summaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2015-03-23 08:20:23 +0200
committerLeif Åstrand <leif@vaadin.com>2015-03-23 08:20:23 +0200
commit20d5456c3d5fb825783d7311ebd797c9ae8690f9 (patch)
tree9401f94b7d84209bdc991c15995512c56e50d03f /client/src
parent16c67cfab9b3dd2dbf324caa612fa3a2d15550d0 (diff)
parent04272699b8f429a2bc3b8f0a41e20a604213895e (diff)
downloadvaadin-framework-20d5456c3d5fb825783d7311ebd797c9ae8690f9.tar.gz
vaadin-framework-20d5456c3d5fb825783d7311ebd797c9ae8690f9.zip
Merge remote-tracking branch 'origin/master' into grid-7.5
Change-Id: I53218c269f0701cddd8279bf25c493950144f4cb
Diffstat (limited to 'client/src')
-rw-r--r--client/src/com/vaadin/client/VTooltip.java36
-rw-r--r--client/src/com/vaadin/client/ui/AbstractComponentConnector.java3
-rw-r--r--client/src/com/vaadin/client/ui/datefield/DateFieldConnector.java219
-rw-r--r--client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java205
-rw-r--r--client/src/com/vaadin/client/ui/orderedlayout/Slot.java108
-rw-r--r--client/src/com/vaadin/client/ui/ui/UIConnector.java8
6 files changed, 250 insertions, 329 deletions
diff --git a/client/src/com/vaadin/client/VTooltip.java b/client/src/com/vaadin/client/VTooltip.java
index a9406935dc..453563370c 100644
--- a/client/src/com/vaadin/client/VTooltip.java
+++ b/client/src/com/vaadin/client/VTooltip.java
@@ -20,7 +20,17 @@ import com.google.gwt.aria.client.RelevantValue;
import com.google.gwt.aria.client.Roles;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Display;
-import com.google.gwt.event.dom.client.*;
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
+import com.google.gwt.event.dom.client.DomEvent;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
+import com.google.gwt.event.dom.client.MouseMoveEvent;
+import com.google.gwt.event.dom.client.MouseMoveHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Timer;
@@ -378,8 +388,7 @@ public class VTooltip extends VOverlay {
}
private class TooltipEventHandler implements MouseMoveHandler,
- KeyDownHandler, FocusHandler, BlurHandler, MouseDownHandler,
- MouseUpHandler, TouchStartHandler {
+ KeyDownHandler, FocusHandler, BlurHandler, MouseDownHandler {
/**
* Current element hovered
@@ -392,11 +401,6 @@ public class VTooltip extends VOverlay {
private boolean handledByFocus;
/**
- * Indicates whether the tooltip is being called after a touch event.
- */
- private boolean touchInitiated = false;
-
- /**
* Locate the tooltip for given element
*
* @param element
@@ -446,19 +450,7 @@ public class VTooltip extends VOverlay {
@Override
public void onMouseMove(MouseMoveEvent mme) {
- if (!touchInitiated) {
- handleShowHide(mme, false);
- }
- }
-
- @Override
- public void onMouseUp(MouseUpEvent event) {
- touchInitiated = false;
- }
-
- @Override
- public void onTouchStart(TouchStartEvent te) {
- touchInitiated = true;
+ handleShowHide(mme, false);
}
@Override
@@ -558,11 +550,9 @@ public class VTooltip extends VOverlay {
Profiler.enter("VTooltip.connectHandlersToWidget");
widget.addDomHandler(tooltipEventHandler, MouseMoveEvent.getType());
widget.addDomHandler(tooltipEventHandler, MouseDownEvent.getType());
- widget.addDomHandler(tooltipEventHandler, MouseUpEvent.getType());
widget.addDomHandler(tooltipEventHandler, KeyDownEvent.getType());
widget.addDomHandler(tooltipEventHandler, FocusEvent.getType());
widget.addDomHandler(tooltipEventHandler, BlurEvent.getType());
- widget.addDomHandler(tooltipEventHandler, TouchStartEvent.getType());
Profiler.leave("VTooltip.connectHandlersToWidget");
}
diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
index 46ad289488..24a0438476 100644
--- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
+++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
@@ -35,7 +35,6 @@ import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.metadata.NoDataException;
import com.vaadin.client.metadata.Type;
import com.vaadin.client.metadata.TypeData;
-import com.vaadin.client.ui.datefield.PopupDateFieldConnector;
import com.vaadin.client.ui.ui.UIConnector;
import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.ComponentConstants;
@@ -404,7 +403,7 @@ public abstract class AbstractComponentConnector extends AbstractConnector
* updated in another widget in addition to the one returned by the
* <code>Connector</code>'s {@link #getWidget()}, or if the prefix should be
* different. For example see
- * {@link PopupDateFieldConnector#setWidgetStyleNameWithPrefix(String, String, boolean)}
+ * {@link com.vaadin.client.ui.datefield.DateFieldConnector#setWidgetStyleNameWithPrefix(String, String, boolean)}
* </p>
*
* @param styleName
diff --git a/client/src/com/vaadin/client/ui/datefield/DateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/DateFieldConnector.java
new file mode 100644
index 0000000000..042b8db8e2
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/datefield/DateFieldConnector.java
@@ -0,0 +1,219 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.client.ui.datefield;
+
+import java.util.Date;
+
+import com.google.gwt.event.logical.shared.CloseEvent;
+import com.google.gwt.event.logical.shared.CloseHandler;
+import com.google.gwt.user.client.ui.PopupPanel;
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.DateTimeService;
+import com.vaadin.client.UIDL;
+import com.vaadin.client.communication.StateChangeEvent;
+import com.vaadin.client.ui.VCalendarPanel.FocusChangeListener;
+import com.vaadin.client.ui.VCalendarPanel.TimeChangeListener;
+import com.vaadin.client.ui.VPopupCalendar;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.datefield.PopupDateFieldState;
+import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.PopupDateField;
+
+@Connect(DateField.class)
+public class DateFieldConnector extends TextualDateConnector {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.client.ui.AbstractConnector#init()
+ */
+ @Override
+ protected void init() {
+ getWidget().popup.addCloseHandler(new CloseHandler<PopupPanel>() {
+
+ @Override
+ public void onClose(CloseEvent<PopupPanel> event) {
+ /*
+ * FIXME This is a hack so we do not have to rewrite half of the
+ * datefield so values are not sent while selecting a date
+ * (#6252).
+ *
+ * The datefield will now only set the date UIDL variables while
+ * the user is selecting year/month/date/time and not send them
+ * directly. Only when the user closes the popup (by clicking on
+ * a day/enter/clicking outside of popup) then the new value is
+ * communicated to the server.
+ */
+ if (getWidget().isImmediate()) {
+ getConnection().sendPendingVariableChanges();
+ }
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.client.ui.VTextualDate#updateFromUIDL(com.vaadin
+ * .client.UIDL, com.vaadin.client.ApplicationConnection)
+ */
+ @Override
+ @SuppressWarnings("deprecation")
+ public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+
+ String oldLocale = getWidget().getCurrentLocale();
+
+ getWidget().parsable = uidl.getBooleanAttribute("parsable");
+
+ super.updateFromUIDL(uidl, client);
+
+ getWidget().calendar.setDateTimeService(getWidget()
+ .getDateTimeService());
+ getWidget().calendar.setShowISOWeekNumbers(getWidget()
+ .isShowISOWeekNumbers());
+ if (getWidget().calendar.getResolution() != getWidget()
+ .getCurrentResolution()) {
+ boolean hasSelectedDate = false;
+ getWidget().calendar.setResolution(getWidget()
+ .getCurrentResolution());
+ if (getWidget().calendar.getDate() != null
+ && getWidget().getCurrentDate() != null) {
+ hasSelectedDate = true;
+ getWidget().calendar.setDate((Date) getWidget()
+ .getCurrentDate().clone());
+ }
+ // force re-render when changing resolution only
+ getWidget().calendar.renderCalendar(hasSelectedDate);
+ }
+
+ // Force re-render of calendar if locale has changed (#12153)
+ if (!getWidget().getCurrentLocale().equals(oldLocale)) {
+ getWidget().calendar.renderCalendar();
+ }
+
+ if (getWidget().getCurrentResolution().getCalendarField() <= Resolution.MONTH
+ .getCalendarField()) {
+ getWidget().calendar
+ .setFocusChangeListener(new FocusChangeListener() {
+ @Override
+ public void focusChanged(Date date) {
+
+ getWidget().updateValue(date);
+ getWidget().buildDate();
+ Date date2 = getWidget().calendar.getDate();
+ date2.setYear(date.getYear());
+ date2.setMonth(date.getMonth());
+ }
+ });
+ } else {
+ getWidget().calendar.setFocusChangeListener(null);
+ }
+
+ if (getWidget().getCurrentResolution().getCalendarField() > Resolution.DAY
+ .getCalendarField()) {
+ getWidget().calendar
+ .setTimeChangeListener(new TimeChangeListener() {
+ @Override
+ public void changed(int hour, int min, int sec, int msec) {
+ Date d = getWidget().getDate();
+ if (d == null) {
+ // date currently null, use the value from
+ // calendarPanel
+ // (~ client time at the init of the widget)
+ d = (Date) getWidget().calendar.getDate()
+ .clone();
+ }
+ d.setHours(hour);
+ d.setMinutes(min);
+ d.setSeconds(sec);
+ DateTimeService.setMilliseconds(d, msec);
+
+ // Always update time changes to the server
+ getWidget().updateValue(d);
+
+ // Update text field
+ getWidget().buildDate();
+ }
+ });
+ }
+
+ if (getWidget().isReadonly()) {
+ getWidget().calendarToggle.addStyleName(VPopupCalendar.CLASSNAME
+ + "-button-readonly");
+ } else {
+ getWidget().calendarToggle.removeStyleName(VPopupCalendar.CLASSNAME
+ + "-button-readonly");
+ }
+
+ getWidget().setDescriptionForAssistiveDevices(
+ getState().descriptionForAssistiveDevices);
+
+ getWidget().setTextFieldTabIndex();
+ }
+
+ @Override
+ public VPopupCalendar getWidget() {
+ return (VPopupCalendar) super.getWidget();
+ }
+
+ @Override
+ public PopupDateFieldState getState() {
+ return (PopupDateFieldState) super.getState();
+ }
+
+ @Override
+ public void onStateChanged(StateChangeEvent stateChangeEvent) {
+ super.onStateChanged(stateChangeEvent);
+ getWidget().setTextFieldEnabled(getState().textFieldEnabled);
+ getWidget().setRangeStart(nullSafeDateClone(getState().rangeStart));
+ getWidget().setRangeEnd(nullSafeDateClone(getState().rangeEnd));
+ }
+
+ private Date nullSafeDateClone(Date date) {
+ if (date == null) {
+ return null;
+ } else {
+ return (Date) date.clone();
+ }
+ }
+
+ @Override
+ protected void setWidgetStyleName(String styleName, boolean add) {
+ super.setWidgetStyleName(styleName, add);
+
+ // update the style change to popup calendar widget
+ getWidget().popup.setStyleName(styleName, add);
+ }
+
+ @Override
+ protected void setWidgetStyleNameWithPrefix(String prefix,
+ String styleName, boolean add) {
+ super.setWidgetStyleNameWithPrefix(prefix, styleName, add);
+
+ // update the style change to popup calendar widget with the correct
+ // prefix
+ if (!styleName.startsWith("-")) {
+ getWidget().popup.setStyleName(getWidget().getStylePrimaryName()
+ + "-popup-" + styleName, add);
+ } else {
+ getWidget().popup.setStyleName(getWidget().getStylePrimaryName()
+ + "-popup" + styleName, add);
+ }
+ }
+
+}
diff --git a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
index 7bcaaba04e..31232177d3 100644
--- a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
+++ b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -16,203 +16,10 @@
package com.vaadin.client.ui.datefield;
-import java.util.Date;
-
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.vaadin.client.ApplicationConnection;
-import com.vaadin.client.DateTimeService;
-import com.vaadin.client.UIDL;
-import com.vaadin.client.communication.StateChangeEvent;
-import com.vaadin.client.ui.VCalendarPanel.FocusChangeListener;
-import com.vaadin.client.ui.VCalendarPanel.TimeChangeListener;
-import com.vaadin.client.ui.VPopupCalendar;
import com.vaadin.shared.ui.Connect;
-import com.vaadin.shared.ui.datefield.PopupDateFieldState;
-import com.vaadin.shared.ui.datefield.Resolution;
-import com.vaadin.ui.DateField;
-
-@Connect(DateField.class)
-public class PopupDateFieldConnector extends TextualDateConnector {
-
- /*
- * (non-Javadoc)
- *
- * @see com.vaadin.client.ui.AbstractConnector#init()
- */
- @Override
- protected void init() {
- getWidget().popup.addCloseHandler(new CloseHandler<PopupPanel>() {
-
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- /*
- * FIXME This is a hack so we do not have to rewrite half of the
- * datefield so values are not sent while selecting a date
- * (#6252).
- *
- * The datefield will now only set the date UIDL variables while
- * the user is selecting year/month/date/time and not send them
- * directly. Only when the user closes the popup (by clicking on
- * a day/enter/clicking outside of popup) then the new value is
- * communicated to the server.
- */
- if (getWidget().isImmediate()) {
- getConnection().sendPendingVariableChanges();
- }
- }
- });
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.vaadin.client.ui.VTextualDate#updateFromUIDL(com.vaadin
- * .client.UIDL, com.vaadin.client.ApplicationConnection)
- */
- @Override
- @SuppressWarnings("deprecation")
- public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
-
- String oldLocale = getWidget().getCurrentLocale();
-
- getWidget().parsable = uidl.getBooleanAttribute("parsable");
-
- super.updateFromUIDL(uidl, client);
-
- getWidget().calendar.setDateTimeService(getWidget()
- .getDateTimeService());
- getWidget().calendar.setShowISOWeekNumbers(getWidget()
- .isShowISOWeekNumbers());
- if (getWidget().calendar.getResolution() != getWidget()
- .getCurrentResolution()) {
- boolean hasSelectedDate = false;
- getWidget().calendar.setResolution(getWidget()
- .getCurrentResolution());
- if (getWidget().calendar.getDate() != null
- && getWidget().getCurrentDate() != null) {
- hasSelectedDate = true;
- getWidget().calendar.setDate((Date) getWidget()
- .getCurrentDate().clone());
- }
- // force re-render when changing resolution only
- getWidget().calendar.renderCalendar(hasSelectedDate);
- }
-
- // Force re-render of calendar if locale has changed (#12153)
- if (!getWidget().getCurrentLocale().equals(oldLocale)) {
- getWidget().calendar.renderCalendar();
- }
-
- if (getWidget().getCurrentResolution().getCalendarField() <= Resolution.MONTH
- .getCalendarField()) {
- getWidget().calendar
- .setFocusChangeListener(new FocusChangeListener() {
- @Override
- public void focusChanged(Date date) {
-
- getWidget().updateValue(date);
- getWidget().buildDate();
- Date date2 = getWidget().calendar.getDate();
- date2.setYear(date.getYear());
- date2.setMonth(date.getMonth());
- }
- });
- } else {
- getWidget().calendar.setFocusChangeListener(null);
- }
-
- if (getWidget().getCurrentResolution().getCalendarField() > Resolution.DAY
- .getCalendarField()) {
- getWidget().calendar
- .setTimeChangeListener(new TimeChangeListener() {
- @Override
- public void changed(int hour, int min, int sec, int msec) {
- Date d = getWidget().getDate();
- if (d == null) {
- // date currently null, use the value from
- // calendarPanel
- // (~ client time at the init of the widget)
- d = (Date) getWidget().calendar.getDate()
- .clone();
- }
- d.setHours(hour);
- d.setMinutes(min);
- d.setSeconds(sec);
- DateTimeService.setMilliseconds(d, msec);
-
- // Always update time changes to the server
- getWidget().updateValue(d);
-
- // Update text field
- getWidget().buildDate();
- }
- });
- }
-
- if (getWidget().isReadonly()) {
- getWidget().calendarToggle.addStyleName(VPopupCalendar.CLASSNAME
- + "-button-readonly");
- } else {
- getWidget().calendarToggle.removeStyleName(VPopupCalendar.CLASSNAME
- + "-button-readonly");
- }
-
- getWidget().setDescriptionForAssistiveDevices(
- getState().descriptionForAssistiveDevices);
-
- getWidget().setTextFieldTabIndex();
- }
-
- @Override
- public VPopupCalendar getWidget() {
- return (VPopupCalendar) super.getWidget();
- }
-
- @Override
- public PopupDateFieldState getState() {
- return (PopupDateFieldState) super.getState();
- }
-
- @Override
- public void onStateChanged(StateChangeEvent stateChangeEvent) {
- super.onStateChanged(stateChangeEvent);
- getWidget().setTextFieldEnabled(getState().textFieldEnabled);
- getWidget().setRangeStart(nullSafeDateClone(getState().rangeStart));
- getWidget().setRangeEnd(nullSafeDateClone(getState().rangeEnd));
- }
-
- private Date nullSafeDateClone(Date date) {
- if (date == null) {
- return null;
- } else {
- return (Date) date.clone();
- }
- }
-
- @Override
- protected void setWidgetStyleName(String styleName, boolean add) {
- super.setWidgetStyleName(styleName, add);
-
- // update the style change to popup calendar widget
- getWidget().popup.setStyleName(styleName, add);
- }
-
- @Override
- protected void setWidgetStyleNameWithPrefix(String prefix,
- String styleName, boolean add) {
- super.setWidgetStyleNameWithPrefix(prefix, styleName, add);
+import com.vaadin.ui.PopupDateField;
- // update the style change to popup calendar widget with the correct
- // prefix
- if (!styleName.startsWith("-")) {
- getWidget().popup.setStyleName(getWidget().getStylePrimaryName()
- + "-popup-" + styleName, add);
- } else {
- getWidget().popup.setStyleName(getWidget().getStylePrimaryName()
- + "-popup" + styleName, add);
- }
- }
+@Connect(PopupDateField.class)
+public class PopupDateFieldConnector extends DateFieldConnector {
}
diff --git a/client/src/com/vaadin/client/ui/orderedlayout/Slot.java b/client/src/com/vaadin/client/ui/orderedlayout/Slot.java
index 616667c367..b97cf73989 100644
--- a/client/src/com/vaadin/client/ui/orderedlayout/Slot.java
+++ b/client/src/com/vaadin/client/ui/orderedlayout/Slot.java
@@ -22,12 +22,9 @@ import com.google.gwt.aria.client.Roles;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
-import com.google.gwt.event.dom.client.BlurEvent;
-import com.google.gwt.event.dom.client.BlurHandler;
-import com.google.gwt.event.dom.client.FocusEvent;
-import com.google.gwt.event.dom.client.FocusHandler;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.*;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.BrowserInfo;
@@ -47,7 +44,6 @@ import com.vaadin.shared.ui.AlignmentInfo;
public final class Slot extends SimplePanel {
private static final String ALIGN_CLASS_PREFIX = "v-align-";
- private static final int TOUCH_ERROR_MESSAGE_HIDE_DELAY = 200;
private final VAbstractOrderedLayout layout;
@@ -59,13 +55,8 @@ public final class Slot extends SimplePanel {
private Element captionText;
private Icon icon;
private Element errorIcon;
- private Element errorMessage;
private Element requiredIcon;
- private HandlerRegistration focusRegistration;
- private HandlerRegistration blurRegistration;
- private boolean labelClicked = false;
-
private ElementResizeListener captionResizeListener;
private ElementResizeListener widgetResizeListener;
@@ -591,21 +582,9 @@ public final class Slot extends SimplePanel {
errorIcon.setClassName("v-errorindicator");
}
caption.appendChild(errorIcon);
-
- if(BrowserInfo.get().isTouchDevice()) {
- addFocusHandlerToWidget(error, widget);
- addBlurHandlerToWidget(widget);
- }
-
- } else {
- if (errorIcon != null) {
- errorIcon.removeFromParent();
- errorIcon = null;
- }
-
- if (errorMessage != null) {
- removeErrorMessageAndHandlers();
- }
+ } else if (errorIcon != null) {
+ errorIcon.removeFromParent();
+ errorIcon = null;
}
if (caption != null) {
@@ -672,81 +651,6 @@ public final class Slot extends SimplePanel {
}
}
- private void removeErrorMessageAndHandlers() {
- errorMessage.removeFromParent();
- errorMessage = null;
-
- if (focusRegistration != null) {
- focusRegistration.removeHandler();
- focusRegistration = null;
- }
-
- if(blurRegistration != null) {
- blurRegistration.removeHandler();
- blurRegistration = null;
- }
- }
-
- private void addFocusHandlerToWidget(final String error, Widget widget) {
- focusRegistration = widget.addHandler(new FocusHandler() {
- @Override
- public void onFocus(FocusEvent event) {
- if(labelClicked) {
- labelClicked = false;
- return;
- }
- if (errorMessage == null) {
- errorMessage = DOM.createDiv();
- errorMessage.setClassName("v-touch-error-message");
- }
- errorMessage.setInnerHTML(error);
- captionWrap.appendChild(errorMessage);
- }
- }, FocusEvent.getType());
- }
-
- private void addBlurHandlerToWidget(final Widget widget) {
- blurRegistration = widget.addHandler(new BlurHandler() {
- @Override
- public void onBlur(BlurEvent event) {
- if(errorMessage != null) {
- addClickHandlerToErrorMessage(widget);
- }
- scheduleErrorMessageHide(TOUCH_ERROR_MESSAGE_HIDE_DELAY);
- }
- }, BlurEvent.getType());
- }
-
- private void scheduleErrorMessageHide(int delay) {
- //Delaying hiding to allow error message click handler
- //do his job and return the focus back if error message was tapped
- Timer hideTimer = new Timer() {
- @Override
- public void run() {
- if(errorMessage != null) {
- errorMessage.removeFromParent();
- errorMessage = null;
- }
- }
- };
- hideTimer.schedule(delay);
- }
-
- private void addClickHandlerToErrorMessage(final Widget widget) {
- Event.sinkEvents(errorMessage, Event.ONCLICK);
- Event.setEventListener(errorMessage, new EventListener() {
- @Override
- public void onBrowserEvent(Event event) {
- if(Event.ONCLICK == event.getTypeInt()) {
- errorMessage.removeFromParent();
- errorMessage = null;
- labelClicked = true;
- widget.getElement().focus();
- }
- }
- });
- }
-
/**
* Does the slot have a caption
*/
diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java
index 9e1da113bf..804ad45f92 100644
--- a/client/src/com/vaadin/client/ui/ui/UIConnector.java
+++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java
@@ -847,6 +847,7 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
/**
* Loads the new theme and removes references to the old theme
*
+ * @since 7.4.3
* @param oldTheme
* The name of the old theme
* @param newTheme
@@ -856,7 +857,7 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
* @param newThemeUrl
* The url of the new theme
*/
- private void replaceTheme(final String oldTheme, final String newTheme,
+ protected void replaceTheme(final String oldTheme, final String newTheme,
String oldThemeUrl, final String newThemeUrl) {
LinkElement tagToReplace = null;
@@ -961,10 +962,11 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
* Activates the new theme. Assumes the theme has been loaded and taken into
* use in the browser.
*
- * @since 7.3
+ * @since 7.4.3
* @param newTheme
+ * The name of the new theme
*/
- private void activateTheme(String newTheme) {
+ protected void activateTheme(String newTheme) {
if (activeTheme != null) {
getWidget().getParent().removeStyleName(activeTheme);
VOverlay.getOverlayContainer(getConnection()).removeClassName(