From a9a7a79e0f4611be13a2e5eb0a152601831c8b7c Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Mon, 1 Feb 2010 08:52:51 +0000 Subject: [PATCH] Merged code changes from 6.2 svn changeset:11069/svn branch:6.3 --- .../VAADIN/themes/base/button/button.css | 6 +- WebContent/VAADIN/themes/base/styles.css | 6 +- .../reindeer/button/button-link-style.css | 5 ++ WebContent/VAADIN/themes/reindeer/styles.css | 15 +++- WebContent/VAADIN/themes/runo/styles.css | 6 +- .../terminal/gwt/DefaultWidgetSet.gwt.xml | 6 ++ .../terminal/gwt/client/ui/VGridLayout.java | 55 ++++++++------ .../gwt/client/ui/VPopupCalendar.java | 7 +- .../gwt/widgetsetutils/ClassPathExplorer.java | 16 +++-- src/com/vaadin/ui/Select.java | 6 ++ .../ProgressIndicatorInvisible.java | 52 ++++++++++++++ .../vaadin/tests/layouts/GridLayoutNPE.java | 72 +++++++++++++++++++ 12 files changed, 219 insertions(+), 33 deletions(-) create mode 100644 tests/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorInvisible.java create mode 100644 tests/src/com/vaadin/tests/layouts/GridLayoutNPE.java diff --git a/WebContent/VAADIN/themes/base/button/button.css b/WebContent/VAADIN/themes/base/button/button.css index aacc05bbb7..9d4bec0fe4 100644 --- a/WebContent/VAADIN/themes/base/button/button.css +++ b/WebContent/VAADIN/themes/base/button/button.css @@ -23,7 +23,11 @@ -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; - } +} + +.v-button.v-disabled { + cursor: default; +} .v-ie6 .v-button { display: inline; diff --git a/WebContent/VAADIN/themes/base/styles.css b/WebContent/VAADIN/themes/base/styles.css index f1840c6bf2..28d412536e 100644 --- a/WebContent/VAADIN/themes/base/styles.css +++ b/WebContent/VAADIN/themes/base/styles.css @@ -59,7 +59,11 @@ -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; - } +} + +.v-button.v-disabled { + cursor: default; +} .v-ie6 .v-button { display: inline; diff --git a/WebContent/VAADIN/themes/reindeer/button/button-link-style.css b/WebContent/VAADIN/themes/reindeer/button/button-link-style.css index 14530c8dff..f4ba80b3cd 100644 --- a/WebContent/VAADIN/themes/reindeer/button/button-link-style.css +++ b/WebContent/VAADIN/themes/reindeer/button/button-link-style.css @@ -14,6 +14,11 @@ cursor: pointer; line-height: inherit; } + +.v-button.v-button-link.v-disabled, +.v-button.v-button-link.v-disabled .v-button-wrap { + cursor: default; + } .v-button-link .v-button-caption, .v-nativebutton-link .v-nativebutton-caption { diff --git a/WebContent/VAADIN/themes/reindeer/styles.css b/WebContent/VAADIN/themes/reindeer/styles.css index afb15e49a8..c4d29c78ce 100644 --- a/WebContent/VAADIN/themes/reindeer/styles.css +++ b/WebContent/VAADIN/themes/reindeer/styles.css @@ -1,5 +1,5 @@ -.v-theme-version:after {content:"6_2_0_dev-20091229";} -.v-theme-version-6_2_0_dev-20091229 {display: none;} +.v-theme-version:after {content:"9_9_9_INTERNAL-DEBUG-BUILD";} +.v-theme-version-9_9_9_INTERNAL-DEBUG-BUILD {display: none;} /* Automatically compiled css file from subdirectories. */ .v-absolutelayout-wrapper { @@ -59,7 +59,11 @@ -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; - } +} + +.v-button.v-disabled { + cursor: default; +} .v-ie6 .v-button { display: inline; @@ -2177,6 +2181,11 @@ div.v-window-header { cursor: pointer; line-height: inherit; } + +.v-button.v-button-link.v-disabled, +.v-button.v-button-link.v-disabled .v-button-wrap { + cursor: default; + } .v-button-link .v-button-caption, .v-nativebutton-link .v-nativebutton-caption { diff --git a/WebContent/VAADIN/themes/runo/styles.css b/WebContent/VAADIN/themes/runo/styles.css index 06bce5dfa9..7e14ce6d40 100644 --- a/WebContent/VAADIN/themes/runo/styles.css +++ b/WebContent/VAADIN/themes/runo/styles.css @@ -59,7 +59,11 @@ -moz-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; - } +} + +.v-button.v-disabled { + cursor: default; +} .v-ie6 .v-button { display: inline; diff --git a/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml b/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml index d7cf1ca4d0..8918b4b5e7 100644 --- a/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml +++ b/src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml @@ -27,6 +27,12 @@ + + + + + + diff --git a/src/com/vaadin/terminal/gwt/client/ui/VGridLayout.java b/src/com/vaadin/terminal/gwt/client/ui/VGridLayout.java index 1c2fcf5b6f..416455c162 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VGridLayout.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VGridLayout.java @@ -191,6 +191,7 @@ public class VGridLayout extends SimplePanel implements Paintable, Container { renderRemainingComponents(pendingCells); for (Cell cell : relativeHeighted) { + // rendering done above so cell.cc should not be null Widget widget2 = cell.cc.getWidget(); client.handleComponentRelativeSize(widget2); cell.cc.updateWidgetSize(); @@ -685,19 +686,20 @@ public class VGridLayout extends SimplePanel implements Paintable, Container { Cell cell = paintableToCell.get(paintable); if (!cell.hasRelativeHeight() || !cell.hasRelativeWidth()) { // cell sizes will only stay still if only relatively - // sized - // components + // sized components // check if changed child affects min col widths - cell.cc.setWidth(""); - cell.cc.setHeight(""); + if (cell.cc != null) { + cell.cc.setWidth(""); + cell.cc.setHeight(""); - cell.cc.updateWidgetSize(); + cell.cc.updateWidgetSize(); - /* - * If this is the result of an caption icon onload event the - * caption size may have changed - */ - cell.cc.updateCaptionSize(); + /* + * If this is the result of an caption icon onload event the + * caption size may have changed + */ + cell.cc.updateCaptionSize(); + } int width = cell.getWidth(); int allocated = columnWidths[cell.col]; @@ -853,9 +855,16 @@ public class VGridLayout extends SimplePanel implements Paintable, Container { } public RenderSpace getAllocatedSpace() { - return new RenderSpace(getAvailableWidth() - - cc.getCaptionWidthAfterComponent(), getAvailableHeight() - - cc.getCaptionHeightAboveComponent()); + if (cc != null) { + return new RenderSpace(getAvailableWidth() + - cc.getCaptionWidthAfterComponent(), + getAvailableHeight() + - cc.getCaptionHeightAboveComponent()); + } else { + // this should not happen normally + return new RenderSpace(getAvailableWidth(), + getAvailableHeight()); + } } public boolean hasContent() { @@ -965,6 +974,8 @@ public class VGridLayout extends SimplePanel implements Paintable, Container { int rowspan = 1; UIDL childUidl; int alignment; + // may be null after setUidl() if content has vanished or changed, set + // in render() ChildComponentContainer cc; public void setUidl(UIDL c) { @@ -986,21 +997,21 @@ public class VGridLayout extends SimplePanel implements Paintable, Container { if (childUidl != null) { if (c == null) { // content has vanished, old content will be removed from - // canvas - // later durin render phase + // canvas later during the render phase cc = null; } else if (cc != null && cc.getWidget() != client.getPaintable(c)) { // content has changed - cc = null; - if (widgetToComponentContainer.containsKey(client - .getPaintable(c))) { - // cc exist for this component (moved) use that for this - // cell - cc = widgetToComponentContainer.get(client - .getPaintable(c)); + Paintable newPaintable = client.getPaintable(c); + if (widgetToComponentContainer.containsKey(newPaintable)) { + // if a key in the map, newPaintable must be a widget + replaceChildComponent(cc.getWidget(), + (Widget) newPaintable); + cc = widgetToComponentContainer.get(newPaintable); cc.setWidth(""); cc.setHeight(""); + } else { + cc = null; } } } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VPopupCalendar.java b/src/com/vaadin/terminal/gwt/client/ui/VPopupCalendar.java index 8d83e8b2b5..9b504bc5f3 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VPopupCalendar.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VPopupCalendar.java @@ -52,7 +52,6 @@ public class VPopupCalendar extends VTextualDate implements Paintable, Field, public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { boolean lastReadOnlyState = readonly; super.updateFromUIDL(uidl, client); - addStyleName(CLASSNAME + "-popupcalendar"); popup.setStyleName(VDateField.CLASSNAME + "-popup " + VDateField.CLASSNAME + "-" + resolutionToString(currentResolution)); @@ -67,6 +66,12 @@ public class VPopupCalendar extends VTextualDate implements Paintable, Field, } + @Override + public void setStyleName(String style) { + // make sure the style is there before size calculation + super.setStyleName(style + " " + CLASSNAME + "-popupcalendar"); + } + public void onClick(ClickEvent event) { if (event.getSource() == calendarToggle && !open && !readonly) { open = true; diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java b/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java index 912cfa37a3..c18fc73b08 100644 --- a/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java +++ b/src/com/vaadin/terminal/gwt/widgetsetutils/ClassPathExplorer.java @@ -19,7 +19,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.TreeSet; import java.util.jar.Attributes; import java.util.jar.JarEntry; import java.util.jar.JarFile; @@ -164,7 +163,9 @@ public class ClassPathExplorer { for (int i = 0; i < widgetsetNames.length; i++) { String widgetsetname = widgetsetNames[i].trim() .intern(); - widgetsets.put(widgetsetname, location); + if (!widgetsetname.equals("")) { + widgetsets.put(widgetsetname, location); + } } } } @@ -423,8 +424,15 @@ public class ClassPathExplorer { * @return URL */ public static URL getDefaultSourceDirectory() { - logger.fine("classpathLocations keys: " - + new TreeSet(classpathLocations.keySet())); + if (logger.isLoggable(Level.FINE)) { + logger.fine("classpathLocations keys:"); + ArrayList locations = new ArrayList(classpathLocations + .keySet()); + for (URL location : locations) { + logger.fine(location.toString()); + } + } + Iterator it = rawClasspathEntries.iterator(); while (it.hasNext()) { String entry = it.next(); diff --git a/src/com/vaadin/ui/Select.java b/src/com/vaadin/ui/Select.java index e8e0dfebaa..4174001d87 100644 --- a/src/com/vaadin/ui/Select.java +++ b/src/com/vaadin/ui/Select.java @@ -234,6 +234,12 @@ public class Select extends AbstractSelect implements AbstractSelect.Filtering, currentPage = -1; // current page is always set by client optionRequest = true; + + // Hide the error indicator if needed + if (isRequired() && isEmpty() && getComponentError() == null + && getErrorMessage() != null) { + target.addAttribute("hideErrors", true); + } } /** diff --git a/tests/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorInvisible.java b/tests/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorInvisible.java new file mode 100644 index 0000000000..026465a624 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/progressindicator/ProgressIndicatorInvisible.java @@ -0,0 +1,52 @@ +package com.vaadin.tests.components.progressindicator; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.ProgressIndicator; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Button.ClickEvent; + +public class ProgressIndicatorInvisible extends TestBase { + + @Override + protected void setup() { + final VerticalLayout lo = new VerticalLayout(); + + addComponent(lo); + + final ProgressIndicator pi = new ProgressIndicator(); + pi.setPollingInterval(400); + lo.addComponent(pi); + + final Button b = new Button("Hide container of progress indicator"); + addComponent(b); + + b.addListener(new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + // If we skip hiding the layout, hiding the ProgressIndicator + // will stop the polling + lo.setVisible(!lo.isVisible()); + // Not even this works + pi.setVisible(!lo.isVisible()); + if (!lo.isVisible()) { + b.setCaption("Still polling"); + } else { + b.setCaption("Hide container of progress indicator"); + } + + } + + }); + } + + @Override + protected String getDescription() { + return "Progress indicator does not stop polling when its parent layout is made invisible"; + } + + @Override + protected Integer getTicketNumber() { + return 4014; + } + +} diff --git a/tests/src/com/vaadin/tests/layouts/GridLayoutNPE.java b/tests/src/com/vaadin/tests/layouts/GridLayoutNPE.java new file mode 100644 index 0000000000..5f67aa1a57 --- /dev/null +++ b/tests/src/com/vaadin/tests/layouts/GridLayoutNPE.java @@ -0,0 +1,72 @@ +package com.vaadin.tests.layouts; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Button.ClickEvent; + +public class GridLayoutNPE extends TestBase { + + @Override + protected void setup() { + final VerticalLayout lo = new VerticalLayout(); + + final GridLayout gl = new GridLayout(2, 1); + gl.setSpacing(true); + + final Label toRemove = new Label("First"); + gl.addComponent(toRemove); + final Label toEdit = new Label("Second"); + gl.addComponent(toEdit); + + final Button b = new Button("remove 'First'"); + final Button b2 = new Button("edit 'Second'"); + b2.setVisible(false); + + lo.addComponent(gl); + lo.addComponent(b); + lo.addComponent(b2); + + b.addListener(new Button.ClickListener() { + + public void buttonClick(Button.ClickEvent event) { + gl.removeComponent(toRemove); + + // move another component to where the first was removed + // before rendering to the client + gl.removeComponent(toEdit); + // this could also be the result of removeAllComponents() + // followed by a loop of addComponent(c) + gl.addComponent(toEdit, 0, 0); + + b.setVisible(false); + b2.setVisible(true); + + } + + }); + + b2.addListener(new Button.ClickListener() { + + public void buttonClick(ClickEvent event) { + toEdit.setValue("Second (edited)"); + } + + }); + + addComponent(lo); + } + + @Override + protected String getDescription() { + return "VGridLayout throws an NPE, causing client side to crash"; + } + + @Override + protected Integer getTicketNumber() { + return 4019; + } + +} -- 2.39.5