From 45034ab571c5d185f5faa58b958ad9f258a0bff4 Mon Sep 17 00:00:00 2001
From: Artur Signell
- * Note: The general Java convention is not to explicitly declare that a
- * class generates events, but to directly define the
- *
- * Note: The general Java convention is not to explicitly declare that a
- * class generates events, but to directly define the
- * FocusEvent
listeners.
* By implementing this interface a class explicitly announces that it will
* generate a FocusEvent
when it receives keyboard focus.
- * addListener
and removeListener
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.
- * FocusListener
to the Component which gets fired
* when a LegacyField
receives keyboard focus.
- *
+ *
* @param listener
* @see FocusListener
* @since 6.2
*/
public void addFocusListener(FocusListener listener);
- /**
- * @deprecated As of 7.0, replaced by
- * {@link #addFocusListener(FocusListener)}
- **/
- @Deprecated
- public void addListener(FocusListener listener);
-
/**
* Removes a FocusListener
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 BlurEvent
listeners.
* By implementing this interface a class explicitly announces that it will
* generate a BlurEvent
when it loses keyboard focus.
- * addListener
and removeListener
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.
- * BlurListener
to the Component which gets fired
* when a LegacyField
loses keyboard focus.
- *
+ *
* @param listener
* @see BlurListener
* @since 6.2
*/
public void addBlurListener(BlurListener listener);
- /**
- * @deprecated As of 7.0, replaced by
- * {@link #addBlurListener(BlurListener)}
- **/
- @Deprecated
- public void addListener(BlurListener listener);
-
/**
* Removes a BlurListener
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);
}
/**
* FocusEvent
class for holding additional event information.
* Fired when a LegacyField
receives keyboard focus.
- *
+ *
* @since 6.2
*/
@SuppressWarnings("serial")
@@ -159,18 +117,18 @@ public interface FieldEvents {
/**
* FocusListener
interface for listening for
* FocusEvent
fired by a LegacyField
.
- *
+ *
* @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 {
/**
* BlurEvent
class for holding additional event information.
* Fired when a LegacyField
loses keyboard focus.
- *
+ *
* @since 6.2
*/
@SuppressWarnings("serial")
@@ -199,18 +157,18 @@ public interface FieldEvents {
/**
* BlurListener
interface for listening for
* BlurEvent
fired by a LegacyField
.
- *
+ *
* @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.
*
DateField
with caption.
- *
+ *
* @param caption
* the caption of the datefield.
*/
@@ -198,7 +198,7 @@ public class LegacyDateField extends LegacyAbstractFieldDateField
that's bound to the specified
* Property
and has the given caption String
.
- *
+ *
* @param caption
* the caption String
for the editor.
* @param dataSource
@@ -212,7 +212,7 @@ public class LegacyDateField extends LegacyAbstractFieldDateField
that's bound to the specified
* Property
and has no caption.
- *
+ *
* @param dataSource
* the Property to be edited with this editor.
*/
@@ -233,7 +233,7 @@ public class LegacyDateField extends LegacyAbstractFieldString
for the editor.
* @param value
@@ -315,7 +315,7 @@ public class LegacyDateField extends LegacyAbstractFieldstartDate
is set to null
, any
* value before endDate
will be accepted by the range
- *
+ *
* @param startDate
* - the allowed range's start date
*/
@@ -335,7 +335,7 @@ public class LegacyDateField extends LegacyAbstractFieldrangeStart
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 LegacyAbstractFieldendDate
is set to null
, any value
* after startDate
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 LegacyAbstractFieldCalendar.getInstance
* is used.
- *
+ *
* @return the Calendar.
* @see #setCalendar(Calendar)
*/
@@ -842,14 +842,14 @@ public class LegacyDateField extends LegacyAbstractField* 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. *
- * + * ** The default value is string 'null'. *
- * + * * @return the String Textual representation for null strings. * @see TextField#isNullSettingAllowed() */ @@ -253,7 +255,7 @@ public abstract class AbstractTextField extends LegacyAbstractField
* 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
* By default this setting is false *
- * + * * @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* 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. *
- * + * ** The default value is string 'null' *
- * + * * @param nullRepresentation * Textual representation for null strings. * @see TextField#setNullSettingAllowed(boolean) @@ -299,7 +301,7 @@ public abstract class AbstractTextField extends LegacyAbstractField
* 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
* By default this setting is false. *
- * + * * @param nullSettingAllowed * Should the null-string representation always be converted to * null-values. @@ -331,7 +333,7 @@ public abstract class AbstractTextField extends LegacyAbstractField
* 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 LegacyAbstractFieldITEM_CAPTION_MODE_PROPERTY
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 v-filterselect-item-[style name].
- *
+ *
* @param itemStyleGenerator
* the item style generator to set, or null
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 null
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
* Note! Currently only supported by TabSheet, not Accordion. *
- * + * * @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. - * + * ** 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: * - * + * ** .v-tabsheet-tabitemcell-mystyle {font-style: italic;} *- * + * ** This method will trigger a {@link RepaintRequestEvent} on the * TabSheet to which the Tab belongs. *
- * + * * @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. ** 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. *
* 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)}.
+ * {@link UI#addWindow(Window)}. + * ** 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. *
- * + * * @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 ListcloseShortcuts = new ArrayList (4); + private List closeShortcuts = new ArrayList ( + 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). - * + * * * By default, windows are removed from their respective UIs and thus * visually closed on browser-side. *
- * + * ** 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. - * + * *
* 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. - * + * *
* Since Vaadin 6.5, removing windows using {@link #removeWindow(Window)} * does fire the CloseListener. *
- * + * * @param listener * the CloseListener to add. */ @@ -424,11 +423,11 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, /** * Removes the CloseListener from the window. - * + * ** For more information on CloseListeners see {@link CloseListener}. *
- * + * * @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, ** 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. *
- * + * * @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. * - * + * * @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. * - * + * * @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. * - * + * * @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. - * + * **- * + * */ 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 Roles + * roles are alertdialog and dialog (@see + * Roles * Model). - * + * * 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 Roles + * roles are alertdialog and dialog (@see + * Roles * Model). - * + * * @return WAI-ARIA role set for the window */ public WindowRole getAssistiveRole() { @@ -1305,7 +1267,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier, ** // within the window using helper * window.setCloseShortcut(KeyCode.ESCAPE, null); - * + * * // or globally * getUI().addAction(new Window.CloseShortcut(window, KeyCode.ESCAPE)); *
** 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. *
* 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. *
* 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
descriptions = new ArrayList (); 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 @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(); -- cgit v1.2.3