diff options
author | John Ahlroos <john@vaadin.com> | 2012-08-31 12:27:45 +0300 |
---|---|---|
committer | John Ahlroos <john@vaadin.com> | 2012-08-31 12:27:45 +0300 |
commit | dac974af9bc73491d8818581821a2c99458f71a2 (patch) | |
tree | 235145653519a5f09a929a996485e9b0fdad3115 /client | |
parent | 7b25b3886ea95bc6495506fbe9472e45fcbde684 (diff) | |
download | vaadin-framework-dac974af9bc73491d8818581821a2c99458f71a2.tar.gz vaadin-framework-dac974af9bc73491d8818581821a2c99458f71a2.zip |
Removed getters/setters from states and made instance variabled public
Diffstat (limited to 'client')
44 files changed, 198 insertions, 197 deletions
diff --git a/client/src/com/vaadin/client/ComponentLocator.java b/client/src/com/vaadin/client/ComponentLocator.java index febe871b9d..0701d4ff21 100644 --- a/client/src/com/vaadin/client/ComponentLocator.java +++ b/client/src/com/vaadin/client/ComponentLocator.java @@ -606,7 +606,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 ce1d3c9c01..a0d8761581 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 @@ -1077,7 +1077,7 @@ public class LayoutManager { int assignedHeight) { assert component.isRelativeHeight(); - float percentSize = parsePercent(component.getState().getHeight()); + float percentSize = parsePercent(component.getState().height); int effectiveHeight = Math.round(assignedHeight * (percentSize / 100)); reportOuterHeight(component, effectiveHeight); @@ -1100,7 +1100,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..a3d3a7034e 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 @@ -110,8 +110,9 @@ public class VCaption extends HTML { placedAfterComponent = true; String style = CLASSNAME; - if (owner.getState().hasStyles()) { - for (String customStyle : owner.getState().getStyles()) { + if (owner.getState().styles != null + && !owner.getState().styles.isEmpty()) { + 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,7 @@ public class VCaption extends HTML { captionText = null; } - if (owner.getState().hasDescription() && captionText != null) { + if (owner.getState().description != null && captionText != null) { addStyleDependentName("hasdescription"); } else { removeStyleDependentName("hasdescription"); @@ -392,13 +393,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/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java index 18c13b4b7f..8ac113e72e 100644 --- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java @@ -124,8 +124,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector 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"); @@ -138,8 +138,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector */ if (getState() instanceof TabIndexState && getWidget() instanceof Focusable) { - ((Focusable) getWidget()).setTabIndex(((TabIndexState) getState()) - .getTabIndex()); + ((Focusable) getWidget()) + .setTabIndex(((TabIndexState) getState()).tabIndex); } super.onStateChanged(stateChangeEvent); @@ -192,8 +192,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector } 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 @@ -228,22 +228,22 @@ public abstract class AbstractComponentConnector extends AbstractConnector @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; } /* @@ -278,14 +278,14 @@ public abstract class AbstractComponentConnector extends AbstractConnector // 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 (state.styles != null && !state.styles.isEmpty()) { // 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); @@ -293,14 +293,14 @@ public abstract class AbstractComponentConnector extends AbstractConnector 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) { @@ -373,7 +373,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector @Override @Deprecated public boolean isReadOnly() { - return getState().isReadOnly(); + return getState().readOnly; } @Override @@ -392,7 +392,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector */ @Override public boolean hasEventListener(String eventIdentifier) { - Set<String> reg = getState().getRegisteredEventListeners(); + Set<String> reg = getState().registeredEventListeners; return (reg != null && reg.contains(eventIdentifier)); } @@ -425,8 +425,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector */ @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 989867d40e..b9f254f75c 100644 --- a/client/src/com/vaadin/client/ui/AbstractConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractConnector.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -321,7 +321,7 @@ public abstract class AbstractConnector implements ServerConnector, @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/UI/UIConnector.java b/client/src/com/vaadin/client/ui/UI/UIConnector.java index 920bf152f9..b22e9af09b 100644 --- a/client/src/com/vaadin/client/ui/UI/UIConnector.java +++ b/client/src/com/vaadin/client/ui/UI/UIConnector.java @@ -91,7 +91,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 +106,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 +119,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 (getState().styles != null && !getState().styles.isEmpty()) { + for (String style : getState().styles) { styles += style + " "; } } @@ -338,7 +338,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..13e2011eb2 100644 --- a/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java @@ -126,7 +126,7 @@ public class AbsoluteLayoutConnector extends for (ComponentConnector child : getChildComponents()) { getWrapper(child).setPosition( - getState().getConnectorPosition(child)); + getState().connectorToCssPosition.get(child)); } }; 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..efca4ca083 100644 --- a/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java +++ b/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java @@ -580,8 +580,9 @@ 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 (componentState.styles == null + || componentState.styles.isEmpty()) { + 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..1be137dcaa 100644 --- a/client/src/com/vaadin/client/ui/form/FormConnector.java +++ b/client/src/com/vaadin/client/ui/form/FormConnector.java @@ -81,8 +81,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 +105,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 (getState().description != null) { + getWidget().desc.setInnerHTML(getState().description); if (getWidget().desc.getParentElement() == null) { getWidget().fieldSet.insertAfter(getWidget().desc, getWidget().legend); @@ -128,10 +127,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 +156,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 +205,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..c39b945220 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 @@ -66,8 +66,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 (state.styles != null && !state.styles.isEmpty()) { + for (String name : state.styles) { styles.add(name); } } @@ -271,13 +271,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 +288,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..7dcbbadcd3 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 (getState().styles != null && !getState().styles.isEmpty()) { + 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/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..35adf95066 100644 --- a/client/src/com/vaadin/client/ui/panel/PanelConnector.java +++ b/client/src/com/vaadin/client/ui/panel/PanelConnector.java @@ -98,9 +98,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 +116,8 @@ public class PanelConnector extends AbstractComponentContainerConnector String captionClass = captionBaseClass; String contentClass = contentBaseClass; String decoClass = decoBaseClass; - if (getState().hasStyles()) { - for (String style : getState().getStyles()) { + if (getState().styles != null && !getState().styles.isEmpty()) { + for (String style : getState().styles) { captionClass += " " + captionBaseClass + "-" + style; contentClass += " " + contentBaseClass + "-" + style; decoClass += " " + decoBaseClass + "-" + style; @@ -147,7 +146,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 +163,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..efc6c8c4d7 100644 --- a/client/src/com/vaadin/client/ui/popupview/PopupViewConnector.java +++ b/client/src/com/vaadin/client/ui/popupview/PopupViewConnector.java @@ -69,12 +69,12 @@ public class PopupViewConnector extends AbstractComponentContainerConnector // showPopupOnTop(popup, hostReference); getWidget().preparePopup(getWidget().popup); getWidget().popup.updateFromUIDL(popupUIDL, client); - if (getState().hasStyles()) { + if (getState().styles != null && !getState().styles.isEmpty()) { 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..a0bfc36298 100644 --- a/client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java +++ b/client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java @@ -123,31 +123,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 (getState().styles != null && !getState().styles.isEmpty()) { + 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 +198,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..bd77c0d7d9 100644 --- a/client/src/com/vaadin/client/ui/tabsheet/VTabsheet.java +++ b/client/src/com/vaadin/client/ui/tabsheet/VTabsheet.java @@ -739,8 +739,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 (state.styles != null && !state.styles.isEmpty()) { + final List<String> styles = state.styles; if (!currentStyle.equals(styles.toString())) { currentStyle = styles.toString(); final String tabsBaseClass = TABS_CLASSNAME; @@ -1009,8 +1009,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 |