*
* @param connector
* Child component for which service is requested.
- * @param uidl
- * UIDL of the child component.
*/
- void updateCaption(ComponentConnector connector, UIDL uidl);
+ void updateCaption(ComponentConnector connector);
/**
* Returns the children for this connector.
* This method may only be called when the caption has an owner - otherwise,
* use {@link #updateCaptionWithoutOwner(UIDL, String, boolean, boolean)}.
*
- * @param uidl
* @return true if the position where the caption should be placed has
* changed
*/
- public boolean updateCaption(UIDL uidl) {
- setVisible(!uidl.getBooleanAttribute("invisible"));
-
+ public boolean updateCaption() {
boolean wasPlacedAfterComponent = placedAfterComponent;
// Caption is placed after component unless there is some part which
showError = showError && !abstractFieldState.isHideErrors();
}
if (owner instanceof AbstractFieldConnector) {
- showRequired = ((AbstractFieldConnector) owner)
- .isRequired();
+ showRequired = ((AbstractFieldConnector) owner).isRequired();
}
if (hasIcon) {
}
@Deprecated
- public boolean updateCaptionWithoutOwner(UIDL uidl, String caption,
- boolean disabled, boolean hasDescription, String iconURL) {
- // TODO temporary method, needed because some tabsheet and accordion
- // internal captions do not have an owner or shared state. Simplified to
- // only support those cases
- setVisible(!uidl.getBooleanAttribute("invisible"));
-
+ public boolean updateCaptionWithoutOwner(String caption, boolean disabled,
+ boolean hasDescription, String iconURL) {
boolean wasPlacedAfterComponent = placedAfterComponent;
// Caption is placed after component unless there is some part which
}
}
- public static boolean isNeeded(UIDL uidl, ComponentState state) {
- if (state != null) {
- if (state.getCaption() != null) {
- return true;
- }
- if (state.getIcon() != null) {
- return true;
- }
- if (state.getErrorMessage() != null) {
- return true;
- }
- } else {
- // TODO fallback for cases where the caption has no owner (Tabsheet,
- // Accordion)
- if (uidl.getStringAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_CAPTION) != null) {
- return true;
- }
- if (uidl.hasAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_ICON)) {
- return true;
- }
+ @Deprecated
+ public static boolean isNeeded(UIDL uidl) {
+ // TODO fallback for cases where the caption has no owner (Tabsheet,
+ // Accordion)
+ if (uidl.getStringAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_CAPTION) != null) {
+ return true;
+ }
+ if (uidl.hasAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_ICON)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public static boolean isNeeded(ComponentState state) {
+ if (state.getCaption() != null) {
+ return true;
+ }
+ if (state.getIcon() != null) {
+ return true;
+ }
+ if (state.getErrorMessage() != null) {
+ return true;
}
return false;
setStyleName(CLASSNAME);
}
- public void updateCaption(UIDL uidl) {
- caption.updateCaption(uidl);
- setVisible(!uidl.getBooleanAttribute("invisible"));
+ public void updateCaption() {
+ caption.updateCaption();
}
public ComponentConnector getPaintable() {
}
}
- public void updateCaption(ComponentConnector component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component) {
AbsoluteWrapper parent2 = (AbsoluteWrapper) (component.getWidget())
.getParent();
- parent2.updateCaption(uidl);
+ parent2.updateCaption();
}
@Override
private Widget widget;
- /* State variables */
- private boolean visible = true;
-
// shared state from the server to the client
private ComponentState state;
}
ConnectorMap paintableMap = ConnectorMap.get(getConnection());
- // Visibility
- setVisible(!uidl.getBooleanAttribute("invisible"), uidl);
if (getState().getDebugId() != null) {
getWidget().getElement().setId(getState().getDebugId());
if (delegateCaptionHandling()) {
ComponentContainerConnector parent = getParent();
if (parent != null) {
- parent.updateCaption(this, uidl);
+ parent.updateCaption(this);
} else {
VConsole.error("Parent of connector "
+ getClass().getName()
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;
-
- getWidget().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
getWidget().spacingMeasureElement);
}
- public void updateCaption(ComponentConnector component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component) {
VMeasuringOrderedLayout layout = getWidget();
- if (VCaption.isNeeded(uidl, component.getState())) {
+ if (VCaption.isNeeded(component.getState())) {
VLayoutSlot layoutSlot = layout.getSlotForChild(component
.getWidget());
VCaption caption = layoutSlot.getCaption();
layout.setCaption(widget, caption);
}
- caption.updateCaption(uidl);
+ caption.updateCaption();
} else {
layout.setCaption(component.getWidget(), null);
getLayoutManager().setNeedsUpdate(this);
public static final String SPLITTER_CLICK_EVENT_IDENTIFIER = "sp_click";
- public void updateCaption(ComponentConnector component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component) {
// TODO Implement caption handling
}
return GWT.create(VAccordion.class);
}
- public void updateCaption(ComponentConnector component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component) {
/* Accordion does not render its children's captions */
}
return GWT.create(VCssLayout.class);
}
- public void updateCaption(ComponentConnector component, UIDL uidl) {
- getWidget().panel.updateCaption(component, uidl);
+ public void updateCaption(ComponentConnector component) {
+ getWidget().panel.updateCaption(component);
}
}
return (VCustomComponent) super.getWidget();
}
- public void updateCaption(ComponentConnector component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component) {
// NOP, custom component dont render composition roots caption
}
return GWT.create(VCustomLayout.class);
}
- public void updateCaption(ComponentConnector paintable, UIDL uidl) {
- getWidget().updateCaption(paintable, uidl);
+ public void updateCaption(ComponentConnector paintable) {
+ getWidget().updateCaption(paintable);
}
}
if (null != getState().getErrorMessage()) {
- getWidget().errorMessage.updateMessage(getState()
- .getErrorMessage());
+ getWidget().errorMessage
+ .updateMessage(getState().getErrorMessage());
getWidget().errorMessage.setVisible(true);
} else {
getWidget().errorMessage.setVisible(false);
}
}
- public void updateCaption(ComponentConnector component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component) {
// NOP form don't render caption for neither field layout nor footer
// layout
}
getWidget().table.updateFromUIDL(uidl, client);
}
- public void updateCaption(ComponentConnector component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component) {
final Caption c = getWidget().table.widgetToCaption.get(component
.getWidget());
if (c != null) {
- c.updateCaption(uidl, component.getState(), component.isEnabled());
+ c.updateCaption(component.getState(), component.isEnabled());
}
final ErrorFlag e = getWidget().table.widgetToError.get(component
.getWidget());
if (e != null) {
- e.updateFromUIDL(uidl, component);
+ e.updateFromUIDL(component);
}
}
getLayoutManager().setNeedsUpdate(this);
}
- public void updateCaption(ComponentConnector paintable, UIDL uidl) {
+ public void updateCaption(ComponentConnector paintable) {
VGridLayout layout = getWidget();
- if (VCaption.isNeeded(uidl, paintable.getState())) {
+ if (VCaption.isNeeded(paintable.getState())) {
Cell cell = layout.widgetToCell.get(paintable.getWidget());
VLayoutSlot layoutSlot = cell.slot;
VCaption caption = layoutSlot.getCaption();
layout.setCaption(widget, caption);
}
- caption.updateCaption(uidl);
+ caption.updateCaption();
} else {
layout.setCaption(paintable.getWidget(), null);
}
getWidget().contentNode.setTabIndex(getState().getTabIndex());
}
- public void updateCaption(ComponentConnector component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component) {
// NOP: layouts caption, errors etc not rendered in Panel
}
}
}// updateFromUIDL
- public void updateCaption(ComponentConnector component, UIDL uidl) {
- if (VCaption.isNeeded(uidl, component.getState())) {
+ public void updateCaption(ComponentConnector component) {
+ if (VCaption.isNeeded(component.getState())) {
if (getWidget().popup.captionWrapper != null) {
- getWidget().popup.captionWrapper.updateCaption(uidl);
+ getWidget().popup.captionWrapper.updateCaption();
} else {
getWidget().popup.captionWrapper = new VCaptionWrapper(
component, getConnection());
getWidget().popup.setWidget(getWidget().popup.captionWrapper);
- getWidget().popup.captionWrapper.updateCaption(uidl);
+ getWidget().popup.captionWrapper.updateCaption();
}
} else {
if (getWidget().popup.captionWrapper != null) {
}
};
- public void updateCaption(ComponentConnector component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component) {
// NOP The main view never draws caption for its layout
}
return (VScrollTable) super.getWidget();
}
- public void updateCaption(ComponentConnector component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component) {
// NOP, not rendered
}
return (VTabsheet) super.getWidget();
}
- public void updateCaption(ComponentConnector component, UIDL uidl) {
+ public void updateCaption(ComponentConnector component) {
/* Tabsheet does not render its children's captions */
}
setStyleName(CLASSNAME + "-wrapper");
}
- public void updateCaption(UIDL uidl) {
+ public void updateCaption() {
- boolean captionIsNeeded = VCaption.isNeeded(uidl,
- paintable.getState());
+ boolean captionIsNeeded = VCaption.isNeeded(paintable.getState());
if (captionIsNeeded) {
if (caption == null) {
caption = new VCaption(paintable, client);
VAbsoluteLayout.this.add(caption);
}
- caption.updateCaption(uidl);
+ caption.updateCaption();
updateCaptionPosition();
} else {
if (caption != null) {
public void updateCaption(UIDL uidl) {
// TODO need to call this because the caption does not have an owner
caption.updateCaptionWithoutOwner(
- uidl,
uidl.getStringAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_CAPTION),
uidl.hasAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DISABLED),
uidl.hasAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DESCRIPTION),
insert(child, index);
}
- public void updateCaption(ComponentConnector paintable, UIDL uidl) {
+ public void updateCaption(ComponentConnector paintable) {
Widget widget = paintable.getWidget();
VCaption caption = widgetToCaption.get(widget);
- if (VCaption.isNeeded(uidl, paintable.getState())) {
+ if (VCaption.isNeeded(paintable.getState())) {
if (caption == null) {
caption = new VCaption(paintable, client);
widgetToCaption.put(widget, caption);
insert(caption, getWidgetIndex(widget));
lastIndex++;
}
- caption.updateCaption(uidl);
+ caption.updateCaption();
} else if (caption != null) {
remove(caption);
widgetToCaption.remove(widget);
}
/** Update caption for given widget */
- public void updateCaption(ComponentConnector paintable, UIDL uidl) {
+ public void updateCaption(ComponentConnector paintable) {
VCaptionWrapper wrapper = paintableToCaptionWrapper.get(paintable);
Widget widget = paintable.getWidget();
- if (VCaption.isNeeded(uidl, paintable.getState())) {
+ if (VCaption.isNeeded(paintable.getState())) {
if (wrapper == null) {
// Add a wrapper between the layout and the child widget
final String loc = getLocation(widget);
super.add(wrapper, locationToElement.get(loc));
paintableToCaptionWrapper.put(paintable, wrapper);
}
- wrapper.updateCaption(uidl);
+ wrapper.updateCaption();
} else {
if (wrapper != null) {
// Remove the wrapper and add the widget directly to the layout
setStyleName(styleName);
}
- public void updateCaption(UIDL uidl, ComponentState state,
- boolean enabled) {
- setVisible(!uidl.getBooleanAttribute("invisible"));
-
+ public void updateCaption(ComponentState state, boolean enabled) {
// Update styles as they might have changed when the caption changed
setStyles(getStylesFromState(state, enabled));
sinkEvents(VTooltip.TOOLTIP_EVENTS);
}
- public void updateFromUIDL(UIDL uidl, ComponentConnector component) {
+ public void updateFromUIDL(ComponentConnector component) {
owner = component;
boolean showError = null != owner.getState().getErrorMessage();
if (owner.getState() instanceof AbstractFieldState) {
this.tab = tab;
}
- @Override
public boolean updateCaption(UIDL uidl) {
if (uidl.hasAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DESCRIPTION)) {
TooltipInfo tooltipInfo = new TooltipInfo();
tooltipInfo
.setTitle(uidl
.getStringAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DESCRIPTION));
- // TODO currently, there is no error indicator and message for a tab
+ // TODO currently, there is no error indicator and message for a
+ // tab
client.registerTooltip(getTabsheet(), getElement(), tooltipInfo);
} else {
client.registerTooltip(getTabsheet(), getElement(), null);
// TODO need to call this instead of super because the caption does
// not have an owner
boolean ret = updateCaptionWithoutOwner(
- uidl,
uidl.getStringAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_CAPTION),
uidl.hasAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DISABLED),
uidl.hasAttribute(TabsheetBaseConnector.ATTRIBUTE_TAB_DESCRIPTION),
}
/**
- * @return a list of currently shown Paintables
- *
- * Apparently can be something else than Paintable as
- * {@link #updateFromUIDL(UIDL, ApplicationConnection)} checks if
- * instanceof Paintable. Therefore set to <Object>
+ * @return a list of currently shown Widgets
*/
abstract protected Iterator<Widget> getWidgetIterator();
}
}
- public void updateCaption(ComponentConnector component, UIDL uidl) {
- // NOP, window has own caption, layout captio not rendered
+ public void updateCaption(ComponentConnector component) {
+ // NOP, window has own caption, layout caption not rendered
}
public void onBeforeShortcutAction(Event e) {