]> source.dussan.org Git - vaadin-framework.git/commitdiff
Update some APIs based on the 7.2 API review comments
authorJonatan Kronqvist <jonatan@vaadin.com>
Tue, 8 Apr 2014 12:02:58 +0000 (15:02 +0300)
committerJonatan Kronqvist <jonatan@vaadin.com>
Mon, 14 Apr 2014 08:43:18 +0000 (11:43 +0300)
* NotificationConfiguration "helpers" removed from Notification
* NotificationConfiguration methods accept Type instead of style (String)
* Tab.setIconAltText -> Tab.setIconAlternateText
* Remove the two new TabSheet.addTab() methods
* UI.reinit() -> UI.refresh()

Change-Id: I97488e7c6de8cfacc591450d69c821b2973b8707

25 files changed:
client/src/com/vaadin/client/ui/VNotification.java
client/src/com/vaadin/client/ui/VWindow.java
server/src/com/vaadin/annotations/PreserveOnRefresh.java
server/src/com/vaadin/server/Page.java
server/src/com/vaadin/server/UIProvider.java
server/src/com/vaadin/server/communication/UIInitHandler.java
server/src/com/vaadin/ui/Notification.java
server/src/com/vaadin/ui/NotificationConfiguration.java
server/src/com/vaadin/ui/TabSheet.java
server/src/com/vaadin/ui/UI.java
server/src/com/vaadin/ui/Window.java
server/tests/src/com/vaadin/ui/UIInitRefreshTest.java [new file with mode: 0644]
server/tests/src/com/vaadin/ui/UIInitReinitTest.java [deleted file]
shared/src/com/vaadin/shared/ui/ui/NotificationConfigurationBean.java [deleted file]
shared/src/com/vaadin/shared/ui/ui/NotificationRole.java [new file with mode: 0644]
shared/src/com/vaadin/shared/ui/ui/UIState.java
shared/src/com/vaadin/shared/ui/window/WindowRole.java [new file with mode: 0644]
shared/src/com/vaadin/shared/ui/window/WindowState.java
uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java
uitest/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.java
uitest/src/com/vaadin/tests/components/ui/UIRefresh.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/ui/UIRefreshTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/ui/UIReinit.java [deleted file]
uitest/src/com/vaadin/tests/components/ui/UIReinitTest.java [deleted file]
uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAria.java

index 3aa3fa847d88f9f01e5eb78ba6a6acb83b579b3f..a43f508f6e73e53aff9f9e81288465d843b8bcb8 100644 (file)
@@ -38,9 +38,9 @@ import com.vaadin.client.UIDL;
 import com.vaadin.client.Util;
 import com.vaadin.client.ui.aria.AriaHelper;
 import com.vaadin.shared.Position;
-import com.vaadin.shared.ui.ui.NotificationConfigurationBean;
-import com.vaadin.shared.ui.ui.NotificationConfigurationBean.Role;
 import com.vaadin.shared.ui.ui.UIConstants;
+import com.vaadin.shared.ui.ui.UIState.NotificationTypeConfiguration;
+import com.vaadin.shared.ui.ui.NotificationRole;
 
 public class VNotification extends VOverlay {
 
@@ -161,20 +161,20 @@ public class VNotification extends VOverlay {
     }
 
     public void show(Widget widget, Position position, String style) {
-        NotificationConfigurationBean styleSetup = getUiState(style);
+        NotificationTypeConfiguration styleSetup = getUiState(style);
         setWaiAriaRole(styleSetup);
 
         FlowPanel panel = new FlowPanel();
-        if (styleSetup.hasAssistivePrefix()) {
-            panel.add(new Label(styleSetup.getAssistivePrefix()));
+        if (hasPrefix(styleSetup)) {
+            panel.add(new Label(styleSetup.prefix));
             AriaHelper.setVisibleForAssistiveDevicesOnly(panel.getElement(),
                     true);
         }
 
         panel.add(widget);
 
-        if (styleSetup.hasAssistivePostfix()) {
-            panel.add(new Label(styleSetup.getAssistivePostfix()));
+        if (hasPostfix(styleSetup)) {
+            panel.add(new Label(styleSetup.postfix));
             AriaHelper.setVisibleForAssistiveDevicesOnly(panel.getElement(),
                     true);
         }
@@ -182,8 +182,16 @@ public class VNotification extends VOverlay {
         show(position, style);
     }
 
+    private boolean hasPostfix(NotificationTypeConfiguration styleSetup) {
+        return styleSetup != null && styleSetup.postfix != null && !styleSetup.postfix.isEmpty();
+    }
+
+    private boolean hasPrefix(NotificationTypeConfiguration styleSetup) {
+        return styleSetup != null && styleSetup.prefix != null && !styleSetup.prefix.isEmpty();
+    }
+
     public void show(String html, Position position, String style) {
-        NotificationConfigurationBean styleSetup = getUiState(style);
+        NotificationTypeConfiguration styleSetup = getUiState(style);
         String assistiveDeviceOnlyStyle = AriaHelper.ASSISTIVE_DEVICE_ONLY_STYLE;
 
         setWaiAriaRole(styleSetup);
@@ -191,32 +199,31 @@ public class VNotification extends VOverlay {
         String type = "";
         String usage = "";
 
-        if (styleSetup != null && styleSetup.hasAssistivePrefix()) {
+        if (hasPrefix(styleSetup)) {
             type = "<span class='" + assistiveDeviceOnlyStyle + "'>"
-                    + styleSetup.getAssistivePrefix() + "</span>";
+                    + styleSetup.prefix + "</span>";
         }
 
-        if (styleSetup != null && styleSetup.hasAssistivePostfix()) {
+        if (hasPostfix(styleSetup)) {
             usage = "<span class='" + assistiveDeviceOnlyStyle + "'>"
-                    + styleSetup.getAssistivePostfix() + "</span>";
+                    + styleSetup.postfix + "</span>";
         }
 
         setWidget(new HTML(type + html + usage));
         show(position, style);
     }
 
-    private NotificationConfigurationBean getUiState(String style) {
-        NotificationConfigurationBean styleSetup = getApplicationConnection()
-                .getUIConnector().getState().notificationConfiguration.setup
+    private NotificationTypeConfiguration getUiState(String style) {
+        return getApplicationConnection()
+                .getUIConnector().getState().notificationConfigurations
                 .get(style);
-        return styleSetup;
     }
 
-    private void setWaiAriaRole(NotificationConfigurationBean styleSetup) {
+    private void setWaiAriaRole(NotificationTypeConfiguration styleSetup) {
         Roles.getAlertRole().set(getElement());
 
-        if (styleSetup != null && styleSetup.getAssistiveRole() != null) {
-            if (Role.STATUS == styleSetup.getAssistiveRole()) {
+        if (styleSetup != null && styleSetup.notificationRole != null) {
+            if (NotificationRole.STATUS == styleSetup.notificationRole) {
                 Roles.getStatusRole().set(getElement());
             }
         }
index 396fc76eb06aa74bd7757448b40e12ce8b7f154c..5b6595ea4330e070aceba9f7b3e10c85821b2261 100644 (file)
@@ -67,7 +67,7 @@ import com.vaadin.client.ui.window.WindowMoveHandler;
 import com.vaadin.shared.Connector;
 import com.vaadin.shared.EventId;
 import com.vaadin.shared.ui.window.WindowMode;
-import com.vaadin.shared.ui.window.WindowState.WindowRole;
+import com.vaadin.shared.ui.window.WindowRole;
 
 /**
  * "Sub window" component.
index 801c1e78f28469ef844c6b8966091d667755ba2c..48ea74c217d3564f9b979c64b287544e4d750d6d 100644 (file)
@@ -32,7 +32,7 @@ import com.vaadin.ui.UI;
  * current UI instance when a reload is detected.
  * <p>
  * Whenever a request is received that reloads a preserved UI, the UI's
- * {@link UI#reinit(com.vaadin.server.VaadinRequest) reinit} method is invoked
+ * {@link UI#refresh(com.vaadin.server.VaadinRequest) refresh} method is invoked
  * by the framework.
  * <p>
  * By using
index 70b8306bc3ea9258a43cec7b74b38a161e646885..64c658cd3e1e0669c64f9bb44312fab8780541a4 100644 (file)
@@ -636,7 +636,7 @@ public class Page implements Serializable {
     }
 
     public void init(VaadinRequest request) {
-        // NOTE: UI.reinit makes assumptions about the semantics of this method.
+        // NOTE: UI.refresh makes assumptions about the semantics of this method.
         // It should be kept in sync if this method is changed.
 
         // Extract special parameter sent by vaadinBootstrap.js
index a76f3967679e875f7f18ba61c56bfb09afc85a6f..46439650c08d5037896f99e3083c68050b618324 100644 (file)
@@ -131,7 +131,7 @@ public abstract class UIProvider implements Serializable {
      * the value of window.name in the browser.
      * <p>
      * Whenever a preserved UI is reused, its
-     * {@link UI#reinit(com.vaadin.server.VaadinRequest) reinit} method is
+     * {@link UI#refresh(com.vaadin.server.VaadinRequest) refresh} method is
      * invoked by the framework first.
      * 
      * 
index 5dc44208d1353ddd91c0bd79db0c66686f3571e1..76460e153ad4ff54b9301836877a8e746699f6f5 100644 (file)
@@ -266,7 +266,7 @@ public abstract class UIInitHandler extends SynchronizedRequestHandler {
      */
     private void reinitUI(UI ui, VaadinRequest request) {
         UI.setCurrent(ui);
-        ui.doReinit(request);
+        ui.doRefresh(request);
     }
 
     /**
index 31fa265b020bb9b6e9b3fd911e15a14c00309fdc..7064bfcf396e0ae887522e824c43bbd44a21d760 100644 (file)
@@ -21,7 +21,6 @@ import java.io.Serializable;
 import com.vaadin.server.Page;
 import com.vaadin.server.Resource;
 import com.vaadin.shared.Position;
-import com.vaadin.shared.ui.ui.NotificationConfigurationBean.Role;
 
 /**
  * A notification message, used to display temporary messages to the user - for
@@ -64,7 +63,27 @@ import com.vaadin.shared.ui.ui.NotificationConfigurationBean.Role;
  */
 public class Notification implements Serializable {
     public enum Type {
-        HUMANIZED_MESSAGE, WARNING_MESSAGE, ERROR_MESSAGE, TRAY_NOTIFICATION, ASSISTIVE_NOTIFICATION;
+        HUMANIZED_MESSAGE("humanized"), WARNING_MESSAGE("warning"), ERROR_MESSAGE(
+                "error"), TRAY_NOTIFICATION("tray"),
+        /**
+         * @since 7.2
+         */
+        ASSISTIVE_NOTIFICATION("assistive");
+
+        private String style;
+
+        Type(String style) {
+            this.style = style;
+        }
+
+        /**
+         * @since 7.2
+         *
+         * @return the style name for this notification type.
+         */
+        public String getStyle() {
+            return style;
+        }
     }
 
     @Deprecated
@@ -187,44 +206,28 @@ public class Notification implements Serializable {
     }
 
     private void setType(Type type) {
+        styleName = type.getStyle();
         switch (type) {
         case WARNING_MESSAGE:
             delayMsec = 1500;
-            styleName = "warning";
-            setNavigationConfiguration("Warning: ", "", Role.ALERT);
             break;
         case ERROR_MESSAGE:
             delayMsec = -1;
-            styleName = "error";
-            setNavigationConfiguration("Error: ", " - close with ESC",
-                    Role.ALERT);
             break;
         case TRAY_NOTIFICATION:
             delayMsec = 3000;
             position = Position.BOTTOM_RIGHT;
-            styleName = "tray";
-            setNavigationConfiguration("Info: ", "", Role.STATUS);
             break;
         case ASSISTIVE_NOTIFICATION:
             delayMsec = 3000;
             position = Position.ASSISTIVE;
-            styleName = "assistive";
-            setNavigationConfiguration("Note: ", "", Role.ALERT);
             break;
         case HUMANIZED_MESSAGE:
         default:
-            styleName = "humanized";
-            setNavigationConfiguration("Info: ", "", Role.ALERT);
             break;
         }
     }
 
-    private void setNavigationConfiguration(String prefix, String postfix,
-            Role ariaRole) {
-        UI.getCurrent().getNotificationConfiguration()
-                .setStyleConfiguration(styleName, prefix, postfix, ariaRole);
-    }
-
     /**
      * Gets the caption part of the notification message.
      * 
@@ -339,132 +342,6 @@ public class Notification implements Serializable {
         return styleName;
     }
 
-    /**
-     * Sets the accessibility prefix for a notification type.
-     * 
-     * This prefix is read to assistive device users before the content of the
-     * notification, but not visible on the page.
-     * 
-     * @param type
-     *            Type of the notification
-     * @param prefix
-     *            String that is placed before the notification content
-     */
-    public void setAssistivePrefixForType(Type type, String prefix) {
-        UI.getCurrent().getNotificationConfiguration()
-                .setAssistivePrefixForStyle(getStyle(type), prefix);
-    }
-
-    /**
-     * Gets the accessibility prefix for a notification type.
-     * 
-     * This prefix is read to assistive device users before the content of the
-     * notification, but not visible on the page.
-     * 
-     * @param type
-     *            Type of the notification
-     * @return The accessibility prefix for the provided notification type
-     */
-    public String getAssistivePrefixForType(Type type) {
-        return UI.getCurrent().getNotificationConfiguration()
-                .getAssistivePrefixForStyle(getStyle(type));
-    }
-
-    /**
-     * Sets the accessibility postfix for a notification type.
-     * 
-     * This postfix is read to assistive device users after the content of the
-     * notification, but not visible on the page.
-     * 
-     * @param type
-     *            Type of the notification
-     * @param postfix
-     *            String that is placed after the notification content
-     */
-    public void setAssistivePostfixForType(Type type, String postfix) {
-        UI.getCurrent().getNotificationConfiguration()
-                .setAssistivePostfixForStyle(getStyle(type), postfix);
-    }
-
-    /**
-     * Gets the accessibility postfix for a notification type.
-     * 
-     * This postfix is read to assistive device users after the content of the
-     * notification, but not visible on the page.
-     * 
-     * @param type
-     *            Type of the notification
-     * @return The accessibility postfix for the provided notification type
-     */
-    public String getAssistivePostfixForType(Type type) {
-        return UI.getCurrent().getNotificationConfiguration()
-                .getAssistivePostfixForStyle(getStyle(type));
-    }
-
-    /**
-     * Sets the WAI-ARIA role for a notification type.
-     * 
-     * This role defines how an assistive device handles a notification.
-     * Available roles are alert and status (@see <a
-     * href="http://www.w3.org/TR/2011/CR-wai-aria-20110118/roles">Roles
-     * Model</a>).
-     * 
-     * The default role is alert.
-     * 
-     * @param type
-     *            Type of the notification
-     * @param role
-     *            Role to set for the notification type
-     */
-    public void setAssistiveRoleForType(Type type, Role role) {
-        UI.getCurrent().getNotificationConfiguration()
-                .setAssistiveRoleForStyle(getStyle(type), role);
-    }
-
-    /**
-     * Gets the WAI-ARIA role for a notification type.
-     * 
-     * This role defines how an assistive device handles a notification.
-     * Available roles are alert and status (@see <a
-     * href="http://www.w3.org/TR/2011/CR-wai-aria-20110118/roles">Roles
-     * Model</a>)
-     * 
-     * The default role is alert.
-     * 
-     * @param type
-     *            Type of the notification
-     * @return Role to set for the notification type
-     */
-    public Role getAssistiveRoleForType(Type type) {
-        return UI.getCurrent().getNotificationConfiguration()
-                .getAssistiveRoleForStyle(getStyle(type));
-    }
-
-    private String getStyle(Type type) {
-        String style = "";
-
-        switch (type) {
-        case WARNING_MESSAGE:
-            style = "warning";
-            break;
-        case ERROR_MESSAGE:
-            style = "error";
-            break;
-        case TRAY_NOTIFICATION:
-            style = "tray";
-            break;
-        case ASSISTIVE_NOTIFICATION:
-            style = "assistive";
-            break;
-        case HUMANIZED_MESSAGE:
-        default:
-            style = "humanized";
-            break;
-        }
-
-        return style;
-    }
-
     /**
      * Sets whether html is allowed in the caption and description. If set to
      * true, the texts are passed to the browser as html and the developer is
index 52d3e76d637aae2f11ee7fd94c2e382c5cf6931c..e6d19f84f7300a840237dd04d9316bc3df04412b 100644 (file)
@@ -21,112 +21,99 @@ package com.vaadin.ui;
 
 import java.io.Serializable;
 
-import com.vaadin.shared.ui.ui.NotificationConfigurationBean;
-import com.vaadin.shared.ui.ui.NotificationConfigurationBean.Role;
-import com.vaadin.shared.ui.ui.UIState.NotificationConfigurationState;
+import com.vaadin.shared.ui.ui.NotificationRole;
+import com.vaadin.shared.ui.ui.UIState.NotificationTypeConfiguration;
+import com.vaadin.ui.Notification.Type;
 
 /**
  * Provides methods for configuring the notification.
- * 
+ *
  * @author Vaadin Ltd
- * @since 7.1
+ * @since 7.2
  */
 public interface NotificationConfiguration extends Serializable {
-    public void setStyleConfiguration(String style, String prefix,
-            String postfix, Role ariaRole);
-
     /**
-     * Returns the complete configuration object for the given notification
-     * style.
-     * 
-     * @param style
-     *            String of the notification style to return
-     * @return The notification configuration object
-     */
-    public NotificationConfigurationBean getStyleConfiguration(String style);
-
-    /**
-     * Sets the accessibility prefix for the given notification style.
-     * 
-     * This prefix is read to assistive device users in front of the content of
-     * the notification, but not visible on the page.
-     * 
-     * @param style
-     *            String of the notification style
+     * Sets the accessibility prefix for a notification type.
+     * <p>
+     * This prefix is read to assistive device users before the content of the
+     * notification, but not visible on the page.
+     *
+     * @param type
+     *            type of the notification
      * @param prefix
-     *            String that is placed before the notification content
+     *            string that is placed before the notification content
      */
-    public void setAssistivePrefixForStyle(String style, String prefix);
+    public void setAssistivePrefix(Type type, String prefix);
 
     /**
-     * Returns the accessibility prefix for the given notification style.
-     * 
-     * This prefix is read to assistive device users in front of the content of
-     * the notification, but not visible on the page.
-     * 
-     * @param style
-     *            String of the notification style
-     * @return The prefix of the provided notification style
+     * Gets the accessibility prefix for a notification type.
+     * <p>
+     * This prefix is read to assistive device users before the content of the
+     * notification, but not visible on the page.
+     *
+     * @param type
+     *            type of the notification
+     * @return The accessibility prefix for the provided notification type
      */
-    public String getAssistivePrefixForStyle(String style);
+    public String getAssistivePrefix(Type type);
 
     /**
-     * Sets the accessibility postfix for the given notification style.
-     * 
+     * Sets the accessibility postfix for a notification type.
+     * <p>
      * This postfix is read to assistive device users after the content of the
      * notification, but not visible on the page.
-     * 
-     * @param style
-     *            String of the notification style
+     *
+     * @param type
+     *            type of the notification
      * @param postfix
-     *            String that is placed after the notification content
+     *            string that is placed after the notification content
      */
-    public void setAssistivePostfixForStyle(String style, String postfix);
+    public void setAssistivePostfix(Type type, String postfix);
 
     /**
-     * Returns the accessibility postfix for the given notification style.
-     * 
+     * Gets the accessibility postfix for a notification type.
+     * <p>
      * This postfix is read to assistive device users after the content of the
      * notification, but not visible on the page.
-     * 
-     * @param style
-     *            String of the notification style
-     * @return The postfix of the provided notification style
+     *
+     * @param type
+     *            type of the notification
+     * @return The accessibility postfix for the provided notification type
      */
-    public String getAssistivePostfixForStyle(String style);
+    public String getAssistivePostfix(Type type);
 
     /**
-     * Sets the WAI-ARIA role for a notification style.
-     * 
+     * Sets the WAI-ARIA role for a notification type.
+     * <p>
      * This role defines how an assistive device handles a notification.
-     * Available roles are alert, alertdialog and status (@see <a
+     * Available roles are alert and status (@see <a
      * href="http://www.w3.org/TR/2011/CR-wai-aria-20110118/roles">Roles
-     * Model</a>)
-     * 
+     * Model</a>).
+     *
      * The default role is alert.
-     * 
-     * @param style
-     *            String of the notification style
+     *
+     * @param type
+     *            type of the notification
      * @param role
-     *            Role to set for the notification type
+     *            role to set for the notification type
      */
-    public void setAssistiveRoleForStyle(String style, Role role);
+    public void setAssistiveRole(Type type, NotificationRole role);
 
     /**
-     * Returns the WAI-ARIA role for a notification style.
-     * 
+     * Gets the WAI-ARIA role for a notification type.
+     * <p>
      * This role defines how an assistive device handles a notification.
-     * Available roles are alert, alertdialog and status (@see <a
+     * Available roles are alert and status (@see <a
      * href="http://www.w3.org/TR/2011/CR-wai-aria-20110118/roles">Roles
-     * Model</a> )
-     * 
+     * Model</a>)
+     * <p>
      * The default role is alert.
-     * 
-     * @param style
-     *            String of the notification style
-     * @return The current Role for the notification type
+     *
+     * @param type
+     *            type of the notification
+     * @return role to set for the notification type
      */
-    public Role getAssistiveRoleForStyle(String style);
+    public NotificationRole getAssistiveRole(Type type);
 }
 
 class NotificationConfigurationImpl implements NotificationConfiguration {
@@ -137,133 +124,62 @@ class NotificationConfigurationImpl implements NotificationConfiguration {
         this.ui = ui;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * com.vaadin.ui.NotificationConfiguration#setStyleConfiguration(java.lang
-     * .String, java.lang.String, java.lang.String,
-     * com.vaadin.ui.NotificationConfiguration.Role)
-     */
-    @Override
-    public void setStyleConfiguration(String style, String prefix,
-            String postfix, Role ariaRole) {
-        getState().setup.put(style, new NotificationConfigurationBean(prefix,
-                postfix, ariaRole));
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * com.vaadin.ui.NotificationConfiguration#getStyleConfiguration(java.lang
-     * .String)
-     */
     @Override
-    public NotificationConfigurationBean getStyleConfiguration(String style) {
-        return getState(false).setup.get(style);
+    public void setAssistivePrefix(Type type, String prefix) {
+        getConfigurationBean(type).prefix = prefix;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * com.vaadin.ui.NotificationConfiguration#setStylePrefix(java.lang.String,
-     * java.lang.String)
-     */
     @Override
-    public void setAssistivePrefixForStyle(String style, String prefix) {
-        getConfigurationBean(style).setAssistivePrefix(prefix);
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * com.vaadin.ui.NotificationConfiguration#getStylePrefix(java.lang.String)
-     */
-    @Override
-    public String getAssistivePrefixForStyle(String style) {
-        NotificationConfigurationBean styleSetup = getState().setup.get(style);
+    public String getAssistivePrefix(Type type) {
+        NotificationTypeConfiguration styleSetup = getTypeConf(type);
         if (styleSetup != null) {
-            return styleSetup.getAssistivePrefix();
+            return styleSetup.prefix;
         }
 
         return null;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * com.vaadin.ui.NotificationConfiguration#setStylePostfix(com.vaadin.ui
-     * .Notification.Type, java.lang.String)
-     */
     @Override
-    public void setAssistivePostfixForStyle(String style, String postfix) {
-        getConfigurationBean(style).setAssistivePostfix(postfix);
+    public void setAssistivePostfix(Type type, String postfix) {
+        getConfigurationBean(type).postfix = postfix;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * com.vaadin.ui.NotificationConfiguration#getStylePostfix(com.vaadin.ui
-     * .Notification.Type)
-     */
     @Override
-    public String getAssistivePostfixForStyle(String style) {
-        NotificationConfigurationBean styleSetup = getState().setup.get(style);
+    public String getAssistivePostfix(Type type) {
+        NotificationTypeConfiguration styleSetup = getTypeConf(type);
         if (styleSetup != null) {
-            return styleSetup.getAssistivePostfix();
+            return styleSetup.postfix;
         }
 
         return null;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.NotificationConfiguration#setStyleRole(com.vaadin.ui.
-     * Notification.Type, com.vaadin.ui.NotificationConfiguration.Role)
-     */
     @Override
-    public void setAssistiveRoleForStyle(String style, Role role) {
-        getConfigurationBean(style).setAssistiveRole(role);
+    public void setAssistiveRole(Type type, NotificationRole role) {
+        getConfigurationBean(type).notificationRole = role;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.NotificationConfiguration#getStyleRole(com.vaadin.ui.
-     * Notification.Type)
-     */
     @Override
-    public Role getAssistiveRoleForStyle(String style) {
-        NotificationConfigurationBean styleSetup = getState().setup.get(style);
+    public NotificationRole getAssistiveRole(Type type) {
+        NotificationTypeConfiguration styleSetup = getTypeConf(type);
         if (styleSetup != null) {
-            return styleSetup.getAssistiveRole();
+            return styleSetup.notificationRole;
         }
 
         return null;
     }
 
-    private NotificationConfigurationBean getConfigurationBean(String style) {
-        NotificationConfigurationBean styleSetup = getState().setup.get(style);
+    private NotificationTypeConfiguration getConfigurationBean(Type type) {
+        NotificationTypeConfiguration styleSetup = getTypeConf(type);
         if (styleSetup == null) {
-            styleSetup = new NotificationConfigurationBean();
-            getState().setup.put(style, styleSetup);
+            styleSetup = new NotificationTypeConfiguration();
+            ui.getState().notificationConfigurations.put(type.getStyle(), styleSetup);
         }
 
         return styleSetup;
     }
 
-    private NotificationConfigurationState getState() {
-        return ui.getState().notificationConfiguration;
+    private NotificationTypeConfiguration getTypeConf(Type type) {
+        return ui.getState().notificationConfigurations.get(type.getStyle());
     }
-
-    private NotificationConfigurationState getState(boolean markAsDirty) {
-        return ui.getState(markAsDirty).notificationConfiguration;
-    }
-
 }
index 8e2c40fc0f1fb2de23e5bf78328c609ecae8e949..17ea352d49cb4b6ae9fa33c224e9e57e72139a9c 100644 (file)
@@ -292,34 +292,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
      * @return the created {@link Tab}
      */
     public Tab addTab(Component c, String caption, Resource icon) {
-        return addTab(c, caption, icon, "", components.size());
-    }
-
-    /**
-     * Adds a new tab into TabSheet.
-     * 
-     * The first tab added to a tab sheet is automatically selected and a tab
-     * selection event is fired.
-     * 
-     * If the component is already present in the tab sheet, changes its caption
-     * and icon and icon alternate text and returns the corresponding (old) tab,
-     * preserving other tab metadata.
-     * 
-     * @param c
-     *            the component to be added onto tab - should not be null.
-     * @param caption
-     *            the caption to be set for the component and used rendered in
-     *            tab bar
-     * @param icon
-     *            the icon to be set for the component and used rendered in tab
-     *            bar
-     * @param iconAltText
-     *            the alternate text for the icon
-     * @return the created {@link Tab}
-     */
-    public Tab addTab(Component c, String caption, Resource icon,
-            String iconAltText) {
-        return addTab(c, caption, icon, iconAltText, components.size());
+        return addTab(c, caption, icon, components.size());
     }
 
     /**
@@ -344,43 +317,13 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
      *            the position at where the the tab should be added.
      * @return the created {@link Tab}
      */
-    public Tab addTab(Component c, String caption, Resource icon, int position) {
-        return addTab(c, caption, icon, "", position);
-    }
-
-    /**
-     * Adds a new tab into TabSheet.
-     * 
-     * The first tab added to a tab sheet is automatically selected and a tab
-     * selection event is fired.
-     * 
-     * If the component is already present in the tab sheet, changes its caption
-     * and icon and icon alternate text and returns the corresponding (old) tab,
-     * preserving other tab metadata like the position.
-     * 
-     * @param tabComponent
-     *            the component to be added onto tab - should not be null.
-     * @param caption
-     *            the caption to be set for the component and used rendered in
-     *            tab bar
-     * @param icon
-     *            the icon to be set for the component and used rendered in tab
-     *            bar
-     * @param iconAltText
-     *            the alternate text for the icon
-     * @param position
-     *            the position at where the the tab should be added.
-     * @return the created {@link Tab}
-     */
-    public Tab addTab(Component tabComponent, String caption, Resource icon,
-            String iconAltText, int position) {
-
+    public Tab addTab(Component tabComponent, String caption, Resource icon, int position) {
         if (tabComponent == null) {
             return null;
         } else if (tabs.containsKey(tabComponent)) {
             Tab tab = tabs.get(tabComponent);
             tab.setCaption(caption);
-            tab.setIcon(icon, iconAltText);
+            tab.setIcon(icon);
             return tab;
         } else {
             components.add(position, tabComponent);
@@ -461,11 +404,11 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
                 Tab tab = ((TabSheet) source).getTab(c);
                 caption = tab.getCaption();
                 icon = tab.getIcon();
-                iconAltText = tab.getIconAltText();
+                iconAltText = tab.getIconAlternateText();
             }
             source.removeComponent(c);
-            addTab(c, caption, icon, iconAltText);
-
+            Tab tab = addTab(c, caption, icon);
+            tab.setIconAlternateText(iconAltText);
         }
     }
 
@@ -968,16 +911,20 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
 
         /**
          * Gets the icon alt text for the tab.
+         *
+         * @since 7.2
          */
-        public String getIconAltText();
+        public String getIconAlternateText();
 
         /**
          * Sets the icon alt text for the tab.
-         * 
+         *
+         * @since 7.2
+         *
          * @param iconAltText
          *            the icon to set
          */
-        public void setIconAltText(String iconAltText);
+        public void setIconAlternateText(String iconAltText);
 
         /**
          * Gets the description for the tab. The description can be used to
@@ -1135,12 +1082,12 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
         }
 
         @Override
-        public String getIconAltText() {
+        public String getIconAlternateText() {
             return tabState.iconAltText;
         }
 
         @Override
-        public void setIconAltText(String iconAltText) {
+        public void setIconAlternateText(String iconAltText) {
             tabState.iconAltText = iconAltText;
             markAsDirty();
         }
@@ -1428,7 +1375,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
      */
     private static void copyTabMetadata(Tab from, Tab to) {
         to.setCaption(from.getCaption());
-        to.setIcon(from.getIcon(), from.getIconAltText());
+        to.setIcon(from.getIcon(), from.getIconAlternateText());
         to.setDescription(from.getDescription());
         to.setVisible(from.isVisible());
         to.setEnabled(from.isEnabled());
index 2b2e7736011fe6a28036339928219a47eb2a6524..5fbd654dcfed705c0680df76194bf133e1c7e388 100644 (file)
@@ -668,10 +668,10 @@ public abstract class UI extends AbstractSingleComponentContainer implements
      * @param request
      *            the request that caused this UI to be reloaded
      */
-    public void doReinit(VaadinRequest request) {
+    public void doRefresh(VaadinRequest request) {
         // This is a horrible hack. We want to have the most recent location and
-        // browser window size available in reinit(), but we want to call
-        // listeners, if any, only after reinit(). So we momentarily assign the
+        // browser window size available in refresh(), but we want to call
+        // listeners, if any, only after refresh(). So we momentarily assign the
         // old values back before setting the new values again to ensure the
         // events are properly fired.
 
@@ -683,7 +683,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements
 
         page.init(request);
 
-        reinit(request);
+        refresh(request);
 
         URI newLocation = page.getLocation();
         int newWidth = page.getBrowserWindowWidth();
@@ -709,7 +709,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements
      * @param request
      *            the request that caused this UI to be reloaded
      */
-    protected void reinit(VaadinRequest request) {
+    protected void refresh(VaadinRequest request) {
     }
 
     /**
index d3afdaacf1a258ddcf3f20c9ff11c8208e98c14f..022adc637313ec32b072d28d6e089ae4a2ad9242 100644 (file)
@@ -41,7 +41,7 @@ import com.vaadin.shared.MouseEventDetails;
 import com.vaadin.shared.ui.window.WindowMode;
 import com.vaadin.shared.ui.window.WindowServerRpc;
 import com.vaadin.shared.ui.window.WindowState;
-import com.vaadin.shared.ui.window.WindowState.WindowRole;
+import com.vaadin.shared.ui.window.WindowRole;
 import com.vaadin.util.ReflectTools;
 
 /**
diff --git a/server/tests/src/com/vaadin/ui/UIInitRefreshTest.java b/server/tests/src/com/vaadin/ui/UIInitRefreshTest.java
new file mode 100644 (file)
index 0000000..a807e4b
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui;
+
+import org.easymock.EasyMock;
+import org.easymock.IMocksControl;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.vaadin.server.Page.BrowserWindowResizeEvent;
+import com.vaadin.server.Page.BrowserWindowResizeListener;
+import com.vaadin.server.Page.UriFragmentChangedEvent;
+import com.vaadin.server.Page.UriFragmentChangedListener;
+import com.vaadin.server.VaadinRequest;
+
+public class UIInitRefreshTest {
+
+    private boolean initCalled;
+    private boolean refreshCalled;
+    private boolean fragmentChangeCalled;
+    private boolean browserWindowResizeCalled;
+
+    private class TestUI extends UI implements UriFragmentChangedListener,
+            BrowserWindowResizeListener {
+        @Override
+        protected void init(VaadinRequest request) {
+            getPage().addBrowserWindowResizeListener(this);
+            getPage().addUriFragmentChangedListener(this);
+
+            initCalled = true;
+
+            Assert.assertEquals("foo", getPage().getUriFragment());
+            Assert.assertEquals(100, getPage().getBrowserWindowWidth());
+            Assert.assertEquals(100, getPage().getBrowserWindowHeight());
+
+            Assert.assertFalse(fragmentChangeCalled);
+            Assert.assertFalse(browserWindowResizeCalled);
+        }
+
+        @Override
+        protected void refresh(VaadinRequest request) {
+            refreshCalled = true;
+
+            Assert.assertEquals("bar", getPage().getUriFragment());
+            Assert.assertEquals(200, getPage().getBrowserWindowWidth());
+            Assert.assertEquals(200, getPage().getBrowserWindowHeight());
+
+            Assert.assertFalse(fragmentChangeCalled);
+            Assert.assertFalse(browserWindowResizeCalled);
+        }
+
+        @Override
+        public void browserWindowResized(BrowserWindowResizeEvent event) {
+            Assert.assertEquals(200, event.getWidth());
+            Assert.assertEquals(200, event.getHeight());
+            browserWindowResizeCalled = true;
+        }
+
+        @Override
+        public void uriFragmentChanged(UriFragmentChangedEvent event) {
+            Assert.assertEquals("bar", event.getUriFragment());
+            fragmentChangeCalled = true;
+        }
+    };
+
+    @Before
+    public void setUp() {
+        initCalled = refreshCalled = fragmentChangeCalled = browserWindowResizeCalled = false;
+    }
+
+    @Test
+    public void testListenersCalled() {
+        IMocksControl control = EasyMock.createNiceControl();
+
+        VaadinRequest initRequest = control.createMock(VaadinRequest.class);
+        EasyMock.expect(initRequest.getParameter("v-loc")).andReturn(
+                "http://example.com/#foo");
+        EasyMock.expect(initRequest.getParameter("v-cw")).andReturn("100");
+        EasyMock.expect(initRequest.getParameter("v-ch")).andReturn("100");
+
+        VaadinRequest reinitRequest = control.createMock(VaadinRequest.class);
+        EasyMock.expect(reinitRequest.getParameter("v-loc")).andReturn(
+                "http://example.com/#bar");
+        EasyMock.expect(reinitRequest.getParameter("v-cw")).andReturn("200");
+        EasyMock.expect(reinitRequest.getParameter("v-ch")).andReturn("200");
+
+        control.replay();
+
+        UI ui = new TestUI();
+        ui.doInit(initRequest, 0, "");
+
+        Assert.assertTrue(initCalled);
+        Assert.assertFalse(fragmentChangeCalled);
+        Assert.assertFalse(browserWindowResizeCalled);
+
+        ui.doRefresh(reinitRequest);
+
+        Assert.assertTrue(refreshCalled);
+        Assert.assertTrue(fragmentChangeCalled);
+        Assert.assertTrue(browserWindowResizeCalled);
+    }
+}
diff --git a/server/tests/src/com/vaadin/ui/UIInitReinitTest.java b/server/tests/src/com/vaadin/ui/UIInitReinitTest.java
deleted file mode 100644 (file)
index f8ec0e6..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright 2000-2013 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.ui;
-
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.vaadin.server.Page.BrowserWindowResizeEvent;
-import com.vaadin.server.Page.BrowserWindowResizeListener;
-import com.vaadin.server.Page.UriFragmentChangedEvent;
-import com.vaadin.server.Page.UriFragmentChangedListener;
-import com.vaadin.server.VaadinRequest;
-
-public class UIInitReinitTest {
-
-    private boolean initCalled;
-    private boolean reinitCalled;
-    private boolean fragmentChangeCalled;
-    private boolean browserWindowResizeCalled;
-
-    private class TestUI extends UI implements UriFragmentChangedListener,
-            BrowserWindowResizeListener {
-        @Override
-        protected void init(VaadinRequest request) {
-            getPage().addBrowserWindowResizeListener(this);
-            getPage().addUriFragmentChangedListener(this);
-
-            initCalled = true;
-
-            Assert.assertEquals("foo", getPage().getUriFragment());
-            Assert.assertEquals(100, getPage().getBrowserWindowWidth());
-            Assert.assertEquals(100, getPage().getBrowserWindowHeight());
-
-            Assert.assertFalse(fragmentChangeCalled);
-            Assert.assertFalse(browserWindowResizeCalled);
-        }
-
-        @Override
-        protected void reinit(VaadinRequest request) {
-            reinitCalled = true;
-
-            Assert.assertEquals("bar", getPage().getUriFragment());
-            Assert.assertEquals(200, getPage().getBrowserWindowWidth());
-            Assert.assertEquals(200, getPage().getBrowserWindowHeight());
-
-            Assert.assertFalse(fragmentChangeCalled);
-            Assert.assertFalse(browserWindowResizeCalled);
-        }
-
-        @Override
-        public void browserWindowResized(BrowserWindowResizeEvent event) {
-            Assert.assertEquals(200, event.getWidth());
-            Assert.assertEquals(200, event.getHeight());
-            browserWindowResizeCalled = true;
-        }
-
-        @Override
-        public void uriFragmentChanged(UriFragmentChangedEvent event) {
-            Assert.assertEquals("bar", event.getUriFragment());
-            fragmentChangeCalled = true;
-        }
-    };
-
-    @Before
-    public void setUp() {
-        initCalled = reinitCalled = fragmentChangeCalled = browserWindowResizeCalled = false;
-    }
-
-    @Test
-    public void testListenersCalled() {
-        IMocksControl control = EasyMock.createNiceControl();
-
-        VaadinRequest initRequest = control.createMock(VaadinRequest.class);
-        EasyMock.expect(initRequest.getParameter("v-loc")).andReturn(
-                "http://example.com/#foo");
-        EasyMock.expect(initRequest.getParameter("v-cw")).andReturn("100");
-        EasyMock.expect(initRequest.getParameter("v-ch")).andReturn("100");
-
-        VaadinRequest reinitRequest = control.createMock(VaadinRequest.class);
-        EasyMock.expect(reinitRequest.getParameter("v-loc")).andReturn(
-                "http://example.com/#bar");
-        EasyMock.expect(reinitRequest.getParameter("v-cw")).andReturn("200");
-        EasyMock.expect(reinitRequest.getParameter("v-ch")).andReturn("200");
-
-        control.replay();
-
-        UI ui = new TestUI();
-        ui.doInit(initRequest, 0, "");
-
-        Assert.assertTrue(initCalled);
-        Assert.assertFalse(fragmentChangeCalled);
-        Assert.assertFalse(browserWindowResizeCalled);
-
-        ui.doReinit(reinitRequest);
-
-        Assert.assertTrue(reinitCalled);
-        Assert.assertTrue(fragmentChangeCalled);
-        Assert.assertTrue(browserWindowResizeCalled);
-    }
-}
diff --git a/shared/src/com/vaadin/shared/ui/ui/NotificationConfigurationBean.java b/shared/src/com/vaadin/shared/ui/ui/NotificationConfigurationBean.java
deleted file mode 100644 (file)
index 6c8c743..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright 2000-2013 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-/**
- * 
- */
-package com.vaadin.shared.ui.ui;
-
-import java.io.Serializable;
-
-/**
- * Holds configuration information for a notification type.
- * 
- * @author Vaadin Ltd
- */
-public class NotificationConfigurationBean implements Serializable {
-    /**
-     * Available WAI-ARIA roles for a notification.
-     */
-    public enum Role {
-        ALERT, STATUS
-    }
-
-    private String prefix;
-    private String postfix;
-    private Role role = Role.ALERT;
-
-    public NotificationConfigurationBean() {
-    }
-
-    public NotificationConfigurationBean(String prefix, String postfix,
-            Role role) {
-        this.prefix = prefix;
-        this.postfix = postfix;
-        this.role = role;
-    }
-
-    /**
-     * Returns the accessibility prefix, which is placed before the notification
-     * content.
-     * 
-     * @return the prefix
-     */
-    public String getAssistivePrefix() {
-        return prefix;
-    }
-
-    /**
-     * Sets the accessibility prefix, which is placed before the notification
-     * content.
-     * 
-     * @param pefix
-     *            the prefix to set
-     */
-    public void setAssistivePrefix(String prefix) {
-        this.prefix = prefix;
-    }
-
-    /**
-     * Checks if an accessibility prefix is set.
-     * 
-     * @return true when assistivePrefix is not null and has a length > 0, false
-     *         otherwise
-     */
-    public boolean hasAssistivePrefix() {
-        return prefix != null && !prefix.isEmpty();
-    }
-
-    /**
-     * Returns the accessibility postfix, which is placed after the notification
-     * content.
-     * 
-     * @return the postfix
-     */
-    public String getAssistivePostfix() {
-        return postfix;
-    }
-
-    /**
-     * Sets the accessibility postfix, which is placed after the notification
-     * content.
-     * 
-     * @param postfix
-     *            the postfix to set
-     */
-    public void setAssistivePostfix(String postfix) {
-        this.postfix = postfix;
-    }
-
-    /**
-     * Checks if an accessibility postfix is set.
-     * 
-     * @return true when postfix is not null and has a length > 0, false
-     *         otherwise
-     */
-    public boolean hasAssistivePostfix() {
-        return postfix != null && !postfix.isEmpty();
-    }
-
-    /**
-     * Returns the WAI-ARIA role that defines how an assistive device will
-     * inform the user about a notification.
-     * 
-     * @return the role
-     */
-    public Role getAssistiveRole() {
-        return role;
-    }
-
-    /**
-     * Sets the WAI-ARIA role that defines how an assistive device will inform
-     * the user about a notification.
-     * 
-     * Available roles are alert, alertdialog and status (@see <a
-     * href="http://www.w3.org/TR/2011/CR-wai-aria-20110118/roles">Roles
-     * Model</a>).
-     * 
-     * @param role
-     *            the role to set
-     */
-    public void setAssistiveRole(Role role) {
-        this.role = role;
-    }
-}
diff --git a/shared/src/com/vaadin/shared/ui/ui/NotificationRole.java b/shared/src/com/vaadin/shared/ui/ui/NotificationRole.java
new file mode 100644 (file)
index 0000000..218e5e5
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.shared.ui.ui;
+
+/**
+ * Available WAI-ARIA roles for a notification.
+ *
+ * @since 7.2
+ */
+public enum NotificationRole {
+    ALERT, STATUS
+}
index d2e6f037e9829666ecdca03ef521c924ab9ef327..08fe3c7d64e71c9bf8cdd854ef07d78a8f6845e1 100644 (file)
@@ -23,17 +23,50 @@ import java.util.Map;
 
 import com.vaadin.shared.communication.PushMode;
 import com.vaadin.shared.ui.TabIndexState;
-import com.vaadin.shared.ui.ui.NotificationConfigurationBean.Role;
 
 public class UIState extends TabIndexState {
     public TooltipConfigurationState tooltipConfiguration = new TooltipConfigurationState();
     public LoadingIndicatorConfigurationState loadingIndicatorConfiguration = new LoadingIndicatorConfigurationState();
-    public NotificationConfigurationState notificationConfiguration = new NotificationConfigurationState();
     public int pollInterval = -1;
 
     // Informing users of assistive devices, that the content of this container
     // is announced automatically and does not need to be navigated into
     public String overlayContainerLabel = "This content is announced automatically and does not need to be navigated into.";
+    public Map<String, NotificationTypeConfiguration> notificationConfigurations = new HashMap<String, NotificationTypeConfiguration>();
+    {
+        notificationConfigurations.put("error",
+                new NotificationTypeConfiguration("Error: ",
+                        " - close with ESC-key", NotificationRole.ALERT));
+        notificationConfigurations.put("warning",
+                new NotificationTypeConfiguration("Warning: ", null,
+                        NotificationRole.ALERT));
+        notificationConfigurations.put("humanized",
+                new NotificationTypeConfiguration("Info: ", null,
+                        NotificationRole.ALERT));
+        notificationConfigurations.put("tray",
+                new NotificationTypeConfiguration("Status: ", null,
+                        NotificationRole.STATUS));
+        notificationConfigurations.put("assistive",
+                new NotificationTypeConfiguration("Note: ", null,
+                        NotificationRole.STATUS));
+    }
+    /**
+     * State related to the Page class.
+     */
+    public PageState pageState = new PageState();
+    /**
+     * State related to the LocaleService class.
+     */
+    public LocaleServiceState localeServiceState = new LocaleServiceState();
+    /**
+     * Configuration for the push channel
+     */
+    public PushConfigurationState pushConfiguration = new PushConfigurationState();
+    {
+        primaryStyleName = "v-ui";
+        // Default is 1 for legacy reasons
+        tabIndex = 1;
+    }
 
     public static class LoadingIndicatorConfigurationState implements
             Serializable {
@@ -50,19 +83,19 @@ public class UIState extends TabIndexState {
         public int maxWidth = 500;
     }
 
-    public static class NotificationConfigurationState implements Serializable {
-        public Map<String, NotificationConfigurationBean> setup = new HashMap<String, NotificationConfigurationBean>();
-        {
-            setup.put("error", new NotificationConfigurationBean("Error: ",
-                    " - close with ESC-key", Role.ALERT));
-            setup.put("warning", new NotificationConfigurationBean("Warning: ",
-                    null, Role.ALERT));
-            setup.put("humanized", new NotificationConfigurationBean("Info: ",
-                    null, Role.ALERT));
-            setup.put("tray", new NotificationConfigurationBean("Status: ",
-                    null, Role.STATUS));
-            setup.put("assistive", new NotificationConfigurationBean("Note: ",
-                    null, Role.STATUS));
+    public static class NotificationTypeConfiguration implements Serializable {
+        public String prefix;
+        public String postfix;
+        public NotificationRole notificationRole = NotificationRole.ALERT;
+
+        public NotificationTypeConfiguration() {
+        }
+
+        public NotificationTypeConfiguration(String prefix, String postfix,
+                NotificationRole role) {
+            this.prefix = prefix;
+            this.postfix = postfix;
+            this.notificationRole = role;
         }
     }
 
@@ -80,26 +113,6 @@ public class UIState extends TabIndexState {
         }
     }
 
-    /**
-     * State related to the Page class.
-     */
-    public PageState pageState = new PageState();
-    /**
-     * State related to the LocaleService class.
-     */
-    public LocaleServiceState localeServiceState = new LocaleServiceState();
-
-    /**
-     * Configuration for the push channel
-     */
-    public PushConfigurationState pushConfiguration = new PushConfigurationState();
-
-    {
-        primaryStyleName = "v-ui";
-        // Default is 1 for legacy reasons
-        tabIndex = 1;
-    }
-
     public static class LocaleServiceState implements Serializable {
         public List<LocaleData> localeData = new ArrayList<LocaleData>();
     }
diff --git a/shared/src/com/vaadin/shared/ui/window/WindowRole.java b/shared/src/com/vaadin/shared/ui/window/WindowRole.java
new file mode 100644 (file)
index 0000000..fc6b099
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.shared.ui.window;
+
+/**
+ * Available WAI-ARIA roles for a window.
+ *
+ * @since 7.2
+ */
+public enum WindowRole {
+    ALERTDIALOG, DIALOG
+}
index e27bf87e889c038bc241379afd578d72e32ccb86..ebb1995287945efe43f8ea3fafac0dc29b7eac1e 100644 (file)
@@ -23,13 +23,6 @@ public class WindowState extends PanelState {
         primaryStyleName = "v-window";
     }
 
-    /**
-     * Available WAI-ARIA roles for a window.
-     */
-    public enum WindowRole {
-        ALERTDIALOG, DIALOG
-    }
-
     public boolean modal = false;
     public boolean resizable = true;
     public boolean resizeLazy = false;
index 27af49a39798c984292530b2ce3e4909c864c44c..ecf704835fda64e728938126c96133f0446132e5 100644 (file)
@@ -2,7 +2,7 @@ package com.vaadin.tests.components.notification;
 
 import com.vaadin.data.Item;
 import com.vaadin.server.Page;
-import com.vaadin.shared.ui.ui.NotificationConfigurationBean.Role;
+import com.vaadin.shared.ui.ui.NotificationRole;
 import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
@@ -11,8 +11,10 @@ import com.vaadin.ui.ComboBox;
 import com.vaadin.ui.NativeSelect;
 import com.vaadin.ui.Notification;
 import com.vaadin.ui.Notification.Type;
+import com.vaadin.ui.NotificationConfiguration;
 import com.vaadin.ui.TextArea;
 import com.vaadin.ui.TextField;
+import com.vaadin.ui.UI;
 
 public class NotificationsWaiAria extends TestBase {
 
@@ -36,9 +38,9 @@ public class NotificationsWaiAria extends TestBase {
                 " - closes automatically after 10 seconds");
         addComponent(postfix);
 
-        role = new NativeSelect("Role");
-        role.addItem(Role.ALERT);
-        role.addItem(Role.STATUS);
+        role = new NativeSelect("NotificationRole");
+        role.addItem(NotificationRole.ALERT);
+        role.addItem(NotificationRole.STATUS);
         role.setValue(role.getItemIds().iterator().next());
         addComponent(role);
 
@@ -96,9 +98,12 @@ public class NotificationsWaiAria extends TestBase {
 
             Notification n = new Notification(tf.getValue(), typeValue);
             n.setHtmlContentAllowed(true);
-            n.setAssistivePrefixForType(typeValue, prefix.getValue());
-            n.setAssistivePostfixForType(typeValue, postfix.getValue());
-            n.setAssistiveRoleForType(typeValue, (Role) role.getValue());
+            NotificationConfiguration notificationConf = UI.getCurrent()
+                    .getNotificationConfiguration();
+            notificationConf.setAssistivePrefix(typeValue, prefix.getValue());
+            notificationConf.setAssistivePostfix(typeValue, postfix.getValue());
+            notificationConf
+                    .setAssistiveRole(typeValue, (NotificationRole) role.getValue());
 
             n.show(Page.getCurrent());
         }
index ccdc4ecb3860f6cc2e6539682769a896b80a925f..c5e01969a1825374862e26dcf233cd3f2aea44c8 100644 (file)
@@ -46,7 +46,7 @@ public class TabSheetIcons extends TestBase {
 
         for (Component c : tab) {
             tabsheet.addTab(c);
-            tabsheet.getTab(c).setIconAltText(
+            tabsheet.getTab(c).setIconAlternateText(
                     "iconalt" + tabsheet.getComponentCount());
         }
 
diff --git a/uitest/src/com/vaadin/tests/components/ui/UIRefresh.java b/uitest/src/com/vaadin/tests/components/ui/UIRefresh.java
new file mode 100644 (file)
index 0000000..b61e32c
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.tests.components.ui;
+
+import com.vaadin.annotations.PreserveOnRefresh;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Label;
+
+@PreserveOnRefresh
+public class UIRefresh extends AbstractTestUI {
+
+    public static final String REINIT_ID = "reinit";
+
+    @Override
+    protected void setup(VaadinRequest request) {
+    }
+
+    @Override
+    protected void refresh(VaadinRequest request) {
+        Label l = new Label("Reinit!");
+        l.setId(REINIT_ID);
+        addComponent(l);
+    }
+
+    @Override
+    public String getTestDescription() {
+        return "UI reinit after refresh";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return Integer.valueOf(12191);
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/ui/UIRefreshTest.java b/uitest/src/com/vaadin/tests/components/ui/UIRefreshTest.java
new file mode 100644 (file)
index 0000000..974c4bf
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.tests.components.ui;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class UIRefreshTest extends MultiBrowserTest {
+
+    @Test
+    public void testUIRefresh() {
+        openTestURL();
+        Assert.assertFalse(reinitLabelExists());
+        // Reload the page; UI.refresh should be invoked
+        openTestURL();
+        Assert.assertTrue(reinitLabelExists());
+    }
+
+    private boolean reinitLabelExists() {
+        return !getDriver().findElements(By.id(UIRefresh.REINIT_ID)).isEmpty();
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/ui/UIReinit.java b/uitest/src/com/vaadin/tests/components/ui/UIReinit.java
deleted file mode 100644 (file)
index bef7a5a..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2000-2013 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.tests.components.ui;
-
-import com.vaadin.annotations.PreserveOnRefresh;
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.tests.components.AbstractTestUI;
-import com.vaadin.ui.Label;
-
-@PreserveOnRefresh
-public class UIReinit extends AbstractTestUI {
-
-    public static final String REINIT_ID = "reinit";
-
-    @Override
-    protected void setup(VaadinRequest request) {
-    }
-
-    @Override
-    protected void reinit(VaadinRequest request) {
-        Label l = new Label("Reinit!");
-        l.setId(REINIT_ID);
-        addComponent(l);
-    }
-
-    @Override
-    public String getTestDescription() {
-        return "UI reinit after refresh";
-    }
-
-    @Override
-    protected Integer getTicketNumber() {
-        return Integer.valueOf(12191);
-    }
-}
diff --git a/uitest/src/com/vaadin/tests/components/ui/UIReinitTest.java b/uitest/src/com/vaadin/tests/components/ui/UIReinitTest.java
deleted file mode 100644 (file)
index 82132d3..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2000-2013 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.tests.components.ui;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import com.vaadin.testbench.By;
-import com.vaadin.tests.tb3.MultiBrowserTest;
-
-public class UIReinitTest extends MultiBrowserTest {
-
-    @Test
-    public void testUIReinit() {
-        openTestURL();
-        Assert.assertFalse(reinitLabelExists());
-        // Reload the page; UI.reinit should be invoked
-        openTestURL();
-        Assert.assertTrue(reinitLabelExists());
-    }
-
-    private boolean reinitLabelExists() {
-        return !getDriver().findElements(By.id(UIReinit.REINIT_ID)).isEmpty();
-    }
-}
index 39989926e745fda4f091ed4bb24d692ddeca81d6..c7379f666b952e98a7d2bdbd79efa9bbe56424fb 100644 (file)
@@ -2,7 +2,7 @@ package com.vaadin.tests.components.window;
 
 import com.vaadin.server.ThemeResource;
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.window.WindowState.WindowRole;
+import com.vaadin.shared.ui.window.WindowRole;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;