diff options
author | John Ahlroos <john@vaadin.com> | 2012-09-03 11:41:06 +0300 |
---|---|---|
committer | John Ahlroos <john@vaadin.com> | 2012-09-03 11:41:06 +0300 |
commit | 971b0684482dd3b7eb4efac09b9c24e1ea2b305d (patch) | |
tree | 6d6a4be640837500cfaa2f805a8602a9f4803871 /client | |
parent | 340cd7899812b444941584d383d930fe8155159b (diff) | |
parent | f85c152a48686a8a0dca38ca12b4f3509cac056f (diff) | |
download | vaadin-framework-971b0684482dd3b7eb4efac09b9c24e1ea2b305d.tar.gz vaadin-framework-971b0684482dd3b7eb4efac09b9c24e1ea2b305d.zip |
Merge branch 'master' into layoutgraph
Conflicts:
shared/src/com/vaadin/shared/ComponentState.java
Diffstat (limited to 'client')
48 files changed, 228 insertions, 217 deletions
diff --git a/client/src/com/vaadin/client/ComponentLocator.java b/client/src/com/vaadin/client/ComponentLocator.java index 03dd966538..dabea6c8d7 100644 --- a/client/src/com/vaadin/client/ComponentLocator.java +++ b/client/src/com/vaadin/client/ComponentLocator.java @@ -615,7 +615,7 @@ public class ComponentLocator { private ServerConnector findConnectorById(ServerConnector root, String id) { SharedState state = root.getState(); if (state instanceof ComponentState - && id.equals(((ComponentState) state).getId())) { + && id.equals(((ComponentState) state).id)) { return root; } for (ServerConnector child : root.getChildren()) { diff --git a/client/src/com/vaadin/client/LayoutManager.java b/client/src/com/vaadin/client/LayoutManager.java index b456010721..e7617a6b0b 100644 --- a/client/src/com/vaadin/client/LayoutManager.java +++ b/client/src/com/vaadin/client/LayoutManager.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -1121,7 +1121,8 @@ public class LayoutManager { int assignedHeight) { assert component.isRelativeHeight(); - float percentSize = parsePercent(component.getState().getHeight()); + float percentSize = parsePercent(component.getState().height == null ? "" + : component.getState().height); int effectiveHeight = Math.round(assignedHeight * (percentSize / 100)); reportOuterHeight(component, effectiveHeight); @@ -1144,7 +1145,8 @@ public class LayoutManager { int assignedWidth) { assert component.isRelativeWidth(); - float percentSize = parsePercent(component.getState().getWidth()); + float percentSize = parsePercent(component.getState().width == null ? "" + : component.getState().width); int effectiveWidth = Math.round(assignedWidth * (percentSize / 100)); reportOuterWidth(component, effectiveWidth); diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java index f0caf4772f..f832dbfda2 100644 --- a/client/src/com/vaadin/client/Util.java +++ b/client/src/com/vaadin/client/Util.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -44,6 +44,7 @@ import com.vaadin.client.ui.VOverlay; import com.vaadin.shared.ApplicationConstants; import com.vaadin.shared.ComponentState; import com.vaadin.shared.communication.MethodInvocation; +import com.vaadin.shared.ui.ComponentStateUtil; public class Util { @@ -168,6 +169,9 @@ public class Util { * @return An escaped version of <literal>attribute</literal>. */ public static String escapeAttribute(String attribute) { + if (attribute == null) { + return ""; + } attribute = attribute.replace("\"", """); attribute = attribute.replace("'", "'"); attribute = attribute.replace(">", ">"); @@ -517,18 +521,20 @@ public class Util { * @return */ public static FloatSize parseRelativeSize(ComponentState state) { - if (state.isUndefinedHeight() && state.isUndefinedWidth()) { + if (ComponentStateUtil.isUndefinedHeight(state) + && ComponentStateUtil.isUndefinedWidth(state)) { return null; } - float relativeWidth = Util.parseRelativeSize(state.getWidth()); - float relativeHeight = Util.parseRelativeSize(state.getHeight()); + float relativeWidth = Util.parseRelativeSize(state.width); + float relativeHeight = Util.parseRelativeSize(state.height); FloatSize relativeSize = new FloatSize(relativeWidth, relativeHeight); return relativeSize; } + @Deprecated public static boolean isCached(UIDL uidl) { return uidl.getBooleanAttribute("cached"); diff --git a/client/src/com/vaadin/client/VCaption.java b/client/src/com/vaadin/client/VCaption.java index 58e0b847f0..aadc7b88ad 100644 --- a/client/src/com/vaadin/client/VCaption.java +++ b/client/src/com/vaadin/client/VCaption.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -25,6 +25,7 @@ import com.vaadin.client.ui.Icon; import com.vaadin.shared.AbstractFieldState; import com.vaadin.shared.ComponentConstants; import com.vaadin.shared.ComponentState; +import com.vaadin.shared.ui.ComponentStateUtil; public class VCaption extends HTML { @@ -110,8 +111,8 @@ public class VCaption extends HTML { placedAfterComponent = true; String style = CLASSNAME; - if (owner.getState().hasStyles()) { - for (String customStyle : owner.getState().getStyles()) { + if (ComponentStateUtil.hasStyles(owner.getState())) { + for (String customStyle : owner.getState().styles) { style += " " + CLASSNAME + "-" + customStyle; } } @@ -123,11 +124,11 @@ public class VCaption extends HTML { boolean hasIcon = owner.getState().resources .containsKey(ComponentConstants.ICON_RESOURCE); boolean showRequired = false; - boolean showError = owner.getState().getErrorMessage() != null; + boolean showError = owner.getState().errorMessage != null; if (owner.getState() instanceof AbstractFieldState) { AbstractFieldState abstractFieldState = (AbstractFieldState) owner .getState(); - showError = showError && !abstractFieldState.isHideErrors(); + showError = showError && !abstractFieldState.hideErrors; } if (owner instanceof AbstractFieldConnector) { showRequired = ((AbstractFieldConnector) owner).isRequired(); @@ -154,7 +155,7 @@ public class VCaption extends HTML { icon = null; } - if (owner.getState().getCaption() != null) { + if (owner.getState().caption != null) { // A caption text should be shown if the attribute is set // If the caption is null the ATTRIBUTE_CAPTION should not be set to // avoid ending up here. @@ -168,7 +169,7 @@ public class VCaption extends HTML { } // Update caption text - String c = owner.getState().getCaption(); + String c = owner.getState().caption; // A text forces the caption to be above the component. placedAfterComponent = false; if (c == null || c.trim().equals("")) { @@ -191,7 +192,8 @@ public class VCaption extends HTML { captionText = null; } - if (owner.getState().hasDescription() && captionText != null) { + if (ComponentStateUtil.hasDescription(owner.getState()) + && captionText != null) { addStyleDependentName("hasdescription"); } else { removeStyleDependentName("hasdescription"); @@ -392,13 +394,13 @@ public class VCaption extends HTML { } public static boolean isNeeded(ComponentState state) { - if (state.getCaption() != null) { + if (state.caption != null) { return true; } if (state.resources.containsKey(ComponentConstants.ICON_RESOURCE)) { return true; } - if (state.getErrorMessage() != null) { + if (state.errorMessage != null) { return true; } diff --git a/client/src/com/vaadin/client/VDebugConsole.java b/client/src/com/vaadin/client/VDebugConsole.java index bdb24066ca..2db5e028cf 100644 --- a/client/src/com/vaadin/client/VDebugConsole.java +++ b/client/src/com/vaadin/client/VDebugConsole.java @@ -924,7 +924,7 @@ public class VDebugConsole extends VOverlay implements Console { protected void dumpConnectorInfo(ApplicationConnection a) { UIConnector root = a.getRootConnector(); log("================"); - log("Connector hierarchy for Root: " + root.getState().getCaption() + log("Connector hierarchy for Root: " + root.getState().caption + " (" + root.getConnectorId() + ")"); Set<ServerConnector> connectorsInHierarchy = new HashSet<ServerConnector>(); SimpleTree rootHierachy = dumpConnectorHierarchy(root, "", diff --git a/client/src/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java b/client/src/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java index 7cab90a90d..f6d643d1ba 100644 --- a/client/src/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java +++ b/client/src/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -48,7 +48,7 @@ public class JavaScriptManagerConnector extends AbstractExtensionConnector { public void onStateChanged(StateChangeEvent stateChangeEvent) { super.onStateChanged(stateChangeEvent); - Set<String> newNames = getState().getNames(); + Set<String> newNames = getState().names; // Current names now only contains orphan callbacks currentNames.removeAll(newNames); diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java index c886d2f94c..a17c3bc514 100644 --- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java @@ -42,6 +42,7 @@ import com.vaadin.client.ui.datefield.PopupDateFieldConnector; import com.vaadin.shared.ComponentConstants; import com.vaadin.shared.ComponentState; import com.vaadin.shared.Connector; +import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.shared.ui.TabIndexState; import com.vaadin.ui.themes.BaseTheme; @@ -125,8 +126,8 @@ implements ComponentConnector { public void onStateChanged(StateChangeEvent stateChangeEvent) { ConnectorMap paintableMap = ConnectorMap.get(getConnection()); - if (getState().getId() != null) { - getWidget().getElement().setId(getState().getId()); + if (getState().id != null) { + getWidget().getElement().setId(getState().id); } else { getWidget().getElement().removeAttribute("id"); @@ -139,8 +140,8 @@ implements ComponentConnector { */ if (getState() instanceof TabIndexState && getWidget() instanceof Focusable) { - ((Focusable) getWidget()).setTabIndex(((TabIndexState) getState()) - .getTabIndex()); + ((Focusable) getWidget()) + .setTabIndex(((TabIndexState) getState()).tabIndex); } super.onStateChanged(stateChangeEvent); @@ -193,8 +194,8 @@ implements ComponentConnector { } private void updateComponentSize() { - String newWidth = getState().getWidth(); - String newHeight = getState().getHeight(); + String newWidth = getState().width == null ? "" : getState().width; + String newHeight = getState().height == null ? "" : getState().height; // Parent should be updated if either dimension changed between relative // and non-relative @@ -229,22 +230,22 @@ implements ComponentConnector { @Override public boolean isRelativeHeight() { - return getState().getHeight().endsWith("%"); + return getState().height != null && getState().height.endsWith("%"); } @Override public boolean isRelativeWidth() { - return getState().getWidth().endsWith("%"); + return getState().width != null && getState().width.endsWith("%"); } @Override public boolean isUndefinedHeight() { - return getState().getHeight().length() == 0; + return getState().height == null || getState().height.length() == 0; } @Override public boolean isUndefinedWidth() { - return getState().getWidth().length() == 0; + return getState().width == null && getState().width.length() == 0; } /* @@ -279,14 +280,14 @@ implements ComponentConnector { // add / remove error style name setWidgetStyleNameWithPrefix(primaryStyleName, ApplicationConnection.ERROR_CLASSNAME_EXT, - null != state.getErrorMessage()); + null != state.errorMessage); // add additional user defined style names as class names, prefixed with // component default class name. remove nonexistent style names. - if (state.hasStyles()) { + if (ComponentStateUtil.hasStyles(state)) { // add new style names List<String> newStyles = new ArrayList<String>(); - newStyles.addAll(state.getStyles()); + newStyles.addAll(state.styles); newStyles.removeAll(styleNames); for (String newStyle : newStyles) { setWidgetStyleName(newStyle, true); @@ -294,14 +295,14 @@ implements ComponentConnector { true); } // remove nonexistent style names - styleNames.removeAll(state.getStyles()); + styleNames.removeAll(state.styles); for (String oldStyle : styleNames) { setWidgetStyleName(oldStyle, false); setWidgetStyleNameWithPrefix(primaryStyleName + "-", oldStyle, false); } styleNames.clear(); - styleNames.addAll(state.getStyles()); + styleNames.addAll(state.styles); } else { // remove all old style names for (String oldStyle : styleNames) { @@ -374,7 +375,7 @@ implements ComponentConnector { @Override @Deprecated public boolean isReadOnly() { - return getState().isReadOnly(); + return getState().readOnly; } @Override @@ -393,7 +394,7 @@ implements ComponentConnector { */ @Override public boolean hasEventListener(String eventIdentifier) { - Set<String> reg = getState().getRegisteredEventListeners(); + Set<String> reg = getState().registeredEventListeners; return (reg != null && reg.contains(eventIdentifier)); } @@ -426,8 +427,7 @@ implements ComponentConnector { */ @Override public TooltipInfo getTooltipInfo(Element element) { - return new TooltipInfo(getState().getDescription(), getState() - .getErrorMessage()); + return new TooltipInfo(getState().description, getState().errorMessage); } /** diff --git a/client/src/com/vaadin/client/ui/AbstractConnector.java b/client/src/com/vaadin/client/ui/AbstractConnector.java index 2820b7b2c1..bad374c2f0 100644 --- a/client/src/com/vaadin/client/ui/AbstractConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractConnector.java @@ -333,7 +333,7 @@ StateChangeHandler { @Override public boolean isEnabled() { - if (!getState().isEnabled()) { + if (!getState().enabled) { return false; } diff --git a/client/src/com/vaadin/client/ui/AbstractFieldConnector.java b/client/src/com/vaadin/client/ui/AbstractFieldConnector.java index 9a6f285187..1ba371c448 100644 --- a/client/src/com/vaadin/client/ui/AbstractFieldConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractFieldConnector.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -27,11 +27,11 @@ public abstract class AbstractFieldConnector extends AbstractComponentConnector @Override public boolean isReadOnly() { - return super.isReadOnly() || getState().isPropertyReadOnly(); + return super.isReadOnly() || getState().propertyReadOnly; } public boolean isModified() { - return getState().isModified(); + return getState().modified; } /** @@ -43,7 +43,7 @@ public abstract class AbstractFieldConnector extends AbstractComponentConnector * @return true if required indicator should be shown */ public boolean isRequired() { - return getState().isRequired() && !isReadOnly(); + return getState().required && !isReadOnly(); } @Override diff --git a/client/src/com/vaadin/client/ui/MediaBaseConnector.java b/client/src/com/vaadin/client/ui/MediaBaseConnector.java index 8a17e052ba..961ba4821e 100644 --- a/client/src/com/vaadin/client/ui/MediaBaseConnector.java +++ b/client/src/com/vaadin/client/ui/MediaBaseConnector.java @@ -49,12 +49,12 @@ public abstract class MediaBaseConnector extends AbstractComponentConnector { public void onStateChanged(StateChangeEvent stateChangeEvent) { super.onStateChanged(stateChangeEvent); - for (int i = 0; i < getState().getSources().size(); i++) { - URLReference source = getState().getSources().get(i); - String sourceType = getState().getSourceTypes().get(i); + for (int i = 0; i < getState().sources.size(); i++) { + URLReference source = getState().sources.get(i); + String sourceType = getState().sourceTypes.get(i); getWidget().addSource(source.getURL(), sourceType); } - setAltText(getState().getAltText()); + setAltText(getState().altText); } @Override @@ -66,7 +66,7 @@ public abstract class MediaBaseConnector extends AbstractComponentConnector { if (altText == null || "".equals(altText)) { altText = getDefaultAltHtml(); - } else if (!getState().isHtmlContentAllowed()) { + } else if (!getState().htmlContentAllowed) { altText = Util.escapeHTML(altText); } getWidget().setAltText(altText); diff --git a/client/src/com/vaadin/client/ui/UI/UIConnector.java b/client/src/com/vaadin/client/ui/UI/UIConnector.java index 920bf152f9..cb8b0ece9e 100644 --- a/client/src/com/vaadin/client/ui/UI/UIConnector.java +++ b/client/src/com/vaadin/client/ui/UI/UIConnector.java @@ -52,6 +52,7 @@ import com.vaadin.client.ui.layout.MayScrollChildren; import com.vaadin.client.ui.notification.VNotification; import com.vaadin.client.ui.window.WindowConnector; import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.Connect.LoadStyle; import com.vaadin.shared.ui.ui.PageClientRpc; @@ -91,7 +92,7 @@ public class UIConnector extends AbstractComponentContainerConnector implements public void onResize(ResizeEvent event) { rpc.resize(event.getHeight(), event.getWidth(), Window.getClientWidth(), Window.getClientHeight()); - if (getState().isImmediate()) { + if (getState().immediate) { getConnection().sendPendingVariableChanges(); } } @@ -106,7 +107,7 @@ public class UIConnector extends AbstractComponentContainerConnector implements boolean firstPaint = getWidget().connection == null; getWidget().connection = client; - getWidget().immediate = getState().isImmediate(); + getWidget().immediate = getState().immediate; getWidget().resizeLazy = uidl.hasAttribute(UIConstants.RESIZE_LAZY); String newTheme = uidl.getStringAttribute("theme"); if (getWidget().theme != null && !newTheme.equals(getWidget().theme)) { @@ -119,8 +120,8 @@ public class UIConnector extends AbstractComponentContainerConnector implements // this also implicitly removes old styles String styles = ""; styles += getWidget().getStylePrimaryName() + " "; - if (getState().hasStyles()) { - for (String style : getState().getStyles()) { + if (ComponentStateUtil.hasStyles(getState())) { + for (String style : getState().styles) { styles += style + " "; } } @@ -338,7 +339,7 @@ public class UIConnector extends AbstractComponentContainerConnector implements } protected ComponentConnector getContent() { - return (ComponentConnector) getState().getContent(); + return (ComponentConnector) getState().content; } protected void onChildSizeChange() { diff --git a/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java b/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java index b453499c27..be29f5f512 100644 --- a/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java @@ -126,7 +126,8 @@ public class AbsoluteLayoutConnector extends for (ComponentConnector child : getChildComponents()) { getWrapper(child).setPosition( - getState().getConnectorPosition(child)); + getState().connectorToCssPosition.get(child + .getConnectorId())); } }; diff --git a/client/src/com/vaadin/client/ui/audio/AudioConnector.java b/client/src/com/vaadin/client/ui/audio/AudioConnector.java index 8c2fa179c8..bfa282ca09 100644 --- a/client/src/com/vaadin/client/ui/audio/AudioConnector.java +++ b/client/src/com/vaadin/client/ui/audio/AudioConnector.java @@ -35,7 +35,7 @@ public class AudioConnector extends MediaBaseConnector { Style style = getWidget().getElement().getStyle(); // Make sure that the controls are not clipped if visible. - if (getState().isShowControls() + if (getState().showControls && (style.getHeight() == null || "".equals(style.getHeight()))) { if (BrowserInfo.get().isChrome()) { style.setHeight(32, Unit.PX); diff --git a/client/src/com/vaadin/client/ui/button/ButtonConnector.java b/client/src/com/vaadin/client/ui/button/ButtonConnector.java index 65acddb0a4..b15813c99e 100644 --- a/client/src/com/vaadin/client/ui/button/ButtonConnector.java +++ b/client/src/com/vaadin/client/ui/button/ButtonConnector.java @@ -65,7 +65,7 @@ public class ButtonConnector extends AbstractComponentConnector implements addStateChangeHandler("errorMessage", new StateChangeHandler() { @Override public void onStateChanged(StateChangeEvent stateChangeEvent) { - if (null != getState().getErrorMessage()) { + if (null != getState().errorMessage) { if (getWidget().errorIndicatorElement == null) { getWidget().errorIndicatorElement = DOM.createSpan(); getWidget().errorIndicatorElement @@ -117,14 +117,14 @@ public class ButtonConnector extends AbstractComponentConnector implements if (changedProperties.contains("caption") || changedProperties.contains("htmlContentAllowed")) { // Set text - if (getState().isHtmlContentAllowed()) { - getWidget().setHtml(getState().getCaption()); + if (getState().htmlContentAllowed) { + getWidget().setHtml(getState().caption); } else { - getWidget().setText(getState().getCaption()); + getWidget().setText(getState().caption); } } - getWidget().clickShortcut = getState().getClickShortcutKeyCode(); + getWidget().clickShortcut = getState().clickShortcutKeyCode; } @Override @@ -153,7 +153,7 @@ public class ButtonConnector extends AbstractComponentConnector implements @Override public void onClick(ClickEvent event) { - if (getState().isDisableOnClick()) { + if (getState().disableOnClick) { getWidget().setEnabled(false); rpc.disableOnClick(); } diff --git a/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java b/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java index 1a6547a85c..35816039da 100644 --- a/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java +++ b/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java @@ -73,7 +73,7 @@ public class CheckBoxConnector extends AbstractFieldConnector implements blurHandlerRegistration = EventHelper.updateBlurHandler(this, blurHandlerRegistration); - if (null != getState().getErrorMessage()) { + if (null != getState().errorMessage) { if (getWidget().errorIndicatorElement == null) { getWidget().errorIndicatorElement = DOM.createSpan(); getWidget().errorIndicatorElement.setInnerHTML(" "); @@ -113,9 +113,9 @@ public class CheckBoxConnector extends AbstractFieldConnector implements } // Set text - getWidget().setText(getState().getCaption()); - getWidget().setValue(getState().isChecked()); - getWidget().immediate = getState().isImmediate(); + getWidget().setText(getState().caption); + getWidget().setValue(getState().checked); + getWidget().immediate = getState().immediate; } @Override diff --git a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java index fc060f3deb..d89836d6e2 100644 --- a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java +++ b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java @@ -71,7 +71,7 @@ public class ComboBoxConnector extends AbstractFieldConnector implements getWidget().filteringmode = uidl.getIntAttribute("filteringmode"); } - getWidget().immediate = getState().isImmediate(); + getWidget().immediate = getState().immediate; getWidget().nullSelectionAllowed = uidl.hasAttribute("nullselect"); diff --git a/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java b/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java index 9bf758fcba..8692622892 100644 --- a/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java +++ b/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java @@ -72,6 +72,7 @@ import com.vaadin.client.ui.menubar.MenuBar; import com.vaadin.client.ui.menubar.MenuItem; import com.vaadin.shared.ComponentState; import com.vaadin.shared.EventId; +import com.vaadin.shared.ui.ComponentStateUtil; /** * Client side implementation of the Select component. @@ -580,8 +581,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, */ public void updateStyleNames(UIDL uidl, ComponentState componentState) { setStyleName(CLASSNAME + "-suggestpopup"); - if (componentState.hasStyles()) { - for (String style : componentState.getStyles()) { + if (ComponentStateUtil.hasStyles(componentState)) { + for (String style : componentState.styles) { if (!"".equals(style)) { addStyleDependentName(style); } diff --git a/client/src/com/vaadin/client/ui/csslayout/CssLayoutConnector.java b/client/src/com/vaadin/client/ui/csslayout/CssLayoutConnector.java index 0d7e511ddb..cc1d15e026 100644 --- a/client/src/com/vaadin/client/ui/csslayout/CssLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/csslayout/CssLayoutConnector.java @@ -75,10 +75,10 @@ public class CssLayoutConnector extends AbstractLayoutConnector { super.onStateChanged(stateChangeEvent); for (ComponentConnector child : getChildComponents()) { - if (!getState().getChildCss().containsKey(child)) { + if (!getState().childCss.containsKey(child)) { continue; } - String css = getState().getChildCss().get(child); + String css = getState().childCss.get(child); Style style = child.getWidget().getElement().getStyle(); // should we remove styles also? How can we know what we have added // as it is added directly to the child component? diff --git a/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java b/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java index c06bbd5391..0049a4dd3d 100644 --- a/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/customlayout/CustomLayoutConnector.java @@ -62,8 +62,8 @@ public class CustomLayoutConnector extends AbstractLayoutConnector implements // later on. return; } - String templateName = getState().getTemplateName(); - String templateContents = getState().getTemplateContents(); + String templateName = getState().templateName; + String templateContents = getState().templateContents; if (templateName != null) { // Get the HTML-template from client. Overrides templateContents @@ -92,7 +92,7 @@ public class CustomLayoutConnector extends AbstractLayoutConnector implements // For all contained widgets for (ComponentConnector child : getChildComponents()) { - String location = getState().getChildLocations().get(child); + String location = getState().childLocations.get(child); try { getWidget().setWidget(child.getWidget(), location); } catch (final IllegalArgumentException e) { diff --git a/client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java index 62facc380c..cc98767e00 100644 --- a/client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java +++ b/client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java @@ -37,7 +37,7 @@ public class AbstractDateFieldConnector extends AbstractFieldConnector // Save details getWidget().client = client; getWidget().paintableId = uidl.getId(); - getWidget().immediate = getState().isImmediate(); + getWidget().immediate = getState().immediate; getWidget().readonly = isReadOnly(); getWidget().enabled = isEnabled(); diff --git a/client/src/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java b/client/src/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java index 96c68bbbb5..3bbc6f05d1 100644 --- a/client/src/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java +++ b/client/src/com/vaadin/client/ui/draganddropwrapper/DragAndDropWrapperConnector.java @@ -73,7 +73,7 @@ public class DragAndDropWrapperConnector extends CustomComponentConnector .getMapAttribute(DragAndDropWrapperConstants.HTML5_DATA_FLAVORS); // Used to prevent wrapper from stealing tooltips when not defined - getWidget().hasTooltip = getState().hasDescription(); + getWidget().hasTooltip = getState().description != null; } } diff --git a/client/src/com/vaadin/client/ui/embedded/EmbeddedConnector.java b/client/src/com/vaadin/client/ui/embedded/EmbeddedConnector.java index dffb73f099..2a1b4dcc44 100644 --- a/client/src/com/vaadin/client/ui/embedded/EmbeddedConnector.java +++ b/client/src/com/vaadin/client/ui/embedded/EmbeddedConnector.java @@ -101,8 +101,8 @@ public class EmbeddedConnector extends AbstractComponentConnector implements // Set attributes Style style = el.getStyle(); - style.setProperty("width", getState().getWidth()); - style.setProperty("height", getState().getHeight()); + style.setProperty("width", getState().width); + style.setProperty("height", getState().height); DOM.setElementProperty(el, "src", getWidget().getSrc(uidl, client)); diff --git a/client/src/com/vaadin/client/ui/embedded/VEmbedded.java b/client/src/com/vaadin/client/ui/embedded/VEmbedded.java index 239bb4ad46..4dc85cd10c 100644 --- a/client/src/com/vaadin/client/ui/embedded/VEmbedded.java +++ b/client/src/com/vaadin/client/ui/embedded/VEmbedded.java @@ -100,8 +100,8 @@ public class VEmbedded extends HTML { ComponentConnector paintable = ConnectorMap.get(client).getConnector( this); - String height = paintable.getState().getHeight(); - String width = paintable.getState().getWidth(); + String height = paintable.getState().height; + String width = paintable.getState().width; // Add width and height html.append("width=\"" + Util.escapeAttribute(width) + "\" "); diff --git a/client/src/com/vaadin/client/ui/embeddedbrowser/EmbeddedBrowserConnector.java b/client/src/com/vaadin/client/ui/embeddedbrowser/EmbeddedBrowserConnector.java index b0cd6d773d..10445dbff5 100644 --- a/client/src/com/vaadin/client/ui/embeddedbrowser/EmbeddedBrowserConnector.java +++ b/client/src/com/vaadin/client/ui/embeddedbrowser/EmbeddedBrowserConnector.java @@ -29,7 +29,7 @@ public class EmbeddedBrowserConnector extends AbstractComponentConnector { super.onStateChanged(stateChangeEvent); - getWidget().setAlternateText(getState().getAlternateText()); + getWidget().setAlternateText(getState().alternateText); getWidget().setSource( getResourceUrl(AbstractEmbeddedState.SOURCE_RESOURCE)); getWidget().setName(getConnectorId()); diff --git a/client/src/com/vaadin/client/ui/flash/FlashConnector.java b/client/src/com/vaadin/client/ui/flash/FlashConnector.java index cc5423dd20..eaccc4736c 100644 --- a/client/src/com/vaadin/client/ui/flash/FlashConnector.java +++ b/client/src/com/vaadin/client/ui/flash/FlashConnector.java @@ -31,13 +31,13 @@ public class FlashConnector extends AbstractComponentConnector { getWidget().setSource( getResourceUrl(AbstractEmbeddedState.SOURCE_RESOURCE)); - getWidget().setArchive(getState().getArchive()); - getWidget().setClassId(getState().getClassId()); - getWidget().setCodebase(getState().getCodebase()); - getWidget().setCodetype(getState().getCodetype()); - getWidget().setStandby(getState().getStandby()); - getWidget().setAlternateText(getState().getAlternateText()); - getWidget().setEmbedParams(getState().getEmbedParams()); + getWidget().setArchive(getState().archive); + getWidget().setClassId(getState().classId); + getWidget().setCodebase(getState().codebase); + getWidget().setCodetype(getState().codetype); + getWidget().setStandby(getState().standby); + getWidget().setAlternateText(getState().alternateText); + getWidget().setEmbedParams(getState().embedParams); getWidget().rebuildIfNeeded(); } diff --git a/client/src/com/vaadin/client/ui/form/FormConnector.java b/client/src/com/vaadin/client/ui/form/FormConnector.java index 1b97bbc4cb..25b4a76a09 100644 --- a/client/src/com/vaadin/client/ui/form/FormConnector.java +++ b/client/src/com/vaadin/client/ui/form/FormConnector.java @@ -29,6 +29,7 @@ import com.vaadin.client.ui.ShortcutActionHandler; import com.vaadin.client.ui.layout.ElementResizeEvent; import com.vaadin.client.ui.layout.ElementResizeListener; import com.vaadin.client.ui.layout.MayScrollChildren; +import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.form.FormState; import com.vaadin.ui.Form; @@ -81,8 +82,8 @@ public class FormConnector extends AbstractComponentContainerConnector } boolean legendEmpty = true; - if (getState().getCaption() != null) { - getWidget().caption.setInnerText(getState().getCaption()); + if (getState().caption != null) { + getWidget().caption.setInnerText(getState().caption); legendEmpty = false; } else { getWidget().caption.setInnerText(""); @@ -105,16 +106,15 @@ public class FormConnector extends AbstractComponentContainerConnector getWidget().removeStyleDependentName("nocaption"); } - if (null != getState().getErrorMessage()) { - getWidget().errorMessage - .updateMessage(getState().getErrorMessage()); + if (null != getState().errorMessage) { + getWidget().errorMessage.updateMessage(getState().errorMessage); getWidget().errorMessage.setVisible(true); } else { getWidget().errorMessage.setVisible(false); } - if (getState().hasDescription()) { - getWidget().desc.setInnerHTML(getState().getDescription()); + if (ComponentStateUtil.hasDescription(getState())) { + getWidget().desc.setInnerHTML(getState().description); if (getWidget().desc.getParentElement() == null) { getWidget().fieldSet.insertAfter(getWidget().desc, getWidget().legend); @@ -128,10 +128,9 @@ public class FormConnector extends AbstractComponentContainerConnector // first render footer so it will be easier to handle relative height of // main layout - if (getState().getFooter() != null) { + if (getState().footer != null) { // render footer - ComponentConnector newFooter = (ComponentConnector) getState() - .getFooter(); + ComponentConnector newFooter = (ComponentConnector) getState().footer; Widget newFooterWidget = newFooter.getWidget(); if (getWidget().footer == null) { getLayoutManager().addElementResizeListener( @@ -158,8 +157,7 @@ public class FormConnector extends AbstractComponentContainerConnector } } - ComponentConnector newLayout = (ComponentConnector) getState() - .getLayout(); + ComponentConnector newLayout = (ComponentConnector) getState().layout; Widget newLayoutWidget = newLayout.getWidget(); if (getWidget().lo == null) { // Layout not rendered before @@ -208,7 +206,7 @@ public class FormConnector extends AbstractComponentContainerConnector @Override public boolean isReadOnly() { - return super.isReadOnly() || getState().isPropertyReadOnly(); + return super.isReadOnly() || getState().propertyReadOnly; } @Override diff --git a/client/src/com/vaadin/client/ui/formlayout/FormLayoutConnector.java b/client/src/com/vaadin/client/ui/formlayout/FormLayoutConnector.java index c1c6cee324..c78137345f 100644 --- a/client/src/com/vaadin/client/ui/formlayout/FormLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/formlayout/FormLayoutConnector.java @@ -46,9 +46,8 @@ public class FormLayoutConnector extends AbstractLayoutConnector { VFormLayoutTable formLayoutTable = getWidget().table; - formLayoutTable.setMargins(new MarginInfo(getState() - .getMarginsBitmask())); - formLayoutTable.setSpacing(getState().isSpacing()); + formLayoutTable.setMargins(new MarginInfo(getState().marginsBitmask)); + formLayoutTable.setSpacing(getState().spacing); } @@ -99,12 +98,11 @@ public class FormLayoutConnector extends AbstractLayoutConnector { // FIXME This incorrectly depends on AbstractFieldConnector if (component instanceof AbstractFieldConnector) { - hideErrors = ((AbstractFieldConnector) component).getState() - .isHideErrors(); + hideErrors = ((AbstractFieldConnector) component).getState().hideErrors; } - getWidget().table.updateError(component.getWidget(), component - .getState().getErrorMessage(), hideErrors); + getWidget().table.updateError(component.getWidget(), + component.getState().errorMessage, hideErrors); } @Override diff --git a/client/src/com/vaadin/client/ui/formlayout/VFormLayout.java b/client/src/com/vaadin/client/ui/formlayout/VFormLayout.java index 890275dfe4..f2f6e0bc72 100644 --- a/client/src/com/vaadin/client/ui/formlayout/VFormLayout.java +++ b/client/src/com/vaadin/client/ui/formlayout/VFormLayout.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -38,6 +38,7 @@ import com.vaadin.client.ui.AbstractFieldConnector; import com.vaadin.client.ui.Icon; import com.vaadin.shared.ComponentConstants; import com.vaadin.shared.ComponentState; +import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.shared.ui.MarginInfo; /** @@ -66,8 +67,8 @@ public class VFormLayout extends SimplePanel { */ private String[] getStylesFromState(ComponentState state, boolean enabled) { List<String> styles = new ArrayList<String>(); - if (state.hasStyles()) { - for (String name : state.getStyles()) { + if (ComponentStateUtil.hasStyles(state)) { + for (String name : state.styles) { styles.add(name); } } @@ -271,13 +272,13 @@ public class VFormLayout extends SimplePanel { } - if (state.getCaption() != null) { + if (state.caption != null) { if (captionText == null) { captionText = DOM.createSpan(); DOM.insertChild(getElement(), captionText, icon == null ? 0 : 1); } - String c = state.getCaption(); + String c = state.caption; if (c == null) { c = ""; } else { @@ -288,7 +289,7 @@ public class VFormLayout extends SimplePanel { // TODO should span also be removed } - if (state.hasDescription() && captionText != null) { + if (state.description != null && captionText != null) { addStyleDependentName("hasdescription"); } else { removeStyleDependentName("hasdescription"); diff --git a/client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java b/client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java index 16c82c2d21..317836370c 100644 --- a/client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java @@ -106,8 +106,8 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector return; } - int cols = getState().getColumns(); - int rows = getState().getRows(); + int cols = getState().columns; + int rows = getState().rows; layout.columnWidths = new int[cols]; layout.rowHeights = new int[rows]; @@ -164,9 +164,9 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector layout.rowExpandRatioArray = uidl.getIntArrayAttribute("rowExpand"); layout.updateMarginStyleNames(new MarginInfo(getState() - .getMarginsBitmask())); +.marginsBitmask)); - layout.updateSpacingStyleName(getState().isSpacing()); + layout.updateSpacingStyleName(getState().spacing); if (needCaptionUpdate) { needCaptionUpdate = false; diff --git a/client/src/com/vaadin/client/ui/image/ImageConnector.java b/client/src/com/vaadin/client/ui/image/ImageConnector.java index 7c3eb973d2..22067b051e 100644 --- a/client/src/com/vaadin/client/ui/image/ImageConnector.java +++ b/client/src/com/vaadin/client/ui/image/ImageConnector.java @@ -50,7 +50,7 @@ public class ImageConnector extends AbstractComponentConnector { getWidget().setUrl( getResourceUrl(AbstractEmbeddedState.SOURCE_RESOURCE)); - getWidget().setAltText(getState().getAlternateText()); + getWidget().setAltText(getState().alternateText); } protected final ClickEventHandler clickEventHandler = new ClickEventHandler( diff --git a/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java b/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java index ff2346d5ac..b94488896e 100644 --- a/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java +++ b/client/src/com/vaadin/client/ui/layout/LayoutDependencyTree.java @@ -311,8 +311,8 @@ public class LayoutDependencyTree { } ComponentState state = connector.getState(); s += " sizing: " - + getSizeDefinition(direction == VERTICAL ? state - .getHeight() : state.getWidth()) + "\n"; + + getSizeDefinition(direction == VERTICAL ? state.height + : state.width) + "\n"; if (needsLayout) { s += "Needs layout\n"; diff --git a/client/src/com/vaadin/client/ui/link/LinkConnector.java b/client/src/com/vaadin/client/ui/link/LinkConnector.java index 26e0e78654..d7e5f0b25f 100644 --- a/client/src/com/vaadin/client/ui/link/LinkConnector.java +++ b/client/src/com/vaadin/client/ui/link/LinkConnector.java @@ -85,10 +85,10 @@ public class LinkConnector extends AbstractComponentConnector implements .getIntAttribute("targetWidth") : -1; // Set link caption - getWidget().captionElement.setInnerText(getState().getCaption()); + getWidget().captionElement.setInnerText(getState().caption); // handle error - if (null != getState().getErrorMessage()) { + if (null != getState().errorMessage) { if (getWidget().errorIndicatorElement == null) { getWidget().errorIndicatorElement = DOM.createDiv(); DOM.setElementProperty(getWidget().errorIndicatorElement, diff --git a/client/src/com/vaadin/client/ui/menubar/MenuBarConnector.java b/client/src/com/vaadin/client/ui/menubar/MenuBarConnector.java index d187468ee5..fcd1a3bdac 100644 --- a/client/src/com/vaadin/client/ui/menubar/MenuBarConnector.java +++ b/client/src/com/vaadin/client/ui/menubar/MenuBarConnector.java @@ -29,6 +29,7 @@ import com.vaadin.client.Util; import com.vaadin.client.ui.AbstractComponentConnector; import com.vaadin.client.ui.Icon; import com.vaadin.client.ui.SimpleManagedLayout; +import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.Connect.LoadStyle; import com.vaadin.shared.ui.menubar.MenuBarConstants; @@ -69,7 +70,8 @@ public class MenuBarConnector extends AbstractComponentConnector implements UIDL options = uidl.getChildUIDL(0); - if (null != getState() && !getState().isUndefinedWidth()) { + if (null != getState() + && !ComponentStateUtil.isUndefinedWidth(getState())) { UIDL moreItemUIDL = options.getChildUIDL(0); StringBuffer itemHTML = new StringBuffer(); @@ -141,8 +143,8 @@ public class MenuBarConnector extends AbstractComponentConnector implements // this is the top-level style that also propagates to items - // any item specific styles are set above in // currentItem.updateFromUIDL(item, client) - if (getState().hasStyles()) { - for (String style : getState().getStyles()) { + if (ComponentStateUtil.hasStyles(getState())) { + for (String style : getState().styles) { currentMenu.addStyleDependentName(style); } } diff --git a/client/src/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java b/client/src/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java index e821ae1422..75a4d3f893 100644 --- a/client/src/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java +++ b/client/src/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java @@ -61,21 +61,21 @@ public class NativeButtonConnector extends AbstractComponentConnector implements public void onStateChanged(StateChangeEvent stateChangeEvent) { super.onStateChanged(stateChangeEvent); - getWidget().disableOnClick = getState().isDisableOnClick(); + getWidget().disableOnClick = getState().disableOnClick; focusHandlerRegistration = EventHelper.updateFocusHandler(this, focusHandlerRegistration); blurHandlerRegistration = EventHelper.updateBlurHandler(this, blurHandlerRegistration); // Set text - if (getState().isHtmlContentAllowed()) { - getWidget().setHTML(getState().getCaption()); + if (getState().htmlContentAllowed) { + getWidget().setHTML(getState().caption); } else { - getWidget().setText(getState().getCaption()); + getWidget().setText(getState().caption); } // handle error - if (null != getState().getErrorMessage()) { + if (null != getState().errorMessage) { if (getWidget().errorIndicatorElement == null) { getWidget().errorIndicatorElement = DOM.createSpan(); getWidget().errorIndicatorElement diff --git a/client/src/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java b/client/src/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java index 9367176c76..0081ff3c70 100644 --- a/client/src/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java +++ b/client/src/com/vaadin/client/ui/optiongroup/OptionGroupBaseConnector.java @@ -43,7 +43,7 @@ public abstract class OptionGroupBaseConnector extends AbstractFieldConnector getWidget().disabled = !isEnabled(); getWidget().multiselect = "multi".equals(uidl .getStringAttribute("selectmode")); - getWidget().immediate = getState().isImmediate(); + getWidget().immediate = getState().immediate; getWidget().nullSelectionAllowed = uidl .getBooleanAttribute("nullselect"); getWidget().nullSelectionItemAvailable = uidl diff --git a/client/src/com/vaadin/client/ui/orderedlayout/AbstractBoxLayoutConnector.java b/client/src/com/vaadin/client/ui/orderedlayout/AbstractBoxLayoutConnector.java index a4fcea81f5..6402d0696f 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/AbstractBoxLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/AbstractBoxLayoutConnector.java @@ -108,23 +108,23 @@ public abstract class AbstractBoxLayoutConnector extends Slot slot = getWidget().getSlot(child); - String caption = child.getState().getCaption(); + String caption = child.getState().caption; URLReference iconUrl = child.getState().resources .get(ComponentConstants.ICON_RESOURCE); String iconUrlString = iconUrl != null ? iconUrl.toString() : null; - List<String> styles = child.getState().getStyles(); - String error = child.getState().getErrorMessage(); + List<String> styles = child.getState().styles; + String error = child.getState().errorMessage; boolean showError = error != null; if (child.getState() instanceof AbstractFieldState) { AbstractFieldState abstractFieldState = (AbstractFieldState) child .getState(); - showError = showError && !abstractFieldState.isHideErrors(); + showError = showError && !abstractFieldState.hideErrors; } boolean required = false; if (child instanceof AbstractFieldConnector) { required = ((AbstractFieldConnector) child).isRequired(); } - boolean enabled = child.getState().isEnabled(); + boolean enabled = child.getState().enabled; slot.setCaption(caption, iconUrlString, styles, error, showError, required, @@ -213,8 +213,8 @@ public abstract class AbstractBoxLayoutConnector extends super.onStateChanged(stateChangeEvent); clickEventHandler.handleEventHandlerRegistration(); - getWidget().setMargin(new MarginInfo(getState().getMarginsBitmask())); - getWidget().setSpacing(getState().isSpacing()); + getWidget().setMargin(new MarginInfo(getState().marginsBitmask)); + getWidget().setSpacing(getState().spacing); hasExpandRatio.clear(); hasVerticalAlignment.clear(); @@ -224,8 +224,7 @@ public abstract class AbstractBoxLayoutConnector extends boolean equalExpandRatio = getWidget().vertical ? !isUndefinedHeight() : !isUndefinedWidth(); for (ComponentConnector child : getChildComponents()) { - double expandRatio = getState().getChildData().get(child) - .getExpandRatio(); + double expandRatio = getState().childData.get(child).expandRatio; if (expandRatio > 0) { equalExpandRatio = false; break; @@ -235,12 +234,12 @@ public abstract class AbstractBoxLayoutConnector extends for (ComponentConnector child : getChildComponents()) { Slot slot = getWidget().getSlot(child); - AlignmentInfo alignment = new AlignmentInfo(getState() - .getChildData().get(child).getAlignmentBitmask()); + AlignmentInfo alignment = new AlignmentInfo( + getState().childData.get(child).alignmentBitmask); slot.setAlignment(alignment); - double expandRatio = getState().getChildData().get(child) - .getExpandRatio(); + double expandRatio = getState().childData.get(child).expandRatio; + if (equalExpandRatio) { expandRatio = 1; } else if (expandRatio == 0) { diff --git a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java index d7cae9195f..5b1462b33c 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -124,18 +124,16 @@ public abstract class AbstractOrderedLayoutConnector extends for (ComponentConnector child : getChildComponents()) { VLayoutSlot slot = layout.getSlotForChild(child.getWidget()); - AlignmentInfo alignment = new AlignmentInfo(getState() - .getChildData().get(child).getAlignmentBitmask()); + AlignmentInfo alignment = new AlignmentInfo( + getState().childData.get(child).alignmentBitmask); slot.setAlignment(alignment); - double expandRatio = getState().getChildData().get(child) - .getExpandRatio(); + double expandRatio = getState().childData.get(child).expandRatio; slot.setExpandRatio(expandRatio); } - layout.updateMarginStyleNames(new MarginInfo(getState() - .getMarginsBitmask())); - layout.updateSpacingStyleName(getState().isSpacing()); + layout.updateMarginStyleNames(new MarginInfo(getState().marginsBitmask)); + layout.updateSpacingStyleName(getState().spacing); getLayoutManager().setNeedsLayout(this); } @@ -254,9 +252,9 @@ public abstract class AbstractOrderedLayoutConnector extends private String getDefinedSize(boolean isVertical) { if (isVertical) { - return getState().getHeight(); + return getState().height == null ? "" : getState().height; } else { - return getState().getWidth(); + return getState().width == null ? "" : getState().width; } } diff --git a/client/src/com/vaadin/client/ui/panel/PanelConnector.java b/client/src/com/vaadin/client/ui/panel/PanelConnector.java index f991d295b4..35a2681590 100644 --- a/client/src/com/vaadin/client/ui/panel/PanelConnector.java +++ b/client/src/com/vaadin/client/ui/panel/PanelConnector.java @@ -33,6 +33,7 @@ import com.vaadin.client.ui.ShortcutActionHandler; import com.vaadin.client.ui.SimpleManagedLayout; import com.vaadin.client.ui.layout.MayScrollChildren; import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.panel.PanelServerRpc; import com.vaadin.shared.ui.panel.PanelState; @@ -98,9 +99,8 @@ public class PanelConnector extends AbstractComponentContainerConnector + "-deco"); getWidget().captionNode.setClassName(VPanel.CLASSNAME + "-caption"); boolean hasCaption = false; - if (getState().getCaption() != null - && !"".equals(getState().getCaption())) { - getWidget().setCaption(getState().getCaption()); + if (getState().caption != null && !"".equals(getState().caption)) { + getWidget().setCaption(getState().caption); hasCaption = true; } else { getWidget().setCaption(""); @@ -117,8 +117,8 @@ public class PanelConnector extends AbstractComponentContainerConnector String captionClass = captionBaseClass; String contentClass = contentBaseClass; String decoClass = decoBaseClass; - if (getState().hasStyles()) { - for (String style : getState().getStyles()) { + if (ComponentStateUtil.hasStyles(getState())) { + for (String style : getState().styles) { captionClass += " " + captionBaseClass + "-" + style; contentClass += " " + contentBaseClass + "-" + style; decoClass += " " + decoBaseClass + "-" + style; @@ -147,7 +147,7 @@ public class PanelConnector extends AbstractComponentContainerConnector } getWidget().setErrorIndicatorVisible( - null != getState().getErrorMessage()); +null != getState().errorMessage); // We may have actions attached to this panel if (uidl.getChildCount() > 0) { @@ -164,20 +164,20 @@ public class PanelConnector extends AbstractComponentContainerConnector } } - if (getState().getScrollTop() != getWidget().scrollTop) { + if (getState().scrollTop != getWidget().scrollTop) { // Sizes are not yet up to date, so changing the scroll position // is deferred to after the layout phase - uidlScrollTop = getState().getScrollTop(); + uidlScrollTop = getState().scrollTop; } - if (getState().getScrollLeft() != getWidget().scrollLeft) { + if (getState().scrollLeft != getWidget().scrollLeft) { // Sizes are not yet up to date, so changing the scroll position // is deferred to after the layout phase - uidlScrollLeft = getState().getScrollLeft(); + uidlScrollLeft = getState().scrollLeft; } // And apply tab index - getWidget().contentNode.setTabIndex(getState().getTabIndex()); + getWidget().contentNode.setTabIndex(getState().tabIndex); } @Override diff --git a/client/src/com/vaadin/client/ui/popupview/PopupViewConnector.java b/client/src/com/vaadin/client/ui/popupview/PopupViewConnector.java index 5a4950cc0a..8def4d244d 100644 --- a/client/src/com/vaadin/client/ui/popupview/PopupViewConnector.java +++ b/client/src/com/vaadin/client/ui/popupview/PopupViewConnector.java @@ -23,6 +23,7 @@ import com.vaadin.client.VCaption; import com.vaadin.client.VCaptionWrapper; import com.vaadin.client.ui.AbstractComponentContainerConnector; import com.vaadin.client.ui.PostLayoutListener; +import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.shared.ui.Connect; import com.vaadin.ui.PopupView; @@ -69,12 +70,12 @@ public class PopupViewConnector extends AbstractComponentContainerConnector // showPopupOnTop(popup, hostReference); getWidget().preparePopup(getWidget().popup); getWidget().popup.updateFromUIDL(popupUIDL, client); - if (getState().hasStyles()) { + if (ComponentStateUtil.hasStyles(getState())) { final StringBuffer styleBuf = new StringBuffer(); final String primaryName = getWidget().popup .getStylePrimaryName(); styleBuf.append(primaryName); - for (String style : getState().getStyles()) { + for (String style : getState().styles) { styleBuf.append(" "); styleBuf.append(primaryName); styleBuf.append("-"); diff --git a/client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java b/client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java index b5c5e0d88b..5933286f8f 100644 --- a/client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java +++ b/client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java @@ -51,7 +51,7 @@ public class RichTextAreaConnector extends AbstractFieldConnector implements } getWidget().setReadOnly(isReadOnly()); - getWidget().immediate = getState().isImmediate(); + getWidget().immediate = getState().immediate; int newMaxLength = uidl.hasAttribute("maxLength") ? uidl .getIntAttribute("maxLength") : -1; if (newMaxLength >= 0) { diff --git a/client/src/com/vaadin/client/ui/slider/SliderConnector.java b/client/src/com/vaadin/client/ui/slider/SliderConnector.java index ab9a618c6d..e4c76b6ce8 100644 --- a/client/src/com/vaadin/client/ui/slider/SliderConnector.java +++ b/client/src/com/vaadin/client/ui/slider/SliderConnector.java @@ -59,15 +59,15 @@ public class SliderConnector extends AbstractFieldConnector implements super.onStateChanged(stateChangeEvent); getWidget().setId(getConnectorId()); - getWidget().setImmediate(getState().isImmediate()); + getWidget().setImmediate(getState().immediate); getWidget().setDisabled(!isEnabled()); getWidget().setReadOnly(isReadOnly()); - getWidget().setOrientation(getState().getOrientation()); - getWidget().setMinValue(getState().getMinValue()); - getWidget().setMaxValue(getState().getMaxValue()); - getWidget().setResolution(getState().getResolution()); - getWidget().setValue(getState().getValue(), false); - getWidget().setFeedbackValue(getState().getValue()); + getWidget().setOrientation(getState().orientation); + getWidget().setMinValue(getState().minValue); + getWidget().setMaxValue(getState().maxValue); + getWidget().setResolution(getState().resolution); + getWidget().setValue(getState().value, false); + getWidget().setFeedbackValue(getState().value); getWidget().buildBase(); } diff --git a/client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java b/client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java index 19b1129aea..229d3894cf 100644 --- a/client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java +++ b/client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java @@ -37,6 +37,7 @@ import com.vaadin.client.ui.SimpleManagedLayout; import com.vaadin.client.ui.splitpanel.VAbstractSplitPanel.SplitterMoveHandler; import com.vaadin.client.ui.splitpanel.VAbstractSplitPanel.SplitterMoveHandler.SplitterMoveEvent; import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.shared.ui.splitpanel.AbstractSplitPanelRpc; import com.vaadin.shared.ui.splitpanel.AbstractSplitPanelState; import com.vaadin.shared.ui.splitpanel.AbstractSplitPanelState.SplitterState; @@ -123,31 +124,31 @@ public abstract class AbstractSplitPanelConnector extends public void onStateChanged(StateChangeEvent stateChangeEvent) { super.onStateChanged(stateChangeEvent); - getWidget().immediate = getState().isImmediate(); + getWidget().immediate = getState().immediate; getWidget().setEnabled(isEnabled()); clickEventHandler.handleEventHandlerRegistration(); - if (getState().hasStyles()) { - getWidget().componentStyleNames = getState().getStyles(); + if (ComponentStateUtil.hasStyles(getState())) { + getWidget().componentStyleNames = getState().styles; } else { getWidget().componentStyleNames = new LinkedList<String>(); } // Splitter updates - SplitterState splitterState = getState().getSplitterState(); + SplitterState splitterState = getState().splitterState; getWidget().setStylenames(); - getWidget().minimumPosition = splitterState.getMinPosition() - + splitterState.getMinPositionUnit(); + getWidget().minimumPosition = splitterState.minPosition + + splitterState.minPositionUnit; - getWidget().maximumPosition = splitterState.getMaxPosition() - + splitterState.getMaxPositionUnit(); + getWidget().maximumPosition = splitterState.maxPosition + + splitterState.maxPositionUnit; - getWidget().position = splitterState.getPosition() - + splitterState.getPositionUnit(); + getWidget().position = splitterState.position + + splitterState.positionUnit; // This is needed at least for cases like #3458 to take // appearing/disappearing scrollbars into account. @@ -198,11 +199,11 @@ public abstract class AbstractSplitPanelConnector extends } private ComponentConnector getFirstChild() { - return (ComponentConnector) getState().getFirstChild(); + return (ComponentConnector) getState().firstChild; } private ComponentConnector getSecondChild() { - return (ComponentConnector) getState().getSecondChild(); + return (ComponentConnector) getState().secondChild; } @Override diff --git a/client/src/com/vaadin/client/ui/table/TableConnector.java b/client/src/com/vaadin/client/ui/table/TableConnector.java index 891d4880b3..a84a321653 100644 --- a/client/src/com/vaadin/client/ui/table/TableConnector.java +++ b/client/src/com/vaadin/client/ui/table/TableConnector.java @@ -105,7 +105,7 @@ public class TableConnector extends AbstractComponentContainerConnector } getWidget().paintableId = uidl.getStringAttribute("id"); - getWidget().immediate = getState().isImmediate(); + getWidget().immediate = getState().immediate; int previousTotalRows = getWidget().totalRows; getWidget().updateTotalRows(uidl); @@ -334,7 +334,7 @@ public class TableConnector extends AbstractComponentContainerConnector @Override public boolean isReadOnly() { - return super.isReadOnly() || getState().isPropertyReadOnly(); + return super.isReadOnly() || getState().propertyReadOnly; } @Override diff --git a/client/src/com/vaadin/client/ui/tabsheet/VTabsheet.java b/client/src/com/vaadin/client/ui/tabsheet/VTabsheet.java index ba72f319e1..b2ad68e79b 100644 --- a/client/src/com/vaadin/client/ui/tabsheet/VTabsheet.java +++ b/client/src/com/vaadin/client/ui/tabsheet/VTabsheet.java @@ -58,6 +58,7 @@ import com.vaadin.client.VCaption; import com.vaadin.client.ui.label.VLabel; import com.vaadin.shared.ComponentState; import com.vaadin.shared.EventId; +import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.shared.ui.tabsheet.TabsheetBaseConstants; import com.vaadin.shared.ui.tabsheet.TabsheetConstants; @@ -739,8 +740,8 @@ public class VTabsheet extends VTabsheetBase implements Focusable, void handleStyleNames(UIDL uidl, ComponentState state) { // Add proper stylenames for all elements (easier to prevent unwanted // style inheritance) - if (state.hasStyles()) { - final List<String> styles = state.getStyles(); + if (ComponentStateUtil.hasStyles(state)) { + final List<String> styles = state.styles; if (!currentStyle.equals(styles.toString())) { currentStyle = styles.toString(); final String tabsBaseClass = TABS_CLASSNAME; @@ -1009,8 +1010,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable, if (!isDynamicWidth()) { ComponentConnector paintable = ConnectorMap.get(client) .getConnector(this); - DOM.setStyleAttribute(tabs, "width", paintable.getState() - .getWidth()); + DOM.setStyleAttribute(tabs, "width", paintable.getState().width); } // Make sure scrollerIndex is valid diff --git a/client/src/com/vaadin/client/ui/textfield/TextFieldConnector.java b/client/src/com/vaadin/client/ui/textfield/TextFieldConnector.java index 4216919245..7fa68f2bc6 100644 --- a/client/src/com/vaadin/client/ui/textfield/TextFieldConnector.java +++ b/client/src/com/vaadin/client/ui/textfield/TextFieldConnector.java @@ -51,9 +51,9 @@ public class TextFieldConnector extends AbstractFieldConnector implements getWidget().setReadOnly(isReadOnly()); - getWidget().setInputPrompt(getState().getInputPrompt()); - getWidget().setMaxLength(getState().getMaxLength()); - getWidget().setImmediate(getState().isImmediate()); + getWidget().setInputPrompt(getState().inputPrompt); + getWidget().setMaxLength(getState().maxLength); + getWidget().setImmediate(getState().immediate); getWidget().listenTextChangeEvents = hasEventListener("ie"); if (getWidget().listenTextChangeEvents) { @@ -74,9 +74,9 @@ public class TextFieldConnector extends AbstractFieldConnector implements getWidget().sinkEvents(VTextField.TEXTCHANGE_EVENTS); getWidget().attachCutEventListener(getWidget().getElement()); } - getWidget().setColumns(getState().getColumns()); + getWidget().setColumns(getState().columns); - final String text = getState().getText(); + final String text = getState().text; /* * We skip the text content update if field has been repainted, but text diff --git a/client/src/com/vaadin/client/ui/tree/TreeConnector.java b/client/src/com/vaadin/client/ui/tree/TreeConnector.java index c7fb8084fa..7fd3b105b6 100644 --- a/client/src/com/vaadin/client/ui/tree/TreeConnector.java +++ b/client/src/com/vaadin/client/ui/tree/TreeConnector.java @@ -57,7 +57,7 @@ public class TreeConnector extends AbstractComponentConnector implements getWidget().paintableId = uidl.getId(); - getWidget().immediate = getState().isImmediate(); + getWidget().immediate = getState().immediate; getWidget().disabled = !isEnabled(); getWidget().readonly = isReadOnly(); @@ -257,7 +257,7 @@ public class TreeConnector extends AbstractComponentConnector implements @Override public boolean isReadOnly() { - return super.isReadOnly() || getState().isPropertyReadOnly(); + return super.isReadOnly() || getState().propertyReadOnly; } @Override diff --git a/client/src/com/vaadin/client/ui/upload/UploadConnector.java b/client/src/com/vaadin/client/ui/upload/UploadConnector.java index 8c23ccfbf7..7a69138d21 100644 --- a/client/src/com/vaadin/client/ui/upload/UploadConnector.java +++ b/client/src/com/vaadin/client/ui/upload/UploadConnector.java @@ -41,7 +41,7 @@ public class UploadConnector extends AbstractComponentConnector implements getWidget().submit(); return; } - getWidget().setImmediate(getState().isImmediate()); + getWidget().setImmediate(getState().immediate); getWidget().client = client; getWidget().paintableId = uidl.getId(); getWidget().nextUploadId = uidl.getIntAttribute("nextid"); diff --git a/client/src/com/vaadin/client/ui/window/WindowConnector.java b/client/src/com/vaadin/client/ui/window/WindowConnector.java index 7c83556283..f26592350a 100644 --- a/client/src/com/vaadin/client/ui/window/WindowConnector.java +++ b/client/src/com/vaadin/client/ui/window/WindowConnector.java @@ -36,8 +36,8 @@ import com.vaadin.client.ui.AbstractComponentContainerConnector; import com.vaadin.client.ui.ClickEventHandler; import com.vaadin.client.ui.PostLayoutListener; import com.vaadin.client.ui.ShortcutActionHandler; -import com.vaadin.client.ui.SimpleManagedLayout; import com.vaadin.client.ui.ShortcutActionHandler.BeforeShortcutActionListener; +import com.vaadin.client.ui.SimpleManagedLayout; import com.vaadin.client.ui.layout.MayScrollChildren; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.Connect; @@ -97,7 +97,7 @@ public class WindowConnector extends AbstractComponentContainerConnector + "_window_close"); if (isRealUpdate(uidl)) { - if (getState().isModal() != getWidget().vaadinModality) { + if (getState().modal != getWidget().vaadinModality) { getWidget().setVaadinModality(!getWidget().vaadinModality); } if (!getWidget().isAttached()) { @@ -105,12 +105,12 @@ public class WindowConnector extends AbstractComponentContainerConnector // possible centering getWidget().show(); } - if (getState().isResizable() != getWidget().resizable) { - getWidget().setResizable(getState().isResizable()); + if (getState().resizable != getWidget().resizable) { + getWidget().setResizable(getState().resizable); } - getWidget().resizeLazy = getState().isResizeLazy(); + getWidget().resizeLazy = getState().resizeLazy; - getWidget().setDraggable(getState().isDraggable()); + getWidget().setDraggable(getState().draggable); // Caption must be set before required header size is measured. If // the caption attribute is missing the caption should be cleared. @@ -118,7 +118,7 @@ public class WindowConnector extends AbstractComponentContainerConnector if (getIcon() != null) { iconURL = getIcon(); } - getWidget().setCaption(getState().getCaption(), iconURL); + getWidget().setCaption(getState().caption, iconURL); } getWidget().visibilityChangesDisabled = true; @@ -129,13 +129,13 @@ public class WindowConnector extends AbstractComponentContainerConnector clickEventHandler.handleEventHandlerRegistration(); - getWidget().immediate = getState().isImmediate(); + getWidget().immediate = getState().immediate; getWidget().setClosable(!isReadOnly()); // Initialize the position form UIDL - int positionx = getState().getPositionX(); - int positiony = getState().getPositionY(); + int positionx = getState().positionX; + int positiony = getState().positionY; if (positionx >= 0 || positiony >= 0) { if (positionx < 0) { positionx = 0; @@ -162,16 +162,16 @@ public class WindowConnector extends AbstractComponentContainerConnector } // setting scrollposition must happen after children is rendered - getWidget().contentPanel.setScrollPosition(getState().getScrollTop()); - getWidget().contentPanel.setHorizontalScrollPosition(getState() - .getScrollLeft()); + getWidget().contentPanel.setScrollPosition(getState().scrollTop); + getWidget().contentPanel + .setHorizontalScrollPosition(getState().scrollLeft); // Center this window on screen if requested // This had to be here because we might not know the content size before // everything is painted into the window // centered is this is unset on move/resize - getWidget().centered = getState().isCentered(); + getWidget().centered = getState().centered; getWidget().setVisible(true); // ensure window is not larger than browser window |