From 8e6e071423f4c4fcfbbd9cbf442b4af13176ba58 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 28 Sep 2012 19:44:01 +0300 Subject: Publish all javadoc as an artifact and build as part of the all module (#9745) Change-Id: I2d5ce81a2b9170eb7c9b91e37d0cf39d5383457c --- all/build.xml | 4 ++-- all/ivy.xml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/all/build.xml b/all/build.xml index d8bc535bb4..8f60703be6 100644 --- a/all/build.xml +++ b/all/build.xml @@ -10,7 +10,7 @@ - + @@ -75,7 +75,7 @@ - + diff --git a/all/ivy.xml b/all/ivy.xml index aebba5ba35..103d65e812 100644 --- a/all/ivy.xml +++ b/all/ivy.xml @@ -11,6 +11,7 @@ + -- cgit v1.2.3 From 08ef970d371d2e9527d6bf5e6a5755b963aa39d2 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 28 Sep 2012 19:47:47 +0300 Subject: Added a dummy value to the parameter to make Websphere happy (#9776) Change-Id: If44a4705fe6c2d9ce381924b2d2a47de532a712c --- WebContent/VAADIN/vaadinBootstrap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebContent/VAADIN/vaadinBootstrap.js b/WebContent/VAADIN/vaadinBootstrap.js index ed798ea146..c6a7b7ed5d 100644 --- a/WebContent/VAADIN/vaadinBootstrap.js +++ b/WebContent/VAADIN/vaadinBootstrap.js @@ -100,7 +100,7 @@ url += '/'; } } - url += ((/\?/).test(url) ? "&" : "?") + "browserDetails"; + url += ((/\?/).test(url) ? "&" : "?") + "browserDetails=1"; var rootId = getConfig("rootId"); if (rootId !== undefined) { url += "&rootId=" + rootId; -- cgit v1.2.3 From a003c8724c1f719e3a9f3ab876396a180b19cae1 Mon Sep 17 00:00:00 2001 From: John Alhroos Date: Tue, 18 Sep 2012 10:11:02 +0000 Subject: Merged shortcut action fix from 6.8 (#8484) Change-Id: I1bc200afa9f4a4f3c5e469eb0b2f93278cca97a7 --- .../src/com/vaadin/client/ui/ShortcutAction.java | 108 +++++++++++++++++++++ .../vaadin/client/ui/ShortcutActionHandler.java | 76 ++++++++------- .../com/vaadin/client/ui/ShortcutActionTarget.java | 24 +++++ .../vaadin/client/ui/button/ButtonConnector.java | 20 +++- server/src/com/vaadin/event/ActionManager.java | 30 +++++- server/src/com/vaadin/event/ShortcutAction.java | 45 +++++++++ server/src/com/vaadin/ui/Button.java | 9 +- 7 files changed, 266 insertions(+), 46 deletions(-) create mode 100644 client/src/com/vaadin/client/ui/ShortcutAction.java create mode 100644 client/src/com/vaadin/client/ui/ShortcutActionTarget.java diff --git a/client/src/com/vaadin/client/ui/ShortcutAction.java b/client/src/com/vaadin/client/ui/ShortcutAction.java new file mode 100644 index 0000000000..3209c02203 --- /dev/null +++ b/client/src/com/vaadin/client/ui/ShortcutAction.java @@ -0,0 +1,108 @@ +/* + * Copyright 2011 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; + +import com.vaadin.client.ApplicationConnection; +import com.vaadin.server.KeyMapper; + +public class ShortcutAction { + + private final ShortcutKeyCombination sc; + private final String caption; + private final String key; + private String targetCID; + private String targetAction; + + /** + * Constructor + * + * @param key + * The @link {@link KeyMapper} key of the action. + * @param sc + * The key combination that triggers the action + * @param caption + * The caption of the action + */ + public ShortcutAction(String key, ShortcutKeyCombination sc, String caption) { + this(key, sc, caption, null, null); + } + + /** + * Constructor + * + * @param key + * The @link {@link KeyMapper} key of the action. + * @param sc + * The key combination that triggers the action + * @param caption + * The caption of the action + * @param targetPID + * The pid of the component the action is targeting. We use the + * pid, instead of the actual Paintable here, so we can delay the + * fetching of the Paintable in cases where the Paintable does + * not yet exist when the action is painted. + * @param targetAction + * The target string of the action. The target string is given to + * the targeted Paintable if the paintable implements the + * {@link ShortcutActionTarget} interface. + */ + public ShortcutAction(String key, ShortcutKeyCombination sc, + String caption, String targetCID, String targetAction) { + this.sc = sc; + this.key = key; + this.caption = caption; + this.targetCID = targetCID; + this.targetAction = targetAction; + } + + /** + * Get the key combination that triggers the action + */ + public ShortcutKeyCombination getShortcutCombination() { + return sc; + } + + /** + * Get the caption of the action + */ + public String getCaption() { + return caption; + } + + /** + * Get the {@link KeyMapper} key for the action + */ + public String getKey() { + return key; + } + + /** + * Get the pid of the target of the action. Use + * {@link ApplicationConnection#getPaintable(String)} to get the actual + * Paintable + */ + public String getTargetCID() { + return targetCID; + } + + /** + * Get the target string of the action + */ + public String getTargetAction() { + return targetAction; + } + +} \ No newline at end of file diff --git a/client/src/com/vaadin/client/ui/ShortcutActionHandler.java b/client/src/com/vaadin/client/ui/ShortcutActionHandler.java index 8dc0d9def7..929de7a15d 100644 --- a/client/src/com/vaadin/client/ui/ShortcutActionHandler.java +++ b/client/src/com/vaadin/client/ui/ShortcutActionHandler.java @@ -30,9 +30,11 @@ import com.google.gwt.user.client.ui.KeyboardListenerCollection; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.BrowserInfo; import com.vaadin.client.ComponentConnector; +import com.vaadin.client.ConnectorMap; import com.vaadin.client.UIDL; import com.vaadin.client.Util; import com.vaadin.client.ui.richtextarea.VRichTextArea; +import com.vaadin.shared.Connector; /** * A helper class to implement keyboard shorcut handling. Keeps a list of owners @@ -43,6 +45,15 @@ import com.vaadin.client.ui.richtextarea.VRichTextArea; */ public class ShortcutActionHandler { + public static final String ACTION_TARGET_ATTRIBUTE = "sat"; + public static final String ACTION_TARGET_ACTION_ATTRIBUTE = "sata"; + public static final String ACTION_CAPTION_ATTRIBUTE = "caption"; + public static final String ACTION_KEY_ATTRIBUTE = "key"; + public static final String ACTION_SHORTCUT_KEY_ATTRIBUTE = "kc"; + public static final String ACTION_MODIFIER_KEYS_ATTRIBUTE = "mk"; + public static final String ACTION_TARGET_VARIABLE = "actiontarget"; + public static final String ACTION_TARGET_ACTION_VARIABLE = "action"; + /** * An interface implemented by those users of this helper class that want to * support special components like {@link VRichTextArea} that don't properly @@ -108,15 +119,23 @@ public class ShortcutActionHandler { final UIDL action = (UIDL) it.next(); int[] modifiers = null; - if (action.hasAttribute("mk")) { - modifiers = action.getIntArrayAttribute("mk"); + if (action.hasAttribute(ACTION_MODIFIER_KEYS_ATTRIBUTE)) { + modifiers = action + .getIntArrayAttribute(ACTION_MODIFIER_KEYS_ATTRIBUTE); } final ShortcutKeyCombination kc = new ShortcutKeyCombination( - action.getIntAttribute("kc"), modifiers); - final String key = action.getStringAttribute("key"); - final String caption = action.getStringAttribute("caption"); - actions.add(new ShortcutAction(key, kc, caption)); + action.getIntAttribute(ACTION_SHORTCUT_KEY_ATTRIBUTE), + modifiers); + final String key = action.getStringAttribute(ACTION_KEY_ATTRIBUTE); + final String caption = action + .getStringAttribute(ACTION_CAPTION_ATTRIBUTE); + final String targetPID = action + .getStringAttribute(ACTION_TARGET_ATTRIBUTE); + final String targetAction = action + .getStringAttribute(ACTION_TARGET_ACTION_ATTRIBUTE); + actions.add(new ShortcutAction(key, kc, caption, targetPID, + targetAction)); } } @@ -171,11 +190,22 @@ public class ShortcutActionHandler { Scheduler.get().scheduleDeferred(new Command() { @Override public void execute() { - if (finalTarget != null) { - client.updateVariable(paintableId, "actiontarget", - finalTarget, false); + Connector shortcutTarget = ConnectorMap.get(client) + .getConnector(a.getTargetCID()); + + boolean handledClientSide = false; + if (shortcutTarget instanceof ShortcutActionTarget) { + handledClientSide = ((ShortcutActionTarget) shortcutTarget) + .handleAction(a); + } + if (!handledClientSide) { + if (finalTarget != null) { + client.updateVariable(paintableId, + ACTION_TARGET_VARIABLE, finalTarget, false); + } + client.updateVariable(paintableId, + ACTION_TARGET_ACTION_VARIABLE, a.getKey(), true); } - client.updateVariable(paintableId, "action", a.getKey(), true); } }); } @@ -282,29 +312,3 @@ class ShortcutKeyCombination { return false; } } - -class ShortcutAction { - - private final ShortcutKeyCombination sc; - private final String caption; - private final String key; - - public ShortcutAction(String key, ShortcutKeyCombination sc, String caption) { - this.sc = sc; - this.key = key; - this.caption = caption; - } - - public ShortcutKeyCombination getShortcutCombination() { - return sc; - } - - public String getCaption() { - return caption; - } - - public String getKey() { - return key; - } - -} diff --git a/client/src/com/vaadin/client/ui/ShortcutActionTarget.java b/client/src/com/vaadin/client/ui/ShortcutActionTarget.java new file mode 100644 index 0000000000..617334600e --- /dev/null +++ b/client/src/com/vaadin/client/ui/ShortcutActionTarget.java @@ -0,0 +1,24 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ +package com.vaadin.client.ui; + +/** + * Widgets who wish to be notificed when a shortcut action has been triggered + * with the widget as a target should implement this interface. The + * {@link #handleAction(ShortcutAction)} method will be called just before the + * action is communicated to the server + * + */ +public interface ShortcutActionTarget { + + /** + * Called by the {@link ShortcutActionHandler} just before the shortcut + * action is sent to the server side + * + * @param action + * The action which will be performed on the server side + * @return Returns true if the shortcut was handled + */ + boolean handleAction(ShortcutAction action); +} diff --git a/client/src/com/vaadin/client/ui/button/ButtonConnector.java b/client/src/com/vaadin/client/ui/button/ButtonConnector.java index b15813c99e..546bdecb61 100644 --- a/client/src/com/vaadin/client/ui/button/ButtonConnector.java +++ b/client/src/com/vaadin/client/ui/button/ButtonConnector.java @@ -33,6 +33,8 @@ import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.communication.StateChangeEvent.StateChangeHandler; import com.vaadin.client.ui.AbstractComponentConnector; import com.vaadin.client.ui.Icon; +import com.vaadin.client.ui.ShortcutAction; +import com.vaadin.client.ui.ShortcutActionTarget; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.communication.FieldRpc.FocusAndBlurServerRpc; import com.vaadin.shared.ui.Connect; @@ -43,7 +45,7 @@ import com.vaadin.ui.Button; @Connect(value = Button.class, loadStyle = LoadStyle.EAGER) public class ButtonConnector extends AbstractComponentConnector implements - BlurHandler, FocusHandler, ClickHandler { + BlurHandler, FocusHandler, ClickHandler, ShortcutActionTarget { private ButtonServerRpc rpc = RpcProxy.create(ButtonServerRpc.class, this); private FocusAndBlurServerRpc focusBlurProxy = RpcProxy.create( @@ -165,4 +167,20 @@ public class ButtonConnector extends AbstractComponentConnector implements rpc.click(details); } + + /* + * (non-Javadoc) + * + * @see + * com.vaadin.terminal.gwt.client.ui.ShortcutActionTarget#handleAction(com + * .vaadin.terminal.gwt.client.ui.ShortcutAction) + */ + public boolean handleAction(ShortcutAction action) { + if ("click".equals(action.getTargetAction())) { + getWidget().onClick(); + return true; + } + return false; + } + } diff --git a/server/src/com/vaadin/event/ActionManager.java b/server/src/com/vaadin/event/ActionManager.java index 85a1bf0f12..ad643863a7 100644 --- a/server/src/com/vaadin/event/ActionManager.java +++ b/server/src/com/vaadin/event/ActionManager.java @@ -18,6 +18,7 @@ package com.vaadin.event; import java.util.HashSet; import java.util.Map; +import com.vaadin.client.ui.ShortcutActionHandler; import com.vaadin.event.Action.Container; import com.vaadin.event.Action.Handler; import com.vaadin.server.KeyMapper; @@ -187,14 +188,29 @@ public class ActionManager implements Action.Container, Action.Handler, } if (a instanceof ShortcutAction) { final ShortcutAction sa = (ShortcutAction) a; - paintTarget.addAttribute("kc", sa.getKeyCode()); + paintTarget + .addAttribute( + ShortcutActionHandler.ACTION_SHORTCUT_KEY_ATTRIBUTE, + sa.getKeyCode()); final int[] modifiers = sa.getModifiers(); if (modifiers != null) { final String[] smodifiers = new String[modifiers.length]; for (int i = 0; i < modifiers.length; i++) { smodifiers[i] = String.valueOf(modifiers[i]); } - paintTarget.addAttribute("mk", smodifiers); + paintTarget + .addAttribute( + ShortcutActionHandler.ACTION_MODIFIER_KEYS_ATTRIBUTE, + smodifiers); + } + if (sa.getTarget() != null) { + paintTarget.addAttribute( + ShortcutActionHandler.ACTION_TARGET_ATTRIBUTE, + sa.getTarget()); + paintTarget + .addAttribute( + ShortcutActionHandler.ACTION_TARGET_ACTION_ATTRIBUTE, + sa.getTargetAction()); } } paintTarget.endTag("action"); @@ -212,10 +228,14 @@ public class ActionManager implements Action.Container, Action.Handler, } public void handleActions(Map variables, Container sender) { - if (variables.containsKey("action") && actionMapper != null) { - final String key = (String) variables.get("action"); + if (variables + .containsKey(ShortcutActionHandler.ACTION_TARGET_ACTION_VARIABLE) + && actionMapper != null) { + final String key = (String) variables + .get(ShortcutActionHandler.ACTION_TARGET_ACTION_VARIABLE); final Action action = actionMapper.get(key); - final Object target = variables.get("actiontarget"); + final Object target = variables + .get(ShortcutActionHandler.ACTION_TARGET_VARIABLE); if (action != null) { handleAction(action, sender, target); } diff --git a/server/src/com/vaadin/event/ShortcutAction.java b/server/src/com/vaadin/event/ShortcutAction.java index b1d14b15fe..9d13d41b9f 100644 --- a/server/src/com/vaadin/event/ShortcutAction.java +++ b/server/src/com/vaadin/event/ShortcutAction.java @@ -21,6 +21,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import com.vaadin.server.Resource; +import com.vaadin.ui.Component; import com.vaadin.ui.ComponentContainer; import com.vaadin.ui.Panel; import com.vaadin.ui.Window; @@ -57,6 +58,10 @@ public class ShortcutAction extends Action { private final int[] modifiers; + private Component target; + + private String targetAction; + /** * Creates a shortcut that reacts to the given {@link KeyCode} and * (optionally) {@link ModifierKey}s.
@@ -236,6 +241,46 @@ public class ShortcutAction extends Action { return modifiers; } + /** + * Set the target for the shortcut action. If the target widget on the + * client side implements {@link ShortcutActionTarget} it will be notified + * of the action before the action is communicated to the server side + * + * @param target + * The component which will be thet target of the action + */ + public void setTarget(Component target) { + this.target = target; + } + + /** + * Get the target of the shortcut action + */ + public Component getTarget() { + return target; + } + + /** + * Get the action string that is given to the {@link ShortcutActionTarget} + * on the client side + * + * @return + */ + public String getTargetAction() { + return targetAction; + } + + /** + * Set the action string that is give to the {@link ShortcutActionTarget} on + * the client side + * + * @param targetAction + * The target action string + */ + public void setTargetAction(String targetAction) { + this.targetAction = targetAction; + } + /** * Key codes that can be used for shortcuts * diff --git a/server/src/com/vaadin/ui/Button.java b/server/src/com/vaadin/ui/Button.java index 02b7689259..d248efd570 100644 --- a/server/src/com/vaadin/ui/Button.java +++ b/server/src/com/vaadin/ui/Button.java @@ -463,7 +463,6 @@ public class Button extends AbstractComponent implements * */ public static class ClickShortcut extends ShortcutListener { - protected Button button; /** * Creates a keyboard shortcut for clicking the given button using the @@ -476,7 +475,8 @@ public class Button extends AbstractComponent implements */ public ClickShortcut(Button button, String shorthandCaption) { super(shorthandCaption); - this.button = button; + setTarget(button); + setTargetAction("click"); } /** @@ -492,7 +492,8 @@ public class Button extends AbstractComponent implements */ public ClickShortcut(Button button, int keyCode, int... modifiers) { super(null, keyCode, modifiers); - this.button = button; + setTarget(button); + setTargetAction("click"); } /** @@ -510,7 +511,7 @@ public class Button extends AbstractComponent implements @Override public void handleAction(Object sender, Object target) { - button.click(); + // Action handled on the client side } } -- cgit v1.2.3 From afa50a4cb6a0ebef4ff396389daeb29d9ee7c60f Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Wed, 19 Sep 2012 15:13:55 +0000 Subject: Merged tests for initial fragment events (#9558) Fix not needed in Vaadin 7 svn changeset:24491/svn branch:6.8 Change-Id: Id78475eac42fef47a523cf1e27b2d15f1789335f --- .../ui/ChangeFragmentOnServerToMatchClient.html | 37 ++++++++++ .../tests/components/ui/FragmentChangeEvents.html | 79 ++++++++++++++++++++++ .../tests/components/ui/InitialFragmentEvent.java | 60 ++++++++++++++++ .../components/ui/InitiallyEmptyFragment.html | 47 +++++++++++++ 4 files changed, 223 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/ui/ChangeFragmentOnServerToMatchClient.html create mode 100644 uitest/src/com/vaadin/tests/components/ui/FragmentChangeEvents.html create mode 100644 uitest/src/com/vaadin/tests/components/ui/InitialFragmentEvent.java create mode 100644 uitest/src/com/vaadin/tests/components/ui/InitiallyEmptyFragment.html diff --git a/uitest/src/com/vaadin/tests/components/ui/ChangeFragmentOnServerToMatchClient.html b/uitest/src/com/vaadin/tests/components/ui/ChangeFragmentOnServerToMatchClient.html new file mode 100644 index 0000000000..8276f0fd89 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/ChangeFragmentOnServerToMatchClient.html @@ -0,0 +1,37 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.ui.InitialFragmentEvent?restartApplication#foo
assertTextvaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_0
clickvaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
assertTextvaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_0
+ + diff --git a/uitest/src/com/vaadin/tests/components/ui/FragmentChangeEvents.html b/uitest/src/com/vaadin/tests/components/ui/FragmentChangeEvents.html new file mode 100644 index 0000000000..972d3d6143 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/FragmentChangeEvents.html @@ -0,0 +1,79 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.ui.InitialFragmentEvent?restartApplication#initial
assertTextvaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_0
open/run/com.vaadin.tests.components.ui.InitialFragmentEvent#initial
assertTextvaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_0
runScriptwindow.location.hash='second'
pause500
waitForVaadin
assertTextvaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_01. Fragment changed from "no event received" to second
runScriptwindow.location.hash=''
pause500
waitForVaadin
assertTextvaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_02. Fragment changed from second to
+ + diff --git a/uitest/src/com/vaadin/tests/components/ui/InitialFragmentEvent.java b/uitest/src/com/vaadin/tests/components/ui/InitialFragmentEvent.java new file mode 100644 index 0000000000..b4a7d4e181 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/InitialFragmentEvent.java @@ -0,0 +1,60 @@ +package com.vaadin.tests.components.ui; + +import com.vaadin.server.Page.FragmentChangedEvent; +import com.vaadin.server.Page.FragmentChangedListener; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.util.Log; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; + +public class InitialFragmentEvent extends AbstractTestUI { + + private String lastKnownFragment = "\"no event received\""; + private Log log = new Log(5); + + @Override + protected void setup(VaadinRequest request) { + getPage().addFragmentChangedListener(new FragmentChangedListener() { + + public void fragmentChanged(FragmentChangedEvent source) { + String newFragment = source.getFragment(); + log.log("Fragment changed from " + lastKnownFragment + " to " + + newFragment); + lastKnownFragment = newFragment; + } + }); + addComponent(log); + addComponent(new Button("Set fragment to 'foo'", + new Button.ClickListener() { + + public void buttonClick(ClickEvent event) { + setFragment("foo"); + } + })); + addComponent(new Button("Set fragment to 'bar'", + new Button.ClickListener() { + + public void buttonClick(ClickEvent event) { + setFragment("bar"); + } + })); + } + + protected void setFragment(String fragment) { + getPage().setFragment(fragment); + } + + @Override + protected Integer getTicketNumber() { + // TODO Auto-generated method stub + return null; + } + + @Override + protected String getTestDescription() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/ui/InitiallyEmptyFragment.html b/uitest/src/com/vaadin/tests/components/ui/InitiallyEmptyFragment.html new file mode 100644 index 0000000000..933274eae6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/InitiallyEmptyFragment.html @@ -0,0 +1,47 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.ui.InitialFragmentEvent?restartApplication
assertTextvaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_0
runScriptwindow.location.hash='bar'
pause500
waitForVaadin
assertTextvaadin=runcomvaadintestscomponentsuiInitialFragmentEvent::PID_SLog_row_01. Fragment changed from "no event received" to bar
+ + -- cgit v1.2.3 From fb00d1e067cf9bb0d48a4edea1091a447b5a922c Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Wed, 19 Sep 2012 15:14:01 +0000 Subject: CRLF -> LF Change-Id: Ib1a828ac5f423de8e05c4ad7c8f399ccaf0beb78 --- .../components/label/LabelPropertySourceValue.java | 114 ++++++++++----------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/uitest/src/com/vaadin/tests/components/label/LabelPropertySourceValue.java b/uitest/src/com/vaadin/tests/components/label/LabelPropertySourceValue.java index d4ec16da4e..c1965ff92b 100644 --- a/uitest/src/com/vaadin/tests/components/label/LabelPropertySourceValue.java +++ b/uitest/src/com/vaadin/tests/components/label/LabelPropertySourceValue.java @@ -1,58 +1,58 @@ -package com.vaadin.tests.components.label; - -import com.vaadin.data.util.ObjectProperty; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.Label; - -public class LabelPropertySourceValue extends AbstractTestUI { - private Label label; - - @Override - public void setup(VaadinRequest request) { - label = new Label("Hello Vaadin user"); - addComponent(label); - Button button = new Button("Give label a new property data source..."); - button.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - ObjectProperty p = new ObjectProperty( - "This text should appear on the label after clicking the button."); - - label.setPropertyDataSource(p); - } - }); - addComponent(button); - button = new Button("Remove data source", new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - label.setPropertyDataSource(null); - } - }); - addComponent(button); - - button = new Button("Set label value to 'foo'", new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - label.setValue("foo"); - } - }); - addComponent(button); - } - - @Override - protected String getTestDescription() { - return "The value should change by clicking the button"; - } - - @Override - protected Integer getTicketNumber() { - return 9618; - } - +package com.vaadin.tests.components.label; + +import com.vaadin.data.util.ObjectProperty; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Label; + +public class LabelPropertySourceValue extends AbstractTestUI { + private Label label; + + @Override + public void setup(VaadinRequest request) { + label = new Label("Hello Vaadin user"); + addComponent(label); + Button button = new Button("Give label a new property data source..."); + button.addClickListener(new ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + ObjectProperty p = new ObjectProperty( + "This text should appear on the label after clicking the button."); + + label.setPropertyDataSource(p); + } + }); + addComponent(button); + button = new Button("Remove data source", new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + label.setPropertyDataSource(null); + } + }); + addComponent(button); + + button = new Button("Set label value to 'foo'", new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + label.setValue("foo"); + } + }); + addComponent(button); + } + + @Override + protected String getTestDescription() { + return "The value should change by clicking the button"; + } + + @Override + protected Integer getTicketNumber() { + return 9618; + } + } \ No newline at end of file -- cgit v1.2.3 From c057cf73a79e670a4d5458b03fe49c35ecd54675 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Fri, 28 Sep 2012 15:31:03 +0300 Subject: Remove VaadinServletSession (#9638) Change-Id: I0e25ba1a6d258b8601c009f6dc062b3f4bd3dbce --- .../com/vaadin/server/CommunicationManager.java | 5 +- server/src/com/vaadin/server/GAEVaadinServlet.java | 15 ++++-- server/src/com/vaadin/server/VaadinService.java | 6 ++- server/src/com/vaadin/server/VaadinServlet.java | 5 +- .../com/vaadin/server/VaadinServletService.java | 6 --- .../com/vaadin/server/VaadinServletSession.java | 57 ---------------------- .../src/com/vaadin/server/WrappedHttpSession.java | 5 ++ .../com/vaadin/server/WrappedPortletSession.java | 5 ++ server/src/com/vaadin/server/WrappedSession.java | 7 +++ .../tests/applicationcontext/ChangeSessionId.java | 15 +++--- 10 files changed, 43 insertions(+), 83 deletions(-) delete mode 100644 server/src/com/vaadin/server/VaadinServletSession.java diff --git a/server/src/com/vaadin/server/CommunicationManager.java b/server/src/com/vaadin/server/CommunicationManager.java index f876e748f8..5f61079261 100644 --- a/server/src/com/vaadin/server/CommunicationManager.java +++ b/server/src/com/vaadin/server/CommunicationManager.java @@ -110,8 +110,9 @@ public class CommunicationManager extends AbstractCommunicationManager { @Override protected InputStream getThemeResourceAsStream(UI uI, String themeName, String resource) { - VaadinServletSession session = (VaadinServletSession) uI.getSession(); - ServletContext servletContext = session.getHttpSession() + VaadinServletService service = (VaadinServletService) uI.getSession() + .getService(); + ServletContext servletContext = service.getServlet() .getServletContext(); return servletContext.getResourceAsStream("/" + VaadinServlet.THEME_DIRECTORY_PATH + themeName + "/" diff --git a/server/src/com/vaadin/server/GAEVaadinServlet.java b/server/src/com/vaadin/server/GAEVaadinServlet.java index 6c9c1882ea..c68f25a282 100644 --- a/server/src/com/vaadin/server/GAEVaadinServlet.java +++ b/server/src/com/vaadin/server/GAEVaadinServlet.java @@ -361,11 +361,18 @@ public class GAEVaadinServlet extends VaadinServlet { * * @param request */ - private void cleanSession(HttpServletRequest request) { - HttpSession session = request.getSession(false); - if (session != null) { - session.removeAttribute(VaadinServletSession.class.getName()); + private void cleanSession(VaadinServletRequest request) { + // Should really be replaced with a session storage API... + WrappedSession wrappedSession = request.getWrappedSession(false); + if (wrappedSession == null) { + return; + } + VaadinServiceSession serviceSession = VaadinServiceSession + .getForSession(getService(), wrappedSession); + if (serviceSession == null) { + return; } + serviceSession.removeFromSession(getService()); } /** diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java index add32bf57b..c56d6caeb5 100644 --- a/server/src/com/vaadin/server/VaadinService.java +++ b/server/src/com/vaadin/server/VaadinService.java @@ -437,8 +437,10 @@ public abstract class VaadinService implements Serializable { * @throws ServletException * @throws MalformedURLException */ - protected abstract VaadinServiceSession createVaadinSession( - VaadinRequest request) throws ServiceException; + protected VaadinServiceSession createVaadinSession(VaadinRequest request) + throws ServiceException { + return new VaadinServiceSession(this); + } private void onVaadinSessionStarted(VaadinRequest request, VaadinServiceSession session) throws ServiceException { diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index 7f664be6fb..e73be682c2 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -232,7 +232,7 @@ public class VaadinServlet extends HttpServlet implements Constants { return; } - VaadinServletSession vaadinSession = null; + VaadinServiceSession vaadinSession = null; try { // If a duplicate "close application" URL is received for an @@ -254,8 +254,7 @@ public class VaadinServlet extends HttpServlet implements Constants { } // Find out the service session this request is related to - vaadinSession = (VaadinServletSession) getService() - .findVaadinSession(request); + vaadinSession = getService().findVaadinSession(request); if (vaadinSession == null) { return; } diff --git a/server/src/com/vaadin/server/VaadinServletService.java b/server/src/com/vaadin/server/VaadinServletService.java index ca894b8a4f..d746ee2303 100644 --- a/server/src/com/vaadin/server/VaadinServletService.java +++ b/server/src/com/vaadin/server/VaadinServletService.java @@ -185,12 +185,6 @@ public class VaadinServletService extends VaadinService { return (VaadinServletResponse) VaadinService.getCurrentResponse(); } - @Override - protected VaadinServiceSession createVaadinSession(VaadinRequest request) - throws ServiceException { - return new VaadinServletSession(this); - } - @Override public String getServiceName() { return getServlet().getServletName(); diff --git a/server/src/com/vaadin/server/VaadinServletSession.java b/server/src/com/vaadin/server/VaadinServletSession.java deleted file mode 100644 index aa31a19c1b..0000000000 --- a/server/src/com/vaadin/server/VaadinServletSession.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2011 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.server; - -import javax.servlet.http.HttpSession; -import javax.servlet.http.HttpSessionBindingListener; - -/** - * Web application context for Vaadin applications. - * - * This is automatically added as a {@link HttpSessionBindingListener} when - * added to a {@link HttpSession}. - * - * @author Vaadin Ltd. - * @since 3.1 - * - * @deprecated might be refactored or removed before 7.0.0 - */ -@Deprecated -@SuppressWarnings("serial") -public class VaadinServletSession extends VaadinServiceSession { - - /** - * Create a servlet service session for the given servlet service - * - * @param service - * the servlet service to which the new session belongs - */ - public VaadinServletSession(VaadinServletService service) { - super(service); - } - - /** - * Gets the http-session application is running in. - * - * @return HttpSession this application context resides in. - */ - public HttpSession getHttpSession() { - WrappedSession session = getSession(); - return ((WrappedHttpSession) session).getHttpSession(); - } - -} diff --git a/server/src/com/vaadin/server/WrappedHttpSession.java b/server/src/com/vaadin/server/WrappedHttpSession.java index e13a63635b..65db010ba9 100644 --- a/server/src/com/vaadin/server/WrappedHttpSession.java +++ b/server/src/com/vaadin/server/WrappedHttpSession.java @@ -88,4 +88,9 @@ public class WrappedHttpSession implements WrappedSession { session.invalidate(); } + @Override + public String getId() { + return session.getId(); + } + } diff --git a/server/src/com/vaadin/server/WrappedPortletSession.java b/server/src/com/vaadin/server/WrappedPortletSession.java index 03c1d7ba1f..f4a6003ed5 100644 --- a/server/src/com/vaadin/server/WrappedPortletSession.java +++ b/server/src/com/vaadin/server/WrappedPortletSession.java @@ -74,4 +74,9 @@ public class WrappedPortletSession implements WrappedSession { public void invalidate() { session.invalidate(); } + + @Override + public String getId() { + return session.getId(); + } } diff --git a/server/src/com/vaadin/server/WrappedSession.java b/server/src/com/vaadin/server/WrappedSession.java index 34443239c7..cf0b1a2fbd 100644 --- a/server/src/com/vaadin/server/WrappedSession.java +++ b/server/src/com/vaadin/server/WrappedSession.java @@ -86,4 +86,11 @@ public interface WrappedSession { * @see PortletSession#invalidate() */ public void invalidate(); + + /** + * Gets a string with a unique identifier for the session. + * + * @return a unique session id string + */ + public String getId(); } diff --git a/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java b/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java index 4495b343d0..fa0f13e172 100644 --- a/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java +++ b/uitest/src/com/vaadin/tests/applicationcontext/ChangeSessionId.java @@ -1,7 +1,6 @@ package com.vaadin.tests.applicationcontext; import com.vaadin.server.VaadinService; -import com.vaadin.server.VaadinServletSession; import com.vaadin.tests.components.AbstractTestCase; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; @@ -30,15 +29,13 @@ public class ChangeSessionId extends AbstractTestCase { })); setMainWindow(mainWindow); - loginButton.addListener(new ClickListener() { + loginButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { - VaadinServletSession context = ((VaadinServletSession) getContext()); - - String oldSessionId = context.getHttpSession().getId(); - context.getService().reinitializeSession( - VaadinService.getCurrentRequest()); - String newSessionId = context.getHttpSession().getId(); + String oldSessionId = getSessionId(); + VaadinService.reinitializeSession(VaadinService + .getCurrentRequest()); + String newSessionId = getSessionId(); if (oldSessionId.equals(newSessionId)) { log.log("FAILED! Both old and new session id is " + newSessionId); @@ -57,7 +54,7 @@ public class ChangeSessionId extends AbstractTestCase { } protected String getSessionId() { - return ((VaadinServletSession) getContext()).getHttpSession().getId(); + return getContext().getSession().getId(); } @Override -- cgit v1.2.3 From 72ea54d8fa00ea17f462541584d51098929da895 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Mon, 1 Oct 2012 11:59:53 +0300 Subject: Remove unused method (#9634) Change-Id: Iad6f920d345832ec6bec49761a31ceb7290679e9 --- server/src/com/vaadin/server/VaadinServlet.java | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index e73be682c2..9d1d79d8b1 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -1172,26 +1172,6 @@ public class VaadinServlet extends HttpServlet implements Constants { return request.getPathInfo(); } - /** - * Gets relative location of a theme resource. - * - * @param theme - * the Theme name. - * @param resource - * the Theme resource. - * @return External URI specifying the resource - * - * @deprecated might be refactored or removed before 7.0.0 - */ - @Deprecated - public String getResourceLocation(String theme, ThemeResource resource) { - - if (resourcePath == null) { - return resource.getResourceId(); - } - return resourcePath + theme + "/" + resource.getResourceId(); - } - public class RequestError implements Terminal.ErrorEvent, Serializable { private final Throwable throwable; -- cgit v1.2.3 From d371ac4a4e3f7f29f5a17f16c4134062c280115e Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 28 Sep 2012 20:47:34 +0300 Subject: Avoid adding RpcInvocationHandler toString as invocations (#9802) Change-Id: If6f378c0942132110adc748bd2c1cf87779924b6 --- .../com/vaadin/server/AbstractClientConnector.java | 5 ++ .../ui/RpcInvocationHandlerToString.html | 51 +++++++++++++++ .../ui/RpcInvocationHandlerToString.java | 74 ++++++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.html create mode 100644 uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.java diff --git a/server/src/com/vaadin/server/AbstractClientConnector.java b/server/src/com/vaadin/server/AbstractClientConnector.java index eb59cbe5fc..1f0d3049b5 100644 --- a/server/src/com/vaadin/server/AbstractClientConnector.java +++ b/server/src/com/vaadin/server/AbstractClientConnector.java @@ -290,6 +290,11 @@ public abstract class AbstractClientConnector implements ClientConnector { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + if (method.getDeclaringClass() == Object.class) { + // Don't add Object methods such as toString and hashCode as + // invocations + return method.invoke(this, args); + } addMethodInvocationToQueue(rpcInterfaceName, method, args); return null; } diff --git a/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.html b/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.html new file mode 100644 index 0000000000..c9d5aa303d --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.html @@ -0,0 +1,51 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.ui.RpcInvocationHandlerToString?restartApplication
clickvaadin=runcomvaadintestscomponentsuiRpcInvocationHandlerToString::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]
assertElementNotPresentvaadin=runcomvaadintestscomponentsuiRpcInvocationHandlerToString::Root/VNotification[0]/HTML[0]
clickvaadin=runcomvaadintestscomponentsuiRpcInvocationHandlerToString::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VButton[0]/domChild[0]/domChild[0]
assertElementNotPresentvaadin=runcomvaadintestscomponentsuiRpcInvocationHandlerToString::Root/VNotification[0]/HTML[0]
clickvaadin=runcomvaadintestscomponentsuiRpcInvocationHandlerToString::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VButton[0]/domChild[0]/domChild[0]
assertElementNotPresentvaadin=runcomvaadintestscomponentsuiRpcInvocationHandlerToString::Root/VNotification[0]/HTML[0]
+ + diff --git a/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.java b/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.java new file mode 100644 index 0000000000..38f971f840 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/RpcInvocationHandlerToString.java @@ -0,0 +1,74 @@ +/* + * Copyright 2011 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.tests.components.ui; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.ui.PageClientRpc; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.tests.util.Log; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; + +public class RpcInvocationHandlerToString extends AbstractTestUI { + + private Log log = new Log(5); + PageClientRpc dummyProxy = getRpcProxy(PageClientRpc.class); + + @Override + protected void setup(VaadinRequest request) { + addComponent(log); + Button b = new Button("Exec toString() for an invocation proxy", + new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + log.log("An invoation proxy: " + dummyProxy.toString()); + } + }); + addComponent(b); + b = new Button("Exec hashCode() for an invocation proxy", + new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + log.log("Invocation proxy.hashCode(): " + + dummyProxy.hashCode()); + } + }); + addComponent(b); + b = new Button("Exec equals(false) for an invocation proxy", + new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + log.log("Invocation proxy.equals(false): " + + dummyProxy.equals(false)); + } + }); + addComponent(b); + } + + @Override + protected String getTestDescription() { + return "Clicking on the buttons invokes Object methods on a dummy proxy instance. They should only cause log rows to appear and no client rpc to be sent"; + } + + @Override + protected Integer getTicketNumber() { + return 9802; + } + +} -- cgit v1.2.3 From 110105726fc186dfec121f0a5b184d3523431d0b Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Mon, 1 Oct 2012 14:06:43 +0300 Subject: Merge from 6.8: Limit propagation of vertical spacing and margins in nested FormLayouts, related test (#9427) svn changeset:24503/svn branch:6.8 svn changeset:24504/svn branch:6.8 svn changeset:24506/svn branch:6.8 Change-Id: I7eca0fccdd9fc9258514c68025bd9e99dcc0b89d --- .../VAADIN/themes/base/formlayout/formlayout.scss | 28 ++--- .../themes/reindeer/formlayout/formlayout.scss | 22 ++-- .../VAADIN/themes/runo/formlayout/formlayout.scss | 22 ++-- .../components/formlayout/NestedFormLayouts.html | 56 ++++++++++ .../components/formlayout/NestedFormLayouts.java | 117 +++++++++++++++++++++ 5 files changed, 209 insertions(+), 36 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/components/formlayout/NestedFormLayouts.html create mode 100644 uitest/src/com/vaadin/tests/components/formlayout/NestedFormLayouts.java diff --git a/WebContent/VAADIN/themes/base/formlayout/formlayout.scss b/WebContent/VAADIN/themes/base/formlayout/formlayout.scss index a45840ebab..258a8e3f15 100644 --- a/WebContent/VAADIN/themes/base/formlayout/formlayout.scss +++ b/WebContent/VAADIN/themes/base/formlayout/formlayout.scss @@ -23,30 +23,30 @@ .v-formlayout-captioncell .v-caption { overflow: visible; } -.v-formlayout-spacing .v-formlayout-row .v-formlayout-captioncell, -.v-formlayout-spacing .v-formlayout-row .v-formlayout-contentcell, -.v-formlayout-spacing .v-formlayout-row .v-formlayout-errorcell { +.v-formlayout-spacing > tbody > .v-formlayout-row > .v-formlayout-captioncell, +.v-formlayout-spacing > tbody > .v-formlayout-row > .v-formlayout-contentcell, +.v-formlayout-spacing > tbody > .v-formlayout-row > .v-formlayout-errorcell { padding-top: 6px; } -.v-formlayout-spacing .v-formlayout-firstrow .v-formlayout-captioncell, -.v-formlayout-spacing .v-formlayout-firstrow .v-formlayout-contentcell, -.v-formlayout-spacing .v-formlayout-firstrow .v-formlayout-errorcell { +.v-formlayout-spacing > tbody > .v-formlayout-firstrow > .v-formlayout-captioncell, +.v-formlayout-spacing > tbody > .v-formlayout-firstrow > .v-formlayout-contentcell, +.v-formlayout-spacing > tbody > .v-formlayout-firstrow > .v-formlayout-errorcell { padding-top: 0; } -.v-formlayout-margin-top .v-formlayout-firstrow .v-formlayout-captioncell, -.v-formlayout-margin-top .v-formlayout-firstrow .v-formlayout-contentcell, -.v-formlayout-margin-top .v-formlayout-firstrow .v-formlayout-errorcell { +.v-formlayout-margin-top > tbody > .v-formlayout-firstrow > .v-formlayout-captioncell, +.v-formlayout-margin-top > tbody > .v-formlayout-firstrow > .v-formlayout-contentcell, +.v-formlayout-margin-top > tbody > .v-formlayout-firstrow > .v-formlayout-errorcell { padding-top: 12px; } -.v-formlayout-margin-bottom .v-formlayout-lastrow .v-formlayout-captioncell, -.v-formlayout-margin-bottom .v-formlayout-lastrow .v-formlayout-contentcell, -.v-formlayout-margin-bottom .v-formlayout-lastrow .v-formlayout-errorcell { +.v-formlayout-margin-bottom > tbody > .v-formlayout-lastrow > .v-formlayout-captioncell, +.v-formlayout-margin-bottom > tbody > .v-formlayout-lastrow > .v-formlayout-contentcell, +.v-formlayout-margin-bottom > tbody > .v-formlayout-lastrow > .v-formlayout-errorcell { padding-bottom: 12px; } -.v-formlayout-margin-left .v-formlayout-captioncell { +.v-formlayout-margin-left > tbody > .v-formlayout-row > .v-formlayout-captioncell { padding-left: 12px; } -.v-formlayout-margin-right .v-formlayout-contentcell { +.v-formlayout-margin-right > tbody > .v-formlayout-row > .v-formlayout-contentcell { padding-right: 12px; } .v-formlayout-captioncell .v-caption .v-required-field-indicator { diff --git a/WebContent/VAADIN/themes/reindeer/formlayout/formlayout.scss b/WebContent/VAADIN/themes/reindeer/formlayout/formlayout.scss index ab47767dcf..e73340fd3b 100644 --- a/WebContent/VAADIN/themes/reindeer/formlayout/formlayout.scss +++ b/WebContent/VAADIN/themes/reindeer/formlayout/formlayout.scss @@ -12,25 +12,25 @@ text-align: right; white-space: nowrap; } -.v-formlayout-spacing .v-formlayout-row .v-formlayout-captioncell, -.v-formlayout-spacing .v-formlayout-row .v-formlayout-contentcell, -.v-formlayout-spacing .v-formlayout-row .v-formlayout-errorcell { +.v-formlayout-spacing > tbody > .v-formlayout-row > .v-formlayout-captioncell, +.v-formlayout-spacing > tbody > .v-formlayout-row > .v-formlayout-contentcell, +.v-formlayout-spacing > tbody > .v-formlayout-row > .v-formlayout-errorcell { padding-top: 8px; } -.v-formlayout-margin-top .v-formlayout-firstrow .v-formlayout-captioncell, -.v-formlayout-margin-top .v-formlayout-firstrow .v-formlayout-contentcell, -.v-formlayout-margin-top .v-formlayout-firstrow .v-formlayout-errorcell { +.v-formlayout-margin-top > tbody > .v-formlayout-firstrow > .v-formlayout-captioncell, +.v-formlayout-margin-top > tbody > .v-formlayout-firstrow > .v-formlayout-contentcell, +.v-formlayout-margin-top > tbody > .v-formlayout-firstrow > .v-formlayout-errorcell { padding-top: 15px; } -.v-formlayout-margin-bottom .v-formlayout-lastrow .v-formlayout-captioncell, -.v-formlayout-margin-bottom .v-formlayout-lastrow .v-formlayout-contentcell, -.v-formlayout-margin-bottom .v-formlayout-lastrow .v-formlayout-errorcell { +.v-formlayout-margin-bottom > tbody > .v-formlayout-lastrow > .v-formlayout-captioncell, +.v-formlayout-margin-bottom > tbody > .v-formlayout-lastrow > .v-formlayout-contentcell, +.v-formlayout-margin-bottom > tbody > .v-formlayout-lastrow > .v-formlayout-errorcell { padding-bottom: 15px; } -.v-formlayout-margin-left .v-formlayout-captioncell { +.v-formlayout-margin-left > tbody > .v-formlayout-row > .v-formlayout-captioncell { padding-left: 18px; } -.v-formlayout-margin-right .v-formlayout-contentcell { +.v-formlayout-margin-right > tbody > .v-formlayout-row > .v-formlayout-contentcell { padding-right: 18px; } /* form */ diff --git a/WebContent/VAADIN/themes/runo/formlayout/formlayout.scss b/WebContent/VAADIN/themes/runo/formlayout/formlayout.scss index 0766269d8b..bb27da1d5b 100644 --- a/WebContent/VAADIN/themes/runo/formlayout/formlayout.scss +++ b/WebContent/VAADIN/themes/runo/formlayout/formlayout.scss @@ -9,25 +9,25 @@ text-align:right; white-space: nowrap; } -.v-formlayout-spacing .v-formlayout-row .v-formlayout-captioncell, -.v-formlayout-spacing .v-formlayout-row .v-formlayout-contentcell, -.v-formlayout-spacing .v-formlayout-row .v-formlayout-errorcell { +.v-formlayout-spacing > tbody > .v-formlayout-row > .v-formlayout-captioncell, +.v-formlayout-spacing > tbody > .v-formlayout-row > .v-formlayout-contentcell, +.v-formlayout-spacing > tbody > .v-formlayout-row > .v-formlayout-errorcell { padding-top: 8px; } -.v-formlayout-margin-top .v-formlayout-firstrow .v-formlayout-captioncell, -.v-formlayout-margin-top .v-formlayout-firstrow .v-formlayout-contentcell, -.v-formlayout-margin-top .v-formlayout-firstrow .v-formlayout-errorcell { +.v-formlayout-margin-top > tbody > .v-formlayout-firstrow > .v-formlayout-captioncell, +.v-formlayout-margin-top > tbody > .v-formlayout-firstrow > .v-formlayout-contentcell, +.v-formlayout-margin-top > tbody > .v-formlayout-firstrow > .v-formlayout-errorcell { padding-top: 15px; } -.v-formlayout-margin-bottom .v-formlayout-lastrow .v-formlayout-captioncell, -.v-formlayout-margin-bottom .v-formlayout-lastrow .v-formlayout-contentcell, -.v-formlayout-margin-bottom .v-formlayout-lastrow .v-formlayout-errorcell { +.v-formlayout-margin-bottom > tbody > .v-formlayout-lastrow > .v-formlayout-captioncell, +.v-formlayout-margin-bottom > tbody > .v-formlayout-lastrow > .v-formlayout-contentcell, +.v-formlayout-margin-bottom > tbody > .v-formlayout-lastrow > .v-formlayout-errorcell { padding-bottom: 15px; } -.v-formlayout-margin-left .v-formlayout-captioncell { +.v-formlayout-margin-left > tbody > .v-formlayout-row > .v-formlayout-captioncell { padding-left: 18px; } -.v-formlayout-margin-right .v-formlayout-contentcell { +.v-formlayout-margin-right > tbody > .v-formlayout-row > .v-formlayout-contentcell { padding-right: 18px; } /* form */ diff --git a/uitest/src/com/vaadin/tests/components/formlayout/NestedFormLayouts.html b/uitest/src/com/vaadin/tests/components/formlayout/NestedFormLayouts.html new file mode 100644 index 0000000000..a95aecac80 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/formlayout/NestedFormLayouts.html @@ -0,0 +1,56 @@ + + + + + + +NestedFormLayouts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NestedFormLayouts
open/run/com.vaadin.tests.components.formlayout.NestedFormLayouts?restartApplication
screenCaptureinitial
mouseClickvaadin=runcomvaadintestscomponentsformlayoutNestedFormLayouts::PID_Sspacings/domChild[0]8,8
screenCapturespacings
mouseClickvaadin=runcomvaadintestscomponentsformlayoutNestedFormLayouts::PID_Smargins/domChild[0]5,4
screenCapturespacings_margins
mouseClickvaadin=runcomvaadintestscomponentsformlayoutNestedFormLayouts::PID_Sspacings/domChild[0]8,5
screenCapturemargins
+ + diff --git a/uitest/src/com/vaadin/tests/components/formlayout/NestedFormLayouts.java b/uitest/src/com/vaadin/tests/components/formlayout/NestedFormLayouts.java new file mode 100644 index 0000000000..147f2dcec7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/formlayout/NestedFormLayouts.java @@ -0,0 +1,117 @@ +package com.vaadin.tests.components.formlayout; + +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.FormLayout; +import com.vaadin.ui.Label; + +public class NestedFormLayouts extends AbstractTestUI { + + private FormLayout outer; + private FormLayout inner1; + private FormLayout inner2; + private FormLayout inner21; + private FormLayout inner3; + private FormLayout inner31; + private FormLayout inner4; + + @Override + protected void setup(VaadinRequest request) { + outer = new FormLayout(); + outer.setSizeUndefined(); + outer.setWidth("100%"); + + inner1 = new FormLayout(); + inner1.addComponent(new Label("Test")); + inner1.addComponent(new Label("Test2")); + outer.addComponent(inner1); + + outer.addComponent(new Label("Test")); + outer.addComponent(new Label("Test2")); + + inner2 = new FormLayout(); + inner2.addComponent(new Label("Test")); + inner2.addComponent(new Label("Test2")); + inner21 = new FormLayout(); + inner21.addComponent(new Label("Test")); + inner21.addComponent(new Label("Test2")); + inner2.addComponent(inner21); + outer.addComponent(inner2); + + inner3 = new FormLayout(); + inner3.addComponent(new Label("Test")); + inner3.addComponent(new Label("Test2")); + // this layout never gets spacing or margin + inner31 = new FormLayout(); + inner31.addComponent(new Label("Test")); + inner31.addComponent(new Label("Test2")); + inner31.setSpacing(false); + inner31.setMargin(false); + inner3.addComponent(inner31); + outer.addComponent(inner3); + + inner4 = new FormLayout(); + inner4.addComponent(new Label("Test")); + inner4.addComponent(new Label("Test2")); + outer.addComponent(inner4); + + addComponent(outer); + + final CheckBox spacingCheckBox = new CheckBox("Spacings", false); + spacingCheckBox.setId("spacings"); + spacingCheckBox.setImmediate(true); + spacingCheckBox.addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + setLayoutSpacing(spacingCheckBox.getValue()); + } + }); + addComponent(spacingCheckBox); + + final CheckBox marginCheckBox = new CheckBox("Margins", false); + marginCheckBox.setId("margins"); + marginCheckBox.setImmediate(true); + marginCheckBox.addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + setLayoutMargin(marginCheckBox.getValue()); + } + }); + addComponent(marginCheckBox); + + setLayoutSpacing(false); + setLayoutMargin(false); + } + + private void setLayoutSpacing(boolean value) { + outer.setSpacing(value); + inner1.setSpacing(value); + inner2.setSpacing(value); + inner21.setSpacing(value); + inner3.setSpacing(value); + inner4.setSpacing(value); + } + + private void setLayoutMargin(boolean value) { + outer.setMargin(value); + inner1.setMargin(value); + inner2.setMargin(value); + inner21.setMargin(value); + inner3.setMargin(value); + inner4.setMargin(value); + } + + @Override + protected String getTestDescription() { + return "Excess padding applied in FormLayouts nested as first or last rows in a FormLayout"; + } + + @Override + protected Integer getTicketNumber() { + return 9427; + } + +} -- cgit v1.2.3 From 0e3b55601457da2d5bc9edb85d2de701409aeb5c Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 1 Oct 2012 14:08:33 +0300 Subject: Avoid throwing exceptions from toString, log message instead (#9804) Change-Id: Ia2f8504a0fe75ab3a7c4746d533e5fd012e2a69c --- server/src/com/vaadin/data/util/AbstractProperty.java | 18 +++++++++++++++--- server/src/com/vaadin/data/util/IndexedContainer.java | 18 ++++++++++++++++-- .../vaadin/data/util/sqlcontainer/ColumnProperty.java | 18 ++++++++++++++++-- 3 files changed, 47 insertions(+), 7 deletions(-) diff --git a/server/src/com/vaadin/data/util/AbstractProperty.java b/server/src/com/vaadin/data/util/AbstractProperty.java index 76d47039d0..aefe00ad32 100644 --- a/server/src/com/vaadin/data/util/AbstractProperty.java +++ b/server/src/com/vaadin/data/util/AbstractProperty.java @@ -18,6 +18,7 @@ package com.vaadin.data.util; import java.util.Collection; import java.util.Collections; import java.util.LinkedList; +import java.util.logging.Logger; import com.vaadin.data.Property; @@ -78,9 +79,17 @@ public abstract class AbstractProperty implements Property, @Deprecated @Override public String toString() { - throw new UnsupportedOperationException( - "Use Property.getValue() instead of " + getClass() - + ".toString()"); + getLogger() + .warning( + "You are using Property.toString() instead of getValue() to get the value for a " + + getClass().getSimpleName() + + ". This will not be supported starting from Vaadin 7.1 " + + "(your debugger might call toString() and cause this message to appear)."); + T v = getValue(); + if (v == null) { + return null; + } + return v.toString(); } /* Events */ @@ -277,4 +286,7 @@ public abstract class AbstractProperty implements Property, return Collections.EMPTY_LIST; } + private static Logger getLogger() { + return Logger.getLogger(AbstractProperty.class.getName()); + } } diff --git a/server/src/com/vaadin/data/util/IndexedContainer.java b/server/src/com/vaadin/data/util/IndexedContainer.java index e957d958a9..7273b28b66 100644 --- a/server/src/com/vaadin/data/util/IndexedContainer.java +++ b/server/src/com/vaadin/data/util/IndexedContainer.java @@ -28,6 +28,7 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.logging.Logger; import com.vaadin.data.Container; import com.vaadin.data.Item; @@ -961,8 +962,21 @@ public class IndexedContainer extends @Deprecated @Override public String toString() { - throw new UnsupportedOperationException( - "Use Property.getValue() instead of IndexedContainerProperty.toString()"); + getLogger() + .warning( + "You are using IndexedContainerProperty.toString() instead of getValue() to get the value for a " + + getClass().getSimpleName() + + ". This will not be supported starting from Vaadin 7.1 " + + "(your debugger might call toString() and cause this message to appear)."); + Object v = getValue(); + if (v == null) { + return null; + } + return v.toString(); + } + + private Logger getLogger() { + return Logger.getLogger(IndexedContainerProperty.class.getName()); } /** diff --git a/server/src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java b/server/src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java index 6e5ba0dc57..bd6b1a75bf 100644 --- a/server/src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java +++ b/server/src/com/vaadin/data/util/sqlcontainer/ColumnProperty.java @@ -18,6 +18,7 @@ package com.vaadin.data.util.sqlcontainer; import java.sql.Date; import java.sql.Time; import java.sql.Timestamp; +import java.util.logging.Logger; import com.vaadin.data.Property; import com.vaadin.data.util.converter.Converter.ConversionException; @@ -261,8 +262,21 @@ final public class ColumnProperty implements Property { @Deprecated @Override public String toString() { - throw new UnsupportedOperationException( - "Use ColumnProperty.getValue() instead of ColumnProperty.toString()"); + getLogger() + .warning( + "You are using ColumnProperty.toString() instead of getValue() to get the value for a " + + getClass().getSimpleName() + + ". This will not be supported starting from Vaadin 7.1 " + + "(your debugger might call toString() and cause this message to appear)."); + Object v = getValue(); + if (v == null) { + return null; + } + return v.toString(); + } + + private static Logger getLogger() { + return Logger.getLogger(ColumnProperty.class.getName()); } public void setOwner(RowItem owner) { -- cgit v1.2.3 From 7c831549c836ec32623ce248b81cd62f67bf0eff Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 1 Oct 2012 15:32:42 +0300 Subject: Fixed typo in method name Change-Id: I6c8e7afc24d3c9e365c99d3bc6af26fbb1eb97a9 --- .../orderedlayout/AbstractOrderedLayoutConnector.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java index 15407a16f4..e0863512b4 100644 --- a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java +++ b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java @@ -115,7 +115,7 @@ public abstract class AbstractOrderedLayoutConnector extends if (captionElement == widgetElement) { // Caption element already detached - rmeoveResizeListener(captionElement, slotCaptionResizeListener); + removeResizeListener(captionElement, slotCaptionResizeListener); childCaptionElementHeight.remove(widgetElement); return; } @@ -460,14 +460,14 @@ public abstract class AbstractOrderedLayoutConnector extends Slot slot = getWidget().getSlot(child.getWidget()); // Clear all possible listeners first - rmeoveResizeListener(slot.getWidget().getElement(), + removeResizeListener(slot.getWidget().getElement(), childComponentResizeListener); if (slot.hasCaption()) { - rmeoveResizeListener(slot.getCaptionElement(), + removeResizeListener(slot.getCaptionElement(), slotCaptionResizeListener); } if (slot.hasSpacing()) { - rmeoveResizeListener(slot.getSpacingElement(), + removeResizeListener(slot.getSpacingElement(), spacingResizeListener); } @@ -579,16 +579,16 @@ public abstract class AbstractOrderedLayoutConnector extends for (ComponentConnector child : getChildComponents()) { Slot slot = getWidget().getSlot(child.getWidget()); if (slot.hasCaption()) { - rmeoveResizeListener(slot.getCaptionElement(), + removeResizeListener(slot.getCaptionElement(), slotCaptionResizeListener); } if (slot.getSpacingElement() != null) { - rmeoveResizeListener(slot.getSpacingElement(), + removeResizeListener(slot.getSpacingElement(), spacingResizeListener); } - rmeoveResizeListener(slot.getWidget().getElement(), + removeResizeListener(slot.getWidget().getElement(), childComponentResizeListener); } @@ -613,9 +613,9 @@ public abstract class AbstractOrderedLayoutConnector extends * @param el * The element from where the resize listener should be removed * @param listener - * THe listener to remove + * The listener to remove */ - private void rmeoveResizeListener(Element el, ElementResizeListener listener) { + private void removeResizeListener(Element el, ElementResizeListener listener) { getLayoutManager().removeElementResizeListener(el, listener); } -- cgit v1.2.3 From 6da74b9512c50ffe736160d697913552c70172ef Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 1 Oct 2012 18:53:43 +0300 Subject: Moved ShortcutActionHandler constants to shared (#8484) Change-Id: Ia75fa0ca8b7f563ccc412381e88abae7c630569e --- .../vaadin/client/ui/ShortcutActionHandler.java | 32 ++++++++++------------ server/src/com/vaadin/event/ActionManager.java | 21 +++++++------- 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/client/src/com/vaadin/client/ui/ShortcutActionHandler.java b/client/src/com/vaadin/client/ui/ShortcutActionHandler.java index 929de7a15d..cd14f14585 100644 --- a/client/src/com/vaadin/client/ui/ShortcutActionHandler.java +++ b/client/src/com/vaadin/client/ui/ShortcutActionHandler.java @@ -35,6 +35,7 @@ import com.vaadin.client.UIDL; import com.vaadin.client.Util; import com.vaadin.client.ui.richtextarea.VRichTextArea; import com.vaadin.shared.Connector; +import com.vaadin.shared.ui.ShortCutConstants; /** * A helper class to implement keyboard shorcut handling. Keeps a list of owners @@ -45,15 +46,6 @@ import com.vaadin.shared.Connector; */ public class ShortcutActionHandler { - public static final String ACTION_TARGET_ATTRIBUTE = "sat"; - public static final String ACTION_TARGET_ACTION_ATTRIBUTE = "sata"; - public static final String ACTION_CAPTION_ATTRIBUTE = "caption"; - public static final String ACTION_KEY_ATTRIBUTE = "key"; - public static final String ACTION_SHORTCUT_KEY_ATTRIBUTE = "kc"; - public static final String ACTION_MODIFIER_KEYS_ATTRIBUTE = "mk"; - public static final String ACTION_TARGET_VARIABLE = "actiontarget"; - public static final String ACTION_TARGET_ACTION_VARIABLE = "action"; - /** * An interface implemented by those users of this helper class that want to * support special components like {@link VRichTextArea} that don't properly @@ -119,21 +111,23 @@ public class ShortcutActionHandler { final UIDL action = (UIDL) it.next(); int[] modifiers = null; - if (action.hasAttribute(ACTION_MODIFIER_KEYS_ATTRIBUTE)) { + if (action + .hasAttribute(ShortCutConstants.ACTION_MODIFIER_KEYS_ATTRIBUTE)) { modifiers = action - .getIntArrayAttribute(ACTION_MODIFIER_KEYS_ATTRIBUTE); + .getIntArrayAttribute(ShortCutConstants.ACTION_MODIFIER_KEYS_ATTRIBUTE); } final ShortcutKeyCombination kc = new ShortcutKeyCombination( - action.getIntAttribute(ACTION_SHORTCUT_KEY_ATTRIBUTE), + action.getIntAttribute(ShortCutConstants.ACTION_SHORTCUT_KEY_ATTRIBUTE), modifiers); - final String key = action.getStringAttribute(ACTION_KEY_ATTRIBUTE); + final String key = action + .getStringAttribute(ShortCutConstants.ACTION_KEY_ATTRIBUTE); final String caption = action - .getStringAttribute(ACTION_CAPTION_ATTRIBUTE); + .getStringAttribute(ShortCutConstants.ACTION_CAPTION_ATTRIBUTE); final String targetPID = action - .getStringAttribute(ACTION_TARGET_ATTRIBUTE); + .getStringAttribute(ShortCutConstants.ACTION_TARGET_ATTRIBUTE); final String targetAction = action - .getStringAttribute(ACTION_TARGET_ACTION_ATTRIBUTE); + .getStringAttribute(ShortCutConstants.ACTION_TARGET_ACTION_ATTRIBUTE); actions.add(new ShortcutAction(key, kc, caption, targetPID, targetAction)); } @@ -201,10 +195,12 @@ public class ShortcutActionHandler { if (!handledClientSide) { if (finalTarget != null) { client.updateVariable(paintableId, - ACTION_TARGET_VARIABLE, finalTarget, false); + ShortCutConstants.ACTION_TARGET_VARIABLE, + finalTarget, false); } client.updateVariable(paintableId, - ACTION_TARGET_ACTION_VARIABLE, a.getKey(), true); + ShortCutConstants.ACTION_TARGET_ACTION_VARIABLE, + a.getKey(), true); } } }); diff --git a/server/src/com/vaadin/event/ActionManager.java b/server/src/com/vaadin/event/ActionManager.java index ad643863a7..50bb2f8dad 100644 --- a/server/src/com/vaadin/event/ActionManager.java +++ b/server/src/com/vaadin/event/ActionManager.java @@ -18,13 +18,13 @@ package com.vaadin.event; import java.util.HashSet; import java.util.Map; -import com.vaadin.client.ui.ShortcutActionHandler; import com.vaadin.event.Action.Container; import com.vaadin.event.Action.Handler; import com.vaadin.server.KeyMapper; import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; import com.vaadin.server.VariableOwner; +import com.vaadin.shared.ui.ShortCutConstants; import com.vaadin.ui.Component; /** @@ -188,10 +188,9 @@ public class ActionManager implements Action.Container, Action.Handler, } if (a instanceof ShortcutAction) { final ShortcutAction sa = (ShortcutAction) a; - paintTarget - .addAttribute( - ShortcutActionHandler.ACTION_SHORTCUT_KEY_ATTRIBUTE, - sa.getKeyCode()); + paintTarget.addAttribute( + ShortCutConstants.ACTION_SHORTCUT_KEY_ATTRIBUTE, + sa.getKeyCode()); final int[] modifiers = sa.getModifiers(); if (modifiers != null) { final String[] smodifiers = new String[modifiers.length]; @@ -200,16 +199,16 @@ public class ActionManager implements Action.Container, Action.Handler, } paintTarget .addAttribute( - ShortcutActionHandler.ACTION_MODIFIER_KEYS_ATTRIBUTE, + ShortCutConstants.ACTION_MODIFIER_KEYS_ATTRIBUTE, smodifiers); } if (sa.getTarget() != null) { paintTarget.addAttribute( - ShortcutActionHandler.ACTION_TARGET_ATTRIBUTE, + ShortCutConstants.ACTION_TARGET_ATTRIBUTE, sa.getTarget()); paintTarget .addAttribute( - ShortcutActionHandler.ACTION_TARGET_ACTION_ATTRIBUTE, + ShortCutConstants.ACTION_TARGET_ACTION_ATTRIBUTE, sa.getTargetAction()); } } @@ -229,13 +228,13 @@ public class ActionManager implements Action.Container, Action.Handler, public void handleActions(Map variables, Container sender) { if (variables - .containsKey(ShortcutActionHandler.ACTION_TARGET_ACTION_VARIABLE) + .containsKey(ShortCutConstants.ACTION_TARGET_ACTION_VARIABLE) && actionMapper != null) { final String key = (String) variables - .get(ShortcutActionHandler.ACTION_TARGET_ACTION_VARIABLE); + .get(ShortCutConstants.ACTION_TARGET_ACTION_VARIABLE); final Action action = actionMapper.get(key); final Object target = variables - .get(ShortcutActionHandler.ACTION_TARGET_VARIABLE); + .get(ShortCutConstants.ACTION_TARGET_VARIABLE); if (action != null) { handleAction(action, sender, target); } -- cgit v1.2.3 From 4ef5aec435042a6c8e5a8084e6aeb6f60b05d863 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 1 Oct 2012 18:57:41 +0300 Subject: Moved ShortcutActionHandler constants to shared (#8484) Change-Id: I59b0f732f819ceb5e63182c7f3ac492f913a6278 --- .../com/vaadin/shared/ui/ShortCutConstants.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 shared/src/com/vaadin/shared/ui/ShortCutConstants.java diff --git a/shared/src/com/vaadin/shared/ui/ShortCutConstants.java b/shared/src/com/vaadin/shared/ui/ShortCutConstants.java new file mode 100644 index 0000000000..1de9ba65da --- /dev/null +++ b/shared/src/com/vaadin/shared/ui/ShortCutConstants.java @@ -0,0 +1,28 @@ +/* + * Copyright 2011 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.shared.ui; + +public class ShortCutConstants { + public static final String ACTION_TARGET_ATTRIBUTE = "sat"; + public static final String ACTION_TARGET_ACTION_ATTRIBUTE = "sata"; + public static final String ACTION_CAPTION_ATTRIBUTE = "caption"; + public static final String ACTION_KEY_ATTRIBUTE = "key"; + public static final String ACTION_SHORTCUT_KEY_ATTRIBUTE = "kc"; + public static final String ACTION_MODIFIER_KEYS_ATTRIBUTE = "mk"; + public static final String ACTION_TARGET_VARIABLE = "actiontarget"; + public static final String ACTION_TARGET_ACTION_VARIABLE = "action"; + +} -- cgit v1.2.3 From cf20da29cf87994e2f9bd0f6957585196e792abd Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 1 Oct 2012 21:11:49 +0300 Subject: Fixed test to work also on build server Change-Id: I78e49ad780c75b38fb62f3880bc6b4b08c9af8b1 --- .../tests/components/ui/UISerialization.html | 2 +- .../tests/components/ui/UISerialization.java | 46 ---------------------- 2 files changed, 1 insertion(+), 47 deletions(-) diff --git a/uitest/src/com/vaadin/tests/components/ui/UISerialization.html b/uitest/src/com/vaadin/tests/components/ui/UISerialization.html index 1eb6dffcc0..2379882a2c 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UISerialization.html +++ b/uitest/src/com/vaadin/tests/components/ui/UISerialization.html @@ -18,7 +18,7 @@ click - vaadin=runcomvaadintestscomponentsuiUISerialization::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VButton[0]/domChild[0]/domChild[0] + vaadin=runcomvaadintestscomponentsuiUISerialization::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0] diff --git a/uitest/src/com/vaadin/tests/components/ui/UISerialization.java b/uitest/src/com/vaadin/tests/components/ui/UISerialization.java index 927d00a388..2f72166b11 100644 --- a/uitest/src/com/vaadin/tests/components/ui/UISerialization.java +++ b/uitest/src/com/vaadin/tests/components/ui/UISerialization.java @@ -24,14 +24,11 @@ import java.io.Serializable; import java.util.Date; import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.VaadinClasses; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.tests.util.Log; -import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.Component; public class UISerialization extends AbstractTestUI { @@ -40,28 +37,6 @@ public class UISerialization extends AbstractTestUI { @Override protected void setup(VaadinRequest request) { addComponent(log); - for (Class cls : VaadinClasses.getComponents()) { - try { - AbstractComponent c = (AbstractComponent) cls.newInstance(); - if (c instanceof LegacyWindow) { - continue; - } - if (!(c instanceof Button)) { - continue; - } - - c.setId(cls.getName()); - c.setCaption(cls.getName()); - c.setDescription(cls.getName()); - c.setWidth("100px"); - c.setHeight("100px"); - addComponent(c); - System.out.println("Added " + cls.getName()); - } catch (Exception e) { - System.err.println("Could not instatiate " + cls.getName()); - } - } - addComponent(new Button("Serialize UI", new ClickListener() { @Override @@ -86,27 +61,6 @@ public class UISerialization extends AbstractTestUI { } })); - addComponent(new Button( - "Instantiate and serialize server classes with no-arg constructors", - new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - for (Class cls : VaadinClasses - .getAllServerSideClasses()) { - try { - serializeInstance(cls); - } catch (InstantiationException e) { - // No no-arg constructor probably, ignore - } catch (Throwable t) { - log.log("Failed to create and serialize instance of " - + cls.getName()); - } - } - log.log("Serialization done"); - - } - })); } protected void serializeInstance(Class cls) -- cgit v1.2.3 From 9e853dd5c69e1f7841e3695c3f3bc6bbb19cf554 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 1 Oct 2012 21:46:26 +0300 Subject: Updated GAE test to be UI based (#9816) Change-Id: I50a0ac7a8aca239e04806a8d6f9be1d9263e71dd --- WebContent/WEB-INF/web.xml | 10 +++--- .../tests/integration/IntegrationTestUI.java | 42 ++++++++++++++++++++++ 2 files changed, 47 insertions(+), 5 deletions(-) create mode 100755 uitest/src/com/vaadin/tests/integration/IntegrationTestUI.java diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml index 67eaba0cca..ea15e2d2a1 100644 --- a/WebContent/WEB-INF/web.xml +++ b/WebContent/WEB-INF/web.xml @@ -18,7 +18,7 @@ resourceCacheTime 3600 - + Embed App 1 com.vaadin.server.LegacyVaadinServlet @@ -58,8 +58,8 @@ IntegrationTest com.vaadin.server.VaadinServlet - application - com.vaadin.tests.integration.IntegrationTestApplication + UI + com.vaadin.tests.integration.IntegrationTestUI @@ -71,12 +71,12 @@ Embed App 2 /embed2/* - + UI provider app /uiprovider/* - + VaadinApplicationRunner /run/* diff --git a/uitest/src/com/vaadin/tests/integration/IntegrationTestUI.java b/uitest/src/com/vaadin/tests/integration/IntegrationTestUI.java new file mode 100755 index 0000000000..05683e7b4e --- /dev/null +++ b/uitest/src/com/vaadin/tests/integration/IntegrationTestUI.java @@ -0,0 +1,42 @@ +package com.vaadin.tests.integration; + +import com.vaadin.data.Item; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.server.ClassResource; +import com.vaadin.server.Resource; +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; +import com.vaadin.ui.UI; + +public class IntegrationTestUI extends UI { + @Override + protected void init(VaadinRequest request) { + final Table table = new Table(); + table.addContainerProperty("icon", Resource.class, null); + table.setItemIconPropertyId("icon"); + table.addContainerProperty("country", String.class, null); + table.setRowHeaderMode(Table.RowHeaderMode.ICON_ONLY); + table.setImmediate(true); + table.setSelectable(true); + table.setVisibleColumns(new Object[] { "country" }); + addComponent(table); + + Item item = table.addItem("FI"); + item.getItemProperty("icon").setValue(new ClassResource("fi.gif")); + item.getItemProperty("country").setValue("Finland"); + item = table.addItem("SE"); + item.getItemProperty("icon").setValue(new FlagSeResource()); + item.getItemProperty("country").setValue("Sweden"); + + final Label selectedLabel = new Label(); + table.addValueChangeListener(new ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + selectedLabel.setValue(table.getValue().toString()); + } + }); + addComponent(selectedLabel); + } +} -- cgit v1.2.3 From def50dcdd7f28f9f4f92fb723191049f67fd21e4 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 1 Oct 2012 23:37:05 +0300 Subject: Made GlobalResourceHandler serializable (#9817) Change-Id: Iae2ac641275a7f16b0bde2184c3f42f9f059f890 --- server/src/com/vaadin/server/GlobalResourceHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/com/vaadin/server/GlobalResourceHandler.java b/server/src/com/vaadin/server/GlobalResourceHandler.java index c968dba066..ad276dc77a 100644 --- a/server/src/com/vaadin/server/GlobalResourceHandler.java +++ b/server/src/com/vaadin/server/GlobalResourceHandler.java @@ -59,7 +59,7 @@ public class GlobalResourceHandler implements RequestHandler { private int nextLegacyId = 0; // APP/global/[uiid]/[type]/[id] - private final Matcher matcher = Pattern.compile( + private static final Matcher matcher = Pattern.compile( "^/?" + ApplicationConstants.APP_REQUEST_PATH + RESOURCE_REQUEST_PATH + "(\\d+)/(([^/]+)(/.*))").matcher( ""); -- cgit v1.2.3 From 2ad19298bd12237dfaf3b2bc9ee9f7aafe737ecb Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 1 Oct 2012 23:40:29 +0300 Subject: Unified log message with other Property implementors (#9804) Change-Id: I0833381d7f7871d062b04ef0ed5408f1777022af --- server/src/com/vaadin/ui/Label.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/com/vaadin/ui/Label.java b/server/src/com/vaadin/ui/Label.java index 9434e92186..89281e0c27 100644 --- a/server/src/com/vaadin/ui/Label.java +++ b/server/src/com/vaadin/ui/Label.java @@ -219,7 +219,7 @@ public class Label extends AbstractComponent implements Property, public String toString() { logger.warning("You are using Label.toString() to get the value for a " + getClass().getSimpleName() - + ". This is not recommended and will not be supported in future versions."); + + ". This will not be supported starting from Vaadin 7.1 (your debugger might call toString() and cause this message to appear)."); return getValue(); } -- cgit v1.2.3 From 3537127077043c8eeb62aa11f6bdbad635931e54 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Tue, 2 Oct 2012 09:22:56 +0300 Subject: Merge from 6.8: Large lazy container for tests svn changeset:24517/svn branch:6.8 Change-Id: I215e0471f608bda6bee27309426a96139a147275 --- .../src/com/vaadin/tests/util/LargeContainer.java | 219 +++++++++++++++++++++ .../src/com/vaadin/tests/util/RangeCollection.java | 48 +++++ 2 files changed, 267 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/util/LargeContainer.java create mode 100644 uitest/src/com/vaadin/tests/util/RangeCollection.java diff --git a/uitest/src/com/vaadin/tests/util/LargeContainer.java b/uitest/src/com/vaadin/tests/util/LargeContainer.java new file mode 100644 index 0000000000..9d02cfa53c --- /dev/null +++ b/uitest/src/com/vaadin/tests/util/LargeContainer.java @@ -0,0 +1,219 @@ +package com.vaadin.tests.util; + +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.vaadin.data.Container; +import com.vaadin.data.ContainerHelpers; +import com.vaadin.data.Item; +import com.vaadin.data.Property; +import com.vaadin.data.util.AbstractContainer; +import com.vaadin.data.util.ObjectProperty; + +public class LargeContainer extends AbstractContainer implements + Container.Indexed { + + public class TestItem implements Item { + + private final Object itemId; + + public TestItem(Object itemId) { + this.itemId = itemId; + } + + public Property getItemProperty(Object propertyId) { + ObjectProperty property = new ObjectProperty( + containerPropertyIdDefaults.get(propertyId) + " (item " + + itemId + ")"); + return property; + + } + + public Collection getItemPropertyIds() { + return getContainerPropertyIds(); + } + + @SuppressWarnings("rawtypes") + public boolean addItemProperty(Object id, Property property) + throws UnsupportedOperationException { + throw new UnsupportedOperationException("Cannot add item property"); + } + + public boolean removeItemProperty(Object id) + throws UnsupportedOperationException { + throw new UnsupportedOperationException( + "Cannot remove item property"); + } + + } + + private int size = 1000; + + private Map> containerPropertyIdTypes = new HashMap>(); + private Map containerPropertyIdDefaults = new HashMap(); + + public Object nextItemId(Object itemId) { + Integer id = (Integer) itemId; + if (id >= size() - 1) { + return null; + } + return (id + 1); + } + + public Object prevItemId(Object itemId) { + Integer id = (Integer) itemId; + if (id <= 0) { + return null; + } + return (id - 1); + } + + public Object firstItemId() { + if (0 == size()) { + return null; + } + return 0; + } + + public Object lastItemId() { + if (0 == size()) { + return null; + } + return (size() - 1); + } + + public boolean isFirstId(Object itemId) { + if (null == itemId) { + return false; + } + return itemId.equals(firstItemId()); + } + + public boolean isLastId(Object itemId) { + if (null == itemId) { + return false; + } + return itemId.equals(lastItemId()); + } + + public TestItem getItem(Object itemId) { + if (!containsId(itemId)) { + return null; + } + return new TestItem(itemId); + } + + public Collection getItemIds() { + return new RangeCollection(size()); + } + + @Override + public List getItemIds(int startIndex, int numberOfIds) { + // TODO use a lazy list for better performance + return ContainerHelpers.getItemIdsUsingGetIdByIndex(startIndex, + numberOfIds, this); + } + + public Property getContainerProperty(Object itemId, Object propertyId) { + TestItem item = getItem(itemId); + if (null == item) { + return null; + } + return item.getItemProperty(propertyId); + } + + public int size() { + return size; + } + + public boolean containsId(Object itemId) { + if (!(itemId instanceof Integer)) { + return false; + } + Integer id = (Integer) itemId; + return (id >= 0 && id < (size() - 1)); + } + + public int indexOfId(Object itemId) { + if (!containsId(itemId)) { + return -1; + } + return (Integer) itemId; + } + + public Object getIdByIndex(int index) { + return index; + } + + public void setSize(int newSize) { + size = newSize; + } + + public boolean removeAllItems() throws UnsupportedOperationException { + setSize(0); + return true; + } + + public Class getType(Object propertyId) { + return containerPropertyIdTypes.get(propertyId); + } + + public Collection getContainerPropertyIds() { + return containerPropertyIdTypes.keySet(); + } + + public boolean addContainerProperty(Object propertyId, Class type, + Object defaultValue) throws UnsupportedOperationException { + if (containerPropertyIdTypes.containsKey(propertyId) || null == type) { + return false; + } + containerPropertyIdTypes.put(propertyId, type); + containerPropertyIdDefaults.put(propertyId, defaultValue); + return true; + } + + public boolean removeContainerProperty(Object propertyId) + throws UnsupportedOperationException { + if (!containerPropertyIdTypes.containsKey(propertyId)) { + return false; + } + containerPropertyIdTypes.remove(propertyId); + containerPropertyIdDefaults.remove(propertyId); + return true; + } + + public Item addItem(Object itemId) throws UnsupportedOperationException { + throw new UnsupportedOperationException("Not supported"); + } + + public Object addItem() throws UnsupportedOperationException { + throw new UnsupportedOperationException("Not supported"); + } + + public boolean removeItem(Object itemId) + throws UnsupportedOperationException { + throw new UnsupportedOperationException("Not supported"); + } + + public Object addItemAt(int index) throws UnsupportedOperationException { + throw new UnsupportedOperationException("Not supported"); + } + + public Item addItemAt(int index, Object newItemId) + throws UnsupportedOperationException { + throw new UnsupportedOperationException("Not supported"); + } + + public Object addItemAfter(Object previousItemId) + throws UnsupportedOperationException { + throw new UnsupportedOperationException("Not supported"); + } + + public Item addItemAfter(Object previousItemId, Object newItemId) + throws UnsupportedOperationException { + throw new UnsupportedOperationException("Not supported"); + } + +} \ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/util/RangeCollection.java b/uitest/src/com/vaadin/tests/util/RangeCollection.java new file mode 100644 index 0000000000..f26e3cfb15 --- /dev/null +++ b/uitest/src/com/vaadin/tests/util/RangeCollection.java @@ -0,0 +1,48 @@ +package com.vaadin.tests.util; + +import java.util.AbstractCollection; +import java.util.Iterator; + +public class RangeCollection extends AbstractCollection { + + public static class RangeIterator implements Iterator { + + private int value; + private int max; + + public RangeIterator(int max) { + this.max = max; + value = 0; + } + + public boolean hasNext() { + return (value < max - 1); + } + + public Integer next() { + return value++; + } + + public void remove() { + throw new UnsupportedOperationException(); + } + + } + + private int size = 0; + + public RangeCollection(int size) { + this.size = size; + } + + @Override + public Iterator iterator() { + return new RangeIterator(size - 1); + } + + @Override + public int size() { + return size; + } + +} \ No newline at end of file -- cgit v1.2.3 From 25b4d23647b1056097c2a4b2761bfe25d8928b7a Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Tue, 2 Oct 2012 10:21:39 +0300 Subject: Make DefaultUIProvider work with lower case parameter name (#9474) Change-Id: I1c66f1661fee32ce924f5923c15a5c86b25465e1 --- server/src/com/vaadin/server/DefaultUIProvider.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/src/com/vaadin/server/DefaultUIProvider.java b/server/src/com/vaadin/server/DefaultUIProvider.java index 1652d39c3a..e02e5dc860 100644 --- a/server/src/com/vaadin/server/DefaultUIProvider.java +++ b/server/src/com/vaadin/server/DefaultUIProvider.java @@ -24,9 +24,11 @@ public class DefaultUIProvider extends UIProvider { public Class getUIClass(UIClassSelectionEvent event) { VaadinRequest request = event.getRequest(); - Object uiClassNameObj = request.getService() - .getDeploymentConfiguration().getInitParameters() - .getProperty(VaadinServiceSession.UI_PARAMETER); + Object uiClassNameObj = request + .getService() + .getDeploymentConfiguration() + .getApplicationOrSystemProperty( + VaadinServiceSession.UI_PARAMETER, null); if (uiClassNameObj instanceof String) { String uiClassName = uiClassNameObj.toString(); -- cgit v1.2.3 From facd94111590d9fe7b8b5ceffe3f7d0db0024948 Mon Sep 17 00:00:00 2001 From: Jonatan Kronqvist Date: Tue, 2 Oct 2012 13:54:48 +0300 Subject: Fixes #9828 - ComponentLocator now makes use of debug IDs if present Change-Id: I58aeee42ef386dd3eef8fdf25f8dd430eb22774c --- client/src/com/vaadin/client/ComponentLocator.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/com/vaadin/client/ComponentLocator.java b/client/src/com/vaadin/client/ComponentLocator.java index 3338147465..e69c55d445 100644 --- a/client/src/com/vaadin/client/ComponentLocator.java +++ b/client/src/com/vaadin/client/ComponentLocator.java @@ -436,8 +436,10 @@ public class ComponentLocator { if (w == null) { return null; } - - if (w instanceof VUI) { + String elementId = w.getElement().getId(); + if (elementId != null && !elementId.isEmpty()) { + return "PID_S" + elementId; + } else if (w instanceof VUI) { return ""; } else if (w instanceof VWindow) { Connector windowConnector = ConnectorMap.get(client) -- cgit v1.2.3 From 22397fed1c2c7461aceb191291fe89ffd403fe26 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 2 Oct 2012 18:03:22 +0300 Subject: Avoid NPEs in integration test Change-Id: Idc20efce93e2ee6f7e9cba2eb3676e6e6ec41771 --- uitest/src/com/vaadin/tests/integration/IntegrationTestApplication.java | 2 +- uitest/src/com/vaadin/tests/integration/IntegrationTestUI.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/uitest/src/com/vaadin/tests/integration/IntegrationTestApplication.java b/uitest/src/com/vaadin/tests/integration/IntegrationTestApplication.java index 41b7b020f5..916af7129e 100644 --- a/uitest/src/com/vaadin/tests/integration/IntegrationTestApplication.java +++ b/uitest/src/com/vaadin/tests/integration/IntegrationTestApplication.java @@ -38,7 +38,7 @@ public class IntegrationTestApplication extends LegacyApplication { table.addListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { - selectedLabel.setValue(table.getValue().toString()); + selectedLabel.setValue(String.valueOf(table.getValue())); } }); window.addComponent(selectedLabel); diff --git a/uitest/src/com/vaadin/tests/integration/IntegrationTestUI.java b/uitest/src/com/vaadin/tests/integration/IntegrationTestUI.java index 05683e7b4e..61214ede8c 100755 --- a/uitest/src/com/vaadin/tests/integration/IntegrationTestUI.java +++ b/uitest/src/com/vaadin/tests/integration/IntegrationTestUI.java @@ -34,7 +34,7 @@ public class IntegrationTestUI extends UI { table.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { - selectedLabel.setValue(table.getValue().toString()); + selectedLabel.setValue(String.valueOf(table.getValue())); } }); addComponent(selectedLabel); -- cgit v1.2.3 From cc1939621e7e0c1075596043b794b0c17eb447c3 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Wed, 3 Oct 2012 14:24:01 +0300 Subject: Firefox now uses the overflow autofix + made sure we don't trigger a layout phase while running another layout phase #9845 Change-Id: I5a5bdf5ffdf84f86054f3f6f1d79737e630e41cb --- client/src/com/vaadin/client/BrowserInfo.java | 4 ++-- client/src/com/vaadin/client/ui/ui/VUI.java | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/client/src/com/vaadin/client/BrowserInfo.java b/client/src/com/vaadin/client/BrowserInfo.java index e32e9b65f0..fab393eedc 100644 --- a/client/src/com/vaadin/client/BrowserInfo.java +++ b/client/src/com/vaadin/client/BrowserInfo.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -327,7 +327,7 @@ public class BrowserInfo { * otherwise false */ public boolean requiresOverflowAutoFix() { - return (getWebkitVersion() > 0 || getOperaVersion() >= 11) + return (getWebkitVersion() > 0 || getOperaVersion() >= 11 || isFirefox()) && Util.getNativeScrollbarSize() > 0; } diff --git a/client/src/com/vaadin/client/ui/ui/VUI.java b/client/src/com/vaadin/client/ui/ui/VUI.java index 8d534053ed..096b0b60ba 100644 --- a/client/src/com/vaadin/client/ui/ui/VUI.java +++ b/client/src/com/vaadin/client/ui/ui/VUI.java @@ -37,6 +37,7 @@ import com.vaadin.client.BrowserInfo; import com.vaadin.client.ComponentConnector; import com.vaadin.client.ConnectorMap; import com.vaadin.client.Focusable; +import com.vaadin.client.LayoutManager; import com.vaadin.client.VConsole; import com.vaadin.client.ui.ShortcutActionHandler; import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; @@ -286,7 +287,12 @@ public class VUI extends SimplePanel implements ResizeHandler, sendClientResized(); - connector.getLayoutManager().layoutNow(); + LayoutManager layoutManager = connector.getLayoutManager(); + if (layoutManager.isLayoutRunning()) { + layoutManager.layoutLater(); + } else { + layoutManager.layoutNow(); + } } } -- cgit v1.2.3 From a930bbb16eeb7c8663c136b441ff44024c615447 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Tue, 25 Sep 2012 11:25:04 +0000 Subject: Ensure the browser does not cache UIDL responses (#9732) svn changeset:24575/svn branch:6.8 Conflicts: src/com/vaadin/terminal/gwt/server/CommunicationManager.java Change-Id: I64a1a8300ab1d96e7a9b22c5ed53398cf0dd3f74 --- server/src/com/vaadin/server/VaadinServlet.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index 9d1d79d8b1..0620035274 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -288,6 +288,11 @@ public class VaadinServlet extends HttpServlet implements Constants { // Handles AJAX UIDL requests communicationManager.handleUidlRequest(request, response, servletWrapper, uI); + + // Ensure that the browser does not cache UIDL responses. + // iOS 6 Safari requires this (#9732) + response.setHeader("Cache-Control", "no-cache"); + return; } else if (requestType == RequestType.BROWSER_DETAILS) { // Browser details - not related to a specific UI -- cgit v1.2.3 From 4b930acc0f76fdd65bbd72c9384067e5be176095 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Tue, 25 Sep 2012 14:52:27 +0000 Subject: Test case for #9508 svn changeset:24580/svn branch:6.8 Change-Id: I2cb7dd24e09c8aaa439b43881ac6a5327cf0fac1 --- .../tabsheet/HiddenTabSheetBrowserResize.java | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/testbench/com/vaadin/tests/components/tabsheet/HiddenTabSheetBrowserResize.java diff --git a/tests/testbench/com/vaadin/tests/components/tabsheet/HiddenTabSheetBrowserResize.java b/tests/testbench/com/vaadin/tests/components/tabsheet/HiddenTabSheetBrowserResize.java new file mode 100644 index 0000000000..0fdb579997 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/tabsheet/HiddenTabSheetBrowserResize.java @@ -0,0 +1,38 @@ +package com.vaadin.tests.components.tabsheet; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Label; +import com.vaadin.ui.TabSheet; + +public class HiddenTabSheetBrowserResize extends TestBase { + + @Override + public void setup() { + final TabSheet tabSheet = new TabSheet(); + + tabSheet.addTab(new Label("Label1"), "Tab1"); + tabSheet.addTab(new Label("Label2"), "Tab2"); + + Button toggleButton = new Button("Toggle TabSheet", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + tabSheet.setVisible(!tabSheet.isVisible()); + } + }); + addComponent(toggleButton); + addComponent(tabSheet); + } + + @Override + protected String getDescription() { + return "TabSheet content disappears if browser window resized when the TabSheet is hidden"; + } + + @Override + protected Integer getTicketNumber() { + return 9508; + } + +} -- cgit v1.2.3