diff options
author | Jonatan Kronqvist <jonatan@vaadin.com> | 2014-04-08 15:02:58 +0300 |
---|---|---|
committer | Jonatan Kronqvist <jonatan@vaadin.com> | 2014-04-14 11:43:18 +0300 |
commit | d2e24feb09ccba7f3a2f253687488774af2bc340 (patch) | |
tree | f66161d98c5c1638741569c45712a6f06e7fd756 /shared | |
parent | 51c2e93172b0132ead54573c74117efac29c1cec (diff) | |
download | vaadin-framework-d2e24feb09ccba7f3a2f253687488774af2bc340.tar.gz vaadin-framework-d2e24feb09ccba7f3a2f253687488774af2bc340.zip |
Update some APIs based on the 7.2 API review comments
* 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
Diffstat (limited to 'shared')
5 files changed, 98 insertions, 179 deletions
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 index 6c8c743d57..0000000000 --- a/shared/src/com/vaadin/shared/ui/ui/NotificationConfigurationBean.java +++ /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 index 0000000000..218e5e59e6 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/ui/NotificationRole.java @@ -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 +} diff --git a/shared/src/com/vaadin/shared/ui/ui/UIState.java b/shared/src/com/vaadin/shared/ui/ui/UIState.java index d2e6f037e9..08fe3c7d64 100644 --- a/shared/src/com/vaadin/shared/ui/ui/UIState.java +++ b/shared/src/com/vaadin/shared/ui/ui/UIState.java @@ -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 index 0000000000..fc6b099620 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/window/WindowRole.java @@ -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 +} diff --git a/shared/src/com/vaadin/shared/ui/window/WindowState.java b/shared/src/com/vaadin/shared/ui/window/WindowState.java index e27bf87e88..ebb1995287 100644 --- a/shared/src/com/vaadin/shared/ui/window/WindowState.java +++ b/shared/src/com/vaadin/shared/ui/window/WindowState.java @@ -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; |