From 985d661e00dabaf5aa78bf67c3d2220e05cacb1e Mon Sep 17 00:00:00 2001 From: michaelvogt Date: Wed, 24 Jul 2013 11:17:23 +0300 Subject: 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 --- server/src/com/vaadin/ui/Window.java | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'server') 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 getAssistiveDescription() { + return Collections.unmodifiableList(Arrays + .asList(getState().contentDescription)); } /** -- cgit v1.2.3