diff options
author | Artur Signell <artur.signell@itmill.com> | 2008-11-03 14:52:38 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2008-11-03 14:52:38 +0000 |
commit | ad15749aedb2f07f98b86c32ce558a08ae15a289 (patch) | |
tree | e7029cef50921539b1946a46fdeb6f3faf477196 /src/com/itmill/toolkit/tests/tickets/Ticket2061c.java | |
parent | 3e0f4b5ab9852221d6495da76cf8029206b303cc (diff) | |
download | vaadin-framework-ad15749aedb2f07f98b86c32ce558a08ae15a289.tar.gz vaadin-framework-ad15749aedb2f07f98b86c32ce558a08ae15a289.zip |
Fixes #2061 for Tabsheets - Changing tab should no longer flicker in FF
svn changeset:5801/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/tests/tickets/Ticket2061c.java')
-rw-r--r-- | src/com/itmill/toolkit/tests/tickets/Ticket2061c.java | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/tests/tickets/Ticket2061c.java b/src/com/itmill/toolkit/tests/tickets/Ticket2061c.java new file mode 100644 index 0000000000..421d434c54 --- /dev/null +++ b/src/com/itmill/toolkit/tests/tickets/Ticket2061c.java @@ -0,0 +1,149 @@ +package com.itmill.toolkit.tests.tickets; + +import com.itmill.toolkit.Application; +import com.itmill.toolkit.data.Item; +import com.itmill.toolkit.data.Property.ValueChangeEvent; +import com.itmill.toolkit.data.Property.ValueChangeListener; +import com.itmill.toolkit.data.util.HierarchicalContainer; +import com.itmill.toolkit.ui.Accordion; +import com.itmill.toolkit.ui.Component; +import com.itmill.toolkit.ui.CustomComponent; +import com.itmill.toolkit.ui.ExpandLayout; +import com.itmill.toolkit.ui.Label; +import com.itmill.toolkit.ui.OrderedLayout; +import com.itmill.toolkit.ui.Panel; +import com.itmill.toolkit.ui.TabSheet; +import com.itmill.toolkit.ui.Table; +import com.itmill.toolkit.ui.Window; +import com.itmill.toolkit.ui.TabSheet.SelectedTabChangeEvent; +import com.itmill.toolkit.ui.TabSheet.SelectedTabChangeListener; + +public class Ticket2061c extends Application implements + SelectedTabChangeListener { + + private Window mainWindow; + private Panel p; + + @Override + public void init() { + mainWindow = new Window("It Mill"); + mainWindow.setSizeFull(); + mainWindow.getLayout().setSizeFull(); + setMainWindow(mainWindow); + + OrderedLayout ol = new OrderedLayout(); + ol.setWidth("200px"); + ol.setHeight("200px"); + + OrderedLayout ol2 = new OrderedLayout(); + ol2.setSizeFull(); + + p = new Panel("This is a panel"); + p.setSizeFull(); + + Label label1 = new Label("This is a table!"); + label1.setHeight("1500px"); + label1.setWidth("1500px"); + p.setScrollTop(50); + + p.addComponent(label1); + ol2.addComponent(p); + ol.addComponent(ol2); + + Label a = new Label("abc123"); + a.setCaption("Label a"); + ol.setCaption("OL"); + Tabs tab = new Tabs(new Component[] { a, ol }); + tab.addListener(this); + mainWindow.addComponent(tab); + + } + + public class MyTable extends CustomComponent implements ValueChangeListener { + + private Table table = new Table(); + private String[] columns; + private ExpandLayout layout = new ExpandLayout(); + + public MyTable(int columnNumber, String id) { + setDebugId(id); + setCompositionRoot(layout); + setSizeFull(); + columns = initializeColumns(columnNumber); + table.setWidth("100%"); + table.setHeight("100%"); + table.setColumnReorderingAllowed(true); + table.setColumnCollapsingAllowed(true); + table.setSelectable(true); + table.setMultiSelect(false); + table.setNullSelectionAllowed(false); + // table.setRowHeaderMode(Table.ROW_HEADER_MODE_ID); + table.addListener(this); + table.setContainerDataSource(createContainer()); + layout.addComponent(table); + } + + public void loadTable(int itemNumber) { + table.removeAllItems(); + for (int j = 0; j < itemNumber; j++) { + Item rowItem = table.addItem(j); + if (rowItem != null) { + for (int i = 0; i < columns.length; i++) { + rowItem.getItemProperty(columns[i]).setValue( + "Value" + j); + } + } + } + } + + private HierarchicalContainer createContainer() { + final HierarchicalContainer c = new HierarchicalContainer(); + for (int i = 0; i < columns.length; i++) { + c.addContainerProperty(columns[i], String.class, null); + } + return c; + } + + private String[] initializeColumns(int number) { + String[] columns = new String[number]; + for (int i = 0; i < number; i++) { + columns[i] = "Column" + i; + } + return columns; + } + + public void valueChange(ValueChangeEvent event) { + + } + + } + + public class Tabs extends TabSheet { + + public Tabs(Component[] components) { + this.setWidth("100%"); + // this.setHeight("100%"); + for (int i = 0; i < components.length; i++) { + this.addTab(components[i], components[i].getDebugId(), null); + } + } + } + + public class MyAccordion extends Accordion { + + public MyAccordion(Component[] components, String id) { + this.setWidth("100%"); + this.setHeight("100%"); + setDebugId(id); + for (int i = 0; i < components.length; i++) { + this.addTab(components[i], components[i].getDebugId(), null); + } + } + } + + public void selectedTabChange(SelectedTabChangeEvent event) { + p.setScrollTop(10); + + } + +} |