You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

VTabsheetBase.java 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. @VaadinApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.terminal.gwt.client.ui;
  5. import java.util.ArrayList;
  6. import java.util.HashSet;
  7. import java.util.Iterator;
  8. import java.util.Set;
  9. import com.google.gwt.user.client.DOM;
  10. import com.google.gwt.user.client.ui.ComplexPanel;
  11. import com.google.gwt.user.client.ui.Widget;
  12. import com.vaadin.terminal.gwt.client.ApplicationConnection;
  13. import com.vaadin.terminal.gwt.client.Container;
  14. import com.vaadin.terminal.gwt.client.UIDL;
  15. import com.vaadin.terminal.gwt.client.VPaintableWidget;
  16. abstract class VTabsheetBase extends ComplexPanel implements Container {
  17. String id;
  18. ApplicationConnection client;
  19. protected final ArrayList<String> tabKeys = new ArrayList<String>();
  20. protected int activeTabIndex = 0;
  21. protected boolean disabled;
  22. protected boolean readonly;
  23. protected Set<String> disabledTabKeys = new HashSet<String>();
  24. public VTabsheetBase(String classname) {
  25. setElement(DOM.createDiv());
  26. setStyleName(classname);
  27. }
  28. /**
  29. * @return a list of currently shown Paintables
  30. *
  31. * Apparently can be something else than Paintable as
  32. * {@link #updateFromUIDL(UIDL, ApplicationConnection)} checks if
  33. * instanceof Paintable. Therefore set to <Object>
  34. */
  35. abstract protected Iterator<Widget> getWidgetIterator();
  36. /**
  37. * Clears current tabs and contents
  38. */
  39. abstract protected void clearPaintables();
  40. /**
  41. * Implement in extending classes. This method should render needed elements
  42. * and set the visibility of the tab according to the 'selected' parameter.
  43. */
  44. protected abstract void renderTab(final UIDL tabUidl, int index,
  45. boolean selected, boolean hidden);
  46. /**
  47. * Implement in extending classes. This method should render any previously
  48. * non-cached content and set the activeTabIndex property to the specified
  49. * index.
  50. */
  51. protected abstract void selectTab(int index, final UIDL contentUidl);
  52. /**
  53. * Implement in extending classes. This method should return the number of
  54. * tabs currently rendered.
  55. */
  56. protected abstract int getTabCount();
  57. /**
  58. * Implement in extending classes. This method should return the Paintable
  59. * corresponding to the given index.
  60. */
  61. protected abstract VPaintableWidget getTab(int index);
  62. /**
  63. * Implement in extending classes. This method should remove the rendered
  64. * tab with the specified index.
  65. */
  66. protected abstract void removeTab(int index);
  67. }