]> source.dussan.org Git - vaadin-framework.git/commitdiff
Constants -> enums (#9072)
authorPekka Hyvönen <pekka@vaadin.com>
Mon, 10 Sep 2012 19:12:47 +0000 (22:12 +0300)
committerArtur Signell <artur@vaadin.com>
Tue, 11 Sep 2012 09:19:02 +0000 (12:19 +0300)
Patch from Pekka with minor changes (ButtonCode -> MouseButton, FilteringMode -> ComboBox)

58 files changed:
client/src/com/vaadin/client/DateTimeService.java
client/src/com/vaadin/client/MouseEventDetailsBuilder.java
client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
client/src/com/vaadin/client/ui/combobox/VFilterSelect.java
client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java
client/src/com/vaadin/client/ui/datefield/InlineDateFieldConnector.java
client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
client/src/com/vaadin/client/ui/datefield/TextualDateConnector.java
client/src/com/vaadin/client/ui/datefield/VCalendarPanel.java
client/src/com/vaadin/client/ui/datefield/VDateField.java
client/src/com/vaadin/client/ui/datefield/VDateFieldCalendar.java
client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java
client/src/com/vaadin/client/ui/datefield/VTextualDate.java
client/src/com/vaadin/client/ui/splitpanel/VAbstractSplitPanel.java
client/src/com/vaadin/client/ui/splitpanel/VSplitPanelHorizontal.java
client/src/com/vaadin/client/ui/splitpanel/VSplitPanelVertical.java
client/src/com/vaadin/client/ui/tree/TreeConnector.java
client/src/com/vaadin/client/ui/tree/VTree.java
server/src/com/vaadin/data/validator/DateRangeValidator.java
server/src/com/vaadin/event/MouseEvents.java
server/src/com/vaadin/server/Page.java
server/src/com/vaadin/ui/AbstractSelect.java
server/src/com/vaadin/ui/ComboBox.java
server/src/com/vaadin/ui/DateField.java
server/src/com/vaadin/ui/Link.java
server/src/com/vaadin/ui/Table.java
server/src/com/vaadin/ui/Tree.java
server/tests/src/com/vaadin/tests/server/component/datefield/ResolutionTest.java
server/tests/src/com/vaadin/tests/server/component/table/TestMultipleSelection.java
shared/src/com/vaadin/shared/MouseEventDetails.java
shared/src/com/vaadin/shared/ui/BorderStyle.java
shared/src/com/vaadin/shared/ui/MultiSelectMode.java [new file with mode: 0644]
shared/src/com/vaadin/shared/ui/Orientation.java [new file with mode: 0644]
shared/src/com/vaadin/shared/ui/combobox/FilteringMode.java [new file with mode: 0644]
shared/src/com/vaadin/shared/ui/datefield/Resolution.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/Components.java
uitest/src/com/vaadin/tests/TestSizeableIncomponents.java
uitest/src/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcut.java
uitest/src/com/vaadin/tests/components/combobox/ComboBoxNavigation.java
uitest/src/com/vaadin/tests/components/combobox/ComboBoxReapperingOldValue.java
uitest/src/com/vaadin/tests/components/combobox/ComboBoxValueInput.java
uitest/src/com/vaadin/tests/components/combobox/ComboBoxes2.java
uitest/src/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java
uitest/src/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java
uitest/src/com/vaadin/tests/components/datefield/DateFieldTest.java
uitest/src/com/vaadin/tests/components/datefield/DateFieldTimezone.java
uitest/src/com/vaadin/tests/components/datefield/InlineDateFields.java
uitest/src/com/vaadin/tests/components/datefield/PopupDateFields.java
uitest/src/com/vaadin/tests/components/link/LinkTargetSize.java
uitest/src/com/vaadin/tests/components/table/TableMultiSelectSimple.java
uitest/src/com/vaadin/tests/components/table/Tables.java
uitest/src/com/vaadin/tests/components/tree/TreeItemClickListening.java
uitest/src/com/vaadin/tests/components/tree/Trees.java
uitest/src/com/vaadin/tests/containers/sqlcontainer/ComboBoxUpdateProblem.java
uitest/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java
uitest/src/com/vaadin/tests/tickets/Ticket1506_Panel.java
uitest/src/com/vaadin/tests/tickets/Ticket2009.java
uitest/src/com/vaadin/tests/tickets/Ticket2043.java

index f33c69576a6897d4ac015feab250e825fecc1f29..caadd5412c7ba267707f10cb4c853d5a99268be7 100644 (file)
@@ -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();
index 2e8d669844484329a36c3a03a40c68dbc498c345..cda2eec07fe690475effe7e89b5a2afd296e8274 100644 (file)
@@ -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());
index d89836d6e273e8769885a528c900a8c4b99eaa06..bcab8e71fcf58657664cc866300d884b9fcb5726 100644 (file)
@@ -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;
index 86926228929e9973a09c23c4d6628acdb5b1d0d5..203f9821807f56ffac638424939d41270bec3b9c 100644 (file)
@@ -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";
index cc98767e003e770802e79527b1994dd5fb41e5fa..994a9e1d66bcaa4c1e5760e0b5b3e919ceb8c26c 100644 (file)
@@ -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) {
index 0bcb828b19a95c0e732894d6293e4563bb1a5c7f..2f2dd380d6d6b242d793aa2955127d0d3a1cf565 100644 (file)
@@ -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
index d09f3a4db675e56003d39125dd711fb6d1f72523..f5be276575936e9be95d9e3172a899a147a70d8b 100644 (file)
@@ -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
index f0a99192fa5e84d60a94fc258fb9f724be13af32..ef4b53f9f4d2ca14667d3d9832d7279c57d9e570 100644 (file)
@@ -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
index 9d519e3179e198c3b10fc133d85d9c458175fa3b..0d21638417e15b1271d4194f35ca49b186dffcaf 100644 (file)
@@ -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, "<strong>"
                         + getDateTimeService().getShortDay(day) + "</strong>");
             } 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()) {
index 788433027b38042424180b8b26fc382806b577f8..915ac4c54d7188a2ce4b40e49a329c0262ec489b 100644 (file)
@@ -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;
     }
 
index cf998421fdecb28919898cdef02cba5777ad9d89..41b7aedae6b92fca6f55672f53e4a48a22e591f1 100644 (file)
@@ -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",
index e5aeb2efe868c0178581447a982307863eb9b674..79ede5b0135521acd260a2caedb973dea0d9fb8c 100644 (file)
@@ -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);
                             }
index 5d19cf5db265b71c1776ef673e534a8c6234cbec..e2d9962979b30f0381dd900d7198c9dee54561e9 100644 (file)
@@ -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", "");
         }
 
index 088e743d7a99fb352387c2ca05e191692958dce7..bcb8809e90d91a8bb974dbb855472d52bfd95fda 100644 (file)
@@ -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";
index f347a8521c81d5bc3fa3c3d3861590a210bb0c34..c277d594b9dd4ffa07fbef7d2947af0eb7473a5f 100644 (file)
 
 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);
     }
 }
index 3f9826833b519b53f715a96cbc28d4cbd77606b5..4f96d7f746de94fd5436834cafe6268975f757f7 100644 (file)
 
 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);
     }
 }
index 7fd3b105b6f3ec4876fa4af6b189ce4b693ee543..10a3c0fb9537262e3119723c2a53d206ae3695da 100644 (file)
@@ -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"));
             }
         }
 
index 2be3d7b33bb5461949cc7215f99c065cba4897d9..ca021b6dfcce5a7f938791f47ced06bdbb68b05c 100644 (file)
@@ -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<String, TreeNode> keyToNode = new HashMap<String, TreeNode>();
 
@@ -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;
index 44c0d1e929f2a42b131b6a7034211f9286a10148..51eaa2e59b40bd417f7d1fd62834aee83ceb41e0 100644 (file)
@@ -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.
index e287055c2b383a8084c39d643d39bec078261133..37c6d665b5321dc6ebb7de88a19d294f5e0f3e6d 100644 (file)
@@ -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();
         }
 
index ccc400341eadd3eb69ab659ba5cb05de6bcaa336..bfbfe53429ceebddcdb349cdaf3db78f9b8d8d7e 100644 (file)
@@ -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;
 
     /**
index 4de3f90d15180828354b2163d672123cecc33fb5..45df42a9be61c4b03c3b82392beb8141eecc4f8c 100644 (file)
@@ -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<Object> implements
     /**
      * Interface for option filtering, used to filter options based on user
      * entered value. The value is matched to the item caption.
-     * <code>FILTERINGMODE_OFF</code> (0) turns the filtering off.
-     * <code>FILTERINGMODE_STARTSWITH</code> (1) matches from the start of the
-     * caption. <code>FILTERINGMODE_CONTAINS</code> (1) matches anywhere in the
+     * <code>FilteringMode.OFF</code> (0) turns the filtering off.
+     * <code>FilteringMode.STARTSWITH</code> (1) matches from the start of the
+     * caption. <code>FilteringMode.CONTAINS</code> (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<Object> 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
     }
 
     /**
index 4f852c2b7b85a88e84103061d99f8f05689c13c8..4987d69fdd08bcc1c38b8d86b025c63ddb304335 100644 (file)
@@ -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<Object>(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;
     }
 
index f54959fb0afed62b6b401a6f83c8a487be7daaf3..39230bf662a43f3022914429bacc3c7a61699c20 100644 (file)
 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;
 
 /**
  * <p>
@@ -63,71 +62,6 @@ import com.vaadin.shared.ui.datefield.DateFieldConstants;
 public class DateField extends AbstractField<Date> 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<Resolution> getResolutionsHigherOrEqualTo(
-                Resolution r) {
-            List<Resolution> resolutions = new ArrayList<DateField.Resolution>();
-            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<Resolution> getResolutionsLowerThan(Resolution r) {
-            List<Resolution> resolutions = new ArrayList<DateField.Resolution>();
-            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<Date> implements
 
     private TimeZone timeZone = null;
 
-    private static Map<Resolution, String> variableNameForResolution = new HashMap<DateField.Resolution, String>();
+    private static Map<Resolution, String> variableNameForResolution = new HashMap<Resolution, String>();
     {
         variableNameForResolution.put(Resolution.SECOND, "sec");
         variableNameForResolution.put(Resolution.MINUTE, "min");
@@ -372,7 +306,7 @@ public class DateField extends AbstractField<Date> implements
 
             // Gets the new date in parts
             boolean hasChanges = false;
-            Map<Resolution, Integer> calendarFieldChanges = new HashMap<DateField.Resolution, Integer>();
+            Map<Resolution, Integer> calendarFieldChanges = new HashMap<Resolution, Integer>();
 
             for (Resolution r : Resolution
                     .getResolutionsHigherOrEqualTo(resolution)) {
index a2737e4483f59cbd2b2bb646190c62e6badaa3c7..6e286174a557c5d6a705ec7bcfaf0ecf2fce224d 100644 (file)
@@ -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;
 
index 87962d5d15ae8264e820ad89e16fa4f341a19103..d9e1403a03a43e25d1f03b92feb7d37a10a380cd 100644 (file)
@@ -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;
 
 /**
index 44a1208cf87d437513ff14ae21269279e009fc39..1ba011dd00da34de95f6bb49b2e43e3f0406734b 100644 (file)
@@ -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");
index 00b5c60dad61b7dff9c2fe886b3679f38eda2306..ae72f9c7430d5db939af761fdd8b5ead0298d72f 100644 (file)
@@ -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 {
 
index 767b651b686990867cd0456b8f55ae90f00beb6f..ff80cdb3c3352ce42461987338a9333c08b764fe 100644 (file)
@@ -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 {
index ccfaac3a00a747d1a56cf08531ff32a8daba6e9a..733d4c08e7879b7965d215ec6c9f70ec1dc5a922 100644 (file)
@@ -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() {
index 786d340f1c39de6ae17789610660e7d1f67d567a..8a48253a222a727899c7b647bea6f3de1b518f05 100755 (executable)
  */
 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 (file)
index 0000000..13eef45
--- /dev/null
@@ -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 (file)
index 0000000..b055f07
--- /dev/null
@@ -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 (file)
index 0000000..eaae85c
--- /dev/null
@@ -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 (file)
index 0000000..a457c99
--- /dev/null
@@ -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<Resolution> getResolutionsHigherOrEqualTo(
+            Resolution r) {
+        List<Resolution> resolutions = new ArrayList<Resolution>();
+        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<Resolution> getResolutionsLowerThan(Resolution r) {
+        List<Resolution> resolutions = new ArrayList<Resolution>();
+        Resolution[] values = Resolution.values();
+        for (int i = r.ordinal() - 1; i >= 0; i--) {
+            resolutions.add(values[i]);
+        }
+        return resolutions;
+    }
+};
index 8295528fc3a1688feedf3c8fd385513b1a3c216d..97a1479df39023f7a5ca89a9dfd2b46476f086cd 100644 (file)
@@ -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);
                     }
                 }
index cc7ba23405c6071c5731bcea4021d8f3ca3490ef..732895cddf975a843cfa6131157e0fa3c75850bc 100644 (file)
@@ -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("<<-|");
index 38bdf0c5fe517105613a4a863b861727bcd88c03..f7d12356f78e8c07196e3466f59ebc98c6977a2b 100644 (file)
@@ -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);
 
index 245fc123dfed262f529a1193567aad2c333cd6fd..0e355af30263285cf27816dd9e28704f2379b226 100644 (file)
@@ -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);
 
     }
index 1ae16db2cb1c39f5ae090e8984cba9f310c255d6..6b9b05e4ac6e5643ed9431c6667efc85e126bf23 100644 (file)
@@ -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);
index 9e1fab0cdacc7dfb636929cb29e0b8226420b89b..356181238efaa3f0d3d7fa842ddc7a865222f042 100644 (file)
@@ -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);
 
     }
 
index c72fdd71326736e28afd469ee9dec05a16508966..867ef6b35c117fc849803e144a613fb8a273790f 100644 (file)
@@ -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<T extends ComboBox> extends AbstractSelectTestCase<T> {
             c.setInputPrompt(value);
         }
     };
-    private Command<T, Integer> filteringModeCommand = new Command<T, Integer>() {
+    private Command<T, FilteringMode> filteringModeCommand = new Command<T, FilteringMode>() {
 
         @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<T extends ComboBox> extends AbstractSelectTestCase<T> {
     }
 
     private void createFilteringModeAction(String category) {
-        LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
-        options.put("Off", ComboBox.FILTERINGMODE_OFF);
-        options.put("Contains", ComboBox.FILTERINGMODE_CONTAINS);
-        options.put("Starts with", ComboBox.FILTERINGMODE_STARTSWITH);
+        LinkedHashMap<String, FilteringMode> options = new LinkedHashMap<String, FilteringMode>();
+        options.put("Off", FilteringMode.OFF);
+        options.put("Contains", FilteringMode.CONTAINS);
+        options.put("Starts with", FilteringMode.STARTSWITH);
 
         createSelectAction("Filtering mode", category, options, "Contains",
                 filteringModeCommand);
index ac3296724b690555d00695b019fc858dd4b12a52..56265203a12a61d2787167e08c63bc632e0dbbbb 100644 (file)
@@ -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;
 
index c0850889177aee172df90d9acf6aac5eed3563a2..070631bac2142580da05946dae032a2aa33ccfab 100644 (file)
@@ -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 {
index c502b9597e38034e31e7756ed31e594ce31388b3..d92199a214bf0d1a3ecc4e183d5325f2f6a4aa2e 100644 (file)
@@ -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<T extends DateField> extends AbstractFieldTest<T> {
 
@@ -97,12 +97,12 @@ public class DateFieldTest<T extends DateField> extends AbstractFieldTest<T> {
 
     private void createResolutionSelectAction(String category) {
         LinkedHashMap<String, Resolution> options = new LinkedHashMap<String, Resolution>();
-        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);
index 6f31b4d80fd39bcfc70a504c007c12e3eb703e6d..6109b7cc142c56850278f1e95cdec649db70842e 100644 (file)
@@ -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) {
index ea384d5634f1324633012a46a4844a059761f57a..1f8ef358af7bd439d2bc18819169ca3e2af20aba 100644 (file)
@@ -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<InlineDateField> {
         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<InlineDateField> {
 
     private Component createResolutionSelectAction() {
         LinkedHashMap<String, Resolution> options = new LinkedHashMap<String, Resolution>();
-        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<InlineDateField, Resolution>() {
 
index e69de5de12fa9bc59c30a5d599d1c49a1c9b5190..9daf89d9507cd87801d56ab7a0bfd53daa62652d 100644 (file)
@@ -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<PopupDateField> {
         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<PopupDateField> {
 
     private Component createResolutionSelectAction() {
         LinkedHashMap<String, Resolution> options = new LinkedHashMap<String, Resolution>();
-        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<PopupDateField, Resolution>() {
 
index 822a8d59917a490c5376f23e2728570fa9c9b7e7..cb537c88ae41b342ee52b05de5aa008ddeed8a21 100644 (file)
@@ -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);
     }
 
index 56fb7c1c7d82fb08fbb6bfb000670d0fc0247529..d6a79759ac13d8691cc2eec73b1a05764a3903ab 100644 (file)
@@ -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;
index 2f06351a81c665bb0a1936b78d7f910648907f8c..c8d10619435cea447d95924b74173cf8cbd63c42 100644 (file)
@@ -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;
index 182bc97c4426eff07841e3bd3c4557f5d4d48ce3..724c1c6f62e98d08138b8c3aea9a9714e8af5bed 100644 (file)
@@ -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;
                 }
index 8796fb854ce74fbb6f851da9e15263a0865f3d05..412840a937b8c40d6572f0100ce1cb14439fdbb0 100644 (file)
@@ -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;
index edaefeb0c3ae9e4f704ee59b1b2c9180cdb836aa..737563f975179f901eeed99e042d3e332917c08f 100644 (file)
@@ -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);
index d1a924e71c6c744b6135f5d2d3a329a861b84fd5..359e77197fc273a66edce003a66eaca342d01b6d 100644 (file)
@@ -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";
index 9835e046dc6b5346b0a18cade347bf9c32baecc1..5f36427733344e806d706f91b15b2fe12fdaaf6e 100644 (file)
@@ -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);
index 538ffb762b87d986740bc5f0b541558b6565fead..64429ed75b1361fa1d55b8f99f8ef04eb2c46032 100644 (file)
@@ -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()) {
index d3d984c8be454bcd7fc384e2e21253fdaf58209e..834301fb1cac45be303ebcf59581de880b548ced 100644 (file)
@@ -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);
     }