From ad101f842727ca84a184f1bf1ad7c5e63878302b Mon Sep 17 00:00:00 2001 From: Jouni Koivuviita Date: Thu, 27 Aug 2009 12:26:49 +0000 Subject: The Button Component Strikes Back Fixes many theme issues with Button (mostly Reindeer theme), including #3110, #3193, #3194, #3180 and 3079. Default button is now rendered on the client side with a DIV. Disabled buttons can now have descriptions, which fixes #2085. Added a "new" component, NativeButton, which uses native BUTTON element rendering on the client side. Theme compilation script now understands simple @import statements, which help keep things more organized in theme development. svn changeset:8558/svn branch:6.1 --- src/com/vaadin/ui/Button.java | 34 ------------------------- src/com/vaadin/ui/NativeButton.java | 51 +++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 34 deletions(-) create mode 100644 src/com/vaadin/ui/NativeButton.java (limited to 'src/com/vaadin/ui') diff --git a/src/com/vaadin/ui/Button.java b/src/com/vaadin/ui/Button.java index df40aeb018..e4ca734d34 100644 --- a/src/com/vaadin/ui/Button.java +++ b/src/com/vaadin/ui/Button.java @@ -28,8 +28,6 @@ public class Button extends AbstractField { boolean switchMode = false; - private String primaryStyleName; - /** * Creates a new push button. The value of the push button is false and it * is immediate by default. @@ -137,9 +135,6 @@ public class Button extends AbstractField { public void paintContent(PaintTarget target) throws PaintException { super.paintContent(target); - if (primaryStyleName != null) { - target.addAttribute("primarystyle", primaryStyleName); - } if (isSwitchMode()) { target.addAttribute("type", "switch"); } @@ -352,33 +347,4 @@ public class Button extends AbstractField { super.setInternalValue(newValue); } - /** - * - * EXPERIMENTAL FEATURE Use with caution, the method signature - * might change in following releases. - *

- * Sets the components primary style name. - *

- * The primary style name is usually used on the client-side as the prefix - * for widget CSS classnames (this depends on the terminal implementation). - * The default primary styles are usually prefixed with Vaadin proprietary - * "v-" string, e.g. the primary style name for a default Vaadin button is - * "v-button". - *

- * With this method, you can change the primary style name to "mybutton", - * and then on the client-side you would have "mybutton" as the CSS - * classname. After that, all other style names you set for the component - * will be prefixed with the new primary style name, i.e. setting an - * additional style name "red" for the same button would result in a CSS - * classname "mybutton-red" on the client-side. - */ - public void setPrimaryStyleName(String primary) { - primaryStyleName = primary; - requestRepaint(); - } - - public String getPrimaryStyleName() { - return primaryStyleName; - } - } diff --git a/src/com/vaadin/ui/NativeButton.java b/src/com/vaadin/ui/NativeButton.java new file mode 100644 index 0000000000..4df771d054 --- /dev/null +++ b/src/com/vaadin/ui/NativeButton.java @@ -0,0 +1,51 @@ +package com.vaadin.ui; + +import com.vaadin.data.Property; + +@SuppressWarnings("serial") +public class NativeButton extends Button { + + public NativeButton() { + super(); + } + + public NativeButton(String caption) { + super(caption); + } + + public NativeButton(String caption, ClickListener listener) { + super(caption, listener); + } + + public NativeButton(String caption, Object target, String methodName) { + super(caption, target, methodName); + } + + /** + * Creates a new switch button with initial value. + * + * @param state + * the Initial state of the switch-button. + * @param initialState + */ + public NativeButton(String caption, boolean initialState) { + super(caption, initialState); + } + + /** + * Creates a new switch button that is connected to a boolean property. + * + * @param state + * the Initial state of the switch-button. + * @param dataSource + */ + public NativeButton(String caption, Property dataSource) { + super(caption, dataSource); + } + + @Override + public String getTag() { + return "nativebutton"; + } + +} \ No newline at end of file -- cgit v1.2.3