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.

VTabsheetPaintable.java 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. @VaadinApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.terminal.gwt.client.ui;
  5. import com.google.gwt.core.client.GWT;
  6. import com.google.gwt.user.client.DOM;
  7. import com.google.gwt.user.client.ui.Widget;
  8. import com.vaadin.terminal.gwt.client.ApplicationConnection;
  9. import com.vaadin.terminal.gwt.client.UIDL;
  10. import com.vaadin.terminal.gwt.client.VPaintableWidget;
  11. public class VTabsheetPaintable extends VTabsheetBasePaintable {
  12. @Override
  13. public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
  14. getWidgetForPaintable().rendering = true;
  15. if (isRealUpdate(uidl)) {
  16. // Handle stylename changes before generics (might affect size
  17. // calculations)
  18. getWidgetForPaintable().handleStyleNames(uidl);
  19. }
  20. super.updateFromUIDL(uidl, client);
  21. if (!isRealUpdate(uidl)) {
  22. getWidgetForPaintable().rendering = false;
  23. return;
  24. }
  25. // tabs; push or not
  26. if (!getWidgetForPaintable().isDynamicWidth()) {
  27. // FIXME: This makes tab sheet tabs go to 1px width on every update
  28. // and then back to original width
  29. // update width later, in updateTabScroller();
  30. DOM.setStyleAttribute(getWidgetForPaintable().tabs, "width", "1px");
  31. DOM.setStyleAttribute(getWidgetForPaintable().tabs, "overflow",
  32. "hidden");
  33. } else {
  34. getWidgetForPaintable().showAllTabs();
  35. DOM.setStyleAttribute(getWidgetForPaintable().tabs, "width", "");
  36. DOM.setStyleAttribute(getWidgetForPaintable().tabs, "overflow",
  37. "visible");
  38. getWidgetForPaintable().updateDynamicWidth();
  39. }
  40. if (!getWidgetForPaintable().isDynamicHeight()) {
  41. // Must update height after the styles have been set
  42. getWidgetForPaintable().updateContentNodeHeight();
  43. getWidgetForPaintable().updateOpenTabSize();
  44. }
  45. getWidgetForPaintable().iLayout();
  46. // Re run relative size update to ensure optimal scrollbars
  47. // TODO isolate to situation that visible tab has undefined height
  48. try {
  49. client.handleComponentRelativeSize(getWidgetForPaintable().tp
  50. .getWidget(getWidgetForPaintable().tp.getVisibleWidget()));
  51. } catch (Exception e) {
  52. // Ignore, most likely empty tabsheet
  53. }
  54. getWidgetForPaintable().renderInformation
  55. .updateSize(getWidgetForPaintable().getElement());
  56. getWidgetForPaintable().waitingForResponse = false;
  57. getWidgetForPaintable().rendering = false;
  58. }
  59. @Override
  60. protected Widget createWidget() {
  61. return GWT.create(VTabsheet.class);
  62. }
  63. @Override
  64. public VTabsheet getWidgetForPaintable() {
  65. return (VTabsheet) super.getWidgetForPaintable();
  66. }
  67. public void updateCaption(VPaintableWidget component, UIDL uidl) {
  68. /* Tabsheet does not render its children's captions */
  69. }
  70. }