comparison src/econnect/wp3_3/client/widgets/table/StiTable.java @ 3:cf06b77a8bbd

Committed branch of the e4D repos sti-gwt branch 16384. git-svn-id: http://dev.dariah.eu/svn/repos/eu.dariah.de/ap1/sti-gwt-dariah-geobrowser@36 f2b5be40-def6-11e0-8a09-b3c1cc336c6b
author StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
date Tue, 17 Jul 2012 13:34:40 +0000
parents
children fef6080e83ad
comparison
equal deleted inserted replaced
2:2897af43ccc6 3:cf06b77a8bbd
1 package econnect.wp3_3.client.widgets.table;
2
3 import com.google.gwt.dom.client.Style.Unit;
4 import com.google.gwt.user.client.ui.TabPanel;
5 import com.google.gwt.user.client.ui.Label;
6 import com.google.gwt.user.client.ui.Grid;
7 import com.google.gwt.user.client.ui.Image;
8 import com.google.gwt.user.client.ui.RootPanel;
9
10 import econnect.wp3_3.client.core.StiCore;
11
12 /**
13 * Implementation of the table widget
14 */
15 public class StiTable extends TabPanel {
16
17 /**
18 * An array of dynamic tables - one for each tab
19 */
20 private DynamicStiTable[] dataTables;
21
22 /**
23 * The sti core component to allow interactions between the different objects
24 */
25 private StiCore core;
26
27 /**
28 * Constructor for the table widget
29 *
30 * @param core object to allow interaction with all components
31 */
32 public StiTable( StiCore core ){
33 this.core = core;
34 this.dataTables = new DynamicStiTable[0];
35 this.setStyleName("baseTable");
36 this.setVisible(false);
37 RootPanel.get("tableWindow").add(this);
38 }
39
40 /**
41 * method called from javascript source if selection of elements has changed
42 *
43 * @param hover if there was a hover selection or not
44 */
45 public void updateTables(boolean hover){
46 for( int i=0; i<this.dataTables.length; i++ ){
47 this.dataTables[i].updateView(hover);
48 }
49 }
50
51 /**
52 * method called from javascript source if tables need to be initialized
53 */
54 public void initTables(){
55 int sets = this.core.getDataSets().length();
56 this.dataTables = new DynamicStiTable[sets];
57 this.clear();
58 for( int i=0; i<sets; i++ ){
59 this.dataTables[i] = new DynamicStiTable(this.core, i);
60 Grid tabLabel = new Grid(1,2);
61 tabLabel.setWidget(0,0,new Image( "images/square"+(core.getColorId(i))+".png" ));
62 tabLabel.setWidget(0,1,new Label(this.dataTables[i].getTermIdentifier()));
63 String header = tabLabel.toString();
64 this.add(this.dataTables[i],header,true);
65 }
66 this.selectTab(sets-1);
67 if( sets > 0 ){
68 this.setVisible(true);
69 }
70 else {
71 this.setVisible(false);
72 }
73 }
74
75 public void setTop(int top) {
76 this.getElement().getStyle().setMarginTop(top, Unit.PX);
77 }
78
79 }