diff options
author | Artur Signell <artur@vaadin.com> | 2012-02-07 16:09:21 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-02-07 18:14:42 +0200 |
commit | 6e7f97280a378d42039f94c768f5fcba06edff0d (patch) | |
tree | 42c6636e2878264fcd2100a33d26f8106c603e9d /src | |
parent | 4ccfd5186b932b44bdc1c52f3cf3f1583a034265 (diff) | |
download | vaadin-framework-6e7f97280a378d42039f94c768f5fcba06edff0d.tar.gz vaadin-framework-6e7f97280a378d42039f94c768f5fcba06edff0d.zip |
#8325 Move ApplicationConnection.updateComponent to
VAbstractPaintableWidget.updateFromUIDL
Diffstat (limited to 'src')
45 files changed, 388 insertions, 273 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index bce5534eeb..65827fac0c 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -30,14 +30,11 @@ import com.google.gwt.user.client.Element; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.ui.FocusWidget; -import com.google.gwt.user.client.ui.Focusable; import com.google.gwt.user.client.ui.HasWidgets; import com.google.gwt.user.client.ui.Widget; import com.vaadin.terminal.gwt.client.ApplicationConfiguration.ErrorMessage; import com.vaadin.terminal.gwt.client.RenderInformation.FloatSize; import com.vaadin.terminal.gwt.client.RenderInformation.Size; -import com.vaadin.terminal.gwt.client.ui.Field; import com.vaadin.terminal.gwt.client.ui.VContextMenu; import com.vaadin.terminal.gwt.client.ui.VNotification; import com.vaadin.terminal.gwt.client.ui.VNotification.HideEvent; @@ -66,13 +63,13 @@ public class ApplicationConnection { // This indicates the whole page is generated by us (not embedded) public static final String GENERATED_BODY_CLASSNAME = "v-generated-body"; - private static final String MODIFIED_CLASSNAME = "v-modified"; + public static final String MODIFIED_CLASSNAME = "v-modified"; public static final String DISABLED_CLASSNAME = "v-disabled"; - private static final String REQUIRED_CLASSNAME_EXT = "-required"; + public static final String REQUIRED_CLASSNAME_EXT = "-required"; - private static final String ERROR_CLASSNAME_EXT = "-error"; + public static final String ERROR_CLASSNAME_EXT = "-error"; public static final char VAR_RECORD_SEPARATOR = '\u001e'; @@ -99,9 +96,6 @@ public class ApplicationConnection { public static final String PARAM_UNLOADBURST = "onunloadburst"; - public static final String ATTRIBUTE_DESCRIPTION = "description"; - public static final String ATTRIBUTE_ERROR = "error"; - /** * A string that, if found in a non-JSON response to a UIDL request, will * cause the browser to refresh the page. If followed by a colon, optional @@ -1592,204 +1586,7 @@ public class ApplicationConnection { return result.toString(); } - /** - * Update generic component features. - * - * <h2>Selecting correct implementation</h2> - * - * <p> - * The implementation of a component depends on many properties, including - * styles, component features, etc. Sometimes the user changes those - * properties after the component has been created. Calling this method in - * the beginning of your updateFromUIDL -method automatically replaces your - * component with more appropriate if the requested implementation changes. - * </p> - * - * <h2>Caption, icon, error messages and description</h2> - * - * <p> - * Component can delegate management of caption, icon, error messages and - * description to parent layout. This is optional an should be decided by - * component author - * </p> - * - * <h2>Component visibility and disabling</h2> - * - * This method will manage component visibility automatically and if - * component is an instanceof FocusWidget, also handle component disabling - * when needed. - * - * @param component - * Widget to be updated, expected to implement an instance of - * Paintable - * @param uidl - * UIDL to be painted - * @param manageCaption - * True if you want to delegate caption, icon, description and - * error message management to parent. - * - * @return Returns true iff no further painting is needed by caller - */ - @Deprecated - public boolean updateComponent(VPaintableWidget paintable, UIDL uidl, - boolean manageCaption) { - Widget component = paintable.getWidgetForPaintable(); - - String pid = paintableMap.getPid(paintable); - if (pid == null) { - VConsole.error("Trying to update an unregistered component: " - + Util.getSimpleName(component)); - return true; - } - - // If the server request that a cached instance should be used, do - // nothing - if (uidl.getBooleanAttribute("cached")) { - return true; - } - - // register the listened events by the server-side to the event-handler - // of the component - paintableMap.registerEventListenersFromUIDL(pid, uidl); - - // Visibility - boolean visible = !uidl.getBooleanAttribute("invisible"); - boolean wasVisible = component.isVisible(); - component.setVisible(visible); - if (wasVisible != visible) { - // Changed invisibile <-> visible - if (wasVisible && manageCaption) { - // Must hide caption when component is hidden - paintable.getParent().updateCaption(paintable, uidl); - } - } - - if (configuration.useDebugIdInDOM() && uidl.getId().startsWith("PID_S")) { - DOM.setElementProperty(component.getElement(), "id", uidl.getId() - .substring(5)); - } - - if (!visible) { - // component is invisible, delete old size to notify parent, if - // later make visible - paintableMap.setOffsetSize(paintable, null); - return true; - } - - boolean enabled = !uidl.getBooleanAttribute("disabled"); - if (uidl.hasAttribute("tabindex") && component instanceof Focusable) { - ((Focusable) component).setTabIndex(uidl - .getIntAttribute("tabindex")); - } - /* - * Disabled state may affect (override) tabindex so the order must be - * first setting tabindex, then enabled state. - */ - if (component instanceof FocusWidget) { - FocusWidget fw = (FocusWidget) component; - fw.setEnabled(enabled); - } - - // Style names - component.setStyleName(getStyleName(component.getStylePrimaryName(), - uidl, component instanceof Field)); - - TooltipInfo tooltipInfo = paintableMap.getTooltipInfo(paintable, null); - // Update tooltip - if (uidl.hasAttribute(ATTRIBUTE_DESCRIPTION)) { - tooltipInfo - .setTitle(uidl.getStringAttribute(ATTRIBUTE_DESCRIPTION)); - } else { - tooltipInfo.setTitle(null); - } - - // Set captions - if (manageCaption) { - paintable.getParent().updateCaption(paintable, uidl); - } - - // add error classname to components w/ error - if (uidl.hasAttribute(ATTRIBUTE_ERROR)) { - tooltipInfo.setErrorUidl(uidl.getErrors()); - } else { - tooltipInfo.setErrorUidl(null); - } - - /* - * updateComponentSize need to be after caption update so caption can be - * taken into account - */ - - updateComponentSize(paintable, uidl); - - return false; - } - - /** - * Generates the style name for the widget based on the given primary style - * name (typically returned by Widget.getPrimaryStyleName()) and the UIDL. - * An additional "modified" style name can be added if the field parameter - * is set to true. - * - * @param primaryStyleName - * @param uidl - * @param isField - * @return - */ - public static String getStyleName(String primaryStyleName, UIDL uidl, - boolean field) { - boolean enabled = !uidl.getBooleanAttribute("disabled"); - - StringBuffer styleBuf = new StringBuffer(); - styleBuf.append(primaryStyleName); - - // first disabling and read-only status - if (!enabled) { - styleBuf.append(" "); - styleBuf.append(DISABLED_CLASSNAME); - } - if (uidl.getBooleanAttribute("readonly")) { - styleBuf.append(" "); - styleBuf.append("v-readonly"); - } - - // add additional styles as css classes, prefixed with component default - // stylename - if (uidl.hasAttribute("style")) { - final String[] styles = uidl.getStringAttribute("style").split(" "); - for (int i = 0; i < styles.length; i++) { - styleBuf.append(" "); - styleBuf.append(primaryStyleName); - styleBuf.append("-"); - styleBuf.append(styles[i]); - styleBuf.append(" "); - styleBuf.append(styles[i]); - } - } - - // add modified classname to Fields - if (field && uidl.hasAttribute("modified")) { - styleBuf.append(" "); - styleBuf.append(MODIFIED_CLASSNAME); - } - - // add error classname to components w/ error - if (uidl.hasAttribute(ATTRIBUTE_ERROR)) { - styleBuf.append(" "); - styleBuf.append(primaryStyleName); - styleBuf.append(ERROR_CLASSNAME_EXT); - } - // add required style to required components - if (uidl.hasAttribute("required")) { - styleBuf.append(" "); - styleBuf.append(primaryStyleName); - styleBuf.append(REQUIRED_CLASSNAME_EXT); - } - - return styleBuf.toString(); - } - - private void updateComponentSize(VPaintableWidget paintable, UIDL uidl) { + public void updateComponentSize(VPaintableWidget paintable, UIDL uidl) { String w = uidl.hasAttribute("width") ? uidl .getStringAttribute("width") : ""; diff --git a/src/com/vaadin/terminal/gwt/client/Util.java b/src/com/vaadin/terminal/gwt/client/Util.java index 135ab04c98..fc4d56931c 100644 --- a/src/com/vaadin/terminal/gwt/client/Util.java +++ b/src/com/vaadin/terminal/gwt/client/Util.java @@ -594,6 +594,7 @@ public class Util { } + @Deprecated public static boolean isCached(UIDL uidl) { return uidl.getBooleanAttribute("cached"); } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VAbsoluteLayoutPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VAbsoluteLayoutPaintable.java index 9d73e75b09..75597e27e0 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VAbsoluteLayoutPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VAbsoluteLayoutPaintable.java @@ -35,11 +35,13 @@ public class VAbsoluteLayoutPaintable extends VAbstractPaintableWidgetContainer } }; + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().rendering = true; getWidgetForPaintable().client = client; // TODO margin handling - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { getWidgetForPaintable().rendering = false; return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java b/src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java index 474e9c416d..6813c225d3 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java @@ -3,21 +3,30 @@ */ package com.vaadin.terminal.gwt.client.ui; +import com.google.gwt.user.client.DOM; +import com.google.gwt.user.client.ui.FocusWidget; +import com.google.gwt.user.client.ui.Focusable; import com.google.gwt.user.client.ui.Widget; import com.vaadin.terminal.gwt.client.ApplicationConnection; +import com.vaadin.terminal.gwt.client.TooltipInfo; +import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.VPaintableMap; import com.vaadin.terminal.gwt.client.VPaintableWidget; import com.vaadin.terminal.gwt.client.VPaintableWidgetContainer; public abstract class VAbstractPaintableWidget implements VPaintableWidget { + public static final String ATTRIBUTE_DESCRIPTION = "description"; + public static final String ATTRIBUTE_ERROR = "error"; + private Widget widget; private ApplicationConnection connection; private String id; private VPaintableWidgetContainer parent; - + /* State variables */ private boolean enabled = true; + private boolean visible = true; /** * Default constructor @@ -73,10 +82,6 @@ public abstract class VAbstractPaintableWidget implements VPaintableWidget { this.connection = connection; } - public boolean isEnabled() { - return enabled; - } - public String getId() { return id; } @@ -86,9 +91,10 @@ public abstract class VAbstractPaintableWidget implements VPaintableWidget { } public VPaintableWidgetContainer getParent() { - if (parent != null) + if (parent != null) { return parent; - + } + // FIXME: Hierarchy should be set by framework instead of looked up here VPaintableMap paintableMap = VPaintableMap.get(getConnection()); @@ -96,11 +102,218 @@ public abstract class VAbstractPaintableWidget implements VPaintableWidget { while (w != null) { w = w.getParent(); if (paintableMap.isPaintable(w)) { - parent = (VPaintableWidgetContainer) paintableMap.getPaintable(w); + parent = (VPaintableWidgetContainer) paintableMap + .getPaintable(w); return parent; } } return null; } + + protected static boolean isRealUpdate(UIDL uidl) { + return !isCachedUpdate(uidl) && !uidl.getBooleanAttribute("invisible"); + } + + protected static boolean isCachedUpdate(UIDL uidl) { + return uidl.getBooleanAttribute("cached"); + } + + public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { + if (isCachedUpdate(uidl)) { + return; + } + + VPaintableMap paintableMap = VPaintableMap.get(getConnection()); + // register the listened events by the server-side to the event-handler + // of the component + paintableMap.registerEventListenersFromUIDL(getId(), uidl); + + // Visibility + setVisible(!uidl.getBooleanAttribute("invisible"), uidl); + + if (uidl.getId().startsWith("PID_S")) { + DOM.setElementProperty(getWidgetForPaintable().getElement(), "id", + uidl.getId().substring(5)); + } + + if (!isVisible()) { + // component is invisible, delete old size to notify parent, if + // later made visible + paintableMap.setOffsetSize(this, null); + return; + } + + /* + * Disabled state may affect (override) tabindex so the order must be + * first setting tabindex, then enabled state. + */ + if (uidl.hasAttribute("tabindex") + && getWidgetForPaintable() instanceof Focusable) { + ((Focusable) getWidgetForPaintable()).setTabIndex(uidl + .getIntAttribute("tabindex")); + } + setEnabled(!uidl.getBooleanAttribute("disabled")); + + // Style names + String styleName = getStyleNameFromUIDL(getWidgetForPaintable() + .getStylePrimaryName(), uidl, + getWidgetForPaintable() instanceof Field); + getWidgetForPaintable().setStyleName(styleName); + + // Update tooltip + TooltipInfo tooltipInfo = paintableMap.getTooltipInfo(this, null); + if (uidl.hasAttribute(ATTRIBUTE_DESCRIPTION)) { + tooltipInfo + .setTitle(uidl.getStringAttribute(ATTRIBUTE_DESCRIPTION)); + } else { + tooltipInfo.setTitle(null); + } + // add error info to tooltip if present + if (uidl.hasAttribute(ATTRIBUTE_ERROR)) { + tooltipInfo.setErrorUidl(uidl.getErrors()); + } else { + tooltipInfo.setErrorUidl(null); + } + + // Set captions + if (delegateCaptionHandling()) { + getParent().updateCaption(this, uidl); + } + + /* + * updateComponentSize need to be after caption update so caption can be + * taken into account + */ + + getConnection().updateComponentSize(this, uidl); + } + + /** + * Sets the enabled state of this paintable + * + * @param enabled + * true if the paintable is enabled, false otherwise + */ + protected void setEnabled(boolean enabled) { + this.enabled = enabled; + + if (getWidgetForPaintable() instanceof FocusWidget) { + FocusWidget fw = (FocusWidget) getWidgetForPaintable(); + fw.setEnabled(enabled); + } + + } + + public boolean isEnabled() { + return enabled; + } + + /** + * Return true if parent handles caption, false if the paintable handles the + * caption itself. + * + * + * @deprecated This should always return true and all components should let + * the parent handle the caption and use other attributes for + * internal texts in the component + * @return + */ + @Deprecated + protected boolean delegateCaptionHandling() { + return true; + } + + /** + * Sets the visible state for this paintable. + * + * @param visible + * true if the paintable should be made visible, false otherwise + * @param captionUidl + * The UIDL that is passed to the parent and onwards to VCaption + * if the caption needs to be updated as a result of the + * visibility change. + */ + protected void setVisible(boolean visible, UIDL captionUidl) { + boolean wasVisible = this.visible; + this.visible = visible; + + getWidgetForPaintable().setVisible(visible); + if (wasVisible != visible) { + // Changed invisibile <-> visible + if (wasVisible && delegateCaptionHandling()) { + // Must hide caption when component is hidden + getParent().updateCaption(this, captionUidl); + } + } + } + + protected boolean isVisible() { + return visible; + } + + /** + * Generates the style name for the widget based on the given primary style + * name (typically returned by Widget.getPrimaryStyleName()) and the UIDL. + * An additional "modified" style name can be added if the field parameter + * is set to true. + * + * @param primaryStyleName + * @param uidl + * @param isField + * @return + */ + protected static String getStyleNameFromUIDL(String primaryStyleName, + UIDL uidl, boolean field) { + boolean enabled = !uidl.getBooleanAttribute("disabled"); + + StringBuffer styleBuf = new StringBuffer(); + styleBuf.append(primaryStyleName); + + // first disabling and read-only status + if (!enabled) { + styleBuf.append(" "); + styleBuf.append(ApplicationConnection.DISABLED_CLASSNAME); + } + if (uidl.getBooleanAttribute("readonly")) { + styleBuf.append(" "); + styleBuf.append("v-readonly"); + } + + // add additional styles as css classes, prefixed with component default + // stylename + if (uidl.hasAttribute("style")) { + final String[] styles = uidl.getStringAttribute("style").split(" "); + for (int i = 0; i < styles.length; i++) { + styleBuf.append(" "); + styleBuf.append(primaryStyleName); + styleBuf.append("-"); + styleBuf.append(styles[i]); + styleBuf.append(" "); + styleBuf.append(styles[i]); + } + } + + // add modified classname to Fields + if (field && uidl.hasAttribute("modified")) { + styleBuf.append(" "); + styleBuf.append(ApplicationConnection.MODIFIED_CLASSNAME); + } + + // add error classname to components w/ error + if (uidl.hasAttribute(ATTRIBUTE_ERROR)) { + styleBuf.append(" "); + styleBuf.append(primaryStyleName); + styleBuf.append(ApplicationConnection.ERROR_CLASSNAME_EXT); + } + // add required style to required components + if (uidl.hasAttribute("required")) { + styleBuf.append(" "); + styleBuf.append(primaryStyleName); + styleBuf.append(ApplicationConnection.REQUIRED_CLASSNAME_EXT); + } + + return styleBuf.toString(); + } + } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VAbstractSplitPanelPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VAbstractSplitPanelPaintable.java index 9c7e5f04f9..ccf3119d13 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VAbstractSplitPanelPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VAbstractSplitPanelPaintable.java @@ -64,6 +64,7 @@ public abstract class VAbstractSplitPanelPaintable extends }; + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().client = client; getWidgetForPaintable().id = uidl.getId(); @@ -71,7 +72,8 @@ public abstract class VAbstractSplitPanelPaintable extends getWidgetForPaintable().immediate = uidl.hasAttribute("immediate"); - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { getWidgetForPaintable().rendering = false; return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VAccordionPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VAccordionPaintable.java index 6b03300a09..2ed356127c 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VAccordionPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VAccordionPaintable.java @@ -32,7 +32,7 @@ public class VAccordionPaintable extends VTabsheetBasePaintable { getWidgetForPaintable().selectedUIDLItemIndex); selectedItem.setContent(selectedTabUIDL); - } else if (!uidl.getBooleanAttribute("cached") + } else if (isRealUpdate(uidl) && getWidgetForPaintable().openTab != null) { getWidgetForPaintable().close(getWidgetForPaintable().openTab); } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VAudioPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VAudioPaintable.java index a10c81861b..f978a51bf7 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VAudioPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VAudioPaintable.java @@ -15,10 +15,10 @@ public class VAudioPaintable extends VMediaBasePaintable { @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } - super.updateFromUIDL(uidl, client); Style style = getWidgetForPaintable().getElement().getStyle(); // Make sure that the controls are not clipped if visible. diff --git a/src/com/vaadin/terminal/gwt/client/ui/VButtonPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VButtonPaintable.java index 98f2888700..9d60e21c82 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VButtonPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VButtonPaintable.java @@ -13,11 +13,18 @@ import com.vaadin.terminal.gwt.client.UIDL; public class VButtonPaintable extends VAbstractPaintableWidget { + @Override + protected boolean delegateCaptionHandling() { + return false; + } + + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // Ensure correct implementation, // but don't let container manage caption etc. - if (client.updateComponent(this, uidl, false)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VCheckBoxPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VCheckBoxPaintable.java index 9fee6a8ba6..acbb620361 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VCheckBoxPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VCheckBoxPaintable.java @@ -14,13 +14,20 @@ import com.vaadin.terminal.gwt.client.VTooltip; public class VCheckBoxPaintable extends VAbstractPaintableWidget { + @Override + protected boolean delegateCaptionHandling() { + return false; + } + + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // Save details getWidgetForPaintable().client = client; getWidgetForPaintable().id = uidl.getId(); // Ensure correct implementation - if (client.updateComponent(this, uidl, false)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VCssLayoutPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VCssLayoutPaintable.java index 4d551fa5e8..016474973f 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VCssLayoutPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VCssLayoutPaintable.java @@ -31,10 +31,12 @@ public class VCssLayoutPaintable extends VAbstractPaintableWidgetContainer { } }; + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().rendering = true; - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { getWidgetForPaintable().rendering = false; return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VCustomComponentPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VCustomComponentPaintable.java index 585466f4f7..25289c6adb 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VCustomComponentPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VCustomComponentPaintable.java @@ -15,9 +15,11 @@ import com.vaadin.terminal.gwt.client.VPaintableWidget; public class VCustomComponentPaintable extends VAbstractPaintableWidgetContainer { + @Override public void updateFromUIDL(UIDL uidl, final ApplicationConnection client) { getWidgetForPaintable().rendering = true; - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { getWidgetForPaintable().rendering = false; return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VCustomLayoutPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VCustomLayoutPaintable.java index 9cf877f446..ea3f3c0bc0 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VCustomLayoutPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VCustomLayoutPaintable.java @@ -16,10 +16,12 @@ import com.vaadin.terminal.gwt.client.VPaintableWidget; public class VCustomLayoutPaintable extends VAbstractPaintableWidgetContainer { /** Update the layout from UIDL */ + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().client = client; // ApplicationConnection manages generic component features - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VDateFieldPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VDateFieldPaintable.java index a4bbe64a30..c11ef6f54f 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VDateFieldPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VDateFieldPaintable.java @@ -14,9 +14,11 @@ import com.vaadin.terminal.gwt.client.VConsole; public class VDateFieldPaintable extends VAbstractPaintableWidget { + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // Ensure correct implementation and let layout manage caption - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VDragAndDropWrapperPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VDragAndDropWrapperPaintable.java index 2d2f0fcad3..262d7f0894 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VDragAndDropWrapperPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VDragAndDropWrapperPaintable.java @@ -17,7 +17,7 @@ public class VDragAndDropWrapperPaintable extends VCustomComponentPaintable { public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().client = client; super.updateFromUIDL(uidl, client); - if (!uidl.hasAttribute("cached") && !uidl.hasAttribute("hidden")) { + if (isRealUpdate(uidl) && !uidl.hasAttribute("hidden")) { UIDL acceptCrit = uidl.getChildByTagName("-ac"); if (acceptCrit == null) { getWidgetForPaintable().dropHandler = null; diff --git a/src/com/vaadin/terminal/gwt/client/ui/VEmbeddedPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VEmbeddedPaintable.java index bdb34b6d14..f4a3df7615 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VEmbeddedPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VEmbeddedPaintable.java @@ -28,8 +28,10 @@ public class VEmbeddedPaintable extends VAbstractPaintableWidget { public static final String CLICK_EVENT_IDENTIFIER = "click"; + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelectPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelectPaintable.java index 3249ea17d5..ee8aedd642 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VFilterSelectPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VFilterSelectPaintable.java @@ -21,6 +21,7 @@ public class VFilterSelectPaintable extends VAbstractPaintableWidget { * com.vaadin.terminal.gwt.client.Paintable#updateFromUIDL(com.vaadin.terminal * .gwt.client.UIDL, com.vaadin.terminal.gwt.client.ApplicationConnection) */ + @Override @SuppressWarnings("deprecation") public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // Save details @@ -33,7 +34,8 @@ public class VFilterSelectPaintable extends VAbstractPaintableWidget { getWidgetForPaintable().tb.setEnabled(getWidgetForPaintable().enabled); getWidgetForPaintable().updateReadOnly(); - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFormLayoutPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VFormLayoutPaintable.java index 3be2a028c5..8769466ce4 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VFormLayoutPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VFormLayoutPaintable.java @@ -10,12 +10,14 @@ import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.VPaintableWidget; public class VFormLayoutPaintable extends VAbstractPaintableWidgetContainer { + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().rendering = true; getWidgetForPaintable().client = client; - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { getWidgetForPaintable().rendering = false; return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFormPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VFormPaintable.java index e2533591ea..a15a5b7837 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VFormPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VFormPaintable.java @@ -13,12 +13,19 @@ import com.vaadin.terminal.gwt.client.VPaintableWidget; public class VFormPaintable extends VAbstractPaintableWidgetContainer { + @Override + protected boolean delegateCaptionHandling() { + return false; + } + + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().rendering = true; getWidgetForPaintable().client = client; getWidgetForPaintable().id = uidl.getId(); - if (client.updateComponent(this, uidl, false)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { getWidgetForPaintable().rendering = false; return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VGridLayoutPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VGridLayoutPaintable.java index 8f84f27297..c7e9f79d9a 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VGridLayoutPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VGridLayoutPaintable.java @@ -37,12 +37,14 @@ public class VGridLayoutPaintable extends VAbstractPaintableWidgetContainer { } }; + @Override @SuppressWarnings("unchecked") public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().rendering = true; getWidgetForPaintable().client = client; - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { getWidgetForPaintable().rendering = false; return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VLinkPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VLinkPaintable.java index 3fbd796c4b..6980baa61d 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VLinkPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VLinkPaintable.java @@ -12,11 +12,18 @@ import com.vaadin.terminal.gwt.client.UIDL; public class VLinkPaintable extends VAbstractPaintableWidget { + @Override + protected boolean delegateCaptionHandling() { + return false; + } + + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // Ensure correct implementation, // but don't let container manage caption etc. - if (client.updateComponent(this, uidl, false)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VMediaBasePaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VMediaBasePaintable.java index 1f6bbe6a0a..833922679b 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VMediaBasePaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VMediaBasePaintable.java @@ -21,8 +21,10 @@ public abstract class VMediaBasePaintable extends VAbstractPaintableWidget { public static final String ATTR_HTML = "html"; public static final String ATTR_ALT_TEXT = "alt"; + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VMenuBarPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VMenuBarPaintable.java index ef2a49b9d0..f3e4609540 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VMenuBarPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VMenuBarPaintable.java @@ -22,10 +22,12 @@ public class VMenuBarPaintable extends VAbstractPaintableWidget { * This method is called when the page is loaded for the first time, and * every time UI changes in the component are received from the server. */ + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // This call should be made first. Ensure correct implementation, // and let the containing layout manage caption, etc. - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VNativeButtonPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VNativeButtonPaintable.java index ebf9cad264..b34a9d1335 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VNativeButtonPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VNativeButtonPaintable.java @@ -12,11 +12,18 @@ import com.vaadin.terminal.gwt.client.UIDL; public class VNativeButtonPaintable extends VAbstractPaintableWidget { + @Override + protected boolean delegateCaptionHandling() { + return false; + } + + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // Ensure correct implementation, // but don't let container manage caption etc. - if (client.updateComponent(this, uidl, false)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VOptionGroupBasePaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VOptionGroupBasePaintable.java index 76486ff8a3..b0fbda0875 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VOptionGroupBasePaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VOptionGroupBasePaintable.java @@ -10,13 +10,15 @@ import com.vaadin.terminal.gwt.client.UIDL; public abstract class VOptionGroupBasePaintable extends VAbstractPaintableWidget { + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // Save details getWidgetForPaintable().client = client; getWidgetForPaintable().paintableId = uidl.getId(); - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VOrderedLayoutPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VOrderedLayoutPaintable.java index 6ab1145798..0d9f5c6263 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VOrderedLayoutPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VOrderedLayoutPaintable.java @@ -58,8 +58,7 @@ public abstract class VOrderedLayoutPaintable extends CellBasedLayoutPaintable { super.updateFromUIDL(uidl, client); // Only non-cached, visible UIDL:s can introduce changes - if (uidl.getBooleanAttribute("cached") - || uidl.getBooleanAttribute("invisible")) { + if (!isRealUpdate(uidl) || uidl.getBooleanAttribute("invisible")) { getWidgetForPaintable().isRendering = false; return; } @@ -106,7 +105,7 @@ public abstract class VOrderedLayoutPaintable extends CellBasedLayoutPaintable { * the layout are rendered later when it is clear how much space * they can use */ - if (!Util.isCached(childUIDL)) { + if (isRealUpdate(childUIDL)) { FloatSize relativeSize = Util.parseRelativeSize(childUIDL); childComponentContainer.setRelativeSize(relativeSize); } @@ -125,7 +124,7 @@ public abstract class VOrderedLayoutPaintable extends CellBasedLayoutPaintable { .getWidth()); } if (getWidgetForPaintable().sizeHasChangedDuringRendering - && Util.isCached(childUIDL)) { + && !isRealUpdate(childUIDL)) { // notify cached relative sized component about size // chance client.handleComponentRelativeSize(childComponentContainer @@ -176,7 +175,7 @@ public abstract class VOrderedLayoutPaintable extends CellBasedLayoutPaintable { getWidgetForPaintable().activeLayoutSize.getWidth()); } - if (Util.isCached(childUIDL)) { + if (!isRealUpdate(childUIDL)) { /* * We must update the size of the relative sized component if * the expand ratio or something else in the layout changes diff --git a/src/com/vaadin/terminal/gwt/client/ui/VPanelPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VPanelPaintable.java index df4554ea5e..9c34a68528 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VPanelPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VPanelPaintable.java @@ -26,13 +26,18 @@ public class VPanelPaintable extends VAbstractPaintableWidgetContainer { } }; + @Override + protected boolean delegateCaptionHandling() { + return false; + }; + + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().rendering = true; - if (!uidl.hasAttribute("cached")) { + if (isRealUpdate(uidl)) { // Handle caption displaying and style names, prior generics. - // Affects size - // calculations + // Affects size calculations // Restore default stylenames getWidgetForPaintable().contentNode.setClassName(VPanel.CLASSNAME @@ -78,7 +83,9 @@ public class VPanelPaintable extends VAbstractPaintableWidgetContainer { } } // Ensure correct implementation - if (client.updateComponent(this, uidl, false)) { + super.updateFromUIDL(uidl, client); + + if (!isRealUpdate(uidl)) { getWidgetForPaintable().rendering = false; return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VPopupCalendarPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VPopupCalendarPaintable.java index 96e966a993..042d730738 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VPopupCalendarPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VPopupCalendarPaintable.java @@ -34,7 +34,7 @@ public class VPopupCalendarPaintable extends VTextualDatePaintable { super.updateFromUIDL(uidl, client); - String popupStyleNames = ApplicationConnection.getStyleName( + String popupStyleNames = getStyleNameFromUIDL( VPopupCalendar.POPUP_PRIMARY_STYLE_NAME, uidl, false); popupStyleNames += " " + VDateField.CLASSNAME diff --git a/src/com/vaadin/terminal/gwt/client/ui/VPopupViewPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VPopupViewPaintable.java index cd8965ffc6..11896f7087 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VPopupViewPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VPopupViewPaintable.java @@ -13,16 +13,23 @@ import com.vaadin.terminal.gwt.client.VPaintableWidget; public class VPopupViewPaintable extends VAbstractPaintableWidgetContainer { + @Override + protected boolean delegateCaptionHandling() { + return false; + } + /** * * * @see com.vaadin.terminal.gwt.client.VPaintableWidget#updateFromUIDL(com.vaadin.terminal.gwt.client.UIDL, * com.vaadin.terminal.gwt.client.ApplicationConnection) */ + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // This call should be made first. Ensure correct implementation, // and don't let the containing layout manage caption. - if (client.updateComponent(this, uidl, false)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } // These are for future server connections diff --git a/src/com/vaadin/terminal/gwt/client/ui/VProgressIndicatorPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VProgressIndicatorPaintable.java index 39ffe1ad96..0d7c1624f4 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VProgressIndicatorPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VProgressIndicatorPaintable.java @@ -12,11 +12,13 @@ import com.vaadin.terminal.gwt.client.UIDL; public class VProgressIndicatorPaintable extends VAbstractPaintableWidget { + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // Ensure correct implementation, // but don't let container manage caption etc. - if (client.updateComponent(this, uidl, false)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTablePaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTablePaintable.java index 058b8f15b3..23cf4925f8 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTablePaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTablePaintable.java @@ -23,6 +23,7 @@ public class VScrollTablePaintable extends VAbstractPaintableWidgetContainer { * com.vaadin.terminal.gwt.client.Paintable#updateFromUIDL(com.vaadin.terminal * .gwt.client.UIDL, com.vaadin.terminal.gwt.client.ApplicationConnection) */ + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().rendering = true; @@ -48,7 +49,8 @@ public class VScrollTablePaintable extends VAbstractPaintableWidgetContainer { getWidgetForPaintable().tFoot .setVisible(getWidgetForPaintable().showColFooters); - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { getWidgetForPaintable().rendering = false; return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VSliderPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VSliderPaintable.java index 6c0dc74412..5e32ac873a 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VSliderPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VSliderPaintable.java @@ -12,13 +12,15 @@ import com.vaadin.terminal.gwt.client.UIDL; public class VSliderPaintable extends VAbstractPaintableWidget { + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().client = client; getWidgetForPaintable().id = uidl.getId(); // Ensure correct implementation - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTabsheetBase.java b/src/com/vaadin/terminal/gwt/client/ui/VTabsheetBase.java index 271aed1859..582452988a 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTabsheetBase.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTabsheetBase.java @@ -26,7 +26,6 @@ abstract class VTabsheetBase extends ComplexPanel implements Container { protected boolean disabled; protected boolean readonly; protected Set<String> disabledTabKeys = new HashSet<String>(); - protected boolean cachedUpdate = false; public VTabsheetBase(String classname) { setElement(DOM.createDiv()); diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTabsheetBasePaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VTabsheetBasePaintable.java index 79f6012ed1..f08ffbe145 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTabsheetBasePaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTabsheetBasePaintable.java @@ -15,13 +15,13 @@ import com.vaadin.terminal.gwt.client.VPaintableWidget; public abstract class VTabsheetBasePaintable extends VAbstractPaintableWidgetContainer { + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().client = client; // Ensure correct implementation - getWidgetForPaintable().cachedUpdate = client.updateComponent(this, - uidl, true); - if (getWidgetForPaintable().cachedUpdate) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTabsheetPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VTabsheetPaintable.java index 0d32484e10..29e3e3d95c 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTabsheetPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTabsheetPaintable.java @@ -16,14 +16,14 @@ public class VTabsheetPaintable extends VTabsheetBasePaintable { public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().rendering = true; - if (!uidl.getBooleanAttribute("cached")) { + if (isRealUpdate(uidl)) { // Handle stylename changes before generics (might affect size // calculations) getWidgetForPaintable().handleStyleNames(uidl); } super.updateFromUIDL(uidl, client); - if (getWidgetForPaintable().cachedUpdate) { + if (!isRealUpdate(uidl)) { getWidgetForPaintable().rendering = false; return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTextFieldPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VTextFieldPaintable.java index e3eecd5a09..f7735afc69 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTextFieldPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTextFieldPaintable.java @@ -16,12 +16,14 @@ import com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler.BeforeShortcutAct public class VTextFieldPaintable extends VAbstractPaintableWidget implements BeforeShortcutActionListener { + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // Save details getWidgetForPaintable().client = client; getWidgetForPaintable().paintableId = uidl.getId(); - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTreePaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VTreePaintable.java index 69aecebb06..1a45c7418d 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTreePaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTreePaintable.java @@ -14,9 +14,11 @@ import com.vaadin.terminal.gwt.client.ui.VTree.TreeNode; public class VTreePaintable extends VAbstractPaintableWidget { + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // Ensure correct implementation and let container manage caption - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTwinColSelectPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VTwinColSelectPaintable.java index ce176113da..b0bb1c6844 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTwinColSelectPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTwinColSelectPaintable.java @@ -15,7 +15,7 @@ public class VTwinColSelectPaintable extends VOptionGroupBasePaintable { public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { // Captions are updated before super call to ensure the widths are set // correctly - if (!uidl.getBooleanAttribute("cached")) { + if (isRealUpdate(uidl)) { getWidgetForPaintable().updateCaptions(uidl); } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VUnknownComponentPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VUnknownComponentPaintable.java index 252d7528ca..4773dec0e5 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VUnknownComponentPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VUnknownComponentPaintable.java @@ -12,8 +12,15 @@ import com.vaadin.terminal.gwt.client.VUIDLBrowser; public class VUnknownComponentPaintable extends VAbstractPaintableWidget { + @Override + protected boolean delegateCaptionHandling() { + return false; + } + + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { - if (client.updateComponent(this, uidl, false)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } getWidgetForPaintable().setCaption( diff --git a/src/com/vaadin/terminal/gwt/client/ui/VUploadPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VUploadPaintable.java index 7fd59fc176..d633d8721c 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VUploadPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VUploadPaintable.java @@ -11,8 +11,10 @@ import com.vaadin.terminal.gwt.client.UIDL; public class VUploadPaintable extends VAbstractPaintableWidget { + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } if (uidl.hasAttribute("notStarted")) { diff --git a/src/com/vaadin/terminal/gwt/client/ui/VVideoPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VVideoPaintable.java index 53b79344cf..e46b975da9 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VVideoPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VVideoPaintable.java @@ -13,7 +13,8 @@ public class VVideoPaintable extends VMediaBasePaintable { @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } super.updateFromUIDL(uidl, client); diff --git a/src/com/vaadin/terminal/gwt/client/ui/VViewPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VViewPaintable.java index 94e7bfd9af..890fdd3e13 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VViewPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VViewPaintable.java @@ -31,6 +31,7 @@ public class VViewPaintable extends VAbstractPaintableWidgetContainer { private static final String CLICK_EVENT_IDENTIFIER = VPanelPaintable.CLICK_EVENT_IDENTIFIER; + @Override public void updateFromUIDL(final UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().rendering = true; // As VView is not created in the same way as all other paintables we @@ -143,7 +144,7 @@ public class VViewPaintable extends VAbstractPaintableWidgetContainer { } getWidgetForPaintable().layout.updateFromUIDL(childUidl, client); - if (!childUidl.getBooleanAttribute("cached")) { + if (isRealUpdate(childUidl)) { getWidgetForPaintable().updateParentFrameSize(); } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VWindowPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VWindowPaintable.java index 633e28d0c3..e77aefc25b 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VWindowPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VWindowPaintable.java @@ -33,6 +33,12 @@ public class VWindowPaintable extends VAbstractPaintableWidgetContainer } }; + @Override + protected boolean delegateCaptionHandling() { + return false; + }; + + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().id = uidl.getId(); getWidgetForPaintable().client = client; @@ -47,7 +53,7 @@ public class VWindowPaintable extends VAbstractPaintableWidgetContainer return; } - if (!uidl.hasAttribute("cached")) { + if (isRealUpdate(uidl)) { if (uidl.getBooleanAttribute("modal") != getWidgetForPaintable().vaadinModality) { getWidgetForPaintable().setVaadinModality( !getWidgetForPaintable().vaadinModality); @@ -75,7 +81,8 @@ public class VWindowPaintable extends VAbstractPaintableWidgetContainer } getWidgetForPaintable().visibilityChangesDisabled = true; - if (client.updateComponent(this, uidl, false)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } getWidgetForPaintable().visibilityChangesDisabled = false; diff --git a/src/com/vaadin/terminal/gwt/client/ui/label/VLabelPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/label/VLabelPaintable.java index c57f705c75..b61eb3eaba 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/label/VLabelPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/label/VLabelPaintable.java @@ -16,8 +16,10 @@ public class VLabelPaintable extends VAbstractPaintableWidget { public VLabelPaintable() { } + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/layout/CellBasedLayoutPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/layout/CellBasedLayoutPaintable.java index c41652fb3d..752462dcf6 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/layout/CellBasedLayoutPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/layout/CellBasedLayoutPaintable.java @@ -11,11 +11,12 @@ import com.vaadin.terminal.gwt.client.ui.VMarginInfo; public abstract class CellBasedLayoutPaintable extends VAbstractPaintableWidgetContainer { + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().client = client; // Only non-cached UIDL:s can introduce changes - if (uidl.getBooleanAttribute("cached")) { + if (isCachedUpdate(uidl)) { return; } @@ -30,9 +31,7 @@ public abstract class CellBasedLayoutPaintable extends * This call should be made first. Ensure correct implementation, handle * size etc. */ - if (client.updateComponent(this, uidl, true)) { - return; - } + super.updateFromUIDL(uidl, client); handleDynamicDimensions(uidl); } diff --git a/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextAreaPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextAreaPaintable.java index ec83f294f2..9ade007d2e 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextAreaPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/richtextarea/VRichTextAreaPaintable.java @@ -14,6 +14,7 @@ import com.vaadin.terminal.gwt.client.ui.VAbstractPaintableWidget; public class VRichTextAreaPaintable extends VAbstractPaintableWidget implements BeforeShortcutActionListener { + @Override public void updateFromUIDL(final UIDL uidl, ApplicationConnection client) { getWidgetForPaintable().client = client; getWidgetForPaintable().id = uidl.getId(); @@ -29,12 +30,13 @@ public class VRichTextAreaPaintable extends VAbstractPaintableWidget implements .setHTML(getWidgetForPaintable().currentValue); } } - if (!uidl.hasAttribute("cached")) { + if (isRealUpdate(uidl)) { getWidgetForPaintable().setEnabled( !uidl.getBooleanAttribute("disabled")); } - if (client.updateComponent(this, uidl, true)) { + super.updateFromUIDL(uidl, client); + if (!isRealUpdate(uidl)) { return; } |