summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorPekka Hyvönen <pekka@vaadin.com>2012-09-10 22:12:47 +0300
committerArtur Signell <artur@vaadin.com>2012-09-11 12:19:02 +0300
commit0f5284bb827b5f04c6c064c851b851604293665a (patch)
tree4c9949ba7fa08dfae4f276f95c6928cae8b7760f /client
parent8a904080835193e322e1f006aa65f490f2cd930a (diff)
downloadvaadin-framework-0f5284bb827b5f04c6c064c851b851604293665a.tar.gz
vaadin-framework-0f5284bb827b5f04c6c064c851b851604293665a.zip
Constants -> enums (#9072)
Patch from Pekka with minor changes (ButtonCode -> MouseButton, FilteringMode -> ComboBox)
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/DateTimeService.java14
-rw-r--r--client/src/com/vaadin/client/MouseEventDetailsBuilder.java9
-rw-r--r--client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java4
-rw-r--r--client/src/com/vaadin/client/ui/combobox/VFilterSelect.java14
-rw-r--r--client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java35
-rw-r--r--client/src/com/vaadin/client/ui/datefield/InlineDateFieldConnector.java7
-rw-r--r--client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java7
-rw-r--r--client/src/com/vaadin/client/ui/datefield/TextualDateConnector.java3
-rw-r--r--client/src/com/vaadin/client/ui/datefield/VCalendarPanel.java51
-rw-r--r--client/src/com/vaadin/client/ui/datefield/VDateField.java35
-rw-r--r--client/src/com/vaadin/client/ui/datefield/VDateFieldCalendar.java19
-rw-r--r--client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java16
-rw-r--r--client/src/com/vaadin/client/ui/datefield/VTextualDate.java80
-rw-r--r--client/src/com/vaadin/client/ui/splitpanel/VAbstractSplitPanel.java43
-rw-r--r--client/src/com/vaadin/client/ui/splitpanel/VSplitPanelHorizontal.java4
-rw-r--r--client/src/com/vaadin/client/ui/splitpanel/VSplitPanelVertical.java4
-rw-r--r--client/src/com/vaadin/client/ui/tree/TreeConnector.java7
-rw-r--r--client/src/com/vaadin/client/ui/tree/VTree.java22
18 files changed, 212 insertions, 162 deletions
diff --git a/client/src/com/vaadin/client/DateTimeService.java b/client/src/com/vaadin/client/DateTimeService.java
index f33c69576a..caadd5412c 100644
--- a/client/src/com/vaadin/client/DateTimeService.java
+++ b/client/src/com/vaadin/client/DateTimeService.java
@@ -20,7 +20,7 @@ import java.util.Date;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.LocaleInfo;
-import com.vaadin.client.ui.datefield.VDateField;
+import com.vaadin.shared.ui.datefield.Resolution;
/**
* This class provides date/time parsing services to all components on the
@@ -201,7 +201,7 @@ public class DateTimeService {
}
public static boolean isInRange(Date date, Date rangeStart, Date rangeEnd,
- int resolution) {
+ Resolution resolution) {
Date s;
Date e;
if (rangeStart.after(rangeEnd)) {
@@ -215,31 +215,31 @@ public class DateTimeService {
long end = e.getYear() * 10000000000l;
long target = date.getYear() * 10000000000l;
- if (resolution == VDateField.RESOLUTION_YEAR) {
+ if (resolution == Resolution.YEAR) {
return (start <= target && end >= target);
}
start += s.getMonth() * 100000000l;
end += e.getMonth() * 100000000l;
target += date.getMonth() * 100000000l;
- if (resolution == VDateField.RESOLUTION_MONTH) {
+ if (resolution == Resolution.MONTH) {
return (start <= target && end >= target);
}
start += s.getDate() * 1000000l;
end += e.getDate() * 1000000l;
target += date.getDate() * 1000000l;
- if (resolution == VDateField.RESOLUTION_DAY) {
+ if (resolution == Resolution.DAY) {
return (start <= target && end >= target);
}
start += s.getHours() * 10000l;
end += e.getHours() * 10000l;
target += date.getHours() * 10000l;
- if (resolution == VDateField.RESOLUTION_HOUR) {
+ if (resolution == Resolution.HOUR) {
return (start <= target && end >= target);
}
start += s.getMinutes() * 100l;
end += e.getMinutes() * 100l;
target += date.getMinutes() * 100l;
- if (resolution == VDateField.RESOLUTION_MIN) {
+ if (resolution == Resolution.MINUTE) {
return (start <= target && end >= target);
}
start += s.getSeconds();
diff --git a/client/src/com/vaadin/client/MouseEventDetailsBuilder.java b/client/src/com/vaadin/client/MouseEventDetailsBuilder.java
index 2e8d669844..cda2eec07f 100644
--- a/client/src/com/vaadin/client/MouseEventDetailsBuilder.java
+++ b/client/src/com/vaadin/client/MouseEventDetailsBuilder.java
@@ -19,6 +19,7 @@ import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.user.client.Event;
import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.MouseEventDetails.MouseButton;
/**
* Helper class for constructing a MouseEventDetails object from a
@@ -58,7 +59,13 @@ public class MouseEventDetailsBuilder {
mouseEventDetails.setType(Event.getTypeInt(evt.getType()));
mouseEventDetails.setClientX(Util.getTouchOrMouseClientX(evt));
mouseEventDetails.setClientY(Util.getTouchOrMouseClientY(evt));
- mouseEventDetails.setButton(evt.getButton());
+ if (evt.getButton() == NativeEvent.BUTTON_LEFT) {
+ mouseEventDetails.setButton(MouseButton.LEFT);
+ } else if (evt.getButton() == NativeEvent.BUTTON_RIGHT) {
+ mouseEventDetails.setButton(MouseButton.RIGHT);
+ } else if (evt.getButton() == NativeEvent.BUTTON_MIDDLE) {
+ mouseEventDetails.setButton(MouseButton.MIDDLE);
+ }
mouseEventDetails.setAltKey(evt.getAltKey());
mouseEventDetails.setCtrlKey(evt.getCtrlKey());
mouseEventDetails.setMetaKey(evt.getMetaKey());
diff --git a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
index d89836d6e2..bcab8e71fc 100644
--- a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
+++ b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
@@ -27,6 +27,7 @@ import com.vaadin.client.ui.combobox.VFilterSelect.FilterSelectSuggestion;
import com.vaadin.client.ui.menubar.MenuItem;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.combobox.ComboBoxConstants;
+import com.vaadin.shared.ui.combobox.FilteringMode;
import com.vaadin.ui.ComboBox;
@Connect(ComboBox.class)
@@ -68,7 +69,8 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
}
if (uidl.hasAttribute("filteringmode")) {
- getWidget().filteringmode = uidl.getIntAttribute("filteringmode");
+ getWidget().filteringmode = FilteringMode.valueOf(uidl
+ .getStringAttribute("filteringmode"));
}
getWidget().immediate = getState().immediate;
diff --git a/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java b/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java
index 8692622892..203f982180 100644
--- a/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java
+++ b/client/src/com/vaadin/client/ui/combobox/VFilterSelect.java
@@ -73,6 +73,7 @@ import com.vaadin.client.ui.menubar.MenuItem;
import com.vaadin.shared.ComponentState;
import com.vaadin.shared.EventId;
import com.vaadin.shared.ui.ComponentStateUtil;
+import com.vaadin.shared.ui.combobox.FilteringMode;
/**
* Client side implementation of the Select component.
@@ -741,7 +742,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
}
} else if (item != null
&& !"".equals(lastFilter)
- && (filteringmode == FILTERINGMODE_CONTAINS ? item
+ && (filteringmode == FilteringMode.CONTAINS ? item
.getText().toLowerCase()
.contains(lastFilter.toLowerCase()) : item
.getText().toLowerCase()
@@ -827,9 +828,12 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
}
}
- public static final int FILTERINGMODE_OFF = 0;
- public static final int FILTERINGMODE_STARTSWITH = 1;
- public static final int FILTERINGMODE_CONTAINS = 2;
+ @Deprecated
+ public static final FilteringMode FILTERINGMODE_OFF = FilteringMode.OFF;
+ @Deprecated
+ public static final FilteringMode FILTERINGMODE_STARTSWITH = FilteringMode.STARTSWITH;
+ @Deprecated
+ public static final FilteringMode FILTERINGMODE_CONTAINS = FilteringMode.CONTAINS;
private static final String CLASSNAME = "v-filterselect";
private static final String STYLE_NO_INPUT = "no-input";
@@ -928,7 +932,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
protected boolean enabled;
protected boolean readonly;
- protected int filteringmode = FILTERINGMODE_OFF;
+ protected FilteringMode filteringmode = FilteringMode.OFF;
// shown in unfocused empty field, disappears on focus (e.g "Search here")
private static final String CLASSNAME_PROMPT = "prompt";
diff --git a/client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java
index cc98767e00..994a9e1d66 100644
--- a/client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java
+++ b/client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java
@@ -24,6 +24,7 @@ import com.vaadin.client.UIDL;
import com.vaadin.client.VConsole;
import com.vaadin.client.ui.AbstractFieldConnector;
import com.vaadin.shared.ui.datefield.DateFieldConstants;
+import com.vaadin.shared.ui.datefield.Resolution;
public class AbstractDateFieldConnector extends AbstractFieldConnector
implements Paintable {
@@ -62,19 +63,19 @@ public class AbstractDateFieldConnector extends AbstractFieldConnector
.getBooleanAttribute(DateFieldConstants.ATTR_WEEK_NUMBERS)
&& getWidget().dts.getFirstDayOfWeek() == 1;
- int newResolution;
+ Resolution newResolution;
if (uidl.hasVariable("sec")) {
- newResolution = VDateField.RESOLUTION_SEC;
+ newResolution = Resolution.SECOND;
} else if (uidl.hasVariable("min")) {
- newResolution = VDateField.RESOLUTION_MIN;
+ newResolution = Resolution.MINUTE;
} else if (uidl.hasVariable("hour")) {
- newResolution = VDateField.RESOLUTION_HOUR;
+ newResolution = Resolution.HOUR;
} else if (uidl.hasVariable("day")) {
- newResolution = VDateField.RESOLUTION_DAY;
+ newResolution = Resolution.DAY;
} else if (uidl.hasVariable("month")) {
- newResolution = VDateField.RESOLUTION_MONTH;
+ newResolution = Resolution.MONTH;
} else {
- newResolution = VDateField.RESOLUTION_YEAR;
+ newResolution = Resolution.YEAR;
}
// Remove old stylename that indicates current resolution
@@ -96,16 +97,16 @@ public class AbstractDateFieldConnector extends AbstractFieldConnector
true);
final int year = uidl.getIntVariable("year");
- final int month = (getWidget().currentResolution >= VDateField.RESOLUTION_MONTH) ? uidl
- .getIntVariable("month") : -1;
- final int day = (getWidget().currentResolution >= VDateField.RESOLUTION_DAY) ? uidl
- .getIntVariable("day") : -1;
- final int hour = (getWidget().currentResolution >= VDateField.RESOLUTION_HOUR) ? uidl
- .getIntVariable("hour") : 0;
- final int min = (getWidget().currentResolution >= VDateField.RESOLUTION_MIN) ? uidl
- .getIntVariable("min") : 0;
- final int sec = (getWidget().currentResolution >= VDateField.RESOLUTION_SEC) ? uidl
- .getIntVariable("sec") : 0;
+ final int month = (getWidget().currentResolution.getCalendarField() >= Resolution.MONTH
+ .getCalendarField()) ? uidl.getIntVariable("month") : -1;
+ final int day = (getWidget().currentResolution.getCalendarField() >= Resolution.DAY
+ .getCalendarField()) ? uidl.getIntVariable("day") : -1;
+ final int hour = (getWidget().currentResolution.getCalendarField() >= Resolution.HOUR
+ .getCalendarField()) ? uidl.getIntVariable("hour") : 0;
+ final int min = (getWidget().currentResolution.getCalendarField() >= Resolution.MINUTE
+ .getCalendarField()) ? uidl.getIntVariable("min") : 0;
+ final int sec = (getWidget().currentResolution.getCalendarField() >= Resolution.SECOND
+ .getCalendarField()) ? uidl.getIntVariable("sec") : 0;
// Construct new date for this datefield (only if not null)
if (year > -1) {
diff --git a/client/src/com/vaadin/client/ui/datefield/InlineDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/InlineDateFieldConnector.java
index 0bcb828b19..2f2dd380d6 100644
--- a/client/src/com/vaadin/client/ui/datefield/InlineDateFieldConnector.java
+++ b/client/src/com/vaadin/client/ui/datefield/InlineDateFieldConnector.java
@@ -23,6 +23,7 @@ import com.vaadin.client.UIDL;
import com.vaadin.client.ui.datefield.VCalendarPanel.FocusChangeListener;
import com.vaadin.client.ui.datefield.VCalendarPanel.TimeChangeListener;
import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.datefield.Resolution;
import com.vaadin.ui.InlineDateField;
@Connect(InlineDateField.class)
@@ -49,7 +50,8 @@ public class InlineDateFieldConnector extends AbstractDateFieldConnector {
getWidget().calendarPanel.setDate(null);
}
- if (getWidget().currentResolution > VDateField.RESOLUTION_DAY) {
+ if (getWidget().currentResolution.getCalendarField() > Resolution.DAY
+ .getCalendarField()) {
getWidget().calendarPanel
.setTimeChangeListener(new TimeChangeListener() {
@Override
@@ -74,7 +76,8 @@ public class InlineDateFieldConnector extends AbstractDateFieldConnector {
});
}
- if (getWidget().currentResolution <= VDateField.RESOLUTION_MONTH) {
+ if (getWidget().currentResolution.getCalendarField() <= Resolution.MONTH
+ .getCalendarField()) {
getWidget().calendarPanel
.setFocusChangeListener(new FocusChangeListener() {
@Override
diff --git a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
index d09f3a4db6..f5be276575 100644
--- a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
+++ b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
@@ -24,6 +24,7 @@ import com.vaadin.client.UIDL;
import com.vaadin.client.ui.datefield.VCalendarPanel.FocusChangeListener;
import com.vaadin.client.ui.datefield.VCalendarPanel.TimeChangeListener;
import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.datefield.Resolution;
import com.vaadin.ui.DateField;
@Connect(DateField.class)
@@ -60,7 +61,8 @@ public class PopupDateFieldConnector extends TextualDateConnector {
}
getWidget().calendarToggle.setEnabled(getWidget().enabled);
- if (getWidget().currentResolution <= VPopupCalendar.RESOLUTION_MONTH) {
+ if (getWidget().currentResolution.getCalendarField() <= Resolution.MONTH
+ .getCalendarField()) {
getWidget().calendar
.setFocusChangeListener(new FocusChangeListener() {
@Override
@@ -76,7 +78,8 @@ public class PopupDateFieldConnector extends TextualDateConnector {
getWidget().calendar.setFocusChangeListener(null);
}
- if (getWidget().currentResolution > VPopupCalendar.RESOLUTION_DAY) {
+ if (getWidget().currentResolution.getCalendarField() > Resolution.DAY
+ .getCalendarField()) {
getWidget().calendar
.setTimeChangeListener(new TimeChangeListener() {
@Override
diff --git a/client/src/com/vaadin/client/ui/datefield/TextualDateConnector.java b/client/src/com/vaadin/client/ui/datefield/TextualDateConnector.java
index f0a99192fa..ef4b53f9f4 100644
--- a/client/src/com/vaadin/client/ui/datefield/TextualDateConnector.java
+++ b/client/src/com/vaadin/client/ui/datefield/TextualDateConnector.java
@@ -18,12 +18,13 @@ package com.vaadin.client.ui.datefield;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.UIDL;
+import com.vaadin.shared.ui.datefield.Resolution;
public class TextualDateConnector extends AbstractDateFieldConnector {
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- int origRes = getWidget().currentResolution;
+ Resolution origRes = getWidget().currentResolution;
String oldLocale = getWidget().currentLocale;
super.updateFromUIDL(uidl, client);
if (origRes != getWidget().currentResolution
diff --git a/client/src/com/vaadin/client/ui/datefield/VCalendarPanel.java b/client/src/com/vaadin/client/ui/datefield/VCalendarPanel.java
index 9d519e3179..0d21638417 100644
--- a/client/src/com/vaadin/client/ui/datefield/VCalendarPanel.java
+++ b/client/src/com/vaadin/client/ui/datefield/VCalendarPanel.java
@@ -56,6 +56,7 @@ import com.vaadin.client.ui.FocusableFlexTable;
import com.vaadin.client.ui.SubPartAware;
import com.vaadin.client.ui.label.VLabel;
import com.vaadin.client.ui.nativeselect.VNativeSelect;
+import com.vaadin.shared.ui.datefield.Resolution;
@SuppressWarnings("deprecation")
public class VCalendarPanel extends FocusableFlexTable implements
@@ -162,7 +163,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
private FlexTable days = new FlexTable();
- private int resolution = VDateField.RESOLUTION_YEAR;
+ private Resolution resolution = Resolution.YEAR;
private int focusedRow;
@@ -225,7 +226,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
*/
private void focusDay(Date date) {
// Only used when calender body is present
- if (resolution > VDateField.RESOLUTION_MONTH) {
+ if (resolution.getCalendarField() > Resolution.MONTH.getCalendarField()) {
if (focusedDay != null) {
focusedDay.removeStyleDependentName(CN_FOCUSED);
}
@@ -321,11 +322,11 @@ public class VCalendarPanel extends FocusableFlexTable implements
return false;
}
- public int getResolution() {
+ public Resolution getResolution() {
return resolution;
}
- public void setResolution(int resolution) {
+ public void setResolution(Resolution resolution) {
this.resolution = resolution;
if (time != null) {
time.removeFromParent();
@@ -492,7 +493,8 @@ public class VCalendarPanel extends FocusableFlexTable implements
if (day > 6) {
day = 0;
}
- if (getResolution() > VDateField.RESOLUTION_MONTH) {
+ if (getResolution().getCalendarField() > Resolution.MONTH
+ .getCalendarField()) {
days.setHTML(headerRow, firstWeekdayColumn + i, "<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()) {
diff --git a/client/src/com/vaadin/client/ui/datefield/VDateField.java b/client/src/com/vaadin/client/ui/datefield/VDateField.java
index 788433027b..915ac4c54d 100644
--- a/client/src/com/vaadin/client/ui/datefield/VDateField.java
+++ b/client/src/com/vaadin/client/ui/datefield/VDateField.java
@@ -22,6 +22,7 @@ import com.google.gwt.user.client.ui.FlowPanel;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.DateTimeService;
import com.vaadin.client.ui.Field;
+import com.vaadin.shared.ui.datefield.Resolution;
public class VDateField extends FlowPanel implements Field {
@@ -33,27 +34,33 @@ public class VDateField extends FlowPanel implements Field {
protected boolean immediate;
- public static final int RESOLUTION_YEAR = 1;
- public static final int RESOLUTION_MONTH = 2;
- public static final int RESOLUTION_DAY = 4;
- public static final int RESOLUTION_HOUR = 8;
- public static final int RESOLUTION_MIN = 16;
- public static final int RESOLUTION_SEC = 32;
-
- static String resolutionToString(int res) {
- if (res > RESOLUTION_DAY) {
+ @Deprecated
+ public static final Resolution RESOLUTION_YEAR = Resolution.YEAR;
+ @Deprecated
+ public static final Resolution RESOLUTION_MONTH = Resolution.MONTH;
+ @Deprecated
+ public static final Resolution RESOLUTION_DAY = Resolution.DAY;
+ @Deprecated
+ public static final Resolution RESOLUTION_HOUR = Resolution.HOUR;
+ @Deprecated
+ public static final Resolution RESOLUTION_MIN = Resolution.MINUTE;
+ @Deprecated
+ public static final Resolution RESOLUTION_SEC = Resolution.SECOND;
+
+ static String resolutionToString(Resolution res) {
+ if (res.getCalendarField() > Resolution.DAY.getCalendarField()) {
return "full";
}
- if (res == RESOLUTION_DAY) {
+ if (res == Resolution.DAY) {
return "day";
}
- if (res == RESOLUTION_MONTH) {
+ if (res == Resolution.MONTH) {
return "month";
}
return "year";
}
- protected int currentResolution = RESOLUTION_YEAR;
+ protected Resolution currentResolution = Resolution.YEAR;
protected String currentLocale;
@@ -108,11 +115,11 @@ public class VDateField extends FlowPanel implements Field {
DateTimeService.setMilliseconds(date, ms);
}
- public int getCurrentResolution() {
+ public Resolution getCurrentResolution() {
return currentResolution;
}
- public void setCurrentResolution(int currentResolution) {
+ public void setCurrentResolution(Resolution currentResolution) {
this.currentResolution = currentResolution;
}
diff --git a/client/src/com/vaadin/client/ui/datefield/VDateFieldCalendar.java b/client/src/com/vaadin/client/ui/datefield/VDateFieldCalendar.java
index cf998421fd..41b7aedae6 100644
--- a/client/src/com/vaadin/client/ui/datefield/VDateFieldCalendar.java
+++ b/client/src/com/vaadin/client/ui/datefield/VDateFieldCalendar.java
@@ -22,6 +22,7 @@ import com.google.gwt.event.dom.client.DomEvent;
import com.vaadin.client.DateTimeService;
import com.vaadin.client.ui.datefield.VCalendarPanel.FocusOutListener;
import com.vaadin.client.ui.datefield.VCalendarPanel.SubmitListener;
+import com.vaadin.shared.ui.datefield.Resolution;
/**
* A client side implementation for InlineDateField
@@ -73,22 +74,28 @@ public class VDateFieldCalendar extends VDateField {
setCurrentDate((Date) date2.clone());
getClient().updateVariable(getId(), "year", date2.getYear() + 1900,
false);
- if (getCurrentResolution() > VDateField.RESOLUTION_YEAR) {
+ if (getCurrentResolution().getCalendarField() > Resolution.YEAR
+ .getCalendarField()) {
getClient().updateVariable(getId(), "month",
date2.getMonth() + 1, false);
- if (getCurrentResolution() > RESOLUTION_MONTH) {
+ if (getCurrentResolution().getCalendarField() > Resolution.MONTH
+ .getCalendarField()) {
getClient().updateVariable(getId(), "day", date2.getDate(),
false);
- if (getCurrentResolution() > RESOLUTION_DAY) {
+ if (getCurrentResolution().getCalendarField() > Resolution.DAY
+ .getCalendarField()) {
getClient().updateVariable(getId(), "hour",
date2.getHours(), false);
- if (getCurrentResolution() > RESOLUTION_HOUR) {
+ if (getCurrentResolution().getCalendarField() > Resolution.HOUR
+ .getCalendarField()) {
getClient().updateVariable(getId(), "min",
date2.getMinutes(), false);
- if (getCurrentResolution() > RESOLUTION_MIN) {
+ if (getCurrentResolution().getCalendarField() > Resolution.MINUTE
+ .getCalendarField()) {
getClient().updateVariable(getId(), "sec",
date2.getSeconds(), false);
- if (getCurrentResolution() > RESOLUTION_SEC) {
+ if (getCurrentResolution().getCalendarField() > Resolution.SECOND
+ .getCalendarField()) {
getClient().updateVariable(
getId(),
"msec",
diff --git a/client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java b/client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java
index e5aeb2efe8..79ede5b013 100644
--- a/client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java
+++ b/client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java
@@ -40,6 +40,7 @@ import com.vaadin.client.ui.SubPartAware;
import com.vaadin.client.ui.VOverlay;
import com.vaadin.client.ui.datefield.VCalendarPanel.FocusOutListener;
import com.vaadin.client.ui.datefield.VCalendarPanel.SubmitListener;
+import com.vaadin.shared.ui.datefield.Resolution;
/**
* Represents a date selection component with a text field and a popup date
@@ -123,19 +124,24 @@ public class VPopupCalendar extends VTextualDate implements Field,
setCurrentDate((Date) newDate.clone());
getClient().updateVariable(getId(), "year",
newDate.getYear() + 1900, false);
- if (getCurrentResolution() > VDateField.RESOLUTION_YEAR) {
+ if (getCurrentResolution().getCalendarField() > Resolution.YEAR
+ .getCalendarField()) {
getClient().updateVariable(getId(), "month",
newDate.getMonth() + 1, false);
- if (getCurrentResolution() > RESOLUTION_MONTH) {
+ if (getCurrentResolution().getCalendarField() > Resolution.MONTH
+ .getCalendarField()) {
getClient().updateVariable(getId(), "day",
newDate.getDate(), false);
- if (getCurrentResolution() > RESOLUTION_DAY) {
+ if (getCurrentResolution().getCalendarField() > Resolution.DAY
+ .getCalendarField()) {
getClient().updateVariable(getId(), "hour",
newDate.getHours(), false);
- if (getCurrentResolution() > RESOLUTION_HOUR) {
+ if (getCurrentResolution().getCalendarField() > Resolution.HOUR
+ .getCalendarField()) {
getClient().updateVariable(getId(), "min",
newDate.getMinutes(), false);
- if (getCurrentResolution() > RESOLUTION_MIN) {
+ if (getCurrentResolution().getCalendarField() > Resolution.MINUTE
+ .getCalendarField()) {
getClient().updateVariable(getId(), "sec",
newDate.getSeconds(), false);
}
diff --git a/client/src/com/vaadin/client/ui/datefield/VTextualDate.java b/client/src/com/vaadin/client/ui/datefield/VTextualDate.java
index 5d19cf5db2..e2d9962979 100644
--- a/client/src/com/vaadin/client/ui/datefield/VTextualDate.java
+++ b/client/src/com/vaadin/client/ui/datefield/VTextualDate.java
@@ -34,6 +34,7 @@ import com.vaadin.client.ui.Field;
import com.vaadin.client.ui.SubPartAware;
import com.vaadin.client.ui.textfield.VTextField;
import com.vaadin.shared.EventId;
+import com.vaadin.shared.ui.datefield.Resolution;
public class VTextualDate extends VDateField implements Field, ChangeHandler,
Focusable, SubPartAware {
@@ -101,7 +102,7 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
protected String getFormatString() {
if (formatStr == null) {
- if (currentResolution == RESOLUTION_YEAR) {
+ if (currentResolution == Resolution.YEAR) {
formatStr = "yyyy"; // force full year
} else {
@@ -111,16 +112,18 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
frmString = cleanFormat(frmString);
// String delim = LocaleService
// .getClockDelimiter(currentLocale);
-
- if (currentResolution >= RESOLUTION_HOUR) {
+ if (currentResolution.getCalendarField() >= Resolution.HOUR
+ .getCalendarField()) {
if (dts.isTwelveHourClock()) {
frmString += " hh";
} else {
frmString += " HH";
}
- if (currentResolution >= RESOLUTION_MIN) {
+ if (currentResolution.getCalendarField() >= Resolution.MINUTE
+ .getCalendarField()) {
frmString += ":mm";
- if (currentResolution >= RESOLUTION_SEC) {
+ if (currentResolution.getCalendarField() >= Resolution.SECOND
+ .getCalendarField()) {
frmString += ":ss";
}
}
@@ -228,59 +231,48 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
Date currentDate = getDate();
getClient().updateVariable(getId(), "year",
currentDate != null ? currentDate.getYear() + 1900 : -1,
- currentResolution == VDateField.RESOLUTION_YEAR && immediate);
- if (currentResolution >= VDateField.RESOLUTION_MONTH) {
- getClient().updateVariable(
- getId(),
- "month",
+ currentResolution == Resolution.YEAR && immediate);
+ if (currentResolution.getCalendarField() >= Resolution.MONTH
+ .getCalendarField()) {
+ getClient().updateVariable(getId(), "month",
currentDate != null ? currentDate.getMonth() + 1 : -1,
- currentResolution == VDateField.RESOLUTION_MONTH
- && immediate);
+ currentResolution == Resolution.MONTH && immediate);
}
- if (currentResolution >= VDateField.RESOLUTION_DAY) {
- getClient()
- .updateVariable(
- getId(),
- "day",
- currentDate != null ? currentDate.getDate() : -1,
- currentResolution == VDateField.RESOLUTION_DAY
- && immediate);
+ if (currentResolution.getCalendarField() >= Resolution.DAY
+ .getCalendarField()) {
+ getClient().updateVariable(getId(), "day",
+ currentDate != null ? currentDate.getDate() : -1,
+ currentResolution == Resolution.DAY && immediate);
}
- if (currentResolution >= VDateField.RESOLUTION_HOUR) {
- getClient().updateVariable(
- getId(),
- "hour",
+ if (currentResolution.getCalendarField() >= Resolution.HOUR
+ .getCalendarField()) {
+ getClient().updateVariable(getId(), "hour",
currentDate != null ? currentDate.getHours() : -1,
- currentResolution == VDateField.RESOLUTION_HOUR
- && immediate);
+ currentResolution == Resolution.HOUR && immediate);
}
- if (currentResolution >= VDateField.RESOLUTION_MIN) {
- getClient()
- .updateVariable(
- getId(),
- "min",
- currentDate != null ? currentDate.getMinutes() : -1,
- currentResolution == VDateField.RESOLUTION_MIN
- && immediate);
+ if (currentResolution.getCalendarField() >= Resolution.MINUTE
+ .getCalendarField()) {
+ getClient().updateVariable(getId(), "min",
+ currentDate != null ? currentDate.getMinutes() : -1,
+ currentResolution == Resolution.MINUTE && immediate);
}
- if (currentResolution >= VDateField.RESOLUTION_SEC) {
- getClient()
- .updateVariable(
- getId(),
- "sec",
- currentDate != null ? currentDate.getSeconds() : -1,
- currentResolution == VDateField.RESOLUTION_SEC
- && immediate);
+ if (currentResolution.getCalendarField() >= Resolution.SECOND
+ .getCalendarField()) {
+ getClient().updateVariable(getId(), "sec",
+ currentDate != null ? currentDate.getSeconds() : -1,
+ currentResolution == Resolution.SECOND && immediate);
}
}
private String cleanFormat(String format) {
// Remove unnecessary d & M if resolution is too low
- if (currentResolution < VDateField.RESOLUTION_DAY) {
+ if (currentResolution.getCalendarField() < Resolution.DAY
+ .getCalendarField()) {
format = format.replaceAll("d", "");
}
- if (currentResolution < VDateField.RESOLUTION_MONTH) {
+ if (currentResolution.getCalendarField() < Resolution.MONTH
+ .getCalendarField()) {
format = format.replaceAll("M", "");
}
diff --git a/client/src/com/vaadin/client/ui/splitpanel/VAbstractSplitPanel.java b/client/src/com/vaadin/client/ui/splitpanel/VAbstractSplitPanel.java
index 088e743d7a..bcb8809e90 100644
--- a/client/src/com/vaadin/client/ui/splitpanel/VAbstractSplitPanel.java
+++ b/client/src/com/vaadin/client/ui/splitpanel/VAbstractSplitPanel.java
@@ -48,6 +48,7 @@ import com.vaadin.client.ui.TouchScrollDelegate;
import com.vaadin.client.ui.TouchScrollDelegate.TouchScrollHandler;
import com.vaadin.client.ui.VOverlay;
import com.vaadin.client.ui.splitpanel.VAbstractSplitPanel.SplitterMoveHandler.SplitterMoveEvent;
+import com.vaadin.shared.ui.Orientation;
public class VAbstractSplitPanel extends ComplexPanel {
@@ -55,13 +56,9 @@ public class VAbstractSplitPanel extends ComplexPanel {
public static final String CLASSNAME = "v-splitpanel";
- public static final int ORIENTATION_HORIZONTAL = 0;
-
- public static final int ORIENTATION_VERTICAL = 1;
-
private static final int MIN_SIZE = 30;
- private int orientation = ORIENTATION_HORIZONTAL;
+ private Orientation orientation = Orientation.HORIZONTAL;
Widget firstChild;
@@ -113,17 +110,17 @@ public class VAbstractSplitPanel extends ComplexPanel {
protected int origScrollTop;
public VAbstractSplitPanel() {
- this(ORIENTATION_HORIZONTAL);
+ this(Orientation.HORIZONTAL);
}
- public VAbstractSplitPanel(int orientation) {
+ public VAbstractSplitPanel(Orientation orientation) {
setElement(DOM.createDiv());
setStyleName(StyleConstants.UI_LAYOUT);
switch (orientation) {
- case ORIENTATION_HORIZONTAL:
+ case HORIZONTAL:
addStyleName(CLASSNAME + "-horizontal");
break;
- case ORIENTATION_VERTICAL:
+ case VERTICAL:
default:
addStyleName(CLASSNAME + "-vertical");
break;
@@ -190,9 +187,9 @@ public class VAbstractSplitPanel extends ComplexPanel {
setStylenames();
}
- private void setOrientation(int orientation) {
+ private void setOrientation(Orientation orientation) {
this.orientation = orientation;
- if (orientation == ORIENTATION_HORIZONTAL) {
+ if (orientation == Orientation.HORIZONTAL) {
DOM.setStyleAttribute(splitter, "height", "100%");
DOM.setStyleAttribute(splitter, "top", "0");
DOM.setStyleAttribute(firstContainer, "height", "100%");
@@ -228,10 +225,10 @@ public class VAbstractSplitPanel extends ComplexPanel {
void setPositionReversed(boolean reversed) {
if (positionReversed != reversed) {
- if (orientation == ORIENTATION_HORIZONTAL) {
+ if (orientation == Orientation.HORIZONTAL) {
DOM.setStyleAttribute(splitter, "right", "");
DOM.setStyleAttribute(splitter, "left", "");
- } else if (orientation == ORIENTATION_VERTICAL) {
+ } else if (orientation == Orientation.VERTICAL) {
DOM.setStyleAttribute(splitter, "top", "");
DOM.setStyleAttribute(splitter, "bottom", "");
}
@@ -253,7 +250,7 @@ public class VAbstractSplitPanel extends ComplexPanel {
posAsFloat = Math.round(Float.parseFloat(pos.substring(0,
pos.length() - 1))
/ 100
- * (orientation == ORIENTATION_HORIZONTAL ? getOffsetWidth()
+ * (orientation == Orientation.HORIZONTAL ? getOffsetWidth()
: getOffsetHeight()));
} else {
posAsFloat = Float.parseFloat(pos.substring(0, pos.length() - 2));
@@ -272,7 +269,7 @@ public class VAbstractSplitPanel extends ComplexPanel {
if (pos.endsWith("px")) {
float pixelPosition = Float.parseFloat(pos.substring(0,
pos.length() - 2));
- int offsetLength = orientation == ORIENTATION_HORIZONTAL ? getOffsetWidth()
+ int offsetLength = orientation == Orientation.HORIZONTAL ? getOffsetWidth()
: getOffsetHeight();
// Take splitter size into account at the edge
@@ -344,7 +341,7 @@ public class VAbstractSplitPanel extends ComplexPanel {
// Convert percentage values to pixels
if (pos.indexOf("%") > 0) {
- int size = orientation == ORIENTATION_HORIZONTAL ? getOffsetWidth()
+ int size = orientation == Orientation.HORIZONTAL ? getOffsetWidth()
: getOffsetHeight();
float percentage = Float.parseFloat(pos.substring(0,
pos.length() - 1));
@@ -352,7 +349,7 @@ public class VAbstractSplitPanel extends ComplexPanel {
}
String attributeName;
- if (orientation == ORIENTATION_HORIZONTAL) {
+ if (orientation == Orientation.HORIZONTAL) {
if (positionReversed) {
attributeName = "right";
} else {
@@ -382,7 +379,7 @@ public class VAbstractSplitPanel extends ComplexPanel {
int pixelPosition;
switch (orientation) {
- case ORIENTATION_HORIZONTAL:
+ case HORIZONTAL:
wholeSize = DOM.getElementPropertyInt(wrapper, "clientWidth");
pixelPosition = DOM.getElementPropertyInt(splitter, "offsetLeft");
@@ -430,7 +427,7 @@ public class VAbstractSplitPanel extends ComplexPanel {
}
}
break;
- case ORIENTATION_VERTICAL:
+ case VERTICAL:
wholeSize = DOM.getElementPropertyInt(wrapper, "clientHeight");
pixelPosition = DOM.getElementPropertyInt(splitter, "offsetTop");
@@ -562,11 +559,11 @@ public class VAbstractSplitPanel extends ComplexPanel {
public void onMouseMove(Event event) {
switch (orientation) {
- case ORIENTATION_HORIZONTAL:
+ case HORIZONTAL:
final int x = Util.getTouchOrMouseClientX(event);
onHorizontalMouseMove(x);
break;
- case ORIENTATION_VERTICAL:
+ case VERTICAL:
default:
final int y = Util.getTouchOrMouseClientY(event);
onVerticalMouseMove(y);
@@ -729,7 +726,7 @@ public class VAbstractSplitPanel extends ComplexPanel {
if (splitterSize < 0) {
if (isAttached()) {
switch (orientation) {
- case ORIENTATION_HORIZONTAL:
+ case HORIZONTAL:
splitterSize = DOM.getElementPropertyInt(splitter,
"offsetWidth");
break;
@@ -746,7 +743,7 @@ public class VAbstractSplitPanel extends ComplexPanel {
void setStylenames() {
final String splitterClass = CLASSNAME
- + (orientation == ORIENTATION_HORIZONTAL ? "-hsplitter"
+ + (orientation == Orientation.HORIZONTAL ? "-hsplitter"
: "-vsplitter");
final String firstContainerClass = CLASSNAME + "-first-container";
final String secondContainerClass = CLASSNAME + "-second-container";
diff --git a/client/src/com/vaadin/client/ui/splitpanel/VSplitPanelHorizontal.java b/client/src/com/vaadin/client/ui/splitpanel/VSplitPanelHorizontal.java
index f347a8521c..c277d594b9 100644
--- a/client/src/com/vaadin/client/ui/splitpanel/VSplitPanelHorizontal.java
+++ b/client/src/com/vaadin/client/ui/splitpanel/VSplitPanelHorizontal.java
@@ -16,9 +16,11 @@
package com.vaadin.client.ui.splitpanel;
+import com.vaadin.shared.ui.Orientation;
+
public class VSplitPanelHorizontal extends VAbstractSplitPanel {
public VSplitPanelHorizontal() {
- super(VAbstractSplitPanel.ORIENTATION_HORIZONTAL);
+ super(Orientation.HORIZONTAL);
}
}
diff --git a/client/src/com/vaadin/client/ui/splitpanel/VSplitPanelVertical.java b/client/src/com/vaadin/client/ui/splitpanel/VSplitPanelVertical.java
index 3f9826833b..4f96d7f746 100644
--- a/client/src/com/vaadin/client/ui/splitpanel/VSplitPanelVertical.java
+++ b/client/src/com/vaadin/client/ui/splitpanel/VSplitPanelVertical.java
@@ -16,9 +16,11 @@
package com.vaadin.client.ui.splitpanel;
+import com.vaadin.shared.ui.Orientation;
+
public class VSplitPanelVertical extends VAbstractSplitPanel {
public VSplitPanelVertical() {
- super(VAbstractSplitPanel.ORIENTATION_VERTICAL);
+ super(Orientation.VERTICAL);
}
}
diff --git a/client/src/com/vaadin/client/ui/tree/TreeConnector.java b/client/src/com/vaadin/client/ui/tree/TreeConnector.java
index 7fd3b105b6..10a3c0fb95 100644
--- a/client/src/com/vaadin/client/ui/tree/TreeConnector.java
+++ b/client/src/com/vaadin/client/ui/tree/TreeConnector.java
@@ -30,6 +30,7 @@ import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.client.ui.tree.VTree.TreeNode;
import com.vaadin.shared.AbstractFieldState;
import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.MultiSelectMode;
import com.vaadin.shared.ui.tree.TreeConstants;
import com.vaadin.ui.Tree;
@@ -108,10 +109,10 @@ public class TreeConnector extends AbstractComponentConnector implements
if (BrowserInfo.get().isTouchDevice()) {
// Always use the simple mode for touch devices that do not have
// shift/ctrl keys (#8595)
- getWidget().multiSelectMode = VTree.MULTISELECT_MODE_SIMPLE;
+ getWidget().multiSelectMode = MultiSelectMode.SIMPLE;
} else {
- getWidget().multiSelectMode = uidl
- .getIntAttribute("multiselectmode");
+ getWidget().multiSelectMode = MultiSelectMode.valueOf(uidl
+ .getStringAttribute("multiselectmode"));
}
}
diff --git a/client/src/com/vaadin/client/ui/tree/VTree.java b/client/src/com/vaadin/client/ui/tree/VTree.java
index 2be3d7b33b..ca021b6dfc 100644
--- a/client/src/com/vaadin/client/ui/tree/VTree.java
+++ b/client/src/com/vaadin/client/ui/tree/VTree.java
@@ -72,6 +72,8 @@ import com.vaadin.client.ui.dd.VDropHandler;
import com.vaadin.client.ui.dd.VHasDropHandler;
import com.vaadin.client.ui.dd.VTransferable;
import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.MouseEventDetails.MouseButton;
+import com.vaadin.shared.ui.MultiSelectMode;
import com.vaadin.shared.ui.dd.VerticalDropLocation;
import com.vaadin.shared.ui.tree.TreeConstants;
@@ -85,14 +87,16 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
public static final String CLASSNAME = "v-tree";
/**
- * Click selects the current node, ctrl/shift toggles multi selection
+ * @deprecated from 7.0, use {@link MultiSelectMode#DEFAULT} instead.
*/
- public static final int MULTISELECT_MODE_DEFAULT = 0;
+ @Deprecated
+ public static final MultiSelectMode MULTISELECT_MODE_DEFAULT = MultiSelectMode.DEFAULT;
/**
- * Click/touch on node toggles its selected status
+ * @deprecated from 7.0, use {@link MultiSelectMode#SIMPLE} instead.
*/
- public static final int MULTISELECT_MODE_SIMPLE = 1;
+ @Deprecated
+ public static final MultiSelectMode MULTISELECT_MODE_SIMPLE = MultiSelectMode.SIMPLE;
private static final int CHARCODE_SPACE = 32;
@@ -106,7 +110,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
private String currentMouseOverKey;
TreeNode lastSelection;
TreeNode focusedNode;
- int multiSelectMode = MULTISELECT_MODE_DEFAULT;
+ MultiSelectMode multiSelectMode = MultiSelectMode.DEFAULT;
private final HashMap<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;