From: John Ahlroos Date: Fri, 31 Aug 2012 09:27:45 +0000 (+0300) Subject: Removed getters/setters from states and made instance variabled public X-Git-Tag: 7.0.0.beta1~209^2~12^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dac974af9bc73491d8818581821a2c99458f71a2;p=vaadin-framework.git Removed getters/setters from states and made instance variabled public --- 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 attribute. */ 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 connectorsInHierarchy = new HashSet(); 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 newStyles = new ArrayList(); - 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 reg = getState().getRegisteredEventListeners(); + Set 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 styles = new ArrayList(); - 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(); } // 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 styles = state.getStyles(); + if (state.styles != null && !state.styles.isEmpty()) { + final List 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 diff --git a/server/src/com/vaadin/ui/AbsoluteLayout.java b/server/src/com/vaadin/ui/AbsoluteLayout.java index 794de49671..e3eecaac12 100644 --- a/server/src/com/vaadin/ui/AbsoluteLayout.java +++ b/server/src/com/vaadin/ui/AbsoluteLayout.java @@ -182,7 +182,7 @@ public class AbsoluteLayout extends AbstractLayout implements connectorToPosition.put(c.getConnectorId(), getPosition(c) .getCSSString()); } - getState().setConnectorToCssPosition(connectorToPosition); + getState().connectorToCssPosition = connectorToPosition; } @@ -639,6 +639,7 @@ public class AbsoluteLayout extends AbstractLayout implements * @deprecated Since 7.0, replaced by * {@link #addLayoutClickListener(LayoutClickListener)} **/ + @Override @Deprecated public void addListener(LayoutClickListener listener) { addLayoutClickListener(listener); @@ -654,6 +655,7 @@ public class AbsoluteLayout extends AbstractLayout implements * @deprecated Since 7.0, replaced by * {@link #removeLayoutClickListener(LayoutClickListener)} **/ + @Override @Deprecated public void removeListener(LayoutClickListener listener) { removeLayoutClickListener(listener); diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index 045173036e..e367d39b07 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -40,6 +40,7 @@ import com.vaadin.server.Resource; import com.vaadin.server.Terminal; import com.vaadin.shared.ComponentConstants; import com.vaadin.shared.ComponentState; +import com.vaadin.shared.ui.ComponentStateUtil; import com.vaadin.tools.ReflectTools; /** @@ -118,7 +119,7 @@ public abstract class AbstractComponent extends AbstractClientConnector */ @Override public void setId(String id) { - getState().setId(id); + getState().id = id; } /* @@ -128,7 +129,7 @@ public abstract class AbstractComponent extends AbstractClientConnector */ @Override public String getId() { - return getState().getId(); + return getState().id; } /** @@ -154,8 +155,8 @@ public abstract class AbstractComponent extends AbstractClientConnector @Override public String getStyleName() { String s = ""; - if (getState().getStyles() != null) { - for (final Iterator it = getState().getStyles().iterator(); it + if (getState().styles != null) { + for (final Iterator it = getState().styles.iterator(); it .hasNext();) { s += it.next(); if (it.hasNext()) { @@ -173,13 +174,13 @@ public abstract class AbstractComponent extends AbstractClientConnector @Override public void setStyleName(String style) { if (style == null || "".equals(style)) { - getState().setStyles(null); + getState().styles = null; return; } - if (getState().getStyles() == null) { - getState().setStyles(new ArrayList()); + if (getState().styles == null) { + getState().styles = new ArrayList(); } - List styles = getState().getStyles(); + List styles = getState().styles; styles.clear(); String[] styleParts = style.split(" +"); for (String part : styleParts) { @@ -202,10 +203,10 @@ public abstract class AbstractComponent extends AbstractClientConnector return; } - if (getState().getStyles() == null) { - getState().setStyles(new ArrayList()); + if (getState().styles == null) { + getState().styles = new ArrayList(); } - List styles = getState().getStyles(); + List styles = getState().styles; if (!styles.contains(style)) { styles.add(style); } @@ -213,11 +214,11 @@ public abstract class AbstractComponent extends AbstractClientConnector @Override public void removeStyleName(String style) { - if (getState().getStyles() != null) { + if (getState().styles != null) { String[] styleParts = style.split(" +"); for (String part : styleParts) { if (part.length() > 0) { - getState().getStyles().remove(part); + getState().styles.remove(part); } } } @@ -229,7 +230,7 @@ public abstract class AbstractComponent extends AbstractClientConnector */ @Override public String getCaption() { - return getState().getCaption(); + return getState().caption; } /** @@ -242,7 +243,7 @@ public abstract class AbstractComponent extends AbstractClientConnector */ @Override public void setCaption(String caption) { - getState().setCaption(caption); + getState().caption = caption; } /* @@ -319,7 +320,7 @@ public abstract class AbstractComponent extends AbstractClientConnector */ @Override public boolean isEnabled() { - return getState().isEnabled(); + return getState().enabled; } /* @@ -329,7 +330,7 @@ public abstract class AbstractComponent extends AbstractClientConnector */ @Override public void setEnabled(boolean enabled) { - getState().setEnabled(enabled); + getState().enabled = enabled; } /* @@ -358,7 +359,7 @@ public abstract class AbstractComponent extends AbstractClientConnector * interface. */ public boolean isImmediate() { - return getState().isImmediate(); + return getState().immediate; } /** @@ -371,7 +372,7 @@ public abstract class AbstractComponent extends AbstractClientConnector * @see Component#isImmediate() */ public void setImmediate(boolean immediate) { - getState().setImmediate(immediate); + getState().immediate = immediate; } /* @@ -381,7 +382,7 @@ public abstract class AbstractComponent extends AbstractClientConnector */ @Override public boolean isVisible() { - return getState().isVisible(); + return getState().visible; } /* @@ -391,11 +392,11 @@ public abstract class AbstractComponent extends AbstractClientConnector */ @Override public void setVisible(boolean visible) { - if (getState().isVisible() == visible) { + if (getState().visible == visible) { return; } - getState().setVisible(visible); + getState().visible = visible; if (getParent() != null) { // Must always repaint the parent (at least the hierarchy) when // visibility of a child component changes. @@ -461,7 +462,7 @@ public abstract class AbstractComponent extends AbstractClientConnector * @return component's description String */ public String getDescription() { - return getState().getDescription(); + return getState().description; } /** @@ -477,7 +478,7 @@ public abstract class AbstractComponent extends AbstractClientConnector * the new description string for the component. */ public void setDescription(String description) { - getState().setDescription(description); + getState().description = description; } /* @@ -570,7 +571,7 @@ public abstract class AbstractComponent extends AbstractClientConnector */ @Override public boolean isReadOnly() { - return getState().isReadOnly(); + return getState().readOnly; } /* @@ -579,7 +580,7 @@ public abstract class AbstractComponent extends AbstractClientConnector */ @Override public void setReadOnly(boolean readOnly) { - getState().setReadOnly(readOnly); + getState().readOnly = readOnly; } /* @@ -700,24 +701,24 @@ public abstract class AbstractComponent extends AbstractClientConnector if (getHeight() >= 0 && (getHeightUnits() != Unit.PERCENTAGE || ComponentSizeValidator .parentCanDefineHeight(this))) { - getState().setHeight("" + getCSSHeight()); + getState().height = "" + getCSSHeight(); } else { - getState().setHeight(""); + getState().height = ""; } if (getWidth() >= 0 && (getWidthUnits() != Unit.PERCENTAGE || ComponentSizeValidator .parentCanDefineWidth(this))) { - getState().setWidth("" + getCSSWidth()); + getState().width = "" + getCSSWidth(); } else { - getState().setWidth(""); + getState().width = ""; } ErrorMessage error = getErrorMessage(); if (null != error) { - getState().setErrorMessage(error.getFormattedHtmlMessage()); + getState().errorMessage = error.getFormattedHtmlMessage(); } else { - getState().setErrorMessage(null); + getState().errorMessage = null; } } @@ -766,7 +767,8 @@ public abstract class AbstractComponent extends AbstractClientConnector eventRouter.addListener(eventType, target, method); if (needRepaint) { - getState().addRegisteredEventListener(eventIdentifier); + ComponentStateUtil.addRegisteredEventListener(getState(), + eventIdentifier); } } @@ -814,7 +816,8 @@ public abstract class AbstractComponent extends AbstractClientConnector if (eventRouter != null) { eventRouter.removeListener(eventType, target); if (!eventRouter.hasListeners(eventType)) { - getState().removeRegisteredEventListener(eventIdentifier); + ComponentStateUtil.removeRegisteredEventListener(getState(), + eventIdentifier); } } } diff --git a/server/src/com/vaadin/ui/AbstractComponentContainer.java b/server/src/com/vaadin/ui/AbstractComponentContainer.java index cf3bf1d2b9..31529ca0d6 100644 --- a/server/src/com/vaadin/ui/AbstractComponentContainer.java +++ b/server/src/com/vaadin/ui/AbstractComponentContainer.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -115,6 +115,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent * @deprecated Since 7.0, replaced by * {@link #addComponentAttachListener(com.vaadin.ui.ComponentContainer.ComponentAttachListener)} **/ + @Override @Deprecated public void addListener(ComponentAttachListener listener) { addComponentAttachListener(listener); @@ -131,6 +132,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent * @deprecated Since 7.0, replaced by * {@link #addComponentDetachListener(com.vaadin.ui.ComponentContainer.ComponentDetachListener)} **/ + @Override @Deprecated public void addListener(ComponentDetachListener listener) { addComponentDetachListener(listener); @@ -147,6 +149,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent * @deprecated Since 7.0, replaced by * {@link #removeComponentAttachListener(com.vaadin.ui.ComponentContainer.ComponentAttachListener)} **/ + @Override @Deprecated public void removeListener(ComponentAttachListener listener) { removeComponentAttachListener(listener); @@ -163,6 +166,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent * @deprecated Since 7.0, replaced by * {@link #removeComponentDetachListener(com.vaadin.ui.ComponentContainer.ComponentDetachListener)} **/ + @Override @Deprecated public void removeListener(ComponentDetachListener listener) { removeComponentDetachListener(listener); @@ -240,7 +244,7 @@ public abstract class AbstractComponentContainer extends AbstractComponent @Override public void setVisible(boolean visible) { - if (getState().isVisible() == visible) { + if (getState().visible == visible) { return; } diff --git a/server/src/com/vaadin/ui/AbstractEmbedded.java b/server/src/com/vaadin/ui/AbstractEmbedded.java index d94f62120f..5c72141ef9 100644 --- a/server/src/com/vaadin/ui/AbstractEmbedded.java +++ b/server/src/com/vaadin/ui/AbstractEmbedded.java @@ -52,10 +52,10 @@ public abstract class AbstractEmbedded extends AbstractComponent { * content. */ public void setAlternateText(String altText) { - if (altText != getState().getAlternateText() - || (altText != null && !altText.equals(getState() - .getAlternateText()))) { - getState().setAlternateText(altText); + if (altText != getState().alternateText + || (altText != null && !altText + .equals(getState().alternateText))) { + getState().alternateText = altText; requestRepaint(); } } @@ -67,7 +67,7 @@ public abstract class AbstractEmbedded extends AbstractComponent { * @returns Alternate text */ public String getAlternateText() { - return getState().getAlternateText(); + return getState().alternateText; } } diff --git a/server/src/com/vaadin/ui/AbstractField.java b/server/src/com/vaadin/ui/AbstractField.java index b1d45ae590..548cb06c8f 100644 --- a/server/src/com/vaadin/ui/AbstractField.java +++ b/server/src/com/vaadin/ui/AbstractField.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -355,11 +355,11 @@ public abstract class AbstractField extends AbstractComponent implements */ @Override public boolean isModified() { - return getState().isModified(); + return getState().modified; } private void setModified(boolean modified) { - getState().setModified(modified); + getState().modified = modified; } /** @@ -632,8 +632,8 @@ public abstract class AbstractField extends AbstractComponent implements // Sets the new data source dataSource = newDataSource; - getState().setPropertyReadOnly( - dataSource == null ? false : dataSource.isReadOnly()); + getState().propertyReadOnly = dataSource == null ? false : dataSource + .isReadOnly(); // Check if the current converter is compatible. if (newDataSource != null @@ -1056,6 +1056,7 @@ public abstract class AbstractField extends AbstractComponent implements * @deprecated Since 7.0, replaced by * {@link #addValueChangeListener(com.vaadin.data.Property.ValueChangeListener)} **/ + @Override @Deprecated public void addListener(Property.ValueChangeListener listener) { addValueChangeListener(listener); @@ -1076,6 +1077,7 @@ public abstract class AbstractField extends AbstractComponent implements * @deprecated Since 7.0, replaced by * {@link #removeValueChangeListener(com.vaadin.data.Property.ValueChangeListener)} **/ + @Override @Deprecated public void removeListener(Property.ValueChangeListener listener) { removeValueChangeListener(listener); @@ -1117,7 +1119,7 @@ public abstract class AbstractField extends AbstractComponent implements */ @Override public void readOnlyStatusChange(Property.ReadOnlyStatusChangeEvent event) { - getState().setPropertyReadOnly(event.getProperty().isReadOnly()); + getState().propertyReadOnly = event.getProperty().isReadOnly(); } /** @@ -1167,6 +1169,7 @@ public abstract class AbstractField extends AbstractComponent implements * @deprecated Since 7.0, replaced by * {@link #addReadOnlyStatusChangeListener(com.vaadin.data.Property.ReadOnlyStatusChangeListener)} **/ + @Override @Deprecated public void addListener(Property.ReadOnlyStatusChangeListener listener) { addReadOnlyStatusChangeListener(listener); @@ -1188,6 +1191,7 @@ public abstract class AbstractField extends AbstractComponent implements * @deprecated Since 7.0, replaced by * {@link #removeReadOnlyStatusChangeListener(com.vaadin.data.Property.ReadOnlyStatusChangeListener)} **/ + @Override @Deprecated public void removeListener(Property.ReadOnlyStatusChangeListener listener) { removeReadOnlyStatusChangeListener(listener); @@ -1258,7 +1262,7 @@ public abstract class AbstractField extends AbstractComponent implements */ @Override public int getTabIndex() { - return getState().getTabIndex(); + return getState().tabIndex; } /* @@ -1268,7 +1272,7 @@ public abstract class AbstractField extends AbstractComponent implements */ @Override public void setTabIndex(int tabIndex) { - getState().setTabIndex(tabIndex); + getState().tabIndex = tabIndex; } /** @@ -1350,7 +1354,7 @@ public abstract class AbstractField extends AbstractComponent implements */ @Override public boolean isRequired() { - return getState().isRequired(); + return getState().required; } /** @@ -1370,7 +1374,7 @@ public abstract class AbstractField extends AbstractComponent implements */ @Override public void setRequired(boolean required) { - getState().setRequired(required); + getState().required = required; } /** @@ -1569,7 +1573,7 @@ public abstract class AbstractField extends AbstractComponent implements super.beforeClientResponse(initial); // Hide the error indicator if needed - getState().setHideErrors(shouldHideErrors()); + getState().hideErrors = shouldHideErrors(); } /** diff --git a/server/src/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/com/vaadin/ui/AbstractOrderedLayout.java index 184f7c40f4..4e27dbb158 100644 --- a/server/src/com/vaadin/ui/AbstractOrderedLayout.java +++ b/server/src/com/vaadin/ui/AbstractOrderedLayout.java @@ -143,11 +143,11 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements } private void componentRemoved(Component c) { - getState().getChildData().remove(c); + getState().childData.remove(c); } private void componentAdded(Component c) { - getState().getChildData().put(c, new ChildComponentData()); + getState().childData.put(c, new ChildComponentData()); } /** @@ -232,11 +232,11 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements @Override public void setComponentAlignment(Component childComponent, Alignment alignment) { - ChildComponentData childData = getState().getChildData().get( + ChildComponentData childData = getState().childData.get( childComponent); if (childData != null) { // Alignments are bit masks - childData.setAlignmentBitmask(alignment.getBitMask()); + childData.alignmentBitmask = alignment.getBitMask(); } else { throw new IllegalArgumentException( "Component must be added to layout before using setComponentAlignment()"); @@ -252,14 +252,14 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements */ @Override public Alignment getComponentAlignment(Component childComponent) { - ChildComponentData childData = getState().getChildData().get( + ChildComponentData childData = getState().childData.get( childComponent); if (childData == null) { throw new IllegalArgumentException( "The given component is not a child of this layout"); } - return new Alignment(childData.getAlignmentBitmask()); + return new Alignment(childData.alignmentBitmask); } /* @@ -269,7 +269,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements */ @Override public void setSpacing(boolean spacing) { - getState().setSpacing(spacing); + getState().spacing = spacing; } /* @@ -279,7 +279,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements */ @Override public boolean isSpacing() { - return getState().isSpacing(); + return getState().spacing; } /** @@ -312,13 +312,13 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements * @param ratio */ public void setExpandRatio(Component component, float ratio) { - ChildComponentData childData = getState().getChildData().get(component); + ChildComponentData childData = getState().childData.get(component); if (childData == null) { throw new IllegalArgumentException( "The given component is not a child of this layout"); } - childData.setExpandRatio(ratio); + childData.expandRatio = ratio; } /** @@ -329,13 +329,13 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements * @return expand ratio of given component, 0.0f by default. */ public float getExpandRatio(Component component) { - ChildComponentData childData = getState().getChildData().get(component); + ChildComponentData childData = getState().childData.get(component); if (childData == null) { throw new IllegalArgumentException( "The given component is not a child of this layout"); } - return childData.getExpandRatio(); + return childData.expandRatio; } @Override @@ -349,6 +349,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements * @deprecated Since 7.0, replaced by * {@link #addLayoutClickListener(LayoutClickListener)} **/ + @Override @Deprecated public void addListener(LayoutClickListener listener) { addLayoutClickListener(listener); @@ -364,6 +365,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements * @deprecated Since 7.0, replaced by * {@link #removeLayoutClickListener(LayoutClickListener)} **/ + @Override @Deprecated public void removeListener(LayoutClickListener listener) { removeLayoutClickListener(listener); @@ -405,7 +407,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements */ @Override public MarginInfo getMargin() { - return new MarginInfo(getState().getMarginsBitmask()); + return new MarginInfo(getState().marginsBitmask); } /* @@ -415,6 +417,6 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements */ @Override public void setMargin(MarginInfo marginInfo) { - getState().setMarginsBitmask(marginInfo.getBitMask()); + getState().marginsBitmask = marginInfo.getBitMask(); } } diff --git a/server/src/com/vaadin/ui/AbstractSplitPanel.java b/server/src/com/vaadin/ui/AbstractSplitPanel.java index f1452caacf..c5df57b36f 100644 --- a/server/src/com/vaadin/ui/AbstractSplitPanel.java +++ b/server/src/com/vaadin/ui/AbstractSplitPanel.java @@ -56,7 +56,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { @Override public void setSplitterPosition(float position) { - getSplitterState().setPosition(position); + getSplitterState().position = position; } }; @@ -150,7 +150,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { // detach old removeComponent(getFirstComponent()); } - getState().setFirstChild(c); + getState().firstChild = c; if (c != null) { super.addComponent(c); } @@ -173,7 +173,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { // detach old removeComponent(getSecondComponent()); } - getState().setSecondChild(c); + getState().secondChild = c; if (c != null) { super.addComponent(c); } @@ -186,7 +186,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { * @return the first component of this split panel */ public Component getFirstComponent() { - return (Component) getState().getFirstChild(); + return (Component) getState().firstChild; } /** @@ -196,7 +196,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { * @return the second component of this split panel */ public Component getSecondComponent() { - return (Component) getState().getSecondChild(); + return (Component) getState().secondChild; } /** @@ -210,9 +210,9 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { public void removeComponent(Component c) { super.removeComponent(c); if (c == getFirstComponent()) { - getState().setFirstChild(null); + getState().firstChild = null; } else if (c == getSecondComponent()) { - getState().setSecondChild(null); + getState().secondChild = null; } markAsDirty(); } @@ -322,9 +322,9 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { pos = Math.round(pos); } SplitterState splitterState = getSplitterState(); - splitterState.setPosition(pos); - splitterState.setPositionUnit(unit.getSymbol()); - splitterState.setPositionReversed(reverse); + splitterState.position = pos; + splitterState.positionUnit = unit.getSymbol(); + splitterState.positionReversed = reverse; posUnit = unit; } @@ -335,7 +335,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { * @return position of the splitter */ public float getSplitPosition() { - return getSplitterState().getPosition(); + return getSplitterState().position; } /** @@ -358,7 +358,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { * Allowed units are UNITS_PERCENTAGE and UNITS_PIXELS */ public void setMinSplitPosition(int pos, Unit unit) { - setSplitPositionLimits(pos, unit, getSplitterState().getMaxPosition(), + setSplitPositionLimits(pos, unit, getSplitterState().maxPosition, posMaxUnit); } @@ -369,7 +369,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { * @return the minimum position of the splitter */ public float getMinSplitPosition() { - return getSplitterState().getMinPosition(); + return getSplitterState().minPosition; } /** @@ -392,7 +392,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { * Allowed units are UNITS_PERCENTAGE and UNITS_PIXELS */ public void setMaxSplitPosition(float pos, Unit unit) { - setSplitPositionLimits(getSplitterState().getMinPosition(), posMinUnit, + setSplitPositionLimits(getSplitterState().minPosition, posMinUnit, pos, unit); } @@ -403,7 +403,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { * @return the maximum position of the splitter */ public float getMaxSplitPosition() { - return getSplitterState().getMaxPosition(); + return getSplitterState().maxPosition; } /** @@ -440,12 +440,12 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { SplitterState state = getSplitterState(); - state.setMinPosition(minPos); - state.setMinPositionUnit(minPosUnit.getSymbol()); + state.minPosition = minPos; + state.minPositionUnit = minPosUnit.getSymbol(); posMinUnit = minPosUnit; - state.setMaxPosition(maxPos); - state.setMaxPositionUnit(maxPosUnit.getSymbol()); + state.maxPosition = maxPos; + state.maxPositionUnit = maxPosUnit.getSymbol(); posMaxUnit = maxPosUnit; } @@ -457,7 +457,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { * Set true if locked, false otherwise. */ public void setLocked(boolean locked) { - getSplitterState().setLocked(locked); + getSplitterState().locked = locked; } /** @@ -467,7 +467,7 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { * @return true if locked, false otherwise. */ public boolean isLocked() { - return getSplitterState().isLocked(); + return getSplitterState().locked; } /** @@ -535,6 +535,6 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { } private SplitterState getSplitterState() { - return getState().getSplitterState(); + return getState().splitterState; } } diff --git a/server/src/com/vaadin/ui/AbstractTextField.java b/server/src/com/vaadin/ui/AbstractTextField.java index c187d9e198..0cb74dae6d 100644 --- a/server/src/com/vaadin/ui/AbstractTextField.java +++ b/server/src/com/vaadin/ui/AbstractTextField.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -27,9 +27,9 @@ import com.vaadin.event.FieldEvents.FocusNotifier; import com.vaadin.event.FieldEvents.TextChangeEvent; import com.vaadin.event.FieldEvents.TextChangeListener; import com.vaadin.event.FieldEvents.TextChangeNotifier; +import com.vaadin.server.LegacyComponent; import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; -import com.vaadin.server.LegacyComponent; import com.vaadin.shared.ui.textfield.AbstractTextFieldState; import com.vaadin.shared.ui.textfield.TextFieldConstants; @@ -104,7 +104,7 @@ public abstract class AbstractTextField extends AbstractField implements if (value == null) { value = getNullRepresentation(); } - getState().setText(value); + getState().text = value; } @Override @@ -312,7 +312,7 @@ public abstract class AbstractTextField extends AbstractField implements * @return the maxLength */ public int getMaxLength() { - return getState().getMaxLength(); + return getState().maxLength; } /** @@ -323,7 +323,7 @@ public abstract class AbstractTextField extends AbstractField implements * the maxLength to set */ public void setMaxLength(int maxLength) { - getState().setMaxLength(maxLength); + getState().maxLength = maxLength; } /** @@ -334,7 +334,7 @@ public abstract class AbstractTextField extends AbstractField implements * @return the number of columns in the editor. */ public int getColumns() { - return getState().getColumns(); + return getState().columns; } /** @@ -349,7 +349,7 @@ public abstract class AbstractTextField extends AbstractField implements if (columns < 0) { columns = 0; } - getState().setColumns(columns); + getState().columns = columns; } /** @@ -359,7 +359,7 @@ public abstract class AbstractTextField extends AbstractField implements * @return the current input prompt, or null if not enabled */ public String getInputPrompt() { - return getState().getInputPrompt(); + return getState().inputPrompt; } /** @@ -369,7 +369,7 @@ public abstract class AbstractTextField extends AbstractField implements * @param inputPrompt */ public void setInputPrompt(String inputPrompt) { - getState().setInputPrompt(inputPrompt); + getState().inputPrompt = inputPrompt; } /* ** Text Change Events ** */ @@ -521,6 +521,7 @@ public abstract class AbstractTextField extends AbstractField implements * @deprecated Since 7.0, replaced by * {@link #addTextChangeListener(TextChangeListener)} **/ + @Override @Deprecated public void addListener(TextChangeListener listener) { addTextChangeListener(listener); @@ -536,6 +537,7 @@ public abstract class AbstractTextField extends AbstractField implements * @deprecated Since 7.0, replaced by * {@link #removeTextChangeListener(TextChangeListener)} **/ + @Override @Deprecated public void removeListener(TextChangeListener listener) { removeTextChangeListener(listener); @@ -688,6 +690,7 @@ public abstract class AbstractTextField extends AbstractField implements * @deprecated Since 7.0, replaced by * {@link #addFocusListener(FocusListener)} **/ + @Override @Deprecated public void addListener(FocusListener listener) { addFocusListener(listener); @@ -702,6 +705,7 @@ public abstract class AbstractTextField extends AbstractField implements * @deprecated Since 7.0, replaced by * {@link #removeFocusListener(FocusListener)} **/ + @Override @Deprecated public void removeListener(FocusListener listener) { removeFocusListener(listener); @@ -716,6 +720,7 @@ public abstract class AbstractTextField extends AbstractField implements /** * @deprecated Since 7.0, replaced by {@link #addBlurListener(BlurListener)} **/ + @Override @Deprecated public void addListener(BlurListener listener) { addBlurListener(listener); @@ -730,6 +735,7 @@ public abstract class AbstractTextField extends AbstractField implements * @deprecated Since 7.0, replaced by * {@link #removeBlurListener(BlurListener)} **/ + @Override @Deprecated public void removeListener(BlurListener listener) { removeBlurListener(listener); diff --git a/server/src/com/vaadin/ui/Button.java b/server/src/com/vaadin/ui/Button.java index 2e026ebc52..bbed7d540f 100644 --- a/server/src/com/vaadin/ui/Button.java +++ b/server/src/com/vaadin/ui/Button.java @@ -367,6 +367,7 @@ public class Button extends AbstractComponent implements /** * @deprecated Since 7.0, replaced by {@link #addBlurListener(BlurListener)} **/ + @Override @Deprecated public void addListener(BlurListener listener) { addBlurListener(listener); @@ -381,6 +382,7 @@ public class Button extends AbstractComponent implements * @deprecated Since 7.0, replaced by * {@link #removeBlurListener(BlurListener)} **/ + @Override @Deprecated public void removeListener(BlurListener listener) { removeBlurListener(listener); @@ -396,6 +398,7 @@ public class Button extends AbstractComponent implements * @deprecated Since 7.0, replaced by * {@link #addFocusListener(FocusListener)} **/ + @Override @Deprecated public void addListener(FocusListener listener) { addFocusListener(listener); @@ -410,6 +413,7 @@ public class Button extends AbstractComponent implements * @deprecated Since 7.0, replaced by * {@link #removeFocusListener(FocusListener)} **/ + @Override @Deprecated public void removeListener(FocusListener listener) { removeFocusListener(listener); @@ -438,7 +442,7 @@ public class Button extends AbstractComponent implements } clickShortcut = new ClickShortcut(this, keyCode, modifiers); addShortcutListener(clickShortcut); - getState().setClickShortcutKeyCode(clickShortcut.getKeyCode()); + getState().clickShortcutKeyCode = clickShortcut.getKeyCode(); } /** @@ -449,7 +453,7 @@ public class Button extends AbstractComponent implements if (clickShortcut != null) { removeShortcutListener(clickShortcut); clickShortcut = null; - getState().setClickShortcutKeyCode(0); + getState().clickShortcutKeyCode = 0; } } @@ -517,7 +521,7 @@ public class Button extends AbstractComponent implements * @return true if the button is disabled when clicked, false otherwise */ public boolean isDisableOnClick() { - return getState().isDisableOnClick(); + return getState().disableOnClick; } /** @@ -533,7 +537,7 @@ public class Button extends AbstractComponent implements * true to disable button when it is clicked, false otherwise */ public void setDisableOnClick(boolean disableOnClick) { - getState().setDisableOnClick(disableOnClick); + getState().disableOnClick = disableOnClick; } /* @@ -543,7 +547,7 @@ public class Button extends AbstractComponent implements */ @Override public int getTabIndex() { - return getState().getTabIndex(); + return getState().tabIndex; } /* @@ -553,7 +557,7 @@ public class Button extends AbstractComponent implements */ @Override public void setTabIndex(int tabIndex) { - getState().setTabIndex(tabIndex); + getState().tabIndex = tabIndex; } @Override @@ -580,7 +584,7 @@ public class Button extends AbstractComponent implements * false otherwise */ public void setHtmlContentAllowed(boolean htmlContentAllowed) { - getState().setHtmlContentAllowed(htmlContentAllowed); + getState().htmlContentAllowed = htmlContentAllowed; } /** @@ -590,7 +594,7 @@ public class Button extends AbstractComponent implements * false otherwise */ public boolean isHtmlContentAllowed() { - return getState().isHtmlContentAllowed(); + return getState().htmlContentAllowed; } } diff --git a/server/src/com/vaadin/ui/CheckBox.java b/server/src/com/vaadin/ui/CheckBox.java index 149d4779d8..8a42182598 100644 --- a/server/src/com/vaadin/ui/CheckBox.java +++ b/server/src/com/vaadin/ui/CheckBox.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -116,7 +116,7 @@ public class CheckBox extends AbstractField { if (newValue == null) { newValue = false; } - getState().setChecked(newValue); + getState().checked = newValue; } public void addBlurListener(BlurListener listener) { diff --git a/server/src/com/vaadin/ui/CssLayout.java b/server/src/com/vaadin/ui/CssLayout.java index b63c8573ba..9ac29c4deb 100644 --- a/server/src/com/vaadin/ui/CssLayout.java +++ b/server/src/com/vaadin/ui/CssLayout.java @@ -199,12 +199,12 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { @Override public void beforeClientResponse(boolean initial) { super.beforeClientResponse(initial); - getState().getChildCss().clear(); + getState().childCss.clear(); for (Iterator ci = getComponentIterator(); ci.hasNext();) { Component child = ci.next(); String componentCssString = getCss(child); if (componentCssString != null) { - getState().getChildCss().put(child, componentCssString); + getState().childCss.put(child, componentCssString); } } @@ -291,6 +291,7 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { * @deprecated Since 7.0, replaced by * {@link #addLayoutClickListener(LayoutClickListener)} **/ + @Override @Deprecated public void addListener(LayoutClickListener listener) { addLayoutClickListener(listener); @@ -306,6 +307,7 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { * @deprecated Since 7.0, replaced by * {@link #removeLayoutClickListener(LayoutClickListener)} **/ + @Override @Deprecated public void removeListener(LayoutClickListener listener) { removeLayoutClickListener(listener); diff --git a/server/src/com/vaadin/ui/CustomLayout.java b/server/src/com/vaadin/ui/CustomLayout.java index f747b6ff3b..828a1b91ad 100644 --- a/server/src/com/vaadin/ui/CustomLayout.java +++ b/server/src/com/vaadin/ui/CustomLayout.java @@ -25,9 +25,9 @@ import java.util.Map; import java.util.Set; import com.vaadin.server.JsonPaintTarget; +import com.vaadin.server.LegacyComponent; import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; -import com.vaadin.server.LegacyComponent; import com.vaadin.shared.ui.customlayout.CustomLayoutState; /** @@ -142,7 +142,7 @@ public class CustomLayout extends AbstractLayout implements LegacyComponent { removeComponent(old); } slots.put(location, c); - getState().getChildLocations().put(c, location); + getState().childLocations.put(c, location); c.setParent(this); fireComponentAttachEvent(c); } @@ -173,7 +173,7 @@ public class CustomLayout extends AbstractLayout implements LegacyComponent { return; } slots.values().remove(c); - getState().getChildLocations().remove(c); + getState().childLocations.remove(c); super.removeComponent(c); } @@ -247,19 +247,19 @@ public class CustomLayout extends AbstractLayout implements LegacyComponent { } else { slots.put(newLocation, oldComponent); slots.put(oldLocation, newComponent); - getState().getChildLocations().put(newComponent, oldLocation); - getState().getChildLocations().put(oldComponent, newLocation); + getState().childLocations.put(newComponent, oldLocation); + getState().childLocations.put(oldComponent, newLocation); } } /** Get the name of the template */ public String getTemplateName() { - return getState().getTemplateName(); + return getState().templateName; } /** Get the contents of the template */ public String getTemplateContents() { - return getState().getTemplateContents(); + return getState().templateContents; } /** @@ -272,8 +272,8 @@ public class CustomLayout extends AbstractLayout implements LegacyComponent { * @param templateName */ public void setTemplateName(String templateName) { - getState().setTemplateName(templateName); - getState().setTemplateContents(null); + getState().templateName = templateName; + getState().templateContents = null; } /** @@ -282,8 +282,8 @@ public class CustomLayout extends AbstractLayout implements LegacyComponent { * @param templateContents */ public void setTemplateContents(String templateContents) { - getState().setTemplateContents(templateContents); - getState().setTemplateName(null); + getState().templateContents = templateContents; + getState().templateName = null; } @Override @@ -295,7 +295,7 @@ public class CustomLayout extends AbstractLayout implements LegacyComponent { public void paintContent(PaintTarget target) throws PaintException { // Workaround to make the CommunicationManager read the template file // and send it to the client - String templateName = getState().getTemplateName(); + String templateName = getState().templateName; if (templateName != null && templateName.length() != 0) { Set usedResources = ((JsonPaintTarget) target) .getUsedResources(); diff --git a/server/src/com/vaadin/ui/Flash.java b/server/src/com/vaadin/ui/Flash.java index 0e6cf63a91..d39f34634e 100644 --- a/server/src/com/vaadin/ui/Flash.java +++ b/server/src/com/vaadin/ui/Flash.java @@ -33,10 +33,10 @@ public class Flash extends AbstractEmbedded { * The base path */ public void setCodebase(String codebase) { - if (codebase != getState().getCodebase() + if (codebase != getState().codebase || (codebase != null && !codebase.equals(getState() - .getCodebase()))) { - getState().setCodebase(codebase); +.codebase))) { + getState().codebase = codebase; requestRepaint(); } } @@ -52,10 +52,10 @@ public class Flash extends AbstractEmbedded { * the codetype to set. */ public void setCodetype(String codetype) { - if (codetype != getState().getCodetype() + if (codetype != getState().codetype || (codetype != null && !codetype.equals(getState() - .getCodetype()))) { - getState().setCodetype(codetype); +.codetype))) { + getState().codetype = codetype; requestRepaint(); } } @@ -73,17 +73,17 @@ public class Flash extends AbstractEmbedded { * object */ public void setArchive(String archive) { - if (archive != getState().getArchive() - || (archive != null && !archive.equals(getState().getArchive()))) { - getState().setArchive(archive); + if (archive != getState().archive + || (archive != null && !archive.equals(getState().archive))) { + getState().archive = archive; requestRepaint(); } } public void setStandby(String standby) { - if (standby != getState().getStandby() - || (standby != null && !standby.equals(getState().getStandby()))) { - getState().setStandby(standby); + if (standby != getState().standby + || (standby != null && !standby.equals(getState().standby))) { + getState().standby = standby; requestRepaint(); } } @@ -100,10 +100,10 @@ public class Flash extends AbstractEmbedded { * the value of the parameter. */ public void setParameter(String name, String value) { - if (getState().getEmbedParams() == null) { - getState().setEmbedParams(new HashMap()); + if (getState().embedParams == null) { + getState().embedParams = new HashMap(); } - getState().getEmbedParams().put(name, value); + getState().embedParams.put(name, value); requestRepaint(); } @@ -115,8 +115,8 @@ public class Flash extends AbstractEmbedded { * @return the Value of parameter or null if not found. */ public String getParameter(String name) { - return getState().getEmbedParams() != null ? getState() - .getEmbedParams().get(name) : null; + return getState().embedParams != null ? getState().embedParams + .get(name) : null; } /** @@ -126,10 +126,10 @@ public class Flash extends AbstractEmbedded { * the name of the parameter to remove. */ public void removeParameter(String name) { - if (getState().getEmbedParams() == null) { + if (getState().embedParams == null) { return; } - getState().getEmbedParams().remove(name); + getState().embedParams.remove(name); requestRepaint(); } diff --git a/server/src/com/vaadin/ui/Form.java b/server/src/com/vaadin/ui/Form.java index 7e77117acb..dd804ef67a 100644 --- a/server/src/com/vaadin/ui/Form.java +++ b/server/src/com/vaadin/ui/Form.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -39,10 +39,10 @@ import com.vaadin.event.ActionManager; import com.vaadin.server.AbstractErrorMessage; import com.vaadin.server.CompositeErrorMessage; import com.vaadin.server.ErrorMessage; +import com.vaadin.server.LegacyComponent; import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; import com.vaadin.server.UserError; -import com.vaadin.server.LegacyComponent; import com.vaadin.shared.ui.form.FormState; /** @@ -776,7 +776,7 @@ public class Form extends AbstractField implements Item.Editor, * @return the Layout of the form. */ public Layout getLayout() { - return (Layout) getState().getLayout(); + return (Layout) getState().layout; } /** @@ -819,7 +819,7 @@ public class Form extends AbstractField implements Item.Editor, // Replace the previous layout layout.setParent(this); - getState().setLayout(layout); + getState().layout = layout; } /** @@ -1214,7 +1214,7 @@ public class Form extends AbstractField implements Item.Editor, * @return layout rendered below normal form contents. */ public Layout getFooter() { - return (Layout) getState().getFooter(); + return (Layout) getState().footer; } /** @@ -1233,7 +1233,7 @@ public class Form extends AbstractField implements Item.Editor, footer = new HorizontalLayout(); } - getState().setFooter(footer); + getState().footer = footer; footer.setParent(this); } diff --git a/server/src/com/vaadin/ui/GridLayout.java b/server/src/com/vaadin/ui/GridLayout.java index 21602c6802..de167962e7 100644 --- a/server/src/com/vaadin/ui/GridLayout.java +++ b/server/src/com/vaadin/ui/GridLayout.java @@ -27,10 +27,10 @@ import java.util.Map.Entry; import com.vaadin.event.LayoutEvents.LayoutClickEvent; import com.vaadin.event.LayoutEvents.LayoutClickListener; import com.vaadin.event.LayoutEvents.LayoutClickNotifier; +import com.vaadin.server.LegacyComponent; import com.vaadin.server.LegacyPaint; import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; -import com.vaadin.server.LegacyComponent; import com.vaadin.shared.Connector; import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; @@ -961,7 +961,7 @@ public class GridLayout extends AbstractLayout implements } } - getState().setColumns(columns); + getState().columns = columns; } /** @@ -970,7 +970,7 @@ public class GridLayout extends AbstractLayout implements * @return the number of columns in the grid. */ public int getColumns() { - return getState().getColumns(); + return getState().columns; } /** @@ -1003,7 +1003,7 @@ public class GridLayout extends AbstractLayout implements } } - getState().setRows(rows); + getState().rows = rows; } /** @@ -1012,7 +1012,7 @@ public class GridLayout extends AbstractLayout implements * @return the number of rows in the grid. */ public int getRows() { - return getState().getRows(); + return getState().rows; } /** @@ -1127,7 +1127,7 @@ public class GridLayout extends AbstractLayout implements */ @Override public void setSpacing(boolean spacing) { - getState().setSpacing(spacing); + getState().spacing = spacing; } /* @@ -1137,7 +1137,7 @@ public class GridLayout extends AbstractLayout implements */ @Override public boolean isSpacing() { - return getState().isSpacing(); + return getState().spacing; } /** @@ -1405,7 +1405,7 @@ public class GridLayout extends AbstractLayout implements */ @Override public void setMargin(MarginInfo marginInfo) { - getState().setMarginsBitmask(marginInfo.getBitMask()); + getState().marginsBitmask = marginInfo.getBitMask(); } /* @@ -1415,7 +1415,7 @@ public class GridLayout extends AbstractLayout implements */ @Override public MarginInfo getMargin() { - return new MarginInfo(getState().getMarginsBitmask()); + return new MarginInfo(getState().marginsBitmask); } } diff --git a/server/src/com/vaadin/ui/Panel.java b/server/src/com/vaadin/ui/Panel.java index 6f399bcc19..de34c0be2c 100644 --- a/server/src/com/vaadin/ui/Panel.java +++ b/server/src/com/vaadin/ui/Panel.java @@ -25,10 +25,10 @@ import com.vaadin.event.Action.Handler; import com.vaadin.event.ActionManager; import com.vaadin.event.MouseEvents.ClickEvent; import com.vaadin.event.MouseEvents.ClickListener; +import com.vaadin.server.LegacyComponent; import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; import com.vaadin.server.Scrollable; -import com.vaadin.server.LegacyComponent; import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.panel.PanelServerRpc; @@ -83,7 +83,7 @@ public class Panel extends AbstractComponentContainer implements Scrollable, registerRpc(rpc); setContent(content); setWidth(100, Unit.PERCENTAGE); - getState().setTabIndex(-1); + getState().tabIndex = -1; } /** @@ -269,11 +269,11 @@ public class Panel extends AbstractComponentContainer implements Scrollable, final Integer newScrollY = (Integer) variables.get("scrollTop"); if (newScrollX != null && newScrollX.intValue() != getScrollLeft()) { // set internally, not to fire request repaint - getState().setScrollLeft(newScrollX.intValue()); + getState().scrollLeft = newScrollX.intValue(); } if (newScrollY != null && newScrollY.intValue() != getScrollTop()) { // set internally, not to fire request repaint - getState().setScrollTop(newScrollY.intValue()); + getState().scrollTop = newScrollY.intValue(); } // Actions @@ -292,7 +292,7 @@ public class Panel extends AbstractComponentContainer implements Scrollable, */ @Override public int getScrollLeft() { - return getState().getScrollLeft(); + return getState().scrollLeft; } /* @@ -302,7 +302,7 @@ public class Panel extends AbstractComponentContainer implements Scrollable, */ @Override public int getScrollTop() { - return getState().getScrollTop(); + return getState().scrollTop; } /* @@ -316,7 +316,7 @@ public class Panel extends AbstractComponentContainer implements Scrollable, throw new IllegalArgumentException( "Scroll offset must be at least 0"); } - getState().setScrollLeft(scrollLeft); + getState().scrollLeft = scrollLeft; } /* @@ -330,7 +330,7 @@ public class Panel extends AbstractComponentContainer implements Scrollable, throw new IllegalArgumentException( "Scroll offset must be at least 0"); } - getState().setScrollTop(scrollTop); + getState().scrollTop = scrollTop; } /* Documented in superclass */ @@ -471,7 +471,7 @@ public class Panel extends AbstractComponentContainer implements Scrollable, */ @Override public int getTabIndex() { - return getState().getTabIndex(); + return getState().tabIndex; } /** @@ -479,7 +479,7 @@ public class Panel extends AbstractComponentContainer implements Scrollable, */ @Override public void setTabIndex(int tabIndex) { - getState().setTabIndex(tabIndex); + getState().tabIndex = tabIndex; } /** diff --git a/server/src/com/vaadin/ui/Slider.java b/server/src/com/vaadin/ui/Slider.java index 660bf739ae..fe913f6b2c 100644 --- a/server/src/com/vaadin/ui/Slider.java +++ b/server/src/com/vaadin/ui/Slider.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -25,10 +25,10 @@ import com.vaadin.shared.ui.slider.SliderState; * * Example code: * class MyPlayer extends CustomComponent implements ValueChangeListener { - * + * * Label volumeIndicator = new Label(); * Slider slider; - * + * * public MyPlayer() { * VerticalLayout vl = new VerticalLayout(); * setCompositionRoot(vl); @@ -68,11 +68,11 @@ public class Slider extends AbstractField { } catch (final ValueOutOfBoundsException e) { // Convert to nearest bound double out = e.getValue().doubleValue(); - if (out < getState().getMinValue()) { - out = getState().getMinValue(); + if (out < getState().minValue) { + out = getState().minValue; } - if (out > getState().getMaxValue()) { - out = getState().getMaxValue(); + if (out > getState().maxValue) { + out = getState().maxValue; } Slider.super.setValue(new Double(out), false); } @@ -88,7 +88,7 @@ public class Slider extends AbstractField { public Slider() { super(); registerRpc(rpc); - super.setValue(new Double(getState().getMinValue())); + super.setValue(new Double(getState().minValue)); } /** @@ -164,7 +164,7 @@ public class Slider extends AbstractField { * @return the largest value the slider can have */ public double getMax() { - return getState().getMaxValue(); + return getState().maxValue; } /** @@ -175,7 +175,7 @@ public class Slider extends AbstractField { * The new maximum slider value */ public void setMax(double max) { - getState().setMaxValue(max); + getState().maxValue = max; if (getValue() > max) { setValue(max); } @@ -187,7 +187,7 @@ public class Slider extends AbstractField { * @return the smallest value the slider can have */ public double getMin() { - return getState().getMinValue(); + return getState().minValue; } /** @@ -198,7 +198,7 @@ public class Slider extends AbstractField { * The new minimum slider value */ public void setMin(double min) { - getState().setMinValue(min); + getState().minValue = min; if (getValue() < min) { setValue(min); } @@ -211,7 +211,7 @@ public class Slider extends AbstractField { * {@link SliderOrientation#VERTICAL} */ public SliderOrientation getOrientation() { - return getState().getOrientation(); + return getState().orientation; } /** @@ -223,7 +223,7 @@ public class Slider extends AbstractField { * {@link SliderOrientation#VERTICAL} */ public void setOrientation(SliderOrientation orientation) { - getState().setOrientation(orientation); + getState().orientation = orientation; } /** @@ -233,7 +233,7 @@ public class Slider extends AbstractField { * @return resolution */ public int getResolution() { - return getState().getResolution(); + return getState().resolution; } /** @@ -250,7 +250,7 @@ public class Slider extends AbstractField { throw new IllegalArgumentException( "Cannot set a negative resolution to Slider"); } - getState().setResolution(resolution); + getState().resolution = resolution; } /** @@ -284,7 +284,7 @@ public class Slider extends AbstractField { } } - getState().setValue(newValue); + getState().value = newValue; super.setValue(newValue, repaintIsNotNeeded); } @@ -296,7 +296,7 @@ public class Slider extends AbstractField { } super.setValue(newFieldValue); // The cast is safe if the above call returned without throwing - getState().setValue((Double) newFieldValue); + getState().value = (Double) newFieldValue; } /** diff --git a/server/src/com/vaadin/ui/TextArea.java b/server/src/com/vaadin/ui/TextArea.java index 0dc9722eb3..cc8e947e24 100644 --- a/server/src/com/vaadin/ui/TextArea.java +++ b/server/src/com/vaadin/ui/TextArea.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -95,7 +95,7 @@ public class TextArea extends AbstractTextField { if (rows < 0) { rows = 0; } - getState().setRows(rows); + getState().rows = rows; } /** @@ -104,7 +104,7 @@ public class TextArea extends AbstractTextField { * @return number of explicitly set rows. */ public int getRows() { - return getState().getRows(); + return getState().rows; } /** @@ -115,7 +115,7 @@ public class TextArea extends AbstractTextField { * word-wrap mode. */ public void setWordwrap(boolean wordwrap) { - getState().setWordwrap(wordwrap); + getState().wordwrap = wordwrap; } /** @@ -125,7 +125,7 @@ public class TextArea extends AbstractTextField { * false if not. */ public boolean isWordwrap() { - return getState().isWordwrap(); + return getState().wordwrap; } } diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index a59b96d27a..d86d46c155 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -35,14 +35,14 @@ import com.vaadin.event.ActionManager; import com.vaadin.event.MouseEvents.ClickEvent; import com.vaadin.event.MouseEvents.ClickListener; import com.vaadin.server.AbstractApplicationServlet; +import com.vaadin.server.LegacyComponent; import com.vaadin.server.Page; +import com.vaadin.server.Page.BrowserWindowResizeEvent; +import com.vaadin.server.Page.BrowserWindowResizeListener; import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; import com.vaadin.server.Resource; -import com.vaadin.server.LegacyComponent; import com.vaadin.server.WrappedRequest; -import com.vaadin.server.Page.BrowserWindowResizeEvent; -import com.vaadin.server.Page.BrowserWindowResizeListener; import com.vaadin.server.WrappedRequest.BrowserDetails; import com.vaadin.shared.EventId; import com.vaadin.shared.MouseEventDetails; @@ -385,7 +385,7 @@ public abstract class UI extends AbstractComponentContainer implements @Override public void setCaption(String caption) { // Override to provide backwards compatibility - getState().setCaption(caption); + getState().caption = caption; getPage().setTitle(caption); } @@ -879,7 +879,7 @@ public abstract class UI extends AbstractComponentContainer implements * @see #createDefaultLayout() */ public ComponentContainer getContent() { - return (ComponentContainer) getState().getContent(); + return (ComponentContainer) getState().content; } /** @@ -911,10 +911,10 @@ public abstract class UI extends AbstractComponentContainer implements content = createDefaultLayout(); } - if (getState().getContent() != null) { - super.removeComponent((Component) getState().getContent()); + if (getState().content != null) { + super.removeComponent((Component) getState().content); } - getState().setContent(content); + getState().content = content; if (content != null) { super.addComponent(content); } diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java index aaf0fbc492..5c94a4c929 100644 --- a/server/src/com/vaadin/ui/Window.java +++ b/server/src/com/vaadin/ui/Window.java @@ -31,9 +31,9 @@ import com.vaadin.event.ShortcutAction; import com.vaadin.event.ShortcutAction.KeyCode; import com.vaadin.event.ShortcutAction.ModifierKey; import com.vaadin.event.ShortcutListener; +import com.vaadin.server.LegacyComponent; import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; -import com.vaadin.server.LegacyComponent; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.window.WindowServerRpc; import com.vaadin.shared.ui.window.WindowState; @@ -242,7 +242,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @since 4.0.0 */ public int getPositionX() { - return getState().getPositionX(); + return getState().positionX; } /** @@ -255,8 +255,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @since 4.0.0 */ public void setPositionX(int positionX) { - getState().setPositionX(positionX); - getState().setCentered(false); + getState().positionX = positionX; + getState().centered = false; } /** @@ -269,7 +269,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @since 4.0.0 */ public int getPositionY() { - return getState().getPositionY(); + return getState().positionY; } /** @@ -283,8 +283,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @since 4.0.0 */ public void setPositionY(int positionY) { - getState().setPositionY(positionY); - getState().setCentered(false); + getState().positionY = positionY; + getState().centered = false; } private static final Method WINDOW_CLOSE_METHOD; @@ -540,7 +540,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * true if modality is to be turned on */ public void setModal(boolean modal) { - getState().setModal(modal); + getState().modal = modal; center(); } @@ -548,7 +548,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @return true if this window is modal. */ public boolean isModal() { - return getState().isModal(); + return getState().modal; } /** @@ -558,7 +558,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * true if resizability is to be turned on */ public void setResizable(boolean resizable) { - getState().setResizable(resizable); + getState().resizable = resizable; } /** @@ -566,7 +566,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @return true if window is resizable by the end-user, otherwise false. */ public boolean isResizable() { - return getState().isResizable(); + return getState().resizable; } /** @@ -575,7 +575,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * sizes are recalculated immediately. */ public boolean isResizeLazy() { - return getState().isResizeLazy(); + return getState().resizeLazy; } /** @@ -591,7 +591,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * calculate immediately. */ public void setResizeLazy(boolean resizeLazy) { - getState().setResizeLazy(resizeLazy); + getState().resizeLazy = resizeLazy; } /** @@ -604,7 +604,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * Please refer to http://dev.vaadin.com/ticket/8971 for details. */ public void center() { - getState().setCentered(true); + getState().centered = true; } /** @@ -655,7 +655,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * true if the sub window can be dragged by the user */ public boolean isDraggable() { - return getState().isDraggable(); + return getState().draggable; } /** @@ -668,7 +668,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * true if the sub window can be dragged by the user */ public void setDraggable(boolean draggable) { - getState().setDraggable(draggable); + getState().draggable = draggable; } /* @@ -793,6 +793,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @deprecated Since 7.0, replaced by * {@link #addFocusListener(FocusListener)} **/ + @Override @Deprecated public void addListener(FocusListener listener) { addFocusListener(listener); @@ -807,6 +808,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @deprecated Since 7.0, replaced by * {@link #removeFocusListener(FocusListener)} **/ + @Override @Deprecated public void removeListener(FocusListener listener) { removeFocusListener(listener); @@ -829,6 +831,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * @deprecated Since 7.0, replaced by {@link #addBlurListener(BlurListener)} **/ + @Override @Deprecated public void addListener(BlurListener listener) { addBlurListener(listener); @@ -843,6 +846,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * @deprecated Since 7.0, replaced by * {@link #removeBlurListener(BlurListener)} **/ + @Override @Deprecated public void removeListener(BlurListener listener) { removeBlurListener(listener); diff --git a/server/tests/src/com/vaadin/server/JSONSerializerTest.java b/server/tests/src/com/vaadin/server/JSONSerializerTest.java index 05139e6f1a..fc02c13781 100644 --- a/server/tests/src/com/vaadin/server/JSONSerializerTest.java +++ b/server/tests/src/com/vaadin/server/JSONSerializerTest.java @@ -42,10 +42,10 @@ public class JSONSerializerTest extends TestCase { stringToStateMap = new HashMap(); AbstractSplitPanelState s = new AbstractSplitPanelState(); AbstractSplitPanelState s2 = new AbstractSplitPanelState(); - s.setCaption("State 1"); - s.setId("foo"); - s2.setCaption("State 2"); - s2.setId("bar"); + s.caption = "State 1"; + s.id = "foo"; + s2.caption = "State 2"; + s2.id = "bar"; stringToStateMap.put("string - state 1", s); stringToStateMap.put("String - state 2", s2); @@ -61,8 +61,8 @@ public class JSONSerializerTest extends TestCase { stateToStringMap = new HashMap(); AbstractSplitPanelState s = new AbstractSplitPanelState(); AbstractSplitPanelState s2 = new AbstractSplitPanelState(); - s.setCaption("State 1"); - s2.setCaption("State 2"); + s.caption = "State 1"; + s2.caption = "State 2"; stateToStringMap.put(s, "string - state 1"); stateToStringMap.put(s2, "String - state 2"); diff --git a/shared/src/com/vaadin/shared/AbstractFieldState.java b/shared/src/com/vaadin/shared/AbstractFieldState.java index 02cbd16a6f..37f8599bbf 100644 --- a/shared/src/com/vaadin/shared/AbstractFieldState.java +++ b/shared/src/com/vaadin/shared/AbstractFieldState.java @@ -24,128 +24,9 @@ import com.vaadin.shared.ui.TabIndexState; * @since 7.0.0 * */ -public class AbstractFieldState extends ComponentState implements TabIndexState { - private boolean propertyReadOnly = false; - private boolean hideErrors = false; - private boolean required = false; - private boolean modified = false; - - /** - * The tab order number of this field. - */ - private int tabIndex = 0; - - /** - * Checks if the property data source for the Field is in read only mode. - * This affects the read only state of the field itself. - * - * @return true if there is a property data source and it is set to read - * only, false otherwise - */ - public boolean isPropertyReadOnly() { - return propertyReadOnly; - } - - /** - * Sets the read only state of the property data source. - * - * @param propertyReadOnly - * true if the property data source if read only, false otherwise - */ - public void setPropertyReadOnly(boolean propertyReadOnly) { - this.propertyReadOnly = propertyReadOnly; - } - - /** - * Returns true if the component will hide any errors even if the error - * message is set. - * - * @return true if error messages are disabled - */ - public boolean isHideErrors() { - return hideErrors; - } - - /** - * Sets whether the component should hide any errors even if the error - * message is set. - * - * This is used e.g. on forms to hide error messages for invalid fields - * before the first user actions. - * - * @param hideErrors - * true if error messages should be hidden - */ - public void setHideErrors(boolean hideErrors) { - this.hideErrors = hideErrors; - } - - /** - * Is the field required. Required fields must filled by the user. - * - * See {@link com.vaadin.ui.AbstractField#isRequired()} for more - * information. - * - * @return true if the field is required, otherwise - * false. - */ - public boolean isRequired() { - return required; - } - - /** - * Sets the field required. Required fields must filled by the user. - * - * See {@link com.vaadin.ui.AbstractField#setRequired(boolean)} for more - * information. - * - * @param required - * Is the field required. - */ - public void setRequired(boolean required) { - this.required = required; - } - - /** - * Has the contents of the field been modified, i.e. has the value been - * updated after it was read from the data source. - * - * @return true if the field has been modified, false otherwise - */ - public boolean isModified() { - return modified; - } - - /** - * Setter for the modified flag, toggled when the contents of the field is - * modified by the user. - * - * @param modified - * the new modified state - * - */ - public void setModified(boolean modified) { - this.modified = modified; - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.client.ComponentState#getTabIndex() - */ - @Override - public int getTabIndex() { - return tabIndex; - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.client.ui.TabIndexState#setTabIndex(int) - */ - @Override - public void setTabIndex(int tabIndex) { - this.tabIndex = tabIndex; - } - +public class AbstractFieldState extends TabIndexState { + public boolean propertyReadOnly = false; + public boolean hideErrors = false; + public boolean required = false; + public boolean modified = false; } diff --git a/shared/src/com/vaadin/shared/ComponentState.java b/shared/src/com/vaadin/shared/ComponentState.java index 898114e1db..55a26a8e0f 100644 --- a/shared/src/com/vaadin/shared/ComponentState.java +++ b/shared/src/com/vaadin/shared/ComponentState.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -16,7 +16,6 @@ package com.vaadin.shared; -import java.util.HashSet; import java.util.List; import java.util.Set; @@ -30,354 +29,25 @@ import com.vaadin.shared.communication.SharedState; * @since 7.0 */ public class ComponentState extends SharedState { - private String height = ""; - private String width = ""; - private boolean readOnly = false; - private boolean immediate = false; - private String description = ""; + public String height = ""; + public String width = ""; + public boolean readOnly = false; + public boolean immediate = false; + public String description = ""; // Note: for the caption, there is a difference between null and an empty // string! - private String caption = null; - private boolean visible = true; - private List styles = null; - private String id = null; + public String caption = null; + public boolean visible = true; + public List styles = null; + public String id = null; /** * A set of event identifiers with registered listeners. */ - private Set registeredEventListeners = null; + public Set registeredEventListeners = null; // HTML formatted error message for the component // TODO this could be an object with more information, but currently the UI // only uses the message - private String errorMessage = null; + public String errorMessage = null; - /** - * Returns the component height as set by the server. - * - * Can be relative (containing the percent sign) or absolute, or empty - * string for undefined height. - * - * @return component height as defined by the server, not null - */ - public String getHeight() { - if (height == null) { - return ""; - } - return height; - } - - /** - * Sets the height of the component in the server format. - * - * Can be relative (containing the percent sign) or absolute, or null or - * empty string for undefined height. - * - * @param height - * component height - */ - public void setHeight(String height) { - this.height = height; - } - - /** - * Returns true if the component height is undefined, false if defined - * (absolute or relative). - * - * @return true if component height is undefined - */ - public boolean isUndefinedHeight() { - return "".equals(getHeight()); - } - - /** - * Returns the component width as set by the server. - * - * Can be relative (containing the percent sign) or absolute, or empty - * string for undefined height. - * - * @return component width as defined by the server, not null - */ - public String getWidth() { - if (width == null) { - return ""; - } - return width; - } - - /** - * Sets the width of the component in the server format. - * - * Can be relative (containing the percent sign) or absolute, or null or - * empty string for undefined width. - * - * @param width - * component width - */ - public void setWidth(String width) { - this.width = width; - } - - /** - * Returns true if the component width is undefined, false if defined - * (absolute or relative). - * - * @return true if component width is undefined - */ - public boolean isUndefinedWidth() { - return "".equals(getWidth()); - } - - /** - * Returns true if the component is in read-only mode. - * - * @see com.vaadin.ui.Component#isReadOnly() - * - * @return true if the component is in read-only mode - */ - public boolean isReadOnly() { - return readOnly; - } - - /** - * Sets or resets the read-only mode for a component. - * - * @see com.vaadin.ui.Component#setReadOnly() - * - * @param readOnly - * new mode for the component - */ - public void setReadOnly(boolean readOnly) { - this.readOnly = readOnly; - } - - /** - * Returns true if the component is in immediate mode. - * - * @see com.vaadin.server.VariableOwner#isImmediate() - * - * @return true if the component is in immediate mode - */ - public boolean isImmediate() { - return immediate; - } - - /** - * Sets or resets the immediate mode for a component. - * - * @see com.vaadin.server.VariableOwner#setImmediate() - * - * @param immediate - * new mode for the component - */ - public void setImmediate(boolean immediate) { - this.immediate = immediate; - } - - /** - * Returns true if the component has user-defined styles. - * - * @return true if the component has user-defined styles - */ - public boolean hasStyles() { - return styles != null && !styles.isEmpty(); - } - - /** - * Gets the description of the component (typically shown as tooltip). - * - * @see com.vaadin.ui.AbstractComponent#getDescription() - * - * @return component description (not null, can be empty string) - */ - public String getDescription() { - return description; - } - - /** - * Sets the description of the component (typically shown as tooltip). - * - * @see com.vaadin.ui.AbstractComponent#setDescription(String) - * - * @param description - * new component description (can be null) - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Returns true if the component has a description. - * - * @return true if the component has a description - */ - public boolean hasDescription() { - return getDescription() != null && !"".equals(getDescription()); - } - - /** - * Gets the caption of the component (typically shown by the containing - * layout). - * - * @see com.vaadin.ui.Component#getCaption() - * - * @return component caption - can be null (no caption) or empty string - * (reserve space for an empty caption) - */ - public String getCaption() { - return caption; - } - - /** - * Sets the caption of the component (typically shown by the containing - * layout). - * - * @see com.vaadin.ui.Component#setCaption(String) - * - * @param caption - * new component caption - can be null (no caption) or empty - * string (reserve space for an empty caption) - */ - public void setCaption(String caption) { - this.caption = caption; - } - - /** - * Returns the visibility state of the component. Note that this state is - * related to the component only, not its parent. This might differ from - * what {@link com.vaadin.ui.Component#isVisible()} returns as this takes - * the hierarchy into account. - * - * @return The visibility state. - */ - public boolean isVisible() { - return visible; - } - - /** - * Sets the visibility state of the component. - * - * @param visible - * The new visibility state. - */ - public void setVisible(boolean visible) { - this.visible = visible; - } - - /** - * Gets the style names for the component. - * - * @return A List of style names or null if no styles have been set. - */ - public List getStyles() { - return styles; - } - - /** - * Sets the style names for the component. - * - * @param styles - * A list containing style names - */ - public void setStyles(List styles) { - this.styles = styles; - } - - /** - * Gets the id for the component. The id is added as DOM id for the - * component. - * - * @return The id for the component or null if not set - */ - public String getId() { - return id; - } - - /** - * Sets the id for the component. The id is added as DOM id for the - * component. - * - * @param id - * The new id for the component or null for no id - * - */ - public void setId(String id) { - this.id = id; - } - - /** - * Gets the identifiers for the event listeners that have been registered - * for the component (using an event id) - * - * @return A set of event identifiers or null if no identifiers have been - * registered - */ - public Set getRegisteredEventListeners() { - return registeredEventListeners; - } - - /** - * Sets the identifiers for the event listeners that have been registered - * for the component (using an event id) - * - * @param registeredEventListeners - * The new set of identifiers or null if no identifiers have been - * registered - */ - public void setRegisteredEventListeners(Set registeredEventListeners) { - this.registeredEventListeners = registeredEventListeners; - } - - /** - * Adds an event listener id. - * - * @param eventListenerId - * The event identifier to add - */ - public void addRegisteredEventListener(String eventListenerId) { - if (registeredEventListeners == null) { - registeredEventListeners = new HashSet(); - } - registeredEventListeners.add(eventListenerId); - - } - - /** - * Removes an event listener id. - * - * @param eventListenerId - * The event identifier to remove - */ - public void removeRegisteredEventListener(String eventIdentifier) { - if (registeredEventListeners == null) { - return; - } - registeredEventListeners.remove(eventIdentifier); - if (registeredEventListeners.size() == 0) { - registeredEventListeners = null; - } - } - - /** - * Returns the current error message for the component. - * - * @return HTML formatted error message to show for the component or null if - * none - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Sets the current error message for the component. - * - * TODO this could use an object with more details about the error - * - * @param errorMessage - * HTML formatted error message to show for the component or null - * for none - */ - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - -} +} \ No newline at end of file diff --git a/shared/src/com/vaadin/shared/communication/SharedState.java b/shared/src/com/vaadin/shared/communication/SharedState.java index 09147ac97d..4473eba7a0 100644 --- a/shared/src/com/vaadin/shared/communication/SharedState.java +++ b/shared/src/com/vaadin/shared/communication/SharedState.java @@ -59,29 +59,5 @@ public class SharedState implements Serializable { */ public Map resources = new HashMap(); - private boolean enabled = true; - - /** - * Returns true if the component is enabled. - * - * @see com.vaadin.ui.Component#isEnabled() - * - * @return true if the component is enabled - */ - public boolean isEnabled() { - return enabled; - } - - /** - * Enables or disables the component. - * - * @see com.vaadin.ui.Component#setEnabled(boolean) - * - * @param enabled - * new mode for the component - */ - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - + public boolean enabled = true; } diff --git a/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java b/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java index 6422b643ad..608152cc54 100644 --- a/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java +++ b/shared/src/com/vaadin/shared/ui/AbstractEmbeddedState.java @@ -6,14 +6,5 @@ public class AbstractEmbeddedState extends ComponentState { public static final String SOURCE_RESOURCE = "source"; - private String alternateText; - - public String getAlternateText() { - return alternateText; - } - - public void setAlternateText(String alternateText) { - this.alternateText = alternateText; - } - + public String alternateText; } diff --git a/shared/src/com/vaadin/shared/ui/ComponentStateUtil.java b/shared/src/com/vaadin/shared/ui/ComponentStateUtil.java new file mode 100644 index 0000000000..556c46518f --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/ComponentStateUtil.java @@ -0,0 +1,52 @@ +package com.vaadin.shared.ui; + +import java.util.HashSet; + +import com.vaadin.shared.ComponentState; + +public final class ComponentStateUtil { + + private ComponentStateUtil() { + // Util class is not instantiable + } + + public static final boolean isUndefinedWidth(ComponentState state) { + return state.width == null || "".equals(state.width); + } + + public static final boolean isUndefinedHeight(ComponentState state) { + return state.height == null || "".equals(state.height); + } + + /** + * Removes an event listener id. + * + * @param eventListenerId + * The event identifier to remove + */ + public static final void removeRegisteredEventListener( + ComponentState state, + String eventIdentifier) { + if (state.registeredEventListeners == null) { + return; + } + state.registeredEventListeners.remove(eventIdentifier); + if (state.registeredEventListeners.size() == 0) { + state.registeredEventListeners = null; + } + } + + /** + * Adds an event listener id. + * + * @param eventListenerId + * The event identifier to add + */ + public static final void addRegisteredEventListener(ComponentState state, + String eventListenerId) { + if (state.registeredEventListeners == null) { + state.registeredEventListeners = new HashSet(); + } + state.registeredEventListeners.add(eventListenerId); + } +} diff --git a/shared/src/com/vaadin/shared/ui/TabIndexState.java b/shared/src/com/vaadin/shared/ui/TabIndexState.java index 5f17b9b016..a9cb56e5ed 100644 --- a/shared/src/com/vaadin/shared/ui/TabIndexState.java +++ b/shared/src/com/vaadin/shared/ui/TabIndexState.java @@ -15,6 +15,8 @@ */ package com.vaadin.shared.ui; +import com.vaadin.shared.ComponentState; + /** * Interface implemented by state classes that support tab indexes. * @@ -22,19 +24,11 @@ package com.vaadin.shared.ui; * @since 7.0.0 * */ -public interface TabIndexState { - /** - * Gets the tabulator index of the field. - * - * @return the tab index for the Field - */ - public int getTabIndex(); +public class TabIndexState extends ComponentState { /** - * Sets the tabulator index of the field. - * - * @param tabIndex - * the tab index to set + * The tabulator index of the field. */ - public void setTabIndex(int tabIndex); + public int tabIndex = 0; + } diff --git a/shared/src/com/vaadin/shared/ui/absolutelayout/AbsoluteLayoutState.java b/shared/src/com/vaadin/shared/ui/absolutelayout/AbsoluteLayoutState.java index a0e0f4d3c7..283e827e6e 100644 --- a/shared/src/com/vaadin/shared/ui/absolutelayout/AbsoluteLayoutState.java +++ b/shared/src/com/vaadin/shared/ui/absolutelayout/AbsoluteLayoutState.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -18,24 +18,9 @@ package com.vaadin.shared.ui.absolutelayout; import java.util.HashMap; import java.util.Map; -import com.vaadin.shared.Connector; import com.vaadin.shared.ui.AbstractLayoutState; public class AbsoluteLayoutState extends AbstractLayoutState { // Maps each component to a position - private Map connectorToCssPosition = new HashMap(); - - public String getConnectorPosition(Connector connector) { - return connectorToCssPosition.get(connector.getConnectorId()); - } - - public Map getConnectorToCssPosition() { - return connectorToCssPosition; - } - - public void setConnectorToCssPosition( - Map componentToCssPosition) { - connectorToCssPosition = componentToCssPosition; - } - + public Map connectorToCssPosition = new HashMap(); } \ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/button/ButtonState.java b/shared/src/com/vaadin/shared/ui/button/ButtonState.java index 2383b038bd..c144a8124f 100644 --- a/shared/src/com/vaadin/shared/ui/button/ButtonState.java +++ b/shared/src/com/vaadin/shared/ui/button/ButtonState.java @@ -27,108 +27,11 @@ import com.vaadin.shared.ui.TabIndexState; * * @since 7.0 */ -public class ButtonState extends ComponentState implements TabIndexState { - private boolean disableOnClick = false; - private int clickShortcutKeyCode = 0; - /** - * The tab order number of this field. - */ - private int tabIndex = 0; +public class ButtonState extends TabIndexState { + public boolean disableOnClick = false; + public int clickShortcutKeyCode = 0; /** * If caption should be rendered in HTML */ - private boolean htmlContentAllowed = false; - - /** - * Checks whether the button should be disabled on the client side on next - * click. - * - * @return true if the button should be disabled on click - */ - public boolean isDisableOnClick() { - return disableOnClick; - } - - /** - * Sets whether the button should be disabled on the client side on next - * click. - * - * @param disableOnClick - * true if the button should be disabled on click - */ - public void setDisableOnClick(boolean disableOnClick) { - this.disableOnClick = disableOnClick; - } - - /** - * Returns the key code for activating the button via a keyboard shortcut. - * - * See {@link com.vaadin.ui.Button#setClickShortcut(int, int...)} for more - * information. - * - * @return key code or 0 for none - */ - public int getClickShortcutKeyCode() { - return clickShortcutKeyCode; - } - - /** - * Sets the key code for activating the button via a keyboard shortcut. - * - * See {@link com.vaadin.ui.Button#setClickShortcut(int, int...)} for more - * information. - * - * @param clickShortcutKeyCode - * key code or 0 for none - */ - public void setClickShortcutKeyCode(int clickShortcutKeyCode) { - this.clickShortcutKeyCode = clickShortcutKeyCode; - } - - /** - * Set whether the caption text is rendered as HTML or not. You might need - * to retheme button to allow higher content than the original text style. - * - * If set to true, the captions are passed to the browser as html and the - * developer is responsible for ensuring no harmful html is used. If set to - * false, the content is passed to the browser as plain text. - * - * @param htmlContentAllowed - * true if caption is rendered as HTML, - * false otherwise - */ - public void setHtmlContentAllowed(boolean htmlContentAllowed) { - this.htmlContentAllowed = htmlContentAllowed; - } - - /** - * Return HTML rendering setting. - * - * @return true if the caption text is to be rendered as HTML, - * false otherwise - */ - public boolean isHtmlContentAllowed() { - return htmlContentAllowed; - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.client.ui.TabIndexState#getTabIndex() - */ - @Override - public int getTabIndex() { - return tabIndex; - } - - /* - * (non-Javadoc) - * - * @see com.vaadin.client.ui.TabIndexState#setTabIndex(int) - */ - @Override - public void setTabIndex(int tabIndex) { - this.tabIndex = tabIndex; - } - + public boolean htmlContentAllowed = false; } diff --git a/shared/src/com/vaadin/shared/ui/checkbox/CheckBoxState.java b/shared/src/com/vaadin/shared/ui/checkbox/CheckBoxState.java index 1f48b8fe9e..b89270bee2 100644 --- a/shared/src/com/vaadin/shared/ui/checkbox/CheckBoxState.java +++ b/shared/src/com/vaadin/shared/ui/checkbox/CheckBoxState.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -18,14 +18,6 @@ package com.vaadin.shared.ui.checkbox; import com.vaadin.shared.AbstractFieldState; public class CheckBoxState extends AbstractFieldState { - private boolean checked = false; - - public boolean isChecked() { - return checked; - } - - public void setChecked(boolean checked) { - this.checked = checked; - } + public boolean checked = false; } \ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/csslayout/CssLayoutState.java b/shared/src/com/vaadin/shared/ui/csslayout/CssLayoutState.java index fc230a8e2f..2fbc42ca0f 100644 --- a/shared/src/com/vaadin/shared/ui/csslayout/CssLayoutState.java +++ b/shared/src/com/vaadin/shared/ui/csslayout/CssLayoutState.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -22,14 +22,5 @@ import com.vaadin.shared.Connector; import com.vaadin.shared.ui.AbstractLayoutState; public class CssLayoutState extends AbstractLayoutState { - private Map childCss = new HashMap(); - - public Map getChildCss() { - return childCss; - } - - public void setChildCss(Map childCss) { - this.childCss = childCss; - } - + public Map childCss = new HashMap(); } \ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/customlayout/CustomLayoutState.java b/shared/src/com/vaadin/shared/ui/customlayout/CustomLayoutState.java index 0c1aa24161..e77ea5c068 100644 --- a/shared/src/com/vaadin/shared/ui/customlayout/CustomLayoutState.java +++ b/shared/src/com/vaadin/shared/ui/customlayout/CustomLayoutState.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -22,32 +22,7 @@ import com.vaadin.shared.Connector; import com.vaadin.shared.ui.AbstractLayoutState; public class CustomLayoutState extends AbstractLayoutState { - Map childLocations = new HashMap(); - private String templateContents; - private String templateName; - - public String getTemplateContents() { - return templateContents; - } - - public void setTemplateContents(String templateContents) { - this.templateContents = templateContents; - } - - public String getTemplateName() { - return templateName; - } - - public void setTemplateName(String templateName) { - this.templateName = templateName; - } - - public Map getChildLocations() { - return childLocations; - } - - public void setChildLocations(Map childLocations) { - this.childLocations = childLocations; - } - + public Map childLocations = new HashMap(); + public String templateContents; + public String templateName; } \ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/flash/FlashState.java b/shared/src/com/vaadin/shared/ui/flash/FlashState.java index 2d33d1a711..50f0d63733 100644 --- a/shared/src/com/vaadin/shared/ui/flash/FlashState.java +++ b/shared/src/com/vaadin/shared/ui/flash/FlashState.java @@ -6,63 +6,15 @@ import com.vaadin.shared.ui.AbstractEmbeddedState; public class FlashState extends AbstractEmbeddedState { - protected String classId; + public String classId; - protected String codebase; + public String codebase; - protected String codetype; + public String codetype; - protected String archive; + public String archive; - protected String standby; + public String standby; - protected Map embedParams; - - public String getClassId() { - return classId; - } - - public void setClassId(String classId) { - this.classId = classId; - } - - public String getCodebase() { - return codebase; - } - - public void setCodebase(String codeBase) { - codebase = codebase; - } - - public String getCodetype() { - return codetype; - } - - public void setCodetype(String codetype) { - this.codetype = codetype; - } - - public String getArchive() { - return archive; - } - - public void setArchive(String archive) { - this.archive = archive; - } - - public String getStandby() { - return standby; - } - - public void setStandby(String standby) { - this.standby = standby; - } - - public Map getEmbedParams() { - return embedParams; - } - - public void setEmbedParams(Map embedParams) { - this.embedParams = embedParams; - } + public Map embedParams; } diff --git a/shared/src/com/vaadin/shared/ui/form/FormState.java b/shared/src/com/vaadin/shared/ui/form/FormState.java index 7e8b36707a..f0e79ad38f 100644 --- a/shared/src/com/vaadin/shared/ui/form/FormState.java +++ b/shared/src/com/vaadin/shared/ui/form/FormState.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -19,23 +19,6 @@ import com.vaadin.shared.AbstractFieldState; import com.vaadin.shared.Connector; public class FormState extends AbstractFieldState { - private Connector layout; - private Connector footer; - - public Connector getLayout() { - return layout; - } - - public void setLayout(Connector layout) { - this.layout = layout; - } - - public Connector getFooter() { - return footer; - } - - public void setFooter(Connector footer) { - this.footer = footer; - } - + public Connector layout; + public Connector footer; } \ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/gridlayout/GridLayoutState.java b/shared/src/com/vaadin/shared/ui/gridlayout/GridLayoutState.java index 381a6a7f85..ae54dc3765 100644 --- a/shared/src/com/vaadin/shared/ui/gridlayout/GridLayoutState.java +++ b/shared/src/com/vaadin/shared/ui/gridlayout/GridLayoutState.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -18,41 +18,8 @@ package com.vaadin.shared.ui.gridlayout; import com.vaadin.shared.ui.AbstractLayoutState; public class GridLayoutState extends AbstractLayoutState { - private boolean spacing = false; - private int rows = 0; - private int columns = 0; - private int marginsBitmask = 0; - - public boolean isSpacing() { - return spacing; - } - - public void setSpacing(boolean spacing) { - this.spacing = spacing; - } - - public int getMarginsBitmask() { - return marginsBitmask; - } - - public void setMarginsBitmask(int marginsBitmask) { - this.marginsBitmask = marginsBitmask; - } - - public int getRows() { - return rows; - } - - public void setRows(int rows) { - this.rows = rows; - } - - public int getColumns() { - return columns; - } - - public void setColumns(int cols) { - columns = cols; - } - + public boolean spacing = false; + public int rows = 0; + public int columns = 0; + public int marginsBitmask = 0; } \ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutState.java b/shared/src/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutState.java index 35456ab9ac..27ab6ac8e0 100644 --- a/shared/src/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutState.java +++ b/shared/src/com/vaadin/shared/ui/orderedlayout/AbstractOrderedLayoutState.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -23,56 +23,16 @@ import com.vaadin.shared.ui.AbstractLayoutState; import com.vaadin.shared.ui.AlignmentInfo; public class AbstractOrderedLayoutState extends AbstractLayoutState { - private boolean spacing = false; + public boolean spacing = false; - private HashMap childData = new HashMap(); + public HashMap childData = new HashMap(); - private int marginsBitmask = 0; + public int marginsBitmask = 0; public static class ChildComponentData implements Serializable { - private int alignmentBitmask = AlignmentInfo.TOP_LEFT.getBitMask(); - private float expandRatio = 0.0f; - public int getAlignmentBitmask() { - return alignmentBitmask; - } + public int alignmentBitmask = AlignmentInfo.TOP_LEFT.getBitMask(); - public void setAlignmentBitmask(int alignmentBitmask) { - this.alignmentBitmask = alignmentBitmask; - } - - public float getExpandRatio() { - return expandRatio; - } - - public void setExpandRatio(float expandRatio) { - this.expandRatio = expandRatio; - } - - } - - public HashMap getChildData() { - return childData; - } - - public void setChildData(HashMap childData) { - this.childData = childData; - } - - public boolean isSpacing() { - return spacing; - } - - public void setSpacing(boolean spacing) { - this.spacing = spacing; - } - - public int getMarginsBitmask() { - return marginsBitmask; - } - - public void setMarginsBitmask(int marginsBitmask) { - this.marginsBitmask = marginsBitmask; + public float expandRatio = 0.0f; } - } \ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/panel/PanelState.java b/shared/src/com/vaadin/shared/ui/panel/PanelState.java index d432de97ad..878b921d55 100644 --- a/shared/src/com/vaadin/shared/ui/panel/PanelState.java +++ b/shared/src/com/vaadin/shared/ui/panel/PanelState.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -18,31 +18,6 @@ package com.vaadin.shared.ui.panel; import com.vaadin.shared.ComponentState; public class PanelState extends ComponentState { - private int tabIndex; - private int scrollLeft, scrollTop; - - public int getTabIndex() { - return tabIndex; - } - - public void setTabIndex(int tabIndex) { - this.tabIndex = tabIndex; - } - - public int getScrollLeft() { - return scrollLeft; - } - - public void setScrollLeft(int scrollLeft) { - this.scrollLeft = scrollLeft; - } - - public int getScrollTop() { - return scrollTop; - } - - public void setScrollTop(int scrollTop) { - this.scrollTop = scrollTop; - } - + public int tabIndex; + public int scrollLeft, scrollTop; } \ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/slider/SliderState.java b/shared/src/com/vaadin/shared/ui/slider/SliderState.java index 98168b80af..7236672b31 100644 --- a/shared/src/com/vaadin/shared/ui/slider/SliderState.java +++ b/shared/src/com/vaadin/shared/ui/slider/SliderState.java @@ -4,57 +4,17 @@ import com.vaadin.shared.AbstractFieldState; public class SliderState extends AbstractFieldState { - protected double value; + public double value; - protected double maxValue; - protected double minValue; + public double maxValue; + public double minValue; /** * The number of fractional digits that are considered significant. Must be * non-negative. */ - protected int resolution; + public int resolution; - protected SliderOrientation orientation; - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } - - public double getMaxValue() { - return maxValue; - } - - public void setMaxValue(double maxValue) { - this.maxValue = maxValue; - } - - public double getMinValue() { - return minValue; - } - - public void setMinValue(double minValue) { - this.minValue = minValue; - } - - public int getResolution() { - return resolution; - } - - public void setResolution(int resolution) { - this.resolution = resolution; - } - - public SliderOrientation getOrientation() { - return orientation; - } - - public void setOrientation(SliderOrientation orientation) { - this.orientation = orientation; - } + public SliderOrientation orientation; } diff --git a/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java b/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java index 71f789b70d..41c51f998a 100644 --- a/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java +++ b/shared/src/com/vaadin/shared/ui/splitpanel/AbstractSplitPanelState.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -23,117 +23,22 @@ import com.vaadin.shared.annotations.DelegateToWidget; public class AbstractSplitPanelState extends ComponentState { - private Connector firstChild = null; - private Connector secondChild = null; - private SplitterState splitterState = new SplitterState(); - - public boolean hasFirstChild() { - return firstChild != null; - } - - public boolean hasSecondChild() { - return secondChild != null; - } - - public Connector getFirstChild() { - return firstChild; - } - - public void setFirstChild(Connector firstChild) { - this.firstChild = firstChild; - } - - public Connector getSecondChild() { - return secondChild; - } - - public void setSecondChild(Connector secondChild) { - this.secondChild = secondChild; - } - - public SplitterState getSplitterState() { - return splitterState; - } - - public void setSplitterState(SplitterState splitterState) { - this.splitterState = splitterState; - } + public Connector firstChild = null; + public Connector secondChild = null; + public SplitterState splitterState = new SplitterState(); public static class SplitterState implements Serializable { - private float position; - private String positionUnit; - private float minPosition; - private String minPositionUnit; - private float maxPosition; - private String maxPositionUnit; - private boolean positionReversed = false; - private boolean locked = false; - - public float getPosition() { - return position; - } - - public void setPosition(float position) { - this.position = position; - } - - public String getPositionUnit() { - return positionUnit; - } - - public void setPositionUnit(String positionUnit) { - this.positionUnit = positionUnit; - } - - public float getMinPosition() { - return minPosition; - } - - public void setMinPosition(float minPosition) { - this.minPosition = minPosition; - } - - public String getMinPositionUnit() { - return minPositionUnit; - } - - public void setMinPositionUnit(String minPositionUnit) { - this.minPositionUnit = minPositionUnit; - } - - public float getMaxPosition() { - return maxPosition; - } - - public void setMaxPosition(float maxPosition) { - this.maxPosition = maxPosition; - } - - public String getMaxPositionUnit() { - return maxPositionUnit; - } - - public void setMaxPositionUnit(String maxPositionUnit) { - this.maxPositionUnit = maxPositionUnit; - } - - public boolean isPositionReversed() { - return positionReversed; - } - + public float position; + public String positionUnit; + public float minPosition; + public String minPositionUnit; + public float maxPosition; + public String maxPositionUnit; + @DelegateToWidget - public void setPositionReversed(boolean positionReversed) { - this.positionReversed = positionReversed; - } - - public boolean isLocked() { - return locked; - } + public boolean positionReversed = false; @DelegateToWidget - public void setLocked(boolean locked) { - this.locked = locked; - } - + public boolean locked = false; } } \ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/textarea/TextAreaState.java b/shared/src/com/vaadin/shared/ui/textarea/TextAreaState.java index 50dc1393a3..a562c607b0 100644 --- a/shared/src/com/vaadin/shared/ui/textarea/TextAreaState.java +++ b/shared/src/com/vaadin/shared/ui/textarea/TextAreaState.java @@ -23,29 +23,13 @@ public class TextAreaState extends AbstractTextFieldState { /** * Number of visible rows in the text area. The default is 5. */ - private int rows = 5; + @DelegateToWidget + public int rows = 5; /** * Tells if word-wrapping should be used in the text area. */ - private boolean wordwrap = true; - - public int getRows() { - return rows; - } - - @DelegateToWidget - public void setRows(int rows) { - this.rows = rows; - } - - public boolean isWordwrap() { - return wordwrap; - } - @DelegateToWidget - public void setWordwrap(boolean wordwrap) { - this.wordwrap = wordwrap; - } + public boolean wordwrap = true; } diff --git a/shared/src/com/vaadin/shared/ui/textfield/AbstractTextFieldState.java b/shared/src/com/vaadin/shared/ui/textfield/AbstractTextFieldState.java index cd3562606d..39265c516f 100644 --- a/shared/src/com/vaadin/shared/ui/textfield/AbstractTextFieldState.java +++ b/shared/src/com/vaadin/shared/ui/textfield/AbstractTextFieldState.java @@ -21,53 +21,20 @@ public class AbstractTextFieldState extends AbstractFieldState { /** * Maximum character count in text field. */ - private int maxLength = -1; + public int maxLength = -1; /** * Number of visible columns in the TextField. */ - private int columns = 0; + public int columns = 0; /** * The prompt to display in an empty field. Null when disabled. */ - private String inputPrompt = null; + public String inputPrompt = null; /** * The text in the field */ - private String text = null; - - public int getMaxLength() { - return maxLength; - } - - public void setMaxLength(int maxLength) { - this.maxLength = maxLength; - } - - public int getColumns() { - return columns; - } - - public void setColumns(int columns) { - this.columns = columns; - } - - public String getInputPrompt() { - return inputPrompt; - } - - public void setInputPrompt(String inputPrompt) { - this.inputPrompt = inputPrompt; - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - + public String text = null; } diff --git a/shared/src/com/vaadin/shared/ui/ui/UIState.java b/shared/src/com/vaadin/shared/ui/ui/UIState.java index 01426bd8f3..6bbfeb18e1 100644 --- a/shared/src/com/vaadin/shared/ui/ui/UIState.java +++ b/shared/src/com/vaadin/shared/ui/ui/UIState.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -19,14 +19,5 @@ import com.vaadin.shared.ComponentState; import com.vaadin.shared.Connector; public class UIState extends ComponentState { - private Connector content; - - public Connector getContent() { - return content; - } - - public void setContent(Connector content) { - this.content = content; - } - + public Connector content; } \ No newline at end of file diff --git a/shared/src/com/vaadin/shared/ui/window/WindowState.java b/shared/src/com/vaadin/shared/ui/window/WindowState.java index 526c5dacb0..c86b6cb187 100644 --- a/shared/src/com/vaadin/shared/ui/window/WindowState.java +++ b/shared/src/com/vaadin/shared/ui/window/WindowState.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -18,68 +18,11 @@ package com.vaadin.shared.ui.window; import com.vaadin.shared.ui.panel.PanelState; public class WindowState extends PanelState { - private boolean modal = false; - private boolean resizable = true; - private boolean resizeLazy = false; - private boolean draggable = true; - private boolean centered = false;; - private int positionX = -1; - private int positionY = -1; - - public boolean isModal() { - return modal; - } - - public void setModal(boolean modal) { - this.modal = modal; - } - - public boolean isResizable() { - return resizable; - } - - public void setResizable(boolean resizable) { - this.resizable = resizable; - } - - public boolean isResizeLazy() { - return resizeLazy; - } - - public void setResizeLazy(boolean resizeLazy) { - this.resizeLazy = resizeLazy; - } - - public boolean isDraggable() { - return draggable; - } - - public void setDraggable(boolean draggable) { - this.draggable = draggable; - } - - public boolean isCentered() { - return centered; - } - - public void setCentered(boolean centered) { - this.centered = centered; - } - - public int getPositionX() { - return positionX; - } - - public void setPositionX(int positionX) { - this.positionX = positionX; - } - - public int getPositionY() { - return positionY; - } - - public void setPositionY(int positionY) { - this.positionY = positionY; - } - + public boolean modal = false; + public boolean resizable = true; + public boolean resizeLazy = false; + public boolean draggable = true; + public boolean centered = false;; + public int positionX = -1; + public int positionY = -1; } \ No newline at end of file