From: Pekka Hyvönen Date: Mon, 10 Sep 2012 19:12:47 +0000 (+0300) Subject: Constants -> enums (#9072) X-Git-Tag: 7.0.0.beta1~51 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0f5284bb827b5f04c6c064c851b851604293665a;p=vaadin-framework.git Constants -> enums (#9072) Patch from Pekka with minor changes (ButtonCode -> MouseButton, FilteringMode -> ComboBox) --- diff --git a/client/src/com/vaadin/client/DateTimeService.java b/client/src/com/vaadin/client/DateTimeService.java index f33c69576a..caadd5412c 100644 --- a/client/src/com/vaadin/client/DateTimeService.java +++ b/client/src/com/vaadin/client/DateTimeService.java @@ -20,7 +20,7 @@ import java.util.Date; import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.i18n.client.LocaleInfo; -import com.vaadin.client.ui.datefield.VDateField; +import com.vaadin.shared.ui.datefield.Resolution; /** * This class provides date/time parsing services to all components on the @@ -201,7 +201,7 @@ public class DateTimeService { } public static boolean isInRange(Date date, Date rangeStart, Date rangeEnd, - int resolution) { + Resolution resolution) { Date s; Date e; if (rangeStart.after(rangeEnd)) { @@ -215,31 +215,31 @@ public class DateTimeService { long end = e.getYear() * 10000000000l; long target = date.getYear() * 10000000000l; - if (resolution == VDateField.RESOLUTION_YEAR) { + if (resolution == Resolution.YEAR) { return (start <= target && end >= target); } start += s.getMonth() * 100000000l; end += e.getMonth() * 100000000l; target += date.getMonth() * 100000000l; - if (resolution == VDateField.RESOLUTION_MONTH) { + if (resolution == Resolution.MONTH) { return (start <= target && end >= target); } start += s.getDate() * 1000000l; end += e.getDate() * 1000000l; target += date.getDate() * 1000000l; - if (resolution == VDateField.RESOLUTION_DAY) { + if (resolution == Resolution.DAY) { return (start <= target && end >= target); } start += s.getHours() * 10000l; end += e.getHours() * 10000l; target += date.getHours() * 10000l; - if (resolution == VDateField.RESOLUTION_HOUR) { + if (resolution == Resolution.HOUR) { return (start <= target && end >= target); } start += s.getMinutes() * 100l; end += e.getMinutes() * 100l; target += date.getMinutes() * 100l; - if (resolution == VDateField.RESOLUTION_MIN) { + if (resolution == Resolution.MINUTE) { return (start <= target && end >= target); } start += s.getSeconds(); diff --git a/client/src/com/vaadin/client/MouseEventDetailsBuilder.java b/client/src/com/vaadin/client/MouseEventDetailsBuilder.java index 2e8d669844..cda2eec07f 100644 --- a/client/src/com/vaadin/client/MouseEventDetailsBuilder.java +++ b/client/src/com/vaadin/client/MouseEventDetailsBuilder.java @@ -19,6 +19,7 @@ import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.user.client.Event; import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.MouseEventDetails.MouseButton; /** * Helper class for constructing a MouseEventDetails object from a @@ -58,7 +59,13 @@ public class MouseEventDetailsBuilder { mouseEventDetails.setType(Event.getTypeInt(evt.getType())); mouseEventDetails.setClientX(Util.getTouchOrMouseClientX(evt)); mouseEventDetails.setClientY(Util.getTouchOrMouseClientY(evt)); - mouseEventDetails.setButton(evt.getButton()); + if (evt.getButton() == NativeEvent.BUTTON_LEFT) { + mouseEventDetails.setButton(MouseButton.LEFT); + } else if (evt.getButton() == NativeEvent.BUTTON_RIGHT) { + mouseEventDetails.setButton(MouseButton.RIGHT); + } else if (evt.getButton() == NativeEvent.BUTTON_MIDDLE) { + mouseEventDetails.setButton(MouseButton.MIDDLE); + } mouseEventDetails.setAltKey(evt.getAltKey()); mouseEventDetails.setCtrlKey(evt.getCtrlKey()); mouseEventDetails.setMetaKey(evt.getMetaKey()); diff --git a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java index d89836d6e2..bcab8e71fc 100644 --- a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java +++ b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java @@ -27,6 +27,7 @@ import com.vaadin.client.ui.combobox.VFilterSelect.FilterSelectSuggestion; import com.vaadin.client.ui.menubar.MenuItem; import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.combobox.ComboBoxConstants; +import com.vaadin.shared.ui.combobox.FilteringMode; import com.vaadin.ui.ComboBox; @Connect(ComboBox.class) @@ -68,7 +69,8 @@ public class ComboBoxConnector extends AbstractFieldConnector implements } if (uidl.hasAttribute("filteringmode")) { - getWidget().filteringmode = uidl.getIntAttribute("filteringmode"); + getWidget().filteringmode = FilteringMode.valueOf(uidl + .getStringAttribute("filteringmode")); } getWidget().immediate = getState().immediate; diff --git a/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java b/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java index 8692622892..203f982180 100644 --- a/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java +++ b/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java @@ -73,6 +73,7 @@ import com.vaadin.client.ui.menubar.MenuItem; import com.vaadin.shared.ComponentState; import com.vaadin.shared.EventId; import com.vaadin.shared.ui.ComponentStateUtil; +import com.vaadin.shared.ui.combobox.FilteringMode; /** * Client side implementation of the Select component. @@ -741,7 +742,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, } } else if (item != null && !"".equals(lastFilter) - && (filteringmode == FILTERINGMODE_CONTAINS ? item + && (filteringmode == FilteringMode.CONTAINS ? item .getText().toLowerCase() .contains(lastFilter.toLowerCase()) : item .getText().toLowerCase() @@ -827,9 +828,12 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, } } - public static final int FILTERINGMODE_OFF = 0; - public static final int FILTERINGMODE_STARTSWITH = 1; - public static final int FILTERINGMODE_CONTAINS = 2; + @Deprecated + public static final FilteringMode FILTERINGMODE_OFF = FilteringMode.OFF; + @Deprecated + public static final FilteringMode FILTERINGMODE_STARTSWITH = FilteringMode.STARTSWITH; + @Deprecated + public static final FilteringMode FILTERINGMODE_CONTAINS = FilteringMode.CONTAINS; private static final String CLASSNAME = "v-filterselect"; private static final String STYLE_NO_INPUT = "no-input"; @@ -928,7 +932,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler, protected boolean enabled; protected boolean readonly; - protected int filteringmode = FILTERINGMODE_OFF; + protected FilteringMode filteringmode = FilteringMode.OFF; // shown in unfocused empty field, disappears on focus (e.g "Search here") private static final String CLASSNAME_PROMPT = "prompt"; diff --git a/client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java index cc98767e00..994a9e1d66 100644 --- a/client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java +++ b/client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java @@ -24,6 +24,7 @@ import com.vaadin.client.UIDL; import com.vaadin.client.VConsole; import com.vaadin.client.ui.AbstractFieldConnector; import com.vaadin.shared.ui.datefield.DateFieldConstants; +import com.vaadin.shared.ui.datefield.Resolution; public class AbstractDateFieldConnector extends AbstractFieldConnector implements Paintable { @@ -62,19 +63,19 @@ public class AbstractDateFieldConnector extends AbstractFieldConnector .getBooleanAttribute(DateFieldConstants.ATTR_WEEK_NUMBERS) && getWidget().dts.getFirstDayOfWeek() == 1; - int newResolution; + Resolution newResolution; if (uidl.hasVariable("sec")) { - newResolution = VDateField.RESOLUTION_SEC; + newResolution = Resolution.SECOND; } else if (uidl.hasVariable("min")) { - newResolution = VDateField.RESOLUTION_MIN; + newResolution = Resolution.MINUTE; } else if (uidl.hasVariable("hour")) { - newResolution = VDateField.RESOLUTION_HOUR; + newResolution = Resolution.HOUR; } else if (uidl.hasVariable("day")) { - newResolution = VDateField.RESOLUTION_DAY; + newResolution = Resolution.DAY; } else if (uidl.hasVariable("month")) { - newResolution = VDateField.RESOLUTION_MONTH; + newResolution = Resolution.MONTH; } else { - newResolution = VDateField.RESOLUTION_YEAR; + newResolution = Resolution.YEAR; } // Remove old stylename that indicates current resolution @@ -96,16 +97,16 @@ public class AbstractDateFieldConnector extends AbstractFieldConnector true); final int year = uidl.getIntVariable("year"); - final int month = (getWidget().currentResolution >= VDateField.RESOLUTION_MONTH) ? uidl - .getIntVariable("month") : -1; - final int day = (getWidget().currentResolution >= VDateField.RESOLUTION_DAY) ? uidl - .getIntVariable("day") : -1; - final int hour = (getWidget().currentResolution >= VDateField.RESOLUTION_HOUR) ? uidl - .getIntVariable("hour") : 0; - final int min = (getWidget().currentResolution >= VDateField.RESOLUTION_MIN) ? uidl - .getIntVariable("min") : 0; - final int sec = (getWidget().currentResolution >= VDateField.RESOLUTION_SEC) ? uidl - .getIntVariable("sec") : 0; + final int month = (getWidget().currentResolution.getCalendarField() >= Resolution.MONTH + .getCalendarField()) ? uidl.getIntVariable("month") : -1; + final int day = (getWidget().currentResolution.getCalendarField() >= Resolution.DAY + .getCalendarField()) ? uidl.getIntVariable("day") : -1; + final int hour = (getWidget().currentResolution.getCalendarField() >= Resolution.HOUR + .getCalendarField()) ? uidl.getIntVariable("hour") : 0; + final int min = (getWidget().currentResolution.getCalendarField() >= Resolution.MINUTE + .getCalendarField()) ? uidl.getIntVariable("min") : 0; + final int sec = (getWidget().currentResolution.getCalendarField() >= Resolution.SECOND + .getCalendarField()) ? uidl.getIntVariable("sec") : 0; // Construct new date for this datefield (only if not null) if (year > -1) { diff --git a/client/src/com/vaadin/client/ui/datefield/InlineDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/InlineDateFieldConnector.java index 0bcb828b19..2f2dd380d6 100644 --- a/client/src/com/vaadin/client/ui/datefield/InlineDateFieldConnector.java +++ b/client/src/com/vaadin/client/ui/datefield/InlineDateFieldConnector.java @@ -23,6 +23,7 @@ import com.vaadin.client.UIDL; import com.vaadin.client.ui.datefield.VCalendarPanel.FocusChangeListener; import com.vaadin.client.ui.datefield.VCalendarPanel.TimeChangeListener; import com.vaadin.shared.ui.Connect; +import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.ui.InlineDateField; @Connect(InlineDateField.class) @@ -49,7 +50,8 @@ public class InlineDateFieldConnector extends AbstractDateFieldConnector { getWidget().calendarPanel.setDate(null); } - if (getWidget().currentResolution > VDateField.RESOLUTION_DAY) { + if (getWidget().currentResolution.getCalendarField() > Resolution.DAY + .getCalendarField()) { getWidget().calendarPanel .setTimeChangeListener(new TimeChangeListener() { @Override @@ -74,7 +76,8 @@ public class InlineDateFieldConnector extends AbstractDateFieldConnector { }); } - if (getWidget().currentResolution <= VDateField.RESOLUTION_MONTH) { + if (getWidget().currentResolution.getCalendarField() <= Resolution.MONTH + .getCalendarField()) { getWidget().calendarPanel .setFocusChangeListener(new FocusChangeListener() { @Override diff --git a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java index d09f3a4db6..f5be276575 100644 --- a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java +++ b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java @@ -24,6 +24,7 @@ import com.vaadin.client.UIDL; import com.vaadin.client.ui.datefield.VCalendarPanel.FocusChangeListener; import com.vaadin.client.ui.datefield.VCalendarPanel.TimeChangeListener; import com.vaadin.shared.ui.Connect; +import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.ui.DateField; @Connect(DateField.class) @@ -60,7 +61,8 @@ public class PopupDateFieldConnector extends TextualDateConnector { } getWidget().calendarToggle.setEnabled(getWidget().enabled); - if (getWidget().currentResolution <= VPopupCalendar.RESOLUTION_MONTH) { + if (getWidget().currentResolution.getCalendarField() <= Resolution.MONTH + .getCalendarField()) { getWidget().calendar .setFocusChangeListener(new FocusChangeListener() { @Override @@ -76,7 +78,8 @@ public class PopupDateFieldConnector extends TextualDateConnector { getWidget().calendar.setFocusChangeListener(null); } - if (getWidget().currentResolution > VPopupCalendar.RESOLUTION_DAY) { + if (getWidget().currentResolution.getCalendarField() > Resolution.DAY + .getCalendarField()) { getWidget().calendar .setTimeChangeListener(new TimeChangeListener() { @Override diff --git a/client/src/com/vaadin/client/ui/datefield/TextualDateConnector.java b/client/src/com/vaadin/client/ui/datefield/TextualDateConnector.java index f0a99192fa..ef4b53f9f4 100644 --- a/client/src/com/vaadin/client/ui/datefield/TextualDateConnector.java +++ b/client/src/com/vaadin/client/ui/datefield/TextualDateConnector.java @@ -18,12 +18,13 @@ package com.vaadin.client.ui.datefield; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.UIDL; +import com.vaadin.shared.ui.datefield.Resolution; public class TextualDateConnector extends AbstractDateFieldConnector { @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { - int origRes = getWidget().currentResolution; + Resolution origRes = getWidget().currentResolution; String oldLocale = getWidget().currentLocale; super.updateFromUIDL(uidl, client); if (origRes != getWidget().currentResolution diff --git a/client/src/com/vaadin/client/ui/datefield/VCalendarPanel.java b/client/src/com/vaadin/client/ui/datefield/VCalendarPanel.java index 9d519e3179..0d21638417 100644 --- a/client/src/com/vaadin/client/ui/datefield/VCalendarPanel.java +++ b/client/src/com/vaadin/client/ui/datefield/VCalendarPanel.java @@ -56,6 +56,7 @@ import com.vaadin.client.ui.FocusableFlexTable; import com.vaadin.client.ui.SubPartAware; import com.vaadin.client.ui.label.VLabel; import com.vaadin.client.ui.nativeselect.VNativeSelect; +import com.vaadin.shared.ui.datefield.Resolution; @SuppressWarnings("deprecation") public class VCalendarPanel extends FocusableFlexTable implements @@ -162,7 +163,7 @@ public class VCalendarPanel extends FocusableFlexTable implements private FlexTable days = new FlexTable(); - private int resolution = VDateField.RESOLUTION_YEAR; + private Resolution resolution = Resolution.YEAR; private int focusedRow; @@ -225,7 +226,7 @@ public class VCalendarPanel extends FocusableFlexTable implements */ private void focusDay(Date date) { // Only used when calender body is present - if (resolution > VDateField.RESOLUTION_MONTH) { + if (resolution.getCalendarField() > Resolution.MONTH.getCalendarField()) { if (focusedDay != null) { focusedDay.removeStyleDependentName(CN_FOCUSED); } @@ -321,11 +322,11 @@ public class VCalendarPanel extends FocusableFlexTable implements return false; } - public int getResolution() { + public Resolution getResolution() { return resolution; } - public void setResolution(int resolution) { + public void setResolution(Resolution resolution) { this.resolution = resolution; if (time != null) { time.removeFromParent(); @@ -492,7 +493,8 @@ public class VCalendarPanel extends FocusableFlexTable implements if (day > 6) { day = 0; } - if (getResolution() > VDateField.RESOLUTION_MONTH) { + if (getResolution().getCalendarField() > Resolution.MONTH + .getCalendarField()) { days.setHTML(headerRow, firstWeekdayColumn + i, "" + getDateTimeService().getShortDay(day) + ""); } else { @@ -568,7 +570,8 @@ public class VCalendarPanel extends FocusableFlexTable implements * @return True if it is required */ private boolean isTimeSelectorNeeded() { - return getResolution() > VDateField.RESOLUTION_DAY; + return getResolution().getCalendarField() > Resolution.DAY + .getCalendarField(); } /** @@ -582,13 +585,15 @@ public class VCalendarPanel extends FocusableFlexTable implements displayedMonth = new Date(now.getYear(), now.getMonth(), 1); } - if (getResolution() <= VDateField.RESOLUTION_MONTH - && focusChangeListener != null) { + if (getResolution().getCalendarField() <= Resolution.MONTH + .getCalendarField() && focusChangeListener != null) { focusChangeListener.focusChanged(new Date(focusedDate.getTime())); } - final boolean needsMonth = getResolution() > VDateField.RESOLUTION_YEAR; - boolean needsBody = getResolution() >= VDateField.RESOLUTION_DAY; + final boolean needsMonth = getResolution().getCalendarField() > Resolution.YEAR + .getCalendarField(); + boolean needsBody = getResolution().getCalendarField() >= Resolution.DAY + .getCalendarField(); buildCalendarHeader(needsMonth); clearCalendarBody(!needsBody); if (needsBody) { @@ -1048,15 +1053,15 @@ public class VCalendarPanel extends FocusableFlexTable implements return false; } - else if (resolution == VDateField.RESOLUTION_YEAR) { + else if (resolution == Resolution.YEAR) { return handleNavigationYearMode(keycode, ctrl, shift); } - else if (resolution == VDateField.RESOLUTION_MONTH) { + else if (resolution == Resolution.MONTH) { return handleNavigationMonthMode(keycode, ctrl, shift); } - else if (resolution == VDateField.RESOLUTION_DAY) { + else if (resolution == Resolution.DAY) { return handleNavigationDayMode(keycode, ctrl, shift); } @@ -1311,14 +1316,16 @@ public class VCalendarPanel extends FocusableFlexTable implements ampm.addChangeHandler(this); } - if (getResolution() >= VDateField.RESOLUTION_MIN) { + if (getResolution().getCalendarField() >= Resolution.MINUTE + .getCalendarField()) { mins = createListBox(); for (int i = 0; i < 60; i++) { mins.addItem((i < 10) ? "0" + i : "" + i); } mins.addChangeHandler(this); } - if (getResolution() >= VDateField.RESOLUTION_SEC) { + if (getResolution().getCalendarField() >= Resolution.SECOND + .getCalendarField()) { sec = createListBox(); for (int i = 0; i < 60; i++) { sec.addItem((i < 10) ? "0" + i : "" + i); @@ -1340,7 +1347,8 @@ public class VCalendarPanel extends FocusableFlexTable implements add(hours); } - if (getResolution() >= VDateField.RESOLUTION_MIN) { + if (getResolution().getCalendarField() >= Resolution.MINUTE + .getCalendarField()) { add(new VLabel(delimiter)); if (isReadonly()) { final int m = mins.getSelectedIndex(); @@ -1349,7 +1357,8 @@ public class VCalendarPanel extends FocusableFlexTable implements add(mins); } } - if (getResolution() >= VDateField.RESOLUTION_SEC) { + if (getResolution().getCalendarField() >= Resolution.SECOND + .getCalendarField()) { add(new VLabel(delimiter)); if (isReadonly()) { final int s = sec.getSelectedIndex(); @@ -1358,7 +1367,7 @@ public class VCalendarPanel extends FocusableFlexTable implements add(sec); } } - if (getResolution() == VDateField.RESOLUTION_HOUR) { + if (getResolution() == Resolution.HOUR) { add(new VLabel(delimiter + "00")); // o'clock } if (getDateTimeService().isTwelveHourClock()) { @@ -1428,10 +1437,12 @@ public class VCalendarPanel extends FocusableFlexTable implements } else { hours.setSelectedIndex(value.getHours()); } - if (getResolution() >= VDateField.RESOLUTION_MIN) { + if (getResolution().getCalendarField() >= Resolution.MINUTE + .getCalendarField()) { mins.setSelectedIndex(value.getMinutes()); } - if (getResolution() >= VDateField.RESOLUTION_SEC) { + if (getResolution().getCalendarField() >= Resolution.SECOND + .getCalendarField()) { sec.setSelectedIndex(value.getSeconds()); } if (getDateTimeService().isTwelveHourClock()) { diff --git a/client/src/com/vaadin/client/ui/datefield/VDateField.java b/client/src/com/vaadin/client/ui/datefield/VDateField.java index 788433027b..915ac4c54d 100644 --- a/client/src/com/vaadin/client/ui/datefield/VDateField.java +++ b/client/src/com/vaadin/client/ui/datefield/VDateField.java @@ -22,6 +22,7 @@ import com.google.gwt.user.client.ui.FlowPanel; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.DateTimeService; import com.vaadin.client.ui.Field; +import com.vaadin.shared.ui.datefield.Resolution; public class VDateField extends FlowPanel implements Field { @@ -33,27 +34,33 @@ public class VDateField extends FlowPanel implements Field { protected boolean immediate; - public static final int RESOLUTION_YEAR = 1; - public static final int RESOLUTION_MONTH = 2; - public static final int RESOLUTION_DAY = 4; - public static final int RESOLUTION_HOUR = 8; - public static final int RESOLUTION_MIN = 16; - public static final int RESOLUTION_SEC = 32; - - static String resolutionToString(int res) { - if (res > RESOLUTION_DAY) { + @Deprecated + public static final Resolution RESOLUTION_YEAR = Resolution.YEAR; + @Deprecated + public static final Resolution RESOLUTION_MONTH = Resolution.MONTH; + @Deprecated + public static final Resolution RESOLUTION_DAY = Resolution.DAY; + @Deprecated + public static final Resolution RESOLUTION_HOUR = Resolution.HOUR; + @Deprecated + public static final Resolution RESOLUTION_MIN = Resolution.MINUTE; + @Deprecated + public static final Resolution RESOLUTION_SEC = Resolution.SECOND; + + static String resolutionToString(Resolution res) { + if (res.getCalendarField() > Resolution.DAY.getCalendarField()) { return "full"; } - if (res == RESOLUTION_DAY) { + if (res == Resolution.DAY) { return "day"; } - if (res == RESOLUTION_MONTH) { + if (res == Resolution.MONTH) { return "month"; } return "year"; } - protected int currentResolution = RESOLUTION_YEAR; + protected Resolution currentResolution = Resolution.YEAR; protected String currentLocale; @@ -108,11 +115,11 @@ public class VDateField extends FlowPanel implements Field { DateTimeService.setMilliseconds(date, ms); } - public int getCurrentResolution() { + public Resolution getCurrentResolution() { return currentResolution; } - public void setCurrentResolution(int currentResolution) { + public void setCurrentResolution(Resolution currentResolution) { this.currentResolution = currentResolution; } diff --git a/client/src/com/vaadin/client/ui/datefield/VDateFieldCalendar.java b/client/src/com/vaadin/client/ui/datefield/VDateFieldCalendar.java index cf998421fd..41b7aedae6 100644 --- a/client/src/com/vaadin/client/ui/datefield/VDateFieldCalendar.java +++ b/client/src/com/vaadin/client/ui/datefield/VDateFieldCalendar.java @@ -22,6 +22,7 @@ import com.google.gwt.event.dom.client.DomEvent; import com.vaadin.client.DateTimeService; import com.vaadin.client.ui.datefield.VCalendarPanel.FocusOutListener; import com.vaadin.client.ui.datefield.VCalendarPanel.SubmitListener; +import com.vaadin.shared.ui.datefield.Resolution; /** * A client side implementation for InlineDateField @@ -73,22 +74,28 @@ public class VDateFieldCalendar extends VDateField { setCurrentDate((Date) date2.clone()); getClient().updateVariable(getId(), "year", date2.getYear() + 1900, false); - if (getCurrentResolution() > VDateField.RESOLUTION_YEAR) { + if (getCurrentResolution().getCalendarField() > Resolution.YEAR + .getCalendarField()) { getClient().updateVariable(getId(), "month", date2.getMonth() + 1, false); - if (getCurrentResolution() > RESOLUTION_MONTH) { + if (getCurrentResolution().getCalendarField() > Resolution.MONTH + .getCalendarField()) { getClient().updateVariable(getId(), "day", date2.getDate(), false); - if (getCurrentResolution() > RESOLUTION_DAY) { + if (getCurrentResolution().getCalendarField() > Resolution.DAY + .getCalendarField()) { getClient().updateVariable(getId(), "hour", date2.getHours(), false); - if (getCurrentResolution() > RESOLUTION_HOUR) { + if (getCurrentResolution().getCalendarField() > Resolution.HOUR + .getCalendarField()) { getClient().updateVariable(getId(), "min", date2.getMinutes(), false); - if (getCurrentResolution() > RESOLUTION_MIN) { + if (getCurrentResolution().getCalendarField() > Resolution.MINUTE + .getCalendarField()) { getClient().updateVariable(getId(), "sec", date2.getSeconds(), false); - if (getCurrentResolution() > RESOLUTION_SEC) { + if (getCurrentResolution().getCalendarField() > Resolution.SECOND + .getCalendarField()) { getClient().updateVariable( getId(), "msec", diff --git a/client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java b/client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java index e5aeb2efe8..79ede5b013 100644 --- a/client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java +++ b/client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java @@ -40,6 +40,7 @@ import com.vaadin.client.ui.SubPartAware; import com.vaadin.client.ui.VOverlay; import com.vaadin.client.ui.datefield.VCalendarPanel.FocusOutListener; import com.vaadin.client.ui.datefield.VCalendarPanel.SubmitListener; +import com.vaadin.shared.ui.datefield.Resolution; /** * Represents a date selection component with a text field and a popup date @@ -123,19 +124,24 @@ public class VPopupCalendar extends VTextualDate implements Field, setCurrentDate((Date) newDate.clone()); getClient().updateVariable(getId(), "year", newDate.getYear() + 1900, false); - if (getCurrentResolution() > VDateField.RESOLUTION_YEAR) { + if (getCurrentResolution().getCalendarField() > Resolution.YEAR + .getCalendarField()) { getClient().updateVariable(getId(), "month", newDate.getMonth() + 1, false); - if (getCurrentResolution() > RESOLUTION_MONTH) { + if (getCurrentResolution().getCalendarField() > Resolution.MONTH + .getCalendarField()) { getClient().updateVariable(getId(), "day", newDate.getDate(), false); - if (getCurrentResolution() > RESOLUTION_DAY) { + if (getCurrentResolution().getCalendarField() > Resolution.DAY + .getCalendarField()) { getClient().updateVariable(getId(), "hour", newDate.getHours(), false); - if (getCurrentResolution() > RESOLUTION_HOUR) { + if (getCurrentResolution().getCalendarField() > Resolution.HOUR + .getCalendarField()) { getClient().updateVariable(getId(), "min", newDate.getMinutes(), false); - if (getCurrentResolution() > RESOLUTION_MIN) { + if (getCurrentResolution().getCalendarField() > Resolution.MINUTE + .getCalendarField()) { getClient().updateVariable(getId(), "sec", newDate.getSeconds(), false); } diff --git a/client/src/com/vaadin/client/ui/datefield/VTextualDate.java b/client/src/com/vaadin/client/ui/datefield/VTextualDate.java index 5d19cf5db2..e2d9962979 100644 --- a/client/src/com/vaadin/client/ui/datefield/VTextualDate.java +++ b/client/src/com/vaadin/client/ui/datefield/VTextualDate.java @@ -34,6 +34,7 @@ import com.vaadin.client.ui.Field; import com.vaadin.client.ui.SubPartAware; import com.vaadin.client.ui.textfield.VTextField; import com.vaadin.shared.EventId; +import com.vaadin.shared.ui.datefield.Resolution; public class VTextualDate extends VDateField implements Field, ChangeHandler, Focusable, SubPartAware { @@ -101,7 +102,7 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler, protected String getFormatString() { if (formatStr == null) { - if (currentResolution == RESOLUTION_YEAR) { + if (currentResolution == Resolution.YEAR) { formatStr = "yyyy"; // force full year } else { @@ -111,16 +112,18 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler, frmString = cleanFormat(frmString); // String delim = LocaleService // .getClockDelimiter(currentLocale); - - if (currentResolution >= RESOLUTION_HOUR) { + if (currentResolution.getCalendarField() >= Resolution.HOUR + .getCalendarField()) { if (dts.isTwelveHourClock()) { frmString += " hh"; } else { frmString += " HH"; } - if (currentResolution >= RESOLUTION_MIN) { + if (currentResolution.getCalendarField() >= Resolution.MINUTE + .getCalendarField()) { frmString += ":mm"; - if (currentResolution >= RESOLUTION_SEC) { + if (currentResolution.getCalendarField() >= Resolution.SECOND + .getCalendarField()) { frmString += ":ss"; } } @@ -228,59 +231,48 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler, Date currentDate = getDate(); getClient().updateVariable(getId(), "year", currentDate != null ? currentDate.getYear() + 1900 : -1, - currentResolution == VDateField.RESOLUTION_YEAR && immediate); - if (currentResolution >= VDateField.RESOLUTION_MONTH) { - getClient().updateVariable( - getId(), - "month", + currentResolution == Resolution.YEAR && immediate); + if (currentResolution.getCalendarField() >= Resolution.MONTH + .getCalendarField()) { + getClient().updateVariable(getId(), "month", currentDate != null ? currentDate.getMonth() + 1 : -1, - currentResolution == VDateField.RESOLUTION_MONTH - && immediate); + currentResolution == Resolution.MONTH && immediate); } - if (currentResolution >= VDateField.RESOLUTION_DAY) { - getClient() - .updateVariable( - getId(), - "day", - currentDate != null ? currentDate.getDate() : -1, - currentResolution == VDateField.RESOLUTION_DAY - && immediate); + if (currentResolution.getCalendarField() >= Resolution.DAY + .getCalendarField()) { + getClient().updateVariable(getId(), "day", + currentDate != null ? currentDate.getDate() : -1, + currentResolution == Resolution.DAY && immediate); } - if (currentResolution >= VDateField.RESOLUTION_HOUR) { - getClient().updateVariable( - getId(), - "hour", + if (currentResolution.getCalendarField() >= Resolution.HOUR + .getCalendarField()) { + getClient().updateVariable(getId(), "hour", currentDate != null ? currentDate.getHours() : -1, - currentResolution == VDateField.RESOLUTION_HOUR - && immediate); + currentResolution == Resolution.HOUR && immediate); } - if (currentResolution >= VDateField.RESOLUTION_MIN) { - getClient() - .updateVariable( - getId(), - "min", - currentDate != null ? currentDate.getMinutes() : -1, - currentResolution == VDateField.RESOLUTION_MIN - && immediate); + if (currentResolution.getCalendarField() >= Resolution.MINUTE + .getCalendarField()) { + getClient().updateVariable(getId(), "min", + currentDate != null ? currentDate.getMinutes() : -1, + currentResolution == Resolution.MINUTE && immediate); } - if (currentResolution >= VDateField.RESOLUTION_SEC) { - getClient() - .updateVariable( - getId(), - "sec", - currentDate != null ? currentDate.getSeconds() : -1, - currentResolution == VDateField.RESOLUTION_SEC - && immediate); + if (currentResolution.getCalendarField() >= Resolution.SECOND + .getCalendarField()) { + getClient().updateVariable(getId(), "sec", + currentDate != null ? currentDate.getSeconds() : -1, + currentResolution == Resolution.SECOND && immediate); } } private String cleanFormat(String format) { // Remove unnecessary d & M if resolution is too low - if (currentResolution < VDateField.RESOLUTION_DAY) { + if (currentResolution.getCalendarField() < Resolution.DAY + .getCalendarField()) { format = format.replaceAll("d", ""); } - if (currentResolution < VDateField.RESOLUTION_MONTH) { + if (currentResolution.getCalendarField() < Resolution.MONTH + .getCalendarField()) { format = format.replaceAll("M", ""); } diff --git a/client/src/com/vaadin/client/ui/splitpanel/VAbstractSplitPanel.java b/client/src/com/vaadin/client/ui/splitpanel/VAbstractSplitPanel.java index 088e743d7a..bcb8809e90 100644 --- a/client/src/com/vaadin/client/ui/splitpanel/VAbstractSplitPanel.java +++ b/client/src/com/vaadin/client/ui/splitpanel/VAbstractSplitPanel.java @@ -48,6 +48,7 @@ import com.vaadin.client.ui.TouchScrollDelegate; import com.vaadin.client.ui.TouchScrollDelegate.TouchScrollHandler; import com.vaadin.client.ui.VOverlay; import com.vaadin.client.ui.splitpanel.VAbstractSplitPanel.SplitterMoveHandler.SplitterMoveEvent; +import com.vaadin.shared.ui.Orientation; public class VAbstractSplitPanel extends ComplexPanel { @@ -55,13 +56,9 @@ public class VAbstractSplitPanel extends ComplexPanel { public static final String CLASSNAME = "v-splitpanel"; - public static final int ORIENTATION_HORIZONTAL = 0; - - public static final int ORIENTATION_VERTICAL = 1; - private static final int MIN_SIZE = 30; - private int orientation = ORIENTATION_HORIZONTAL; + private Orientation orientation = Orientation.HORIZONTAL; Widget firstChild; @@ -113,17 +110,17 @@ public class VAbstractSplitPanel extends ComplexPanel { protected int origScrollTop; public VAbstractSplitPanel() { - this(ORIENTATION_HORIZONTAL); + this(Orientation.HORIZONTAL); } - public VAbstractSplitPanel(int orientation) { + public VAbstractSplitPanel(Orientation orientation) { setElement(DOM.createDiv()); setStyleName(StyleConstants.UI_LAYOUT); switch (orientation) { - case ORIENTATION_HORIZONTAL: + case HORIZONTAL: addStyleName(CLASSNAME + "-horizontal"); break; - case ORIENTATION_VERTICAL: + case VERTICAL: default: addStyleName(CLASSNAME + "-vertical"); break; @@ -190,9 +187,9 @@ public class VAbstractSplitPanel extends ComplexPanel { setStylenames(); } - private void setOrientation(int orientation) { + private void setOrientation(Orientation orientation) { this.orientation = orientation; - if (orientation == ORIENTATION_HORIZONTAL) { + if (orientation == Orientation.HORIZONTAL) { DOM.setStyleAttribute(splitter, "height", "100%"); DOM.setStyleAttribute(splitter, "top", "0"); DOM.setStyleAttribute(firstContainer, "height", "100%"); @@ -228,10 +225,10 @@ public class VAbstractSplitPanel extends ComplexPanel { void setPositionReversed(boolean reversed) { if (positionReversed != reversed) { - if (orientation == ORIENTATION_HORIZONTAL) { + if (orientation == Orientation.HORIZONTAL) { DOM.setStyleAttribute(splitter, "right", ""); DOM.setStyleAttribute(splitter, "left", ""); - } else if (orientation == ORIENTATION_VERTICAL) { + } else if (orientation == Orientation.VERTICAL) { DOM.setStyleAttribute(splitter, "top", ""); DOM.setStyleAttribute(splitter, "bottom", ""); } @@ -253,7 +250,7 @@ public class VAbstractSplitPanel extends ComplexPanel { posAsFloat = Math.round(Float.parseFloat(pos.substring(0, pos.length() - 1)) / 100 - * (orientation == ORIENTATION_HORIZONTAL ? getOffsetWidth() + * (orientation == Orientation.HORIZONTAL ? getOffsetWidth() : getOffsetHeight())); } else { posAsFloat = Float.parseFloat(pos.substring(0, pos.length() - 2)); @@ -272,7 +269,7 @@ public class VAbstractSplitPanel extends ComplexPanel { if (pos.endsWith("px")) { float pixelPosition = Float.parseFloat(pos.substring(0, pos.length() - 2)); - int offsetLength = orientation == ORIENTATION_HORIZONTAL ? getOffsetWidth() + int offsetLength = orientation == Orientation.HORIZONTAL ? getOffsetWidth() : getOffsetHeight(); // Take splitter size into account at the edge @@ -344,7 +341,7 @@ public class VAbstractSplitPanel extends ComplexPanel { // Convert percentage values to pixels if (pos.indexOf("%") > 0) { - int size = orientation == ORIENTATION_HORIZONTAL ? getOffsetWidth() + int size = orientation == Orientation.HORIZONTAL ? getOffsetWidth() : getOffsetHeight(); float percentage = Float.parseFloat(pos.substring(0, pos.length() - 1)); @@ -352,7 +349,7 @@ public class VAbstractSplitPanel extends ComplexPanel { } String attributeName; - if (orientation == ORIENTATION_HORIZONTAL) { + if (orientation == Orientation.HORIZONTAL) { if (positionReversed) { attributeName = "right"; } else { @@ -382,7 +379,7 @@ public class VAbstractSplitPanel extends ComplexPanel { int pixelPosition; switch (orientation) { - case ORIENTATION_HORIZONTAL: + case HORIZONTAL: wholeSize = DOM.getElementPropertyInt(wrapper, "clientWidth"); pixelPosition = DOM.getElementPropertyInt(splitter, "offsetLeft"); @@ -430,7 +427,7 @@ public class VAbstractSplitPanel extends ComplexPanel { } } break; - case ORIENTATION_VERTICAL: + case VERTICAL: wholeSize = DOM.getElementPropertyInt(wrapper, "clientHeight"); pixelPosition = DOM.getElementPropertyInt(splitter, "offsetTop"); @@ -562,11 +559,11 @@ public class VAbstractSplitPanel extends ComplexPanel { public void onMouseMove(Event event) { switch (orientation) { - case ORIENTATION_HORIZONTAL: + case HORIZONTAL: final int x = Util.getTouchOrMouseClientX(event); onHorizontalMouseMove(x); break; - case ORIENTATION_VERTICAL: + case VERTICAL: default: final int y = Util.getTouchOrMouseClientY(event); onVerticalMouseMove(y); @@ -729,7 +726,7 @@ public class VAbstractSplitPanel extends ComplexPanel { if (splitterSize < 0) { if (isAttached()) { switch (orientation) { - case ORIENTATION_HORIZONTAL: + case HORIZONTAL: splitterSize = DOM.getElementPropertyInt(splitter, "offsetWidth"); break; @@ -746,7 +743,7 @@ public class VAbstractSplitPanel extends ComplexPanel { void setStylenames() { final String splitterClass = CLASSNAME - + (orientation == ORIENTATION_HORIZONTAL ? "-hsplitter" + + (orientation == Orientation.HORIZONTAL ? "-hsplitter" : "-vsplitter"); final String firstContainerClass = CLASSNAME + "-first-container"; final String secondContainerClass = CLASSNAME + "-second-container"; diff --git a/client/src/com/vaadin/client/ui/splitpanel/VSplitPanelHorizontal.java b/client/src/com/vaadin/client/ui/splitpanel/VSplitPanelHorizontal.java index f347a8521c..c277d594b9 100644 --- a/client/src/com/vaadin/client/ui/splitpanel/VSplitPanelHorizontal.java +++ b/client/src/com/vaadin/client/ui/splitpanel/VSplitPanelHorizontal.java @@ -16,9 +16,11 @@ package com.vaadin.client.ui.splitpanel; +import com.vaadin.shared.ui.Orientation; + public class VSplitPanelHorizontal extends VAbstractSplitPanel { public VSplitPanelHorizontal() { - super(VAbstractSplitPanel.ORIENTATION_HORIZONTAL); + super(Orientation.HORIZONTAL); } } diff --git a/client/src/com/vaadin/client/ui/splitpanel/VSplitPanelVertical.java b/client/src/com/vaadin/client/ui/splitpanel/VSplitPanelVertical.java index 3f9826833b..4f96d7f746 100644 --- a/client/src/com/vaadin/client/ui/splitpanel/VSplitPanelVertical.java +++ b/client/src/com/vaadin/client/ui/splitpanel/VSplitPanelVertical.java @@ -16,9 +16,11 @@ package com.vaadin.client.ui.splitpanel; +import com.vaadin.shared.ui.Orientation; + public class VSplitPanelVertical extends VAbstractSplitPanel { public VSplitPanelVertical() { - super(VAbstractSplitPanel.ORIENTATION_VERTICAL); + super(Orientation.VERTICAL); } } diff --git a/client/src/com/vaadin/client/ui/tree/TreeConnector.java b/client/src/com/vaadin/client/ui/tree/TreeConnector.java index 7fd3b105b6..10a3c0fb95 100644 --- a/client/src/com/vaadin/client/ui/tree/TreeConnector.java +++ b/client/src/com/vaadin/client/ui/tree/TreeConnector.java @@ -30,6 +30,7 @@ import com.vaadin.client.ui.AbstractComponentConnector; import com.vaadin.client.ui.tree.VTree.TreeNode; import com.vaadin.shared.AbstractFieldState; import com.vaadin.shared.ui.Connect; +import com.vaadin.shared.ui.MultiSelectMode; import com.vaadin.shared.ui.tree.TreeConstants; import com.vaadin.ui.Tree; @@ -108,10 +109,10 @@ public class TreeConnector extends AbstractComponentConnector implements if (BrowserInfo.get().isTouchDevice()) { // Always use the simple mode for touch devices that do not have // shift/ctrl keys (#8595) - getWidget().multiSelectMode = VTree.MULTISELECT_MODE_SIMPLE; + getWidget().multiSelectMode = MultiSelectMode.SIMPLE; } else { - getWidget().multiSelectMode = uidl - .getIntAttribute("multiselectmode"); + getWidget().multiSelectMode = MultiSelectMode.valueOf(uidl + .getStringAttribute("multiselectmode")); } } diff --git a/client/src/com/vaadin/client/ui/tree/VTree.java b/client/src/com/vaadin/client/ui/tree/VTree.java index 2be3d7b33b..ca021b6dfc 100644 --- a/client/src/com/vaadin/client/ui/tree/VTree.java +++ b/client/src/com/vaadin/client/ui/tree/VTree.java @@ -72,6 +72,8 @@ import com.vaadin.client.ui.dd.VDropHandler; import com.vaadin.client.ui.dd.VHasDropHandler; import com.vaadin.client.ui.dd.VTransferable; import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.MouseEventDetails.MouseButton; +import com.vaadin.shared.ui.MultiSelectMode; import com.vaadin.shared.ui.dd.VerticalDropLocation; import com.vaadin.shared.ui.tree.TreeConstants; @@ -85,14 +87,16 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, public static final String CLASSNAME = "v-tree"; /** - * Click selects the current node, ctrl/shift toggles multi selection + * @deprecated from 7.0, use {@link MultiSelectMode#DEFAULT} instead. */ - public static final int MULTISELECT_MODE_DEFAULT = 0; + @Deprecated + public static final MultiSelectMode MULTISELECT_MODE_DEFAULT = MultiSelectMode.DEFAULT; /** - * Click/touch on node toggles its selected status + * @deprecated from 7.0, use {@link MultiSelectMode#SIMPLE} instead. */ - public static final int MULTISELECT_MODE_SIMPLE = 1; + @Deprecated + public static final MultiSelectMode MULTISELECT_MODE_SIMPLE = MultiSelectMode.SIMPLE; private static final int CHARCODE_SPACE = 32; @@ -106,7 +110,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, private String currentMouseOverKey; TreeNode lastSelection; TreeNode focusedNode; - int multiSelectMode = MULTISELECT_MODE_DEFAULT; + MultiSelectMode multiSelectMode = MultiSelectMode.DEFAULT; private final HashMap keyToNode = new HashMap(); @@ -606,11 +610,11 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, @Override public void execute() { - if (multiSelectMode == MULTISELECT_MODE_SIMPLE + if (multiSelectMode == MultiSelectMode.SIMPLE || !isMultiselect) { toggleSelection(); lastSelection = TreeNode.this; - } else if (multiSelectMode == MULTISELECT_MODE_DEFAULT) { + } else if (multiSelectMode == MultiSelectMode.DEFAULT) { // Handle ctrl+click if (isMultiselect && ctrl && !shift) { toggleSelection(); @@ -795,8 +799,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler, // we want to send it immediately. boolean sendClickEventNow = true; - if (details.getButton() == NativeEvent.BUTTON_LEFT - && immediate && selectable) { + if (details.getButton() == MouseButton.LEFT && immediate + && selectable) { // Probably a selection that will cause a value change // event to be sent sendClickEventNow = false; diff --git a/server/src/com/vaadin/data/validator/DateRangeValidator.java b/server/src/com/vaadin/data/validator/DateRangeValidator.java index 44c0d1e929..51eaa2e59b 100644 --- a/server/src/com/vaadin/data/validator/DateRangeValidator.java +++ b/server/src/com/vaadin/data/validator/DateRangeValidator.java @@ -17,7 +17,7 @@ package com.vaadin.data.validator; import java.util.Date; -import com.vaadin.ui.DateField.Resolution; +import com.vaadin.shared.ui.datefield.Resolution; /** * Validator for validating that a Date is inside a given range. diff --git a/server/src/com/vaadin/event/MouseEvents.java b/server/src/com/vaadin/event/MouseEvents.java index e287055c2b..37c6d665b5 100644 --- a/server/src/com/vaadin/event/MouseEvents.java +++ b/server/src/com/vaadin/event/MouseEvents.java @@ -19,6 +19,7 @@ package com.vaadin.event; import java.lang.reflect.Method; import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.MouseEventDetails.MouseButton; import com.vaadin.ui.Component; import com.vaadin.util.ReflectTools; @@ -44,10 +45,21 @@ public interface MouseEvents { * @since 6.2 */ public static class ClickEvent extends Component.Event { - public static final int BUTTON_LEFT = MouseEventDetails.BUTTON_LEFT; - public static final int BUTTON_MIDDLE = MouseEventDetails.BUTTON_MIDDLE; - public static final int BUTTON_RIGHT = MouseEventDetails.BUTTON_RIGHT; - + /** + * @deprecated use {@link Button#LEFT} instead. + */ + @Deprecated + public static final MouseButton BUTTON_LEFT = MouseButton.LEFT; + /** + * @deprecated use {@link Button#MIDDLE} instead. + */ + @Deprecated + public static final MouseButton BUTTON_MIDDLE = MouseButton.MIDDLE; + /** + * @deprecated use {@link Button#RIGHT} instead. + */ + @Deprecated + public static final MouseButton BUTTON_RIGHT = MouseButton.RIGHT; private MouseEventDetails details; public ClickEvent(Component source, MouseEventDetails mouseEventDetails) { @@ -57,13 +69,13 @@ public interface MouseEvents { /** * Returns an identifier describing which mouse button the user pushed. - * Compare with {@link #BUTTON_LEFT},{@link #BUTTON_MIDDLE}, - * {@link #BUTTON_RIGHT} to find out which butten it is. + * Compare with {@link MouseButton#LEFT},{@link MouseButton#MIDDLE}, + * {@link Button#RIGHT} to find out which button it is. * - * @return one of {@link #BUTTON_LEFT}, {@link #BUTTON_MIDDLE}, - * {@link #BUTTON_RIGHT}. + * @return one of {@link MouseButton#LEFT}, {@link MouseButton#MIDDLE}, + * {@link MouseButton#RIGHT}. */ - public int getButton() { + public MouseButton getButton() { return details.getButton(); } diff --git a/server/src/com/vaadin/server/Page.java b/server/src/com/vaadin/server/Page.java index ccc400341e..bfbfe53429 100644 --- a/server/src/com/vaadin/server/Page.java +++ b/server/src/com/vaadin/server/Page.java @@ -211,21 +211,21 @@ public class Page implements Serializable { "browserWindowResized", BrowserWindowResizeEvent.class); /** - * A border style used for opening resources in a window without a border. + * @deprecated from 7.0, use {@link BorderStyle#NONE} instead. */ @Deprecated public static final BorderStyle BORDER_NONE = BorderStyle.NONE; /** - * A border style used for opening resources in a window with a minimal - * border. + * @deprecated from 7.0, use {@link BorderStyle#MINIMAL} instead. */ + @Deprecated public static final BorderStyle BORDER_MINIMAL = BorderStyle.MINIMAL; /** - * A border style that indicates that the default border style should be - * used when opening resources. + * @deprecated from 7.0, use {@link BorderStyle#DEFAULT} instead. */ + @Deprecated public static final BorderStyle BORDER_DEFAULT = BorderStyle.DEFAULT; /** diff --git a/server/src/com/vaadin/ui/AbstractSelect.java b/server/src/com/vaadin/ui/AbstractSelect.java index 4de3f90d15..45df42a9be 100644 --- a/server/src/com/vaadin/ui/AbstractSelect.java +++ b/server/src/com/vaadin/ui/AbstractSelect.java @@ -45,6 +45,7 @@ import com.vaadin.server.LegacyComponent; import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; import com.vaadin.server.Resource; +import com.vaadin.shared.ui.combobox.FilteringMode; import com.vaadin.shared.ui.dd.VerticalDropLocation; /** @@ -154,15 +155,28 @@ public abstract class AbstractSelect extends AbstractField implements /** * Interface for option filtering, used to filter options based on user * entered value. The value is matched to the item caption. - * FILTERINGMODE_OFF (0) turns the filtering off. - * FILTERINGMODE_STARTSWITH (1) matches from the start of the - * caption. FILTERINGMODE_CONTAINS (1) matches anywhere in the + * FilteringMode.OFF (0) turns the filtering off. + * FilteringMode.STARTSWITH (1) matches from the start of the + * caption. FilteringMode.CONTAINS (1) matches anywhere in the * caption. */ public interface Filtering extends Serializable { - public static final int FILTERINGMODE_OFF = 0; - public static final int FILTERINGMODE_STARTSWITH = 1; - public static final int FILTERINGMODE_CONTAINS = 2; + + /** + * @deprecated from 7.0, use {@link FilteringMode#OFF} instead + */ + @Deprecated + public static final FilteringMode FILTERINGMODE_OFF = FilteringMode.OFF; + /** + * @deprecated from 7.0, use {@link FilteringMode#STARTSWITH} instead + */ + @Deprecated + public static final FilteringMode FILTERINGMODE_STARTSWITH = FilteringMode.STARTSWITH; + /** + * @deprecated from 7.0, use {@link FilteringMode#CONTAINS} instead + */ + @Deprecated + public static final FilteringMode FILTERINGMODE_CONTAINS = FilteringMode.CONTAINS; /** * Sets the option filtering mode. @@ -170,30 +184,15 @@ public abstract class AbstractSelect extends AbstractField implements * @param filteringMode * the filtering mode to use */ - public void setFilteringMode(int filteringMode); + public void setFilteringMode(FilteringMode filteringMode); /** * Gets the current filtering mode. * * @return the filtering mode in use */ - public int getFilteringMode(); - - } - - /** - * Multi select modes that controls how multi select behaves. - */ - public enum MultiSelectMode { - /** - * The default behavior of the multi select mode - */ - DEFAULT, + public FilteringMode getFilteringMode(); - /** - * The previous more simple behavior of the multselect - */ - SIMPLE } /** diff --git a/server/src/com/vaadin/ui/ComboBox.java b/server/src/com/vaadin/ui/ComboBox.java index 4f852c2b7b..4987d69fdd 100644 --- a/server/src/com/vaadin/ui/ComboBox.java +++ b/server/src/com/vaadin/ui/ComboBox.java @@ -34,6 +34,7 @@ import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; import com.vaadin.server.Resource; import com.vaadin.shared.ui.combobox.ComboBoxConstants; +import com.vaadin.shared.ui.combobox.FilteringMode; /** * A filtering dropdown single-select. Suitable for newItemsAllowed, but it's @@ -60,7 +61,7 @@ public class ComboBox extends AbstractSelect implements // Current page when the user is 'paging' trough options private int currentPage = -1; - private int filteringMode = Filtering.FILTERINGMODE_STARTSWITH; + private FilteringMode filteringMode = FilteringMode.STARTSWITH; private String filterstring; private String prevfilterstring; @@ -186,7 +187,7 @@ public class ComboBox extends AbstractSelect implements target.addAttribute("pagelength", pageLength); - target.addAttribute("filteringmode", getFilteringMode()); + target.addAttribute("filteringmode", getFilteringMode().toString()); // Paints the options and create array of selected id keys int keyIndex = 0; @@ -201,7 +202,7 @@ public class ComboBox extends AbstractSelect implements boolean nullFilteredOut = filterstring != null && !"".equals(filterstring) - && filteringMode != Filtering.FILTERINGMODE_OFF; + && filteringMode != FilteringMode.OFF; // null option is needed and not filtered out, even if not on current // page boolean nullOptionVisible = needNullSelectOption && !nullFilteredOut; @@ -411,18 +412,19 @@ public class ComboBox extends AbstractSelect implements * @param filteringMode * @return */ - protected Filter buildFilter(String filterString, int filteringMode) { + protected Filter buildFilter(String filterString, + FilteringMode filteringMode) { Filter filter = null; if (null != filterString && !"".equals(filterString)) { switch (filteringMode) { - case Filtering.FILTERINGMODE_OFF: + case OFF: break; - case Filtering.FILTERINGMODE_STARTSWITH: + case STARTSWITH: filter = new SimpleStringFilter(getItemCaptionPropertyId(), filterString, true, true); break; - case Filtering.FILTERINGMODE_CONTAINS: + case CONTAINS: filter = new SimpleStringFilter(getItemCaptionPropertyId(), filterString, true, false); break; @@ -576,7 +578,7 @@ public class ComboBox extends AbstractSelect implements */ protected List getFilteredOptions() { if (null == filterstring || "".equals(filterstring) - || Filtering.FILTERINGMODE_OFF == filteringMode) { + || FilteringMode.OFF == filteringMode) { prevfilterstring = null; filteredOptions = new LinkedList(getItemIds()); return filteredOptions; @@ -605,12 +607,12 @@ public class ComboBox extends AbstractSelect implements caption = caption.toLowerCase(); } switch (filteringMode) { - case Filtering.FILTERINGMODE_CONTAINS: + case CONTAINS: if (caption.indexOf(filterstring) > -1) { filteredOptions.add(itemId); } break; - case Filtering.FILTERINGMODE_STARTSWITH: + case STARTSWITH: default: if (caption.startsWith(filterstring)) { filteredOptions.add(itemId); @@ -686,12 +688,12 @@ public class ComboBox extends AbstractSelect implements } @Override - public void setFilteringMode(int filteringMode) { + public void setFilteringMode(FilteringMode filteringMode) { this.filteringMode = filteringMode; } @Override - public int getFilteringMode() { + public FilteringMode getFilteringMode() { return filteringMode; } diff --git a/server/src/com/vaadin/ui/DateField.java b/server/src/com/vaadin/ui/DateField.java index f54959fb0a..39230bf662 100644 --- a/server/src/com/vaadin/ui/DateField.java +++ b/server/src/com/vaadin/ui/DateField.java @@ -17,12 +17,10 @@ package com.vaadin.ui; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Calendar; import java.util.Collection; import java.util.Date; import java.util.HashMap; -import java.util.List; import java.util.Locale; import java.util.Map; import java.util.TimeZone; @@ -40,6 +38,7 @@ import com.vaadin.server.LegacyComponent; import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; import com.vaadin.shared.ui.datefield.DateFieldConstants; +import com.vaadin.shared.ui.datefield.Resolution; /** *

@@ -63,71 +62,6 @@ import com.vaadin.shared.ui.datefield.DateFieldConstants; public class DateField extends AbstractField implements FieldEvents.BlurNotifier, FieldEvents.FocusNotifier, LegacyComponent { - /** - * Resolutions for DateFields - * - * @author Vaadin Ltd. - * @since 7.0 - */ - public enum Resolution { - SECOND(Calendar.SECOND), MINUTE(Calendar.MINUTE), HOUR( - Calendar.HOUR_OF_DAY), DAY(Calendar.DAY_OF_MONTH), MONTH( - Calendar.MONTH), YEAR(Calendar.YEAR); - - private int calendarField; - - private Resolution(int calendarField) { - this.calendarField = calendarField; - } - - /** - * Returns the field in {@link Calendar} that corresponds to this - * resolution. - * - * @return one of the field numbers used by Calendar - */ - public int getCalendarField() { - return calendarField; - } - - /** - * Returns the resolutions that are higher or equal to the given - * resolution, starting from the given resolution. In other words - * passing DAY to this methods returns DAY,MONTH,YEAR - * - * @param r - * The resolution to start from - * @return An iterable for the resolutions higher or equal to r - */ - public static Iterable getResolutionsHigherOrEqualTo( - Resolution r) { - List resolutions = new ArrayList(); - Resolution[] values = Resolution.values(); - for (int i = r.ordinal(); i < values.length; i++) { - resolutions.add(values[i]); - } - return resolutions; - } - - /** - * Returns the resolutions that are lower than the given resolution, - * starting from the given resolution. In other words passing DAY to - * this methods returns HOUR,MINUTE,SECOND. - * - * @param r - * The resolution to start from - * @return An iterable for the resolutions lower than r - */ - public static List getResolutionsLowerThan(Resolution r) { - List resolutions = new ArrayList(); - Resolution[] values = Resolution.values(); - for (int i = r.ordinal() - 1; i >= 0; i--) { - resolutions.add(values[i]); - } - return resolutions; - } - }; - /** * Resolution identifier: seconds. * @@ -212,7 +146,7 @@ public class DateField extends AbstractField implements private TimeZone timeZone = null; - private static Map variableNameForResolution = new HashMap(); + private static Map variableNameForResolution = new HashMap(); { variableNameForResolution.put(Resolution.SECOND, "sec"); variableNameForResolution.put(Resolution.MINUTE, "min"); @@ -372,7 +306,7 @@ public class DateField extends AbstractField implements // Gets the new date in parts boolean hasChanges = false; - Map calendarFieldChanges = new HashMap(); + Map calendarFieldChanges = new HashMap(); for (Resolution r : Resolution .getResolutionsHigherOrEqualTo(resolution)) { diff --git a/server/src/com/vaadin/ui/Link.java b/server/src/com/vaadin/ui/Link.java index a2737e4483..6e286174a5 100644 --- a/server/src/com/vaadin/ui/Link.java +++ b/server/src/com/vaadin/ui/Link.java @@ -34,15 +34,21 @@ import com.vaadin.shared.ui.link.LinkConstants; @SuppressWarnings("serial") public class Link extends AbstractComponent implements LegacyComponent { - /* Target window border type constant: No window border */ + /** + * @deprecated from 7.0, use {@link BorderStyle#NONE} instead + */ @Deprecated public static final BorderStyle TARGET_BORDER_NONE = BorderStyle.NONE; - /* Target window border type constant: Minimal window border */ + /** + * @deprecated from 7.0, use {@link BorderStyle#MINIMAL} instead + */ @Deprecated public static final BorderStyle TARGET_BORDER_MINIMAL = BorderStyle.MINIMAL; - /* Target window border type constant: Default window border */ + /** + * @deprecated from 7.0, use {@link BorderStyle#DEFAULT} instead + */ @Deprecated public static final BorderStyle TARGET_BORDER_DEFAULT = BorderStyle.DEFAULT; diff --git a/server/src/com/vaadin/ui/Table.java b/server/src/com/vaadin/ui/Table.java index 87962d5d15..d9e1403a03 100644 --- a/server/src/com/vaadin/ui/Table.java +++ b/server/src/com/vaadin/ui/Table.java @@ -59,6 +59,7 @@ import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; import com.vaadin.server.Resource; import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.ui.MultiSelectMode; import com.vaadin.shared.ui.table.TableConstants; /** diff --git a/server/src/com/vaadin/ui/Tree.java b/server/src/com/vaadin/ui/Tree.java index 44a1208cf8..1ba011dd00 100644 --- a/server/src/com/vaadin/ui/Tree.java +++ b/server/src/com/vaadin/ui/Tree.java @@ -54,6 +54,7 @@ import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; import com.vaadin.server.Resource; import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.ui.MultiSelectMode; import com.vaadin.shared.ui.dd.VerticalDropLocation; import com.vaadin.shared.ui.tree.TreeConstants; import com.vaadin.util.ReflectTools; @@ -519,7 +520,7 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, : "single")); if (isMultiSelect()) { target.addAttribute("multiselectmode", - multiSelectMode.ordinal()); + multiSelectMode.toString()); } } else { target.addAttribute("selectmode", "none"); diff --git a/server/tests/src/com/vaadin/tests/server/component/datefield/ResolutionTest.java b/server/tests/src/com/vaadin/tests/server/component/datefield/ResolutionTest.java index 00b5c60dad..ae72f9c743 100644 --- a/server/tests/src/com/vaadin/tests/server/component/datefield/ResolutionTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/datefield/ResolutionTest.java @@ -4,8 +4,8 @@ import java.util.ArrayList; import junit.framework.TestCase; +import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.util.TestUtil; -import com.vaadin.ui.DateField.Resolution; public class ResolutionTest extends TestCase { diff --git a/server/tests/src/com/vaadin/tests/server/component/table/TestMultipleSelection.java b/server/tests/src/com/vaadin/tests/server/component/table/TestMultipleSelection.java index 767b651b68..ff80cdb3c3 100644 --- a/server/tests/src/com/vaadin/tests/server/component/table/TestMultipleSelection.java +++ b/server/tests/src/com/vaadin/tests/server/component/table/TestMultipleSelection.java @@ -7,7 +7,7 @@ import junit.framework.TestCase; import com.vaadin.data.Container; import com.vaadin.data.util.IndexedContainer; -import com.vaadin.ui.AbstractSelect.MultiSelectMode; +import com.vaadin.shared.ui.MultiSelectMode; import com.vaadin.ui.Table; public class TestMultipleSelection extends TestCase { diff --git a/shared/src/com/vaadin/shared/MouseEventDetails.java b/shared/src/com/vaadin/shared/MouseEventDetails.java index ccfaac3a00..733d4c08e7 100644 --- a/shared/src/com/vaadin/shared/MouseEventDetails.java +++ b/shared/src/com/vaadin/shared/MouseEventDetails.java @@ -21,16 +21,55 @@ import java.io.Serializable; * Helper class to store and transfer mouse event details. */ public class MouseEventDetails implements Serializable { - // From com.google.gwt.dom.client.NativeEvent - public static final int BUTTON_LEFT = 1; - public static final int BUTTON_MIDDLE = 4; - public static final int BUTTON_RIGHT = 2; + /** + * @deprecated use {@link MouseButton#LEFT} instead. + */ + @Deprecated + public static final MouseButton BUTTON_LEFT = MouseButton.LEFT; + /** + * @deprecated use {@link MouseButton#MIDDLE} instead. + */ + @Deprecated + public static final MouseButton BUTTON_MIDDLE = MouseButton.MIDDLE; + /** + * @deprecated use {@link MouseButton#RIGHT} instead. + */ + @Deprecated + public static final MouseButton BUTTON_RIGHT = MouseButton.RIGHT; + + /** + * Constants for mouse buttons. + * + * @author Vaadin Ltd + * @version @VERSION@ + * @since 7.0 + * + */ + public enum MouseButton { + LEFT("left"), RIGHT("right"), MIDDLE("middle"); + + private String name; + + private MouseButton(String name) { + this.name = name; + } + + /** + * Returns a human readable text representing the button + * + * @return + */ + public String getName() { + return name; + } + + } private static final char DELIM = ','; // From com.google.gwt.user.client.Event private static final int ONDBLCLICK = 0x00002; - private int button; + private MouseButton button; private int clientX; private int clientY; private boolean altKey; @@ -41,7 +80,7 @@ public class MouseEventDetails implements Serializable { private int relativeX = -1; private int relativeY = -1; - public int getButton() { + public MouseButton getButton() { return button; } @@ -77,7 +116,7 @@ public class MouseEventDetails implements Serializable { return relativeY; } - public void setButton(int button) { + public void setButton(MouseButton button) { this.button = button; } @@ -126,16 +165,15 @@ public class MouseEventDetails implements Serializable { } public String serialize() { - return "" + button + DELIM + clientX + DELIM + clientY + DELIM + altKey - + DELIM + ctrlKey + DELIM + metaKey + DELIM + shiftKey + DELIM - + type + DELIM + relativeX + DELIM + relativeY; + return button.toString() + DELIM + clientX + DELIM + clientY + DELIM + + altKey + DELIM + ctrlKey + DELIM + metaKey + DELIM + shiftKey + + DELIM + type + DELIM + relativeX + DELIM + relativeY; } public static MouseEventDetails deSerialize(String serializedString) { MouseEventDetails instance = new MouseEventDetails(); String[] fields = serializedString.split(","); - - instance.button = Integer.parseInt(fields[0]); + instance.button = MouseButton.valueOf(fields[0]); instance.clientX = Integer.parseInt(fields[1]); instance.clientY = Integer.parseInt(fields[2]); instance.altKey = Boolean.valueOf(fields[3]).booleanValue(); @@ -149,15 +187,7 @@ public class MouseEventDetails implements Serializable { } public String getButtonName() { - if (button == BUTTON_LEFT) { - return "left"; - } else if (button == BUTTON_RIGHT) { - return "right"; - } else if (button == BUTTON_MIDDLE) { - return "middle"; - } - - return ""; + return button == null ? "" : button.getName(); } public int getType() { diff --git a/shared/src/com/vaadin/shared/ui/BorderStyle.java b/shared/src/com/vaadin/shared/ui/BorderStyle.java index 786d340f1c..8a48253a22 100755 --- a/shared/src/com/vaadin/shared/ui/BorderStyle.java +++ b/shared/src/com/vaadin/shared/ui/BorderStyle.java @@ -15,6 +15,28 @@ */ package com.vaadin.shared.ui; +/** + * Constants for border styles used on HTML elements. + * + * @author Vaadin Ltd + * @version @VERSION@ + * @since 7.0 + * + */ public enum BorderStyle { - NONE, MINIMAL, DEFAULT; + /** + * A border style used for using no border. + */ + NONE, + + /** + * A border style used for a minimal border. + */ + MINIMAL, + + /** + * A border style that indicates that the default border style should be + * used. + */ + DEFAULT; } diff --git a/shared/src/com/vaadin/shared/ui/MultiSelectMode.java b/shared/src/com/vaadin/shared/ui/MultiSelectMode.java new file mode 100644 index 0000000000..13eef452cd --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/MultiSelectMode.java @@ -0,0 +1,16 @@ +package com.vaadin.shared.ui; + +/** + * Multi select modes that controls how multi select behaves. + */ +public enum MultiSelectMode { + /** + * The default behavior of the multi select mode + */ + DEFAULT, + + /** + * The previous more simple behavior of the multi select + */ + SIMPLE +} diff --git a/shared/src/com/vaadin/shared/ui/Orientation.java b/shared/src/com/vaadin/shared/ui/Orientation.java new file mode 100644 index 0000000000..b055f078ae --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/Orientation.java @@ -0,0 +1,5 @@ +package com.vaadin.shared.ui; + +public enum Orientation { + HORIZONTAL, VERTICAL; +} diff --git a/shared/src/com/vaadin/shared/ui/combobox/FilteringMode.java b/shared/src/com/vaadin/shared/ui/combobox/FilteringMode.java new file mode 100644 index 0000000000..eaae85c156 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/combobox/FilteringMode.java @@ -0,0 +1,5 @@ +package com.vaadin.shared.ui.combobox; + +public enum FilteringMode { + OFF, STARTSWITH, CONTAINS; +} diff --git a/shared/src/com/vaadin/shared/ui/datefield/Resolution.java b/shared/src/com/vaadin/shared/ui/datefield/Resolution.java new file mode 100644 index 0000000000..a457c99de9 --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/datefield/Resolution.java @@ -0,0 +1,69 @@ +package com.vaadin.shared.ui.datefield; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +/** + * Resolutions for DateFields + * + * @author Vaadin Ltd. + * @since 7.0 + */ +public enum Resolution { + SECOND(Calendar.SECOND), MINUTE(Calendar.MINUTE), HOUR(Calendar.HOUR_OF_DAY), DAY( + Calendar.DAY_OF_MONTH), MONTH(Calendar.MONTH), YEAR(Calendar.YEAR); + + private int calendarField; + + private Resolution(int calendarField) { + this.calendarField = calendarField; + } + + /** + * Returns the field in {@link Calendar} that corresponds to this + * resolution. + * + * @return one of the field numbers used by Calendar + */ + public int getCalendarField() { + return calendarField; + } + + /** + * Returns the resolutions that are higher or equal to the given resolution, + * starting from the given resolution. In other words passing DAY to this + * methods returns DAY,MONTH,YEAR + * + * @param r + * The resolution to start from + * @return An iterable for the resolutions higher or equal to r + */ + public static Iterable getResolutionsHigherOrEqualTo( + Resolution r) { + List resolutions = new ArrayList(); + Resolution[] values = Resolution.values(); + for (int i = r.ordinal(); i < values.length; i++) { + resolutions.add(values[i]); + } + return resolutions; + } + + /** + * Returns the resolutions that are lower than the given resolution, + * starting from the given resolution. In other words passing DAY to this + * methods returns HOUR,MINUTE,SECOND. + * + * @param r + * The resolution to start from + * @return An iterable for the resolutions lower than r + */ + public static List getResolutionsLowerThan(Resolution r) { + List resolutions = new ArrayList(); + Resolution[] values = Resolution.values(); + for (int i = r.ordinal() - 1; i >= 0; i--) { + resolutions.add(values[i]); + } + return resolutions; + } +}; diff --git a/uitest/src/com/vaadin/tests/Components.java b/uitest/src/com/vaadin/tests/Components.java index 8295528fc3..97a1479df3 100644 --- a/uitest/src/com/vaadin/tests/Components.java +++ b/uitest/src/com/vaadin/tests/Components.java @@ -17,6 +17,7 @@ import com.vaadin.event.ItemClickEvent; import com.vaadin.event.ItemClickEvent.ItemClickListener; import com.vaadin.server.ExternalResource; import com.vaadin.server.Sizeable; +import com.vaadin.shared.MouseEventDetails.MouseButton; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.components.AbstractComponentTest; import com.vaadin.ui.AbstractComponent; @@ -189,10 +190,10 @@ public class Components extends LegacyApplication { if (!isAbstract(cls)) { String url = baseUrl + cls.getName() + "?restartApplication"; - if (event.getButton() == ItemClickEvent.BUTTON_LEFT) { + if (event.getButton() == MouseButton.LEFT) { openEmbedded(url); naviTree.setValue(event.getItemId()); - } else if (event.getButton() == ItemClickEvent.BUTTON_RIGHT) { + } else if (event.getButton() == MouseButton.RIGHT) { openInNewTab(url); } } diff --git a/uitest/src/com/vaadin/tests/TestSizeableIncomponents.java b/uitest/src/com/vaadin/tests/TestSizeableIncomponents.java index cc7ba23405..732895cddf 100644 --- a/uitest/src/com/vaadin/tests/TestSizeableIncomponents.java +++ b/uitest/src/com/vaadin/tests/TestSizeableIncomponents.java @@ -26,6 +26,7 @@ import com.vaadin.data.Container; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.util.IndexedContainer; import com.vaadin.server.ThemeResource; +import com.vaadin.shared.ui.combobox.FilteringMode; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.AbstractSelect; import com.vaadin.ui.Button; @@ -63,7 +64,7 @@ public class TestSizeableIncomponents extends LegacyApplication { select = new ComboBox(); select.setImmediate(true); - select.setFilteringMode(ComboBox.FILTERINGMODE_CONTAINS); + select.setFilteringMode(FilteringMode.CONTAINS); select.setWidth("400px"); prev = new Button("<<-|"); diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcut.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcut.java index 38bdf0c5fe..f7d12356f7 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcut.java +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcut.java @@ -1,9 +1,9 @@ package com.vaadin.tests.components.combobox; import com.vaadin.event.ShortcutAction.KeyCode; +import com.vaadin.shared.ui.combobox.FilteringMode; import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.Log; -import com.vaadin.ui.AbstractSelect.Filtering; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.ComboBox; @@ -21,7 +21,7 @@ public class ComboBoxCombinedWithEnterShortcut extends TestBase { l.addItem(cities[i]); } - l.setFilteringMode(Filtering.FILTERINGMODE_OFF); + l.setFilteringMode(FilteringMode.OFF); l.setImmediate(true); l.setNewItemsAllowed(true); diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxNavigation.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxNavigation.java index 245fc123df..0e355af302 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxNavigation.java +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxNavigation.java @@ -1,5 +1,6 @@ package com.vaadin.tests.components.combobox; +import com.vaadin.shared.ui.combobox.FilteringMode; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.ComboBox; @@ -22,7 +23,7 @@ public class ComboBoxNavigation extends TestBase { cb.addItem("Item " + i); } - cb.setFilteringMode(ComboBox.FILTERINGMODE_CONTAINS); + cb.setFilteringMode(FilteringMode.CONTAINS); addComponent(cb); } diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxReapperingOldValue.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxReapperingOldValue.java index 1ae16db2cb..6b9b05e4ac 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxReapperingOldValue.java +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxReapperingOldValue.java @@ -5,7 +5,7 @@ import com.vaadin.data.Container; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.data.util.IndexedContainer; -import com.vaadin.ui.AbstractSelect; +import com.vaadin.shared.ui.combobox.FilteringMode; import com.vaadin.ui.ComboBox; import com.vaadin.ui.Label; import com.vaadin.ui.UI.LegacyWindow; @@ -31,7 +31,7 @@ public class ComboBoxReapperingOldValue extends LegacyApplication implements layout.addComponent(lbl); cbox1.setCaption("Com Box 1"); - cbox1.setFilteringMode(AbstractSelect.Filtering.FILTERINGMODE_CONTAINS); + cbox1.setFilteringMode(FilteringMode.CONTAINS); cbox1.setContainerDataSource(getContainer()); cbox1.setImmediate(true); cbox1.setNullSelectionAllowed(false); diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxValueInput.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxValueInput.java index 9e1fab0cda..356181238e 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxValueInput.java +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxValueInput.java @@ -1,5 +1,6 @@ package com.vaadin.tests.components.combobox; +import com.vaadin.shared.ui.combobox.FilteringMode; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.ComboBox; @@ -32,7 +33,7 @@ public class ComboBoxValueInput extends TestBase { addComponent(cb); cb = getComboBox("A combobox with filteringMode off", false); - cb.setFilteringMode(ComboBox.FILTERINGMODE_OFF); + cb.setFilteringMode(FilteringMode.OFF); } diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxes2.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxes2.java index c72fdd7132..867ef6b35c 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxes2.java +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxes2.java @@ -3,6 +3,7 @@ package com.vaadin.tests.components.combobox; import java.util.LinkedHashMap; import com.vaadin.server.Resource; +import com.vaadin.shared.ui.combobox.FilteringMode; import com.vaadin.tests.components.select.AbstractSelectTestCase; import com.vaadin.ui.ComboBox; @@ -14,10 +15,10 @@ public class ComboBoxes2 extends AbstractSelectTestCase { c.setInputPrompt(value); } }; - private Command filteringModeCommand = new Command() { + private Command filteringModeCommand = new Command() { @Override - public void execute(T c, Integer value, Object data) { + public void execute(T c, FilteringMode value, Object data) { c.setFilteringMode(value); } }; @@ -58,10 +59,10 @@ public class ComboBoxes2 extends AbstractSelectTestCase { } private void createFilteringModeAction(String category) { - LinkedHashMap options = new LinkedHashMap(); - options.put("Off", ComboBox.FILTERINGMODE_OFF); - options.put("Contains", ComboBox.FILTERINGMODE_CONTAINS); - options.put("Starts with", ComboBox.FILTERINGMODE_STARTSWITH); + LinkedHashMap options = new LinkedHashMap(); + options.put("Off", FilteringMode.OFF); + options.put("Contains", FilteringMode.CONTAINS); + options.put("Starts with", FilteringMode.STARTSWITH); createSelectAction("Filtering mode", category, options, "Contains", filteringModeCommand); diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java index ac3296724b..56265203a1 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java @@ -3,10 +3,10 @@ package com.vaadin.tests.components.datefield; import java.util.Date; import java.util.Locale; +import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.AbstractTestCase; import com.vaadin.ui.Alignment; import com.vaadin.ui.DateField; -import com.vaadin.ui.DateField.Resolution; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI.LegacyWindow; diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java index c085088917..070631bac2 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java @@ -7,9 +7,9 @@ import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.data.util.BeanItem; import com.vaadin.data.validator.RangeValidator; +import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.CheckBox; -import com.vaadin.ui.DateField.Resolution; import com.vaadin.ui.PopupDateField; public class DateFieldRangeValidation extends TestBase { diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldTest.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldTest.java index c502b9597e..d92199a214 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldTest.java +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldTest.java @@ -7,9 +7,9 @@ import java.util.Date; import java.util.LinkedHashMap; import java.util.Locale; +import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.abstractfield.AbstractFieldTest; import com.vaadin.ui.DateField; -import com.vaadin.ui.DateField.Resolution; public class DateFieldTest extends AbstractFieldTest { @@ -97,12 +97,12 @@ public class DateFieldTest extends AbstractFieldTest { private void createResolutionSelectAction(String category) { LinkedHashMap options = new LinkedHashMap(); - options.put("Year", DateField.Resolution.YEAR); - options.put("Month", DateField.Resolution.MONTH); - options.put("Day", DateField.Resolution.DAY); - options.put("Hour", DateField.Resolution.HOUR); - options.put("Min", DateField.Resolution.MINUTE); - options.put("Sec", DateField.Resolution.SECOND); + options.put("Year", Resolution.YEAR); + options.put("Month", Resolution.MONTH); + options.put("Day", Resolution.DAY); + options.put("Hour", Resolution.HOUR); + options.put("Min", Resolution.MINUTE); + options.put("Sec", Resolution.SECOND); createSelectAction("Resolution", category, options, "Year", resolutionCommand); diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldTimezone.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldTimezone.java index 6f31b4d80f..6109b7cc14 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldTimezone.java +++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldTimezone.java @@ -10,11 +10,12 @@ import java.util.TimeZone; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.shared.ui.combobox.FilteringMode; +import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.Log; import com.vaadin.ui.ComboBox; import com.vaadin.ui.DateField; -import com.vaadin.ui.DateField.Resolution; public class DateFieldTimezone extends TestBase { @@ -49,7 +50,7 @@ public class DateFieldTimezone extends TestBase { timezoneSelector.setImmediate(true); timezoneSelector.setNullSelectionAllowed(true); timezoneSelector.setNullSelectionItemId(nullValue); - timezoneSelector.setFilteringMode(ComboBox.FILTERINGMODE_CONTAINS); + timezoneSelector.setFilteringMode(FilteringMode.CONTAINS); timezoneSelector.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { diff --git a/uitest/src/com/vaadin/tests/components/datefield/InlineDateFields.java b/uitest/src/com/vaadin/tests/components/datefield/InlineDateFields.java index ea384d5634..1f8ef358af 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/InlineDateFields.java +++ b/uitest/src/com/vaadin/tests/components/datefield/InlineDateFields.java @@ -5,10 +5,9 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; +import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.ComponentTestCase; import com.vaadin.ui.Component; -import com.vaadin.ui.DateField; -import com.vaadin.ui.DateField.Resolution; import com.vaadin.ui.InlineDateField; @SuppressWarnings("serial") @@ -52,7 +51,7 @@ public class InlineDateFields extends ComponentTestCase { pd.setWidth(width); pd.setValue(new Date(12312312313L)); pd.setLocale(locale); - pd.setResolution(DateField.Resolution.YEAR); + pd.setResolution(Resolution.YEAR); return pd; } @@ -72,12 +71,12 @@ public class InlineDateFields extends ComponentTestCase { private Component createResolutionSelectAction() { LinkedHashMap options = new LinkedHashMap(); - options.put("Year", DateField.Resolution.YEAR); - options.put("Month", DateField.Resolution.MONTH); - options.put("Day", DateField.Resolution.DAY); - options.put("Hour", DateField.Resolution.HOUR); - options.put("Min", DateField.Resolution.MINUTE); - options.put("Sec", DateField.Resolution.SECOND); + options.put("Year", Resolution.YEAR); + options.put("Month", Resolution.MONTH); + options.put("Day", Resolution.DAY); + options.put("Hour", Resolution.HOUR); + options.put("Min", Resolution.MINUTE); + options.put("Sec", Resolution.SECOND); return createSelectAction("Resolution", options, "Year", new Command() { diff --git a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFields.java b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFields.java index e69de5de12..9daf89d950 100644 --- a/uitest/src/com/vaadin/tests/components/datefield/PopupDateFields.java +++ b/uitest/src/com/vaadin/tests/components/datefield/PopupDateFields.java @@ -5,10 +5,9 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; +import com.vaadin.shared.ui.datefield.Resolution; import com.vaadin.tests.components.ComponentTestCase; import com.vaadin.ui.Component; -import com.vaadin.ui.DateField; -import com.vaadin.ui.DateField.Resolution; import com.vaadin.ui.PopupDateField; @SuppressWarnings("serial") @@ -48,7 +47,7 @@ public class PopupDateFields extends ComponentTestCase { pd.setWidth(width); pd.setValue(new Date(12312312313L)); pd.setLocale(locale); - pd.setResolution(DateField.Resolution.YEAR); + pd.setResolution(Resolution.YEAR); return pd; } @@ -68,12 +67,12 @@ public class PopupDateFields extends ComponentTestCase { private Component createResolutionSelectAction() { LinkedHashMap options = new LinkedHashMap(); - options.put("Year", DateField.Resolution.YEAR); - options.put("Month", DateField.Resolution.MONTH); - options.put("Day", DateField.Resolution.DAY); - options.put("Hour", DateField.Resolution.HOUR); - options.put("Min", DateField.Resolution.MINUTE); - options.put("Sec", DateField.Resolution.SECOND); + options.put("Year", Resolution.YEAR); + options.put("Month", Resolution.MONTH); + options.put("Day", Resolution.DAY); + options.put("Hour", Resolution.HOUR); + options.put("Min", Resolution.MINUTE); + options.put("Sec", Resolution.SECOND); return createSelectAction("Resolution", options, "Year", new Command() { diff --git a/uitest/src/com/vaadin/tests/components/link/LinkTargetSize.java b/uitest/src/com/vaadin/tests/components/link/LinkTargetSize.java index 822a8d5991..cb537c88ae 100644 --- a/uitest/src/com/vaadin/tests/components/link/LinkTargetSize.java +++ b/uitest/src/com/vaadin/tests/components/link/LinkTargetSize.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.link; import com.vaadin.server.ExternalResource; +import com.vaadin.shared.ui.BorderStyle; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Link; @@ -23,7 +24,7 @@ public class LinkTargetSize extends TestBase { l.setTargetName("_blank"); l.setTargetWidth(300); l.setTargetHeight(300); - l.setTargetBorder(Link.TARGET_BORDER_NONE); + l.setTargetBorder(BorderStyle.NONE); addComponent(l); } diff --git a/uitest/src/com/vaadin/tests/components/table/TableMultiSelectSimple.java b/uitest/src/com/vaadin/tests/components/table/TableMultiSelectSimple.java index 56fb7c1c7d..d6a79759ac 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableMultiSelectSimple.java +++ b/uitest/src/com/vaadin/tests/components/table/TableMultiSelectSimple.java @@ -5,9 +5,9 @@ import java.util.TreeSet; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.shared.ui.MultiSelectMode; import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.Log; -import com.vaadin.ui.AbstractSelect.MultiSelectMode; import com.vaadin.ui.Button; import com.vaadin.ui.Component; import com.vaadin.ui.Table; diff --git a/uitest/src/com/vaadin/tests/components/table/Tables.java b/uitest/src/com/vaadin/tests/components/table/Tables.java index 2f06351a81..c8d1061943 100644 --- a/uitest/src/com/vaadin/tests/components/table/Tables.java +++ b/uitest/src/com/vaadin/tests/components/table/Tables.java @@ -9,9 +9,9 @@ import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; import com.vaadin.event.ItemClickEvent.ItemClickListener; import com.vaadin.server.Resource; +import com.vaadin.shared.ui.MultiSelectMode; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.components.select.AbstractSelectTestCase; -import com.vaadin.ui.AbstractSelect.MultiSelectMode; import com.vaadin.ui.Button; import com.vaadin.ui.Label; import com.vaadin.ui.Table; diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeItemClickListening.java b/uitest/src/com/vaadin/tests/components/tree/TreeItemClickListening.java index 182bc97c44..724c1c6f62 100644 --- a/uitest/src/com/vaadin/tests/components/tree/TreeItemClickListening.java +++ b/uitest/src/com/vaadin/tests/components/tree/TreeItemClickListening.java @@ -32,13 +32,13 @@ public class TreeItemClickListening extends TestBase { public void itemClick(ItemClickEvent event) { clickCounter++; switch (event.getButton()) { - case ItemClickEvent.BUTTON_LEFT: + case LEFT: log.log("Left Click"); break; - case ItemClickEvent.BUTTON_RIGHT: + case RIGHT: log.log("Right Click"); break; - case ItemClickEvent.BUTTON_MIDDLE: + case MIDDLE: log.log("Middle Click"); break; } diff --git a/uitest/src/com/vaadin/tests/components/tree/Trees.java b/uitest/src/com/vaadin/tests/components/tree/Trees.java index 8796fb854c..412840a937 100644 --- a/uitest/src/com/vaadin/tests/components/tree/Trees.java +++ b/uitest/src/com/vaadin/tests/components/tree/Trees.java @@ -10,8 +10,8 @@ import com.vaadin.data.Container.Hierarchical; import com.vaadin.data.util.HierarchicalContainer; import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; +import com.vaadin.shared.ui.MultiSelectMode; import com.vaadin.tests.components.select.AbstractSelectTestCase; -import com.vaadin.ui.AbstractSelect.MultiSelectMode; import com.vaadin.ui.Tree; import com.vaadin.ui.Tree.CollapseEvent; import com.vaadin.ui.Tree.CollapseListener; diff --git a/uitest/src/com/vaadin/tests/containers/sqlcontainer/ComboBoxUpdateProblem.java b/uitest/src/com/vaadin/tests/containers/sqlcontainer/ComboBoxUpdateProblem.java index edaefeb0c3..737563f975 100644 --- a/uitest/src/com/vaadin/tests/containers/sqlcontainer/ComboBoxUpdateProblem.java +++ b/uitest/src/com/vaadin/tests/containers/sqlcontainer/ComboBoxUpdateProblem.java @@ -1,7 +1,7 @@ package com.vaadin.tests.containers.sqlcontainer; import com.vaadin.LegacyApplication; -import com.vaadin.ui.AbstractSelect.Filtering; +import com.vaadin.shared.ui.combobox.FilteringMode; import com.vaadin.ui.ComboBox; import com.vaadin.ui.UI; @@ -18,7 +18,7 @@ public class ComboBoxUpdateProblem extends LegacyApplication { ComboBox combo = new ComboBox("Names", databaseHelper.getTestContainer()); combo.setItemCaptionPropertyId("FIELD1"); - combo.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS); + combo.setFilteringMode(FilteringMode.CONTAINS); combo.setImmediate(true); getMainWindow().addComponent(combo); diff --git a/uitest/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java b/uitest/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java index d1a924e71c..359e77197f 100644 --- a/uitest/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java +++ b/uitest/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java @@ -2,7 +2,6 @@ package com.vaadin.tests.layouts; import com.vaadin.event.LayoutEvents.LayoutClickEvent; import com.vaadin.event.LayoutEvents.LayoutClickListener; -import com.vaadin.event.MouseEvents.ClickEvent; import com.vaadin.tests.components.AbstractTestCase; import com.vaadin.tests.util.Log; import com.vaadin.ui.AbsoluteLayout; @@ -147,13 +146,7 @@ public class TestLayoutClickListeners extends AbstractTestCase { target = ((Label) component).getValue().toString(); } } - String button = "left"; - if (event.getButton() == ClickEvent.BUTTON_RIGHT) { - button = "right"; - } else if (event.getButton() == ClickEvent.BUTTON_MIDDLE) { - button = "middle"; - - } + String button = event.getButtonName(); String type = "click"; if (event.isDoubleClick()) { type = "double-click"; diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1506_Panel.java b/uitest/src/com/vaadin/tests/tickets/Ticket1506_Panel.java index 9835e046dc..5f36427733 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket1506_Panel.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket1506_Panel.java @@ -2,6 +2,7 @@ package com.vaadin.tests.tickets; import com.vaadin.data.Container; import com.vaadin.data.util.ObjectProperty; +import com.vaadin.shared.ui.combobox.FilteringMode; import com.vaadin.ui.Button; import com.vaadin.ui.Component; import com.vaadin.ui.Panel; @@ -37,7 +38,7 @@ public class Ticket1506_Panel extends Panel { private Component initSelect(Container containerDataSource, String caption, ObjectProperty property) { Select select = new Select(caption); - select.setFilteringMode(Select.FILTERINGMODE_CONTAINS); + select.setFilteringMode(FilteringMode.CONTAINS); select.setImmediate(true); select.setNullSelectionAllowed(false); select.setItemCaptionPropertyId(Ticket1506_TestContainer.PROPERTY_2_ID); diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2009.java b/uitest/src/com/vaadin/tests/tickets/Ticket2009.java index 538ffb762b..64429ed75b 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2009.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2009.java @@ -44,7 +44,7 @@ public class Ticket2009 extends com.vaadin.LegacyApplication { public void itemClick(ItemClickEvent event) { events.addComponent(new Label(new Label("Click:" + (event.isDoubleClick() ? "double" : "single") - + " button:" + event.getButton() + " propertyId:" + + " button:" + event.getButtonName() + " propertyId:" + event.getPropertyId() + " itemID:" + event.getItemId() + " item:" + event.getItem()))); @@ -67,7 +67,7 @@ public class Ticket2009 extends com.vaadin.LegacyApplication { public void itemClick(ItemClickEvent event) { events2.addComponent(new Label("Click:" + (event.isDoubleClick() ? "double" : "single") - + " button:" + event.getButton() + " propertyId:" + + " button:" + event.getButtonName() + " propertyId:" + event.getPropertyId() + " itemID:" + event.getItemId() + " item:" + event.getItem())); if (event.isDoubleClick()) { diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2043.java b/uitest/src/com/vaadin/tests/tickets/Ticket2043.java index d3d984c8be..834301fb1c 100644 --- a/uitest/src/com/vaadin/tests/tickets/Ticket2043.java +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2043.java @@ -2,6 +2,7 @@ package com.vaadin.tests.tickets; import com.vaadin.LegacyApplication; import com.vaadin.server.ExternalResource; +import com.vaadin.shared.ui.BorderStyle; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Link; import com.vaadin.ui.UI.LegacyWindow; @@ -21,7 +22,7 @@ public class Ticket2043 extends LegacyApplication { private void createUI(GridLayout layout) { Link l = new Link("Vaadin home (new 200x200 window, no decor, icon)", new ExternalResource("http://www.vaadin.com"), "_blank", 200, - 200, Link.TARGET_BORDER_NONE); + 200, BorderStyle.NONE); layout.addComponent(l); }