Mercurial > hg > STI-GWT
view src/econnect/wp3_3/client/widgets/table/StiTable.java @ 40:20eb7596d466 CellTable
Preparation for a switch to a CellTable.
This is work in progress.
author | Sebastian Kruse <skruse@mpiwg-berlin.mpg.de> |
---|---|
date | Thu, 06 Dec 2012 18:05:39 +0100 |
parents | fef6080e83ad |
children |
line wrap: on
line source
package econnect.wp3_3.client.widgets.table; import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.user.client.ui.TabPanel; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.Grid; import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.RootPanel; import econnect.wp3_3.client.core.StiCore; /** * Implementation of the table widget */ public class StiTable extends TabPanel { /** * An array of dynamic tables - one for each tab */ private DynamicStiTable[] dataTables; /** * The sti core component to allow interactions between the different objects */ private StiCore core; /** * Constructor for the table widget * * @param core object to allow interaction with all components */ public StiTable( StiCore core ){ this.core = core; this.dataTables = new DynamicStiTable[0]; this.setStyleName("baseTable"); this.setVisible(false); //RootPanel.get("tableWindow").add(this); } /** * method called from javascript source if selection of elements has changed * * @param hover if there was a hover selection or not */ public void updateTables(boolean hover){ for( int i=0; i<this.dataTables.length; i++ ){ this.dataTables[i].updateView(hover); } } /** * method called from javascript source if tables need to be initialized */ public void initTables(){ int sets = this.core.getDataSets().length(); this.dataTables = new DynamicStiTable[sets]; this.clear(); for( int i=0; i<sets; i++ ){ this.dataTables[i] = new DynamicStiTable(this.core, i); Grid tabLabel = new Grid(1,2); tabLabel.setWidget(0,0,new Image( "images/square"+(core.getColorId(i))+".png" )); tabLabel.setWidget(0,1,new Label(this.dataTables[i].getTermIdentifier())); String header = tabLabel.toString(); this.add(this.dataTables[i],header,true); } this.selectTab(sets-1); if( sets > 0 ){ this.setVisible(true); } else { this.setVisible(false); } } public void setTop(int top) { this.getElement().getStyle().setMarginTop(top, Unit.PX); } }