diff options
author | michaelvogt <michael@vaadin.com> | 2013-07-24 11:17:23 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-07-24 10:15:42 +0000 |
commit | 985d661e00dabaf5aa78bf67c3d2220e05cacb1e (patch) | |
tree | 115406954846196965ec3acbc85a0d1a8fba6d17 /server | |
parent | 3bbb824c7f1dd9ed23fd65283332db31a24a1935 (diff) | |
download | vaadin-framework-985d661e00dabaf5aa78bf67c3d2220e05cacb1e.tar.gz vaadin-framework-985d661e00dabaf5aa78bf67c3d2220e05cacb1e.zip |
Make settting of assistive description of Window optional (#12276)
Throws exception on server side for null parameter
Adds client side getter for descriptions
Change-Id: I7d6231eec52b584f674b97b9d0c8ee0b78b19297
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/ui/Window.java | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java index 658c821f88..dfe83d48a1 100644 --- a/server/src/com/vaadin/ui/Window.java +++ b/server/src/com/vaadin/ui/Window.java @@ -18,6 +18,9 @@ package com.vaadin.ui; import java.io.Serializable; import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; import java.util.Map; import com.vaadin.event.FieldEvents.BlurEvent; @@ -997,27 +1000,32 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, } /** - * Allows to specify which component contains the description for the - * window. Text contained in this component will be read by assistive + * Allows to specify which components contain the description for the + * window. Text contained in these components will be read by assistive * devices when it is opened. * - * @param connector - * with the component to use as description + * @param connectors + * with the components to use as description */ - public void setAssistiveDescription(Connector connector) { - setAssistiveDescription(new Connector[] { connector }); + public void setAssistiveDescription(Connector... connectors) { + if (connectors == null) { + throw new IllegalArgumentException( + "Parameter connectors must be non-null"); + } else { + getState().contentDescription = connectors; + } } /** - * Allows to specify which components contain the description for the - * window. Text contained in this component will be read by assistive - * devices when it is opened. + * Gets the components that are used as assistive description. Text + * contained in these components will be read by assistive devices when the + * window is opened. * - * @param connectors - * with the components to use as description + * @return list of previously set components */ - public void setAssistiveDescription(Connector... connectors) { - getState().contentDescription = connectors; + public List<Connector> getAssistiveDescription() { + return Collections.unmodifiableList(Arrays + .asList(getState().contentDescription)); } /** |