]> source.dussan.org Git - vaadin-framework.git/commitdiff
setStyle() -> setStyleName() refactor (partial #890). Compromise: setStyle() _removed...
authorMarc Englund <marc.englund@itmill.com>
Mon, 22 Oct 2007 12:52:55 +0000 (12:52 +0000)
committerMarc Englund <marc.englund@itmill.com>
Mon, 22 Oct 2007 12:52:55 +0000 (12:52 +0000)
svn changeset:2577/svn branch:trunk

src/com/itmill/toolkit/tests/featurebrowser/PropertyPanel.java
src/com/itmill/toolkit/ui/AbstractComponent.java
src/com/itmill/toolkit/ui/Component.java
src/com/itmill/toolkit/ui/CustomComponent.java

index 63cc57cffa84afc14d3f39264d011b979031518d..779dd35a88587ee24ca63ae433803e780246797b 100644 (file)
@@ -207,7 +207,7 @@ public class PropertyPanel extends Panel implements Button.ClickListener,
                                                                "Sample Formatted error", "Sample System Error" });
 
                // Style
-               String currentStyle = ((Component) objectToConfigure).getStyle();
+               String currentStyle = ((Component) objectToConfigure).getStyleName();
                if (currentStyle == null)
                        set.replaceWithSelect("style", new Object[] { null },
                                        new Object[] { "Default" }).setNewItemsAllowed(true);
index 62a34ba453f0c6f76ec3a54adb5c7ea2fe17846e..68ceec5b0cd128331f0cd5030fed1db20ecd9a4c 100644 (file)
@@ -151,11 +151,38 @@ public abstract class AbstractComponent implements Component, MethodEventSource
         */
        public abstract String getTag();
 
+       /**
+        * Gets style for component. Multiple styles are joined with spaces.
+        * 
+        * @return the component's styleValue of property style.
+        * @deprecated Use getStyleName() instead; renamed for consistency and to
+        *             indicate that "style" should not be used to switch client
+        *             side implementation, only to style the component.
+        */
+       public String getStyle() {
+               return getStyleName();
+       }
+       
+       /**
+        * Sets and replaces all previous style names of the component. This method
+        * will trigger a
+        * {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent RepaintRequestEvent}.
+        * 
+        * @param style
+        *            the new style of the component.
+        * @deprecated Use setStyleName() instead; renamed for consistency and to
+        *             indicate that "style" should not be used to switch client
+        *             side implementation, only to style the component.
+        */
+       public void setStyle(String style) {
+               setStyleName(style);
+       }
+       
        /*
         * Gets the component's style. Don't add a JavaDoc comment here, we use the
         * default documentation from implemented interface.
         */
-       public String getStyle() {
+       public String getStyleName() {
                String s = "";
                if (styles != null) {
                        for (Iterator it = styles.iterator(); it.hasNext();) {
@@ -171,7 +198,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource
         * Sets the component's style. Don't add a JavaDoc comment here, we use the
         * default documentation from implemented interface.
         */
-       public void setStyle(String style) {
+       public void setStyleName(String style) {
                if (style == null || "".equals(style)) {
                        styles = null;
                        requestRepaint();
index 7af0485e0e415ca00526ffd2040875217dd7b2f0..eefa6ff11d5a77948eea8350e89ac5051d66a0f5 100644 (file)
@@ -55,7 +55,7 @@ public interface Component extends Paintable, VariableOwner {
         * 
         * @return the component's styleValue of property style.
         */
-       public String getStyle();
+       public String getStyleName();
 
        /**
         * Sets and replaces all previous style names of the component. This method
@@ -65,12 +65,12 @@ public interface Component extends Paintable, VariableOwner {
         * @param style
         *            the new style of the component.
         */
-       public void setStyle(String style);
-
+       public void setStyleName(String style);
+       
        /**
-        * Adds style name to component. Handeling additional style names is
-        * terminal spesicif, but in web browser enviroment they will most likely
-        * become CSS classes as given on server side.
+        * Adds style name to component. Handling additional style names is terminal
+        * specific, but in web browser environment they will most likely become CSS
+        * classes as given on server side.
         * 
         * This method will trigger a
         * {@link com.itmill.toolkit.terminal.Paintable.RepaintRequestEvent RepaintRequestEvent}.
index 2c5267e03396150f353112edae33c534cb9ea55f..786fdae539918b012c11198e35ce043f949700d8 100644 (file)
@@ -228,7 +228,7 @@ public class CustomComponent implements Component {
         * 
         * @see com.itmill.toolkit.ui.Component#getStyle()
         */
-       public String getStyle() {
+       public String getStyleName() {
                return null;
        }
 
@@ -244,7 +244,7 @@ public class CustomComponent implements Component {
        }
 
        /**
-        * Custom component is allways enabled by default.
+        * Custom component is always enabled by default.
         * 
         * @see com.itmill.toolkit.ui.Component#isEnabled()
         */
@@ -380,11 +380,11 @@ public class CustomComponent implements Component {
        }
 
        /**
-        * Sets the look-and-feel style of the component.
+        * Custom component does not implement custom styles by default.
         * 
         * @see com.itmill.toolkit.ui.Component#setStyle(java.lang.String)
         */
-       public void setStyle(String style) {
+       public void setStyleName(String style) {
        }
 
        /**
@@ -433,13 +433,16 @@ public class CustomComponent implements Component {
        }
 
        /* Dependency -framework is deprecated */
-       public void dependsOn(VariableOwner depended) {}
-       public void removeDirectDependency(VariableOwner depended) {}
+       public void dependsOn(VariableOwner depended) {
+       }
+
+       public void removeDirectDependency(VariableOwner depended) {
+       }
+
        public Set getDirectDependencies() {
                return null;
        }
 
-
        /* Event functions are not implemented by default -------------------- */
 
        /**