]> source.dussan.org Git - vaadin-framework.git/commitdiff
Remove dependencies from ProgressBar/Escalator to parts related to the server (#15544)
authorArtur Signell <artur@vaadin.com>
Fri, 9 Jan 2015 14:10:21 +0000 (16:10 +0200)
committerArtur Signell <artur@vaadin.com>
Sun, 11 Jan 2015 11:06:49 +0000 (11:06 +0000)
Change-Id: I45e6a651daf00f1d6868ad27c042891ef0d34f6a

12 files changed:
client/src/com/vaadin/client/ApplicationConnection.java
client/src/com/vaadin/client/StyleConstants.java
client/src/com/vaadin/client/VCaption.java
client/src/com/vaadin/client/ui/AbstractComponentConnector.java
client/src/com/vaadin/client/ui/AbstractFieldConnector.java
client/src/com/vaadin/client/ui/VFormLayout.java
client/src/com/vaadin/client/ui/VNativeButton.java
client/src/com/vaadin/client/ui/VOptionGroup.java
client/src/com/vaadin/client/ui/VProgressBar.java
client/src/com/vaadin/client/ui/VTwinColSelect.java
client/src/com/vaadin/client/ui/VUpload.java
client/src/com/vaadin/client/widgets/Escalator.java

index 82723a0551464e6fd0f49b4f653d7a7d40e0cdfa..a84b7d747264fb32fb4f83d936b838cbe80f9730 100644 (file)
@@ -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
index c4588587d4d58ef174659dc2cea8869df26685d3..fad88f1359a2da5867680f17d0abf9a115e7f7cb 100644 (file)
@@ -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";
 }
index a12097da7d320db5a280bad86547f6ae5049a4a6..050edae8bed8343a9643a8d785e16b2145d57667 100644 (file)
@@ -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) {
index 4ac8ee11a859f744367309e00bfb314fd6f246f0..46ad2894882f27a39cd7485ba13f92c50a54c5b1 100644 (file)
@@ -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.
index 965e79b6fd9817e85bef24af9f1ad0dc51771dbc..8d8df81bd890f0a11db75860fc5418df54c93f96 100644 (file)
@@ -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());
     }
 }
index 64a7c5e5794f3b5135055a34be38fa180ed2d5b7..a2ea77d31c68dab92669ff5589359f3fcec67495 100644 (file)
@@ -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;
index 8e0dd2bce1983a68e5a6db8688829aeb0ce83224..77b2515f4573f6d1306206d98e2d0ccdefc31633 100644 (file)
@@ -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();
         }
 
index 588934369bbf384ca58c24581c9cd7596de28f01..d4297520696c4cc7013d6fd60bad413f27246870 100644 (file)
@@ -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()));
                 }
             }
index 00646f7a5e34f0efe627f4e17fe7e75ef6ca13c3..348791728f330ccd4d3e33e2e762c68e8508169e 100644 (file)
@@ -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);
         }
     }
 }
index 5dbd534934d3fb2807240463d30314e5993228c0..853bd8d456e727803a728531fd7d7497e2ec8b65 100644 (file)
@@ -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
index 42fb08fb3cd69ecba260fe04b5d24d7dff439a6c..dff45a69512c6bec0587ae1c07a9748eb869a964 100644 (file)
@@ -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);
     }
 
     /**
index 2d131b71c58f2c02f63492bf61e14fdbbae7a3cd..deaa9005c34483d0afef65506c8204e765b6b945 100644 (file)
@@ -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)