]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixes #3736 "Split up style and type definitions" and #3467 "Button styles missing?"
authorJouni Koivuviita <jouni.koivuviita@itmill.com>
Wed, 3 Mar 2010 11:05:31 +0000 (11:05 +0000)
committerJouni Koivuviita <jouni.koivuviita@itmill.com>
Wed, 3 Mar 2010 11:05:31 +0000 (11:05 +0000)
 * Now all built-in themes have an accompanying class file that describes all provided style names.
 * Deprecated Button.STYLE_LINK in favor of BaseTheme.BUTTON_LINK
 * Deprecated Panel.STYLE_LIGHT in favor of Reindeer.PANEL_LIGHT and Runo.PANEL_LIGHT

svn changeset:11601/svn branch:6.3

src/com/vaadin/ui/Button.java
src/com/vaadin/ui/Panel.java
src/com/vaadin/ui/themes/BaseTheme.java [new file with mode: 0644]
src/com/vaadin/ui/themes/Reindeer.java [new file with mode: 0644]
src/com/vaadin/ui/themes/Runo.java [new file with mode: 0644]

index 3ed50b2d42e20f32636d578644077a3730902406..65a34a18bb97bc3723abb97a47b3a7187b23b369 100644 (file)
@@ -13,6 +13,7 @@ import com.vaadin.data.Property;
 import com.vaadin.terminal.PaintException;
 import com.vaadin.terminal.PaintTarget;
 import com.vaadin.terminal.gwt.client.ui.VButton;
+import com.vaadin.ui.themes.BaseTheme;
 
 /**
  * A generic button component.
@@ -239,7 +240,12 @@ public class Button extends AbstractField {
 
     private static final Method BUTTON_CLICK_METHOD;
 
-    /* Button style with no decorations. Looks like a link, acts like a button */
+    /**
+     * Button style with no decorations. Looks like a link, acts like a button
+     * 
+     * @deprecated use {@link BaseTheme#BUTTON_LINK} instead.
+     */
+    @Deprecated
     public static final String STYLE_LINK = "link";
 
     static {
index df08c4e62bfb315ee9c6e43aa88621135a6a2c7c..f4ce352687b1c4d49d9f013ac9403088392ffc06 100644 (file)
@@ -19,6 +19,8 @@ import com.vaadin.terminal.PaintTarget;
 import com.vaadin.terminal.Scrollable;
 import com.vaadin.terminal.gwt.client.MouseEventDetails;
 import com.vaadin.terminal.gwt.client.ui.VPanel;
+import com.vaadin.ui.themes.Reindeer;
+import com.vaadin.ui.themes.Runo;
 
 /**
  * Panel - a simple single component container.
@@ -36,6 +38,16 @@ public class Panel extends AbstractComponentContainer implements Scrollable,
 
     private static final String CLICK_EVENT = VPanel.CLICK_EVENT_IDENTIFIER;
 
+    /**
+     * Removes extra decorations from the Panel.
+     * 
+     * @deprecated this style is no longer part of the core framework and this
+     *             component, even though most built-in themes implement this
+     *             style. Use the constant specified in the theme class file
+     *             that you're using, if it provides one, e.g.
+     *             {@link Reindeer#PANEL_LIGHT} or {@link Runo#PANEL_LIGHT} .
+     */
+    @Deprecated
     public static final String STYLE_LIGHT = "light";
 
     /**
diff --git a/src/com/vaadin/ui/themes/BaseTheme.java b/src/com/vaadin/ui/themes/BaseTheme.java
new file mode 100644 (file)
index 0000000..48083f5
--- /dev/null
@@ -0,0 +1,44 @@
+package com.vaadin.ui.themes;
+
+/**
+ * <p>
+ * The Base theme is the foundation for all Vaadin themes. Although it is not
+ * necessary to use it as the starting point for all other themes, it is heavily
+ * encouraged, since it abstracts and hides away many necessary style properties
+ * that the Vaadin terminal expects and needs.
+ * </p>
+ * <p>
+ * When creating your own theme, either extend this class and specify the styles
+ * implemented in your theme here, or extend some other theme that has a class
+ * file specified (e.g. Reindeer or Runo).
+ * </p>
+ * <p>
+ * All theme class files should follow the convention of specifying the theme
+ * name as a string constant <code>THEME_NAME</code>.
+ * 
+ * @since 6.3.0
+ * 
+ */
+public class BaseTheme {
+
+    public static final String THEME_NAME = "Base";
+
+    /**
+     * Creates a button that looks like a regular hypertext link but still acts
+     * like a normal button.
+     */
+    public static final String BUTTON_LINK = "link";
+
+    /**
+     * Removes extra decorations from the panel.
+     * 
+     * @deprecated Base theme does not implement this style, but it is defined
+     *             here since it has been a part of the framework before
+     *             multiple themes were available. Use the constant provided by
+     *             the theme you're using instead, e.g.
+     *             {@link Reindeer#PANEL_LIGHT} or {@link Runo#PANEL_LIGHT}.
+     */
+    @Deprecated
+    public static final String PANEL_LIGHT = "light";
+
+}
\ No newline at end of file
diff --git a/src/com/vaadin/ui/themes/Reindeer.java b/src/com/vaadin/ui/themes/Reindeer.java
new file mode 100644 (file)
index 0000000..acbf003
--- /dev/null
@@ -0,0 +1,163 @@
+package com.vaadin.ui.themes;
+
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.VerticalLayout;
+
+public class Reindeer extends BaseTheme {
+
+    public static final String THEME_NAME = "Reindeer";
+
+    /***************************************************************************
+     * 
+     * Label styles
+     * 
+     **************************************************************************/
+
+    /**
+     * Large font for main application headings
+     */
+    public static final String LABEL_H1 = "h1";
+
+    /**
+     * Large font for different sections in the application
+     */
+    public static final String LABEL_H2 = "h2";
+
+    /**
+     * Small and a little lighter font
+     */
+    public static final String LABEL_SMALL = "light";
+
+    /***************************************************************************
+     * 
+     * Button styles
+     * 
+     **************************************************************************/
+
+    /**
+     * Default action style for buttons (the button that gets activated when
+     * user presses 'enter' in a form). Use sparingly, only one default button
+     * per screen should be visible.
+     */
+    public static final String BUTTON_DEFAULT = "primary";
+
+    /**
+     * Small sized button, use for context specific actions for example
+     */
+    public static final String BUTTON_SMALL = "small";
+
+    /***************************************************************************
+     * 
+     * TextField styles
+     * 
+     **************************************************************************/
+
+    /**
+     * Small sized text field with small font
+     */
+    public static final String TEXTFIELD_SMALL = "small";
+
+    /***************************************************************************
+     * 
+     * Panel styles
+     * 
+     **************************************************************************/
+
+    /**
+     * Removes borders and background color from the panel
+     */
+    public static final String PANEL_LIGHT = "light";
+
+    /***************************************************************************
+     * 
+     * SplitPanel styles
+     * 
+     **************************************************************************/
+
+    /**
+     * Reduces the split handle to a minimal size (1 pixel)
+     */
+    public static final String SPLITPANEL_SMALL = "small";
+
+    /***************************************************************************
+     * 
+     * TabSheet styles
+     * 
+     **************************************************************************/
+
+    /**
+     * Removes borders and background color from the tab sheet, and shows the
+     * tabs as a small bar.
+     */
+    public static final String TABSHEET_BAR = "bar";
+
+    /**
+     * Removes borders and background color from the tab sheet. The tabs are
+     * presented with minimal lines indicating the selected tab.
+     */
+    public static final String TABSHEET_MINIMAL = "minimal";
+
+    /***************************************************************************
+     * 
+     * Table styles
+     * 
+     **************************************************************************/
+
+    /**
+     * Removes borders from the table
+     */
+    public static final String TABLE_BORDERLESS = "borderless";
+
+    /**
+     * Makes the table headers dark and more prominent.
+     */
+    public static final String TABLE_STRONG = "strong";
+
+    /***************************************************************************
+     * 
+     * Layout styles
+     * 
+     **************************************************************************/
+
+    /**
+     * Changes the background of a layout to a shade of blue. Applies to
+     * {@link VerticalLayout}, {@link HorizontalLayout}, {@link GridLayout},
+     * {@link FormLayout} and {@link CssLayout}.
+     */
+    public static final String LAYOUT_BLUE = "blue";
+
+    /**
+     * <p>
+     * Changes the background of a layout to almost black, and at the same time
+     * transforms contained components to their black style correspondents when
+     * available. At least texts, buttons, text fields, selects, date fields,
+     * tables and a few other component styles should change.
+     * </p>
+     * <p>
+     * Applies to {@link VerticalLayout}, {@link HorizontalLayout},
+     * {@link GridLayout}, {@link FormLayout} and {@link CssLayout}.
+     * </p>
+     * 
+     */
+    public static final String LAYOUT_BLACK = "black";
+
+    /***************************************************************************
+     * 
+     * Window styles
+     * 
+     **************************************************************************/
+
+    /**
+     * Makes the whole window white and increases the font size of the title.
+     */
+    public static final String WINDOW_LIGHT = "light";
+
+    /**
+     * Makes the whole window black, and changes contained components in the
+     * same way as {@link #LAYOUT_BLACK} does.
+     */
+    public static final String WINDOW_BLACK = "black";
+}
diff --git a/src/com/vaadin/ui/themes/Runo.java b/src/com/vaadin/ui/themes/Runo.java
new file mode 100644 (file)
index 0000000..4df6046
--- /dev/null
@@ -0,0 +1,30 @@
+package com.vaadin.ui.themes;
+
+
+public class Runo extends BaseTheme {
+
+    public static final String THEME_NAME = "Runo";
+
+    /***************************************************************************
+     * 
+     * Button styles
+     * 
+     **************************************************************************/
+
+    /**
+     * Small sized button, use for context specific actions for example
+     */
+    public static final String BUTTON_SMALL = "small";
+
+    /***************************************************************************
+     * 
+     * Panel styles
+     * 
+     **************************************************************************/
+
+    /**
+     * Removes borders and background color from the panel
+     */
+    public static final String PANEL_LIGHT = "light";
+
+}