summaryrefslogtreecommitdiffstats
path: root/compatibility-client
diff options
context:
space:
mode:
Diffstat (limited to 'compatibility-client')
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/AbstractFieldConnector.java16
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/AbstractLegacyComponentConnector.java8
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCheckBox.java109
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java20
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/checkbox/CheckBoxConnector.java2
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/colorpicker/AbstractColorPickerConnector.java4
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/colorpicker/ColorPickerGradientConnector.java6
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/colorpicker/ColorPickerGridConnector.java4
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/label/LabelConnector.java4
9 files changed, 151 insertions, 22 deletions
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/AbstractFieldConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/AbstractFieldConnector.java
index 36d8f17d00..7f96e63d0a 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/AbstractFieldConnector.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/AbstractFieldConnector.java
@@ -15,14 +15,16 @@
*/
package com.vaadin.v7.client.ui;
+import com.google.gwt.user.client.ui.Focusable;
import com.vaadin.client.StyleConstants;
-import com.vaadin.client.ui.AbstractComponentConnector;
+import com.vaadin.client.annotations.OnStateChange;
import com.vaadin.client.ui.HasErrorIndicator;
import com.vaadin.client.ui.HasRequiredIndicator;
import com.vaadin.v7.shared.AbstractFieldState;
@Deprecated
-public abstract class AbstractFieldConnector extends AbstractComponentConnector
+public abstract class AbstractFieldConnector
+ extends AbstractLegacyComponentConnector
implements HasRequiredIndicator, HasErrorIndicator {
@Override
@@ -71,4 +73,14 @@ public abstract class AbstractFieldConnector extends AbstractComponentConnector
getWidget().setStyleName(StyleConstants.REQUIRED,
isRequiredIndicatorVisible());
}
+
+ @OnStateChange("tabIndex")
+ void updateTabIndex() {
+ // AbstractFieldState is not inheriting TabIndexState because of
+ // AbstractLegacyComponentState, thus need to set tab index here
+ // (instead of AbstractComponentConnector)
+ if (getWidget() instanceof Focusable) {
+ ((Focusable) getWidget()).setTabIndex(getState().tabIndex);
+ }
+ }
}
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/AbstractLegacyComponentConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/AbstractLegacyComponentConnector.java
index a9fe473ad4..5e27f26282 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/AbstractLegacyComponentConnector.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/AbstractLegacyComponentConnector.java
@@ -18,6 +18,7 @@ package com.vaadin.v7.client.ui;
import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.client.ui.AbstractConnector;
import com.vaadin.shared.communication.ServerRpc;
+import com.vaadin.v7.shared.AbstractLegacyComponentState;
/**
* Legacy connector for Vaadin 7 compatibility connectors. Needed because
@@ -26,7 +27,9 @@ import com.vaadin.shared.communication.ServerRpc;
*
* @author Vaadin Ltd
* @since 8.0
+ * @deprecated only used for Vaadin 7 compatiblity components
*/
+@Deprecated
public class AbstractLegacyComponentConnector
extends AbstractComponentConnector {
@@ -36,4 +39,9 @@ public class AbstractLegacyComponentConnector
protected <T extends ServerRpc> T getRpcProxy(Class<T> rpcInterface) {
return super.getRpcProxy(rpcInterface);
}
+
+ @Override
+ public AbstractLegacyComponentState getState() {
+ return (AbstractLegacyComponentState) super.getState();
+ }
}
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCheckBox.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCheckBox.java
new file mode 100644
index 0000000000..60a0d06821
--- /dev/null
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCheckBox.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.v7.client.ui;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Event;
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.BrowserInfo;
+import com.vaadin.client.Util;
+import com.vaadin.client.VTooltip;
+import com.vaadin.client.ui.Field;
+import com.vaadin.client.ui.Icon;
+import com.vaadin.client.ui.aria.AriaHelper;
+import com.vaadin.client.ui.aria.HandlesAriaInvalid;
+import com.vaadin.client.ui.aria.HandlesAriaRequired;
+
+public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox
+ implements Field, HandlesAriaInvalid, HandlesAriaRequired {
+
+ public static final String CLASSNAME = "v-checkbox";
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public String id;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public boolean immediate;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public ApplicationConnection client;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public Element errorIndicatorElement;
+
+ /** For internal use only. May be removed or replaced in the future. */
+ public Icon icon;
+
+ public VCheckBox() {
+ setStyleName(CLASSNAME);
+
+ Element el = DOM.getFirstChild(getElement());
+ while (el != null) {
+ DOM.sinkEvents(el, DOM.getEventsSunk(el) | VTooltip.TOOLTIP_EVENTS);
+ el = DOM.getNextSibling(el);
+ }
+
+ if (BrowserInfo.get().isWebkit()) {
+ // Webkit does not focus non-text input elements on click
+ // (#11854)
+ addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ setFocus(true);
+ }
+ });
+ }
+ }
+
+ @Override
+ public void onBrowserEvent(Event event) {
+ if (icon != null && event.getTypeInt() == Event.ONCLICK
+ && DOM.eventGetTarget(event) == icon.getElement()) {
+ // Click on icon should do nothing if widget is disabled
+ if (isEnabled()) {
+ setValue(!getValue());
+ }
+ }
+ super.onBrowserEvent(event);
+ if (event.getTypeInt() == Event.ONLOAD) {
+ Util.notifyParentOfSizeChange(this, true);
+ }
+ }
+
+ /**
+ * Gives access to the input element.
+ *
+ * @return Element of the CheckBox itself
+ */
+ private Element getCheckBoxElement() {
+ // FIXME: Would love to use a better way to access the checkbox element
+ return getElement().getFirstChildElement();
+ }
+
+ @Override
+ public void setAriaRequired(boolean required) {
+ AriaHelper.handleInputRequired(getCheckBoxElement(), required);
+ }
+
+ @Override
+ public void setAriaInvalid(boolean invalid) {
+ AriaHelper.handleInputInvalid(getCheckBoxElement(), invalid);
+ }
+}
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java
index 62e8e123db..0e50bd639d 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java
@@ -39,12 +39,12 @@ import com.vaadin.client.VConsole;
import com.vaadin.client.WidgetUtil;
import com.vaadin.client.communication.RpcProxy;
import com.vaadin.client.communication.StateChangeEvent;
-import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.client.ui.Action;
import com.vaadin.client.ui.ActionOwner;
import com.vaadin.client.ui.SimpleManagedLayout;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.Connect.LoadStyle;
+import com.vaadin.v7.client.ui.AbstractLegacyComponentConnector;
import com.vaadin.v7.client.ui.VCalendar;
import com.vaadin.v7.client.ui.VCalendar.BackwardListener;
import com.vaadin.v7.client.ui.VCalendar.DateClickListener;
@@ -82,14 +82,14 @@ import com.vaadin.v7.ui.Calendar;
* @author Vaadin Ltd.
*/
@Connect(value = Calendar.class, loadStyle = LoadStyle.LAZY)
-public class CalendarConnector extends AbstractComponentConnector
+public class CalendarConnector extends AbstractLegacyComponentConnector
implements ActionOwner, SimpleManagedLayout, Paintable {
private CalendarServerRpc rpc = RpcProxy.create(CalendarServerRpc.class,
this);
- private final HashMap<String, String> actionMap = new HashMap<String, String>();
- private HashMap<Object, String> tooltips = new HashMap<Object, String>();
+ private final HashMap<String, String> actionMap = new HashMap<>();
+ private HashMap<Object, String> tooltips = new HashMap<>();
private static final String DROPHANDLER_ACCEPT_CRITERIA_PAINT_TAG = "-ac";
@@ -469,8 +469,8 @@ public class CalendarConnector extends AbstractComponentConnector
}
private Action[] getActionsBetween(Date start, Date end) {
- List<Action> actions = new ArrayList<Action>();
- List<String> ids = new ArrayList<String>();
+ List<Action> actions = new ArrayList<>();
+ List<String> ids = new ArrayList<>();
for (int i = 0; i < actionKeys.size(); i++) {
String actionKey = actionKeys.get(i);
@@ -525,7 +525,7 @@ public class CalendarConnector extends AbstractComponentConnector
return actions.toArray(new Action[actions.size()]);
}
- private List<String> actionKeys = new ArrayList<String>();
+ private List<String> actionKeys = new ArrayList<>();
private void updateActionMap(List<CalendarState.Action> actions) {
actionMap.clear();
@@ -624,7 +624,7 @@ public class CalendarConnector extends AbstractComponentConnector
*/
@Override
public Action[] getActions() {
- List<Action> actions = new ArrayList<Action>();
+ List<Action> actions = new ArrayList<>();
for (int i = 0; i < actionKeys.size(); i++) {
final String actionKey = actionKeys.get(i);
final VCalendarAction a = new VCalendarAction(this, rpc, actionKey);
@@ -655,7 +655,7 @@ public class CalendarConnector extends AbstractComponentConnector
private List<CalendarEvent> calendarEventListOf(
List<CalendarState.Event> events, boolean format24h) {
- List<CalendarEvent> list = new ArrayList<CalendarEvent>(events.size());
+ List<CalendarEvent> list = new ArrayList<>(events.size());
for (CalendarState.Event event : events) {
final String dateFrom = event.dateFrom;
final String dateTo = event.dateTo;
@@ -680,7 +680,7 @@ public class CalendarConnector extends AbstractComponentConnector
}
private List<CalendarDay> calendarDayListOf(List<CalendarState.Day> days) {
- List<CalendarDay> list = new ArrayList<CalendarDay>(days.size());
+ List<CalendarDay> list = new ArrayList<>(days.size());
for (CalendarState.Day day : days) {
CalendarDay d = new CalendarDay(day.date, day.localizedDateFormat,
day.dayOfWeek, day.week, day.yearOfWeek);
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/checkbox/CheckBoxConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/checkbox/CheckBoxConnector.java
index 5d103e419f..d2a761ba0a 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/checkbox/CheckBoxConnector.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/checkbox/CheckBoxConnector.java
@@ -27,11 +27,11 @@ import com.vaadin.client.annotations.OnStateChange;
import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.ConnectorFocusAndBlurHandler;
import com.vaadin.client.ui.Icon;
-import com.vaadin.client.ui.VCheckBox;
import com.vaadin.shared.EventId;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.ui.Connect;
import com.vaadin.v7.client.ui.AbstractFieldConnector;
+import com.vaadin.v7.client.ui.VCheckBox;
import com.vaadin.v7.shared.ui.checkbox.CheckBoxServerRpc;
import com.vaadin.v7.shared.ui.checkbox.CheckBoxState;
import com.vaadin.v7.ui.CheckBox;
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/colorpicker/AbstractColorPickerConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/colorpicker/AbstractColorPickerConnector.java
index aa5e878312..bd51cecf5a 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/colorpicker/AbstractColorPickerConnector.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/colorpicker/AbstractColorPickerConnector.java
@@ -18,7 +18,7 @@ package com.vaadin.v7.client.ui.colorpicker;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.vaadin.client.communication.StateChangeEvent;
-import com.vaadin.client.ui.AbstractComponentConnector;
+import com.vaadin.v7.client.ui.AbstractLegacyComponentConnector;
import com.vaadin.v7.shared.ui.colorpicker.ColorPickerState;
/**
@@ -29,7 +29,7 @@ import com.vaadin.v7.shared.ui.colorpicker.ColorPickerState;
*/
@Deprecated
public abstract class AbstractColorPickerConnector
- extends AbstractComponentConnector implements ClickHandler {
+ extends AbstractLegacyComponentConnector implements ClickHandler {
private static final String DEFAULT_WIDTH_STYLE = "v-default-caption-width";
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/colorpicker/ColorPickerGradientConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/colorpicker/ColorPickerGradientConnector.java
index 014e4b6f04..f71ac4d05e 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/colorpicker/ColorPickerGradientConnector.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/colorpicker/ColorPickerGradientConnector.java
@@ -21,10 +21,10 @@ import com.google.gwt.event.dom.client.MouseUpHandler;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.communication.RpcProxy;
import com.vaadin.client.communication.StateChangeEvent;
-import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.client.ui.colorpicker.VColorPickerGradient;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.Connect.LoadStyle;
+import com.vaadin.v7.client.ui.AbstractLegacyComponentConnector;
import com.vaadin.v7.shared.ui.colorpicker.ColorPickerGradientServerRpc;
import com.vaadin.v7.shared.ui.colorpicker.ColorPickerGradientState;
@@ -37,8 +37,8 @@ import com.vaadin.v7.shared.ui.colorpicker.ColorPickerGradientState;
* @since 7.0.0
*/
@Connect(value = com.vaadin.v7.ui.components.colorpicker.ColorPickerGradient.class, loadStyle = LoadStyle.LAZY)
-public class ColorPickerGradientConnector extends AbstractComponentConnector
- implements MouseUpHandler {
+public class ColorPickerGradientConnector
+ extends AbstractLegacyComponentConnector implements MouseUpHandler {
private ColorPickerGradientServerRpc rpc = RpcProxy
.create(ColorPickerGradientServerRpc.class, this);
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/colorpicker/ColorPickerGridConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/colorpicker/ColorPickerGridConnector.java
index 561f28af3a..8d7c94cb2f 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/colorpicker/ColorPickerGridConnector.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/colorpicker/ColorPickerGridConnector.java
@@ -21,10 +21,10 @@ import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.communication.RpcProxy;
import com.vaadin.client.communication.StateChangeEvent;
-import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.client.ui.colorpicker.VColorPickerGrid;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.Connect.LoadStyle;
+import com.vaadin.v7.client.ui.AbstractLegacyComponentConnector;
import com.vaadin.v7.shared.ui.colorpicker.ColorPickerGridServerRpc;
import com.vaadin.v7.shared.ui.colorpicker.ColorPickerGridState;
@@ -37,7 +37,7 @@ import com.vaadin.v7.shared.ui.colorpicker.ColorPickerGridState;
* @since 7.0.0
*/
@Connect(value = com.vaadin.v7.ui.components.colorpicker.ColorPickerGrid.class, loadStyle = LoadStyle.LAZY)
-public class ColorPickerGridConnector extends AbstractComponentConnector
+public class ColorPickerGridConnector extends AbstractLegacyComponentConnector
implements ClickHandler {
private ColorPickerGridServerRpc rpc = RpcProxy
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/label/LabelConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/label/LabelConnector.java
index 7e37aa5f77..9ef43775bf 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/label/LabelConnector.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/label/LabelConnector.java
@@ -20,15 +20,15 @@ import com.google.gwt.dom.client.PreElement;
import com.vaadin.client.Profiler;
import com.vaadin.client.WidgetUtil;
import com.vaadin.client.communication.StateChangeEvent;
-import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.Connect.LoadStyle;
+import com.vaadin.v7.client.ui.AbstractLegacyComponentConnector;
import com.vaadin.v7.client.ui.VLabel;
import com.vaadin.v7.shared.ui.label.LabelState;
import com.vaadin.v7.ui.Label;
@Connect(value = Label.class, loadStyle = LoadStyle.EAGER)
-public class LabelConnector extends AbstractComponentConnector {
+public class LabelConnector extends AbstractLegacyComponentConnector {
@Override
public LabelState getState() {