summaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorJouni Koivuviita <jouni@vaadin.com>2014-06-26 11:45:23 +0300
committerJouni Koivuviita <jouni@vaadin.com>2014-06-26 11:46:08 +0300
commit6327a7ea520aa314fc416d2ba94ab99d0e27dcab (patch)
tree80157093d6c2bdcc133850a16ac9e42671a2e314 /client/src
parent2701ad52c4824e815200784464e8341e1fd135ed (diff)
parent9a84fb14f2b7fc3c405f1446a007d5b9cd796c97 (diff)
downloadvaadin-framework-6327a7ea520aa314fc416d2ba94ab99d0e27dcab.tar.gz
vaadin-framework-6327a7ea520aa314fc416d2ba94ab99d0e27dcab.zip
Merge branch 'master' into valo
Change-Id: I9f804f3ba10922a3d59999df06a23f2daa4cd4e8
Diffstat (limited to 'client/src')
-rw-r--r--client/src/com/vaadin/client/ApplicationConnection.java15
-rw-r--r--client/src/com/vaadin/client/TooltipInfo.java6
-rw-r--r--client/src/com/vaadin/client/Util.java19
-rw-r--r--client/src/com/vaadin/client/VTooltip.java73
-rw-r--r--client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java51
-rw-r--r--client/src/com/vaadin/client/metadata/Type.java17
-rw-r--r--client/src/com/vaadin/client/ui/VAbstractSplitPanel.java8
-rw-r--r--client/src/com/vaadin/client/ui/VCalendarPanel.java4
-rw-r--r--client/src/com/vaadin/client/ui/VColorPickerArea.java2
-rw-r--r--client/src/com/vaadin/client/ui/VFilterSelect.java111
-rw-r--r--client/src/com/vaadin/client/ui/VMenuBar.java84
-rw-r--r--client/src/com/vaadin/client/ui/VRichTextArea.java91
-rw-r--r--client/src/com/vaadin/client/ui/VScrollTable.java17
-rw-r--r--client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java1
-rw-r--r--client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java22
-rw-r--r--client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java33
-rw-r--r--client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java27
-rw-r--r--client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java33
18 files changed, 340 insertions, 274 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index 694fc71060..8bc43dda9a 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -1432,12 +1432,19 @@ public class ApplicationConnection implements HasHandlers {
if (json.containsKey(ApplicationConstants.SERVER_SYNC_ID)) {
int syncId = json.getInt(ApplicationConstants.SERVER_SYNC_ID);
- assert (lastSeenServerSyncId == UNDEFINED_SYNC_ID || syncId == lastSeenServerSyncId + 1) : "Newly retrieved server sync id was not exactly one larger than the previous one (new: "
- + syncId + ", last seen: " + lastSeenServerSyncId + ")";
+ /*
+ * Use sync id unless explicitly set as undefined, as is done by
+ * e.g. critical server-side notifications
+ */
+ if (syncId != -1) {
+ assert (lastSeenServerSyncId == UNDEFINED_SYNC_ID || syncId == lastSeenServerSyncId + 1) : "Newly retrieved server sync id was not exactly one larger than the previous one (new: "
+ + syncId + ", last seen: " + lastSeenServerSyncId + ")";
- lastSeenServerSyncId = syncId;
+ lastSeenServerSyncId = syncId;
+ }
} else {
- VConsole.error("Server response didn't contain an id.");
+ VConsole.error("Server response didn't contain a sync id. "
+ + "Please verify that the server is up-to-date and that the response data has not been modified in transmission.");
}
// Handle redirect
diff --git a/client/src/com/vaadin/client/TooltipInfo.java b/client/src/com/vaadin/client/TooltipInfo.java
index 06940536c8..c1dd5037eb 100644
--- a/client/src/com/vaadin/client/TooltipInfo.java
+++ b/client/src/com/vaadin/client/TooltipInfo.java
@@ -15,6 +15,8 @@
*/
package com.vaadin.client;
+import com.vaadin.shared.util.SharedUtil;
+
public class TooltipInfo {
private String title;
@@ -79,7 +81,7 @@ public class TooltipInfo {
}
public boolean equals(TooltipInfo other) {
- return (other != null && other.title == title
- && other.errorMessageHtml == errorMessageHtml && other.identifier == identifier);
+ return (other != null && SharedUtil.equals(other.title, title)
+ && SharedUtil.equals(other.errorMessageHtml, errorMessageHtml) && other.identifier == identifier);
}
}
diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java
index e031b37422..f12a02c64f 100644
--- a/client/src/com/vaadin/client/Util.java
+++ b/client/src/com/vaadin/client/Util.java
@@ -35,6 +35,7 @@ import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.dom.client.Touch;
+import com.google.gwt.event.dom.client.KeyEvent;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
@@ -66,7 +67,23 @@ public class Util {
}-*/;
/**
- *
+ * Helper method for a bug fix #14041. For mozilla getKeyCode return 0 for
+ * space bar (because space is considered as char). If return 0 use
+ * getCharCode.
+ *
+ * @param event
+ * @return return key code
+ */
+ public static int getKeyCode(KeyEvent<?> event) {
+ int keyCode = event.getNativeEvent().getKeyCode();
+ if (keyCode == 0) {
+ keyCode = event.getNativeEvent().getCharCode();
+ }
+ return keyCode;
+ }
+
+ /**
+ *
* Returns the topmost element of from given coordinates.
*
* TODO fix crossplat issues clientX vs pageX. See quircksmode. Not critical
diff --git a/client/src/com/vaadin/client/VTooltip.java b/client/src/com/vaadin/client/VTooltip.java
index 8e653a0476..d1a2c395f7 100644
--- a/client/src/com/vaadin/client/VTooltip.java
+++ b/client/src/com/vaadin/client/VTooltip.java
@@ -22,13 +22,13 @@ import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.BlurHandler;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
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;
@@ -109,13 +109,13 @@ public class VTooltip extends VWindowOverlay {
}
private void setTooltipText(TooltipInfo info) {
- if (info.getErrorMessage() != null) {
+ if (info.getErrorMessage() != null && !info.getErrorMessage().isEmpty()) {
em.setVisible(true);
em.updateMessage(info.getErrorMessage());
} else {
em.setVisible(false);
}
- if (info.getTitle() != null && !"".equals(info.getTitle())) {
+ if (info.getTitle() != null && !info.getTitle().isEmpty()) {
description.setInnerHTML(info.getTitle());
description.getStyle().clearDisplay();
} else {
@@ -130,13 +130,7 @@ public class VTooltip extends VWindowOverlay {
*
*/
private void showTooltip() {
- boolean hasContent = false;
- if (currentTooltipInfo.getErrorMessage() != null
- || (currentTooltipInfo.getTitle() != null && !""
- .equals(currentTooltipInfo.getTitle()))) {
- hasContent = true;
- }
- if (hasContent) {
+ if (currentTooltipInfo.hasMessage()) {
// Issue #8454: With IE7 the tooltips size is calculated based on
// the last tooltip's position, causing problems if the last one was
// in the right or bottom edge. For this reason the tooltip is moved
@@ -229,18 +223,23 @@ public class VTooltip extends VWindowOverlay {
/**
* For assistive tooltips to work correctly we must have the tooltip visible
- * and attached to the DOM well in advance.
+ * and attached to the DOM well in advance. For this reason both isShowing
+ * and isVisible return false positives. We can't override either of them as
+ * external code may depend on this behavior.
*
- * @return
+ * @return boolean
*/
- public boolean isActuallyVisible() {
- return super.isShowing() && getPopupLeft() > 0 && getPopupTop() > 0;
+ public boolean isTooltipOpen() {
+ return super.isShowing() && super.isVisible() && getPopupLeft() > 0
+ && getPopupTop() > 0;
}
private void closeNow() {
hide();
setWidth("");
closing = false;
+ justClosedTimer.schedule(getQuickOpenTimeout());
+ justClosed = true;
}
private Timer showTimer = new Timer() {
@@ -255,8 +254,6 @@ public class VTooltip extends VWindowOverlay {
@Override
public void run() {
closeNow();
- justClosedTimer.schedule(getQuickOpenTimeout());
- justClosed = true;
}
};
@@ -279,7 +276,7 @@ public class VTooltip extends VWindowOverlay {
// already about to close
return;
}
- if (isActuallyVisible()) {
+ if (isTooltipOpen()) {
closeTimer.schedule(getCloseTimeout());
closing = true;
}
@@ -331,6 +328,8 @@ public class VTooltip extends VWindowOverlay {
if (closing) {
closeTimer.cancel();
closeNow();
+ justClosedTimer.cancel();
+ justClosed = false;
}
showTooltip();
@@ -338,7 +337,7 @@ public class VTooltip extends VWindowOverlay {
}
private class TooltipEventHandler implements MouseMoveHandler,
- ClickHandler, KeyDownHandler, FocusHandler, BlurHandler {
+ KeyDownHandler, FocusHandler, BlurHandler, MouseDownHandler {
/**
* Current element hovered
@@ -404,7 +403,7 @@ public class VTooltip extends VWindowOverlay {
}
@Override
- public void onClick(ClickEvent event) {
+ public void onMouseDown(MouseDownEvent event) {
handleHideEvent();
}
@@ -449,10 +448,10 @@ public class VTooltip extends VWindowOverlay {
// hasn't changed, we ignore the event.
// TooltipInfo contains a reference to the parent component that is
// checked in it's equals-method.
- if (currentElement != null && isActuallyVisible()) {
- TooltipInfo currentTooltip = getTooltipFor(currentElement);
+ if (currentElement != null && isTooltipOpen()) {
TooltipInfo newTooltip = getTooltipFor(element);
- if (currentTooltip != null && currentTooltip.equals(newTooltip)) {
+ if (currentTooltipInfo != null
+ && currentTooltipInfo.equals(newTooltip)) {
return;
}
}
@@ -465,31 +464,27 @@ public class VTooltip extends VWindowOverlay {
closeTimer.cancel();
closing = false;
}
+
+ if (isTooltipOpen()) {
+ closeNow();
+ }
+
setTooltipText(info);
updatePosition(event, isFocused);
- if (isActuallyVisible() && !isFocused) {
+ // Schedule timer for showing the tooltip according to if it
+ // was recently closed or not.
+ int timeout = justClosed ? getQuickOpenDelay() : getOpenDelay();
+ if (timeout == 0) {
showTooltip();
} else {
- if (isActuallyVisible()) {
- closeNow();
- }
- // Schedule timer for showing the tooltip according to if it
- // was recently closed or not.
- int timeout = justClosed ? getQuickOpenDelay()
- : getOpenDelay();
- if (timeout == 0) {
- showTooltip();
- } else {
- showTimer.schedule(timeout);
- opening = true;
- }
+ showTimer.schedule(timeout);
+ opening = true;
}
}
handledByFocus = isFocused;
currentElement = element;
}
-
}
private final TooltipEventHandler tooltipEventHandler = new TooltipEventHandler();
@@ -503,7 +498,7 @@ public class VTooltip extends VWindowOverlay {
public void connectHandlersToWidget(Widget widget) {
Profiler.enter("VTooltip.connectHandlersToWidget");
widget.addDomHandler(tooltipEventHandler, MouseMoveEvent.getType());
- widget.addDomHandler(tooltipEventHandler, ClickEvent.getType());
+ widget.addDomHandler(tooltipEventHandler, MouseDownEvent.getType());
widget.addDomHandler(tooltipEventHandler, KeyDownEvent.getType());
widget.addDomHandler(tooltipEventHandler, FocusEvent.getType());
widget.addDomHandler(tooltipEventHandler, BlurEvent.getType());
diff --git a/client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java b/client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java
index 7d2078061e..846bfd4671 100644
--- a/client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java
+++ b/client/src/com/vaadin/client/metadata/ConnectorBundleLoader.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
@@ -15,13 +15,35 @@
*/
package com.vaadin.client.metadata;
+import java.util.ArrayList;
import java.util.List;
import com.google.gwt.core.shared.GWT;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.ApplicationConfiguration;
import com.vaadin.client.FastStringMap;
import com.vaadin.client.metadata.AsyncBundleLoader.State;
+import com.vaadin.client.ui.VNotification;
+import com.vaadin.shared.Position;
public abstract class ConnectorBundleLoader {
+
+ public static class CValUiInfo {
+ public final String widgetset;
+ public final String product;
+ public final String version;
+ public final String type;
+
+ public CValUiInfo(String product, String version, String widgetset,
+ String type) {
+ this.product = product;
+ this.version = version;
+ this.widgetset = widgetset;
+ this.type = type;
+ }
+ }
+
public static final String EAGER_BUNDLE_NAME = "__eager";
public static final String DEFERRED_BUNDLE_NAME = "__deferred";
@@ -113,4 +135,27 @@ public abstract class ConnectorBundleLoader {
public abstract void init();
+ protected List<CValUiInfo> cvals = new ArrayList<CValUiInfo>();
+
+ public void cval(String typeName) {
+ if (!cvals.isEmpty()) {
+ String msg = "";
+ for (CValUiInfo c : cvals) {
+ String ns = c.widgetset.replaceFirst("\\.[^\\.]+$", "");
+ if (typeName.startsWith(ns)) {
+ cvals.remove(c);
+ msg += c.product + " " + c.version + "<br/>";
+ }
+ }
+ if (!msg.isEmpty()) {
+ // We need a widget for using VNotification, using the
+ // context-menu parent. Is there an easy way?
+ Widget w = ApplicationConfiguration.getRunningApplications()
+ .get(0).getContextMenu().getParent();
+ VNotification n = VNotification.createNotification(0, w);
+ n.setWidget(new HTML("Using Evaluation License of:<br/>" + msg));
+ n.show(Position.BOTTOM_RIGHT);
+ }
+ }
+ }
}
diff --git a/client/src/com/vaadin/client/metadata/Type.java b/client/src/com/vaadin/client/metadata/Type.java
index cc185dff96..15617ffe3c 100644
--- a/client/src/com/vaadin/client/metadata/Type.java
+++ b/client/src/com/vaadin/client/metadata/Type.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
@@ -19,6 +19,7 @@ import java.util.Collection;
import com.google.gwt.core.client.JsArrayString;
import com.vaadin.client.JsArrayObject;
+import com.vaadin.client.ServerConnector;
import com.vaadin.client.communication.JSONSerializer;
public class Type {
@@ -47,7 +48,11 @@ public class Type {
public Object createInstance() throws NoDataException {
Invoker invoker = TypeDataStore.getConstructor(this);
- return invoker.invoke(null);
+ Object ret = invoker.invoke(null);
+ if (ret instanceof ServerConnector) {
+ ConnectorBundleLoader.get().cval(name);
+ }
+ return ret;
}
public Method getMethod(String name) {
@@ -57,7 +62,7 @@ public class Type {
/**
* @return
* @throws NoDataException
- *
+ *
* @deprecated As of 7.0.1, use {@link #getPropertiesAsArray()} instead for
* improved performance
*/
@@ -96,7 +101,7 @@ public class Type {
* returned string may change without notice and should not be used for any
* other purpose than identification. The signature is currently based on
* the fully qualified name of the type.
- *
+ *
* @return the unique signature of this type
*/
public String getSignature() {
diff --git a/client/src/com/vaadin/client/ui/VAbstractSplitPanel.java b/client/src/com/vaadin/client/ui/VAbstractSplitPanel.java
index 269db23366..6ee88d51dd 100644
--- a/client/src/com/vaadin/client/ui/VAbstractSplitPanel.java
+++ b/client/src/com/vaadin/client/ui/VAbstractSplitPanel.java
@@ -511,6 +511,10 @@ public class VAbstractSplitPanel extends ComplexPanel {
firstChild = w;
}
+ public Widget getFirstWidget() {
+ return firstChild;
+ }
+
/** For internal use only. May be removed or replaced in the future. */
public void setSecondWidget(Widget w) {
if (secondChild == w) {
@@ -525,6 +529,10 @@ public class VAbstractSplitPanel extends ComplexPanel {
secondChild = w;
}
+ public Widget getSecondWidget() {
+ return secondChild;
+ }
+
@Override
public void onBrowserEvent(Event event) {
switch (DOM.eventGetType(event)) {
diff --git a/client/src/com/vaadin/client/ui/VCalendarPanel.java b/client/src/com/vaadin/client/ui/VCalendarPanel.java
index d8c96917d8..eaa2292c69 100644
--- a/client/src/com/vaadin/client/ui/VCalendarPanel.java
+++ b/client/src/com/vaadin/client/ui/VCalendarPanel.java
@@ -813,14 +813,12 @@ public class VCalendarPanel extends FocusableFlexTable implements
buildCalendarBody();
}
- if (isTimeSelectorNeeded() && time == null) {
+ if (isTimeSelectorNeeded()) {
time = new VTime();
setWidget(2, 0, time);
getFlexCellFormatter().setColSpan(2, 0, 5);
getFlexCellFormatter().setStyleName(2, 0,
parent.getStylePrimaryName() + "-calendarpanel-time");
- } else if (isTimeSelectorNeeded()) {
- time.updateTimes();
} else if (time != null) {
remove(time);
}
diff --git a/client/src/com/vaadin/client/ui/VColorPickerArea.java b/client/src/com/vaadin/client/ui/VColorPickerArea.java
index e581cf3448..23a9379c80 100644
--- a/client/src/com/vaadin/client/ui/VColorPickerArea.java
+++ b/client/src/com/vaadin/client/ui/VColorPickerArea.java
@@ -34,6 +34,7 @@ import com.google.gwt.user.client.ui.Widget;
public class VColorPickerArea extends Widget implements ClickHandler, HasHTML,
HasClickHandlers {
+ public static final String CLASSNAME = "v-colorpicker";
private String color = null;
private boolean isOpen;
@@ -47,6 +48,7 @@ public class VColorPickerArea extends Widget implements ClickHandler, HasHTML,
public VColorPickerArea() {
super();
setElement(DOM.createDiv());
+ setStyleName(CLASSNAME);
caption = new HTML();
caption.addStyleName("v-caption");
diff --git a/client/src/com/vaadin/client/ui/VFilterSelect.java b/client/src/com/vaadin/client/ui/VFilterSelect.java
index a1de2c2b6d..7157ef99b3 100644
--- a/client/src/com/vaadin/client/ui/VFilterSelect.java
+++ b/client/src/com/vaadin/client/ui/VFilterSelect.java
@@ -81,7 +81,7 @@ import com.vaadin.shared.ui.combobox.FilteringMode;
/**
* Client side implementation of the Select component.
- *
+ *
* TODO needs major refactoring (to be extensible etc)
*/
@SuppressWarnings("deprecation")
@@ -101,7 +101,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Constructor
- *
+ *
* @param uidl
* The UIDL recieved from the server
*/
@@ -150,7 +150,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Get the option key which represents the item on the server side.
- *
+ *
* @return The key of the item
*/
public String getOptionKey() {
@@ -159,7 +159,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Get the URI of the icon. Used when constructing the displayed option.
- *
+ *
* @return
*/
public String getIconUri() {
@@ -256,7 +256,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Shows the popup where the user can see the filtered options
- *
+ *
* @param currentSuggestions
* The filtered suggestions
* @param currentPage
@@ -342,7 +342,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Should the next page button be visible to the user?
- *
+ *
* @param active
*/
private void setNextButtonActive(boolean active) {
@@ -362,7 +362,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Should the previous page button be visible to the user
- *
+ *
* @param active
*/
private void setPrevButtonActive(boolean active) {
@@ -449,7 +449,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* because otherwise the waiting flag will be reset in
* the first response and the second response will be
* ignored, causing an empty popup...
- *
+ *
* As long as the scrolling delay is suitable
* double/triple clicks will work by scrolling two or
* three pages at a time and this should not be a
@@ -484,7 +484,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/*
* (non-Javadoc)
- *
+ *
* @see
* com.google.gwt.user.client.ui.Widget#onBrowserEvent(com.google.gwt
* .user.client.Event)
@@ -521,7 +521,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* amount of items are visible at a time and a scrollbar or buttons are
* visible to change page. If paging is turned of then all options are
* rendered into the popup menu.
- *
+ *
* @param paging
* Should the paging be turned on?
*/
@@ -544,7 +544,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/*
* (non-Javadoc)
- *
+ *
* @see
* com.google.gwt.user.client.ui.PopupPanel$PositionCallback#setPosition
* (int, int)
@@ -637,7 +637,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Was the popup just closed?
- *
+ *
* @return true if popup was just closed
*/
public boolean isJustClosed() {
@@ -648,7 +648,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/*
* (non-Javadoc)
- *
+ *
* @see
* com.google.gwt.event.logical.shared.CloseHandler#onClose(com.google
* .gwt.event.logical.shared.CloseEvent)
@@ -666,7 +666,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Updates style names in suggestion popup to help theme building.
- *
+ *
* @param uidl
* UIDL for the whole combo box
* @param componentState
@@ -746,7 +746,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Sets the suggestions rendered in the menu
- *
+ *
* @param suggestions
* The suggestions to be rendered in the menu
*/
@@ -941,7 +941,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* TextBox variant used as input element for filter selects, which prevents
* selecting text when disabled.
- *
+ *
* @since 7.1.5
*/
public class FilterSelectTextBox extends TextBox {
@@ -993,7 +993,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/*
* (non-Javadoc)
- *
+ *
* @see
* com.google.gwt.user.client.ui.Widget#onBrowserEvent(com.google.gwt
* .user.client.Event)
@@ -1166,7 +1166,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/*
* (non-Javadoc)
- *
+ *
* @see
* com.google.gwt.user.client.ui.Composite#onBrowserEvent(com.google.gwt
* .user.client.Event)
@@ -1193,7 +1193,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* It is invoked during the Constructor and should only be overridden if a
* custom TextBox shall be used. The overriding method cannot use any
* instance variables.
- *
+ *
* @since 7.1.5
* @return TextBox instance used by this VFilterSelect
*/
@@ -1206,7 +1206,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* instance. It is invoked during the Constructor and should only be
* overridden if a custom SuggestionPopup shall be used. The overriding
* method cannot use any instance variables.
- *
+ *
* @since 7.1.5
* @return SuggestionPopup instance used by this VFilterSelect
*/
@@ -1234,7 +1234,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Does the Select have more pages?
- *
+ *
* @return true if a next page exists, else false if the current page is the
* last page
*/
@@ -1249,7 +1249,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Filters the options at a certain page. Uses the text box input as a
* filter
- *
+ *
* @param page
* The page which items are to be filtered
*/
@@ -1259,7 +1259,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Filters the options at certain page using the given filter
- *
+ *
* @param page
* The page to filter
* @param filter
@@ -1271,7 +1271,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Filters the options at certain page using the given filter
- *
+ *
* @param page
* The page to filter
* @param filter
@@ -1336,7 +1336,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Sets the text in the text box.
- *
+ *
* @param text
* the text to set in the text box
*/
@@ -1365,7 +1365,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* shown in the text box if nothing has been entered.
* <p>
* For internal use only. May be removed or replaced in the future.
- *
+ *
* @param text
* The text the text box should contain.
*/
@@ -1380,7 +1380,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Triggered when a suggestion is selected
- *
+ *
* @param suggestion
* The suggestion that just got selected.
*/
@@ -1420,7 +1420,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Sets the icon URI of the selected item. The icon is shown on the left
* side of the item caption text. Set the URI to null to remove the icon.
- *
+ *
* @param iconUri
* The URI of the icon
*/
@@ -1493,7 +1493,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/*
* (non-Javadoc)
- *
+ *
* @see
* com.google.gwt.event.dom.client.KeyDownHandler#onKeyDown(com.google.gwt
* .event.dom.client.KeyDownEvent)
@@ -1546,7 +1546,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Triggered when a key is pressed in the text box
- *
+ *
* @param event
* The KeyDownEvent
*/
@@ -1591,7 +1591,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Triggered when a key was pressed in the suggestion popup.
- *
+ *
* @param event
* The KeyDownEvent of the key
*/
@@ -1673,7 +1673,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Triggered when a key was depressed
- *
+ *
* @param event
* The KeyUpEvent of the key depressed
*/
@@ -1716,7 +1716,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
setPromptingOff(text);
selectedOptionKey = currentSuggestion.key;
} else {
- if (focused) {
+ if (focused || readonly || !enabled) {
setPromptingOff("");
} else {
setPromptingOn();
@@ -1816,7 +1816,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/*
* (non-Javadoc)
- *
+ *
* @see
* com.google.gwt.event.dom.client.FocusHandler#onFocus(com.google.gwt.event
* .dom.client.FocusEvent)
@@ -1860,7 +1860,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/*
* (non-Javadoc)
- *
+ *
* @see
* com.google.gwt.event.dom.client.BlurHandler#onBlur(com.google.gwt.event
* .dom.client.BlurEvent)
@@ -1925,7 +1925,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.client.Focusable#focus()
*/
@@ -1946,22 +1946,9 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
* For internal use only. May be removed or replaced in the future.
*/
public void updateRootWidth() {
- updateRootWidth(false);
- }
-
- /**
- * Calculates the width of the select if the select has undefined width.
- * Should be called when the width changes or when the icon changes.
- * <p>
- * For internal use only. May be removed or replaced in the future.
- *
- * @param forceUpdate
- * a flag that forces a recalculation even if one would not
- * normally be done
- */
- public void updateRootWidth(boolean forceUpdate) {
ComponentConnector paintable = ConnectorMap.get(client).getConnector(
this);
+
if (paintable.isUndefinedWidth()) {
/*
@@ -1973,7 +1960,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
*/
int w = Util.getRequiredWidth(this);
- if (forceUpdate || (!initDone || currentPage + 1 < 0)
+ if ((!initDone || currentPage + 1 < 0)
&& suggestionPopupMinWidth > w) {
/*
* We want to compensate for the paddings just to preserve the
@@ -1987,11 +1974,25 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
String originalBorder = style.getBorderWidth();
style.setPaddingLeft(0, Unit.PX);
style.setBorderWidth(0, Unit.PX);
- int offset = w - Util.getRequiredWidth(this);
style.setProperty("padding", originalPadding);
style.setProperty("borderWidth", originalBorder);
- setWidth(suggestionPopupMinWidth + offset + "px");
+ // Use util.getRequiredWidth instead of getOffsetWidth here
+
+ int iconWidth = selectedItemIcon == null ? 0 : Util
+ .getRequiredWidth(selectedItemIcon);
+ int buttonWidth = popupOpener == null ? 0 : Util
+ .getRequiredWidth(popupOpener);
+
+ /*
+ * Instead of setting the width of the wrapper, set the width of
+ * the combobox. Subtract the width of the icon and the
+ * popupopener
+ */
+
+ tb.setWidth((suggestionPopupMinWidth - iconWidth - buttonWidth)
+ + "px");
+
}
/*
@@ -2009,7 +2010,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Get the width of the select in pixels where the text area and icon has
* been included.
- *
+ *
* @return The width in pixels
*/
private int getMainWidth() {
@@ -2026,7 +2027,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
/**
* Handles special behavior of the mouse down event
- *
+ *
* @param event
*/
private void handleMouseDownEvent(Event event) {
diff --git a/client/src/com/vaadin/client/ui/VMenuBar.java b/client/src/com/vaadin/client/ui/VMenuBar.java
index 11fda6222c..909b25f7fb 100644
--- a/client/src/com/vaadin/client/ui/VMenuBar.java
+++ b/client/src/com/vaadin/client/ui/VMenuBar.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
@@ -243,7 +243,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* This is called by the items in the menu and it communicates the
* information to the server
- *
+ *
* @param clickedItemId
* id of the item that was clicked
*/
@@ -280,7 +280,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Returns the containing element of the menu
- *
+ *
* @return
*/
@Override
@@ -290,7 +290,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Add a new item to this menu
- *
+ *
* @param html
* items text
* @param cmd
@@ -307,7 +307,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Add a new item to this menu
- *
+ *
* @param item
*/
public void addItem(CustomMenuItem item) {
@@ -332,7 +332,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Remove the given item from this menu
- *
+ *
* @param item
*/
public void removeItem(CustomMenuItem item) {
@@ -429,7 +429,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* When an item is clicked
- *
+ *
* @param item
*/
public void itemClick(CustomMenuItem item) {
@@ -460,7 +460,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* When the user hovers the mouse over the item
- *
+ *
* @param item
*/
public void itemOver(CustomMenuItem item) {
@@ -485,7 +485,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* When the mouse is moved away from an item
- *
+ *
* @param item
*/
public void itemOut(CustomMenuItem item) {
@@ -543,7 +543,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Shows the child menu of an item. The caller must ensure that the item has
* a submenu.
- *
+ *
* @param item
*/
public void showChildMenu(CustomMenuItem item) {
@@ -665,7 +665,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Hides the submenu of an item
- *
+ *
* @param item
*/
public void hideChildMenu(CustomMenuItem item) {
@@ -729,7 +729,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Returns the parent menu of this menu, or null if this is the top-level
* menu
- *
+ *
* @return
*/
public VMenuBar getParentMenu() {
@@ -738,7 +738,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Set the parent menu of this menu
- *
+ *
* @param parent
*/
public void setParentMenu(VMenuBar parent) {
@@ -748,7 +748,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Returns the currently selected item of this menu, or null if nothing is
* selected
- *
+ *
* @return
*/
public CustomMenuItem getSelected() {
@@ -757,7 +757,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Set the currently selected item of this menu
- *
+ *
* @param item
*/
public void setSelected(CustomMenuItem item) {
@@ -774,9 +774,9 @@ public class VMenuBar extends SimpleFocusablePanel implements
}
/**
- *
+ *
* A class to hold information on menu items
- *
+ *
*/
public static class CustomMenuItem extends Widget implements HasHTML {
@@ -795,7 +795,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Default menu item {@link Widget} constructor for GWT.create().
- *
+ *
* Use {@link #setHTML(String)} and {@link #setCommand(Command)} after
* constructing a menu item.
*/
@@ -805,7 +805,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Creates a menu item {@link Widget}.
- *
+ *
* @param html
* @param cmd
* @deprecated use the default constructor and {@link #setHTML(String)}
@@ -1039,7 +1039,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Checks if the item can be selected.
- *
+ *
* @return true if it is possible to select this item, false otherwise
*/
public boolean isSelectable() {
@@ -1157,7 +1157,14 @@ public class VMenuBar extends SimpleFocusablePanel implements
*/
@Override
public void onKeyPress(KeyPressEvent event) {
- if (handleNavigation(event.getNativeEvent().getKeyCode(),
+ // A bug fix for #14041
+ // getKeyCode and getCharCode return different values for different
+ // browsers
+ int keyCode = event.getNativeEvent().getKeyCode();
+ if (keyCode == 0) {
+ keyCode = event.getNativeEvent().getCharCode();
+ }
+ if (handleNavigation(keyCode,
event.isControlKeyDown() || event.isMetaKeyDown(),
event.isShiftKeyDown())) {
event.preventDefault();
@@ -1173,7 +1180,14 @@ public class VMenuBar extends SimpleFocusablePanel implements
*/
@Override
public void onKeyDown(KeyDownEvent event) {
- if (handleNavigation(event.getNativeEvent().getKeyCode(),
+ // A bug fix for #14041
+ // getKeyCode and getCharCode return different values for different
+ // browsers
+ int keyCode = event.getNativeEvent().getKeyCode();
+ if (keyCode == 0) {
+ keyCode = event.getNativeEvent().getCharCode();
+ }
+ if (handleNavigation(keyCode,
event.isControlKeyDown() || event.isMetaKeyDown(),
event.isShiftKeyDown())) {
event.preventDefault();
@@ -1184,7 +1198,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
* Get the key that moves the selection upwards. By default it is the up
* arrow key but by overriding this you can change the key to whatever you
* want.
- *
+ *
* @return The keycode of the key
*/
protected int getNavigationUpKey() {
@@ -1195,7 +1209,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
* Get the key that moves the selection downwards. By default it is the down
* arrow key but by overriding this you can change the key to whatever you
* want.
- *
+ *
* @return The keycode of the key
*/
protected int getNavigationDownKey() {
@@ -1206,7 +1220,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
* Get the key that moves the selection left. By default it is the left
* arrow key but by overriding this you can change the key to whatever you
* want.
- *
+ *
* @return The keycode of the key
*/
protected int getNavigationLeftKey() {
@@ -1217,7 +1231,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
* Get the key that moves the selection right. By default it is the right
* arrow key but by overriding this you can change the key to whatever you
* want.
- *
+ *
* @return The keycode of the key
*/
protected int getNavigationRightKey() {
@@ -1227,7 +1241,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Get the key that selects a menu item. By default it is the Enter key but
* by overriding this you can change the key to whatever you want.
- *
+ *
* @deprecated use {@link #isNavigationSelectKey(int)} instead
* @return
*/
@@ -1240,7 +1254,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
* Checks whether key code selects a menu item. By default it is the Enter
* and Space keys but by overriding this you can change the keys to whatever
* you want.
- *
+ *
* @since 7.2
* @param keycode
* @return true if key selects menu item
@@ -1253,7 +1267,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Get the key that closes the menu. By default it is the escape key but by
* overriding this yoy can change the key to whatever you want.
- *
+ *
* @return
*/
protected int getCloseMenuKey() {
@@ -1262,7 +1276,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Handles the keyboard events handled by the MenuBar
- *
+ *
* @param event
* The keyboard event received
* @return true iff the navigation event was handled
@@ -1549,7 +1563,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Get menu item with given DOM element
- *
+ *
* @param element
* Element used in search
* @return Menu item or null if not found
@@ -1578,11 +1592,11 @@ public class VMenuBar extends SimpleFocusablePanel implements
/**
* Get menu item with given DOM element
- *
+ *
* @param element
* Element used in search
* @return Menu item or null if not found
- *
+ *
* @since 7.2
*/
public CustomMenuItem getMenuItemWithElement(Element element) {
diff --git a/client/src/com/vaadin/client/ui/VRichTextArea.java b/client/src/com/vaadin/client/ui/VRichTextArea.java
index 52e3782f32..3f63f38067 100644
--- a/client/src/com/vaadin/client/ui/VRichTextArea.java
+++ b/client/src/com/vaadin/client/ui/VRichTextArea.java
@@ -21,10 +21,6 @@ import java.util.Map;
import java.util.Map.Entry;
import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.Style.Position;
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.event.dom.client.BlurHandler;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler;
@@ -32,7 +28,6 @@ import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
@@ -43,7 +38,6 @@ import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.BrowserInfo;
import com.vaadin.client.ConnectorMap;
-import com.vaadin.client.Util;
import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner;
import com.vaadin.client.ui.richtextarea.VRichTextToolbar;
@@ -73,7 +67,8 @@ public class VRichTextArea extends Composite implements Field, KeyPressHandler,
/** For internal use only. May be removed or replaced in the future. */
public RichTextArea rta;
- private VRichTextToolbar formatter;
+ /** For internal use only. May be removed or replaced in the future. */
+ public VRichTextToolbar formatter;
/** For internal use only. May be removed or replaced in the future. */
public HTML html = new HTML();
@@ -82,9 +77,6 @@ public class VRichTextArea extends Composite implements Field, KeyPressHandler,
private boolean enabled = true;
- private int extraHorizontalPixels = -1;
- private int extraVerticalPixels = -1;
-
/** For internal use only. May be removed or replaced in the future. */
public int maxLength = -1;
@@ -193,92 +185,17 @@ public class VRichTextArea extends Composite implements Field, KeyPressHandler,
return readOnly;
}
- /**
- * @return space used by components paddings and borders
- */
- private int getExtraHorizontalPixels() {
- if (extraHorizontalPixels < 0) {
- detectExtraSizes();
- }
- return extraHorizontalPixels;
- }
-
- /**
- * @return space used by components paddings and borders
- */
- private int getExtraVerticalPixels() {
- if (extraVerticalPixels < 0) {
- detectExtraSizes();
- }
- return extraVerticalPixels;
- }
-
- /**
- * Detects space used by components paddings and borders.
- */
- private void detectExtraSizes() {
- Element clone = Util.cloneNode(getElement(), false);
- DOM.setElementAttribute(clone, "id", "");
- clone.getStyle().setVisibility(Visibility.HIDDEN);
- clone.getStyle().setPosition(Position.ABSOLUTE);
- // due FF3 bug set size to 10px and later subtract it from extra pixels
- clone.getStyle().setWidth(10, Unit.PX);
- clone.getStyle().setHeight(10, Unit.PX);
- DOM.appendChild(DOM.getParent(getElement()), clone);
- extraHorizontalPixels = DOM.getElementPropertyInt(clone, "offsetWidth") - 10;
- extraVerticalPixels = DOM.getElementPropertyInt(clone, "offsetHeight") - 10;
-
- DOM.removeChild(DOM.getParent(getElement()), clone);
- }
-
@Override
public void setHeight(String height) {
- if (height.endsWith("px")) {
- float h = Float
- .parseFloat(height.substring(0, height.length() - 2));
- h -= getExtraVerticalPixels();
- if (h < 0) {
- h = 0;
- }
-
- super.setHeight(h + "px");
- } else {
- super.setHeight(height);
- }
-
+ super.setHeight(height);
if (height == null || height.equals("")) {
rta.setHeight("");
- } else {
- /*
- * The formatter height will be initially calculated wrong so we
- * delay the height setting so the DOM has had time to stabilize.
- */
- Scheduler.get().scheduleDeferred(new Command() {
- @Override
- public void execute() {
- int editorHeight = getOffsetHeight()
- - getExtraVerticalPixels()
- - formatter.getOffsetHeight();
- if (editorHeight < 0) {
- editorHeight = 0;
- }
- rta.setHeight(editorHeight + "px");
- }
- });
}
}
@Override
public void setWidth(String width) {
- if (width.endsWith("px")) {
- float w = Float.parseFloat(width.substring(0, width.length() - 2));
- w -= getExtraHorizontalPixels();
- if (w < 0) {
- w = 0;
- }
-
- super.setWidth(w + "px");
- } else if (width.equals("")) {
+ if (width.equals("")) {
/*
* IE cannot calculate the width of the 100% iframe correctly if
* there is no width specified for the parent. In this case we would
diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java
index d3317abd4d..7ec6845a11 100644
--- a/client/src/com/vaadin/client/ui/VScrollTable.java
+++ b/client/src/com/vaadin/client/ui/VScrollTable.java
@@ -1083,11 +1083,15 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
keyboardSelectionOverRowFetchInProgress = true;
}
if (selected) {
+
if (focusedRow == null
|| !selectedRowKeys.contains(focusedRow
.getKey())) {
- // The focus is no longer on a selected row,
- // move focus to first selected row
+ /*
+ * The focus is no longer on a selected row. Move
+ * focus to the selected row. (#10522)
+ */
+
setRowFocus(row);
}
}
@@ -7258,7 +7262,14 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
// Set new focused row
focusedRow = row;
- ensureRowIsVisible(row);
+ /*
+ * Don't scroll to the focused row when in multiselect mode.
+ * (#13341)
+ */
+
+ if (isSingleSelectMode()) {
+ ensureRowIsVisible(row);
+ }
return true;
}
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java b/client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java
index bbbd355a32..3b168b636c 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java
@@ -298,6 +298,7 @@ public class DateCellDayEvent extends FocusableHTML implements
weekGrid.getCalendar().getEventResizeListener()
.eventResized(calendarEvent);
}
+ dateCell.recalculateEventWidths();
}
}
diff --git a/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java b/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java
index a72049aa90..28f6beefa6 100644
--- a/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java
+++ b/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java
@@ -144,14 +144,18 @@ public class CheckBoxConnector extends AbstractFieldConnector implements
return;
}
- getState().checked = getWidget().getValue();
-
- // Add mouse details
- MouseEventDetails details = MouseEventDetailsBuilder
- .buildMouseEventDetails(event.getNativeEvent(), getWidget()
- .getElement());
- getRpcProxy(CheckBoxServerRpc.class).setChecked(getState().checked,
- details);
-
+ // We get click events also from the label text, which do not alter the
+ // actual value. The server-side is only interested in real changes to
+ // the state.
+ if (getState().checked != getWidget().getValue()) {
+ getState().checked = getWidget().getValue();
+
+ // Add mouse details
+ MouseEventDetails details = MouseEventDetailsBuilder
+ .buildMouseEventDetails(event.getNativeEvent(), getWidget()
+ .getElement());
+ getRpcProxy(CheckBoxServerRpc.class).setChecked(getState().checked,
+ details);
+ }
}
}
diff --git a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
index c3cdb43703..78505d034c 100644
--- a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
+++ b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
@@ -24,7 +24,6 @@ import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.vaadin.client.ApplicationConnection;
import com.vaadin.client.Paintable;
import com.vaadin.client.UIDL;
-import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.AbstractFieldConnector;
import com.vaadin.client.ui.SimpleManagedLayout;
import com.vaadin.client.ui.VFilterSelect;
@@ -44,10 +43,6 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
// update textbox text by a changed item caption.
private boolean oldSuggestionTextMatchTheOldSelection;
- // Need to recompute the width of the combobox when styles change, see
- // #13444
- private boolean stylesChanged;
-
/*
* (non-Javadoc)
*
@@ -201,16 +196,11 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
getWidget().popupOpenerClicked = false;
/*
- * if styles have changed or this is our first time we need to
- * recalculate the root width.
+ * if this is our first time we need to recalculate the root width.
*/
if (!getWidget().initDone) {
- // no need to force update since we have no existing width
- getWidget().updateRootWidth(false);
- } else if (stylesChanged) {
- // we have previously calculated a width, we must force an update
- // due to changed styles
- getWidget().updateRootWidth(true);
+
+ getWidget().updateRootWidth();
}
// Focus dependent style names are lost during the update, so we add
@@ -219,9 +209,6 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
getWidget().addStyleDependentName("focus");
}
- // width has been recalculated above, clear style change flag
- stylesChanged = false;
-
getWidget().initDone = true;
}
@@ -303,8 +290,10 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
* ALWAYS set the prompting style at this point, even though we
* think it has been set already...
*/
- getWidget().prompting = false;
- getWidget().setPromptingOn();
+ getWidget().setPromptingOff("");
+ if (getWidget().enabled && !getWidget().readonly) {
+ getWidget().setPromptingOn();
+ }
} else {
// we have focus in field, prompting can't be set on, instead
// just clear the input if the value has changed from something
@@ -345,12 +334,4 @@ public class ComboBoxConnector extends AbstractFieldConnector implements
getWidget().tb.setEnabled(widgetEnabled);
}
- @Override
- public void onStateChanged(StateChangeEvent event) {
- super.onStateChanged(event);
- if (event.hasPropertyChanged("styles")) {
- stylesChanged = true;
- }
- }
-
}
diff --git a/client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java b/client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java
index 6b3bf84578..5fe637447e 100644
--- a/client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java
+++ b/client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java
@@ -23,6 +23,7 @@ import com.vaadin.client.Paintable;
import com.vaadin.client.UIDL;
import com.vaadin.client.ui.AbstractFieldConnector;
import com.vaadin.client.ui.ShortcutActionHandler.BeforeShortcutActionListener;
+import com.vaadin.client.ui.SimpleManagedLayout;
import com.vaadin.client.ui.VRichTextArea;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.Connect.LoadStyle;
@@ -31,7 +32,7 @@ import com.vaadin.ui.RichTextArea;
@Connect(value = RichTextArea.class, loadStyle = LoadStyle.LAZY)
public class RichTextAreaConnector extends AbstractFieldConnector implements
- Paintable, BeforeShortcutActionListener {
+ Paintable, BeforeShortcutActionListener, SimpleManagedLayout {
/*
* Last value received from the server
@@ -47,6 +48,15 @@ public class RichTextAreaConnector extends AbstractFieldConnector implements
flush();
}
});
+ getLayoutManager().registerDependency(this,
+ getWidget().formatter.getElement());
+ }
+
+ @Override
+ public void onUnregister() {
+ super.onUnregister();
+ getLayoutManager().unregisterDependency(this,
+ getWidget().formatter.getElement());
}
@Override
@@ -110,4 +120,19 @@ public class RichTextAreaConnector extends AbstractFieldConnector implements
}
}
}
+
+ @Override
+ public void layout() {
+ if (!isUndefinedHeight()) {
+ int rootElementInnerHeight = getLayoutManager().getInnerHeight(
+ getWidget().getElement());
+ int formatterHeight = getLayoutManager().getOuterHeight(
+ getWidget().formatter.getElement());
+ int editorHeight = rootElementInnerHeight - formatterHeight;
+ if (editorHeight < 0) {
+ editorHeight = 0;
+ }
+ getWidget().rta.setHeight(editorHeight + "px");
+ }
+ }
}
diff --git a/client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java b/client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java
index ce8b3c8fea..6bf03ad880 100644
--- a/client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java
+++ b/client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java
@@ -161,6 +161,35 @@ public abstract class AbstractSplitPanelConnector extends
getLayoutManager().setNeedsLayout(this);
getWidget().makeScrollable();
+
+ handleSingleComponentMove();
+ }
+
+ /**
+ * Handles the case when there is only one child component and that
+ * component is moved between first <-> second. This does not trigger a
+ * hierarchy change event as the list of children contains the same
+ * component in both cases.
+ */
+ private void handleSingleComponentMove() {
+ if (getChildComponents().size() == 1) {
+ Widget stateFirstChild = null;
+ Widget stateSecondChild = null;
+ if (getState().firstChild != null) {
+ stateFirstChild = ((ComponentConnector) getState().firstChild)
+ .getWidget();
+ }
+ if (getState().secondChild != null) {
+ stateSecondChild = ((ComponentConnector) getState().secondChild)
+ .getWidget();
+ }
+
+ if (stateFirstChild == getWidget().getSecondWidget()
+ || stateSecondChild == getWidget().getFirstWidget()) {
+ handleHierarchyChange();
+ }
+ }
+
}
@Override
@@ -212,6 +241,10 @@ public abstract class AbstractSplitPanelConnector extends
@Override
public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
+ handleHierarchyChange();
+ }
+
+ private void handleHierarchyChange() {
/*
* When the connector gets detached, the state isn't updated but there's
* still a hierarchy change -> verify that the child from the state is