From 4f6bc36661f0d07a6bafd7af3a0cd386f3ab9675 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Thu, 12 Jan 2012 11:17:28 +0000 Subject: Merge from 6.7 svn changeset:22607/svn branch:6.8 --- src/com/vaadin/terminal/gwt/client/Util.java | 2 ++ .../terminal/gwt/client/ui/VScrollTable.java | 35 +++++++++++----------- .../vaadin/terminal/gwt/client/ui/VTextArea.java | 7 +++++ src/com/vaadin/terminal/gwt/client/ui/VView.java | 8 +++++ src/com/vaadin/ui/Table.java | 10 +++++++ 5 files changed, 44 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/com/vaadin/terminal/gwt/client/Util.java b/src/com/vaadin/terminal/gwt/client/Util.java index a72c9c1dc2..3dbbd22329 100644 --- a/src/com/vaadin/terminal/gwt/client/Util.java +++ b/src/com/vaadin/terminal/gwt/client/Util.java @@ -1080,6 +1080,8 @@ public class Util { VConsole.log("\t\t" + var[1] + " (" + var[2] + ")" + " : " + var[0]); } + } else { + VConsole.log("\t" + id + ": Warning: no corresponding paintable!"); } } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index f1c1927b26..553934bf98 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -2292,26 +2292,17 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, * of the caption container element by the correct amount */ public void resizeCaptionContainer(int rightSpacing) { + + int captionContainerWidth = width + - colResizeWidget.getOffsetWidth() - rightSpacing; + if (BrowserInfo.get().isIE6() || td.getClassName().contains("-asc") || td.getClassName().contains("-desc")) { - /* - * Room for the sort indicator is made by subtracting the styled - * margin and width of the resizer from the width of the caption - * container. - */ - int captionContainerWidth = width - - sortIndicator.getOffsetWidth() - - colResizeWidget.getOffsetWidth() - rightSpacing; - captionContainer.getStyle().setPropertyPx("width", - captionContainerWidth); - } else { - /* - * Set the caption container element as wide as possible when - * the sorting indicator is not visible. - */ - captionContainer.getStyle().setPropertyPx("width", - width - rightSpacing); + // Leave room for the sort indicator + captionContainerWidth -= sortIndicator.getOffsetWidth(); } + captionContainer.getStyle().setPropertyPx("width", + captionContainerWidth); // Apply/Remove spacing if defined if (rightSpacing > 0) { @@ -6071,7 +6062,15 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, public void onScroll(ScrollEvent event) { scrollLeft = scrollBodyPanel.getElement().getScrollLeft(); scrollTop = scrollBodyPanel.getScrollPosition(); - if (!initializedAndAttached) { + /* + * #6970 - IE sometimes fires scroll events for a detached table. + * + * FIXME initializedAndAttached should probably be renamed - its name + * doesn't seem to reflect its semantics. onDetach() doesn't set it to + * false, and changing that might break something else, so we need to + * check isAttached() separately. + */ + if (!initializedAndAttached || !isAttached()) { return; } if (!enabled) { diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTextArea.java b/src/com/vaadin/terminal/gwt/client/ui/VTextArea.java index a74fd9f5dc..cd09e24d67 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTextArea.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTextArea.java @@ -69,4 +69,11 @@ public class VTextArea extends VTextField { super.onBrowserEvent(event); } + @Override + public int getCursorPos() { + // This is needed so that TextBoxImplIE6 is used to return the correct + // position for old Internet Explorer versions where it has to be + // detected in a different way. + return getImpl().getTextAreaCursorPos(getElement()); + } } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VView.java b/src/com/vaadin/terminal/gwt/client/ui/VView.java index f21c0aaac0..07ade6a8b1 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VView.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VView.java @@ -591,6 +591,11 @@ public class VView extends SimplePanel implements Container, ResizeHandler, String ownAppId = connection.getConfiguration().getRootPanelId(); + // Hiding elements causes browser to forget scroll position -> must + // save values and restore when the elements are visible again #7976 + int originalScrollTop = Window.getScrollTop(); + int originalScrollLeft = Window.getScrollLeft(); + // Set display: none for all Vaadin apps for (int i = 0; i < vaadinApps.size(); i++) { String appId = vaadinApps.get(i); @@ -629,6 +634,9 @@ public class VView extends SimplePanel implements Container, ResizeHandler, } } + // Scroll back to original location + Window.scrollTo(originalScrollLeft, originalScrollTop); + return w; } diff --git a/src/com/vaadin/ui/Table.java b/src/com/vaadin/ui/Table.java index b7235dd37b..d8c59c2e91 100644 --- a/src/com/vaadin/ui/Table.java +++ b/src/com/vaadin/ui/Table.java @@ -5148,4 +5148,14 @@ public class Table extends AbstractSelect implements Action.Container, public RowGenerator getRowGenerator() { return rowGenerator; } + + @Override + public void setVisible(boolean visible) { + if (!isVisible() && visible) { + // We need to ensure that the rows are sent to the client when the + // Table is made visible if it has been rendered as invisible. + setRowCacheInvalidated(true); + } + super.setVisible(visible); + } } -- cgit v1.2.3 From fa81141d2230f37af17b20718a82709e004160be Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Thu, 12 Jan 2012 15:19:50 +0000 Subject: Removed dead code from VSlider svn changeset:22614/svn branch:6.8 --- src/com/vaadin/terminal/gwt/client/ui/VSlider.java | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/com/vaadin/terminal/gwt/client/ui/VSlider.java b/src/com/vaadin/terminal/gwt/client/ui/VSlider.java index 214ed48e22..9dfab44b93 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VSlider.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VSlider.java @@ -425,10 +425,6 @@ public class VSlider extends SimpleFocusablePanel implements Paintable, Field, setValueByEvent(event, true); DOM.eventCancelBubble(event, true); } - } else if (DOM.eventGetType(event) == Event.ONMOUSEDOWN && dragging) { - dragging = false; - DOM.releaseCapture(getElement()); - setValueByEvent(event, true); } } -- cgit v1.2.3 From c661750fbc7149becd34548ac3a0a844df39b3b7 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 12 Jan 2012 16:22:25 +0000 Subject: #7614 Added getComponent(int) and getComponentIndex(Component) to CssLayout svn changeset:22620/svn branch:6.8 --- src/com/vaadin/ui/CssLayout.java | 26 ++++++- .../AbstractIndexedLayoutTest.java | 84 ++++++++++++++++++++++ .../server/componentcontainer/CssLayoutTest.java | 34 +++++++++ .../server/componentcontainer/FormLayoutTest.java | 34 +++++++++ .../componentcontainer/VerticalLayoutTest.java | 34 +++++++++ 5 files changed, 211 insertions(+), 1 deletion(-) create mode 100644 tests/server-side/com/vaadin/tests/server/componentcontainer/AbstractIndexedLayoutTest.java create mode 100644 tests/server-side/com/vaadin/tests/server/componentcontainer/CssLayoutTest.java create mode 100644 tests/server-side/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java create mode 100644 tests/server-side/com/vaadin/tests/server/componentcontainer/VerticalLayoutTest.java (limited to 'src') diff --git a/src/com/vaadin/ui/CssLayout.java b/src/com/vaadin/ui/CssLayout.java index b952609b20..b9432df6b6 100644 --- a/src/com/vaadin/ui/CssLayout.java +++ b/src/com/vaadin/ui/CssLayout.java @@ -125,7 +125,7 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { // see ticket #7668 if (c.getParent() == this) { // When c is removed, all components after it are shifted down - if (index > components.indexOf(c)) { + if (index > getComponentIndex(c)) { index--; } removeComponent(c); @@ -275,4 +275,28 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { removeListener(CLICK_EVENT, LayoutClickEvent.class, listener); } + /** + * Returns the index of the given component. + * + * @param component + * The component to look up. + * @return The index of the component or -1 if the component is not a child. + */ + public int getComponentIndex(Component component) { + return components.indexOf(component); + } + + /** + * Returns the component at the given position. + * + * @param index + * The position of the component. + * @return The component at the given index. + * @throws IndexOutOfBoundsException + * If the index is out of range. + */ + public Component getComponent(int index) throws IndexOutOfBoundsException { + return components.get(index); + } + } diff --git a/tests/server-side/com/vaadin/tests/server/componentcontainer/AbstractIndexedLayoutTest.java b/tests/server-side/com/vaadin/tests/server/componentcontainer/AbstractIndexedLayoutTest.java new file mode 100644 index 0000000000..9271e9f1b3 --- /dev/null +++ b/tests/server-side/com/vaadin/tests/server/componentcontainer/AbstractIndexedLayoutTest.java @@ -0,0 +1,84 @@ +package com.vaadin.tests.server.componentcontainer; + +import junit.framework.TestCase; + +import com.vaadin.ui.Component; +import com.vaadin.ui.Label; +import com.vaadin.ui.Layout; + +public abstract class AbstractIndexedLayoutTest extends TestCase { + + private Layout layout; + + protected abstract Layout createLayout(); + + @Override + protected void setUp() throws Exception { + layout = createLayout(); + } + + public Layout getLayout() { + return layout; + } + + public void testAddRemoveComponent() { + Label c1 = new Label(); + Label c2 = new Label(); + + layout.addComponent(c1); + + assertEquals(c1, getComponent(0)); + assertEquals(1, getComponentCount()); + layout.addComponent(c2); + assertEquals(c1, getComponent(0)); + assertEquals(c2, getComponent(1)); + assertEquals(2, getComponentCount()); + layout.removeComponent(c1); + assertEquals(c2, getComponent(0)); + assertEquals(1, getComponentCount()); + layout.removeComponent(c2); + assertEquals(0, getComponentCount()); + } + + protected abstract int getComponentCount(); + + protected abstract Component getComponent(int index); + + protected abstract int getComponentIndex(Component c); + + public void testGetComponentIndex() { + Label c1 = new Label(); + Label c2 = new Label(); + + layout.addComponent(c1); + assertEquals(0, getComponentIndex(c1)); + layout.addComponent(c2); + assertEquals(0, getComponentIndex(c1)); + assertEquals(1, getComponentIndex(c2)); + layout.removeComponent(c1); + assertEquals(0, getComponentIndex(c2)); + layout.removeComponent(c2); + assertEquals(-1, getComponentIndex(c2)); + assertEquals(-1, getComponentIndex(c1)); + } + + public void testGetComponent() { + Label c1 = new Label(); + Label c2 = new Label(); + + layout.addComponent(c1); + assertEquals(c1, getComponent(0)); + layout.addComponent(c2); + assertEquals(c1, getComponent(0)); + assertEquals(c2, getComponent(1)); + layout.removeComponent(c1); + assertEquals(c2, getComponent(0)); + layout.removeComponent(c2); + try { + getComponent(0); + fail(); + } catch (IndexOutOfBoundsException e) { + // Expected + } + } +} diff --git a/tests/server-side/com/vaadin/tests/server/componentcontainer/CssLayoutTest.java b/tests/server-side/com/vaadin/tests/server/componentcontainer/CssLayoutTest.java new file mode 100644 index 0000000000..dc9667c38e --- /dev/null +++ b/tests/server-side/com/vaadin/tests/server/componentcontainer/CssLayoutTest.java @@ -0,0 +1,34 @@ +package com.vaadin.tests.server.componentcontainer; + +import com.vaadin.ui.Component; +import com.vaadin.ui.CssLayout; +import com.vaadin.ui.Layout; + +public class CssLayoutTest extends AbstractIndexedLayoutTest { + + @Override + protected Layout createLayout() { + return new CssLayout(); + } + + @Override + public CssLayout getLayout() { + return (CssLayout) super.getLayout(); + } + + @Override + protected Component getComponent(int index) { + return getLayout().getComponent(index); + } + + @Override + protected int getComponentIndex(Component c) { + return getLayout().getComponentIndex(c); + } + + @Override + protected int getComponentCount() { + return getLayout().getComponentCount(); + } + +} diff --git a/tests/server-side/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java b/tests/server-side/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java new file mode 100644 index 0000000000..71a813d423 --- /dev/null +++ b/tests/server-side/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java @@ -0,0 +1,34 @@ +package com.vaadin.tests.server.componentcontainer; + +import com.vaadin.ui.Component; +import com.vaadin.ui.FormLayout; +import com.vaadin.ui.Layout; + +public class FormLayoutTest extends AbstractIndexedLayoutTest { + + @Override + protected Layout createLayout() { + return new FormLayout(); + } + + @Override + public FormLayout getLayout() { + return (FormLayout) super.getLayout(); + } + + @Override + protected Component getComponent(int index) { + return getLayout().getComponent(index); + } + + @Override + protected int getComponentIndex(Component c) { + return getLayout().getComponentIndex(c); + } + + @Override + protected int getComponentCount() { + return getLayout().getComponentCount(); + } + +} diff --git a/tests/server-side/com/vaadin/tests/server/componentcontainer/VerticalLayoutTest.java b/tests/server-side/com/vaadin/tests/server/componentcontainer/VerticalLayoutTest.java new file mode 100644 index 0000000000..0e3a1d5734 --- /dev/null +++ b/tests/server-side/com/vaadin/tests/server/componentcontainer/VerticalLayoutTest.java @@ -0,0 +1,34 @@ +package com.vaadin.tests.server.componentcontainer; + +import com.vaadin.ui.Component; +import com.vaadin.ui.Layout; +import com.vaadin.ui.VerticalLayout; + +public class VerticalLayoutTest extends AbstractIndexedLayoutTest { + + @Override + protected Layout createLayout() { + return new VerticalLayout(); + } + + @Override + public VerticalLayout getLayout() { + return (VerticalLayout) super.getLayout(); + } + + @Override + protected Component getComponent(int index) { + return getLayout().getComponent(index); + } + + @Override + protected int getComponentIndex(Component c) { + return getLayout().getComponentIndex(c); + } + + @Override + protected int getComponentCount() { + return getLayout().getComponentCount(); + } + +} -- cgit v1.2.3 From 326ccadd49971a36bcf4c356f114eba70a4e337f Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Mon, 16 Jan 2012 07:01:28 +0000 Subject: Merged #8105 Compile core files and test files to separate folders svn changeset:22636/svn branch:6.8 --- build/build.properties | 2 +- build/build.xml | 207 +++++++++--------- src/com/vaadin/launcher/util/BrowserLauncher.java | 127 ----------- .../com/vaadin/tests/VaadinClasses.java | 236 +++++++++++++++++++++ .../com/vaadin/launcher/util/BrowserLauncher.java | 127 +++++++++++ tests/testbench/com/vaadin/tests/Components.java | 17 +- .../testbench/com/vaadin/tests/VaadinClasses.java | 235 -------------------- 7 files changed, 480 insertions(+), 471 deletions(-) delete mode 100644 src/com/vaadin/launcher/util/BrowserLauncher.java create mode 100644 tests/server-side/com/vaadin/tests/VaadinClasses.java create mode 100644 tests/testbench/com/vaadin/launcher/util/BrowserLauncher.java delete mode 100644 tests/testbench/com/vaadin/tests/VaadinClasses.java (limited to 'src') diff --git a/build/build.properties b/build/build.properties index 82378c6dac..9e126a4479 100644 --- a/build/build.properties +++ b/build/build.properties @@ -2,7 +2,7 @@ result-path=build/result checkout-path=build/checkout product-file=vaadin product-name=Vaadin -toolkit-package=com/vaadin +vaadin-package=com/vaadin gwt-dir=lib/core/gwt # repository into which Maven snapshots should be published diff --git a/build/build.xml b/build/build.xml index 8c3ee1d04a..1fdcc0ee25 100644 --- a/build/build.xml +++ b/build/build.xml @@ -43,14 +43,32 @@ uri="antlib:org.apache.maven.artifact.ant" classpathref="maven-ant-tasks.classpath" /> + - - + + + + + + + + + + + + + + + + + + + @@ -86,7 +104,7 @@ - + @@ -95,9 +113,6 @@ - - - @@ -109,17 +124,16 @@ Full Version: ${version.full} - - Vaadin package is: ${toolkit-package} + Vaadin package is: ${vaadin-package} - - + + We are using gwt version ${gwt-version}. @@ -185,13 +199,17 @@ Adding test class files and resources and launcher configuration. - - - + + + + + + + - + @@ -201,8 +219,8 @@ - - + + @@ -258,11 +276,11 @@ - + - - - - + + + + @@ -316,7 +339,7 @@ Copying src directory and processing copied files. Replacing <version> tag with build version for java/html/css/xml files. - + @@ -324,13 +347,13 @@ - + - + @@ -346,17 +369,17 @@ Copying non java/html/css/xml files such as images. - + - + - + @@ -383,12 +406,11 @@ - Adding VAADIN/themes, demo and hsqldb.jar files. + Adding VAADIN/themes and META-INF - @@ -431,20 +453,37 @@ - + Compiling src (server-side) - - - - - - - + + + + + + + + + Compiling src (Server and client side JUnit tests) + + + + + + + + Compiling src (TestBench tests) + + + + + + + - + @@ -488,7 +527,7 @@ - + @@ -496,8 +535,8 @@ - - + + @@ -551,12 +590,7 @@ - - - - - - + @@ -588,18 +622,14 @@ ${gwt-version} - - - - - @@ -617,24 +647,10 @@ - - - - - - - - - - - - + + - - - - - + @@ -665,7 +681,7 @@ - + @@ -692,9 +708,7 @@ - - - + ${javadoc.doctitle} ${javadoc.bottom} @@ -784,7 +798,7 @@ - + @@ -793,8 +807,6 @@ - - Base version: ${version} Build number: ${build.number} Build tag: ${build.tag} @@ -924,7 +936,7 @@ - + @@ -944,7 +956,7 @@ - + @@ -957,38 +969,35 @@ - + - + merge="false" + > - - - - - + - - + + + - + - + @@ -1040,7 +1049,7 @@ - + diff --git a/src/com/vaadin/launcher/util/BrowserLauncher.java b/src/com/vaadin/launcher/util/BrowserLauncher.java deleted file mode 100644 index 55692cb251..0000000000 --- a/src/com/vaadin/launcher/util/BrowserLauncher.java +++ /dev/null @@ -1,127 +0,0 @@ -/* -@VaadinApache2LicenseForJavaFiles@ - */ - -package com.vaadin.launcher.util; - -import java.io.BufferedInputStream; -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; - -/** - * This class opens default browser for DemoLauncher class. Default browser is - * detected by the operating system. - * - */ -public class BrowserLauncher { - - /** - * Open browser on specified URL. - * - * @param url - */ - public static void openBrowser(String url) { - - final Runtime runtime = Runtime.getRuntime(); - boolean started = false; - - final String os = System.getProperty("os.name", "windows") - .toLowerCase(); - - // Linux - if (os.indexOf("linux") >= 0) { - // See if the default browser is Konqueror by resolving the symlink. - boolean isDefaultKonqueror = false; - try { - // Find out the location of the x-www-browser link from path. - Process process = runtime.exec("which x-www-browser"); - BufferedInputStream ins = new BufferedInputStream( - process.getInputStream()); - BufferedReader bufreader = new BufferedReader( - new InputStreamReader(ins)); - String defaultLinkPath = bufreader.readLine(); - ins.close(); - - // The path is null if the link did not exist. - if (defaultLinkPath != null) { - // See if the default browser is Konqueror. - File file = new File(defaultLinkPath); - String canonical = file.getCanonicalPath(); - if (canonical.indexOf("konqueror") != -1) { - isDefaultKonqueror = true; - } - } - } catch (IOException e1) { - // The symlink was probably not found, so this is ok. - } - - // Try x-www-browser, which is symlink to the default browser, - // except if we found that it is Konqueror. - if (!started && !isDefaultKonqueror) { - try { - runtime.exec("x-www-browser " + url); - started = true; - } catch (final IOException e) { - } - } - - // Try firefox - if (!started) { - try { - runtime.exec("firefox " + url); - started = true; - } catch (final IOException e) { - } - } - - // Try mozilla - if (!started) { - try { - runtime.exec("mozilla " + url); - started = true; - } catch (final IOException e) { - } - } - - // Try konqueror - if (!started) { - try { - runtime.exec("konqueror " + url); - started = true; - } catch (final IOException e) { - } - } - } - - // OS X - if (os.indexOf("mac os x") >= 0) { - - // Try open - if (!started) { - try { - runtime.exec("open " + url); - started = true; - } catch (final IOException e) { - } - } - } - - // Try cmd /start command on windows - if (os.indexOf("win") >= 0) { - if (!started) { - try { - runtime.exec("cmd /c start " + url); - started = true; - } catch (final IOException e) { - } - } - } - - if (!started) { - System.out.println("Failed to open browser. Please go to " + url); - } - } - -} diff --git a/tests/server-side/com/vaadin/tests/VaadinClasses.java b/tests/server-side/com/vaadin/tests/VaadinClasses.java new file mode 100644 index 0000000000..e02c4f0b6e --- /dev/null +++ b/tests/server-side/com/vaadin/tests/VaadinClasses.java @@ -0,0 +1,236 @@ +package com.vaadin.tests; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.net.JarURLConnection; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Enumeration; +import java.util.List; +import java.util.jar.JarEntry; + +import org.junit.Test; + +import com.vaadin.Application; +import com.vaadin.ui.Component; +import com.vaadin.ui.ComponentContainer; +import com.vaadin.ui.CustomComponent; +import com.vaadin.ui.DragAndDropWrapper; +import com.vaadin.ui.HorizontalSplitPanel; +import com.vaadin.ui.LoginForm; +import com.vaadin.ui.PopupView; +import com.vaadin.ui.SplitPanel; +import com.vaadin.ui.VerticalSplitPanel; +import com.vaadin.ui.Window; + +@SuppressWarnings("deprecation") +public class VaadinClasses { + + public static void main(String[] args) { + System.out.println("ComponentContainers"); + System.out.println("==================="); + for (Class c : getComponentContainers()) { + System.out.println(c.getName()); + } + System.out.println(); + System.out.println("Components"); + System.out.println("=========="); + for (Class c : getComponents()) { + System.out.println(c.getName()); + } + System.out.println(); + System.out.println("Server side classes"); + System.out.println("==================="); + for (Class c : getAllServerSideClasses()) { + System.out.println(c.getName()); + } + } + + public static List> getComponents() { + try { + return findClasses(Component.class, "com.vaadin.ui"); + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public static List> getAllServerSideClasses() { + try { + return findClassesNoTests(Object.class, "com.vaadin", new String[] { + "com.vaadin.tests", "com.vaadin.terminal.gwt.client" }); + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public static List> getComponentContainers() { + try { + return findClasses(ComponentContainer.class, "com.vaadin.ui"); + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + public static List> getComponentContainersSupportingAddRemoveComponent() { + List> classes = getComponentContainers(); + classes.remove(PopupView.class); + classes.remove(CustomComponent.class); + classes.remove(DragAndDropWrapper.class); + classes.remove(CustomComponent.class); + classes.remove(LoginForm.class); + + return classes; + } + + public static List> getComponentContainersSupportingUnlimitedNumberOfComponents() { + List> classes = getComponentContainersSupportingAddRemoveComponent(); + classes.remove(SplitPanel.class); + classes.remove(VerticalSplitPanel.class); + classes.remove(HorizontalSplitPanel.class); + classes.remove(Window.class); + + return classes; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + public static List> getBasicComponentTests() { + try { + // Given as name to avoid dependencies on testbench source folder + return (List) findClasses( + Class.forName("com.vaadin.tests.components.AbstractComponentTest"), + "com.vaadin.tests.components"); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + + } + + private static List> findClasses(Class baseClass, + String basePackage) throws IOException { + return findClasses(baseClass, basePackage, new String[] {}); + } + + private static List> findClasses(Class baseClass, + String basePackage, String[] ignoredPackages) throws IOException { + List> classes = new ArrayList>(); + String basePackageDirName = "/" + basePackage.replace('.', '/'); + URL location = Application.class.getResource(basePackageDirName); + if (location.getProtocol().equals("file")) { + try { + File f = new File(location.toURI()); + if (!f.exists()) { + throw new IOException("Directory " + f.toString() + + " does not exist"); + } + findPackages(f, basePackage, baseClass, classes, + ignoredPackages); + } catch (URISyntaxException e) { + throw new IOException(e.getMessage()); + } + } else if (location.getProtocol().equals("jar")) { + JarURLConnection juc = (JarURLConnection) location.openConnection(); + findPackages(juc, basePackage, baseClass, classes); + } + + Collections.sort(classes, new Comparator>() { + + public int compare(Class o1, Class o2) { + return o1.getName().compareTo(o2.getName()); + } + + }); + return classes; + } + + private static List> findClassesNoTests( + Class baseClass, String basePackage, String[] ignoredPackages) + throws IOException { + List> classes = findClasses(baseClass, basePackage, + ignoredPackages); + List> classesNoTests = new ArrayList>(); + for (Class clazz : classes) { + if (!clazz.getName().contains("Test")) { + boolean testPresent = false; + for (Method method : clazz.getMethods()) { + if (method.isAnnotationPresent(Test.class)) { + testPresent = true; + break; + } + } + if (!testPresent) { + classesNoTests.add(clazz); + } + } + } + return classesNoTests; + } + + private static void findPackages(JarURLConnection juc, + String javaPackage, Class baseClass, + Collection> result) throws IOException { + String prefix = "com/vaadin/ui"; + Enumeration ent = juc.getJarFile().entries(); + while (ent.hasMoreElements()) { + JarEntry e = ent.nextElement(); + if (e.getName().endsWith(".class") + && e.getName().startsWith(prefix)) { + String fullyQualifiedClassName = e.getName().replace('/', '.') + .replace(".class", ""); + addClassIfMatches(result, fullyQualifiedClassName, baseClass); + } + } + } + + private static void findPackages(File parent, String javaPackage, + Class baseClass, Collection> result, + String[] ignoredPackages) { + for (String ignoredPackage : ignoredPackages) { + if (javaPackage.equals(ignoredPackage)) { + return; + } + } + + for (File file : parent.listFiles()) { + if (file.isDirectory()) { + findPackages(file, javaPackage + "." + file.getName(), + baseClass, result, ignoredPackages); + } else if (file.getName().endsWith(".class")) { + String fullyQualifiedClassName = javaPackage + "." + + file.getName().replace(".class", ""); + addClassIfMatches(result, fullyQualifiedClassName, baseClass); + } + } + + } + + @SuppressWarnings("unchecked") + private static void addClassIfMatches( + Collection> result, + String fullyQualifiedClassName, Class baseClass) { + try { + // Try to load the class + + Class c = Class.forName(fullyQualifiedClassName); + if (baseClass.isAssignableFrom(c) + && !Modifier.isAbstract(c.getModifiers())) { + result.add((Class) c); + } + } catch (Exception e) { + // Could ignore that class cannot be loaded + e.printStackTrace(); + } catch (LinkageError e) { + // Ignore. Client side classes will at least throw LinkageErrors + } + + } +} diff --git a/tests/testbench/com/vaadin/launcher/util/BrowserLauncher.java b/tests/testbench/com/vaadin/launcher/util/BrowserLauncher.java new file mode 100644 index 0000000000..55692cb251 --- /dev/null +++ b/tests/testbench/com/vaadin/launcher/util/BrowserLauncher.java @@ -0,0 +1,127 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ + +package com.vaadin.launcher.util; + +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; + +/** + * This class opens default browser for DemoLauncher class. Default browser is + * detected by the operating system. + * + */ +public class BrowserLauncher { + + /** + * Open browser on specified URL. + * + * @param url + */ + public static void openBrowser(String url) { + + final Runtime runtime = Runtime.getRuntime(); + boolean started = false; + + final String os = System.getProperty("os.name", "windows") + .toLowerCase(); + + // Linux + if (os.indexOf("linux") >= 0) { + // See if the default browser is Konqueror by resolving the symlink. + boolean isDefaultKonqueror = false; + try { + // Find out the location of the x-www-browser link from path. + Process process = runtime.exec("which x-www-browser"); + BufferedInputStream ins = new BufferedInputStream( + process.getInputStream()); + BufferedReader bufreader = new BufferedReader( + new InputStreamReader(ins)); + String defaultLinkPath = bufreader.readLine(); + ins.close(); + + // The path is null if the link did not exist. + if (defaultLinkPath != null) { + // See if the default browser is Konqueror. + File file = new File(defaultLinkPath); + String canonical = file.getCanonicalPath(); + if (canonical.indexOf("konqueror") != -1) { + isDefaultKonqueror = true; + } + } + } catch (IOException e1) { + // The symlink was probably not found, so this is ok. + } + + // Try x-www-browser, which is symlink to the default browser, + // except if we found that it is Konqueror. + if (!started && !isDefaultKonqueror) { + try { + runtime.exec("x-www-browser " + url); + started = true; + } catch (final IOException e) { + } + } + + // Try firefox + if (!started) { + try { + runtime.exec("firefox " + url); + started = true; + } catch (final IOException e) { + } + } + + // Try mozilla + if (!started) { + try { + runtime.exec("mozilla " + url); + started = true; + } catch (final IOException e) { + } + } + + // Try konqueror + if (!started) { + try { + runtime.exec("konqueror " + url); + started = true; + } catch (final IOException e) { + } + } + } + + // OS X + if (os.indexOf("mac os x") >= 0) { + + // Try open + if (!started) { + try { + runtime.exec("open " + url); + started = true; + } catch (final IOException e) { + } + } + } + + // Try cmd /start command on windows + if (os.indexOf("win") >= 0) { + if (!started) { + try { + runtime.exec("cmd /c start " + url); + started = true; + } catch (final IOException e) { + } + } + } + + if (!started) { + System.out.println("Failed to open browser. Please go to " + url); + } + } + +} diff --git a/tests/testbench/com/vaadin/tests/Components.java b/tests/testbench/com/vaadin/tests/Components.java index 6987c04a54..d7bc18e2f6 100644 --- a/tests/testbench/com/vaadin/tests/Components.java +++ b/tests/testbench/com/vaadin/tests/Components.java @@ -32,7 +32,7 @@ import com.vaadin.ui.Window; public class Components extends Application { private static final Object CAPTION = "c"; - private Map>, String> tests = new HashMap>, String>(); + private Map, String> tests = new HashMap, String>(); private Tree naviTree; private HorizontalSplitPanel sp; private Window mainWindow; @@ -41,10 +41,9 @@ public class Components extends Application { private List> componentsWithoutTests = new ArrayList>(); { - for (Class> c : VaadinClasses - .getBasicComponentTests()) { + for (Class c : VaadinClasses.getBasicComponentTests()) { String testClass = c.getSimpleName(); - tests.put(c, testClass); + tests.put((Class) c, testClass); } List> componentsWithoutTest = VaadinClasses @@ -171,7 +170,7 @@ public class Components extends Application { hc.setItemSorter(sorter); naviTree.addContainerProperty(CAPTION, String.class, ""); naviTree.setItemCaptionPropertyId(CAPTION); - for (Class> cls : tests.keySet()) { + for (Class cls : tests.keySet()) { addTreeItem(cls); } hc.sort(new Object[] { CAPTION }, new boolean[] { true }); @@ -226,13 +225,13 @@ public class Components extends Application { } @SuppressWarnings("unchecked") - private void addTreeItem(Class> cls) { + private void addTreeItem(Class cls) { String name = tests.get(cls); if (name == null) { name = cls.getSimpleName(); } - Class> superClass = (Class>) cls + Class superClass = (Class) cls .getSuperclass(); // This cast is needed only to make compilation through Ant work .. @@ -249,9 +248,9 @@ public class Components extends Application { } protected Component createTestComponent( - Class> cls) { + Class cls) { try { - AbstractComponentTest t = cls.newInstance(); + AbstractComponentTest t = cls.newInstance(); t.init(); ComponentContainer c = t.getMainWindow().getContent(); t.getMainWindow().setContent(null); diff --git a/tests/testbench/com/vaadin/tests/VaadinClasses.java b/tests/testbench/com/vaadin/tests/VaadinClasses.java deleted file mode 100644 index 0f4e2ff4da..0000000000 --- a/tests/testbench/com/vaadin/tests/VaadinClasses.java +++ /dev/null @@ -1,235 +0,0 @@ -package com.vaadin.tests; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.net.JarURLConnection; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.Enumeration; -import java.util.List; -import java.util.jar.JarEntry; - -import org.junit.Test; - -import com.vaadin.Application; -import com.vaadin.tests.components.AbstractComponentTest; -import com.vaadin.ui.Component; -import com.vaadin.ui.ComponentContainer; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.DragAndDropWrapper; -import com.vaadin.ui.HorizontalSplitPanel; -import com.vaadin.ui.LoginForm; -import com.vaadin.ui.PopupView; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.VerticalSplitPanel; -import com.vaadin.ui.Window; - -@SuppressWarnings("deprecation") -public class VaadinClasses { - - public static void main(String[] args) { - System.out.println("ComponentContainers"); - System.out.println("==================="); - for (Class c : getComponentContainers()) { - System.out.println(c.getName()); - } - System.out.println(); - System.out.println("Components"); - System.out.println("=========="); - for (Class c : getComponents()) { - System.out.println(c.getName()); - } - System.out.println(); - System.out.println("Server side classes"); - System.out.println("==================="); - for (Class c : getAllServerSideClasses()) { - System.out.println(c.getName()); - } - } - - public static List> getComponents() { - try { - return findClasses(Component.class, "com.vaadin.ui"); - } catch (IOException e) { - e.printStackTrace(); - return null; - } - } - - public static List> getAllServerSideClasses() { - try { - return findClassesNoTests(Object.class, "com.vaadin", new String[] { - "com.vaadin.tests", "com.vaadin.terminal.gwt.client" }); - } catch (IOException e) { - e.printStackTrace(); - return null; - } - } - - public static List> getComponentContainers() { - try { - return findClasses(ComponentContainer.class, "com.vaadin.ui"); - } catch (IOException e) { - e.printStackTrace(); - return null; - } - } - - public static List> getComponentContainersSupportingAddRemoveComponent() { - List> classes = getComponentContainers(); - classes.remove(PopupView.class); - classes.remove(CustomComponent.class); - classes.remove(DragAndDropWrapper.class); - classes.remove(CustomComponent.class); - classes.remove(LoginForm.class); - - return classes; - } - - public static List> getComponentContainersSupportingUnlimitedNumberOfComponents() { - List> classes = getComponentContainersSupportingAddRemoveComponent(); - classes.remove(SplitPanel.class); - classes.remove(VerticalSplitPanel.class); - classes.remove(HorizontalSplitPanel.class); - classes.remove(Window.class); - - return classes; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public static List>> getBasicComponentTests() { - try { - return (List) findClasses(AbstractComponentTest.class, - "com.vaadin.tests.components"); - } catch (IOException e) { - e.printStackTrace(); - return null; - } - - } - - private static List> findClasses(Class baseClass, - String basePackage) throws IOException { - return findClasses(baseClass, basePackage, new String[] {}); - } - - private static List> findClasses(Class baseClass, - String basePackage, String[] ignoredPackages) throws IOException { - List> classes = new ArrayList>(); - String basePackageDirName = "/" + basePackage.replace('.', '/'); - URL location = Application.class.getResource(basePackageDirName); - if (location.getProtocol().equals("file")) { - try { - File f = new File(location.toURI()); - if (!f.exists()) { - throw new IOException("Directory " + f.toString() - + " does not exist"); - } - findPackages(f, basePackage, baseClass, classes, - ignoredPackages); - } catch (URISyntaxException e) { - throw new IOException(e.getMessage()); - } - } else if (location.getProtocol().equals("jar")) { - JarURLConnection juc = (JarURLConnection) location.openConnection(); - findPackages(juc, basePackage, baseClass, classes); - } - - Collections.sort(classes, new Comparator>() { - - public int compare(Class o1, Class o2) { - return o1.getName().compareTo(o2.getName()); - } - - }); - return classes; - } - - private static List> findClassesNoTests( - Class baseClass, String basePackage, String[] ignoredPackages) - throws IOException { - List> classes = findClasses(baseClass, basePackage, - ignoredPackages); - List> classesNoTests = new ArrayList>(); - for (Class clazz : classes) { - if (!clazz.getName().contains("Test")) { - boolean testPresent = false; - for (Method method : clazz.getMethods()) { - if (method.isAnnotationPresent(Test.class)) { - testPresent = true; - break; - } - } - if (!testPresent) { - classesNoTests.add(clazz); - } - } - } - return classesNoTests; - } - - private static void findPackages(JarURLConnection juc, - String javaPackage, Class baseClass, - Collection> result) throws IOException { - String prefix = "com/vaadin/ui"; - Enumeration ent = juc.getJarFile().entries(); - while (ent.hasMoreElements()) { - JarEntry e = ent.nextElement(); - if (e.getName().endsWith(".class") - && e.getName().startsWith(prefix)) { - String fullyQualifiedClassName = e.getName().replace('/', '.') - .replace(".class", ""); - addClassIfMatches(result, fullyQualifiedClassName, baseClass); - } - } - } - - private static void findPackages(File parent, String javaPackage, - Class baseClass, Collection> result, - String[] ignoredPackages) { - for (String ignoredPackage : ignoredPackages) { - if (javaPackage.equals(ignoredPackage)) { - return; - } - } - - for (File file : parent.listFiles()) { - if (file.isDirectory()) { - findPackages(file, javaPackage + "." + file.getName(), - baseClass, result, ignoredPackages); - } else if (file.getName().endsWith(".class")) { - String fullyQualifiedClassName = javaPackage + "." - + file.getName().replace(".class", ""); - addClassIfMatches(result, fullyQualifiedClassName, baseClass); - } - } - - } - - @SuppressWarnings("unchecked") - private static void addClassIfMatches( - Collection> result, - String fullyQualifiedClassName, Class baseClass) { - try { - // Try to load the class - - Class c = Class.forName(fullyQualifiedClassName); - if (baseClass.isAssignableFrom(c) - && !Modifier.isAbstract(c.getModifiers())) { - result.add((Class) c); - } - } catch (Exception e) { - // Could ignore that class cannot be loaded - e.printStackTrace(); - } catch (LinkageError e) { - // Ignore. Client side classes will at least throw LinkageErrors - } - - } -} -- cgit v1.2.3 From 69d6bf76820929777168055bf0a941d691463a6b Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Mon, 16 Jan 2012 07:03:15 +0000 Subject: Merge from 6.7 svn changeset:22637/svn branch:6.8 --- WebContent/VAADIN/themes/reindeer-tests/styles.css | 27 ++- .../terminal/gwt/client/ApplicationConnection.java | 139 ++++++++++---- .../vaadin/terminal/gwt/client/ui/VFormLayout.java | 19 +- .../terminal/gwt/client/ui/VPopupCalendar.java | 22 ++- .../terminal/gwt/client/ui/VTextualDate.java | 10 +- .../components/datefield/DatePopupStyleName.html | 32 ++++ .../components/datefield/DatePopupStyleName.java | 33 ++++ .../WidthRecalculationOnEnableStateChange.html | 51 +++++ .../WidthRecalculationOnEnableStateChange.java | 44 +++++ .../formlayout/FormLayoutCaptionStyles.html | 46 +++++ .../formlayout/FormLayoutCaptionStyles.java | 55 ++++++ .../orderedlayout/OrderedLayoutCases.html | 102 ++++++++++ .../orderedlayout/OrderedLayoutCases.java | 171 ++++++++++++++++- .../VerticalLayoutChangingChildrenSizes.html | 211 +++++++++++++++++++++ 14 files changed, 899 insertions(+), 63 deletions(-) create mode 100644 tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.html create mode 100644 tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java create mode 100644 tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.html create mode 100644 tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java create mode 100644 tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.html create mode 100644 tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.java create mode 100644 tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.html create mode 100644 tests/testbench/com/vaadin/tests/components/orderedlayout/VerticalLayoutChangingChildrenSizes.html (limited to 'src') diff --git a/WebContent/VAADIN/themes/reindeer-tests/styles.css b/WebContent/VAADIN/themes/reindeer-tests/styles.css index 7d1727d4ca..243d1b87d4 100644 --- a/WebContent/VAADIN/themes/reindeer-tests/styles.css +++ b/WebContent/VAADIN/themes/reindeer-tests/styles.css @@ -1,4 +1,29 @@ @import url(../reindeer/styles.css); .table-equal-rowheight .v-table-row {height: 30px;} -.table-equal-rowheight .v-table-row-odd {height: 30px;} \ No newline at end of file +.table-equal-rowheight .v-table-row-odd {height: 30px;} + +.v-datefield-enabled-readonly-styled { + background: #ddd; +} + +.v-datefield-enabled-readonly-styled input.v-datefield-textfield { + border: 1px solid black; +} + +.v-datefield-enabled-readonly-styled .v-datefield.v-disabled { + opacity: 1; +} + +.v-disabled.v-datefield-enabled-readonly-styled .v-datefield-button, +.v-readonly.v-datefield-enabled-readonly-styled .v-datefield-button { + display: none; +} + +.popup-style .v-datefield-calendarpanel-header, +.v-datefield-popup-popup-style .v-datefield-calendarpanel-time { + background: red; +} +.popup-style .v-datefield-calendarpanel-body { + background: yellow; +} diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index 89952afe8c..0bb311600c 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -22,6 +22,8 @@ import com.google.gwt.http.client.RequestBuilder; import com.google.gwt.http.client.RequestCallback; import com.google.gwt.http.client.RequestException; import com.google.gwt.http.client.Response; +import com.google.gwt.regexp.shared.MatchResult; +import com.google.gwt.regexp.shared.RegExp; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Element; @@ -94,6 +96,27 @@ public class ApplicationConnection { public static final String ATTRIBUTE_DESCRIPTION = "description"; public static final String ATTRIBUTE_ERROR = "error"; + /** + * A string that, if found in a non-JSON response to a UIDL request, will + * cause the browser to refresh the page. If followed by a colon, optional + * whitespace, and a URI, causes the browser to synchronously load the URI. + * + *

+ * This allows, for instance, a servlet filter to redirect the application + * to a custom login page when the session expires. For example: + *

+ * + *
+     * if (sessionExpired) {
+     *     response.setHeader("Content-Type", "text/html");
+     *     response.getWriter().write(
+     *             myLoginPageHtml + "<!-- Vaadin-Refresh: "
+     *                     + request.getContextPath() + " -->");
+     * }
+     * 
+ */ + public static final String UIDL_REFRESH_TOKEN = "Vaadin-Refresh"; + // will hold the UIDL security key (for XSS protection) once received private String uidlSecurityKey = "init"; @@ -513,6 +536,27 @@ public class ApplicationConnection { return; } + String contentType = response.getHeader("Content-Type"); + if (contentType == null + || !contentType.startsWith("application/json")) { + /* + * A servlet filter or equivalent may have intercepted + * the request and served non-UIDL content (for + * instance, a login page if the session has expired.) + * If the response contains a magic substring, do a + * synchronous refresh. + */ + MatchResult refreshToken = RegExp.compile( + UIDL_REFRESH_TOKEN + "(:\\s*(.*?))?(\\s|$)") + .exec(response.getText()); + if (refreshToken != null) { + redirect(refreshToken.getGroup(2)); + VConsole.log("*** REDIRECT : " + + refreshToken.getGroup(2)); + return; + } + } + final Date start = new Date(); // for(;;);[realjson] final String jsonText = response.getText().substring(9, @@ -1812,9 +1856,60 @@ public class ApplicationConnection { fw.setEnabled(enabled); } + TooltipInfo tooltipInfo = componentDetail.getTooltipInfo(null); + // Update tooltip + if (uidl.hasAttribute(ATTRIBUTE_DESCRIPTION)) { + tooltipInfo + .setTitle(uidl.getStringAttribute(ATTRIBUTE_DESCRIPTION)); + } else { + tooltipInfo.setTitle(null); + } + + // add error classname to components w/ error + if (uidl.hasAttribute(ATTRIBUTE_ERROR)) { + tooltipInfo.setErrorUidl(uidl.getErrors()); + } else { + tooltipInfo.setErrorUidl(null); + } + + // Style names + component.setStyleName(getStyleName(component.getStylePrimaryName(), + uidl, component instanceof Field)); + + // Set captions + if (manageCaption) { + final Container parent = Util.getLayout(component); + if (parent != null) { + parent.updateCaption((Paintable) component, uidl); + } + } + /* + * updateComponentSize need to be after caption update so caption can be + * taken into account + */ + + updateComponentSize(componentDetail, uidl); + + return false; + } + + /** + * Generates the style name for the widget based on the given primary style + * name (typically returned by Widget.getPrimaryStyleName()) and the UIDL. + * An additional "modified" style name can be added if the field parameter + * is set to true. + * + * @param primaryStyleName + * @param uidl + * @param isField + * @return + */ + public static String getStyleName(String primaryStyleName, UIDL uidl, + boolean field) { + boolean enabled = !uidl.getBooleanAttribute("disabled"); + StringBuffer styleBuf = new StringBuffer(); - final String primaryName = component.getStylePrimaryName(); - styleBuf.append(primaryName); + styleBuf.append(primaryStyleName); // first disabling and read-only status if (!enabled) { @@ -1832,7 +1927,7 @@ public class ApplicationConnection { final String[] styles = uidl.getStringAttribute("style").split(" "); for (int i = 0; i < styles.length; i++) { styleBuf.append(" "); - styleBuf.append(primaryName); + styleBuf.append(primaryStyleName); styleBuf.append("-"); styleBuf.append(styles[i]); styleBuf.append(" "); @@ -1841,55 +1936,25 @@ public class ApplicationConnection { } // add modified classname to Fields - if (uidl.hasAttribute("modified") && component instanceof Field) { + if (field && uidl.hasAttribute("modified")) { styleBuf.append(" "); styleBuf.append(MODIFIED_CLASSNAME); } - TooltipInfo tooltipInfo = componentDetail.getTooltipInfo(null); - // Update tooltip - if (uidl.hasAttribute(ATTRIBUTE_DESCRIPTION)) { - tooltipInfo - .setTitle(uidl.getStringAttribute(ATTRIBUTE_DESCRIPTION)); - } else { - tooltipInfo.setTitle(null); - } - - // add error classname to components w/ error if (uidl.hasAttribute(ATTRIBUTE_ERROR)) { - tooltipInfo.setErrorUidl(uidl.getErrors()); styleBuf.append(" "); - styleBuf.append(primaryName); + styleBuf.append(primaryStyleName); styleBuf.append(ERROR_CLASSNAME_EXT); - } else { - tooltipInfo.setErrorUidl(null); } - // add required style to required components if (uidl.hasAttribute("required")) { styleBuf.append(" "); - styleBuf.append(primaryName); + styleBuf.append(primaryStyleName); styleBuf.append(REQUIRED_CLASSNAME_EXT); } - // Styles + disabled & readonly - component.setStyleName(styleBuf.toString()); - - // Set captions - if (manageCaption) { - final Container parent = Util.getLayout(component); - if (parent != null) { - parent.updateCaption((Paintable) component, uidl); - } - } - /* - * updateComponentSize need to be after caption update so caption can be - * taken into account - */ - - updateComponentSize(componentDetail, uidl); + return styleBuf.toString(); - return false; } private void updateComponentSize(ComponentDetail cd, UIDL uidl) { diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFormLayout.java b/src/com/vaadin/terminal/gwt/client/ui/VFormLayout.java index 9f9c6ffbba..d31d1acdd6 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VFormLayout.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VFormLayout.java @@ -114,8 +114,7 @@ public class VFormLayout extends SimplePanel implements Container { final Paintable p = client.getPaintable(childUidl); Caption caption = componentToCaption.get(p); if (caption == null) { - caption = new Caption(p, client, - getStylesFromUIDL(childUidl)); + caption = new Caption(p, client); caption.addClickHandler(this); componentToCaption.put(p, caption); } @@ -197,7 +196,7 @@ public class VFormLayout extends SimplePanel implements Container { if (oldComponent == candidate) { Caption oldCap = componentToCaption.get(oldComponent); final Caption newCap = new Caption( - (Paintable) newComponent, client, null); + (Paintable) newComponent, client); newCap.addClickHandler(this); newCap.setStyleName(oldCap.getStyleName()); componentToCaption.put((Paintable) newComponent, newCap); @@ -319,12 +318,15 @@ public class VFormLayout extends SimplePanel implements Container { * return null * @param client */ - public Caption(Paintable component, ApplicationConnection client, - String[] styles) { + public Caption(Paintable component, ApplicationConnection client) { super(); this.client = client; owner = component; + sinkEvents(VTooltip.TOOLTIP_EVENTS); + } + + private void setStyles(String[] styles) { String style = CLASSNAME; if (styles != null) { for (int i = 0; i < styles.length; i++) { @@ -332,16 +334,13 @@ public class VFormLayout extends SimplePanel implements Container { } } setStyleName(style); - - sinkEvents(VTooltip.TOOLTIP_EVENTS); } public void updateCaption(UIDL uidl) { setVisible(!uidl.getBooleanAttribute("invisible")); - setStyleName(getElement(), - ApplicationConnection.DISABLED_CLASSNAME, - uidl.hasAttribute("disabled")); + // Update styles as they might have changed when the caption changed + setStyles(getStylesFromUIDL(uidl)); boolean isEmpty = true; diff --git a/src/com/vaadin/terminal/gwt/client/ui/VPopupCalendar.java b/src/com/vaadin/terminal/gwt/client/ui/VPopupCalendar.java index 150831d4ed..549248aab3 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VPopupCalendar.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VPopupCalendar.java @@ -45,6 +45,9 @@ import com.vaadin.terminal.gwt.client.ui.VCalendarPanel.TimeChangeListener; public class VPopupCalendar extends VTextualDate implements Paintable, Field, ClickHandler, CloseHandler, SubPartAware { + private static final String POPUP_PRIMARY_STYLE_NAME = VDateField.CLASSNAME + + "-popup"; + private final Button calendarToggle; private VCalendarPanel calendar; @@ -90,7 +93,7 @@ public class VPopupCalendar extends VTextualDate implements Paintable, Field, }); popup = new VOverlay(true, true, true); - popup.setStyleName(VDateField.CLASSNAME + "-popup"); + popup.setStyleName(POPUP_PRIMARY_STYLE_NAME); popup.setWidget(calendar); popup.addCloseHandler(this); @@ -154,13 +157,18 @@ public class VPopupCalendar extends VTextualDate implements Paintable, Field, @SuppressWarnings("deprecation") public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { boolean lastReadOnlyState = readonly; + boolean lastEnabledState = isEnabled(); + parsable = uidl.getBooleanAttribute("parsable"); super.updateFromUIDL(uidl, client); - popup.setStyleName(VDateField.CLASSNAME + "-popup " - + VDateField.CLASSNAME + "-" - + resolutionToString(currentResolution)); + String popupStyleNames = ApplicationConnection.getStyleName( + POPUP_PRIMARY_STYLE_NAME, uidl, false); + popupStyleNames += " " + VDateField.CLASSNAME + "-" + + resolutionToString(currentResolution); + popup.setStyleName(popupStyleNames); + calendar.setDateTimeService(getDateTimeService()); calendar.setShowISOWeekNumbers(isShowISOWeekNumbers()); if (calendar.getResolution() != currentResolution) { @@ -216,7 +224,11 @@ public class VPopupCalendar extends VTextualDate implements Paintable, Field, calendarToggle.removeStyleName(CLASSNAME + "-button-readonly"); } - if (lastReadOnlyState != readonly) { + if (lastReadOnlyState != readonly || lastEnabledState != isEnabled()) { + // Enabled or readonly state changed. Differences in theming might + // affect the width (for instance if the popup button is hidden) so + // we have to recalculate the width (IF the width of the field is + // fixed) updateWidth(); } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTextualDate.java b/src/com/vaadin/terminal/gwt/client/ui/VTextualDate.java index ff4378aedf..fb41829efc 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTextualDate.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTextualDate.java @@ -384,8 +384,16 @@ public class VTextualDate extends VDateField implements Paintable, Field, return fieldExtraWidth; } + /** + * Force an recalculation of the width of the component IF the width has + * been defined. Does nothing if width is undefined as the width will be + * automatically adjusted by the browser. + */ public void updateWidth() { - needLayout = true; + if (!needLayout) { + return; + } + fieldExtraWidth = -1; iLayout(); } diff --git a/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.html b/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.html new file mode 100644 index 0000000000..f367fc383b --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.html @@ -0,0 +1,32 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.datefield.DatePopupStyleName?&restartApplication
mouseClickvaadin=runcomvaadintestscomponentsdatefieldDatePopupStyleName::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton4,10
screenCapturestyled-popup
+ + diff --git a/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java b/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java new file mode 100644 index 0000000000..ba4e324dc1 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java @@ -0,0 +1,33 @@ +package com.vaadin.tests.components.datefield; + +import java.util.Date; + +import com.vaadin.terminal.UserError; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.DateField; + +public class DatePopupStyleName extends TestBase { + @Override + public void setup() { + setTheme("reindeer-tests"); + + final DateField df = new DateField(); + df.setValue(new Date(1203910239L)); + df.setWidth("200px"); + df.setRequired(true); + df.setComponentError(new UserError("abc")); + df.addStyleName("popup-style"); + addComponent(df); + } + + @Override + protected String getDescription() { + return "The DateField is given a style name 'test', but that style isn't applied on the calendar popup element."; + } + + @Override + protected Integer getTicketNumber() { + return 8083; + } + +} diff --git a/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.html b/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.html new file mode 100644 index 0000000000..70441efd9f --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.html @@ -0,0 +1,51 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.datefield.WidthRecalculationOnEnableStateChange?restartApplication
clickvaadin=runcomvaadintestscomponentsdatefieldWidthRecalculationOnEnableStateChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapturedisabled
clickvaadin=runcomvaadintestscomponentsdatefieldWidthRecalculationOnEnableStateChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCaptureenabled
clickvaadin=runcomvaadintestscomponentsdatefieldWidthRecalculationOnEnableStateChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
screenCapturereadonly
+ + diff --git a/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java b/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java new file mode 100644 index 0000000000..f25a9f0350 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java @@ -0,0 +1,44 @@ +package com.vaadin.tests.components.datefield; + +import java.util.Date; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.DateField; + +public class WidthRecalculationOnEnableStateChange extends TestBase { + @Override + public void setup() { + setTheme("reindeer-tests"); + + final DateField df = new DateField(); + df.setValue(new Date(1203910239L)); + df.setWidth("200px"); + df.addStyleName("enabled-readonly-styled"); + addComponent(df); + addComponent(new Button("Toggle disabled for date field", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + df.setEnabled(!df.isEnabled()); + } + })); + addComponent(new Button("Toggle read only for date field", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + df.setReadOnly(!df.isReadOnly()); + } + })); + } + + @Override + protected String getDescription() { + return "Setting the disabled state doesn't recalculate the input element width. Setting the read-only state instead recalculates the width. In both cases, the popup button is hidden using CSS.

The DateField is also given a style name 'test', but that style isn't applied on the calendar popup element."; + } + + @Override + protected Integer getTicketNumber() { + return 8085; + } + +} diff --git a/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.html b/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.html new file mode 100644 index 0000000000..14b5cc4c53 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.html @@ -0,0 +1,46 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.formlayout.FormLayoutCaptionStyles?restartApplication
assertCSSClassvaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]v-caption-bold
assertCSSClassvaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[1]bold
clickvaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VButton[0]/domChild[0]/domChild[0]
assertNotCSSClassvaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[1]bold
assertNotCSSClassvaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]v-caption-bold
+ + diff --git a/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.java b/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.java new file mode 100644 index 0000000000..e74969f637 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.java @@ -0,0 +1,55 @@ +package com.vaadin.tests.components.formlayout; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.FormLayout; +import com.vaadin.ui.TextField; + +public class FormLayoutCaptionStyles extends TestBase { + + @Override + protected void setup() { + setTheme("reindeer-tests"); + FormLayout fl = new FormLayout(); + + TextField f1 = createTextField("Text field 1", ""); + final TextField f2 = createTextField("Text field 2", "bold"); + + fl.addComponent(f1); + fl.addComponent(new Button("Toggle Text field 2 bold style", + new Button.ClickListener() { + + public void buttonClick(ClickEvent event) { + if ("bold".equals(f2.getStyleName())) { + f2.setStyleName(""); + } else { + f2.setStyleName("bold"); + } + + } + + })); + fl.addComponent(f2); + + addComponent(fl); + + } + + private TextField createTextField(String caption, String style) { + TextField tf = new TextField(caption); + tf.setStyleName(style); + return tf; + } + + @Override + protected String getDescription() { + return "The component style should be copied to the caption element. Changing the component style should update the caption style also"; + } + + @Override + protected Integer getTicketNumber() { + return 5982; + } + +} diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.html b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.html new file mode 100644 index 0000000000..9e1400521b --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.html @@ -0,0 +1,102 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.orderedlayout.OrderedLayoutCases?restartApplication
clickvaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
screenCapture1-undefined-without-relative
clickvaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
screenCapture2-undefined-with-relative
clickvaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]
screenCapture3-fixed-with-overflow
clickvaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]
screenCapture4-fixed-with-extra-space
clickvaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[7]/VButton[0]/domChild[0]
screenCapture8-undefined-relative-height
clickvaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[6]/VButton[0]/domChild[0]/domChild[0]
screenCapture7-fixed-relative-height
clickvaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]/domChild[0]
screenCapture6-multiple-expands
clickvaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]
screenCapture5-expand-with-alignment
+ + diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java index d8b01c4099..dae44e3299 100644 --- a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java +++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java @@ -11,17 +11,21 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.TestUtils; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Alignment; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Component; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.NativeSelect; import com.vaadin.ui.VerticalLayout; public class OrderedLayoutCases extends TestBase { - private static final String[] dimensionValues = { "-1px", "5px", "300px", + private static final String[] dimensionValues = { "-1px", "5px", "350px", "800px", "100%", "50%" }; private static class SampleChild extends VerticalLayout { public SampleChild() { - setStyleName("showBorders"); + setStyleName("sampleChild"); addComponent(createSimpleSelector("Child width", new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { @@ -101,18 +105,24 @@ public class OrderedLayoutCases extends TestBase { } private AbstractOrderedLayout currentLayout; + private HorizontalLayout sizeBar; @Override - public void setup() { - TestUtils.injectCSS(getMainWindow(), - ".showBorders {border: 1px solid black};"); + protected void setup() { + TestUtils + .injectCSS( + getMainWindow(), + ".sampleChild, .theLayout {border: 1px solid black;}" + + ".theLayout > div > div:first-child {background: aqua;}" + + ".theLayout > div > div:first-child + div {background: yellow;}" + + ".theLayout > div > div:first-child + div + div {background: lightgrey;}"); currentLayout = new HorizontalLayout(); for (int i = 0; i < 3; i++) { currentLayout.addComponent(new SampleChild()); } - HorizontalLayout sizeBar = new HorizontalLayout(); + sizeBar = new HorizontalLayout(); sizeBar.setSpacing(true); sizeBar.addComponent(createSimpleSelector("Layout width", @@ -129,6 +139,20 @@ public class OrderedLayoutCases extends TestBase { .toString()); } }, dimensionValues)); + sizeBar.addComponent(createSimpleSelector("Spacing", + new ValueChangeListener() { + public void valueChange(ValueChangeEvent event) { + currentLayout.setSpacing(Boolean.parseBoolean(event + .getProperty().getValue().toString())); + } + }, "false", "true")); + sizeBar.addComponent(createSimpleSelector("Margin", + new ValueChangeListener() { + public void valueChange(ValueChangeEvent event) { + currentLayout.setMargin(Boolean.parseBoolean(event + .getProperty().getValue().toString())); + } + }, "false", "true")); sizeBar.addComponent(createSimpleSelector("Direction", new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { @@ -145,7 +169,7 @@ public class OrderedLayoutCases extends TestBase { newLayout.addComponent(currentLayout .getComponent(0)); } - newLayout.setStyleName("showBorders"); + newLayout.setStyleName("theLayout"); newLayout.setHeight(currentLayout.getHeight(), currentLayout.getHeightUnits()); @@ -157,15 +181,145 @@ public class OrderedLayoutCases extends TestBase { } }, "Horizontal", "Vertical")); + HorizontalLayout caseBar = new HorizontalLayout(); + caseBar.addComponent(new Button("Undefined without relative", + new ClickListener() { + public void buttonClick(ClickEvent event) { + resetState(); + // width: 350px to middle child + setChildState(1, 0, 2); + } + })); + caseBar.addComponent(new Button("Undefined with relative", + new ClickListener() { + public void buttonClick(ClickEvent event) { + resetState(); + // width: 100% to middle child + setChildState(1, 0, 4); + } + })); + caseBar.addComponent(new Button("Fixed with overflow", + new ClickListener() { + public void buttonClick(ClickEvent event) { + resetState(); + // layout width: 350px + setState(sizeBar, 0, 2); + // layout margin enabled + setState(sizeBar, 3, 1); + } + })); + caseBar.addComponent(new Button("Fixed with extra space", + new ClickListener() { + public void buttonClick(ClickEvent event) { + resetState(); + // Layout width: 800px + setState(sizeBar, 0, 3); + // layout margin enabled + setState(sizeBar, 3, 1); + // width: 350px to middle child + setChildState(1, 0, 2); + } + })); + + caseBar.addComponent(new Button("Expand with alignment", + new ClickListener() { + public void buttonClick(ClickEvent event) { + resetState(); + // Layout width: 800px + setState(sizeBar, 0, 3); + // Layout height: 350px + setState(sizeBar, 1, 2); + // Expand: 1 to middle child + setChildState(1, 3, 1); + // Align bottom left to middle child + setChildState(1, 4, 6); + } + })); + + caseBar.addComponent(new Button("Multiple expands", + new ClickListener() { + public void buttonClick(ClickEvent event) { + resetState(); + // Layout width: 800px + setState(sizeBar, 0, 3); + // Layout height: 350px + setState(sizeBar, 1, 2); + // Width 350px to middle child + setChildState(1, 0, 2); + // Apply to left and middle child + for (int i = 0; i < 2; i++) { + // Expand: 1 + setChildState(i, 3, 1); + // Align: middle center + setChildState(i, 4, 5); + } + } + })); + + caseBar.addComponent(new Button("Fixed + relative height", + new ClickListener() { + public void buttonClick(ClickEvent event) { + resetState(); + // Layout height: 100% + setState(sizeBar, 1, 4); + // Height: 350px to left child + setChildState(0, 1, 2); + // Height: 100% to middle child + setChildState(1, 1, 4); + } + })); + + caseBar.addComponent(new Button("Undefined + relative height", + new ClickListener() { + public void buttonClick(ClickEvent event) { + resetState(); + // Height: 350px to left child + setChildState(0, 1, 2); + // Height: 100% to middle child + setChildState(1, 1, 4); + } + })); + + caseBar.setSpacing(true); + + addComponent(caseBar); addComponent(sizeBar); addComponent(currentLayout); getLayout().setSpacing(true); - getMainWindow().getContent().setSizeFull(); + getLayout().getParent().setSizeFull(); getLayout().setSizeFull(); getLayout().setExpandRatio(currentLayout, 1); } + private void resetState() { + for (int i = 0; i < sizeBar.getComponentCount(); i++) { + setState(sizeBar, i, 0); + } + for (int i = 0; i < 3; i++) { + // Child width and height -> -1px + SampleChild child = (SampleChild) currentLayout.getComponent(i); + for (int j = 0; j < child.getComponentCount(); j++) { + if (j == 4) { + setState(child, j, 1); + } else { + setState(child, j, 0); + } + } + } + } + + private void setChildState(int childIndex, int selectIndex, int valueIndex) { + Component child = currentLayout.getComponent(childIndex); + setState(child, selectIndex, valueIndex); + } + + private static void setState(Component container, int selectIndex, int value) { + NativeSelect select = (NativeSelect) ((AbstractOrderedLayout) container) + .getComponent(selectIndex); + select.setValue(new ArrayList(select.getItemIds()).get(value)); + } + private static NativeSelect createSimpleSelector(String caption, ValueChangeListener listener, String... values) { return createSimpleSelector(caption, listener, Arrays.asList(values), @@ -185,7 +339,6 @@ public class OrderedLayoutCases extends TestBase { @Override protected Integer getTicketNumber() { - // TODO Auto-generated method stub return null; } diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/VerticalLayoutChangingChildrenSizes.html b/tests/testbench/com/vaadin/tests/components/orderedlayout/VerticalLayoutChangingChildrenSizes.html new file mode 100644 index 0000000000..edcf60176d --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/VerticalLayoutChangingChildrenSizes.html @@ -0,0 +1,211 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.orderedlayout.VerticalLayoutTest?restartApplication
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item128,5
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item030,8
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item041,8
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item384,6
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item043,6
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item068,8
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item030,11
screenCaptureauto-auto-one-button
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item035,11
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item385,5
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item083,3
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item128,7
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item140,10
screenCaptureauto-auto-two-buttons
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item042,6
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item377,6
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item2115,7
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item072,8
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item414,2
screenCaptureauto-auto-two-buttons-equal-width
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item022,9
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3117,9
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item3104,8
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item174,12
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item223,8
screenCaptureauto-auto-two-buttons-lower-higher
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item024,11
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3104,12
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item2114,10
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item087,11
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item017,8
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item028,3
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item377,8
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item396,6
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item175,10
mouseClickvaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item019,3
screenCaptureauto-auto-two-buttons
+ + -- cgit v1.2.3 From 22eb633dcb50ea7ce302cdf4a0af127e44bf36f6 Mon Sep 17 00:00:00 2001 From: Marc Englund Date: Wed, 18 Jan 2012 14:06:23 +0000 Subject: Merged patch found in #7111 from 6.7, also for #5095 #5096 #6996 svn changeset:22691/svn branch:6.8 --- WebContent/VAADIN/themes/base/tabsheet/tabsheet.css | 6 +++++- WebContent/VAADIN/themes/chameleon/components/tabsheet/tabsheet.css | 1 - WebContent/VAADIN/themes/reindeer/tabsheet/tabsheet-scroller.css | 1 - src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java | 5 ++++- 4 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/WebContent/VAADIN/themes/base/tabsheet/tabsheet.css b/WebContent/VAADIN/themes/base/tabsheet/tabsheet.css index 6fae7381a1..0cae436002 100644 --- a/WebContent/VAADIN/themes/base/tabsheet/tabsheet.css +++ b/WebContent/VAADIN/themes/base/tabsheet/tabsheet.css @@ -95,7 +95,11 @@ padding: 0.2em 0.5em; } .v-tabsheet-tabitem .v-caption { - cursor: pointer; + cursor: inherit; +} +.v-tabsheet.v-disabled .v-tabsheet-tabitem, +.v-tabsheet-tabitemcell-disabled .v-tabsheet-tabitem { + cursor: default; } .v-tabsheet-tabitem-selected { cursor: default; diff --git a/WebContent/VAADIN/themes/chameleon/components/tabsheet/tabsheet.css b/WebContent/VAADIN/themes/chameleon/components/tabsheet/tabsheet.css index 1c52c27576..4ca7359094 100644 --- a/WebContent/VAADIN/themes/chameleon/components/tabsheet/tabsheet.css +++ b/WebContent/VAADIN/themes/chameleon/components/tabsheet/tabsheet.css @@ -105,7 +105,6 @@ width: 16px; height: 14px; overflow: hidden; - cursor: default; opacity: .5; filter: alpha(opacity=50); } diff --git a/WebContent/VAADIN/themes/reindeer/tabsheet/tabsheet-scroller.css b/WebContent/VAADIN/themes/reindeer/tabsheet/tabsheet-scroller.css index 217676558e..18ad5c9194 100644 --- a/WebContent/VAADIN/themes/reindeer/tabsheet/tabsheet-scroller.css +++ b/WebContent/VAADIN/themes/reindeer/tabsheet/tabsheet-scroller.css @@ -24,7 +24,6 @@ width: 18px; height: 17px; overflow: hidden; - cursor: default; } .v-tabsheet-scroller button::-moz-focus-inner { border: none; diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java b/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java index 6c912fec19..d30d999d16 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java @@ -52,7 +52,7 @@ public class VTabsheet extends VTabsheetBase { /** * Representation of a single "tab" shown in the TabBar - * + * */ private static class Tab extends SimplePanel { private static final String TD_CLASSNAME = CLASSNAME + "-tabitemcell"; @@ -62,6 +62,8 @@ public class VTabsheet extends VTabsheetBase { + "-selected"; private static final String TD_SELECTED_FIRST_CLASSNAME = TD_SELECTED_CLASSNAME + "-first"; + private static final String TD_DISABLED_CLASSNAME = TD_CLASSNAME + + "-disabled"; private static final String DIV_CLASSNAME = CLASSNAME + "-tabitem"; private static final String DIV_SELECTED_CLASSNAME = DIV_CLASSNAME @@ -114,6 +116,7 @@ public class VTabsheet extends VTabsheetBase { public void setEnabledOnServer(boolean enabled) { enabledOnServer = enabled; + setStyleName(td, TD_DISABLED_CLASSNAME, !enabled); } public void addClickHandler(ClickHandler handler) { -- cgit v1.2.3 From 2cb8d5f1573454a5342ef3b131b344bc41fcd33c Mon Sep 17 00:00:00 2001 From: Marc Englund Date: Wed, 18 Jan 2012 15:41:54 +0000 Subject: Merged patch from 6.7 for #5093 and #5094 (cursors for dragging/resizing subwindows) svn changeset:22695/svn branch:6.8 --- WebContent/VAADIN/themes/base/window/window.css | 15 +++- src/com/vaadin/terminal/gwt/client/ui/VWindow.java | 88 ++++++++++++++++------ 2 files changed, 79 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/WebContent/VAADIN/themes/base/window/window.css b/WebContent/VAADIN/themes/base/window/window.css index d4c03bd82e..398238426e 100644 --- a/WebContent/VAADIN/themes/base/window/window.css +++ b/WebContent/VAADIN/themes/base/window/window.css @@ -2,10 +2,15 @@ background: #fff; } .v-window-outerheader { - cursor: move; padding: 0.3em 1em; height: 1em; } + +.v-window-outerheader, +.v-window-draggingCurtain { + cursor: move; +} + .v-window-header { font-weight: bold; } @@ -40,16 +45,22 @@ div.v-window-header { zoom: 1; height: 10px; position: relative; + cursor: move; } .v-window-resizebox { width: 10px; height: 10px; - cursor: se-resize; background: #ddd; overflow: hidden; position: absolute; right: 0; } + +.v-window-resizebox, +.v-window-resizingCurtain { + cursor: se-resize; +} + .v-window div.v-window-footer-noresize { height: 0; } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VWindow.java b/src/com/vaadin/terminal/gwt/client/ui/VWindow.java index 54a151c7e7..7b9ece24c9 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VWindow.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VWindow.java @@ -141,6 +141,7 @@ public class VWindow extends VOverlay implements Container, private Element modalityCurtain; private Element draggingCurtain; + private Element resizingCurtain; private Element headerText; @@ -575,12 +576,17 @@ public class VWindow extends VOverlay implements Container, this.draggable = draggable; + setCursorProperties(); + } + + private void setCursorProperties() { if (!this.draggable) { header.getStyle().setProperty("cursor", "default"); + footer.getStyle().setProperty("cursor", "default"); } else { header.getStyle().setProperty("cursor", ""); + footer.getStyle().setProperty("cursor", ""); } - } private void setNaturalWidth() { @@ -771,32 +777,70 @@ public class VWindow extends VOverlay implements Container, } /* - * Shows (or hides) an empty div on top of all other content; used when - * resizing or moving, so that iframes (etc) do not steal event. + * Shows an empty div on top of all other content; used when moving, so that + * iframes (etc) do not steal event. */ - private void showDraggingCurtain(boolean show) { - if (show && draggingCurtain == null) { + private void showDraggingCurtain() { + setFF2CaretFixEnabled(false); // makes FF2 slow - setFF2CaretFixEnabled(false); // makes FF2 slow + DOM.appendChild(RootPanel.getBodyElement(), getDraggingCurtain()); + } - draggingCurtain = DOM.createDiv(); - DOM.setStyleAttribute(draggingCurtain, "position", "absolute"); - DOM.setStyleAttribute(draggingCurtain, "top", "0px"); - DOM.setStyleAttribute(draggingCurtain, "left", "0px"); - DOM.setStyleAttribute(draggingCurtain, "width", "100%"); - DOM.setStyleAttribute(draggingCurtain, "height", "100%"); - DOM.setStyleAttribute(draggingCurtain, "zIndex", "" - + VOverlay.Z_INDEX); + private void hideDraggingCurtain() { + if (draggingCurtain != null) { + setFF2CaretFixEnabled(true); // makes FF2 slow - DOM.appendChild(RootPanel.getBodyElement(), draggingCurtain); - } else if (!show && draggingCurtain != null) { + DOM.removeChild(RootPanel.getBodyElement(), draggingCurtain); + } + } + + /* + * Shows an empty div on top of all other content; used when resizing, so + * that iframes (etc) do not steal event. + */ + private void showResizingCurtain() { + setFF2CaretFixEnabled(false); // makes FF2 slow + + DOM.appendChild(RootPanel.getBodyElement(), getResizingCurtain()); + } + private void hideResizingCurtain() { + if (resizingCurtain != null) { setFF2CaretFixEnabled(true); // makes FF2 slow - DOM.removeChild(RootPanel.getBodyElement(), draggingCurtain); - draggingCurtain = null; + DOM.removeChild(RootPanel.getBodyElement(), resizingCurtain); + } + } + + private Element getDraggingCurtain() { + if (draggingCurtain == null) { + draggingCurtain = createCurtain(); + draggingCurtain.setClassName(CLASSNAME + "-draggingCurtain"); + } + + return draggingCurtain; + } + + private Element getResizingCurtain() { + if (resizingCurtain == null) { + resizingCurtain = createCurtain(); + resizingCurtain.setClassName(CLASSNAME + "-resizingCurtain"); } + return resizingCurtain; + } + + private Element createCurtain() { + Element curtain = DOM.createDiv(); + + DOM.setStyleAttribute(curtain, "position", "absolute"); + DOM.setStyleAttribute(curtain, "top", "0px"); + DOM.setStyleAttribute(curtain, "left", "0px"); + DOM.setStyleAttribute(curtain, "width", "100%"); + DOM.setStyleAttribute(curtain, "height", "100%"); + DOM.setStyleAttribute(curtain, "zIndex", "" + VOverlay.Z_INDEX); + + return curtain; } private void setResizable(boolean resizability) { @@ -916,7 +960,7 @@ public class VWindow extends VOverlay implements Container, if (!isActive()) { bringToFront(); } - showDraggingCurtain(true); + showResizingCurtain(); if (BrowserInfo.get().isIE()) { DOM.setStyleAttribute(resizeBox, "visibility", "hidden"); } @@ -934,7 +978,7 @@ public class VWindow extends VOverlay implements Container, case Event.ONTOUCHCANCEL: DOM.releaseCapture(getElement()); case Event.ONLOSECAPTURE: - showDraggingCurtain(false); + hideResizingCurtain(); if (BrowserInfo.get().isIE()) { DOM.setStyleAttribute(resizeBox, "visibility", ""); } @@ -1180,7 +1224,7 @@ public class VWindow extends VOverlay implements Container, private void beginMovingWindow(Event event) { if (draggable) { - showDraggingCurtain(true); + showDraggingCurtain(); dragging = true; startX = Util.getTouchOrMouseClientX(event); startY = Util.getTouchOrMouseClientY(event); @@ -1193,7 +1237,7 @@ public class VWindow extends VOverlay implements Container, private void stopMovingWindow() { dragging = false; - showDraggingCurtain(false); + hideDraggingCurtain(); DOM.releaseCapture(getElement()); } -- cgit v1.2.3 From 272923e03232e07cca23abf51618c819807122e1 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Fri, 20 Jan 2012 10:30:03 +0000 Subject: Merge from 6.7 svn changeset:22729/svn branch:6.8 --- .../vaadin/terminal/gwt/client/VDebugConsole.java | 6 ++++-- .../vaadin/terminal/gwt/client/ui/VFormLayout.java | 16 +++++++++++---- .../terminal/gwt/client/ui/VTextualDate.java | 24 ++++++++++++++-------- tests/integration_base_files/cleanup.sh | 3 ++- tests/integration_base_files/lock_age.sh | 2 +- tests/integration_tests.xml | 8 ++++++++ tests/test.xml | 2 +- .../combobox/ComboBoxIdenticalItems.html | 6 +++++- .../orderedlayout/OrderedLayoutCases.java | 4 ++++ 9 files changed, 52 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java index e180c05aaa..c43581b000 100644 --- a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java +++ b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java @@ -730,8 +730,10 @@ public class VDebugConsole extends VOverlay implements Console { forceLayout.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { - // TODO for each client in appconf force layout - // VDebugConsole.this.client.forceLayout(); + for (ApplicationConnection applicationConnection : ApplicationConfiguration + .getRunningApplications()) { + applicationConnection.forceLayout(); + } } }); diff --git a/src/com/vaadin/terminal/gwt/client/ui/VFormLayout.java b/src/com/vaadin/terminal/gwt/client/ui/VFormLayout.java index d31d1acdd6..174e66b7aa 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VFormLayout.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VFormLayout.java @@ -327,13 +327,21 @@ public class VFormLayout extends SimplePanel implements Container { } private void setStyles(String[] styles) { - String style = CLASSNAME; + String styleName = CLASSNAME; + if (styles != null) { - for (int i = 0; i < styles.length; i++) { - style += " " + CLASSNAME + "-" + styles[i]; + for (String style : styles) { + if (ApplicationConnection.DISABLED_CLASSNAME.equals(style)) { + // Add v-disabled also without classname prefix so + // generic v-disabled CSS rules work + styleName += " " + style; + } + + styleName += " " + CLASSNAME + "-" + style; } } - setStyleName(style); + + setStyleName(styleName); } public void updateCaption(UIDL uidl) { diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTextualDate.java b/src/com/vaadin/terminal/gwt/client/ui/VTextualDate.java index fb41829efc..56cdf05ddb 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTextualDate.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTextualDate.java @@ -340,7 +340,7 @@ public class VTextualDate extends VDateField implements Paintable, Field, @Override public void setWidth(String newWidth) { - if (!"".equals(newWidth) && (width == null || !newWidth.equals(width))) { + if (!"".equals(newWidth) && (isUndefinedWidth() || !newWidth.equals(width))) { if (BrowserInfo.get().isIE6()) { // in IE6 cols ~ min-width DOM.setElementProperty(text.getElement(), "size", "1"); @@ -353,19 +353,21 @@ public class VTextualDate extends VDateField implements Paintable, Field, needLayout = false; } } else { - if ("".equals(newWidth) && width != null && !"".equals(width)) { + if ("".equals(newWidth) && !isUndefinedWidth()) { + // Changing from defined to undefined if (BrowserInfo.get().isIE6()) { // revert IE6 hack DOM.setElementProperty(text.getElement(), "size", ""); } super.setWidth(""); - needLayout = true; - iLayout(); - needLayout = false; + iLayout(true); width = null; } } } + protected boolean isUndefinedWidth() { + return width == null || "".equals(width); + } /** * Returns pixels in x-axis reserved for other than textfield content. @@ -390,16 +392,20 @@ public class VTextualDate extends VDateField implements Paintable, Field, * automatically adjusted by the browser. */ public void updateWidth() { - if (!needLayout) { + if (isUndefinedWidth()) { return; } - + needLayout = true; fieldExtraWidth = -1; - iLayout(); + iLayout(true); } public void iLayout() { - if (needLayout) { + iLayout(false); + } + + public void iLayout(boolean force) { + if (needLayout || force) { int textFieldWidth = getOffsetWidth() - getFieldExtraWidth(); if (textFieldWidth < 0) { // Field can never be smaller than 0 (causes exception in IE) diff --git a/tests/integration_base_files/cleanup.sh b/tests/integration_base_files/cleanup.sh index 42fb5a434d..44e2e5f6ee 100644 --- a/tests/integration_base_files/cleanup.sh +++ b/tests/integration_base_files/cleanup.sh @@ -23,4 +23,5 @@ if [ -a /home/integration/demo.war ] fi echo Cleaning deploy dir -rm -rf /home/integration/deploy/* +ant -f /home/integration/deploy.xml clean + diff --git a/tests/integration_base_files/lock_age.sh b/tests/integration_base_files/lock_age.sh index 6b78acb590..115a8fef79 100644 --- a/tests/integration_base_files/lock_age.sh +++ b/tests/integration_base_files/lock_age.sh @@ -8,7 +8,7 @@ if lockfile -r0 -! /home/integration/deploy/lock.file &> /dev/null AGE=$[($DATE - $LOCK_AGE)/60] - if [ "$AGE" -gt "15" ] + if [ "$AGE" -gt "20" ] then echo lock.file is $AGE min old. ./cleanup.sh diff --git a/tests/integration_tests.xml b/tests/integration_tests.xml index 5984097880..57d6bb47a9 100644 --- a/tests/integration_tests.xml +++ b/tests/integration_tests.xml @@ -259,6 +259,13 @@ + + + + + + + @@ -308,6 +315,7 @@ + diff --git a/tests/test.xml b/tests/test.xml index f09c115fec..39d45d2a74 100644 --- a/tests/test.xml +++ b/tests/test.xml @@ -129,7 +129,7 @@ - + diff --git a/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.html b/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.html index 6d18c60038..3ad7d62a09 100644 --- a/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.html +++ b/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.html @@ -101,12 +101,16 @@ vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0] enter + + pause + 100 + + assertText vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::PID_SLog_row_0 4. Item one-1 selected - diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java index dae44e3299..ff3c304600 100644 --- a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java +++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java @@ -266,6 +266,8 @@ public class OrderedLayoutCases extends TestBase { setChildState(0, 1, 2); // Height: 100% to middle child setChildState(1, 1, 4); + // Alignment: bottom left to right child + setChildState(2, 4, 7); } })); @@ -277,6 +279,8 @@ public class OrderedLayoutCases extends TestBase { setChildState(0, 1, 2); // Height: 100% to middle child setChildState(1, 1, 4); + // Alignment: bottom left to right child + setChildState(2, 4, 7); } })); -- cgit v1.2.3 From 7b2e97499efa079a055eb4a8d2b932f216d3666f Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Mon, 23 Jan 2012 13:10:38 +0000 Subject: #8273 Added sanity check to prevent trying to render past the end of the cells array svn changeset:22745/svn branch:6.8 --- src/com/vaadin/ui/Table.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/com/vaadin/ui/Table.java b/src/com/vaadin/ui/Table.java index d8c59c2e91..199a6805f6 100644 --- a/src/com/vaadin/ui/Table.java +++ b/src/com/vaadin/ui/Table.java @@ -3047,6 +3047,9 @@ public class Table extends AbstractSelect implements Action.Container, if (start > cells[CELL_ITEMID].length || start < 0) { start = 0; } + if (end > cells[CELL_ITEMID].length) { + end = cells[CELL_ITEMID].length; + } for (int indexInRowbuffer = start; indexInRowbuffer < end; indexInRowbuffer++) { final Object itemId = cells[CELL_ITEMID][indexInRowbuffer]; -- cgit v1.2.3 From 0b8a57ad0a0b776c0c89aaf7fdc65e5f2c9ac726 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Mon, 23 Jan 2012 13:11:02 +0000 Subject: #8241 Removed debug message, added reference to ticket svn changeset:22746/svn branch:6.8 --- src/com/vaadin/terminal/gwt/client/ApplicationConnection.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index 0bb311600c..944d9b5974 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -544,15 +544,13 @@ public class ApplicationConnection { * the request and served non-UIDL content (for * instance, a login page if the session has expired.) * If the response contains a magic substring, do a - * synchronous refresh. + * synchronous refresh. See #8241. */ MatchResult refreshToken = RegExp.compile( UIDL_REFRESH_TOKEN + "(:\\s*(.*?))?(\\s|$)") .exec(response.getText()); if (refreshToken != null) { redirect(refreshToken.getGroup(2)); - VConsole.log("*** REDIRECT : " - + refreshToken.getGroup(2)); return; } } -- cgit v1.2.3 From 7396c309a4699e1e61b03cb17d005084758a25ed Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Wed, 25 Jan 2012 14:07:13 +0000 Subject: #6718 Extend PopupDateField range - allow selection of the last days of the preceding month and the first days of the following month without switching to that month Changes: - Internally use Date objects instead of day-of-month integers to track the selected and focused date - Keep track of the currently displayed month separately from the currently focused date - New CSS class for off-month dates: .v-datefield-calendarpanel-day-offmonth - Off-month days map to negative or past-the-end-of-month integer ids in getSubPart functions - The popup now always shows exactly 6 weeks, so that depending on the month, 1 to 7 days of the preceding month and 4 to 13 days of the following month are shown svn changeset:22758/svn branch:6.8 --- .../VAADIN/themes/base/datefield/datefield.css | 3 + .../terminal/gwt/client/ui/VCalendarPanel.java | 200 ++++++++++----------- 2 files changed, 96 insertions(+), 107 deletions(-) (limited to 'src') diff --git a/WebContent/VAADIN/themes/base/datefield/datefield.css b/WebContent/VAADIN/themes/base/datefield/datefield.css index 72d9510c3f..8e2e9aeb2b 100644 --- a/WebContent/VAADIN/themes/base/datefield/datefield.css +++ b/WebContent/VAADIN/themes/base/datefield/datefield.css @@ -60,6 +60,9 @@ .v-datefield-calendarpanel-day-focused { outline: 1px dotted black; } +.v-datefield-calendarpanel-day-offmonth { + color: #666; +} .v-ie6 .v-datefield-calendarpanel-day, .v-ie7 .v-datefield-calendarpanel-day { diff --git a/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java b/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java index 3b1ee273d5..3b74232112 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java @@ -103,6 +103,8 @@ public class VCalendarPanel extends FocusableFlexTable implements private static final String CN_SELECTED = "selected"; + private static final String CN_OFFMONTH = "offmonth"; + /** * Represents a click handler for when a user selects a value by using the * mouse @@ -117,7 +119,7 @@ public class VCalendarPanel extends FocusableFlexTable implements */ public void onClick(ClickEvent event) { Day day = (Day) event.getSource(); - focusDay(day.getDay()); + focusDay(day.getDate()); selectFocused(); onSubmit(); } @@ -151,6 +153,8 @@ public class VCalendarPanel extends FocusableFlexTable implements private boolean showISOWeekNumbers; + private Date displayedMonth; + private Date focusedDate; private Day selectedDay; @@ -190,18 +194,18 @@ public class VCalendarPanel extends FocusableFlexTable implements * Sets the focus to given day of current time. Used when moving in the * calender with the keyboard. * - * @param day + * @param date * The day number from by Date.getDate() */ - private void focusDay(int day) { + private void focusDay(Date day) { // Only used when calender body is present if (resolution > VDateField.RESOLUTION_MONTH) { if (focusedDay != null) { focusedDay.removeStyleDependentName(CN_FOCUSED); } - if (day > 0 && focusedDate != null) { - focusedDate.setDate(day); + if (day != null && focusedDate != null) { + focusedDate.setTime(day.getTime()); int rowCount = days.getRowCount(); for (int i = 0; i < rowCount; i++) { int cellCount = days.getCellCount(i); @@ -209,7 +213,7 @@ public class VCalendarPanel extends FocusableFlexTable implements Widget widget = days.getWidget(i, j); if (widget != null && widget instanceof Day) { Day curday = (Day) widget; - if (curday.getDay() == day) { + if (curday.getDate().equals(day)) { curday.addStyleDependentName(CN_FOCUSED); focusedDay = curday; focusedRow = i; @@ -225,9 +229,9 @@ public class VCalendarPanel extends FocusableFlexTable implements /** * Sets the selection hightlight to a given date of current time * - * @param day + * @param date */ - private void selectDate(int day) { + private void selectDate(Date date) { if (selectedDay != null) { selectedDay.removeStyleDependentName(CN_SELECTED); } @@ -239,7 +243,7 @@ public class VCalendarPanel extends FocusableFlexTable implements Widget widget = days.getWidget(i, j); if (widget != null && widget instanceof Day) { Day curday = (Day) widget; - if (curday.getDay() == day) { + if (curday.getDate().equals(date)) { curday.addStyleDependentName(CN_SELECTED); selectedDay = curday; return; @@ -278,7 +282,7 @@ public class VCalendarPanel extends FocusableFlexTable implements // it was forced to 1 above. value.setDate(focusedDate.getDate()); - selectDate(focusedDate.getDate()); + selectDate(focusedDate); } else { VConsole.log("Trying to select a the focused date which is NULL!"); } @@ -467,97 +471,62 @@ public class VCalendarPanel extends FocusableFlexTable implements } } - // The day of month that is selected, -1 if no day of this month is - // selected (i.e, showing another month/year than selected or nothing is - // selected) - int dayOfMonthSelected = -1; - // The day of month that is today, -1 if no day of this month is today - // (i.e., showing another month/year than current) - int dayOfMonthToday = -1; - - boolean initiallyNull = value == null; - - if (!initiallyNull && value.getMonth() == focusedDate.getMonth() - && value.getYear() == focusedDate.getYear()) { - dayOfMonthSelected = value.getDate(); - } - final Date today = new Date(); - if (today.getMonth() == focusedDate.getMonth() - && today.getYear() == focusedDate.getYear()) { - dayOfMonthToday = today.getDate(); - } + // today must have zeroed hours, minutes, seconds, and milliseconds + final Date tmp = new Date(); + final Date today = new Date(tmp.getYear(), tmp.getMonth(), + tmp.getDate()); final int startWeekDay = getDateTimeService().getStartWeekDay( focusedDate); - final int daysInMonth = DateTimeService - .getNumberOfDaysInMonth(focusedDate); - - int dayCount = 0; - final Date curr = new Date(focusedDate.getTime()); + final Date curr = (Date) focusedDate.clone(); + // Start from the first day of the week that at least partially belongs + // to the current month + curr.setDate(-startWeekDay); // No month has more than 6 weeks so 6 is a safe maximum for rows. for (int weekOfMonth = 1; weekOfMonth < 7; weekOfMonth++) { - boolean weekNumberProcessed[] = new boolean[] { false, false, - false, false, false, false, false }; - for (int dayOfWeek = 0; dayOfWeek < 7; dayOfWeek++) { - if (!(weekOfMonth == 1 && dayOfWeek < startWeekDay)) { - - if (dayCount >= daysInMonth) { - // All days printed and we are done - break; - } - - final int dayOfMonth = ++dayCount; - - curr.setDate(dayCount); - // Actually write the day of month - Day day = new Day(dayOfMonth); + // Actually write the day of month + Day day = new Day((Date) curr.clone()); - if (dayOfMonthSelected == dayOfMonth) { - day.addStyleDependentName(CN_SELECTED); - selectedDay = day; + if (curr.equals(value)) { + day.addStyleDependentName(CN_SELECTED); + selectedDay = day; + } + if (curr.equals(today)) { + day.addStyleDependentName(CN_TODAY); + } + if (curr.equals(focusedDate)) { + focusedDay = day; + focusedRow = weekOfMonth; + if (hasFocus) { + day.addStyleDependentName(CN_FOCUSED); } + } + if (curr.getMonth() != focusedDate.getMonth()) { + day.addStyleDependentName(CN_OFFMONTH); + } - if (dayOfMonthToday == dayOfMonth) { - day.addStyleDependentName(CN_TODAY); - } + days.setWidget(weekOfMonth, firstWeekdayColumn + dayOfWeek, day); - if (dayOfMonth == focusedDate.getDate()) { - focusedDay = day; - focusedRow = weekOfMonth; - if (hasFocus) { - day.addStyleDependentName(CN_FOCUSED); - } - } + // ISO week numbers if requested + days.getCellFormatter().setVisible(weekOfMonth, weekColumn, + isShowISOWeekNumbers()); + if (isShowISOWeekNumbers()) { + final String baseCssClass = VDateField.CLASSNAME + + "-calendarpanel-weeknumber"; + String weekCssClass = baseCssClass; - days.setWidget(weekOfMonth, firstWeekdayColumn + dayOfWeek, - day); - - // ISO week numbers if requested - if (!weekNumberProcessed[weekOfMonth]) { - days.getCellFormatter().setVisible(weekOfMonth, - weekColumn, isShowISOWeekNumbers()); - if (isShowISOWeekNumbers()) { - final String baseCssClass = VDateField.CLASSNAME - + "-calendarpanel-weeknumber"; - String weekCssClass = baseCssClass; - - int weekNumber = DateTimeService - .getISOWeekNumber(curr); - - days.setHTML(weekOfMonth, 0, "" + weekNumber - + ""); - weekNumberProcessed[weekOfMonth] = true; - } + int weekNumber = DateTimeService.getISOWeekNumber(curr); - } + days.setHTML(weekOfMonth, 0, "" + weekNumber + + ""); } + curr.setDate(curr.getDate() + 1); } } - } /** @@ -621,6 +590,7 @@ public class VCalendarPanel extends FocusableFlexTable implements while (focusedDate.getMonth() != requestedMonth) { focusedDate.setDate(focusedDate.getDate() - 1); } + displayedMonth.setMonth(displayedMonth.getMonth() + 1); renderCalendar(); } @@ -640,6 +610,7 @@ public class VCalendarPanel extends FocusableFlexTable implements while (focusedDate.getMonth() == currentMonth) { focusedDate.setDate(focusedDate.getDate() - 1); } + displayedMonth.setMonth(displayedMonth.getMonth() - 1); renderCalendar(); } @@ -649,6 +620,7 @@ public class VCalendarPanel extends FocusableFlexTable implements */ private void focusPreviousYear(int years) { focusedDate.setYear(focusedDate.getYear() - years); + displayedMonth.setYear(displayedMonth.getYear() - years); renderCalendar(); } @@ -657,6 +629,7 @@ public class VCalendarPanel extends FocusableFlexTable implements */ private void focusNextYear(int years) { focusedDate.setYear(focusedDate.getYear() + years); + displayedMonth.setYear(displayedMonth.getYear() + years); renderCalendar(); } @@ -905,7 +878,7 @@ public class VCalendarPanel extends FocusableFlexTable implements if (newCurrentDate.getMonth() == focusedDate.getMonth()) { // Month did not change, only move the selection - focusDay(focusedDate.getDate() + 1); + focusDay(newCurrentDate); } else { // If the month changed we need to re-render the calendar focusedDate.setDate(focusedDate.getDate() + 1); @@ -924,7 +897,7 @@ public class VCalendarPanel extends FocusableFlexTable implements if (newCurrentDate.getMonth() == focusedDate.getMonth()) { // Month did not change, only move the selection - focusDay(focusedDate.getDate() - 1); + focusDay(newCurrentDate); } else { // If the month changed we need to re-render the calendar focusedDate.setDate(focusedDate.getDate() - 1); @@ -944,10 +917,10 @@ public class VCalendarPanel extends FocusableFlexTable implements if (newCurrentDate.getMonth() == focusedDate.getMonth() && focusedRow > 1) { // Month did not change, only move the selection - focusDay(focusedDate.getDate() - 7); + focusDay(newCurrentDate); } else { // If the month changed we need to re-render the calendar - focusedDate.setDate(focusedDate.getDate() - 7); + focusedDate = newCurrentDate; renderCalendar(); } @@ -963,10 +936,10 @@ public class VCalendarPanel extends FocusableFlexTable implements if (newCurrentDate.getMonth() == focusedDate.getMonth()) { // Month did not change, only move the selection - focusDay(focusedDate.getDate() + 7); + focusDay(newCurrentDate); } else { // If the month changed we need to re-render the calendar - focusedDate.setDate(focusedDate.getDate() + 7); + focusedDate = newCurrentDate; renderCalendar(); } @@ -1210,27 +1183,28 @@ public class VCalendarPanel extends FocusableFlexTable implements return; } - Date oldFocusedValue = focusedDate; + Date oldDisplayedMonth = displayedMonth; value = currentDate; if (value == null) { - focusedDate = null; + focusedDate = displayedMonth = null; } else { focusedDate = (Date) value.clone(); + displayedMonth = (Date) value.clone(); } // Re-render calendar if month or year of focused date has changed - if (oldFocusedValue == null || value == null - || oldFocusedValue.getYear() != value.getYear() - || oldFocusedValue.getMonth() != value.getMonth()) { + if (oldDisplayedMonth == null || value == null + || oldDisplayedMonth.getYear() != value.getYear() + || oldDisplayedMonth.getMonth() != value.getMonth()) { renderCalendar(); } else { - focusDay(currentDate.getDate()); + focusDay(currentDate); selectFocused(); } if (!hasFocus) { - focusDay(-1); + focusDay((Date) null); } } @@ -1555,17 +1529,17 @@ public class VCalendarPanel extends FocusableFlexTable implements private class Day extends InlineHTML { private static final String BASECLASS = VDateField.CLASSNAME + "-calendarpanel-day"; - private final int day; + private final Date date; - Day(int dayOfMonth) { - super("" + dayOfMonth); + Day(Date date) { + super("" + date.getDate()); setStyleName(BASECLASS); - day = dayOfMonth; + this.date = date; addClickHandler(dayClickHandler); } - public int getDay() { - return day; + public Date getDate() { + return date; } } @@ -1648,7 +1622,7 @@ public class VCalendarPanel extends FocusableFlexTable implements public void onBlur(final BlurEvent event) { if (event.getSource() instanceof VCalendarPanel) { hasFocus = false; - focusDay(-1); + focusDay(null); } } @@ -1665,7 +1639,7 @@ public class VCalendarPanel extends FocusableFlexTable implements // Focuses the current day if the calendar shows the days if (focusedDay != null) { - focusDay(focusedDay.getDay()); + focusDay(focusedDate); } } } @@ -1696,7 +1670,15 @@ public class VCalendarPanel extends FocusableFlexTable implements // Day, find out which dayOfMonth and use that as the identifier Day day = Util.findWidget(subElement, Day.class); if (day != null) { - return SUBPART_DAY + day.getDay(); + Date date = day.getDate(); + int id = date.getDate(); + if (date.getMonth() < displayedMonth.getMonth()) { + id -= DateTimeService.getNumberOfDaysInMonth(date); + } else if (date.getMonth() > displayedMonth.getMonth()) { + id += DateTimeService + .getNumberOfDaysInMonth(displayedMonth); + } + return SUBPART_DAY + id; } } else if (time != null) { if (contains(time.hours, subElement)) { @@ -1762,14 +1744,18 @@ public class VCalendarPanel extends FocusableFlexTable implements return time.ampm.getElement(); } if (subPart.startsWith(SUBPART_DAY)) { + // can be less than 1 or greater than the number of days in the current month + // these map to the "off-month" days int dayOfMonth = Integer.parseInt(subPart.substring(SUBPART_DAY .length())); + Date date = new Date(displayedMonth.getYear(), + displayedMonth.getMonth(), dayOfMonth); Iterator iter = days.iterator(); while (iter.hasNext()) { Widget w = iter.next(); if (w instanceof Day) { Day day = (Day) w; - if (day.getDay() == dayOfMonth) { + if (day.getDate().equals(date)) { return day.getElement(); } } -- cgit v1.2.3 From 4c9905b221bc9324669713711a5fd3759e15f899 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 26 Jan 2012 16:30:54 +0200 Subject: Fixed ClassCastException when MenuBar has a set width --- src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java | 4 ---- src/com/vaadin/terminal/gwt/client/ui/VMenuBarPaintable.java | 7 ++----- 2 files changed, 2 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java b/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java index 372ddf25d2..c39155d032 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java @@ -1420,8 +1420,4 @@ public class VMenuBar extends SimpleFocusablePanel implements return null; } - public Widget getWidgetForPaintable() { - return this; - } - } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VMenuBarPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VMenuBarPaintable.java index 38b3cac358..f36db99583 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VMenuBarPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VMenuBarPaintable.java @@ -9,7 +9,6 @@ import com.google.gwt.user.client.ui.Widget; import com.vaadin.terminal.gwt.client.ApplicationConnection; import com.vaadin.terminal.gwt.client.UIDL; import com.vaadin.terminal.gwt.client.Util; -import com.vaadin.terminal.gwt.client.VPaintableMap; import com.vaadin.terminal.gwt.client.ui.VMenuBar.CustomMenuItem; public class VMenuBarPaintable extends VAbstractPaintableWidget { @@ -66,12 +65,10 @@ public class VMenuBarPaintable extends VAbstractPaintableWidget { getWidgetForPaintable().moreItem = GWT.create(CustomMenuItem.class); getWidgetForPaintable().moreItem.setHTML(itemHTML.toString()); - getWidgetForPaintable().moreItem - .setCommand(getWidgetForPaintable().emptyCommand); + getWidgetForPaintable().moreItem.setCommand(VMenuBar.emptyCommand); getWidgetForPaintable().collapsedRootItems = new VMenuBar(true, - (VMenuBar) VPaintableMap.get(client).getPaintable( - getWidgetForPaintable().uidlId)); + getWidgetForPaintable()); getWidgetForPaintable().moreItem .setSubMenu(getWidgetForPaintable().collapsedRootItems); getWidgetForPaintable().moreItem.addStyleName(VMenuBar.CLASSNAME -- cgit v1.2.3 From d94559e52b89cf23abcd4985a4866d400dbdece3 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 26 Jan 2012 17:07:08 +0200 Subject: Avoid comparing Widget with VPaintableWidget --- src/com/vaadin/terminal/gwt/client/ApplicationConnection.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index 9b756382f3..18f7b19e92 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -1821,7 +1821,7 @@ public class ApplicationConnection { while (childWidgets.hasNext()) { final Widget child = childWidgets.next(); - if (child instanceof VPaintableWidget) { + if (getPaintableMap().isPaintable(child)) { if (handleComponentRelativeSize(child)) { /* @@ -1856,7 +1856,7 @@ public class ApplicationConnection { if (paintable == null) { return false; } - boolean debugSizes = false; + boolean debugSizes = true; FloatSize relativeSize = paintableMap.getRelativeSize(paintable); if (relativeSize == null) { -- cgit v1.2.3 From 08aef8e80937b3c81d8a6761827f72b65c25e71c Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 26 Jan 2012 18:26:12 +0200 Subject: Added missing license info --- .../terminal/gwt/client/ui/VAbstractPaintableWidget.java | 11 +++++++---- src/com/vaadin/terminal/gwt/client/ui/VMenuBarPaintable.java | 3 +++ .../vaadin/terminal/gwt/client/ui/VScrollTablePaintable.java | 3 +++ .../vaadin/terminal/gwt/client/ui/VTreeTablePaintable.java | 3 +++ 4 files changed, 16 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java b/src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java index d4c8f79467..9a2e728454 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidget.java @@ -1,3 +1,6 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ package com.vaadin.terminal.gwt.client.ui; import com.google.gwt.user.client.ui.Widget; @@ -10,7 +13,7 @@ public abstract class VAbstractPaintableWidget implements VPaintableWidget { private ApplicationConnection connection; /* State variables */ -// private boolean enabled = true; + // private boolean enabled = true; /** * Default constructor @@ -66,7 +69,7 @@ public abstract class VAbstractPaintableWidget implements VPaintableWidget { this.connection = connection; } -// public boolean isEnabled() { -// return enabled; -// } + // public boolean isEnabled() { + // return enabled; + // } } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VMenuBarPaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VMenuBarPaintable.java index f36db99583..fabc77bced 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VMenuBarPaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VMenuBarPaintable.java @@ -1,3 +1,6 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ package com.vaadin.terminal.gwt.client.ui; import java.util.Iterator; diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTablePaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTablePaintable.java index c747a29a21..fa7cc3d4ec 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTablePaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTablePaintable.java @@ -1,3 +1,6 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ package com.vaadin.terminal.gwt.client.ui; import com.google.gwt.core.client.GWT; diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTreeTablePaintable.java b/src/com/vaadin/terminal/gwt/client/ui/VTreeTablePaintable.java index 8fec0558ec..9b6f03f612 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTreeTablePaintable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTreeTablePaintable.java @@ -1,3 +1,6 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ package com.vaadin.terminal.gwt.client.ui; import com.google.gwt.core.client.GWT; -- cgit v1.2.3 From eee32602e81d3eef56b6cc645e8455349b257c97 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 27 Jan 2012 07:11:06 +0000 Subject: [merge from 6.7] #8045 Removed incorrect/confusing javadoc svn changeset:22769/svn branch:6.8 --- src/com/vaadin/ui/Component.java | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'src') diff --git a/src/com/vaadin/ui/Component.java b/src/com/vaadin/ui/Component.java index 0051b9e943..b32aad2fca 100644 --- a/src/com/vaadin/ui/Component.java +++ b/src/com/vaadin/ui/Component.java @@ -11,7 +11,6 @@ import java.util.EventObject; import java.util.Locale; import com.vaadin.Application; -import com.vaadin.data.Property; import com.vaadin.event.FieldEvents; import com.vaadin.terminal.ErrorMessage; import com.vaadin.terminal.Paintable; @@ -363,12 +362,6 @@ public interface Component extends Paintable, VariableOwner, Sizeable, *

* *

- * The read-only status affects only the user; the value can still be - * changed programmatically, for example, with - * {@link Property#setValue(Object)}. - *

- * - *

* The method will return {@code true} if the component or any of its * parents is in the read-only mode. *

@@ -396,12 +389,6 @@ public interface Component extends Paintable, VariableOwner, Sizeable, *

* *

- * The read-only status affects only the user; the value can still be - * changed programmatically, for example, with - * {@link Property#setValue(Object)}. - *

- * - *

* This method will trigger a * {@link com.vaadin.terminal.Paintable.RepaintRequestEvent * RepaintRequestEvent}. -- cgit v1.2.3