]> source.dussan.org Git - vaadin-framework.git/commitdiff
Merged revisions [10620]-[10678] from 6.2
authorArtur Signell <artur.signell@itmill.com>
Tue, 12 Jan 2010 13:52:27 +0000 (13:52 +0000)
committerArtur Signell <artur.signell@itmill.com>
Tue, 12 Jan 2010 13:52:27 +0000 (13:52 +0000)
svn changeset:10693/svn branch:6.3

13 files changed:
WebContent/VAADIN/themes/reindeer/styles.css
WebContent/VAADIN/themes/reindeer/tabsheet/tabsheet-normal-style.css
src/com/vaadin/data/Container.java
src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java
src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java
src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java
src/com/vaadin/ui/AbstractComponent.java
src/com/vaadin/ui/AbstractSelect.java
src/com/vaadin/ui/Tree.java
tests/src/com/vaadin/tests/components/button/Buttons.html [new file with mode: 0644]
tests/src/com/vaadin/tests/components/button/Buttons.java
tests/src/com/vaadin/tests/components/menubar/Menubars.html [new file with mode: 0644]
tests/src/com/vaadin/tests/components/menubar/Menubars.java [new file with mode: 0644]

index 446c69d7d966f88dffc2e3ba7e24634e60fda24a..afb15e49a8cfce15d92f66744218e79e3409d563 100644 (file)
@@ -1,5 +1,5 @@
-.v-theme-version:after {content:"9_9_9_INTERNAL-DEBUG-BUILD";}
-.v-theme-version-9_9_9_INTERNAL-DEBUG-BUILD {display: none;}
+.v-theme-version:after {content:"6_2_0_dev-20091229";}
+.v-theme-version-6_2_0_dev-20091229 {display: none;}
 /* Automatically compiled css file from subdirectories. */
 
 .v-absolutelayout-wrapper {
@@ -4256,6 +4256,8 @@ td.v-datefield-calendarpanel-nextyear {
 .v-ie .v-tabsheet-tabs .v-errorindicator {
        zoom: 1;
        display: inline;
+}
+.v-ie8 .v-tabsheet-tabs .v-errorindicator {
        display: inline-block;
 }
 
index 8cf324be263d058d1dbd772df9e72b9534b54439..83f5ce9a0ddb4c4fe18ec8bd6d070b18b429de1b 100644 (file)
 .v-ie .v-tabsheet-tabs .v-errorindicator {
        zoom: 1;
        display: inline;
+}
+.v-ie8 .v-tabsheet-tabs .v-errorindicator {
        display: inline-block;
 }
\ No newline at end of file
index 226a4e0b0958f9f4461b422bb428f673d173a75b..5777bf2b0516bfa67d89e9fb98fbb4095d914248 100644 (file)
@@ -541,6 +541,24 @@ public interface Container extends Serializable {
          *         <code>false</code> if not (is a leaf)
          */
         public boolean hasChildren(Object itemId);
+
+        /**
+         * <p>
+         * Removes the Item identified by <code>ItemId</code> from the
+         * Container.
+         * </p>
+         * 
+         * <p>
+         * Note that this does not remove any children the item might have.
+         * </p>
+         * 
+         * @param itemId
+         *            ID of the Item to remove
+         * @return <code>true</code> if the operation succeeded,
+         *         <code>false</code> if not
+         */
+        public boolean removeItem(Object itemId)
+                throws UnsupportedOperationException;
     }
 
     /**
@@ -555,17 +573,15 @@ public interface Container extends Serializable {
      * visible in the container.
      * 
      * When an {@link com.vaadin.data.Ordered} or
-     * {@link com.vaadin.data.Indexed} container is filtered, all
-     * operations of these interfaces should only use the filtered contents and
-     * the filtered indices to the container.
+     * {@link com.vaadin.data.Indexed} container is filtered, all operations of
+     * these interfaces should only use the filtered contents and the filtered
+     * indices to the container.
      * 
-     * Adding items (if supported) to a filtered
-     * {@link com.vaadin.data.Ordered} or
-     * {@link com.vaadin.data.Indexed} container should insert them
+     * Adding items (if supported) to a filtered {@link com.vaadin.data.Ordered}
+     * or {@link com.vaadin.data.Indexed} container should insert them
      * immediately after the indicated visible item. The unfiltered position of
-     * items added at index 0, at index
-     * {@link com.vaadin.data.Container#size()} or at an undefined
-     * position is up to the implementation.
+     * items added at index 0, at index {@link com.vaadin.data.Container#size()}
+     * or at an undefined position is up to the implementation.
      * 
      * @since 5.0
      */
index 470045154322ad0d010e8ef6fc482baa64c76fb3..4ea806e29e3c93655118a811f8908e72243617d1 100644 (file)
@@ -158,9 +158,8 @@ public class ApplicationConfiguration {
             // Something went wrong: multiple widgetsets inited
             String msg = "Tried to init " + widgetset.getClass().getName()
                     + ", but " + initedWidgetSet.getClass().getName()
-                    + " is already inited.";
-            System.err.println(msg);
-            throw new IllegalStateException(msg);
+                    + " was already inited.";
+            ApplicationConnection.getConsole().log(msg);
         }
         initedWidgetSet = widgetset;
         ArrayList<String> appIds = new ArrayList<String>();
index 9cad1fbd91ff7b317882e56b117070c682d2fbb1..4e17dcb8798d27ef47625ffe977d51e6bf7472f2 100644 (file)
@@ -787,7 +787,21 @@ public class VMenuBar extends Widget implements Paintable,
                 paddingWidth = widthBefore - getElement().getClientWidth();
                 getElement().getStyle().setProperty("padding", "");
             }
+            String overflow = "";
+            if (BrowserInfo.get().isIE6()) {
+                // IE6 cannot measure available width correctly without
+                // overflow:hidden
+                overflow = getElement().getStyle().getProperty("overflow");
+                getElement().getStyle().setProperty("overflow", "hidden");
+            }
+
             int availableWidth = getElement().getClientWidth() - paddingWidth;
+
+            if (BrowserInfo.get().isIE6()) {
+                // IE6 cannot measure available width correctly without
+                // overflow:hidden
+                getElement().getStyle().setProperty("overflow", overflow);
+            }
             int diff = availableWidth - getConsumedWidth();
 
             removeItem(moreItem);
index e7452826050e3e2a8c893ce1803f1e975405351b..649a5e129db94c6279a7ad81ac877ec02feb9e07 100644 (file)
@@ -4,9 +4,15 @@
 
 package com.vaadin.terminal.gwt.server;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.PrintWriter;
 import java.io.Serializable;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -1000,25 +1006,37 @@ public class JsonPaintTarget implements PaintTarget {
         }
     }
 
+    private static final Map<Class<? extends Paintable>, Class<? extends Paintable>> widgetMappingCache = new HashMap<Class<? extends Paintable>, Class<? extends Paintable>>();
+
     @SuppressWarnings("unchecked")
     public String getTag(Paintable paintable) {
-        /*
-         * Client widget annotation is searched from component hierarchy to
-         * detect the component that presumably has client side implementation.
-         * The server side name is used in the transportation, but encoded into
-         * integer strings to optimized transferred data.
-         */
-        Class<? extends Paintable> class1 = paintable.getClass();
-        while (!hasClientWidgetMapping(class1)) {
-            Class<?> superclass = class1.getSuperclass();
-            if (superclass != null
-                    && Paintable.class.isAssignableFrom(superclass)) {
-                class1 = (Class<? extends Paintable>) superclass;
-            } else {
-                System.out
-                        .append("Warning: no superclass of givent has ClientWidget"
-                                + " annotation. Component will not be mapped correctly on client side.");
-                break;
+        Class<? extends Paintable> class1;
+        synchronized (widgetMappingCache) {
+            class1 = widgetMappingCache.get(paintable.getClass());
+        }
+        if (class1 == null) {
+            /*
+             * Client widget annotation is searched from component hierarchy to
+             * detect the component that presumably has client side
+             * implementation. The server side name is used in the
+             * transportation, but encoded into integer strings to optimized
+             * transferred data.
+             */
+            class1 = paintable.getClass();
+            while (!hasClientWidgetMapping(class1)) {
+                Class<?> superclass = class1.getSuperclass();
+                if (superclass != null
+                        && Paintable.class.isAssignableFrom(superclass)) {
+                    class1 = (Class<? extends Paintable>) superclass;
+                } else {
+                    System.out
+                            .append("Warning: no superclass of givent has ClientWidget"
+                                    + " annotation. Component will not be mapped correctly on client side.");
+                    break;
+                }
+            }
+            synchronized (widgetMappingCache) {
+                widgetMappingCache.put(paintable.getClass(), class1);
             }
         }
 
@@ -1029,15 +1047,58 @@ public class JsonPaintTarget implements PaintTarget {
 
     private boolean hasClientWidgetMapping(Class<? extends Paintable> class1) {
         try {
-            ClientWidget annotation = class1.getAnnotation(ClientWidget.class);
-            return annotation != null;
+            return class1.isAnnotationPresent(ClientWidget.class);
         } catch (RuntimeException e) {
             if (e.getStackTrace()[0].getClassName().equals(
                     "org.glassfish.web.loader.WebappClassLoader")) {
+
                 // Glassfish 3 is darn eager to load the value class, even
                 // though we just want to check if the annotation exists.
                 // See #3920, remove this hack when fixed in glassfish
-                return true;
+                // In some situations (depending on class loading order) it
+                // would be enough to return true here, but it is safer to check
+                // the annotation from bytecode
+
+                String name = class1.getName().replace('.', File.separatorChar)
+                        + ".class";
+
+                try {
+                    InputStream stream = class1.getClassLoader()
+                            .getResourceAsStream(name);
+                    BufferedReader bufferedReader = new BufferedReader(
+                            new InputStreamReader(stream));
+                    try {
+                        String line;
+                        boolean atSourcefile = false;
+                        while ((line = bufferedReader.readLine()) != null) {
+                            if (line.startsWith("SourceFile")) {
+                                atSourcefile = true;
+                            }
+                            if (atSourcefile) {
+                                if (line.contains("ClientWidget")) {
+                                    return true;
+                                }
+                            }
+                            // TODO could optize to quit at the end attribute
+                        }
+                    } catch (IOException e1) {
+                        // TODO Auto-generated catch block
+                        e1.printStackTrace();
+                    } finally {
+                        try {
+                            bufferedReader.close();
+                        } catch (IOException e1) {
+                            // TODO Auto-generated catch block
+                            e1.printStackTrace();
+                        }
+                    }
+
+                } catch (Throwable e2) {
+                    // TODO Auto-generated catch block
+                    e2.printStackTrace();
+                }
+
+                return false;
             } else {
                 // throw exception forward
                 throw e;
index 4619c2ab8d965294f9ded19749c33599d28c1b72..0c02792ffff459b5ff5ebfcea459f904c1b41c02 100644 (file)
@@ -315,6 +315,7 @@ public abstract class AbstractComponent implements Component, MethodEventSource
      */
     public void setLocale(Locale locale) {
         this.locale = locale;
+        requestRepaint();
     }
 
     /*
index b8ef6bc2067b55c507eb3ece62d8fae12ce892d3..4b5ef4a0a8bca40a425da9ac41efedafb42c45f7 100644 (file)
@@ -793,12 +793,9 @@ public abstract class AbstractSelect extends AbstractField implements
         return retval;
     }
 
-    /**
-     * Removes the item identified by Id from the container. This functionality
-     * is optional. If the function is not implemented, the functions allways
-     * returns false.
+    /*
+     * (non-Javadoc)
      * 
-     * @return True if the operation succeeded.
      * @see com.vaadin.data.Container#removeItem(java.lang.Object)
      */
     public boolean removeItem(Object itemId)
index 509d83a1532bcbdaccd837efa56414438fc0212b..28a410fa137f851ff715f53339def3161c09c461 100644 (file)
@@ -1068,4 +1068,11 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
         public abstract String getStyle(Object itemId);
     }
 
+    // Overriden so javadoc comes from Container.Hierarchical
+    @Override
+    public boolean removeItem(Object itemId)
+            throws UnsupportedOperationException {
+        return super.removeItem(itemId);
+    }
+
 }
diff --git a/tests/src/com/vaadin/tests/components/button/Buttons.html b/tests/src/com/vaadin/tests/components/button/Buttons.html
new file mode 100644 (file)
index 0000000..43e554b
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>com.vaadin.tests.components.button.Buttons</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">com.vaadin.tests.components.button.Buttons</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.button.Buttons</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForVaadin</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
index 4b1e7d60d8325b3ae78783b76d5884b3cd880703..b27d3f8ae9c8deff2c0629d8207aea228b949818 100644 (file)
@@ -8,7 +8,6 @@ import com.vaadin.tests.util.LoremIpsum;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.CheckBox;
 import com.vaadin.ui.Component;
-import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.NativeButton;
 import com.vaadin.ui.Button.ClickEvent;
 
@@ -54,17 +53,6 @@ public class Buttons extends ComponentTestCase {
 
     }
 
-    private Component createActionLayout() {
-        HorizontalLayout actionLayout = new HorizontalLayout();
-        actionLayout.setSpacing(true);
-        actionLayout.setMargin(true);
-        for (Component c : createActions()) {
-            actionLayout.addComponent(c);
-        }
-        addComponent(actionLayout);
-        return actionLayout;
-    }
-
     private Button createButton(String text, boolean nativeButton) {
         Button b;
         if (nativeButton) {
diff --git a/tests/src/com/vaadin/tests/components/menubar/Menubars.html b/tests/src/com/vaadin/tests/components/menubar/Menubars.html
new file mode 100644 (file)
index 0000000..090a6bf
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://artur-laptop.office.itmill.com:8888/" />
+<title>com.vaadin.tests.components.menubar.Menubars</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">com.vaadin.tests.components.menubar.Menubars</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.menubar.Menubars</td>
+       <td></td>
+</tr>
+<tr>
+       <td>waitForVaadin</td>
+       <td></td>
+       <td></td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/src/com/vaadin/tests/components/menubar/Menubars.java b/tests/src/com/vaadin/tests/components/menubar/Menubars.java
new file mode 100644 (file)
index 0000000..15c353b
--- /dev/null
@@ -0,0 +1,126 @@
+package com.vaadin.tests.components.menubar;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import com.vaadin.tests.components.ComponentTestCase;\r
+import com.vaadin.ui.Button;\r
+import com.vaadin.ui.CheckBox;\r
+import com.vaadin.ui.Component;\r
+import com.vaadin.ui.MenuBar;\r
+import com.vaadin.ui.Button.ClickEvent;\r
+import com.vaadin.ui.MenuBar.MenuItem;\r
+\r
+public class Menubars extends ComponentTestCase {\r
+\r
+    MenuBar menubar[] = new MenuBar[20];\r
+\r
+    @Override\r
+    protected void setup() {\r
+        super.setup();\r
+\r
+        MenuBar m;\r
+        m = createMenuBar("This is an undefined wide menubar with 3 items", 3);\r
+\r
+        m.setWidth(null);\r
+        addTestComponent(m);\r
+\r
+        m = createMenuBar(\r
+                "This is an undefined wide menubar with fixed 100px height (4 items)",\r
+                4);\r
+        m.setWidth(null);\r
+        m.setHeight("100px");\r
+        addTestComponent(m);\r
+\r
+        m = createMenuBar("This is a 200px wide menubar with 10 items", 10);\r
+        m.setWidth("200px");\r
+        addTestComponent(m);\r
+\r
+        m = createMenuBar("This is a 200px wide menubar with 2 items", 2);\r
+        m.setWidth("200px");\r
+        addTestComponent(m);\r
+\r
+        m = createMenuBar("This is a 100% wide menubar with 3 items ", 3);\r
+        m.setWidth("100%");\r
+        addTestComponent(m);\r
+\r
+        m = createMenuBar("This is a 100% wide menubar with 40 items ", 40);\r
+        m.setWidth("100%");\r
+        addTestComponent(m);\r
+\r
+        m = createMenuBar(\r
+                "This is a 100% wide menubar with fixed 65px height (5 items). ",\r
+                5);\r
+        m.setWidth("100%");\r
+        m.setHeight("65px");\r
+\r
+        addTestComponent(m);\r
+\r
+    }\r
+\r
+    private MenuBar createMenuBar(String text, int items) {\r
+        MenuBar m = new MenuBar();\r
+        m.setCaption(text);\r
+\r
+        for (int i = 1; i <= items; i++) {\r
+            MenuItem mi = m.addItem("Item " + i, null);\r
+            for (int j = 1; j <= items; j++) {\r
+                mi.addItem("Sub menu " + i + "/" + j, null);\r
+            }\r
+        }\r
+\r
+        return m;\r
+    }\r
+\r
+    @Override\r
+    protected String getDescription() {\r
+        return "A generic test for MenuBars in different configurations";\r
+    }\r
+\r
+    @Override\r
+    protected List<Component> createActions() {\r
+        ArrayList<Component> actions = new ArrayList<Component>();\r
+\r
+        CheckBox errorIndicators = new CheckBox("Error indicators",\r
+                new Button.ClickListener() {\r
+                    public void buttonClick(ClickEvent event) {\r
+                        Button b = event.getButton();\r
+                        boolean enabled = (Boolean) b.getValue();\r
+                        setErrorIndicators(enabled);\r
+\r
+                    }\r
+                });\r
+\r
+        CheckBox enabled = new CheckBox("Enabled", new Button.ClickListener() {\r
+            public void buttonClick(ClickEvent event) {\r
+                Button b = event.getButton();\r
+                boolean enabled = (Boolean) b.getValue();\r
+                setEnabled(enabled);\r
+            }\r
+        });\r
+\r
+        CheckBox readonly = new CheckBox("Readonly",\r
+                new Button.ClickListener() {\r
+                    public void buttonClick(ClickEvent event) {\r
+                        Button b = event.getButton();\r
+                        boolean enabled = (Boolean) b.getValue();\r
+                        setReadOnly(enabled);\r
+                    }\r
+                });\r
+\r
+        errorIndicators.setValue(new Boolean(false));\r
+        readonly.setValue(new Boolean(false));\r
+        enabled.setValue(new Boolean(true));\r
+\r
+        errorIndicators.setImmediate(true);\r
+        readonly.setImmediate(true);\r
+        enabled.setImmediate(true);\r
+\r
+        actions.add(errorIndicators);\r
+        actions.add(readonly);\r
+        actions.add(enabled);\r
+\r
+        return actions;\r
+    }\r
+\r
+}\r