diff options
20 files changed, 521 insertions, 890 deletions
diff --git a/server/src/main/java/com/vaadin/event/FieldEvents.java b/server/src/main/java/com/vaadin/event/FieldEvents.java index c6109a79d2..aeaf910d92 100644 --- a/server/src/main/java/com/vaadin/event/FieldEvents.java +++ b/server/src/main/java/com/vaadin/event/FieldEvents.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2014 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 @@ -37,15 +37,7 @@ public interface FieldEvents { * The interface for adding and removing <code>FocusEvent</code> listeners. * By implementing this interface a class explicitly announces that it will * generate a <code>FocusEvent</code> when it receives keyboard focus. - * <p> - * Note: The general Java convention is not to explicitly declare that a - * class generates events, but to directly define the - * <code>addListener</code> and <code>removeListener</code> methods. That - * way the caller of these methods has no real way of finding out if the - * class really will send the events, or if it just defines the methods to - * be able to implement an interface. - * </p> - * + * * @since 6.2 * @see FocusListener * @see FocusEvent @@ -54,7 +46,7 @@ public interface FieldEvents { /** * Adds a <code>FocusListener</code> to the Component which gets fired * when a <code>LegacyField</code> receives keyboard focus. - * + * * @param listener * @see FocusListener * @since 6.2 @@ -62,42 +54,21 @@ public interface FieldEvents { public void addFocusListener(FocusListener listener); /** - * @deprecated As of 7.0, replaced by - * {@link #addFocusListener(FocusListener)} - **/ - @Deprecated - public void addListener(FocusListener listener); - - /** * Removes a <code>FocusListener</code> from the Component. - * + * * @param listener * @see FocusListener * @since 6.2 */ public void removeFocusListener(FocusListener listener); - /** - * @deprecated As of 7.0, replaced by - * {@link #removeFocusListener(FocusListener)} - **/ - @Deprecated - public void removeListener(FocusListener listener); } /** * The interface for adding and removing <code>BlurEvent</code> listeners. * By implementing this interface a class explicitly announces that it will * generate a <code>BlurEvent</code> when it loses keyboard focus. - * <p> - * Note: The general Java convention is not to explicitly declare that a - * class generates events, but to directly define the - * <code>addListener</code> and <code>removeListener</code> methods. That - * way the caller of these methods has no real way of finding out if the - * class really will send the events, or if it just defines the methods to - * be able to implement an interface. - * </p> - * + * * @since 6.2 * @see BlurListener * @see BlurEvent @@ -106,7 +77,7 @@ public interface FieldEvents { /** * Adds a <code>BlurListener</code> to the Component which gets fired * when a <code>LegacyField</code> loses keyboard focus. - * + * * @param listener * @see BlurListener * @since 6.2 @@ -114,33 +85,20 @@ public interface FieldEvents { public void addBlurListener(BlurListener listener); /** - * @deprecated As of 7.0, replaced by - * {@link #addBlurListener(BlurListener)} - **/ - @Deprecated - public void addListener(BlurListener listener); - - /** * Removes a <code>BlurListener</code> from the Component. - * + * * @param listener * @see BlurListener * @since 6.2 */ public void removeBlurListener(BlurListener listener); - /** - * @deprecated As of 7.0, replaced by - * {@link #removeBlurListener(BlurListener)} - **/ - @Deprecated - public void removeListener(BlurListener listener); } /** * <code>FocusEvent</code> class for holding additional event information. * Fired when a <code>LegacyField</code> receives keyboard focus. - * + * * @since 6.2 */ @SuppressWarnings("serial") @@ -159,18 +117,18 @@ public interface FieldEvents { /** * <code>FocusListener</code> interface for listening for * <code>FocusEvent</code> fired by a <code>LegacyField</code>. - * + * * @see FocusEvent * @since 6.2 */ public interface FocusListener extends ConnectorEventListener { - public static final Method focusMethod = ReflectTools.findMethod( - FocusListener.class, "focus", FocusEvent.class); + public static final Method focusMethod = ReflectTools + .findMethod(FocusListener.class, "focus", FocusEvent.class); /** * Component has been focused - * + * * @param event * Component focus event. */ @@ -180,7 +138,7 @@ public interface FieldEvents { /** * <code>BlurEvent</code> class for holding additional event information. * Fired when a <code>LegacyField</code> loses keyboard focus. - * + * * @since 6.2 */ @SuppressWarnings("serial") @@ -199,18 +157,18 @@ public interface FieldEvents { /** * <code>BlurListener</code> interface for listening for * <code>BlurEvent</code> fired by a <code>LegacyField</code>. - * + * * @see BlurEvent * @since 6.2 */ public interface BlurListener extends ConnectorEventListener { - public static final Method blurMethod = ReflectTools.findMethod( - BlurListener.class, "blur", BlurEvent.class); + public static final Method blurMethod = ReflectTools + .findMethod(BlurListener.class, "blur", BlurEvent.class); /** * Component has been blurred - * + * * @param event * Component blur event. */ @@ -236,7 +194,7 @@ public interface FieldEvents { * example on each key press, but buffered with a small delay. The * {@link TextField} component supports different modes for triggering * TextChangeEvents. - * + * * @see TextChangeListener * @see TextChangeNotifier * @see TextField#setTextChangeEventMode(com.vaadin.ui.TextField.TextChangeEventMode) @@ -262,7 +220,7 @@ public interface FieldEvents { /** * A listener for {@link TextChangeEvent}s. - * + * * @since 6.5 */ public interface TextChangeListener extends ConnectorEventListener { @@ -273,7 +231,7 @@ public interface FieldEvents { /** * This method is called repeatedly while the text is edited by a user. - * + * * @param event * the event providing details of the text change */ @@ -288,25 +246,12 @@ public interface FieldEvents { public interface TextChangeNotifier extends Serializable { public void addTextChangeListener(TextChangeListener listener); - /** - * @deprecated As of 7.0, replaced by - * {@link #addTextChangeListener(TextChangeListener)} - **/ - @Deprecated - public void addListener(TextChangeListener listener); - public void removeTextChangeListener(TextChangeListener listener); - /** - * @deprecated As of 7.0, replaced by - * {@link #removeTextChangeListener(TextChangeListener)} - **/ - @Deprecated - public void removeListener(TextChangeListener listener); } - public static abstract class FocusAndBlurServerRpcImpl implements - FocusAndBlurServerRpc { + public static abstract class FocusAndBlurServerRpcImpl + implements FocusAndBlurServerRpc { private Component component; diff --git a/server/src/main/java/com/vaadin/legacy/ui/LegacyDateField.java b/server/src/main/java/com/vaadin/legacy/ui/LegacyDateField.java index 86cbcf9eec..4bb114bbd5 100644 --- a/server/src/main/java/com/vaadin/legacy/ui/LegacyDateField.java +++ b/server/src/main/java/com/vaadin/legacy/ui/LegacyDateField.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2014 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 @@ -63,7 +63,7 @@ import com.vaadin.ui.declarative.DesignContext; * {@link com.vaadin.legacy.ui.LegacyAbstractField#setWriteThrough(boolean)}must * be called to enable buffering. * </p> - * + * * @author Vaadin Ltd. * @since 3.0 */ @@ -73,7 +73,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Resolution identifier: seconds. - * + * * @deprecated As of 7.0, use {@link Resolution#SECOND} */ @Deprecated @@ -81,7 +81,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Resolution identifier: minutes. - * + * * @deprecated As of 7.0, use {@link Resolution#MINUTE} */ @Deprecated @@ -89,7 +89,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Resolution identifier: hours. - * + * * @deprecated As of 7.0, use {@link Resolution#HOUR} */ @Deprecated @@ -97,7 +97,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Resolution identifier: days. - * + * * @deprecated As of 7.0, use {@link Resolution#DAY} */ @Deprecated @@ -105,7 +105,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Resolution identifier: months. - * + * * @deprecated As of 7.0, use {@link Resolution#MONTH} */ @Deprecated @@ -113,7 +113,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Resolution identifier: years. - * + * * @deprecated As of 7.0, use {@link Resolution#YEAR} */ @Deprecated @@ -187,7 +187,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Constructs an empty <code>DateField</code> with caption. - * + * * @param caption * the caption of the datefield. */ @@ -198,7 +198,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Constructs a new <code>DateField</code> that's bound to the specified * <code>Property</code> and has the given caption <code>String</code>. - * + * * @param caption * the caption <code>String</code> for the editor. * @param dataSource @@ -212,7 +212,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Constructs a new <code>DateField</code> that's bound to the specified * <code>Property</code> and has no caption. - * + * * @param dataSource * the Property to be edited with this editor. */ @@ -233,7 +233,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements * to a Property unless * {@link com.vaadin.data.Property.Viewer#setPropertyDataSource(Property)} * is called to bind it. - * + * * @param caption * the caption <code>String</code> for the editor. * @param value @@ -315,7 +315,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements * date (taking the resolution into account), the component will not * validate. If <code>startDate</code> is set to <code>null</code>, any * value before <code>endDate</code> will be accepted by the range - * + * * @param startDate * - the allowed range's start date */ @@ -335,7 +335,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Sets the current error message if the range validation fails. - * + * * @param dateOutOfRangeMessage * - Localizable message which is shown when value (the date) is * set outside allowed range @@ -351,7 +351,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements * to YEAR, any date in year n will be accepted. Resolutions lower than DAY * will be interpreted on a DAY level. That is, everything below DATE is * cleared - * + * * @param forResolution * - the range conforms to the resolution * @return @@ -390,7 +390,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements * if <code>rangeStart</code> is set to one millisecond before year n and * resolution is set to YEAR, any date in year n - 1 will be accepted. * Lowest supported resolution is DAY. - * + * * @param forResolution * - the range conforms to the resolution * @return @@ -435,7 +435,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements * date (taking the resolution into account), the component will not * validate. If <code>endDate</code> is set to <code>null</code>, any value * after <code>startDate</code> will be accepted by the range. - * + * * @param endDate * - the allowed range's end date (inclusive, based on the * current resolution) @@ -456,9 +456,9 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Returns the precise rangeStart used. - * + * * @param startDate - * + * */ public Date getRangeStart() { return getState(false).rangeStart; @@ -466,7 +466,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Returns the precise rangeEnd used. - * + * * @param startDate */ public Date getRangeEnd() { @@ -608,7 +608,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements * also checks the parsingSucceeded flag, we must also * notify the form (if this is used in one) that the * validity of this field has changed. - * + * * Normally fields validity doesn't change without value * change and form depends on this implementation detail. */ @@ -649,13 +649,13 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * This method is called to handle a non-empty date string from the client * if the client could not parse it as a Date. - * + * * By default, a Converter.ConversionException is thrown, and the current * value is not modified. - * + * * This can be overridden to handle conversions, to return null (equivalent * to empty input), to throw an exception or to fire an event. - * + * * @param dateString * @return parsed Date * @throws Converter.ConversionException @@ -680,7 +680,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /* * (non-Javadoc) - * + * * @see com.vaadin.ui.AbstractField#setValue(java.lang.Object, boolean) */ @Override @@ -705,7 +705,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements * datefields validity may change although the logical value does * not change. This is an issue for Form which expects that validity * of Fields cannot change unless actual value changes. - * + * * So we check if this field is inside a form and the form has * registered this as a field. In this case we repaint the form. * Without this hacky solution the form might not be able to clean @@ -774,7 +774,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Gets the resolution. - * + * * @return int */ public Resolution getResolution() { @@ -783,9 +783,9 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Sets the resolution of the DateField. - * + * * The default resolution is {@link Resolution#DAY} since Vaadin 7.0. - * + * * @param resolution * the resolution to set. */ @@ -797,13 +797,13 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Returns new instance calendar used in Date conversions. - * + * * Returns new clone of the calendar object initialized using the the * current date (if available) - * + * * If this is no calendar is assigned the <code>Calendar.getInstance</code> * is used. - * + * * @return the Calendar. * @see #setCalendar(Calendar) */ @@ -842,14 +842,14 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Sets formatting used by some component implementations. See * {@link SimpleDateFormat} for format details. - * + * * By default it is encouraged to used default formatting defined by Locale, * but due some JVM bugs it is sometimes necessary to use this method to * override formatting. See Vaadin issue #2200. - * + * * @param dateFormat * the dateFormat to set - * + * * @see com.vaadin.ui.AbstractComponent#setLocale(Locale)) */ public void setDateFormat(String dateFormat) { @@ -860,7 +860,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Returns a format string used to format date value on client side or null * if default formatting from {@link Component#getLocale()} is used. - * + * * @return the dateFormat */ public String getDateFormat() { @@ -870,10 +870,10 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Specifies whether or not date/time interpretation in component is to be * lenient. - * + * * @see Calendar#setLenient(boolean) * @see #isLenient() - * + * * @param lenient * true if the lenient mode is to be turned on; false if it is to * be turned off. @@ -885,9 +885,9 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Returns whether date/time interpretation is to be lenient. - * + * * @see #setLenient(boolean) - * + * * @return true if the interpretation mode of this calendar is lenient; * false otherwise. */ @@ -901,64 +901,25 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements FocusListener.focusMethod); } - /** - * @deprecated As of 7.0, replaced by - * {@link #addFocusListener(FocusListener)} - **/ - @Override - @Deprecated - public void addListener(FocusListener listener) { - addFocusListener(listener); - } - @Override public void removeFocusListener(FocusListener listener) { removeListener(FocusEvent.EVENT_ID, FocusEvent.class, listener); } - /** - * @deprecated As of 7.0, replaced by - * {@link #removeFocusListener(FocusListener)} - **/ - @Override - @Deprecated - public void removeListener(FocusListener listener) { - removeFocusListener(listener); - } - @Override public void addBlurListener(BlurListener listener) { addListener(BlurEvent.EVENT_ID, BlurEvent.class, listener, BlurListener.blurMethod); } - /** - * @deprecated As of 7.0, replaced by {@link #addBlurListener(BlurListener)} - **/ - @Override - @Deprecated - public void addListener(BlurListener listener) { - addBlurListener(listener); - } - @Override public void removeBlurListener(BlurListener listener) { removeListener(BlurEvent.EVENT_ID, BlurEvent.class, listener); } /** - * @deprecated As of 7.0, replaced by - * {@link #removeBlurListener(BlurListener)} - **/ - @Override - @Deprecated - public void removeListener(BlurListener listener) { - removeBlurListener(listener); - } - - /** * Checks whether ISO 8601 week numbers are shown in the date selector. - * + * * @return true if week numbers are shown, false otherwise. */ public boolean isShowISOWeekNumbers() { @@ -969,7 +930,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements * Sets the visibility of ISO 8601 week numbers in the date selector. ISO * 8601 defines that a week always starts with a Monday so the week numbers * are only shown if this is the case. - * + * * @param showWeekNumbers * true if week numbers should be shown, false otherwise. */ @@ -983,7 +944,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements * not empty. Note that DateField is considered empty (value == null) and * invalid if it contains text typed in by the user that couldn't be parsed * into a Date value. - * + * * @see com.vaadin.legacy.ui.LegacyAbstractField#validate() */ @Override @@ -1006,9 +967,9 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements * custom exception, the message returned by * {@link Exception#getLocalizedMessage()} will be used instead of the value * returned by this method. - * + * * @see #setParseErrorMessage(String) - * + * * @return the error message that the DateField uses when it can't parse the * textual input from user to a Date object */ @@ -1021,7 +982,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements * text input by user to a Date field. Note that if the * {@link #handleUnparsableDateString(String)} method is overridden, the * localized message from its exception is used. - * + * * @see #getParseErrorMessage() * @see #handleUnparsableDateString(String) * @param parsingErrorMessage @@ -1034,10 +995,10 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements * Sets the time zone used by this date field. The time zone is used to * convert the absolute time in a Date object to a logical time displayed in * the selector and to convert the select time back to a Date object. - * + * * If no time zone has been set, the current default time zone returned by * {@code TimeZone.getDefault()} is used. - * + * * @see #getTimeZone() * @param timeZone * the time zone to use for time calculations. @@ -1051,10 +1012,10 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements * Gets the time zone used by this field. The time zone is used to convert * the absolute time in a Date object to a logical time displayed in the * selector and to convert the select time back to a Date object. - * + * * If {@code null} is returned, the current default time zone returned by * {@code TimeZone.getDefault()} is used. - * + * * @return the current time zone */ public TimeZone getTimeZone() { @@ -1096,7 +1057,7 @@ public class LegacyDateField extends LegacyAbstractField<Date> implements /** * Returns current date-out-of-range error message. - * + * * @see #setDateOutOfRangeMessage(String) * @since 7.4 * @return Current error message for dates out of range. diff --git a/server/src/main/java/com/vaadin/ui/AbstractFocusable.java b/server/src/main/java/com/vaadin/ui/AbstractFocusable.java index ad3b96f29b..c41b117b01 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractFocusable.java +++ b/server/src/main/java/com/vaadin/ui/AbstractFocusable.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2014 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 @@ -28,12 +28,12 @@ import com.vaadin.ui.Component.Focusable; /** * An abstract base class for focusable components. Includes API for setting the * tab index, programmatic focusing, and adding focus and blur listeners. - * + * * @since 7.6 * @author Vaadin Ltd */ -public abstract class AbstractFocusable extends AbstractComponent implements - Focusable, FocusNotifier, BlurNotifier { +public abstract class AbstractFocusable extends AbstractComponent + implements Focusable, FocusNotifier, BlurNotifier { protected AbstractFocusable() { registerRpc(new FocusAndBlurServerRpcImpl(this) { @@ -50,31 +50,11 @@ public abstract class AbstractFocusable extends AbstractComponent implements BlurListener.blurMethod); } - /** - * @deprecated As of 7.0, replaced by {@link #addBlurListener(BlurListener)} - */ - @Override - @Deprecated - public void addListener(BlurListener listener) { - addBlurListener(listener); - } - @Override public void removeBlurListener(BlurListener listener) { removeListener(BlurEvent.EVENT_ID, BlurEvent.class, listener); } - /** - * @deprecated As of 7.0, replaced by - * {@link #removeBlurListener(BlurListener)} - */ - @Override - @Deprecated - public void removeListener(BlurListener listener) { - removeBlurListener(listener); - - } - @Override public void addFocusListener(FocusListener listener) { addListener(FocusEvent.EVENT_ID, FocusEvent.class, listener, @@ -82,31 +62,11 @@ public abstract class AbstractFocusable extends AbstractComponent implements } - /** - * @deprecated As of 7.0, replaced by - * {@link #addFocusListener(FocusListener)} - */ - @Override - @Deprecated - public void addListener(FocusListener listener) { - addFocusListener(listener); - } - @Override public void removeFocusListener(FocusListener listener) { removeListener(FocusEvent.EVENT_ID, FocusEvent.class, listener); } - /** - * @deprecated As of 7.0, replaced by - * {@link #removeFocusListener(FocusListener)} - */ - @Override - @Deprecated - public void removeListener(FocusListener listener) { - removeFocusListener(listener); - } - @Override public void focus() { super.focus(); diff --git a/server/src/main/java/com/vaadin/ui/AbstractTextField.java b/server/src/main/java/com/vaadin/ui/AbstractTextField.java index c3b911a56b..ba53d546c2 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractTextField.java +++ b/server/src/main/java/com/vaadin/ui/AbstractTextField.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2014 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 @@ -39,8 +39,9 @@ import com.vaadin.shared.ui.textfield.TextFieldConstants; import com.vaadin.ui.declarative.DesignAttributeHandler; import com.vaadin.ui.declarative.DesignContext; -public abstract class AbstractTextField extends LegacyAbstractField<String> implements - BlurNotifier, FocusNotifier, TextChangeNotifier, LegacyComponent { +public abstract class AbstractTextField extends LegacyAbstractField<String> + implements BlurNotifier, FocusNotifier, TextChangeNotifier, + LegacyComponent { /** * Null representation. @@ -190,7 +191,8 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl String newValue = (String) variables.get("text"); // server side check for max length - if (getMaxLength() != -1 && newValue.length() > getMaxLength()) { + if (getMaxLength() != -1 + && newValue.length() > getMaxLength()) { newValue = newValue.substring(0, getMaxLength()); } final String oldValue = getValue(); @@ -233,17 +235,17 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl /** * Gets the null-string representation. - * + * * <p> * The null-valued strings are represented on the user interface by * replacing the null value with this string. If the null representation is * set null (not 'null' string), painting null value throws exception. * </p> - * + * * <p> * The default value is string 'null'. * </p> - * + * * @return the String Textual representation for null strings. * @see TextField#isNullSettingAllowed() */ @@ -253,7 +255,7 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl /** * Is setting nulls with null-string representation allowed. - * + * * <p> * If this property is true, writing null-representation string to text * field always sets the field value to real null. If this property is @@ -262,11 +264,11 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl * contents to real null, if the text field matches the null-string * representation and the current value of the field is null. * </p> - * + * * <p> * By default this setting is false * </p> - * + * * @return boolean Should the null-string represenation be always converted * to null-values. * @see TextField#getNullRepresentation() @@ -277,17 +279,17 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl /** * Sets the null-string representation. - * + * * <p> * The null-valued strings are represented on the user interface by * replacing the null value with this string. If the null representation is * set null (not 'null' string), painting null value throws exception. * </p> - * + * * <p> * The default value is string 'null' * </p> - * + * * @param nullRepresentation * Textual representation for null strings. * @see TextField#setNullSettingAllowed(boolean) @@ -299,7 +301,7 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl /** * Sets the null conversion mode. - * + * * <p> * If this property is true, writing null-representation string to text * field always sets the field value to real null. If this property is @@ -308,11 +310,11 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl * contents to real null, if the text field matches the null-string * representation and the current value of the field is null. * </p> - * + * * <p> * By default this setting is false. * </p> - * + * * @param nullSettingAllowed * Should the null-string representation always be converted to * null-values. @@ -331,7 +333,7 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl /** * Returns the maximum number of characters in the field. Value -1 is * considered unlimited. Terminal may however have some technical limits. - * + * * @return the maxLength */ public int getMaxLength() { @@ -341,7 +343,7 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl /** * Sets the maximum number of characters in the field. Value -1 is * considered unlimited. Terminal may however have some technical limits. - * + * * @param maxLength * the maxLength to set */ @@ -353,7 +355,7 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl * Gets the number of columns in the editor. If the number of columns is set * 0, the actual number of displayed columns is determined implicitly by the * adapter. - * + * * @return the number of columns in the editor. */ public int getColumns() { @@ -364,7 +366,7 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl * Sets the number of columns in the editor. If the number of columns is set * 0, the actual number of displayed columns is determined implicitly by the * adapter. - * + * * @param columns * the number of columns to set. */ @@ -377,7 +379,7 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl /** * Gets the current input prompt. - * + * * @see #setInputPrompt(String) * @return the current input prompt, or null if not enabled */ @@ -388,7 +390,7 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl /** * Sets the input prompt - a textual prompt that is displayed when the field * would otherwise be empty, to prompt the user for input. - * + * * @param inputPrompt */ public void setInputPrompt(String inputPrompt) { @@ -415,11 +417,11 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl /* * TODO check for possible (minor?) issue (not tested) - * + * * -field with e.g. PropertyFormatter. - * + * * -TextChangeListener and it changes value. - * + * * -if formatter again changes the value, do we get an extra * simulated text change event ? */ @@ -427,7 +429,7 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl /* * Fire a "simulated" text change event before value change event if * change is coming from the client side. - * + * * Iff there is both value change and textChangeEvent in same * variable burst, it is a text field in non immediate mode and the * text change event "flushed" queued value change event. In this @@ -458,8 +460,8 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl * Make sure w reset lastKnownTextContent field on value change. The * clearing must happen here as well because TextChangeListener can * revert the original value. Client must respect the value in this - * case. LegacyAbstractField optimizes value change if the existing value is - * reset. Also we need to force repaint if the flag is on. + * case. LegacyAbstractField optimizes value change if the existing + * value is reset. Also we need to force repaint if the flag is on. */ if (lastKnownTextContent != null) { lastKnownTextContent = null; @@ -480,10 +482,10 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl /** * Sets the mode how the TextField triggers {@link TextChangeEvent}s. - * + * * @param inputEventMode * the new mode - * + * * @see TextChangeEventMode */ public void setTextChangeEventMode(TextChangeEventMode inputEventMode) { @@ -540,16 +542,6 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl listener, TextChangeListener.EVENT_METHOD); } - /** - * @deprecated As of 7.0, replaced by - * {@link #addTextChangeListener(TextChangeListener)} - **/ - @Override - @Deprecated - public void addListener(TextChangeListener listener) { - addTextChangeListener(listener); - } - @Override public void removeTextChangeListener(TextChangeListener listener) { removeListener(TextChangeListener.EVENT_ID, TextChangeEvent.class, @@ -557,23 +549,13 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl } /** - * @deprecated As of 7.0, replaced by - * {@link #removeTextChangeListener(TextChangeListener)} - **/ - @Override - @Deprecated - public void removeListener(TextChangeListener listener) { - removeTextChangeListener(listener); - } - - /** * The text change timeout modifies how often text change events are * communicated to the application when {@link #getTextChangeEventMode()} is * {@link TextChangeEventMode#LAZY} or {@link TextChangeEventMode#TIMEOUT}. - * - * + * + * * @see #getTextChangeEventMode() - * + * * @param timeout * the timeout in milliseconds */ @@ -586,7 +568,7 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl * Gets the timeout used to fire {@link TextChangeEvent}s when the * {@link #getTextChangeEventMode()} is {@link TextChangeEventMode#LAZY} or * {@link TextChangeEventMode#TIMEOUT}. - * + * * @return the timeout value in milliseconds */ public int getTextChangeTimeout() { @@ -629,7 +611,7 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl * pressing enter. The value returned by this method is updated also on * {@link TextChangeEvent}s. Due to this high dependency to the terminal * implementation this method is (at least at this point) not published. - * + * * @return the text which is currently displayed in the field. */ private String getCurrentTextContent() { @@ -646,7 +628,7 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl /** * Selects all text in the field. - * + * * @since 6.4 */ public void selectAll() { @@ -656,11 +638,11 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl /** * Sets the range of text to be selected. - * + * * As a side effect the field will become focused. - * + * * @since 6.4 - * + * * @param pos * the position of the first character to be selected * @param length @@ -676,12 +658,12 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl /** * Sets the cursor position in the field. As a side effect the field will * become focused. - * + * * @since 6.4 - * + * * @param pos * the position for the cursor - * */ + */ public void setCursorPosition(int pos) { setSelectionRange(pos, 0); lastKnownCursorPosition = pos; @@ -689,14 +671,14 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl /** * Returns the last known cursor position of the field. - * + * * <p> * Note that due to the client server nature or the GWT terminal, Vaadin * cannot provide the exact value of the cursor position in most situations. * The value is updated only when the client side terminal communicates to * TextField, like on {@link ValueChangeEvent}s and {@link TextChangeEvent} * s. This may change later if a deep push integration is built to Vaadin. - * + * * @return the cursor position */ public int getCursorPosition() { @@ -709,64 +691,25 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl FocusListener.focusMethod); } - /** - * @deprecated As of 7.0, replaced by - * {@link #addFocusListener(FocusListener)} - **/ - @Override - @Deprecated - public void addListener(FocusListener listener) { - addFocusListener(listener); - } - @Override public void removeFocusListener(FocusListener listener) { removeListener(FocusEvent.EVENT_ID, FocusEvent.class, listener); } - /** - * @deprecated As of 7.0, replaced by - * {@link #removeFocusListener(FocusListener)} - **/ - @Override - @Deprecated - public void removeListener(FocusListener listener) { - removeFocusListener(listener); - } - @Override public void addBlurListener(BlurListener listener) { addListener(BlurEvent.EVENT_ID, BlurEvent.class, listener, BlurListener.blurMethod); } - /** - * @deprecated As of 7.0, replaced by {@link #addBlurListener(BlurListener)} - **/ - @Override - @Deprecated - public void addListener(BlurListener listener) { - addBlurListener(listener); - } - @Override public void removeBlurListener(BlurListener listener) { removeListener(BlurEvent.EVENT_ID, BlurEvent.class, listener); } - /** - * @deprecated As of 7.0, replaced by - * {@link #removeBlurListener(BlurListener)} - **/ - @Override - @Deprecated - public void removeListener(BlurListener listener) { - removeBlurListener(listener); - } - /* * (non-Javadoc) - * + * * @see com.vaadin.ui.AbstractField#readDesign(org.jsoup.nodes.Element , * com.vaadin.ui.declarative.DesignContext) */ @@ -775,14 +718,14 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl super.readDesign(design, designContext); Attributes attr = design.attributes(); if (attr.hasKey("maxlength")) { - setMaxLength(DesignAttributeHandler.readAttribute("maxlength", - attr, Integer.class)); + setMaxLength(DesignAttributeHandler.readAttribute("maxlength", attr, + Integer.class)); } } /* * (non-Javadoc) - * + * * @see com.vaadin.ui.AbstractField#getCustomAttributes() */ @Override @@ -797,7 +740,7 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl /* * (non-Javadoc) - * + * * @see com.vaadin.ui.AbstractField#writeDesign(org.jsoup.nodes.Element, * com.vaadin.ui.declarative.DesignContext) */ @@ -807,8 +750,8 @@ public abstract class AbstractTextField extends LegacyAbstractField<String> impl AbstractTextField def = (AbstractTextField) designContext .getDefaultInstance(this); Attributes attr = design.attributes(); - DesignAttributeHandler.writeAttribute("maxlength", attr, - getMaxLength(), def.getMaxLength(), Integer.class); + DesignAttributeHandler.writeAttribute("maxlength", attr, getMaxLength(), + def.getMaxLength(), Integer.class); } } diff --git a/server/src/main/java/com/vaadin/ui/ComboBox.java b/server/src/main/java/com/vaadin/ui/ComboBox.java index 008326abb9..6384aa361b 100644 --- a/server/src/main/java/com/vaadin/ui/ComboBox.java +++ b/server/src/main/java/com/vaadin/ui/ComboBox.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2014 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 @@ -45,18 +45,18 @@ import com.vaadin.shared.ui.combobox.FilteringMode; * input, and loaded dynamically ("lazy-loading") from the server. You can turn * on newItemsAllowed and change filtering mode (and also turn it off), but you * can not turn on multi-select mode. - * + * */ @SuppressWarnings("serial") -public class ComboBox extends AbstractSelect implements - AbstractSelect.Filtering, FieldEvents.BlurNotifier, +public class ComboBox extends AbstractSelect + implements AbstractSelect.Filtering, FieldEvents.BlurNotifier, FieldEvents.FocusNotifier { /** * ItemStyleGenerator can be used to add custom styles to combo box items * shown in the popup. The CSS class name that will be added to the item * style names is <tt>v-filterselect-item-[style name]</tt>. - * + * * @since 7.5.6 * @see ComboBox#setItemStyleGenerator(ItemStyleGenerator) */ @@ -64,7 +64,7 @@ public class ComboBox extends AbstractSelect implements /** * Called by ComboBox when an item is painted. - * + * * @param source * the source combo box * @param itemId @@ -118,7 +118,8 @@ public class ComboBox extends AbstractSelect implements } }; - FocusAndBlurServerRpcImpl focusBlurRpc = new FocusAndBlurServerRpcImpl(this) { + FocusAndBlurServerRpcImpl focusBlurRpc = new FocusAndBlurServerRpcImpl( + this) { @Override protected void fireEvent(Component.Event event) { ComboBox.this.fireEvent(event); @@ -156,7 +157,7 @@ public class ComboBox extends AbstractSelect implements * Flag to indicate whether to scroll the selected item visible (select the * page on which it is) when opening the popup or not. Only applies to * single select mode. - * + * * This requires finding the index of the item, which can be expensive in * many large lazy loading containers. */ @@ -197,7 +198,7 @@ public class ComboBox extends AbstractSelect implements /** * Gets the current input prompt. - * + * * @see #setInputPrompt(String) * @return the current input prompt, or null if not enabled */ @@ -224,7 +225,7 @@ public class ComboBox extends AbstractSelect implements /** * A class representing an item in a ComboBox for server to client * communication. This class is for internal use only and subject to change. - * + * * @since */ private static class ComboBoxItem implements Serializable { @@ -353,11 +354,11 @@ public class ComboBox extends AbstractSelect implements } target.endTag("options"); - target.addAttribute("totalitems", size() - + (needNullSelectOption ? 1 : 0)); + target.addAttribute("totalitems", + size() + (needNullSelectOption ? 1 : 0)); if (filteredSize > 0 || nullOptionVisible) { - target.addAttribute("totalMatches", filteredSize - + (nullOptionVisible ? 1 : 0)); + target.addAttribute("totalMatches", + filteredSize + (nullOptionVisible ? 1 : 0)); } // Paint variables @@ -397,9 +398,9 @@ public class ComboBox extends AbstractSelect implements * field area of the component is just used to show what is selected. By * disabling text input, the comboBox will work in the same way as a * {@link NativeSelect} - * + * * @see #isTextInputAllowed() - * + * * @param textInputAllowed * true to allow entering text, false to just show the current * selection @@ -413,7 +414,7 @@ public class ComboBox extends AbstractSelect implements * the selections or enter a new value if {@link #isNewItemsAllowed()} * returns true. If text input is disabled, the comboBox will work in the * same way as a {@link NativeSelect} - * + * * @return */ public boolean isTextInputAllowed() { @@ -433,17 +434,17 @@ public class ComboBox extends AbstractSelect implements /** * Returns the filtered options for the current page using a container * filter. - * + * * As a size effect, {@link #filteredSize} is set to the total number of * items passing the filter. - * + * * The current container must be {@link Filterable} and {@link Indexed}, and * the filtering mode must be suitable for container filtering (tested with * {@link #canUseContainerFilter()}). - * + * * Use {@link #getFilteredOptions()} and * {@link #sanitetizeList(List, boolean)} if this is not the case. - * + * * @param needNullSelectOption * @return filtered list of options (may be empty) or null if cannot use * container filters @@ -486,7 +487,8 @@ public class ComboBox extends AbstractSelect implements // to page with the selected item after filtering if accepted by // filter Object selection = getValue(); - if (isScrollToSelectedItem() && !optionRequest && selection != null) { + if (isScrollToSelectedItem() && !optionRequest + && selection != null) { // ensure proper page indexToEnsureInView = indexed.indexOfId(selection); } @@ -519,11 +521,11 @@ public class ComboBox extends AbstractSelect implements /** * Constructs a filter instance to use when using a Filterable container in * the <code>ITEM_CAPTION_MODE_PROPERTY</code> mode. - * + * * Note that the client side implementation expects the filter string to * apply to the item caption string it sees, so changing the behavior of * this method can cause problems. - * + * * @param filterString * @param filteringMode * @return @@ -558,20 +560,21 @@ public class ComboBox extends AbstractSelect implements /** * Makes correct sublist of given list of options. - * + * * If paint is not an option request (affected by page or filter change), * page will be the one where possible selection exists. - * + * * Detects proper first and last item in list to return right page of * options. Also, if the current page is beyond the end of the list, it will * be adjusted. - * + * * @param options * @param needNullSelectOption * flag to indicate if nullselect option needs to be taken into * consideration */ - private List<?> sanitetizeList(List<?> options, boolean needNullSelectOption) { + private List<?> sanitetizeList(List<?> options, + boolean needNullSelectOption) { if (getPageLength() != 0 && options.size() > getPageLength()) { @@ -581,7 +584,8 @@ public class ComboBox extends AbstractSelect implements // to page with the selected item after filtering if accepted by // filter Object selection = getValue(); - if (isScrollToSelectedItem() && !optionRequest && selection != null) { + if (isScrollToSelectedItem() && !optionRequest + && selection != null) { // ensure proper page indexToEnsureInView = options.indexOf(selection); } @@ -591,8 +595,8 @@ public class ComboBox extends AbstractSelect implements indexToEnsureInView, size); int first = getFirstItemIndexOnCurrentPage(needNullSelectOption, size); - int last = getLastItemIndexOnCurrentPage(needNullSelectOption, - size, first); + int last = getLastItemIndexOnCurrentPage(needNullSelectOption, size, + first); return options.subList(first, last + 1); } else { return options; @@ -603,7 +607,7 @@ public class ComboBox extends AbstractSelect implements * Returns the index of the first item on the current page. The index is to * the underlying (possibly filtered) contents. The null item, if any, does * not have an index but takes up a slot on the first page. - * + * * @param needNullSelectOption * true if a null option should be shown before any other options * (takes up the first slot on the first page, not counted in @@ -630,7 +634,7 @@ public class ComboBox extends AbstractSelect implements * the underlying (possibly filtered) contents. If needNullSelectOption is * true, the null item takes up the first slot on the first page, * effectively reducing the first page size by one. - * + * * @param needNullSelectOption * true if a null option should be shown before any other options * (takes up the first slot on the first page, not counted in @@ -655,7 +659,7 @@ public class ComboBox extends AbstractSelect implements * page is not after the end of the contents, and optionally go to the page * containg a specific item. There are no side effects but the adjusted page * index is returned. - * + * * @param page * page number to use as the starting point * @param needNullSelectOption @@ -685,11 +689,11 @@ public class ComboBox extends AbstractSelect implements /** * Filters the options in memory and returns the full filtered list. - * + * * This can be less efficient than using container filters, so use * {@link #getOptionsWithFilter(boolean)} if possible (filterable container * and suitable item caption mode etc.). - * + * * @return */ protected List<?> getFilteredOptions() { @@ -741,7 +745,7 @@ public class ComboBox extends AbstractSelect implements /** * Invoked when the value of a variable has changed. - * + * * @see com.vaadin.ui.AbstractComponent#changeVariables(java.lang.Object, * java.util.Map) */ @@ -769,64 +773,25 @@ public class ComboBox extends AbstractSelect implements BlurListener.blurMethod); } - /** - * @deprecated As of 7.0, replaced by {@link #addBlurListener(BlurListener)} - **/ - @Override - @Deprecated - public void addListener(BlurListener listener) { - addBlurListener(listener); - } - @Override public void removeBlurListener(BlurListener listener) { removeListener(BlurEvent.EVENT_ID, BlurEvent.class, listener); } - /** - * @deprecated As of 7.0, replaced by - * {@link #removeBlurListener(BlurListener)} - **/ - @Override - @Deprecated - public void removeListener(BlurListener listener) { - removeBlurListener(listener); - } - @Override public void addFocusListener(FocusListener listener) { addListener(FocusEvent.EVENT_ID, FocusEvent.class, listener, FocusListener.focusMethod); } - /** - * @deprecated As of 7.0, replaced by - * {@link #addFocusListener(FocusListener)} - **/ - @Override - @Deprecated - public void addListener(FocusListener listener) { - addFocusListener(listener); - } - @Override public void removeFocusListener(FocusListener listener) { removeListener(FocusEvent.EVENT_ID, FocusEvent.class, listener); } /** - * @deprecated As of 7.0, replaced by - * {@link #removeFocusListener(FocusListener)} - **/ - @Override - @Deprecated - public void removeListener(FocusListener listener) { - removeFocusListener(listener); - } - - /** * ComboBox does not support multi select mode. - * + * * @deprecated As of 7.0, use {@link ListSelect}, {@link OptionGroup} or * {@link TwinColSelect} instead * @see com.vaadin.ui.AbstractSelect#setMultiSelect(boolean) @@ -837,18 +802,19 @@ public class ComboBox extends AbstractSelect implements @Override public void setMultiSelect(boolean multiSelect) { if (multiSelect) { - throw new UnsupportedOperationException("Multiselect not supported"); + throw new UnsupportedOperationException( + "Multiselect not supported"); } } /** * ComboBox does not support multi select mode. - * + * * @deprecated As of 7.0, use {@link ListSelect}, {@link OptionGroup} or * {@link TwinColSelect} instead - * + * * @see com.vaadin.ui.AbstractSelect#isMultiSelect() - * + * * @return false */ @Deprecated @@ -859,7 +825,7 @@ public class ComboBox extends AbstractSelect implements /** * Returns the page length of the suggestion popup. - * + * * @return the pageLength */ public int getPageLength() { @@ -879,7 +845,7 @@ public class ComboBox extends AbstractSelect implements /** * Sets the page length for the suggestion popup. Setting the page length to * 0 will disable suggestion popup paging (all items visible). - * + * * @param pageLength * the pageLength to set */ @@ -891,7 +857,7 @@ public class ComboBox extends AbstractSelect implements * Sets the suggestion pop-up's width as a CSS string. By using relative * units (e.g. "50%") it's possible to set the popup's width relative to the * ComboBox itself. - * + * * @see #getPopupWidth() * @since 7.7 * @param width @@ -905,10 +871,10 @@ public class ComboBox extends AbstractSelect implements * Sets whether to scroll the selected item visible (directly open the page * on which it is) when opening the combo box popup or not. Only applies to * single select mode. - * + * * This requires finding the index of the item, which can be expensive in * many large lazy loading containers. - * + * * @param scrollToSelectedItem * true to find the page with the selected item when opening the * selection popup @@ -920,9 +886,9 @@ public class ComboBox extends AbstractSelect implements /** * Returns true if the select should find the page with the selected item * when opening the popup (single select combo box only). - * + * * @see #setScrollToSelectedItem(boolean) - * + * * @return true if the page with the selected item will be shown when * opening the popup */ @@ -934,7 +900,7 @@ public class ComboBox extends AbstractSelect implements * Sets the item style generator that is used to produce custom styles for * showing items in the popup. The CSS class name that will be added to the * item style names is <tt>v-filterselect-item-[style name]</tt>. - * + * * @param itemStyleGenerator * the item style generator to set, or <code>null</code> to not * use any custom item styles @@ -947,7 +913,7 @@ public class ComboBox extends AbstractSelect implements /** * Gets the currently used item style generator. - * + * * @return the itemStyleGenerator the currently used item style generator, * or <code>null</code> if no generator is used * @since 7.5.6 diff --git a/server/src/main/java/com/vaadin/ui/NativeSelect.java b/server/src/main/java/com/vaadin/ui/NativeSelect.java index c7af478428..6fe619d58a 100644 --- a/server/src/main/java/com/vaadin/ui/NativeSelect.java +++ b/server/src/main/java/com/vaadin/ui/NativeSelect.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2014 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 @@ -33,10 +33,11 @@ import com.vaadin.event.FieldEvents.FocusListener; * better choice. */ @SuppressWarnings("serial") -public class NativeSelect extends AbstractSelect implements - FieldEvents.BlurNotifier, FieldEvents.FocusNotifier { +public class NativeSelect extends AbstractSelect + implements FieldEvents.BlurNotifier, FieldEvents.FocusNotifier { - FocusAndBlurServerRpcImpl focusBlurRpc = new FocusAndBlurServerRpcImpl(this) { + FocusAndBlurServerRpcImpl focusBlurRpc = new FocusAndBlurServerRpcImpl( + this) { @Override protected void fireEvent(Event event) { @@ -68,7 +69,8 @@ public class NativeSelect extends AbstractSelect implements public void setMultiSelect(boolean multiSelect) throws UnsupportedOperationException { if (multiSelect == true) { - throw new UnsupportedOperationException("Multiselect not supported"); + throw new UnsupportedOperationException( + "Multiselect not supported"); } } @@ -87,59 +89,20 @@ public class NativeSelect extends AbstractSelect implements FocusListener.focusMethod); } - /** - * @deprecated As of 7.0, replaced by - * {@link #addFocusListener(FocusListener)} - **/ - @Override - @Deprecated - public void addListener(FocusListener listener) { - addFocusListener(listener); - } - @Override public void removeFocusListener(FocusListener listener) { removeListener(FocusEvent.EVENT_ID, FocusEvent.class, listener); } - /** - * @deprecated As of 7.0, replaced by - * {@link #removeFocusListener(FocusListener)} - **/ - @Override - @Deprecated - public void removeListener(FocusListener listener) { - removeFocusListener(listener); - } - @Override public void addBlurListener(BlurListener listener) { addListener(BlurEvent.EVENT_ID, BlurEvent.class, listener, BlurListener.blurMethod); } - /** - * @deprecated As of 7.0, replaced by {@link #addBlurListener(BlurListener)} - **/ - @Override - @Deprecated - public void addListener(BlurListener listener) { - addBlurListener(listener); - } - @Override public void removeBlurListener(BlurListener listener) { removeListener(BlurEvent.EVENT_ID, BlurEvent.class, listener); } - /** - * @deprecated As of 7.0, replaced by - * {@link #removeBlurListener(BlurListener)} - **/ - @Override - @Deprecated - public void removeListener(BlurListener listener) { - removeBlurListener(listener); - } - } diff --git a/server/src/main/java/com/vaadin/ui/OptionGroup.java b/server/src/main/java/com/vaadin/ui/OptionGroup.java index af2afeb4ad..c3c590ece3 100644 --- a/server/src/main/java/com/vaadin/ui/OptionGroup.java +++ b/server/src/main/java/com/vaadin/ui/OptionGroup.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2014 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 @@ -40,8 +40,8 @@ import com.vaadin.ui.declarative.DesignFormatter; * Configures select to be used as an option group. */ @SuppressWarnings("serial") -public class OptionGroup extends AbstractSelect implements - FieldEvents.BlurNotifier, FieldEvents.FocusNotifier { +public class OptionGroup extends AbstractSelect + implements FieldEvents.BlurNotifier, FieldEvents.FocusNotifier { private Set<Object> disabledItemIds = new HashSet<Object>(); @@ -89,62 +89,23 @@ public class OptionGroup extends AbstractSelect implements BlurListener.blurMethod); } - /** - * @deprecated As of 7.0, replaced by {@link #addBlurListener(BlurListener)} - **/ - @Override - @Deprecated - public void addListener(BlurListener listener) { - addBlurListener(listener); - } - @Override public void removeBlurListener(BlurListener listener) { removeListener(BlurEvent.EVENT_ID, BlurEvent.class, listener); } - /** - * @deprecated As of 7.0, replaced by - * {@link #removeBlurListener(BlurListener)} - **/ - @Override - @Deprecated - public void removeListener(BlurListener listener) { - removeBlurListener(listener); - } - @Override public void addFocusListener(FocusListener listener) { addListener(FocusEvent.EVENT_ID, FocusEvent.class, listener, FocusListener.focusMethod); } - /** - * @deprecated As of 7.0, replaced by - * {@link #addFocusListener(FocusListener)} - **/ - @Override - @Deprecated - public void addListener(FocusListener listener) { - addFocusListener(listener); - } - @Override public void removeFocusListener(FocusListener listener) { removeListener(FocusEvent.EVENT_ID, FocusEvent.class, listener); } - /** - * @deprecated As of 7.0, replaced by - * {@link #removeFocusListener(FocusListener)} - **/ - @Override - @Deprecated - public void removeListener(FocusListener listener) { - removeFocusListener(listener); - } - @Override protected void setValue(Object newValue, boolean repaintIsNotNeeded) { if (repaintIsNotNeeded) { @@ -158,7 +119,8 @@ public class OptionGroup extends AbstractSelect implements Set<?> currentValueSet = (Set<?>) getValue(); Set<?> newValueSet = (Set<?>) newValue; for (Object itemId : currentValueSet) { - if (!isItemEnabled(itemId) && !newValueSet.contains(itemId)) { + if (!isItemEnabled(itemId) + && !newValueSet.contains(itemId)) { markAsDirty(); return; } @@ -187,10 +149,10 @@ public class OptionGroup extends AbstractSelect implements * Sets an item disabled or enabled. In the multiselect mode, a disabled * item cannot be selected or deselected by the user. In the single * selection mode, a disable item cannot be selected. - * + * * However, programmatical selection or deselection of an disable item is * possible. By default, items are enabled. - * + * * @param itemId * the id of the item to be disabled or enabled * @param enabled @@ -209,7 +171,7 @@ public class OptionGroup extends AbstractSelect implements /** * Returns true if the item is enabled. - * + * * @param itemId * the id of the item to be checked * @return true if the item is enabled, false otherwise @@ -227,7 +189,7 @@ public class OptionGroup extends AbstractSelect implements * captions are passed to the browser as html and the developer is * responsible for ensuring no harmful html is used. If set to false, the * content is passed to the browser as plain text. - * + * * @param htmlContentAllowed * true if the captions are used as html, false if used as plain * text @@ -238,7 +200,7 @@ public class OptionGroup extends AbstractSelect implements /** * Checks whether captions are interpreted as html or plain text. - * + * * @return true if the captions are used as html, false if used as plain * text * @see #setHtmlContentAllowed(boolean) diff --git a/server/src/main/java/com/vaadin/ui/TabSheet.java b/server/src/main/java/com/vaadin/ui/TabSheet.java index 66784aaa02..7f42409219 100644 --- a/server/src/main/java/com/vaadin/ui/TabSheet.java +++ b/server/src/main/java/com/vaadin/ui/TabSheet.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2014 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 @@ -52,37 +52,37 @@ import com.vaadin.ui.themes.Runo; /** * TabSheet component. - * + * * Tabs are typically identified by the component contained on the tab (see * {@link ComponentContainer}), and tab metadata (including caption, icon, * visibility, enabledness, closability etc.) is kept in separate {@link Tab} * instances. - * + * * Tabs added with {@link #addComponent(Component)} get the caption and the icon * of the component at the time when the component is created, and these are not * automatically updated after tab creation. - * + * * A tab sheet can have multiple tab selection listeners and one tab close * handler ({@link CloseHandler}), which by default removes the tab from the * TabSheet. - * + * * The {@link TabSheet} can be styled with the .v-tabsheet, .v-tabsheet-tabs and * .v-tabsheet-content styles. Themes may also have pre-defined variations of * the tab sheet presentation, such as {@link Reindeer#TABSHEET_BORDERLESS}, * {@link Runo#TABSHEET_SMALL} and several other styles in {@link Reindeer}. - * + * * The current implementation does not load the tabs to the UI before the first * time they are shown, but this may change in future releases. - * + * * @author Vaadin Ltd. * @since 3.0 */ -public class TabSheet extends AbstractComponentContainer implements Focusable, - FocusNotifier, BlurNotifier, SelectiveRenderer { +public class TabSheet extends AbstractComponentContainer + implements Focusable, FocusNotifier, BlurNotifier, SelectiveRenderer { /** * Client to server RPC implementation for TabSheet. - * + * * @since 7.2 */ protected class TabsheetServerRpcImpl implements TabsheetServerRpc { @@ -153,7 +153,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Constructs a new TabSheet containing the given components. - * + * * @param components * The components to add to the tab sheet. Each component will be * added to a separate tab. @@ -166,7 +166,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Gets the component container iterator for going through all the * components (tab contents). - * + * * @return the unmodifiable Iterator of the tab content components */ @@ -178,7 +178,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Gets the number of contained components (tabs). Consistent with the * iterator returned by {@link #getComponentIterator()}. - * + * * @return the number of contained components */ @@ -189,10 +189,10 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Removes a component and its corresponding tab. - * + * * If the tab was selected, the first eligible (visible and enabled) * remaining tab is selected. - * + * * @param component * the component to be removed. */ @@ -216,7 +216,8 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, setSelected(null); } else { - int newSelectedIndex = selectedTabIndexAfterTabRemove(componentIndex); + int newSelectedIndex = selectedTabIndexAfterTabRemove( + componentIndex); // Make sure the component actually exists, in case someone // override it and provide a non existing component. @@ -245,11 +246,11 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * Called when a selected tab is removed to specify the new tab to select. * Can be overridden to provide another algorithm that calculates the new * selection. - * + * * Current implementation will choose the first enabled tab to the right of * the removed tab if it's not the last one, otherwise will choose the * closer enabled tab to the left. - * + * * @since 7.4 * @param removedTabIndex * the index of the selected tab which was just remove. @@ -284,7 +285,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * If the tab was selected, the first eligible (visible and enabled) * remaining tab is selected. * </p> - * + * * @see #addTab(Component) * @see #addTab(Component, String, Resource) * @see #addComponent(Component) @@ -299,9 +300,9 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Adds a new tab into TabSheet. Component caption and icon are copied to * the tab metadata at creation time. - * + * * @see #addTab(Component) - * + * * @param c * the component to be added. */ @@ -313,13 +314,13 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * 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 returns the corresponding (old) tab, preserving other tab metadata. - * + * * @param c * the component to be added onto tab - should not be null. * @param caption @@ -333,14 +334,14 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * 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 returns the corresponding (old) tab, preserving other tab * metadata. - * + * * @param c * the component to be added onto tab - should not be null. * @param caption @@ -357,14 +358,14 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * 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 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 @@ -409,9 +410,9 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Adds a new tab into TabSheet. Component caption and icon are copied to * the tab metadata at creation time. - * + * * If the tab sheet already contains the component, its tab is returned. - * + * * @param c * the component to be added onto tab - should not be null. * @return the created {@link Tab} @@ -423,9 +424,9 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Adds a new tab into TabSheet. Component caption and icon are copied to * the tab metadata at creation time. - * + * * If the tab sheet already contains the component, its tab is returned. - * + * * @param component * the component to be added onto tab - should not be null. * @param position @@ -446,10 +447,10 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Moves all components from another container to this container. The * components are removed from the other container. - * + * * If the source container is a {@link TabSheet}, component captions and * icons are copied from it. - * + * * @param source * the container components are removed from. */ @@ -476,7 +477,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Are the tab selection parts ("tabs") hidden. - * + * * @return true if the tabs are hidden in the UI * @deprecated as of 7.5, use {@link #isTabsVisible()} instead */ @@ -487,7 +488,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Hides or shows the tab selection parts ("tabs"). - * + * * @param tabsHidden * true if the tabs should be hidden * @deprecated as of 7.5, use {@link #setTabsVisible(boolean)} instead @@ -499,7 +500,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Sets whether the tab selection part should be shown in the UI - * + * * @since 7.5 * @param tabsVisible * true if the tabs should be shown in the UI, false otherwise @@ -522,7 +523,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Returns the {@link Tab} (metadata) for a component. The {@link Tab} * object can be used for setting caption,icon, etc for the tab. - * + * * @param c * the component * @return The tab instance associated with the given component, or null if @@ -535,7 +536,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Returns the {@link Tab} (metadata) for a component. The {@link Tab} * object can be used for setting caption,icon, etc for the tab. - * + * * @param position * the position of the tab * @return The tab in the given position, or null if the position is out of @@ -552,7 +553,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Sets the selected tab. The tab is identified by the tab content * component. Does nothing if the tabsheet doesn't contain the component. - * + * * @param c */ public void setSelectedTab(Component c) { @@ -568,7 +569,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Sets the selected tab in the TabSheet. Ensures that the selected tab is * repainted if needed. - * + * * @param component * The new selection or null for no selection */ @@ -599,7 +600,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * Sets the selected tab. The tab is identified by the corresponding * {@link Tab Tab} instance. Does nothing if the tabsheet doesn't contain * the given tab. - * + * * @param tab */ public void setSelectedTab(Tab tab) { @@ -611,7 +612,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Sets the selected tab, identified by its position. Does nothing if the * position is out of bounds. - * + * * @param position */ public void setSelectedTab(int position) { @@ -623,15 +624,16 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * the previously selected component is not visible and enabled. The first * visible and enabled tab is selected if the current selection is empty or * invalid. - * + * * This method does not fire tab change events, but the caller should do so * if appropriate. - * + * * @return true if selection was changed, false otherwise */ private boolean updateSelection() { Component originalSelection = selected; - for (final Iterator<Component> i = getComponentIterator(); i.hasNext();) { + for (final Iterator<Component> i = getComponentIterator(); i + .hasNext();) { final Component component = i.next(); Tab tab = tabs.get(component); @@ -668,7 +670,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Gets the selected tab content component. - * + * * @return the selected tab contents */ public Component getSelectedTab() { @@ -691,21 +693,22 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * change tab contents or to rearrange tabs. The tab position and some * metadata are preserved when moving components within the same * {@link TabSheet}. - * + * * If the oldComponent is not present in the tab sheet, the new one is added * at the end. - * + * * If the oldComponent is already in the tab sheet but the newComponent * isn't, the old tab is replaced with a new one, and the caption and icon * of the old one are copied to the new tab. - * + * * If both old and new components are present, their positions are swapped. - * + * * {@inheritDoc} */ @Override - public void replaceComponent(Component oldComponent, Component newComponent) { + public void replaceComponent(Component oldComponent, + Component newComponent) { boolean selectAfterInserting = false; if (selected == oldComponent) { @@ -720,7 +723,8 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, int newLocation = -1; int location = 0; - for (final Iterator<Component> i = components.iterator(); i.hasNext();) { + for (final Iterator<Component> i = components.iterator(); i + .hasNext();) { final Component component = i.next(); if (component == oldComponent) { @@ -755,8 +759,10 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, if (selectAfterInserting) { setSelected(newComponent); - //SelectedTabChangeEvent should be fired here as selected Tab is changed. - //Other cases are handled implicitly by removeComponent() and addComponent()addTab() + // SelectedTabChangeEvent should be fired here as selected Tab + // is changed. + // Other cases are handled implicitly by removeComponent() and + // addComponent()addTab() fireSelectedTabChange(); } @@ -790,7 +796,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Selected tab change event. This event is sent when the selected (shown) * tab in the tab sheet is changed. - * + * * @author Vaadin Ltd. * @since 3.0 */ @@ -798,7 +804,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * New instance of selected tab change event - * + * * @param source * the Source of the event. */ @@ -808,7 +814,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * TabSheet where the event occurred. - * + * * @return the Source of the event. */ public TabSheet getTabSheet() { @@ -820,16 +826,16 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * Selected tab change event listener. The listener is called whenever * another tab is selected, including when adding the first tab to a * tabsheet. - * + * * @author Vaadin Ltd. - * + * * @since 3.0 */ public interface SelectedTabChangeListener extends Serializable { /** * Selected (shown) tab in tab sheet has has been changed. - * + * * @param event * the selected tab change event. */ @@ -838,11 +844,12 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Adds a tab selection listener - * + * * @param listener * the Listener to be added. */ - public void addSelectedTabChangeListener(SelectedTabChangeListener listener) { + public void addSelectedTabChangeListener( + SelectedTabChangeListener listener) { addListener(SelectedTabChangeEvent.class, listener, SELECTED_TAB_CHANGE_METHOD); } @@ -858,7 +865,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Removes a tab selection listener - * + * * @param listener * the Listener to be removed. */ @@ -886,11 +893,11 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Tab meta-data for a component in a {@link TabSheet}. - * + * * The meta-data includes the tab caption, icon, visibility and enabledness, * closability, description (tooltip) and an optional component error shown * in the tab. - * + * * Tabs are identified by the component contained on them in most cases, and * the meta-data can be obtained with {@link TabSheet#getTab(Component)}. */ @@ -898,7 +905,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Returns the visible status for the tab. An invisible tab is not shown * in the tab bar and cannot be selected. - * + * * @return true for visible, false for hidden */ public boolean isVisible(); @@ -907,7 +914,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * Sets the visible status for the tab. An invisible tab is not shown in * the tab bar and cannot be selected, selection is changed * automatically when there is an attempt to select an invisible tab. - * + * * @param visible * true for visible, false for hidden */ @@ -915,7 +922,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Returns the closability status for the tab. - * + * * @return true if the tab is allowed to be closed by the end user, * false for not allowing closing */ @@ -928,7 +935,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * <p> * Note! Currently only supported by TabSheet, not Accordion. * </p> - * + * * @param closable * true if the end user is allowed to close the tab, false * for not allowing to close. Should default to false. @@ -938,7 +945,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Set the component that should automatically focused when the tab is * selected. - * + * * @param component * the component to focus */ @@ -947,7 +954,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Get the component that should be automatically focused when the tab * is selected. - * + * * @return the focusable component */ public Focusable getDefaultFocusComponent(); @@ -955,7 +962,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Returns the enabled status for the tab. A disabled tab is shown as * such in the tab bar and cannot be selected. - * + * * @return true for enabled, false for disabled */ public boolean isEnabled(); @@ -963,7 +970,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Sets the enabled status for the tab. A disabled tab is shown as such * in the tab bar and cannot be selected. - * + * * @param enabled * true for enabled, false for disabled */ @@ -971,7 +978,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Sets the caption for the tab. - * + * * @param caption * the caption to set */ @@ -989,7 +996,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Sets the icon for the tab. - * + * * @param icon * the icon to set */ @@ -997,7 +1004,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Sets the icon and alt text for the tab. - * + * * @param icon * the icon to set */ @@ -1005,16 +1012,16 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Gets the icon alt text for the tab. - * + * * @since 7.2 */ public String getIconAlternateText(); /** * Sets the icon alt text for the tab. - * + * * @since 7.2 - * + * * @param iconAltText * the icon to set */ @@ -1024,7 +1031,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * Gets the description for the tab. The description can be used to * briefly describe the state of the tab to the user, and is typically * shown as a tooltip when hovering over the tab. - * + * * @return the description for the tab */ public String getDescription(); @@ -1033,7 +1040,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * Sets the description for the tab. The description can be used to * briefly describe the state of the tab to the user, and is typically * shown as a tooltip when hovering over the tab. - * + * * @param description * the new description string for the tab. */ @@ -1043,9 +1050,9 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * Sets an error indicator to be shown in the tab. This can be used e.g. * to communicate to the user that there is a problem in the contents of * the tab. - * + * * @see AbstractComponent#setComponentError(ErrorMessage) - * + * * @param componentError * error message or null for none */ @@ -1053,9 +1060,9 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Gets the current error message shown for the tab. - * + * * TODO currently not sent to the client - * + * * @see AbstractComponent#setComponentError(ErrorMessage) */ public ErrorMessage getComponentError(); @@ -1068,7 +1075,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Sets a style name for the tab. The style name will be rendered as a * HTML class name, which can be used in a CSS definition. - * + * * <pre> * Tab tab = tabsheet.addTab(tabContent, "Tab text"); * tab.setStyleName("mystyle"); @@ -1080,16 +1087,16 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * {@code v-tabsheet-tabitemcell-mystyle}" style. You could then style * the component with: * </p> - * + * * <pre> * .v-tabsheet-tabitemcell-mystyle {font-style: italic;} * </pre> - * + * * <p> * This method will trigger a {@link RepaintRequestEvent} on the * TabSheet to which the Tab belongs. * </p> - * + * * @param styleName * the new style to be set for tab * @see #getStyleName() @@ -1099,7 +1106,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Gets the user-defined CSS style name of the tab. Built-in style names * defined in Vaadin or GWT are not returned. - * + * * @return the style name or of the tab * @see #setStyleName(String) */ @@ -1109,7 +1116,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * Adds an unique id for component that is used in the client-side for * testing purposes. Keeping identifiers unique is the responsibility of * the programmer. - * + * * @param id * An alphanumeric id */ @@ -1117,7 +1124,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Gets currently set debug identifier - * + * * @return current id, null if not set */ public String getId(); @@ -1257,8 +1264,8 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, public void setComponentError(ErrorMessage componentError) { this.componentError = componentError; - String formattedHtmlMessage = componentError != null ? componentError - .getFormattedHtmlMessage() : null; + String formattedHtmlMessage = componentError != null + ? componentError.getFormattedHtmlMessage() : null; tabState.componentError = formattedHtmlMessage; markAsDirty(); @@ -1312,17 +1319,17 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * CloseHandler is used to process tab closing events. Default behavior is * to remove the tab from the TabSheet. - * + * * @author Jouni Koivuviita / Vaadin Ltd. * @since 6.2.0 - * + * */ public interface CloseHandler extends Serializable { /** * Called when a user has pressed the close icon of a tab in the client * side widget. - * + * * @param tabsheet * the TabSheet to which the tab belongs to * @param tabContent @@ -1336,12 +1343,12 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * Provide a custom {@link CloseHandler} for this TabSheet if you wish to * perform some additional tasks when a user clicks on a tabs close button, * e.g. show a confirmation dialogue before removing the tab. - * + * * To remove the tab, if you provide your own close handler, you must call * {@link #removeComponent(Component)} yourself. - * + * * The default CloseHandler for TabSheet will only remove the tab. - * + * * @param handler */ public void setCloseHandler(CloseHandler handler) { @@ -1350,7 +1357,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Sets the position of the tab. - * + * * @param tab * The tab * @param position @@ -1367,7 +1374,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Gets the position of the tab - * + * * @param tab * The tab * @return @@ -1397,61 +1404,22 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, BlurListener.blurMethod); } - /** - * @deprecated As of 7.0, replaced by {@link #addBlurListener(BlurListener)} - **/ - @Override - @Deprecated - public void addListener(BlurListener listener) { - addBlurListener(listener); - } - @Override public void removeBlurListener(BlurListener listener) { removeListener(BlurEvent.EVENT_ID, BlurEvent.class, listener); } - /** - * @deprecated As of 7.0, replaced by - * {@link #removeBlurListener(BlurListener)} - **/ - @Override - @Deprecated - public void removeListener(BlurListener listener) { - removeBlurListener(listener); - } - @Override public void addFocusListener(FocusListener listener) { addListener(FocusEvent.EVENT_ID, FocusEvent.class, listener, FocusListener.focusMethod); } - /** - * @deprecated As of 7.0, replaced by - * {@link #addFocusListener(FocusListener)} - **/ - @Override - @Deprecated - public void addListener(FocusListener listener) { - addFocusListener(listener); - } - @Override public void removeFocusListener(FocusListener listener) { removeListener(FocusEvent.EVENT_ID, FocusEvent.class, listener); } - /** - * @deprecated As of 7.0, replaced by - * {@link #removeFocusListener(FocusListener)} - **/ - @Override - @Deprecated - public void removeListener(FocusListener listener) { - removeFocusListener(listener); - } - @Override public boolean isRendered(Component childComponent) { return childComponent == getSelectedTab(); @@ -1459,7 +1427,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Copies properties from one Tab to another. - * + * * @param from * The tab whose data to copy. * @param to @@ -1488,7 +1456,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /* * (non-Javadoc) - * + * * @see com.vaadin.ui.AbstractComponent#readDesign(org.jsoup.nodes .Element, * com.vaadin.ui.declarative.DesignContext) */ @@ -1498,8 +1466,8 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, // create new tabs for (Element tab : design.children()) { if (!tab.tagName().equals("tab")) { - throw new DesignException("Invalid tag name for tabsheet tab " - + tab.tagName()); + throw new DesignException( + "Invalid tag name for tabsheet tab " + tab.tagName()); } readTabFromDesign(tab, designContext); } @@ -1507,9 +1475,9 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Reads the given tab element from design - * + * * @since 7.4 - * + * * @param tabElement * the element to be read * @param designContext @@ -1527,32 +1495,32 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, Component child = designContext.readDesign(content); Tab tab = this.addTab(child); if (attr.hasKey("visible")) { - tab.setVisible(DesignAttributeHandler.readAttribute("visible", - attr, Boolean.class)); + tab.setVisible(DesignAttributeHandler.readAttribute("visible", attr, + Boolean.class)); } if (attr.hasKey("closable")) { tab.setClosable(DesignAttributeHandler.readAttribute("closable", attr, Boolean.class)); } if (attr.hasKey("caption")) { - tab.setCaption(DesignAttributeHandler.readAttribute("caption", - attr, String.class)); + tab.setCaption(DesignAttributeHandler.readAttribute("caption", attr, + String.class)); } if (attr.hasKey("enabled")) { - tab.setEnabled(DesignAttributeHandler.readAttribute("enabled", - attr, Boolean.class)); + tab.setEnabled(DesignAttributeHandler.readAttribute("enabled", attr, + Boolean.class)); } if (attr.hasKey("icon")) { tab.setIcon(DesignAttributeHandler.readAttribute("icon", attr, Resource.class)); } if (attr.hasKey("icon-alt")) { - tab.setIconAlternateText(DesignAttributeHandler.readAttribute( - "icon-alt", attr, String.class)); + tab.setIconAlternateText(DesignAttributeHandler + .readAttribute("icon-alt", attr, String.class)); } if (attr.hasKey("description")) { - tab.setDescription(DesignAttributeHandler.readAttribute( - "description", attr, String.class)); + tab.setDescription(DesignAttributeHandler + .readAttribute("description", attr, String.class)); } if (attr.hasKey("style-name")) { tab.setStyleName(DesignAttributeHandler.readAttribute("style-name", @@ -1573,7 +1541,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Writes the given tab to design - * + * * @since 7.4 * @param design * the design node for tabsheet @@ -1596,8 +1564,8 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, def.isVisible(), Boolean.class); DesignAttributeHandler.writeAttribute("closable", attr, tab.isClosable(), def.isClosable(), Boolean.class); - DesignAttributeHandler.writeAttribute("caption", attr, - tab.getCaption(), def.getCaption(), String.class); + DesignAttributeHandler.writeAttribute("caption", attr, tab.getCaption(), + def.getCaption(), String.class); DesignAttributeHandler.writeAttribute("enabled", attr, tab.isEnabled(), def.isEnabled(), Boolean.class); DesignAttributeHandler.writeAttribute("icon", attr, tab.getIcon(), @@ -1614,14 +1582,14 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, if (getSelectedTab() != null && getSelectedTab().equals(tab.getComponent())) { // use write attribute to get consistent handling for boolean - DesignAttributeHandler.writeAttribute("selected", attr, true, - false, boolean.class); + DesignAttributeHandler.writeAttribute("selected", attr, true, false, + boolean.class); } } /* * (non-Javadoc) - * + * * @see com.vaadin.ui.AbstractComponent#getCustomAttributes() */ @Override @@ -1633,7 +1601,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /* * (non-Javadoc) - * + * * @see com.vaadin.ui.AbstractComponent#writeDesign(org.jsoup.nodes.Element * , com.vaadin.ui.declarative.DesignContext) */ @@ -1661,7 +1629,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * false, the content is rendered in the browser as plain text. * <p> * The default is false, i.e. render tab captions as plain text - * + * * @param tabCaptionsAsHtml * true if the tab captions are rendered as HTML, false if * rendered as plain text @@ -1675,7 +1643,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * Checks whether HTML is allowed in the tab captions. * <p> * The default is false, i.e. render tab captions as plain text - * + * * @return true if the tab captions are rendered as HTML, false if rendered * as plain text * @since 7.4 diff --git a/server/src/main/java/com/vaadin/ui/Window.java b/server/src/main/java/com/vaadin/ui/Window.java index 70399ae566..f3b4728b26 100644 --- a/server/src/main/java/com/vaadin/ui/Window.java +++ b/server/src/main/java/com/vaadin/ui/Window.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2014 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 @@ -55,7 +55,8 @@ import com.vaadin.util.ReflectTools; /** * A component that represents a floating popup window that can be added to a * {@link UI}. A window is added to a {@code UI} using - * {@link UI#addWindow(Window)}. </p> + * {@link UI#addWindow(Window)}. + * </p> * <p> * The contents of a window is set using {@link #setContent(Component)} or by * using the {@link #Window(String, Component)} constructor. @@ -71,13 +72,13 @@ import com.vaadin.util.ReflectTools; * In Vaadin versions prior to 7.0.0, Window was also used as application level * windows. This function is now covered by the {@link UI} class. * </p> - * + * * @author Vaadin Ltd. * @since 3.0 */ @SuppressWarnings({ "serial", "deprecation" }) -public class Window extends Panel implements FocusNotifier, BlurNotifier, - LegacyComponent { +public class Window extends Panel + implements FocusNotifier, BlurNotifier, LegacyComponent { private WindowServerRpc rpc = new WindowServerRpc() { @@ -105,7 +106,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Holds registered CloseShortcut instances for query and later removal */ - private List<CloseShortcut> closeShortcuts = new ArrayList<CloseShortcut>(4); + private List<CloseShortcut> closeShortcuts = new ArrayList<CloseShortcut>( + 4); /** * Creates a new, empty window @@ -116,7 +118,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Creates a new, empty window with a given title. - * + * * @param caption * the title of the window. */ @@ -126,7 +128,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Creates a new, empty window with the given content and title. - * + * * @param caption * the title of the window. * @param content @@ -143,7 +145,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /* * (non-Javadoc) - * + * * @see com.vaadin.ui.Panel#paintContent(com.vaadin.server.PaintTarget) */ @@ -161,10 +163,9 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /* * (non-Javadoc) - * - * @see - * com.vaadin.ui.AbstractComponent#setParent(com.vaadin.server.ClientConnector - * ) + * + * @see com.vaadin.ui.AbstractComponent#setParent(com.vaadin.server. + * ClientConnector ) */ @Override public void setParent(HasComponents parent) { @@ -178,7 +179,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /* * (non-Javadoc) - * + * * @see com.vaadin.ui.Panel#changeVariables(java.lang.Object, java.util.Map) */ @@ -189,14 +190,12 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, boolean sizeHasChanged = false; // size is handled in super class, but resize events only in windows -> // so detect if size change occurs before super.changeVariables() - if (variables.containsKey("height") - && (getHeightUnits() != Unit.PIXELS || (Integer) variables - .get("height") != getHeight())) { + if (variables.containsKey("height") && (getHeightUnits() != Unit.PIXELS + || (Integer) variables.get("height") != getHeight())) { sizeHasChanged = true; } - if (variables.containsKey("width") - && (getWidthUnits() != Unit.PIXELS || (Integer) variables - .get("width") != getWidth())) { + if (variables.containsKey("width") && (getWidthUnits() != Unit.PIXELS + || (Integer) variables.get("width") != getWidth())) { sizeHasChanged = true; } @@ -241,12 +240,12 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Method that handles window closing (from UI). - * + * * <p> * By default, windows are removed from their respective UIs and thus * visually closed on browser-side. * </p> - * + * * <p> * To react to a window being closed (after it is closed), register a * {@link CloseListener}. @@ -265,7 +264,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Gets the distance of Window left border in pixels from left border of the * containing (main window) when the window is in {@link WindowMode#NORMAL}. - * + * * @return the Distance of Window left border in pixels from left border of * the containing (main window).or -1 if unspecified * @since 4.0.0 @@ -277,7 +276,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Sets the position of the window on the screen using * {@link #setPositionX(int)} and {@link #setPositionY(int)} - * + * * @since 7.5 * @param x * The new x coordinate for the window @@ -293,7 +292,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * Sets the distance of Window left border in pixels from left border of the * containing (main window). Has effect only if in {@link WindowMode#NORMAL} * mode. - * + * * @param positionX * the Distance of Window left border in pixels from left border * of the containing (main window). or -1 if unspecified. @@ -308,10 +307,10 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * Gets the distance of Window top border in pixels from top border of the * containing (main window) when the window is in {@link WindowMode#NORMAL} * state, or when next set to that state. - * + * * @return Distance of Window top border in pixels from top border of the * containing (main window). or -1 if unspecified - * + * * @since 4.0.0 */ public int getPositionY() { @@ -322,11 +321,11 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * Sets the distance of Window top border in pixels from top border of the * containing (main window). Has effect only if in {@link WindowMode#NORMAL} * mode. - * + * * @param positionY * the Distance of Window top border in pixels from top border of * the containing (main window). or -1 if unspecified - * + * * @since 4.0.0 */ public void setPositionY(int positionY) { @@ -349,7 +348,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, public static class CloseEvent extends Component.Event { /** - * + * * @param source */ public CloseEvent(Component source) { @@ -358,7 +357,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Gets the Window. - * + * * @return the window. */ public Window getWindow() { @@ -371,7 +370,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * CloseListener to a window and * {@link CloseListener#windowClose(CloseEvent)} will be called whenever the * user closes the window. - * + * * <p> * Since Vaadin 6.5, removing a window using {@link #removeWindow(Window)} * fires the CloseListener. @@ -382,7 +381,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * Called when the user closes a window. Use * {@link CloseEvent#getWindow()} to get a reference to the * {@link Window} that was closed. - * + * * @param e * Event containing */ @@ -391,21 +390,21 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Adds a CloseListener to the window. - * + * * For a window the CloseListener is fired when the user closes it (clicks * on the close button). - * + * * For a browser level window the CloseListener is fired when the browser * level window is closed. Note that closing a browser level window does not * mean it will be destroyed. Also note that Opera does not send events like * all other browsers and therefore the close listener might not be called * if Opera is used. - * + * * <p> * Since Vaadin 6.5, removing windows using {@link #removeWindow(Window)} * does fire the CloseListener. * </p> - * + * * @param listener * the CloseListener to add. */ @@ -424,11 +423,11 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Removes the CloseListener from the window. - * + * * <p> * For more information on CloseListeners see {@link CloseListener}. * </p> - * + * * @param listener * the CloseListener to remove. */ @@ -451,17 +450,17 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Event which is fired when the mode of the Window changes. - * + * * @author Vaadin Ltd * @since 7.1 - * + * */ public static class WindowModeChangeEvent extends Component.Event { private final WindowMode windowMode; /** - * + * * @param source */ public WindowModeChangeEvent(Component source, WindowMode windowMode) { @@ -471,7 +470,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Gets the Window. - * + * * @return the window */ public Window getWindow() { @@ -480,7 +479,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Gets the new window mode. - * + * * @return the new mode */ public WindowMode getWindowMode() { @@ -498,8 +497,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, public interface WindowModeChangeListener extends Serializable { public static final Method windowModeChangeMethod = ReflectTools - .findMethod(WindowModeChangeListener.class, - "windowModeChanged", WindowModeChangeEvent.class); + .findMethod(WindowModeChangeListener.class, "windowModeChanged", + WindowModeChangeEvent.class); /** * Called when the user maximizes / restores a window. Use @@ -507,7 +506,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * {@link Window} that was maximized / restored. Use * {@link WindowModeChangeEvent#getWindowMode()} to get a reference to * the new state. - * + * * @param event */ public void windowModeChanged(WindowModeChangeEvent event); @@ -515,12 +514,12 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Adds a WindowModeChangeListener to the window. - * + * * The WindowModeChangeEvent is fired when the user changed the display * state by clicking the maximize/restore button or by double clicking on * the window header. The event is also fired if the state is changed using * {@link #setWindowMode(WindowMode)}. - * + * * @param listener * the WindowModeChangeListener to add. */ @@ -531,17 +530,19 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Removes the WindowModeChangeListener from the window. - * + * * @param listener * the WindowModeChangeListener to remove. */ - public void removeWindowModeChangeListener(WindowModeChangeListener listener) { + public void removeWindowModeChangeListener( + WindowModeChangeListener listener) { removeListener(WindowModeChangeEvent.class, listener, WindowModeChangeListener.windowModeChangeMethod); } protected void fireWindowWindowModeChange() { - fireEvent(new Window.WindowModeChangeEvent(this, getState().windowMode)); + fireEvent( + new Window.WindowModeChangeEvent(this, getState().windowMode)); } /** @@ -567,7 +568,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, public static class ResizeEvent extends Component.Event { /** - * + * * @param source */ public ResizeEvent(Component source) { @@ -576,7 +577,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Get the window form which this event originated - * + * * @return the window */ public Window getWindow() { @@ -586,7 +587,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Listener for window resize events. - * + * * @see com.vaadin.ui.Window.ResizeEvent */ public interface ResizeListener extends Serializable { @@ -595,7 +596,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Add a resize listener. - * + * * @param listener */ public void addResizeListener(ResizeListener listener) { @@ -613,7 +614,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Remove a resize listener. - * + * * @param listener */ public void removeResizeListener(ResizeListener listener) { @@ -680,7 +681,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * <p> * Keyboard navigation is restricted by blocking the tab key at the top and * bottom of the window by activating the tab stop function internally. - * + * * @param modal * true if modality is to be turned on */ @@ -698,7 +699,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Sets window resizable. - * + * * @param resizable * true if resizability is to be turned on */ @@ -707,7 +708,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, } /** - * + * * @return true if window is resizable by the end-user, otherwise false. */ public boolean isResizable() { @@ -715,7 +716,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, } /** - * + * * @return true if a delay is used before recalculating sizes, false if * sizes are recalculated immediately. */ @@ -727,10 +728,10 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * Should resize operations be lazy, i.e. should there be a delay before * layout sizes are recalculated. Speeds up resize operations in slow UIs * with the penalty of slightly decreased usability. - * + * * Note, some browser send false resize events for the browser window and * are therefore always lazy. - * + * * @param resizeLazy * true to use a delay before recalculating sizes, false to * calculate immediately. @@ -757,12 +758,12 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * typically shows an X in the upper right corner. Clicking on the X sends a * close event to the server. Setting closable to false will remove the X * from the window and prevent the user from closing the window. - * + * * Note! For historical reasons readonly controls the closability of the * window and therefore readonly and closable affect each other. Setting * readonly to true will set closable to false and vice versa. * <p/> - * + * * @return true if the window can be closed by the user. */ public boolean isClosable() { @@ -774,12 +775,12 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * typically shows an X in the upper right corner. Clicking on the X sends a * close event to the server. Setting closable to false will remove the X * from the window and prevent the user from closing the window. - * + * * Note! For historical reasons readonly controls the closability of the * window and therefore readonly and closable affect each other. Setting * readonly to true will set closable to false and vice versa. * <p/> - * + * * @param closable * determines if the window can be closed by the user. */ @@ -791,7 +792,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * Indicates whether a window can be dragged or not. By default a window is * draggable. * <p/> - * + * * @param draggable * true if the window can be dragged by the user */ @@ -803,7 +804,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * Enables or disables that a window can be dragged (moved) by the user. By * default a window is draggable. * <p/> - * + * * @param draggable * true if the window can be dragged by the user */ @@ -813,7 +814,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Gets the current mode of the window. - * + * * @see WindowMode * @return the mode of the window. */ @@ -823,7 +824,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Sets the mode for the window - * + * * @see WindowMode * @param windowMode * The new mode @@ -854,13 +855,13 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * Note that this shortcut only reacts while the window has focus, closing * itself - if you want to close a window from a UI, use * {@link UI#addAction(com.vaadin.event.Action)} of the UI instead. - * + * * @param keyCode * the keycode for invoking the shortcut * @param modifiers * the (optional) modifiers for invoking the shortcut. Can be set * to null to be explicit about not having modifiers. - * + * * @deprecated Use {@link #addCloseShortcut(int, int...)} instead. */ @Deprecated @@ -881,7 +882,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * {@link #removeCloseShortcut(int,int...)}, * {@link #removeAllCloseShortcuts()}, {@link #hasCloseShortcut(int,int...)} * and {@link #getCloseShortcuts()}. - * + * * @deprecated Use {@link #removeCloseShortcut(int, int...)} instead. */ @Deprecated @@ -897,7 +898,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Adds a close shortcut - pressing this key while holding down all (if any) * modifiers specified while this Window is in focus will close the Window. - * + * * @since 7.6 * @param keyCode * the keycode for invoking the shortcut @@ -921,7 +922,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Removes a close shortcut previously added with * {@link #addCloseShortcut(int, int...)}. - * + * * @since 7.6 * @param keyCode * the keycode for invoking the shortcut @@ -944,7 +945,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * It is up to the user to add back any and all keyboard close shortcuts * they may require. For more fine-grained control over shortcuts, use * {@link #removeCloseShortcut(int, int...)}. - * + * * @since 7.6 */ public void removeAllCloseShortcuts() { @@ -956,7 +957,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Checks if a close window shortcut key has already been registered. - * + * * @since 7.6 * @param keyCode * the keycode for invoking the shortcut @@ -980,7 +981,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * mainly so that users can implement their own serialization routines. To * check if a certain combination of keys has been registered as a close * shortcut, use the {@link #hasCloseShortcut(int, int...)} method instead. - * + * * @since 7.6 * @return an unmodifiable Collection of CloseShortcut objects. */ @@ -991,17 +992,17 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * A {@link ShortcutListener} specifically made to define a keyboard * shortcut that closes the window. - * + * * <pre> * <code> * // within the window using helper * window.setCloseShortcut(KeyCode.ESCAPE, null); - * + * * // or globally * getUI().addAction(new Window.CloseShortcut(window, KeyCode.ESCAPE)); * </code> * </pre> - * + * */ public static class CloseShortcut extends ShortcutListener { protected Window window; @@ -1009,7 +1010,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Creates a keyboard shortcut for closing the given window using the * shorthand notation defined in {@link ShortcutAction}. - * + * * @param window * to be closed when the shortcut is invoked * @param shorthandCaption @@ -1023,7 +1024,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Creates a keyboard shortcut for closing the given window using the * given {@link KeyCode} and {@link ModifierKey}s. - * + * * @param window * to be closed when the shortcut is invoked * @param keyCode @@ -1039,7 +1040,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Creates a keyboard shortcut for closing the given window using the * given {@link KeyCode}. - * + * * @param window * to be closed when the shortcut is invoked * @param keyCode @@ -1078,7 +1079,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /* * (non-Javadoc) - * + * * @see * com.vaadin.event.FieldEvents.FocusNotifier#addFocusListener(com.vaadin * .event.FieldEvents.FocusListener) @@ -1089,34 +1090,14 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, FocusListener.focusMethod); } - /** - * @deprecated As of 7.0, replaced by - * {@link #addFocusListener(FocusListener)} - **/ - @Override - @Deprecated - public void addListener(FocusListener listener) { - addFocusListener(listener); - } - @Override public void removeFocusListener(FocusListener listener) { removeListener(FocusEvent.EVENT_ID, FocusEvent.class, listener); } - /** - * @deprecated As of 7.0, replaced by - * {@link #removeFocusListener(FocusListener)} - **/ - @Override - @Deprecated - public void removeListener(FocusListener listener) { - removeFocusListener(listener); - } - /* * (non-Javadoc) - * + * * @see * com.vaadin.event.FieldEvents.BlurNotifier#addBlurListener(com.vaadin. * event.FieldEvents.BlurListener) @@ -1127,33 +1108,14 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, BlurListener.blurMethod); } - /** - * @deprecated As of 7.0, replaced by {@link #addBlurListener(BlurListener)} - **/ - @Override - @Deprecated - public void addListener(BlurListener listener) { - addBlurListener(listener); - } - @Override public void removeBlurListener(BlurListener listener) { removeListener(BlurEvent.EVENT_ID, BlurEvent.class, listener); } /** - * @deprecated As of 7.0, replaced by - * {@link #removeBlurListener(BlurListener)} - **/ - @Override - @Deprecated - public void removeListener(BlurListener listener) { - removeBlurListener(listener); - } - - /** * {@inheritDoc} - * + * * Cause the window to be brought on top of other windows and gain keyboard * focus. */ @@ -1182,7 +1144,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * 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 components * the components to use as description */ @@ -1199,7 +1161,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * 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. - * + * * @return array of previously set components */ public Component[] getAssistiveDescription() { @@ -1217,10 +1179,10 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Sets the accessibility prefix for the window caption. - * + * * This prefix is read to assistive device users before the window caption, * but not visible on the page. - * + * * @param prefix * String that is placed before the window caption */ @@ -1230,10 +1192,10 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Gets the accessibility prefix for the window caption. - * + * * This prefix is read to assistive device users before the window caption, * but not visible on the page. - * + * * @return The accessibility prefix */ public String getAssistivePrefix() { @@ -1242,10 +1204,10 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Sets the accessibility postfix for the window caption. - * + * * This postfix is read to assistive device users after the window caption, * but not visible on the page. - * + * * @param prefix * String that is placed after the window caption */ @@ -1255,10 +1217,10 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Gets the accessibility postfix for the window caption. - * + * * This postfix is read to assistive device users after the window caption, * but not visible on the page. - * + * * @return The accessibility postfix */ public String getAssistivePostfix() { @@ -1267,14 +1229,14 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Sets the WAI-ARIA role the window. - * + * * This role defines how an assistive device handles a window. Available - * roles are alertdialog and dialog (@see <a - * href="http://www.w3.org/TR/2011/CR-wai-aria-20110118/roles">Roles + * roles are alertdialog and dialog (@see + * <a href="http://www.w3.org/TR/2011/CR-wai-aria-20110118/roles">Roles * Model</a>). - * + * * The default role is dialog. - * + * * @param role * WAI-ARIA role to set for the window */ @@ -1284,12 +1246,12 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Gets the WAI-ARIA role the window. - * + * * This role defines how an assistive device handles a window. Available - * roles are alertdialog and dialog (@see <a - * href="http://www.w3.org/TR/2011/CR-wai-aria-20110118/roles">Roles + * roles are alertdialog and dialog (@see + * <a href="http://www.w3.org/TR/2011/CR-wai-aria-20110118/roles">Roles * Model</a>). - * + * * @return WAI-ARIA role set for the window */ public WindowRole getAssistiveRole() { @@ -1305,7 +1267,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * <p> * For modal windows, this function is activated automatically, while * preserving the stored value of tabStop. - * + * * @param tabStop * true to keep the focus inside the window when reaching the top * or bottom, false (default) to allow leaving the window @@ -1316,7 +1278,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Get if it is prevented to leave a window with the tab key. - * + * * @return true when the focus is limited to inside the window, false when * focus can leave the window */ @@ -1330,7 +1292,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * is prevented. * <p> * This message is not visible on the screen. - * + * * @param topMessage * String provided when the user navigates with Shift-Tab keys to * the top of the window @@ -1345,7 +1307,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * key is prevented. * <p> * This message is not visible on the screen. - * + * * @param bottomMessage * String provided when the user navigates with the Tab key to * the bottom of the window @@ -1358,7 +1320,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * Gets the message that is provided to users of assistive devices when the * user reaches the top of the window when leaving a window with the tab key * is prevented. - * + * * @return the top message */ public String getTabStopTopAssistiveText() { @@ -1369,7 +1331,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * Gets the message that is provided to users of assistive devices when the * user reaches the bottom of the window when leaving a window with the tab * key is prevented. - * + * * @return the bottom message */ public String getTabStopBottomAssistiveText() { @@ -1393,17 +1355,18 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, if (design.hasAttr("close-shortcut")) { // Parse shortcuts - String[] shortcutStrings = DesignAttributeHandler.readAttribute( - "close-shortcut", design.attributes(), String.class).split( - "\\s+"); + String[] shortcutStrings = DesignAttributeHandler + .readAttribute("close-shortcut", design.attributes(), + String.class) + .split("\\s+"); removeAllCloseShortcuts(); for (String part : shortcutStrings) { if (!part.isEmpty()) { ShortcutAction shortcut = DesignAttributeHandler - .getFormatter().parse(part.trim(), - ShortcutAction.class); + .getFormatter() + .parse(part.trim(), ShortcutAction.class); addCloseShortcut(shortcut.getKeyCode(), shortcut.getModifiers()); } @@ -1418,22 +1381,23 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, * the list of components used as the assistive description of this Window. * Otherwise, sets the component as the content of this Window. If there are * multiple non-description elements, throws a DesignException. - * + * * @param children * child elements in a design * @param context * the DesignContext instance used to parse the design - * + * * @throws DesignException * if there are multiple non-description child elements * @throws DesignException * if a child element could not be parsed as a Component - * + * * @see #setContent(Component) * @see #setAssistiveDescription(Component...) */ @Override - protected void readDesignChildren(Elements children, DesignContext context) { + protected void readDesignChildren(Elements children, + DesignContext context) { List<Component> descriptions = new ArrayList<Component>(); Elements content = new Elements(); @@ -1482,8 +1446,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, } for (Component c : getAssistiveDescription()) { - Element child = context.createElement(c).attr( - ":assistive-description", true); + Element child = context.createElement(c) + .attr(":assistive-description", true); design.appendChild(child); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractTextFieldTest.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractTextFieldTest.java index 6e2920cf63..fcf10ed162 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractTextFieldTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractTextFieldTest.java @@ -46,9 +46,9 @@ public abstract class AbstractTextFieldTest<T extends AbstractTextField> @Override public void execute(T c, Boolean value, Object data) { if (value) { - c.addListener((TextChangeListener) AbstractTextFieldTest.this); + c.addTextChangeListener(AbstractTextFieldTest.this); } else { - c.removeListener((TextChangeListener) AbstractTextFieldTest.this); + c.removeTextChangeListener(AbstractTextFieldTest.this); } } }; diff --git a/uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java b/uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java index 58aab16269..1ae33c1d8d 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java @@ -32,13 +32,13 @@ public class TextAreaCursorPosition extends TestBase { AbstractTextField newTextField = (AbstractTextField) newField; newTextField.setTextChangeEventMode(TextChangeEventMode.EAGER); - newTextField.addListener(new TextChangeListener() { + newTextField.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { AbstractTextField component = (AbstractTextField) event .getComponent(); - cursorPosition.setValue(String.valueOf(component - .getCursorPosition())); + cursorPosition.setValue( + String.valueOf(component.getCursorPosition())); } }); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java index 24feab5cab..5832b605e8 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java @@ -19,7 +19,7 @@ public class MultipleTextChangeEvents extends TestBase { TextField tf = new TextField(); tf.setTextChangeEventMode(TextChangeEventMode.TIMEOUT); tf.setTextChangeTimeout(500); - tf.addListener(new TextChangeListener() { + tf.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { log.log("TextChangeEvent: " + event.getText()); diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java index 531392b84a..125dff6e4e 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java @@ -28,27 +28,27 @@ public class TextChangeEvents extends TestBase { } }; - tf.addListener(inputEventListener); + tf.addTextChangeListener(inputEventListener); getLayout().addComponent(tf); TextField eager = new TextField("Eager"); - eager.addListener(inputEventListener); + eager.addTextChangeListener(inputEventListener); eager.setTextChangeEventMode(TextChangeEventMode.EAGER); getLayout().addComponent(eager); TextField to = new TextField("Timeout 3s"); - to.addListener(inputEventListener); + to.addTextChangeListener(inputEventListener); to.setTextChangeEventMode(TextChangeEventMode.TIMEOUT); to.setTextChangeTimeout(3000); getLayout().addComponent(to); TextArea ta = new TextArea("Default text area"); - ta.addListener(inputEventListener); + ta.addTextChangeListener(inputEventListener); getLayout().addComponent(ta); VaadinDeveloperNameField vd = new VaadinDeveloperNameField(); - vd.addListener(inputEventListener); + vd.addTextChangeListener(inputEventListener); getLayout().addComponent(vd); getLayout().addComponent(l); @@ -66,22 +66,22 @@ public class TextChangeEvents extends TestBase { /** * "Autosuggest" - * + * * Known issue is timing if suggestion comes while typing more content. IMO * we will not support this kind of features in default TextField, but * hopefully make it easily extendable to perfect suggest feature. MT * 2010-10 - * + * */ - private class VaadinDeveloperNameField extends TextField implements - TextChangeListener { + private class VaadinDeveloperNameField extends TextField + implements TextChangeListener { private String[] names = new String[] { "Matti Tahvonen", "Marc Englund", "Joonas Lehtinen", "Jouni Koivuviita", "Marko Grönroos", "Artur Signell" }; public VaadinDeveloperNameField() { setCaption("Start typing 'old' Vaadin developers."); - addListener((TextChangeListener) this); + addTextChangeListener(this); setStyleName("nomatch"); } @@ -94,7 +94,8 @@ public class TextChangeEvents extends TestBase { @Override public void textChange(TextChangeEvent event) { - boolean atTheEndOfText = event.getText().length() == getCursorPosition(); + boolean atTheEndOfText = event.getText() + .length() == getCursorPosition(); String match = findMatch(event.getText()); if (match != null) { setStyleName("match"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents2.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents2.java index 848d2a3228..67eaf52f33 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents2.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents2.java @@ -22,7 +22,7 @@ public class TextChangeEvents2 extends TestBase { final TextField tf = new TextField("Debug"); getLayout().addComponent(tf); - tf.addListener(new TextChangeListener() { + tf.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { System.err.println(tf.getCaption() + " textChange"); @@ -58,7 +58,7 @@ public class TextChangeEvents2 extends TestBase { getLayout().addComponent(tf); final Label l = new Label(); getLayout().addComponent(l); - tf.addListener(new TextChangeListener() { + tf.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { l.setValue(event.getText()); @@ -81,7 +81,7 @@ public class TextChangeEvents2 extends TestBase { getLayout().addComponent(tf); final Label l = new Label(); getLayout().addComponent(l); - tf.addListener(new TextChangeListener() { + tf.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { @@ -104,7 +104,7 @@ public class TextChangeEvents2 extends TestBase { getLayout().addComponent(tf); final Label l = new Label(); getLayout().addComponent(l); - tf.addListener(new TextChangeListener() { + tf.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { @@ -132,7 +132,7 @@ public class TextChangeEvents2 extends TestBase { tf.setTextChangeEventMode(TextChangeEventMode.EAGER); hl.addComponent(tf); - tf.addListener(new TextChangeListener() { + tf.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { @@ -149,8 +149,8 @@ public class TextChangeEvents2 extends TestBase { TextField next = tfs[idx + 1]; next.focus(); if (len > 4) { - next.setValue(txt.substring(4, len > 8 ? 8 - : len)); + next.setValue(txt.substring(4, + len > 8 ? 8 : len)); } else { next.selectAll(); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsEternalLoop.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsEternalLoop.java index 331c8d2efc..ae794fcf21 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsEternalLoop.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsEternalLoop.java @@ -12,7 +12,7 @@ public class TextChangeEventsEternalLoop extends TestBase { final TextField tf = new TextField("Debug"); getLayout().addComponent(tf); - tf.addListener(new TextChangeListener() { + tf.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { tf.setValue(event.getText()); diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsWithNonImmediateValueChange.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsWithNonImmediateValueChange.java index ebb8b88411..eebb26d45e 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsWithNonImmediateValueChange.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsWithNonImmediateValueChange.java @@ -26,7 +26,7 @@ public class TextChangeEventsWithNonImmediateValueChange extends TestBase { } }; - tf.addListener(inputEventListener); + tf.addTextChangeListener(inputEventListener); // tf.setImmediate(true); // works when this is set diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerChangingNonTextProperties.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerChangingNonTextProperties.java index 5991ac6ff7..5cf5d390e4 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerChangingNonTextProperties.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerChangingNonTextProperties.java @@ -22,15 +22,12 @@ public class TextChangeListenerChangingNonTextProperties extends TestBase { @Override public void attach() { super.attach(); - TestUtils - .injectCSS( - getUI(), - ".red { background:red;} " - + ".green { background:green;} .blue { background:blue;} .cyan { background:cyan;} .magenta { background:magenta;}"); + TestUtils.injectCSS(getUI(), ".red { background:red;} " + + ".green { background:green;} .blue { background:blue;} .cyan { background:cyan;} .magenta { background:magenta;}"); } }; tf2.setTextChangeEventMode(TextChangeEventMode.EAGER); - tf2.addListener(new TextChangeListener() { + tf2.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { tf2.setStyleName(getNextStyle()); diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.java index ed74c83616..ceed6f004d 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.java @@ -28,6 +28,7 @@ import com.vaadin.ui.TextField; public class TextChangeListenerLosesFocus extends TestBase { private final TextChangeListener listener = new TextChangeListener() { + @Override public void textChange(TextChangeEvent event) { final String value = event.getText(); if (value.length() > 2) { @@ -46,13 +47,13 @@ public class TextChangeListenerLosesFocus extends TestBase { AbstractTextField field = new TextField(); field.setDebugId("test-textfield"); field.setInputPrompt("Enter at least 3 characters"); - field.addListener(listener); + field.addTextChangeListener(listener); addComponent(field); field = new TextArea(); field.setDebugId("test-textarea"); field.setInputPrompt("Enter at least 3 characters"); - field.addListener(listener); + field.addTextChangeListener(listener); addComponent(field); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeTimeoutAfterDetach.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeTimeoutAfterDetach.java index 00783e0106..17a3995cc6 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeTimeoutAfterDetach.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeTimeoutAfterDetach.java @@ -17,7 +17,7 @@ public class TextChangeTimeoutAfterDetach extends TestBase { field.setImmediate(false); field.setTextChangeTimeout(2000); field.setTextChangeEventMode(TextChangeEventMode.TIMEOUT); - field.addListener(new TextChangeListener() { + field.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { // Need to add a listener for events to occur diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldEagerRepaint.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldEagerRepaint.java index e103afbe62..aee216d97d 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldEagerRepaint.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldEagerRepaint.java @@ -13,7 +13,7 @@ public class TextFieldEagerRepaint extends TestBase { final TextField tf1 = new TextField("Updates value"); tf1.setTextChangeEventMode(TextChangeEventMode.EAGER); - tf1.addListener(new TextChangeListener() { + tf1.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { String text = event.getText(); @@ -26,7 +26,7 @@ public class TextFieldEagerRepaint extends TestBase { final TextField tf2 = new TextField("Updates width"); tf2.setTextChangeEventMode(TextChangeEventMode.EAGER); - tf2.addListener(new TextChangeListener() { + tf2.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { String text = event.getText(); |