diff options
author | Artur Signell <artur@vaadin.com> | 2015-01-09 16:10:21 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2015-01-11 11:06:49 +0000 |
commit | e6f97d6f52e633c3a3ea3917797902cee917164d (patch) | |
tree | 6fc54225b49cce33965be37b29b7836028b733e5 | |
parent | 408c24629435be48396a1b54921746bb856dd555 (diff) | |
download | vaadin-framework-e6f97d6f52e633c3a3ea3917797902cee917164d.tar.gz vaadin-framework-e6f97d6f52e633c3a3ea3917797902cee917164d.zip |
Remove dependencies from ProgressBar/Escalator to parts related to the server (#15544)
Change-Id: I45e6a651daf00f1d6868ad27c042891ef0d34f6a
12 files changed, 47 insertions, 41 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index 82723a0551..a84b7d7472 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -144,15 +144,20 @@ public class ApplicationConnection implements HasHandlers { private FastStringSet detachedConnectorIds = FastStringSet.create(); } - public static final String MODIFIED_CLASSNAME = "v-modified"; + @Deprecated + public static final String MODIFIED_CLASSNAME = StyleConstants.MODIFIED; - public static final String DISABLED_CLASSNAME = "v-disabled"; + @Deprecated + public static final String DISABLED_CLASSNAME = StyleConstants.DISABLED; - public static final String REQUIRED_CLASSNAME = "v-required"; + @Deprecated + public static final String REQUIRED_CLASSNAME = StyleConstants.REQUIRED; - public static final String REQUIRED_CLASSNAME_EXT = "-required"; + @Deprecated + public static final String REQUIRED_CLASSNAME_EXT = StyleConstants.REQUIRED_EXT; - public static final String ERROR_CLASSNAME_EXT = "-error"; + @Deprecated + public static final String ERROR_CLASSNAME_EXT = StyleConstants.ERROR_EXT; /** * A string that, if found in a non-JSON response to a UIDL request, will diff --git a/client/src/com/vaadin/client/StyleConstants.java b/client/src/com/vaadin/client/StyleConstants.java index c4588587d4..fad88f1359 100644 --- a/client/src/com/vaadin/client/StyleConstants.java +++ b/client/src/com/vaadin/client/StyleConstants.java @@ -35,4 +35,13 @@ public class StyleConstants { * Added to all layouts to denote they are layouts */ public static final String UI_LAYOUT = "v-layout"; + + public static final String MODIFIED = "v-modified"; + public static final String DISABLED = "v-disabled"; + + public static final String REQUIRED = "v-required"; + + public static final String REQUIRED_EXT = "-required"; + + public static final String ERROR_EXT = "-error"; } diff --git a/client/src/com/vaadin/client/VCaption.java b/client/src/com/vaadin/client/VCaption.java index a12097da7d..050edae8be 100644 --- a/client/src/com/vaadin/client/VCaption.java +++ b/client/src/com/vaadin/client/VCaption.java @@ -148,7 +148,7 @@ public class VCaption extends HTML { } } if (!owner.isEnabled()) { - style += " " + ApplicationConnection.DISABLED_CLASSNAME; + style += " " + StyleConstants.DISABLED; } setStyleName(style); @@ -328,7 +328,7 @@ public class VCaption extends HTML { String style = VCaption.CLASSNAME; if (disabled) { - style += " " + ApplicationConnection.DISABLED_CLASSNAME; + style += " " + StyleConstants.DISABLED; } setStyleName(style); if (hasDescription) { diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java index 4ac8ee11a8..46ad289488 100644 --- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java @@ -21,7 +21,6 @@ import com.google.gwt.dom.client.Element; import com.google.gwt.user.client.ui.Focusable; import com.google.gwt.user.client.ui.HasEnabled; import com.google.gwt.user.client.ui.Widget; -import com.vaadin.client.ApplicationConnection; import com.vaadin.client.ComponentConnector; import com.vaadin.client.HasComponentsConnector; import com.vaadin.client.LayoutManager; @@ -195,8 +194,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector @Override public void setWidgetEnabled(boolean widgetEnabled) { // add or remove v-disabled style name from the widget - setWidgetStyleName(ApplicationConnection.DISABLED_CLASSNAME, - !widgetEnabled); + setWidgetStyleName(StyleConstants.DISABLED, !widgetEnabled); if (getWidget() instanceof HasEnabled) { // set widget specific enabled state @@ -343,8 +341,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector // add / remove error style name setWidgetStyleNameWithPrefix(primaryStyleName, - ApplicationConnection.ERROR_CLASSNAME_EXT, - null != state.errorMessage); + StyleConstants.ERROR_EXT, null != state.errorMessage); // add additional user defined style names as class names, prefixed with // component default class name. remove nonexistent style names. diff --git a/client/src/com/vaadin/client/ui/AbstractFieldConnector.java b/client/src/com/vaadin/client/ui/AbstractFieldConnector.java index 965e79b6fd..8d8df81bd8 100644 --- a/client/src/com/vaadin/client/ui/AbstractFieldConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractFieldConnector.java @@ -15,7 +15,7 @@ */ package com.vaadin.client.ui; -import com.vaadin.client.ApplicationConnection; +import com.vaadin.client.StyleConstants; import com.vaadin.shared.AbstractFieldState; public abstract class AbstractFieldConnector extends AbstractComponentConnector { @@ -51,14 +51,12 @@ public abstract class AbstractFieldConnector extends AbstractComponentConnector super.updateWidgetStyleNames(); // add / remove modified style name to Fields - setWidgetStyleName(ApplicationConnection.MODIFIED_CLASSNAME, - isModified()); + setWidgetStyleName(StyleConstants.MODIFIED, isModified()); // add / remove error style name to Fields setWidgetStyleNameWithPrefix(getWidget().getStylePrimaryName(), - ApplicationConnection.REQUIRED_CLASSNAME_EXT, isRequired()); + StyleConstants.REQUIRED_EXT, isRequired()); - getWidget().setStyleName(ApplicationConnection.REQUIRED_CLASSNAME, - isRequired()); + getWidget().setStyleName(StyleConstants.REQUIRED, isRequired()); } } diff --git a/client/src/com/vaadin/client/ui/VFormLayout.java b/client/src/com/vaadin/client/ui/VFormLayout.java index 64a7c5e579..a2ea77d31c 100644 --- a/client/src/com/vaadin/client/ui/VFormLayout.java +++ b/client/src/com/vaadin/client/ui/VFormLayout.java @@ -30,7 +30,6 @@ import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.SimplePanel; import com.google.gwt.user.client.ui.Widget; -import com.vaadin.client.ApplicationConnection; import com.vaadin.client.BrowserInfo; import com.vaadin.client.ComponentConnector; import com.vaadin.client.Focusable; @@ -78,7 +77,7 @@ public class VFormLayout extends SimplePanel { } if (!enabled) { - styles.add(ApplicationConnection.DISABLED_CLASSNAME); + styles.add(StyleConstants.DISABLED); } return styles.toArray(new String[styles.size()]); @@ -242,7 +241,7 @@ public class VFormLayout extends SimplePanel { if (styles != null) { for (String style : styles) { - if (ApplicationConnection.DISABLED_CLASSNAME.equals(style)) { + if (StyleConstants.DISABLED.equals(style)) { // Add v-disabled also without classname prefix so // generic v-disabled CSS rules work styleName += " " + style; diff --git a/client/src/com/vaadin/client/ui/VNativeButton.java b/client/src/com/vaadin/client/ui/VNativeButton.java index 8e0dd2bce1..77b2515f45 100644 --- a/client/src/com/vaadin/client/ui/VNativeButton.java +++ b/client/src/com/vaadin/client/ui/VNativeButton.java @@ -25,6 +25,7 @@ import com.google.gwt.user.client.ui.Button; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.BrowserInfo; import com.vaadin.client.MouseEventDetailsBuilder; +import com.vaadin.client.StyleConstants; import com.vaadin.client.Util; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.button.ButtonServerRpc; @@ -146,7 +147,7 @@ public class VNativeButton extends Button implements ClickHandler { setEnabled(false); // FIXME: This should be moved to NativeButtonConnector along with // buttonRpcProxy - addStyleName(ApplicationConnection.DISABLED_CLASSNAME); + addStyleName(StyleConstants.DISABLED); buttonRpcProxy.disableOnClick(); } diff --git a/client/src/com/vaadin/client/ui/VOptionGroup.java b/client/src/com/vaadin/client/ui/VOptionGroup.java index 588934369b..d429752069 100644 --- a/client/src/com/vaadin/client/ui/VOptionGroup.java +++ b/client/src/com/vaadin/client/ui/VOptionGroup.java @@ -40,8 +40,8 @@ import com.google.gwt.user.client.ui.HasEnabled; import com.google.gwt.user.client.ui.Panel; import com.google.gwt.user.client.ui.RadioButton; import com.google.gwt.user.client.ui.Widget; -import com.vaadin.client.ApplicationConnection; import com.vaadin.client.BrowserInfo; +import com.vaadin.client.StyleConstants; import com.vaadin.client.UIDL; import com.vaadin.client.Util; import com.vaadin.client.WidgetUtil; @@ -179,8 +179,7 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, op.setEnabled(enabled); optionsEnabled.put(op, optionEnabled); - setStyleName(op.getElement(), - ApplicationConnection.DISABLED_CLASSNAME, + setStyleName(op.getElement(), StyleConstants.DISABLED, !(optionEnabled && isEnabled())); newwidgets.add(op); @@ -249,14 +248,12 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, Boolean isOptionEnabled = optionsEnabled.get(w); if (isOptionEnabled == null) { hasEnabled.setEnabled(optionGroupEnabled); - setStyleName(w.getElement(), - ApplicationConnection.DISABLED_CLASSNAME, + setStyleName(w.getElement(), StyleConstants.DISABLED, !isEnabled()); } else { hasEnabled .setEnabled(isOptionEnabled && optionGroupEnabled); - setStyleName(w.getElement(), - ApplicationConnection.DISABLED_CLASSNAME, + setStyleName(w.getElement(), StyleConstants.DISABLED, !(isOptionEnabled && isEnabled())); } } diff --git a/client/src/com/vaadin/client/ui/VProgressBar.java b/client/src/com/vaadin/client/ui/VProgressBar.java index 00646f7a5e..348791728f 100644 --- a/client/src/com/vaadin/client/ui/VProgressBar.java +++ b/client/src/com/vaadin/client/ui/VProgressBar.java @@ -21,8 +21,7 @@ import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.HasEnabled; import com.google.gwt.user.client.ui.Widget; -import com.vaadin.client.ApplicationConnection; -import com.vaadin.shared.ui.progressindicator.ProgressBarState; +import com.vaadin.client.StyleConstants; /** * Widget for showing the current progress of a long running task. @@ -37,6 +36,8 @@ import com.vaadin.shared.ui.progressindicator.ProgressBarState; */ public class VProgressBar extends Widget implements HasEnabled { + public static final String PRIMARY_STYLE_NAME = "v-progressbar"; + Element wrapper = DOM.createDiv(); Element indicator = DOM.createDiv(); @@ -49,7 +50,7 @@ public class VProgressBar extends Widget implements HasEnabled { getElement().appendChild(wrapper); wrapper.appendChild(indicator); - setStylePrimaryName(ProgressBarState.PRIMARY_STYLE_NAME); + setStylePrimaryName(PRIMARY_STYLE_NAME); } /* @@ -94,7 +95,7 @@ public class VProgressBar extends Widget implements HasEnabled { public void setEnabled(boolean enabled) { if (this.enabled != enabled) { this.enabled = enabled; - setStyleName(ApplicationConnection.DISABLED_CLASSNAME, !enabled); + setStyleName(StyleConstants.DISABLED, !enabled); } } } diff --git a/client/src/com/vaadin/client/ui/VTwinColSelect.java b/client/src/com/vaadin/client/ui/VTwinColSelect.java index 5dbd534934..853bd8d456 100644 --- a/client/src/com/vaadin/client/ui/VTwinColSelect.java +++ b/client/src/com/vaadin/client/ui/VTwinColSelect.java @@ -37,7 +37,7 @@ import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.ListBox; import com.google.gwt.user.client.ui.Panel; -import com.vaadin.client.ApplicationConnection; +import com.vaadin.client.StyleConstants; import com.vaadin.client.UIDL; import com.vaadin.client.WidgetUtil; import com.vaadin.shared.ui.twincolselect.TwinColSelectConstants; @@ -429,8 +429,8 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler, selections.setEnabled(enabled); add.setEnabled(enabled); remove.setEnabled(enabled); - add.setStyleName(ApplicationConnection.DISABLED_CLASSNAME, !enabled); - remove.setStyleName(ApplicationConnection.DISABLED_CLASSNAME, !enabled); + add.setStyleName(StyleConstants.DISABLED, !enabled); + remove.setStyleName(StyleConstants.DISABLED, !enabled); } @Override diff --git a/client/src/com/vaadin/client/ui/VUpload.java b/client/src/com/vaadin/client/ui/VUpload.java index 42fb08fb3c..dff45a6951 100644 --- a/client/src/com/vaadin/client/ui/VUpload.java +++ b/client/src/com/vaadin/client/ui/VUpload.java @@ -36,6 +36,7 @@ import com.google.gwt.user.client.ui.Panel; import com.google.gwt.user.client.ui.SimplePanel; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.BrowserInfo; +import com.vaadin.client.StyleConstants; import com.vaadin.client.VConsole; import com.vaadin.client.ui.upload.UploadIFrameOnloadStrategy; @@ -211,8 +212,7 @@ public class VUpload extends SimplePanel { private void setEnabledForSubmitButton(boolean enabled) { submitButton.setEnabled(enabled); - submitButton.setStyleName(ApplicationConnection.DISABLED_CLASSNAME, - !enabled); + submitButton.setStyleName(StyleConstants.DISABLED, !enabled); } /** diff --git a/client/src/com/vaadin/client/widgets/Escalator.java b/client/src/com/vaadin/client/widgets/Escalator.java index 2d131b71c5..deaa9005c3 100644 --- a/client/src/com/vaadin/client/widgets/Escalator.java +++ b/client/src/com/vaadin/client/widgets/Escalator.java @@ -74,7 +74,6 @@ import com.vaadin.client.widget.escalator.ScrollbarBundle.VerticalScrollbarBundl import com.vaadin.client.widget.grid.events.ScrollEvent; import com.vaadin.client.widget.grid.events.ScrollHandler; import com.vaadin.client.widgets.Escalator.JsniUtil.TouchHandlerBundle; -import com.vaadin.shared.ui.grid.GridState; import com.vaadin.shared.ui.grid.HeightMode; import com.vaadin.shared.ui.grid.Range; import com.vaadin.shared.ui.grid.ScrollDestination; @@ -4266,7 +4265,7 @@ public class Escalator extends Widget implements RequiresResize, DeferredWorker private double heightOfEscalator = 0; /** The height of Escalator in terms of body rows. */ - private double heightByRows = GridState.DEFAULT_HEIGHT_BY_ROWS; + private double heightByRows = 10.0d; /** The height of Escalator, as defined by {@link #setHeight(String)} */ private String heightByCss = ""; @@ -4892,7 +4891,7 @@ public class Escalator extends Widget implements RequiresResize, DeferredWorker * Gets the amount of rows in Escalator's body that are shown, while * {@link #getHeightMode()} is {@link HeightMode#ROW}. * <p> - * By default, it is {@value GridState#DEFAULT_HEIGHT_BY_ROWS}. + * By default, it is 10. * * @return the amount of rows that are being shown in Escalator's body * @see #setHeightByRows(double) |