diff options
author | Artur Signell <artur@vaadin.com> | 2013-08-19 12:34:29 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2013-08-19 12:34:29 +0300 |
commit | 65b262cd6947f893e4c554efeb7ae2bf0f617bfc (patch) | |
tree | f4d529baf4bc78da337d4c171e49820606dc504a | |
parent | 84651fdb6fc695e3d0752a75f7478577ad8a0063 (diff) | |
parent | 421922705b6e5bd2abf6a11d83f5b4a4791f968a (diff) | |
download | vaadin-framework-65b262cd6947f893e4c554efeb7ae2bf0f617bfc.tar.gz vaadin-framework-65b262cd6947f893e4c554efeb7ae2bf0f617bfc.zip |
Merge changes from origin/7.1
a53d487 Verify the connector hierarchy if assertions are enabled (#12271)
e9f3fcc Fix issue with hidden component cells in Table and TreeTable #12119
cbab936 Fixes light theme window sprites #12171
938d412 Fixes button :active state on firefox #12126
4219227 Fixed wrong classname in WindowThemes TB test #12171
Change-Id: I09bdb2fd0d16acad2afd84c544b26223d5f603a1
9 files changed, 265 insertions, 24 deletions
diff --git a/WebContent/VAADIN/themes/reindeer/window/window.scss b/WebContent/VAADIN/themes/reindeer/window/window.scss index e8f0011397..57bd2d4c12 100644 --- a/WebContent/VAADIN/themes/reindeer/window/window.scss +++ b/WebContent/VAADIN/themes/reindeer/window/window.scss @@ -210,12 +210,12 @@ .#{$primaryStyleName}-closebox { top: 8px; - background-image: url(img/black/close.png); /** sprite-ref: verticals */ + background-image: url(img/black/close.png); /** sprite-ref: black-verticals */ &:hover { - background-image: url(img/black/close-hover.png); /** sprite-ref: verticals */ + background-image: url(img/black/close-hover.png); /** sprite-ref: black-verticals */ } &:active { - background-image: url(img/black/close-pressed.png); /** sprite-ref: verticals */ + background-image: url(img/black/close-pressed.png); /** sprite-ref: black-verticals */ } } .#{$primaryStyleName}-footer { @@ -232,23 +232,23 @@ .#{$primaryStyleName}-maximizebox { top: 8px; - background-image: url(img/black/maximize.png); /** sprite-ref: verticals */ + background-image: url(img/black/maximize.png); /** sprite-ref: black-verticals */ &:hover { - background-image: url(img/black/maximize-hover.png); /** sprite-ref: verticals */ + background-image: url(img/black/maximize-hover.png); /** sprite-ref: black-verticals */ } &:active { - background-image: url(img/black/maximize-active.png); /** sprite-ref: verticals */ + background-image: url(img/black/maximize-active.png); /** sprite-ref: black-verticals */ } } .#{$primaryStyleName}-restorebox { top: 8px; - background-image: url(img/black/restore.png); /** sprite-ref: verticals */ + background-image: url(img/black/restore.png); /** sprite-ref: black-verticals */ &:hover { - background-image: url(img/black/restore-hover.png); /** sprite-ref: verticals */ + background-image: url(img/black/restore-hover.png); /** sprite-ref: black-verticals */ } &:active { - background-image: url(img/black/restore-active.png); /** sprite-ref: verticals */ + background-image: url(img/black/restore-active.png); /** sprite-ref: black-verticals */ } } diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java index 236417f23b..0b64f56c3e 100644 --- a/client/src/com/vaadin/client/ApplicationConnection.java +++ b/client/src/com/vaadin/client/ApplicationConnection.java @@ -2000,12 +2000,15 @@ public class ApplicationConnection { .getConnector(childConnectorId); if (childConnector == null) { VConsole.error("Hierarchy claims that " - + childConnectorId + " is a child for " - + connectorId + " (" + + childConnectorId + + " is a child for " + + connectorId + + " (" + parentConnector.getClass().getName() + ") but no connector with id " + childConnectorId - + " has been registered"); + + " has been registered. " + + "More information might be available in the server-side log if assertions are enabled"); continue; } newChildren.add(childConnector); diff --git a/client/src/com/vaadin/client/ui/VButton.java b/client/src/com/vaadin/client/ui/VButton.java index e67fa6eceb..840ed39114 100644 --- a/client/src/com/vaadin/client/ui/VButton.java +++ b/client/src/com/vaadin/client/ui/VButton.java @@ -142,7 +142,7 @@ public class VButton extends FocusWidget implements ClickHandler { * * -for IE/Opera added CLASSNAME_PRESSED * - * -event.preventDefault() commented from ONMOUSEDOWN (Firefox won't apply + * -event.preventDefault() removed from ONMOUSEDOWN (Firefox won't apply * :active styles if it is present) * * -Tooltip event handling added @@ -189,10 +189,14 @@ public class VButton extends FocusWidget implements ClickHandler { setFocus(true); DOM.setCapture(getElement()); isCapturing = true; - // Prevent dragging (on some browsers); - event.preventDefault(); - if (BrowserInfo.get().isIE() || BrowserInfo.get().isOpera()) { - addStyleName(CLASSNAME_PRESSED); + addStyleName(CLASSNAME_PRESSED); + + if (BrowserInfo.get().isIE8() || BrowserInfo.get().isIE9()) { + /* + * We need to prevent the default behavior on these browsers + * since user-select is not available. + */ + event.preventDefault(); } } break; @@ -204,9 +208,9 @@ public class VButton extends FocusWidget implements ClickHandler { // Click ok disallowNextClick = false; } - if (BrowserInfo.get().isIE() || BrowserInfo.get().isOpera()) { - removeStyleName(CLASSNAME_PRESSED); - } + + removeStyleName(CLASSNAME_PRESSED); + // Explicitly prevent IE 8 from propagating mouseup events // upward (fixes #6753) if (BrowserInfo.get().isIE8()) { @@ -235,9 +239,7 @@ public class VButton extends FocusWidget implements ClickHandler { if (isCapturing) { } setHovering(false); - if (BrowserInfo.get().isIE() || BrowserInfo.get().isOpera()) { - removeStyleName(CLASSNAME_PRESSED); - } + removeStyleName(CLASSNAME_PRESSED); } break; case Event.ONBLUR: diff --git a/server/src/com/vaadin/ui/ConnectorTracker.java b/server/src/com/vaadin/ui/ConnectorTracker.java index c2aeebcd44..0f8ec60104 100644 --- a/server/src/com/vaadin/ui/ConnectorTracker.java +++ b/server/src/com/vaadin/ui/ConnectorTracker.java @@ -22,6 +22,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedList; import java.util.Map; import java.util.Set; import java.util.UUID; @@ -271,6 +272,12 @@ public class ConnectorTracker implements Serializable { } unregisteredConnectors.clear(); + // Do this expensive check only with assertions enabled + assert isHierarchyComplete() : "The connector hierarchy is corrupted. " + + "Check for missing calls to super.setParent(), super.attach() and super.detach() " + + "and that all custom component containers call child.setParent(this) when a child is added and child.setParent(null) when the child is no longer used. " + + "See previous log messages for details."; + // remove detached components from paintableIdMap so they // can be GC'ed Iterator<String> iterator = connectorIdToConnector.keySet().iterator(); @@ -313,6 +320,49 @@ public class ConnectorTracker implements Serializable { cleanStreamVariables(); } + private boolean isHierarchyComplete() { + boolean noErrors = true; + + Set<ClientConnector> danglingConnectors = new HashSet<ClientConnector>( + connectorIdToConnector.values()); + + LinkedList<ClientConnector> stack = new LinkedList<ClientConnector>(); + stack.add(uI); + while (!stack.isEmpty()) { + ClientConnector connector = stack.pop(); + danglingConnectors.remove(connector); + + Iterable<ClientConnector> children = AbstractClientConnector + .getAllChildrenIterable(connector); + for (ClientConnector child : children) { + stack.add(child); + + if (child.getParent() != connector) { + noErrors = false; + getLogger() + .log(Level.WARNING, + "{0} claims that {1} is its child, but the child claims {2} is its parent.", + new Object[] { + getConnectorString(connector), + getConnectorString(child), + getConnectorString(child + .getParent()) }); + } + } + } + + for (ClientConnector dangling : danglingConnectors) { + noErrors = false; + getLogger() + .log(Level.WARNING, + "{0} claims that {1} is its parent, but the parent does not acknowledge the parenthood.", + new Object[] { getConnectorString(dangling), + getConnectorString(dangling.getParent()) }); + } + + return noErrors; + } + /** * Finds the uI that the connector is attached to. * diff --git a/server/src/com/vaadin/ui/Table.java b/server/src/com/vaadin/ui/Table.java index 5dbf927658..3507e6b0a5 100644 --- a/server/src/com/vaadin/ui/Table.java +++ b/server/src/com/vaadin/ui/Table.java @@ -54,6 +54,7 @@ import com.vaadin.event.dd.DropHandler; import com.vaadin.event.dd.DropTarget; import com.vaadin.event.dd.acceptcriteria.ServerSideCriterion; import com.vaadin.server.KeyMapper; +import com.vaadin.server.LegacyCommunicationManager; import com.vaadin.server.LegacyPaint; import com.vaadin.server.PaintException; import com.vaadin.server.PaintTarget; @@ -3784,7 +3785,9 @@ public class Table extends AbstractSelect implements Action.Container, + currentColumn][indexInRowbuffer])) { final Component c = (Component) cells[CELL_FIRSTCOL + currentColumn][indexInRowbuffer]; - if (c == null) { + if (c == null + || !LegacyCommunicationManager + .isComponentVisibleToClient(c)) { target.addText(""); } else { LegacyPaint.paint(c, target); diff --git a/uitest/src/com/vaadin/tests/components/table/HiddenComponentCells.html b/uitest/src/com/vaadin/tests/components/table/HiddenComponentCells.html new file mode 100644 index 0000000000..22ba16abca --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/HiddenComponentCells.html @@ -0,0 +1,27 @@ +<?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://localhost:7171/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.table.HiddenComponentCells?restartApplication</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>hidden-cells</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/table/HiddenComponentCells.java b/uitest/src/com/vaadin/tests/components/table/HiddenComponentCells.java new file mode 100644 index 0000000000..32046932cc --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/HiddenComponentCells.java @@ -0,0 +1,67 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +/** + * + */ +package com.vaadin.tests.components.table; + +import com.vaadin.data.Item; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; + +/** + * + * @since + * @author Vaadin Ltd + */ +public class HiddenComponentCells extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final Table tbl = new Table(); + tbl.addContainerProperty("col1", Label.class, null); + tbl.addContainerProperty("col2", Label.class, null); + + for (int rows = 0; rows < 20; rows++) { + + Item item = tbl.addItem(rows); + + Label cb = new Label("col1"); + cb.setVisible(rows % 2 == 0); + item.getItemProperty("col1").setValue(cb); + + cb = new Label("col2"); + cb.setVisible((rows + 1) % 2 == 0); + item.getItemProperty("col2").setValue(cb); + } + + addComponent(tbl); + } + + @Override + protected String getTestDescription() { + return "Hiding a component in the Table should not cause exceptions. <br/> Every other cell in the table should be hidden."; + } + + @Override + protected Integer getTicketNumber() { + return 12119; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/window/WindowThemes.html b/uitest/src/com/vaadin/tests/components/window/WindowThemes.html new file mode 100644 index 0000000000..7e8d8af53d --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/WindowThemes.html @@ -0,0 +1,27 @@ +<?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://localhost:7171/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.window.WindowThemes</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>windows</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/window/WindowThemes.java b/uitest/src/com/vaadin/tests/components/window/WindowThemes.java new file mode 100644 index 0000000000..2b39916db8 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/WindowThemes.java @@ -0,0 +1,62 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +/** + * + */ +package com.vaadin.tests.components.window; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Label; +import com.vaadin.ui.Window; +import com.vaadin.ui.themes.Reindeer; + +public class WindowThemes extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + Window def = new Window("default", new Label("Some content")); + def.setWidth("300px"); + def.setHeight("100%"); + addWindow(def); + + Window light = new Window("WINDOW_LIGHT", new Label("Some content")); + light.setStyleName(Reindeer.WINDOW_LIGHT); + light.setPositionX(300); + light.setWidth("300px"); + light.setHeight("100%"); + addWindow(light); + + Window black = new Window("WINDOW_BLACK", new Label("Some content")); + black.setStyleName(Reindeer.WINDOW_BLACK); + black.setPositionX(600); + black.setWidth("300px"); + black.setHeight("100%"); + addWindow(black); + } + + @Override + protected String getTestDescription() { + return "Shows the different css themes of Window"; + } + + @Override + protected Integer getTicketNumber() { + // Not tied to any specific ticket + return null; + } +} |