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;
// 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';
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
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") : "";
}
+ @Deprecated
public static boolean isCached(UIDL uidl) {
return uidl.getBooleanAttribute("cached");
}
}
};
+ @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;
}
*/
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
this.connection = connection;
}
- public boolean isEnabled() {
- return enabled;
- }
-
public String getId() {
return id;
}
}
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());
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();
+ }
+
}
};
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
getWidgetForPaintable().client = client;
getWidgetForPaintable().id = uidl.getId();
getWidgetForPaintable().immediate = uidl.hasAttribute("immediate");
- if (client.updateComponent(this, uidl, true)) {
+ super.updateFromUIDL(uidl, client);
+ if (!isRealUpdate(uidl)) {
getWidgetForPaintable().rendering = false;
return;
}
getWidgetForPaintable().selectedUIDLItemIndex);
selectedItem.setContent(selectedTabUIDL);
- } else if (!uidl.getBooleanAttribute("cached")
+ } else if (isRealUpdate(uidl)
&& getWidgetForPaintable().openTab != null) {
getWidgetForPaintable().close(getWidgetForPaintable().openTab);
}
@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.
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;
}
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;
}
}
};
+ @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;
}
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;
}
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;
}
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;
}
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;
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;
}
* 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
getWidgetForPaintable().tb.setEnabled(getWidgetForPaintable().enabled);
getWidgetForPaintable().updateReadOnly();
- if (client.updateComponent(this, uidl, true)) {
+ super.updateFromUIDL(uidl, client);
+ if (!isRealUpdate(uidl)) {
return;
}
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;
}
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;
}
}
};
+ @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;
}
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;
}
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;
}
* 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;
}
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;
}
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;
}
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;
}
* 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);
}
.getWidth());
}
if (getWidgetForPaintable().sizeHasChangedDuringRendering
- && Util.isCached(childUIDL)) {
+ && !isRealUpdate(childUIDL)) {
// notify cached relative sized component about size
// chance
client.handleComponentRelativeSize(childComponentContainer
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
}
};
+ @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
}
}
// Ensure correct implementation
- if (client.updateComponent(this, uidl, false)) {
+ super.updateFromUIDL(uidl, client);
+
+ if (!isRealUpdate(uidl)) {
getWidgetForPaintable().rendering = false;
return;
}
super.updateFromUIDL(uidl, client);
- String popupStyleNames = ApplicationConnection.getStyleName(
+ String popupStyleNames = getStyleNameFromUIDL(
VPopupCalendar.POPUP_PRIMARY_STYLE_NAME, uidl, false);
popupStyleNames += " "
+ VDateField.CLASSNAME
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
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;
}
* 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;
getWidgetForPaintable().tFoot
.setVisible(getWidgetForPaintable().showColFooters);
- if (client.updateComponent(this, uidl, true)) {
+ super.updateFromUIDL(uidl, client);
+ if (!isRealUpdate(uidl)) {
getWidgetForPaintable().rendering = false;
return;
}
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;
}
protected boolean disabled;
protected boolean readonly;
protected Set<String> disabledTabKeys = new HashSet<String>();
- protected boolean cachedUpdate = false;
public VTabsheetBase(String classname) {
setElement(DOM.createDiv());
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;
}
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;
}
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;
}
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;
}
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);
}
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(
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")) {
@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);
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
}
getWidgetForPaintable().layout.updateFromUIDL(childUidl, client);
- if (!childUidl.getBooleanAttribute("cached")) {
+ if (isRealUpdate(childUidl)) {
getWidgetForPaintable().updateParentFrameSize();
}
}
};
+ @Override
+ protected boolean delegateCaptionHandling() {
+ return false;
+ };
+
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
getWidgetForPaintable().id = uidl.getId();
getWidgetForPaintable().client = client;
return;
}
- if (!uidl.hasAttribute("cached")) {
+ if (isRealUpdate(uidl)) {
if (uidl.getBooleanAttribute("modal") != getWidgetForPaintable().vaadinModality) {
getWidgetForPaintable().setVaadinModality(
!getWidgetForPaintable().vaadinModality);
}
getWidgetForPaintable().visibilityChangesDisabled = true;
- if (client.updateComponent(this, uidl, false)) {
+ super.updateFromUIDL(uidl, client);
+ if (!isRealUpdate(uidl)) {
return;
}
getWidgetForPaintable().visibilityChangesDisabled = false;
public VLabelPaintable() {
}
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- if (client.updateComponent(this, uidl, true)) {
+ super.updateFromUIDL(uidl, client);
+ if (!isRealUpdate(uidl)) {
return;
}
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;
}
* 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);
}
public class VRichTextAreaPaintable extends VAbstractPaintableWidget implements
BeforeShortcutActionListener {
+ @Override
public void updateFromUIDL(final UIDL uidl, ApplicationConnection client) {
getWidgetForPaintable().client = client;
getWidgetForPaintable().id = uidl.getId();
.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;
}
public class VMyDragSourcePaintable extends VAbstractPaintableWidget {
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- if (client.updateComponent(this, uidl, true)) {
+ super.updateFromUIDL(uidl, client);
+ if (!isRealUpdate(uidl)) {
return;
}
}
public class VMyDropTargetPaintable extends VAbstractPaintableWidget {
+ @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- if (client.updateComponent(this, uidl, true)) {
+ super.updateFromUIDL(uidl, client);
+ if (!isRealUpdate(uidl)) {
return;
}
getWidgetForPaintable().client = client;