diff options
author | Leif Åstrand <leif@vaadin.com> | 2014-12-18 18:30:09 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2014-12-18 18:30:09 +0200 |
commit | e3d0fbbab68f9ef8642a975741d9f576993b1f38 (patch) | |
tree | 5711a31c5af1d3773a86b4d25c9f8064aa435ecc /client | |
parent | 434fb5bf5cf62490686367e9193b7898077bbd44 (diff) | |
parent | 68eec666b55c42b4a55235c00bc78f6212eb2062 (diff) | |
download | vaadin-framework-e3d0fbbab68f9ef8642a975741d9f576993b1f38.tar.gz vaadin-framework-e3d0fbbab68f9ef8642a975741d9f576993b1f38.zip |
Merge remote-tracking branch 'origin/master' into grid
Change-Id: Ic7629f9cedb3c948edf4f63c678ca499e3d52805
Diffstat (limited to 'client')
21 files changed, 158 insertions, 42 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConfiguration.java b/client/src/com/vaadin/client/ApplicationConfiguration.java index 4865e38a4a..0ef37df130 100644 --- a/client/src/com/vaadin/client/ApplicationConfiguration.java +++ b/client/src/com/vaadin/client/ApplicationConfiguration.java @@ -491,6 +491,8 @@ public class ApplicationConfiguration implements EntryPoint { /** * Return Atmosphere version. * + * @since 7.4 + * * @return Atmosphere version. */ public String getAtmosphereVersion() { @@ -500,6 +502,8 @@ public class ApplicationConfiguration implements EntryPoint { /** * Return Atmosphere JS version. * + * @since 7.4 + * * @return Atmosphere JS version. */ public String getAtmosphereJSVersion() { diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index 741813f2a9..3b8b7ddc40 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -854,6 +854,7 @@ public class ApplicationConnection implements HasHandlers { * The contents of the request to send * @param retry * true when a status code 0 should be retried + * @since 7.3.7 */ protected void doUidlRequest(final String uri, final JsonObject payload, final boolean retry) { diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java index f0131f0690..783d6db36f 100644 --- a/client/src/com/vaadin/client/Util.java +++ b/client/src/com/vaadin/client/Util.java @@ -1330,6 +1330,8 @@ public class Util { /** * Gets currently focused element and checks if it's editable * + * @since 7.4 + * * @return true if focused element is editable */ public static boolean isFocusedElementEditable() { diff --git a/client/src/com/vaadin/client/VCaption.java b/client/src/com/vaadin/client/VCaption.java index becc89ce1d..eb19dedf8b 100644 --- a/client/src/com/vaadin/client/VCaption.java +++ b/client/src/com/vaadin/client/VCaption.java @@ -22,6 +22,7 @@ import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.HTML; +import com.google.gwt.user.client.ui.HasHTML; import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.ui.AbstractFieldConnector; import com.vaadin.client.ui.Icon; @@ -60,6 +61,8 @@ public class VCaption extends HTML { private TooltipInfo tooltipInfo = null; + private boolean captionAsHtml = false; + /** * Creates a caption that is not linked to a {@link ComponentConnector}. * @@ -213,7 +216,7 @@ public class VCaption extends HTML { captionText.setInnerHTML(" "); } } else { - DOM.setInnerText(captionText, c); + setCaptionText(captionText, owner.getState()); } } else if (captionText != null) { @@ -382,7 +385,11 @@ public class VCaption extends HTML { captionText.setInnerHTML(" "); } } else { - DOM.setInnerText(captionText, caption); + if (captionAsHtml) { + captionText.setInnerHTML(caption); + } else { + captionText.setInnerText(caption); + } } } else if (captionText != null) { @@ -687,4 +694,74 @@ public class VCaption extends HTML { return el.vOwnerPid; }-*/; + /** + * Sets whether the caption is rendered as HTML. + * <p> + * Default is false + * + * @param captionAsHtml + * true if the captions are rendered as HTML, false if rendered + * as plain text + */ + public void setCaptionAsHtml(boolean captionAsHtml) { + this.captionAsHtml = captionAsHtml; + } + + /** + * Checks whether captions are rendered as HTML. + * <p> + * Default is false + * + * @return true if the captions are rendered as HTML, false if rendered as + * plain text + */ + public boolean isCaptionAsHtml() { + return captionAsHtml; + } + + /** + * Sets the text of the given caption element to the caption found in the + * state. + * <p> + * Uses {@link AbstractComponentState#captionAsHtml} to determine whether to + * set the caption as html or plain text + * + * @since 7.4 + * @param captionElement + * the target element + * @param state + * the state from which to read the caption text and mode + */ + public static void setCaptionText(Element captionElement, + AbstractComponentState state) { + if (state.captionAsHtml) { + captionElement.setInnerHTML(state.caption); + } else { + captionElement.setInnerText(state.caption); + } + + } + + /** + * Sets the text of the given widget to the caption found in the state. + * <p> + * Uses {@link AbstractComponentState#captionAsHtml} to determine whether to + * set the caption as html or plain text + * + * @since 7.4 + * @param widget + * the target widget + * @param state + * the state from which to read the caption text and mode + */ + public static void setCaptionText(HasHTML widget, + AbstractComponentState state) { + if (state.captionAsHtml) { + widget.setHTML(state.caption); + } else { + widget.setText(state.caption); + } + + } + } diff --git a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java index f6f888c98b..628933fd86 100644 --- a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java +++ b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.core.client.Scheduler; import com.google.gwt.user.client.Command; +import com.google.gwt.user.client.Window.Location; import com.vaadin.client.ApplicationConfiguration; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.ApplicationConnection.CommunicationErrorHandler; @@ -147,6 +148,10 @@ public class AtmospherePushConnection implements PushConnection { this.errorHandler = errorHandler; config = createConfig(); + String debugParameter = Location.getParameter("debug"); + if ("push".equals(debugParameter)) { + config.setStringValue("logLevel", "debug"); + } for (String param : pushConfiguration.parameters.keySet()) { config.setStringValue(param, pushConfiguration.parameters.get(param)); diff --git a/client/src/com/vaadin/client/componentlocator/ComponentLocator.java b/client/src/com/vaadin/client/componentlocator/ComponentLocator.java index 52c7b57d1d..feb1c91767 100644 --- a/client/src/com/vaadin/client/componentlocator/ComponentLocator.java +++ b/client/src/com/vaadin/client/componentlocator/ComponentLocator.java @@ -121,7 +121,7 @@ public class ComponentLocator { * {@link #getPathForElement(com.google.gwt.user.client.Element)} instead. * * - * @since + * @since 7.4 * @param targetElement * The element to generate a path for. * @return A String locator that identifies the target element or null if a diff --git a/client/src/com/vaadin/client/ui/VMenuBar.java b/client/src/com/vaadin/client/ui/VMenuBar.java index 66160e691d..b5dac3f7ef 100644 --- a/client/src/com/vaadin/client/ui/VMenuBar.java +++ b/client/src/com/vaadin/client/ui/VMenuBar.java @@ -719,6 +719,7 @@ public class VMenuBar extends SimpleFocusablePanel implements * enable/disable animate-in animation when hide popup * @param animateOut * enable/disable animate-out animation when hide popup + * @since 7.3.7 */ public void hideChildren(boolean animateIn, boolean animateOut) { if (visibleChildMenu != null) { diff --git a/client/src/com/vaadin/client/ui/VOverlay.java b/client/src/com/vaadin/client/ui/VOverlay.java index 9071b6ee47..9845e89dab 100644 --- a/client/src/com/vaadin/client/ui/VOverlay.java +++ b/client/src/com/vaadin/client/ui/VOverlay.java @@ -1019,6 +1019,7 @@ public class VOverlay extends PopupPanel implements CloseHandler<PopupPanel> { * enable/disable animate-in animation * @param animateOut * enable/disable animate-out animation + * @since 7.3.7 */ public void hide(final boolean autoClosed, final boolean animateIn, final boolean animateOut) { diff --git a/client/src/com/vaadin/client/ui/VTabsheet.java b/client/src/com/vaadin/client/ui/VTabsheet.java index 090f83c066..10c9a332e0 100644 --- a/client/src/com/vaadin/client/ui/VTabsheet.java +++ b/client/src/com/vaadin/client/ui/VTabsheet.java @@ -1505,7 +1505,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware /** * Stop the command from being executed. * - * @since + * @since 7.4 */ public void stopSchedule() { blurSource = null; @@ -1514,7 +1514,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware /** * Schedule the command for a deferred execution. * - * @since + * @since 7.4 */ public void scheduleDeferred() { Scheduler.get().scheduleDeferred(this); diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java index 5c9a2ab47d..eb3c89beb0 100644 --- a/client/src/com/vaadin/client/ui/VWindow.java +++ b/client/src/com/vaadin/client/ui/VWindow.java @@ -872,7 +872,14 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } public void setCaption(String c, String iconURL) { - String html = Util.escapeHTML(c); + setCaption(c, iconURL, false); + } + + public void setCaption(String c, String iconURL, boolean asHtml) { + String html = c; + if (!asHtml) { + c = Util.escapeHTML(c); + } // Provide information to assistive device users that a sub window was // opened diff --git a/client/src/com/vaadin/client/ui/button/ButtonConnector.java b/client/src/com/vaadin/client/ui/button/ButtonConnector.java index 4220c3f5d1..2d13d62a91 100644 --- a/client/src/com/vaadin/client/ui/button/ButtonConnector.java +++ b/client/src/com/vaadin/client/ui/button/ButtonConnector.java @@ -26,6 +26,7 @@ import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.user.client.DOM; import com.vaadin.client.EventHelper; import com.vaadin.client.MouseEventDetailsBuilder; +import com.vaadin.client.VCaption; import com.vaadin.client.annotations.OnStateChange; import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.ui.AbstractComponentConnector; @@ -98,14 +99,9 @@ public class ButtonConnector extends AbstractComponentConnector implements blurHandlerRegistration); } - @OnStateChange({ "caption", "htmlContentAllowed" }) + @OnStateChange({ "caption", "captionAsHtml" }) void setCaption() { - String caption = getState().caption; - if (getState().htmlContentAllowed) { - getWidget().setHtml(caption); - } else { - getWidget().setText(caption); - } + VCaption.setCaptionText(getWidget().captionElement, getState()); } @OnStateChange("iconAltText") diff --git a/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java b/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java index 28f6beefa6..63984ff225 100644 --- a/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java +++ b/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java @@ -27,6 +27,7 @@ import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Event; import com.vaadin.client.EventHelper; import com.vaadin.client.MouseEventDetailsBuilder; +import com.vaadin.client.VCaption; import com.vaadin.client.VTooltip; import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.ui.AbstractFieldConnector; @@ -109,7 +110,8 @@ public class CheckBoxConnector extends AbstractFieldConnector implements } // Set text - getWidget().setText(getState().caption); + VCaption.setCaptionText(getWidget(), getState()); + getWidget().setValue(getState().checked); getWidget().immediate = getState().immediate; } diff --git a/client/src/com/vaadin/client/ui/colorpicker/ColorPickerAreaConnector.java b/client/src/com/vaadin/client/ui/colorpicker/ColorPickerAreaConnector.java index 2237920cb8..355e705581 100644 --- a/client/src/com/vaadin/client/ui/colorpicker/ColorPickerAreaConnector.java +++ b/client/src/com/vaadin/client/ui/colorpicker/ColorPickerAreaConnector.java @@ -18,6 +18,7 @@ package com.vaadin.client.ui.colorpicker; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.user.client.ui.Widget; +import com.vaadin.client.VCaption; import com.vaadin.client.communication.RpcProxy; import com.vaadin.client.ui.VColorPickerArea; import com.vaadin.shared.ui.Connect; @@ -55,11 +56,7 @@ public class ColorPickerAreaConnector extends AbstractColorPickerConnector { @Override protected void setCaption(String caption) { - if (getState().htmlContentAllowed) { - getWidget().setHTML(caption); - } else { - getWidget().setText(caption); - } + VCaption.setCaptionText(getWidget(), getState()); } @Override diff --git a/client/src/com/vaadin/client/ui/colorpicker/ColorPickerConnector.java b/client/src/com/vaadin/client/ui/colorpicker/ColorPickerConnector.java index 237241fe81..2f0dbd5ce7 100644 --- a/client/src/com/vaadin/client/ui/colorpicker/ColorPickerConnector.java +++ b/client/src/com/vaadin/client/ui/colorpicker/ColorPickerConnector.java @@ -55,7 +55,7 @@ public class ColorPickerConnector extends AbstractColorPickerConnector { @Override protected void setCaption(String caption) { - if (getState().htmlContentAllowed) { + if (getState().captionAsHtml) { getWidget().setHtml(caption); } else { getWidget().setText(caption); diff --git a/client/src/com/vaadin/client/ui/form/FormConnector.java b/client/src/com/vaadin/client/ui/form/FormConnector.java index 25046f8b9a..857c2bd40e 100644 --- a/client/src/com/vaadin/client/ui/form/FormConnector.java +++ b/client/src/com/vaadin/client/ui/form/FormConnector.java @@ -26,6 +26,7 @@ import com.vaadin.client.LayoutManager; import com.vaadin.client.Paintable; import com.vaadin.client.TooltipInfo; import com.vaadin.client.UIDL; +import com.vaadin.client.VCaption; import com.vaadin.client.ui.AbstractComponentContainerConnector; import com.vaadin.client.ui.ShortcutActionHandler; import com.vaadin.client.ui.VForm; @@ -102,7 +103,7 @@ public class FormConnector extends AbstractComponentContainerConnector boolean legendEmpty = true; if (getState().caption != null) { - getWidget().caption.setInnerText(getState().caption); + VCaption.setCaptionText(getWidget().caption, getState()); legendEmpty = false; } else { getWidget().caption.setInnerText(""); diff --git a/client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java b/client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java index 36262ef3d5..3102af8da9 100644 --- a/client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java @@ -185,7 +185,6 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector VCaption caption = layoutSlot.getCaption(); if (caption == null) { caption = new VCaption(childConnector, getConnection()); - Widget widget = childConnector.getWidget(); layout.setCaption(widget, caption); diff --git a/client/src/com/vaadin/client/ui/link/LinkConnector.java b/client/src/com/vaadin/client/ui/link/LinkConnector.java index 42c42cf06e..5a12445655 100644 --- a/client/src/com/vaadin/client/ui/link/LinkConnector.java +++ b/client/src/com/vaadin/client/ui/link/LinkConnector.java @@ -18,6 +18,7 @@ package com.vaadin.client.ui.link; import com.google.gwt.dom.client.Style.Display; import com.google.gwt.user.client.DOM; +import com.vaadin.client.VCaption; import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.ui.AbstractComponentConnector; import com.vaadin.client.ui.Icon; @@ -72,7 +73,7 @@ public class LinkConnector extends AbstractComponentConnector { getWidget().targetHeight = getState().targetHeight; // Set link caption - getWidget().captionElement.setInnerText(getState().caption); + VCaption.setCaptionText(getWidget().captionElement, getState()); // handle error if (null != getState().errorMessage) { diff --git a/client/src/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java b/client/src/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java index 6968f59574..2aae9beae6 100644 --- a/client/src/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java +++ b/client/src/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java @@ -22,6 +22,7 @@ import com.google.gwt.event.dom.client.FocusHandler; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.user.client.DOM; import com.vaadin.client.EventHelper; +import com.vaadin.client.VCaption; import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.ui.AbstractComponentConnector; import com.vaadin.client.ui.Icon; @@ -64,11 +65,7 @@ public class NativeButtonConnector extends AbstractComponentConnector implements blurHandlerRegistration); // Set text - if (getState().htmlContentAllowed) { - getWidget().setHTML(getState().caption); - } else { - getWidget().setText(getState().caption); - } + VCaption.setCaptionText(getWidget(), getState()); // handle error if (null != getState().errorMessage) { diff --git a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java index 0c09ae49c6..c2157650a5 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java @@ -276,7 +276,7 @@ public abstract class AbstractOrderedLayoutConnector extends } slot.setCaption(caption, icon, styles, error, showError, required, - enabled); + enabled, child.getState().captionAsHtml); AriaHelper.handleInputRequired(child.getWidget(), required); AriaHelper.handleInputInvalid(child.getWidget(), showError); diff --git a/client/src/com/vaadin/client/ui/orderedlayout/Slot.java b/client/src/com/vaadin/client/ui/orderedlayout/Slot.java index b1d7dd2804..4b60f11ab4 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/Slot.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/Slot.java @@ -440,7 +440,7 @@ public final class Slot extends SimplePanel { } /** - * Set the caption of the slot + * Set the caption of the slot as text * * @param captionText * The text of the caption @@ -459,6 +459,34 @@ public final class Slot extends SimplePanel { */ public void setCaption(String captionText, Icon icon, List<String> styles, String error, boolean showError, boolean required, boolean enabled) { + setCaption(captionText, icon, styles, error, showError, required, + enabled, false); + } + + /** + * Set the caption of the slot + * + * @param captionText + * The text of the caption + * @param icon + * The icon + * @param styles + * The style names + * @param error + * The error message + * @param showError + * Should the error message be shown + * @param required + * Is the (field) required + * @param enabled + * Is the component enabled + * @param captionAsHtml + * true if the caption should be rendered as HTML, false + * otherwise + */ + public void setCaption(String captionText, Icon icon, List<String> styles, + String error, boolean showError, boolean required, boolean enabled, + boolean captionAsHtml) { // TODO place for optimization: check if any of these have changed // since last time, and only run those changes @@ -507,7 +535,11 @@ public final class Slot extends SimplePanel { if (captionText.trim().equals("")) { this.captionText.setInnerHTML(" "); } else { - this.captionText.setInnerText(captionText); + if (captionAsHtml) { + this.captionText.setInnerHTML(captionText); + } else { + this.captionText.setInnerText(captionText); + } } } else if (this.captionText != null) { this.captionText.removeFromParent(); diff --git a/client/src/com/vaadin/client/ui/textfield/TextFieldConnector.java b/client/src/com/vaadin/client/ui/textfield/TextFieldConnector.java index cba827bcef..1a4b64b0a6 100644 --- a/client/src/com/vaadin/client/ui/textfield/TextFieldConnector.java +++ b/client/src/com/vaadin/client/ui/textfield/TextFieldConnector.java @@ -87,17 +87,10 @@ public class TextFieldConnector extends AbstractFieldConnector implements * change in the queue (in which case we count more on the server side * value). */ - - boolean valueChanged = !uidl - .getBooleanAttribute(TextFieldConstants.ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS); - // null check is not enough since the value is sometimes null but - // sometimes empty. Fix for #15144 - boolean valueBeforeEditEmpty = getWidget().valueBeforeEdit == null - || getWidget().valueBeforeEdit.isEmpty(); - boolean textDoesNotEqualOldValue = !text - .equals(getWidget().valueBeforeEdit); - - if (valueChanged || valueBeforeEditEmpty || textDoesNotEqualOldValue) { + if (!(uidl + .getBooleanAttribute(TextFieldConstants.ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS) + && getWidget().valueBeforeEdit != null && text + .equals(getWidget().valueBeforeEdit))) { getWidget().updateFieldContent(text); } |