diff options
35 files changed, 1048 insertions, 565 deletions
diff --git a/buildhelpers/src/com/vaadin/buildhelpers/FetchReleaseNotesTickets.java b/buildhelpers/src/com/vaadin/buildhelpers/FetchReleaseNotesTickets.java index 5b424f98b1..0cd06890eb 100644 --- a/buildhelpers/src/com/vaadin/buildhelpers/FetchReleaseNotesTickets.java +++ b/buildhelpers/src/com/vaadin/buildhelpers/FetchReleaseNotesTickets.java @@ -26,10 +26,10 @@ import java.util.List; import org.apache.commons.io.IOUtils; public class FetchReleaseNotesTickets { - private static final String queryURL = "http://dev.vaadin.com/query?status=pending-release&status=released&@milestone@&resolution=fixed&col=id&col=summary&col=owner&col=type&col=priority&col=component&col=version&col=bfptime&col=fv&format=tab&order=id"; + private static final String queryURL = "https://dev.vaadin.com/query?status=pending-release&status=released&@milestone@&resolution=fixed&col=id&col=summary&col=owner&col=type&col=priority&col=component&col=version&col=bfptime&col=fv&format=tab&order=id"; private static final String ticketTemplate = "<tr>" + "@badge@" // - + "<td class=\"ticket\"><a href=\"http://dev.vaadin.com/ticket/@ticket@\">#@ticket@</a></td>" // + + "<td class=\"ticket\"><a href=\"https://dev.vaadin.com/ticket/@ticket@\">#@ticket@</a></td>" // + "<td>@description@</td>" // + "</tr>"; // diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java index 501dedbaa8..d28686e777 100644 --- a/client/src/com/vaadin/client/ui/VWindow.java +++ b/client/src/com/vaadin/client/ui/VWindow.java @@ -558,6 +558,21 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, w.bringToFrontSequence = -1; } } + focusTopmostModalWindow(); + } + + private static void focusTopmostModalWindow() { + // If we call focus() directly without scheduling, it does not work in + // IE and FF. + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + @Override + public void execute() { + VWindow topmost = getTopmostWindow(); + if ((topmost != null) && (topmost.vaadinModality)) { + topmost.focus(); + } + } + }); } @Override @@ -690,6 +705,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, while (curIndex < windowOrder.size()) { windowOrder.get(curIndex).setWindowOrder(curIndex++); } + focusTopmostModalWindow(); } private void fixIE8FocusCaptureIssue() { diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java index 804ad45f92..e7c252f26a 100644 --- a/client/src/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java @@ -887,6 +887,26 @@ public class UIConnector extends AbstractSingleComponentContainerConnector } + private void updateVaadinFavicon(String newTheme) { + NodeList<Element> iconElements = querySelectorAll("link[rel~=\"icon\"]"); + for (int i = 0; i < iconElements.getLength(); i++) { + Element iconElement = iconElements.getItem(i); + + String href = iconElement.getAttribute("href"); + if (href != null && href.contains("VAADIN/themes") + && href.endsWith("/favicon.ico")) { + href = href.replaceFirst("VAADIN/themes/.+?/favicon.ico", + "VAADIN/themes/" + newTheme + "/favicon.ico"); + iconElement.setAttribute("href", href); + } + } + } + + private static native NodeList<Element> querySelectorAll(String selector) + /*-{ + return $doc.querySelectorAll(selector); + }-*/; + /** * Finds a link tag for a style sheet with the given URL * @@ -979,6 +999,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector getWidget().getParent().addStyleName(newTheme); VOverlay.getOverlayContainer(getConnection()).addClassName( activeTheme); + + updateVaadinFavicon(newTheme); } forceStateChangeRecursively(UIConnector.this); diff --git a/client/src/com/vaadin/client/widgets/Escalator.java b/client/src/com/vaadin/client/widgets/Escalator.java index cfbbb7dace..17236c5e30 100644 --- a/client/src/com/vaadin/client/widgets/Escalator.java +++ b/client/src/com/vaadin/client/widgets/Escalator.java @@ -2032,8 +2032,9 @@ public class Escalator extends Widget implements RequiresResize, return new Cell(domRowIndex, domColumnIndex, cellElement); } - void createAutoSizeElements(int colIndex, - Collection<TableCellElement> elements) { + double getMaxCellWidth(int colIndex) throws IllegalArgumentException { + double maxCellWidth = -1; + assert isAttached() : "Can't measure max width of cell, since Escalator is not attached to the DOM."; NodeList<TableRowElement> rows = root.getRows(); @@ -2062,9 +2063,24 @@ public class Escalator extends Widget implements RequiresResize, cellClone.getStyle().clearWidth(); rowElement.insertBefore(cellClone, cellOriginal); + double requiredWidth = WidgetUtil + .getRequiredWidthBoundingClientRectDouble(cellClone); + + if (BrowserInfo.get().isIE()) { + /* + * IE browsers have some issues with subpixels. Occasionally + * content is overflown even if not necessary. Increase the + * counted required size by 0.01 just to be on the safe + * side. + */ + requiredWidth += 0.01; + } - elements.add(cellClone); + maxCellWidth = Math.max(requiredWidth, maxCellWidth); + cellClone.removeFromParent(); } + + return maxCellWidth; } private boolean cellIsPartOfSpan(TableCellElement cell) { @@ -3926,8 +3942,7 @@ public class Escalator extends Widget implements RequiresResize, if (px < 0) { if (isAttached()) { - autosizeColumns(Collections.singletonList(columns - .indexOf(this))); + calculateWidth(); } else { /* * the column's width is calculated at Escalator.onLoad @@ -3981,6 +3996,10 @@ public class Escalator extends Widget implements RequiresResize, } return false; } + + private void calculateWidth() { + calculatedWidth = getMaxCellWidth(columns.indexOf(this)); + } } private final List<Column> columns = new ArrayList<Column>(); @@ -4285,7 +4304,6 @@ public class Escalator extends Widget implements RequiresResize, return; } - List<Integer> autosizeColumns = new ArrayList<Integer>(); for (Entry<Integer, Double> entry : indexWidthMap.entrySet()) { int index = entry.getKey().intValue(); double width = entry.getValue().doubleValue(); @@ -4295,14 +4313,9 @@ public class Escalator extends Widget implements RequiresResize, } checkValidColumnIndex(index); - if (width >= 0) { - columns.get(index).setWidth(width); - } else { - autosizeColumns.add(index); - } - } + columns.get(index).setWidth(width); - autosizeColumns(autosizeColumns); + } widthsArray = null; header.reapplyColumnWidths(); @@ -4314,64 +4327,6 @@ public class Escalator extends Widget implements RequiresResize, recalculateElementSizes(); } - private void autosizeColumns(List<Integer> columns) { - if (columns.isEmpty()) { - return; - } - - // Must process columns in index order - Collections.sort(columns); - - Map<Integer, List<TableCellElement>> autoSizeElements = new HashMap<Integer, List<TableCellElement>>(); - try { - // Set up the entire DOM at once - for (int i = columns.size() - 1; i >= 0; i--) { - // Iterate backwards to not mess with the indexing - Integer colIndex = columns.get(i); - - ArrayList<TableCellElement> elements = new ArrayList<TableCellElement>(); - autoSizeElements.put(colIndex, elements); - - header.createAutoSizeElements(colIndex, elements); - body.createAutoSizeElements(colIndex, elements); - footer.createAutoSizeElements(colIndex, elements); - } - - // Extract all measurements & update values - for (Integer colIndex : columns) { - double maxWidth = Double.NEGATIVE_INFINITY; - List<TableCellElement> elements = autoSizeElements - .get(colIndex); - for (TableCellElement element : elements) { - - double cellWidth = WidgetUtil - .getRequiredWidthBoundingClientRectDouble(element); - - maxWidth = Math.max(maxWidth, cellWidth); - } - assert maxWidth >= 0 : "Got a negative max width for a column, which should be impossible."; - - if (BrowserInfo.get().isIE()) { - /* - * IE browsers have some issues with subpixels. - * Occasionally content is overflown even if not - * necessary. Increase the counted required size by 0.01 - * just to be on the safe side. - */ - maxWidth += 0.01; - } - - this.columns.get(colIndex).calculatedWidth = maxWidth; - } - } finally { - for (List<TableCellElement> list : autoSizeElements.values()) { - for (TableCellElement element : list) { - element.removeFromParent(); - } - } - } - } - private void checkValidColumnIndex(int index) throws IllegalArgumentException { if (!Range.withLength(0, getColumnCount()).contains(index)) { @@ -4391,6 +4346,18 @@ public class Escalator extends Widget implements RequiresResize, return columns.get(index).getCalculatedWidth(); } + private double getMaxCellWidth(int colIndex) + throws IllegalArgumentException { + double headerWidth = header.getMaxCellWidth(colIndex); + double bodyWidth = body.getMaxCellWidth(colIndex); + double footerWidth = footer.getMaxCellWidth(colIndex); + + double maxWidth = Math.max(headerWidth, + Math.max(bodyWidth, footerWidth)); + assert maxWidth >= 0 : "Got a negative max width for a column, which should be impossible."; + return maxWidth; + } + /** * Calculates the width of the columns in a given range. * diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index 6717f0c17d..0934d61eeb 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -219,13 +219,13 @@ public class Grid<T> extends ResizeComposite implements * @param <ROWTYPE> * the type of the rows in the section */ - protected abstract static class StaticSection<ROWTYPE extends StaticSection.StaticRow<?>> { + public abstract static class StaticSection<ROWTYPE extends StaticSection.StaticRow<?>> { /** * A header or footer cell. Has a simple textual caption. * */ - static class StaticCell { + public static class StaticCell { private Object content = null; @@ -398,7 +398,7 @@ public class Grid<T> extends ResizeComposite implements * @param <CELLTYPE> * the type of the cells in the row */ - abstract static class StaticRow<CELLTYPE extends StaticCell> { + public abstract static class StaticRow<CELLTYPE extends StaticCell> { private Map<Column<?, ?>, CELLTYPE> cells = new HashMap<Column<?, ?>, CELLTYPE>(); diff --git a/push/build.xml b/push/build.xml index 336c3629aa..a2fdaa2df3 100644 --- a/push/build.xml +++ b/push/build.xml @@ -18,7 +18,7 @@ location="${result.dir}/js/VAADIN/vaadinPush.debug.js" /> <!-- Keep the version number in sync with ivy.xml, server/src/com/vaadin/server/Constants.java --> - <property name="atmosphere.runtime.version" value="2.2.4.vaadin5" /> + <property name="atmosphere.runtime.version" value="2.2.4.vaadin7" /> <property name="jquery.js" location="lib/jquery/jquery-1.11.0.js" /> <path id="classpath.compile.custom" /> diff --git a/push/ivy.xml b/push/ivy.xml index 8827d92bc0..ec4979eafb 100644 --- a/push/ivy.xml +++ b/push/ivy.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ivy-module [ <!-- Keep the version number in sync with build.xml --> - <!ENTITY atmosphere.runtime.version "2.2.4.vaadin5"> + <!ENTITY atmosphere.runtime.version "2.2.4.vaadin7"> - <!ENTITY atmosphere.js.version "2.2.6.vaadin3"> + <!ENTITY atmosphere.js.version "2.2.6.vaadin4"> ]> <ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/scripts/updateSinceTags.sh b/scripts/updateSinceTags.sh index f07ba7fb7e..a4e60cab2e 100755 --- a/scripts/updateSinceTags.sh +++ b/scripts/updateSinceTags.sh @@ -11,7 +11,7 @@ fi scriptdir=`dirname $0` basedir=$scriptdir"/.." -sincefiles=`find $basedir -name *.java|xargs egrep -Hi "(@since$|@since $)"|grep -v "./work/"|grep -v "./uitest/"|grep -v "/tests/"|cut -d: -f 1|sort|uniq` +sincefiles=`find $basedir -name "*.java"|xargs egrep -Hi "(@since$|@since $)"|grep -v "./work/"|grep -v "./uitest/"|grep -v "/tests/"|cut -d: -f 1|sort|uniq` # Stupid feature detection using an invalid parameter. # Mac requires a parameter for the -i option (creates a backup file with that suffix) @@ -25,6 +25,7 @@ else fi for f in $sincefiles do + echo "Fixing $f..." $sedCmd "s/@since\$/@since $version/g" $f $sedCmd "s/@since \$/@since $version/g" $f done diff --git a/server/src/com/vaadin/server/Constants.java b/server/src/com/vaadin/server/Constants.java index f3cdd48d58..2cffab8cba 100644 --- a/server/src/com/vaadin/server/Constants.java +++ b/server/src/com/vaadin/server/Constants.java @@ -67,7 +67,7 @@ public interface Constants { // Keep the version number in sync with push/build.xml and other locations // listed in that file - static final String REQUIRED_ATMOSPHERE_RUNTIME_VERSION = "2.2.4.vaadin5"; + static final String REQUIRED_ATMOSPHERE_RUNTIME_VERSION = "2.2.4.vaadin7"; static final String INVALID_ATMOSPHERE_VERSION_WARNING = "\n" + "=================================================================\n" diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java index dae073904b..3ceb06b31e 100644 --- a/server/src/com/vaadin/ui/AbstractComponent.java +++ b/server/src/com/vaadin/ui/AbstractComponent.java @@ -1239,8 +1239,6 @@ public abstract class AbstractComponent extends AbstractClientConnector */ @Override public void writeDesign(Element design, DesignContext designContext) { - // clear element contents - DesignAttributeHandler.clearElement(design); AbstractComponent def = designContext.getDefaultInstance(this); Attributes attr = design.attributes(); // handle default attributes diff --git a/server/src/com/vaadin/ui/AbstractSelect.java b/server/src/com/vaadin/ui/AbstractSelect.java index 6ac0dad5e4..0e3cfef4ce 100644 --- a/server/src/com/vaadin/ui/AbstractSelect.java +++ b/server/src/com/vaadin/ui/AbstractSelect.java @@ -2192,6 +2192,10 @@ public abstract class AbstractSelect extends AbstractField<Object> implements // handle default attributes super.readDesign(design, context); // handle children specifying selectable items (<option>) + readItems(design, context); + } + + protected void readItems(Element design, DesignContext context) { Set<String> selected = new HashSet<String>(); for (Element child : design.children()) { readItem(child, selected, context); diff --git a/server/src/com/vaadin/ui/Component.java b/server/src/com/vaadin/ui/Component.java index adef4b69c5..5db48806c3 100644 --- a/server/src/com/vaadin/ui/Component.java +++ b/server/src/com/vaadin/ui/Component.java @@ -747,7 +747,7 @@ public interface Component extends ClientConnector, Sizeable, Serializable { * * @since 7.4 * @param design - * The design as HTML to obtain the state from + * The element to obtain the state from * @param designContext * The DesignContext instance used for parsing the design */ @@ -763,8 +763,11 @@ public interface Component extends ClientConnector, Sizeable, Serializable { * * @since 7.4 * @param design - * The design as HTML to update with the current state + * The element to write the component state to. Any previous + * attributes or child nodes are <i>not</i> cleared. * @param designContext + * The DesignContext instance used for writing the design + * */ public void writeDesign(Element design, DesignContext designContext); diff --git a/server/src/com/vaadin/ui/Table.java b/server/src/com/vaadin/ui/Table.java index 347bb8fbff..eb3d35be3e 100644 --- a/server/src/com/vaadin/ui/Table.java +++ b/server/src/com/vaadin/ui/Table.java @@ -34,6 +34,9 @@ import java.util.StringTokenizer; import java.util.logging.Level; import java.util.logging.Logger; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; + import com.vaadin.data.Container; import com.vaadin.data.Item; import com.vaadin.data.Property; @@ -63,6 +66,9 @@ import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.MultiSelectMode; import com.vaadin.shared.ui.table.TableConstants; import com.vaadin.shared.util.SharedUtil; +import com.vaadin.ui.declarative.DesignAttributeHandler; +import com.vaadin.ui.declarative.DesignContext; +import com.vaadin.ui.declarative.DesignException; /** * <p> @@ -3863,7 +3869,7 @@ public class Table extends AbstractSelect implements Action.Container, /** * Checks whether row headers are visible. - * + * * @return {@code false} if row headers are hidden, {@code true} otherwise * @since 7.3.9 */ @@ -6025,6 +6031,264 @@ public class Table extends AbstractSelect implements Action.Container, return iterator(); } + @Override + public void readDesign(Element design, DesignContext context) { + super.readDesign(design, context); + + if (design.hasAttr("sortable")) { + setSortEnabled(DesignAttributeHandler.readAttribute("sortable", + design.attributes(), boolean.class)); + } + + readColumns(design); + readHeader(design); + readBody(design); + readFooter(design); + } + + private void readColumns(Element design) { + Element colgroup = design.select("> table > colgroup").first(); + + if (colgroup != null) { + int i = 0; + List<Object> pIds = new ArrayList<Object>(); + for (Element col : colgroup.children()) { + if (!col.tagName().equals("col")) { + throw new DesignException("invalid column"); + } + + String id = DesignAttributeHandler.readAttribute("property-id", + col.attributes(), "property-" + i++, String.class); + pIds.add(id); + + addContainerProperty(id, String.class, null); + + if (col.hasAttr("width")) { + setColumnWidth( + id, + DesignAttributeHandler.readAttribute("width", + col.attributes(), Integer.class)); + } + if (col.hasAttr("center")) { + setColumnAlignment(id, Align.CENTER); + } else if (col.hasAttr("right")) { + setColumnAlignment(id, Align.RIGHT); + } + if (col.hasAttr("expand")) { + if (col.attr("expand").isEmpty()) { + setColumnExpandRatio(id, 1); + } else { + setColumnExpandRatio(id, + DesignAttributeHandler.readAttribute("expand", + col.attributes(), float.class)); + } + } + if (col.hasAttr("collapsible")) { + setColumnCollapsible(id, + DesignAttributeHandler.readAttribute("collapsible", + col.attributes(), boolean.class)); + } + if (col.hasAttr("collapsed")) { + setColumnCollapsed(id, + DesignAttributeHandler.readAttribute("collapsed", + col.attributes(), boolean.class)); + } + } + setVisibleColumns(pIds.toArray()); + } + } + + private void readFooter(Element design) { + readHeaderOrFooter(design, false); + } + + private void readHeader(Element design) { + readHeaderOrFooter(design, true); + } + + @Override + protected void readItems(Element design, DesignContext context) { + // Do nothing - header/footer and inline data must be handled after + // colgroup. + } + + private void readHeaderOrFooter(Element design, boolean header) { + String selector = header ? "> table > thead" : "> table > tfoot"; + Element elem = design.select(selector).first(); + if (elem != null) { + if (!header) { + setFooterVisible(true); + } + if (elem.children().size() != 1) { + throw new DesignException( + "Table header and footer should contain exactly one <tr> element"); + } + Element tr = elem.child(0); + Elements elems = tr.children(); + Collection<?> propertyIds = visibleColumns; + if (elems.size() != propertyIds.size()) { + throw new DesignException( + "Table header and footer should contain as many items as there" + + " are columns in the Table."); + } + Iterator<?> propertyIt = propertyIds.iterator(); + for (Element e : elems) { + String columnValue = e.html(); + Object propertyId = propertyIt.next(); + if (header) { + setColumnHeader(propertyId, columnValue); + if (e.hasAttr("icon")) { + setColumnIcon( + propertyId, + DesignAttributeHandler.readAttribute("icon", + e.attributes(), Resource.class)); + } + } else { + setColumnFooter(propertyId, columnValue); + } + } + } + } + + private void readBody(Element design) { + Element tbody = design.select("> table > tbody").first(); + if (tbody != null) { + for (Element row : tbody.children()) { + Elements cells = row.children(); + if (visibleColumns.size() != cells.size()) { + throw new DesignException( + "Wrong number of columns in a row of a Table. Expected " + + visibleColumns.size() + ", was " + + cells.size() + "."); + } + Object[] data = new String[cells.size()]; + for (int c = 0; c < cells.size(); ++c) { + data[c] = cells.get(c).html(); + } + Object itemId = addItem(data, null); + if (itemId == null) { + throw new DesignException( + "A row of a Table could not be read"); + } + } + } + } + + @Override + public void writeDesign(Element design, DesignContext context) { + Table def = context.getDefaultInstance(this); + + DesignAttributeHandler.writeAttribute("sortable", design.attributes(), + isSortEnabled(), def.isSortEnabled(), boolean.class); + + Element table = null; + boolean hasColumns = getVisibleColumns().length != 0; + if (hasColumns) { + table = design.appendElement("table"); + writeColumns(table, def); + writeHeader(table, def); + } + super.writeDesign(design, context); + if (hasColumns) { + writeFooter(table); + } + } + + private void writeColumns(Element table, Table def) { + Object[] columns = getVisibleColumns(); + if (columns.length == 0) { + return; + } + + Element colgroup = table.appendElement("colgroup"); + for (Object id : columns) { + Element col = colgroup.appendElement("col"); + + col.attr("property-id", id.toString()); + + if (getColumnAlignment(id) == Align.CENTER) { + col.attr("center", ""); + } else if (getColumnAlignment(id) == Align.RIGHT) { + col.attr("right", ""); + } + + DesignAttributeHandler.writeAttribute("width", col.attributes(), + getColumnWidth(id), def.getColumnWidth(null), int.class); + + DesignAttributeHandler.writeAttribute("expand", col.attributes(), + getColumnExpandRatio(id), def.getColumnExpandRatio(null), + float.class); + + DesignAttributeHandler.writeAttribute("collapsible", + col.attributes(), isColumnCollapsible(id), + def.isColumnCollapsible(null), boolean.class); + + DesignAttributeHandler.writeAttribute("collapsed", + col.attributes(), isColumnCollapsed(id), + def.isColumnCollapsed(null), boolean.class); + } + } + + private void writeHeader(Element table, Table def) { + Object[] columns = getVisibleColumns(); + if (columns.length == 0 + || (columnIcons.isEmpty() && columnHeaders.isEmpty())) { + return; + } + + Element header = table.appendElement("thead").appendElement("tr"); + for (Object id : columns) { + Element th = header.appendElement("th"); + th.html(getColumnHeader(id)); + DesignAttributeHandler.writeAttribute("icon", th.attributes(), + getColumnIcon(id), def.getColumnIcon(null), Resource.class); + } + + } + + private void writeFooter(Element table) { + Object[] columns = getVisibleColumns(); + if (columns.length == 0 || columnFooters.isEmpty()) { + return; + } + + Element footer = table.appendElement("tfoot").appendElement("tr"); + for (Object id : columns) { + footer.appendElement("td").text(getColumnFooter(id)); + } + } + + @Override + protected void writeItems(Element design, DesignContext context) { + Element tbody = design.child(0).appendElement("tbody"); + super.writeItems(tbody, context); + } + + @Override + protected Element writeItem(Element tbody, Object itemId, + DesignContext context) { + Element tr = tbody.appendElement("tr"); + Item item = getItem(itemId); + for (Object id : getVisibleColumns()) { + Element td = tr.appendElement("td"); + td.html(item.getItemProperty(id).getValue().toString()); + } + return tr; + } + + @Override + protected Collection<String> getCustomAttributes() { + Collection<String> result = super.getCustomAttributes(); + result.add("sortable"); + result.add("sort-enabled"); + result.add("sort-disabled"); + result.add("footer-visible"); + result.add("item-caption-mode"); + result.add("current-page-first-item-id"); + result.add("current-page-first-item-index"); + return result; + } + private final Logger getLogger() { if (logger == null) { logger = Logger.getLogger(Table.class.getName()); diff --git a/server/tests/src/com/vaadin/tests/design/DeclarativeTestBaseBase.java b/server/tests/src/com/vaadin/tests/design/DeclarativeTestBaseBase.java index 3afef0e2ee..f0714ef3bd 100644 --- a/server/tests/src/com/vaadin/tests/design/DeclarativeTestBaseBase.java +++ b/server/tests/src/com/vaadin/tests/design/DeclarativeTestBaseBase.java @@ -94,7 +94,7 @@ public abstract class DeclarativeTestBaseBase<T extends Component> { Assert.assertEquals(message + ": array length", a1.length, a2.length); for (int i = 0; i < a1.length; i++) { - assertEquals(message, a1[i], a2[i]); + assertEquals(message + ": element " + i, a1[i], a2[i]); } return; } diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java index dbd945a3d8..55231e5494 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java @@ -15,18 +15,12 @@ */ package com.vaadin.tests.server.component.abstractfield; -import static org.junit.Assert.assertTrue; - -import org.jsoup.nodes.Attributes; -import org.jsoup.nodes.Element; -import org.jsoup.parser.Tag; import org.junit.Test; import com.vaadin.data.util.ObjectProperty; import com.vaadin.tests.design.DeclarativeTestBase; import com.vaadin.ui.AbstractField; import com.vaadin.ui.TextField; -import com.vaadin.ui.declarative.DesignContext; /** * Tests declarative support for implementations of {@link AbstractField}. @@ -64,21 +58,6 @@ public class AbstractFieldDeclarativeTest extends } @Test - public void testWriteRemovesOldContent() { - Attributes attr = new Attributes(); - attr.put("should_be_removed", "foo"); - Element design = new Element(Tag.valueOf("v-text-field"), "", attr); - AbstractField component = new TextField(); - component.setReadOnly(true); - component.writeDesign(design, new DesignContext()); - // we only changed one of the attributes, others are at default values - assertEquals(1, design.attributes().size()); - assertTrue("Design must contain readonly", design.hasAttr("readonly")); - assertTrue("Readonly must be true", design.attr("readonly").equals("") - || design.attr("readonly").equals("true")); - } - - @Test public void testModelReadOnly() { // Test that read only value coming from property data source is not // written to design. diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/AbstractOrderedLayoutDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/AbstractOrderedLayoutDeclarativeTest.java index 192ea0f4f3..8ccd41f797 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/AbstractOrderedLayoutDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractorderedlayout/AbstractOrderedLayoutDeclarativeTest.java @@ -15,14 +15,9 @@ */ package com.vaadin.tests.server.component.abstractorderedlayout; -import static org.junit.Assert.assertTrue; - import java.util.Arrays; import java.util.List; -import org.jsoup.nodes.Attributes; -import org.jsoup.nodes.Element; -import org.jsoup.parser.Tag; import org.junit.Test; import com.vaadin.shared.ui.label.ContentMode; @@ -32,7 +27,6 @@ import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.declarative.DesignContext; /** * Tests declarative support for AbstractOrderedLayout. @@ -86,45 +80,6 @@ public class AbstractOrderedLayoutDeclarativeTest extends testWrite(design, layout); } - @Test - public void testWriteRemovesOldElementContent() { - // Create an element with some content - Attributes rootAttributes = new Attributes(); - rootAttributes.put("caption", "test-layout"); - Element design = new Element(Tag.valueOf("v-vertical-layout"), "", - rootAttributes); - Attributes firstChildAttributes = new Attributes(); - firstChildAttributes.put("caption", "test-label"); - Element firstChild = new Element(Tag.valueOf("v-label"), "", - firstChildAttributes); - design.appendChild(firstChild); - - Attributes secondChildAttributes = new Attributes(); - secondChildAttributes.put("caption", "test-button"); - Element secondChild = new Element(Tag.valueOf("v-button"), "", - secondChildAttributes); - design.appendChild(secondChild); - Attributes thirdChildAttributes = new Attributes(); - thirdChildAttributes.put("caption", "test-button-2"); - Element thirdChild = new Element(Tag.valueOf("v-button"), "", - thirdChildAttributes); - design.appendChild(thirdChild); - // Create and write a layout and check the new contents of the element - // node - VerticalLayout layout = new VerticalLayout(); - layout.addComponent(new Label("test-label")); - layout.getComponent(0).setCaption("test-caption"); - layout.setExpandRatio(layout.getComponent(0), 1.0f); - layout.addComponent(new Label("test-label-2")); - layout.writeDesign(design, new DesignContext()); - assertEquals(2, design.childNodes().size()); - assertEquals("v-label", ((Element) design.childNode(0)).tagName()); - assertEquals("test-caption", design.childNode(0).attr("caption")); - assertTrue(design.childNode(0).hasAttr(":expand")); - assertEquals("", design.childNode(0).attr(":expand")); - - } - private String getDesign(float expandRatio, boolean margin, String... alignments) { String result = "<v-vertical-layout caption=test-layout"; diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelDeclarativeTest.java index 1f2113fabc..2d6db6d19a 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/AbstractSplitPanelDeclarativeTest.java @@ -15,9 +15,6 @@ */ package com.vaadin.tests.server.component.abstractsplitpanel; -import static junit.framework.TestCase.assertTrue; - -import org.jsoup.nodes.Element; import org.junit.Test; import com.vaadin.server.Sizeable.Unit; @@ -25,11 +22,9 @@ import com.vaadin.tests.design.DeclarativeTestBase; import com.vaadin.ui.AbstractSplitPanel; import com.vaadin.ui.Button; import com.vaadin.ui.HorizontalSplitPanel; -import com.vaadin.ui.Label; import com.vaadin.ui.Table; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalSplitPanel; -import com.vaadin.ui.declarative.DesignContext; /** * Tests declarative support for AbstractSplitPanel. @@ -88,23 +83,4 @@ public class AbstractSplitPanelDeclarativeTest extends testRead(design, sp); testWrite(design, sp); } - - @Test - public void testReSynchronize() { - // Test that old children and attributes are removed when an element is - // synchronized to a new component. - DesignContext ctx = new DesignContext(); - VerticalSplitPanel sp = new VerticalSplitPanel(); - sp.setMinSplitPosition(5.5f, Unit.PERCENTAGE); - sp.setMaxSplitPosition(95, Unit.PERCENTAGE); - sp.setFirstComponent(new Button("First slot")); - sp.setSecondComponent(new Label("Second slot")); - Element e = ctx.createElement(sp); - sp = new VerticalSplitPanel(); - sp.writeDesign(e, ctx); - assertTrue("There should be no attributes in the node.", e.attributes() - .size() == 0); - assertTrue("There should be no child elements.", - e.children().size() == 0); - } }
\ No newline at end of file diff --git a/server/tests/src/com/vaadin/tests/server/component/button/ButtonDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/button/ButtonDeclarativeTest.java index 02dfa22671..51abf6be96 100644 --- a/server/tests/src/com/vaadin/tests/server/component/button/ButtonDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/button/ButtonDeclarativeTest.java @@ -15,11 +15,6 @@ */ package com.vaadin.tests.server.component.button; -import static org.junit.Assert.assertTrue; - -import org.jsoup.nodes.Attributes; -import org.jsoup.nodes.Element; -import org.jsoup.parser.Tag; import org.junit.Test; import com.vaadin.event.ShortcutAction.KeyCode; @@ -27,7 +22,6 @@ import com.vaadin.event.ShortcutAction.ModifierKey; import com.vaadin.tests.design.DeclarativeTestBase; import com.vaadin.ui.Button; import com.vaadin.ui.NativeButton; -import com.vaadin.ui.declarative.DesignContext; /** * Tests declarative support for implementations of {@link Button} and @@ -112,17 +106,4 @@ public class ButtonDeclarativeTest extends DeclarativeTestBase<Button> { testRead(design, b); testWrite(design, b); } - - @Test - public void testWriteUpdatesContentMode() { - DesignContext ctx = new DesignContext(); - Button button = new Button("OK"); - Element e = new Element(Tag.valueOf("v-button"), "", new Attributes()); - button.writeDesign(e, ctx); - assertTrue("Button is plain text by default", e.hasAttr("plain-text")); - - button.setHtmlContentAllowed(true); - button.writeDesign(e, ctx); - assertTrue("Button is updated to HTML", !e.hasAttr("plain-text")); - } }
\ No newline at end of file diff --git a/server/tests/src/com/vaadin/tests/server/component/csslayout/CssLayoutDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/csslayout/CssLayoutDeclarativeTest.java index 4cb3fb13e5..0782295310 100644 --- a/server/tests/src/com/vaadin/tests/server/component/csslayout/CssLayoutDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/csslayout/CssLayoutDeclarativeTest.java @@ -15,9 +15,6 @@ */ package com.vaadin.tests.server.component.csslayout; -import org.jsoup.nodes.Attributes; -import org.jsoup.nodes.Element; -import org.jsoup.parser.Tag; import org.junit.Test; import com.vaadin.shared.ui.label.ContentMode; @@ -25,7 +22,6 @@ import com.vaadin.tests.design.DeclarativeTestBase; import com.vaadin.ui.Button; import com.vaadin.ui.CssLayout; import com.vaadin.ui.Label; -import com.vaadin.ui.declarative.DesignContext; /** * Tests declarative support for CssLayout. @@ -64,33 +60,4 @@ public class CssLayoutDeclarativeTest extends DeclarativeTestBase<CssLayout> { testRead(design, layout); testWrite(design, layout); } - - @Test - public void testWriteWithOldContents() { - // Test that any old contents of an element are removed when - // writing a design. - Element design = createDesign(); - CssLayout layout = new CssLayout(); - layout.addComponent(new Label("test-label")); - layout.getComponent(0).setCaption("test-caption"); - layout.addComponent(new Label("test-label-2")); - layout.writeDesign(design, new DesignContext()); - assertEquals(2, design.childNodes().size()); - assertEquals("v-label", ((Element) design.childNode(0)).tagName()); - assertEquals("test-caption", design.childNode(0).attr("caption")); - } - - private Element createDesign() { - // create an element with some contents - Attributes rootAttributes = new Attributes(); - rootAttributes.put("caption", "test-layout"); - Element node = new Element(Tag.valueOf("v-vertical-layout"), "", - rootAttributes); - Attributes childAttributes = new Attributes(); - childAttributes.put("caption", "test-label"); - Element child = new Element(Tag.valueOf("v-label"), "", childAttributes); - node.appendChild(child); - - return node; - } } diff --git a/server/tests/src/com/vaadin/tests/server/component/label/LabelDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/label/LabelDeclarativeTest.java index a3f27e4397..c2fed34c7b 100644 --- a/server/tests/src/com/vaadin/tests/server/component/label/LabelDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/label/LabelDeclarativeTest.java @@ -15,18 +15,11 @@ */ package com.vaadin.tests.server.component.label; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import org.jsoup.nodes.Attributes; -import org.jsoup.nodes.Element; -import org.jsoup.parser.Tag; import org.junit.Test; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.design.DeclarativeTestBase; import com.vaadin.ui.Label; -import com.vaadin.ui.declarative.DesignContext; /** * Tests declarative support for implementations of {@link Label}. @@ -91,22 +84,6 @@ public class LabelDeclarativeTest extends DeclarativeTestBase<Label> { testWrite(design, l); } - @Test - public void testWriteContentMode() { - // test that the plain-text attribute is overwritten by writeDesign - DesignContext ctx = new DesignContext(); - Label l = new Label("label"); - l.setContentMode(ContentMode.TEXT); - Element e = new Element(Tag.valueOf("v-label"), "", new Attributes()); - l.writeDesign(e, ctx); - assertTrue("Label should be marked as plain text", - e.hasAttr("plain-text")); - l.setContentMode(ContentMode.HTML); - l.writeDesign(e, ctx); - assertFalse("Label should not be marked as plain text", - e.hasAttr("plain-text")); - } - private Label createLabel(String content, String caption, boolean html) { Label label = new Label(); label.setContentMode(html ? ContentMode.HTML : ContentMode.TEXT); diff --git a/server/tests/src/com/vaadin/tests/server/component/table/TableDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/table/TableDeclarativeTest.java new file mode 100644 index 0000000000..796d30049e --- /dev/null +++ b/server/tests/src/com/vaadin/tests/server/component/table/TableDeclarativeTest.java @@ -0,0 +1,167 @@ +/* + * Copyright 2000-2014 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.server.component.table; + +import org.junit.Test; + +import com.vaadin.server.ExternalResource; +import com.vaadin.shared.ui.MultiSelectMode; +import com.vaadin.ui.Table; +import com.vaadin.ui.Table.Align; +import com.vaadin.ui.Table.ColumnHeaderMode; +import com.vaadin.ui.Table.RowHeaderMode; +import com.vaadin.ui.Table.TableDragMode; + +/** + * Test declarative support for {@link Table}. + * + * @since + * @author Vaadin Ltd + */ +public class TableDeclarativeTest extends TableDeclarativeTestBase { + + @Test + public void testBasicAttributes() { + + String design = "<v-table page-length=30 cache-rate=3 selectable=true editable=true " + + "sortable=false sort-ascending=false sort-container-property-id=foo " + + "drag-mode=row multi-select-mode=simple column-header-mode=id row-header-mode=id " + + "column-reordering-allowed=true column-collapsing-allowed=true />"; + + Table table = new Table(); + table.setPageLength(30); + table.setCacheRate(3); + table.setSelectable(true); + table.setEditable(true); + + table.setSortEnabled(false); + table.setSortAscending(false); + table.setSortContainerPropertyId("foo"); + + table.setDragMode(TableDragMode.ROW); + table.setMultiSelectMode(MultiSelectMode.SIMPLE); + table.setColumnHeaderMode(ColumnHeaderMode.ID); + table.setRowHeaderMode(RowHeaderMode.ID); + + table.setColumnReorderingAllowed(true); + table.setColumnCollapsingAllowed(true); + + testRead(design, table); + testWrite(design, table); + } + + @Test + public void testColumns() { + String design = "<v-table column-collapsing-allowed=true>" // + + " <table>" // + + " <colgroup>" + + " <col property-id='foo' width=300>" + + " <col property-id='bar' center expand=1 collapsible=false>" + + " <col property-id='baz' right expand=2 collapsed=true>" + + " </colgroup>" // + + " </table>" // + + "</v-table>"; + + Table table = new Table(); + table.setColumnCollapsingAllowed(true); + + table.addContainerProperty("foo", String.class, null); + table.setColumnAlignment("foo", Align.LEFT); + table.setColumnWidth("foo", 300); + + table.addContainerProperty("bar", String.class, null); + table.setColumnAlignment("bar", Align.CENTER); + table.setColumnExpandRatio("bar", 1); + table.setColumnCollapsible("bar", false); + + table.addContainerProperty("baz", String.class, null); + table.setColumnAlignment("baz", Align.RIGHT); + table.setColumnExpandRatio("baz", 2); + table.setColumnCollapsed("baz", true); + + testRead(design, table); + testWrite(design, table); + } + + @Test + public void testHeadersFooters() { + String design = "<v-table>" // + + " <table>" // + + " <colgroup><col property-id=foo><col property-id=bar></colgroup>" // + + " <thead>" // + + " <tr><th icon='http://example.com/icon.png'>FOO<th>BAR" // + + " </thead>" // + + " <tfoot>" // + + " <tr><td>foo<td>bar" // + + " </tfoot>" // + + " </table>" // + + "</v-table>"; + + Table table = new Table(); + table.setFooterVisible(true); + + table.addContainerProperty("foo", String.class, null); + table.setColumnHeader("foo", "FOO"); + table.setColumnIcon("foo", new ExternalResource( + "http://example.com/icon.png")); + table.setColumnFooter("foo", "foo"); + + table.addContainerProperty("bar", String.class, null); + table.setColumnHeader("bar", "BAR"); + table.setColumnFooter("bar", "bar"); + + testRead(design, table); + testWrite(design, table); + } + + @Test + public void testInlineData() { + String design = "<v-table> "// + + " <table>" // + + " <colgroup>" + + " <col property-id='foo' />" + + " <col property-id='bar' />" + + " <col property-id='baz' />" // + + " </colgroup>" + + " <thead>" + + " <tr><th>Description<th>Milestone<th>Status</tr>" + + " </thead>" + + " <tbody>" + + " <tr><td>r1c1</td><td>r1c2</td><td>r1c3</td>" // + + " <tr><td>r2c1</td><td>r2c2</td><td>r2c3</td>" // + + " </tbody>" // + + " <tfoot>" // + + " <tr><td>F1<td>F2<td>F3</tr>" // + + " </tfoot>" // + + " </table>" // + + "</v-table>"; + + Table table = new Table(); + table.addContainerProperty("foo", String.class, null); + table.addContainerProperty("bar", String.class, null); + table.addContainerProperty("baz", String.class, null); + table.setColumnHeaders("Description", "Milestone", "Status"); + table.setColumnFooter("foo", "F1"); + table.setColumnFooter("bar", "F2"); + table.setColumnFooter("baz", "F3"); + table.addItem(new Object[] { "r1c1", "r1c2", "r1c3" }, null); + table.addItem(new Object[] { "r2c1", "r2c2", "r2c3" }, null); + table.setFooterVisible(true); + + testRead(design, table); + testWrite(design, table, true); + } +} diff --git a/server/tests/src/com/vaadin/tests/server/component/table/TableDeclarativeTestBase.java b/server/tests/src/com/vaadin/tests/server/component/table/TableDeclarativeTestBase.java new file mode 100644 index 0000000000..65c9475684 --- /dev/null +++ b/server/tests/src/com/vaadin/tests/server/component/table/TableDeclarativeTestBase.java @@ -0,0 +1,63 @@ +/* + * Copyright 2000-2014 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.server.component.table; + +import static org.junit.Assert.assertTrue; + +import com.vaadin.tests.design.DeclarativeTestBase; +import com.vaadin.ui.Table; + +public class TableDeclarativeTestBase extends DeclarativeTestBase<Table> { + + @Override + public Table testRead(String design, Table expected) { + Table read = super.testRead(design, expected); + compareColumns(read, expected); + compareBody(read, expected); + return read; + } + + private void compareBody(Table read, Table expected) { + assertEquals(expected.getItemIds().size(), read.getItemIds().size()); + for (Object rowId : expected.getItemIds()) { + assertTrue(read.containsId(rowId)); + for (Object propertyId : read.getVisibleColumns()) { + Object expectedItem = expected.getContainerProperty(rowId, + propertyId); + Object readItem = read.getContainerProperty(rowId, propertyId); + assertEquals(expectedItem, readItem); + } + } + } + + private void compareColumns(Table read, Table expected) { + for (Object pid : expected.getVisibleColumns()) { + String col = "column '" + pid + "'"; + assertEquals(col + " width", expected.getColumnWidth(pid), + read.getColumnWidth(pid)); + assertEquals(col + " expand ratio", + expected.getColumnExpandRatio(pid), + read.getColumnExpandRatio(pid)); + assertEquals(col + " collapsible", + expected.isColumnCollapsible(pid), + read.isColumnCollapsible(pid)); + assertEquals(col + " collapsed", expected.isColumnCollapsed(pid), + read.isColumnCollapsed(pid)); + assertEquals(col + " footer", expected.getColumnFooter(pid), + read.getColumnFooter(pid)); + } + } +} diff --git a/server/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetDeclarativeTest.java index c614e7fa1f..bb5669a3a1 100644 --- a/server/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetDeclarativeTest.java @@ -15,9 +15,6 @@ */ package com.vaadin.tests.server.component.tabsheet; -import org.jsoup.nodes.Attributes; -import org.jsoup.nodes.Element; -import org.jsoup.parser.Tag; import org.junit.Test; import com.vaadin.server.ExternalResource; @@ -25,7 +22,6 @@ import com.vaadin.tests.design.DeclarativeTestBase; import com.vaadin.ui.TabSheet; import com.vaadin.ui.TabSheet.Tab; import com.vaadin.ui.TextField; -import com.vaadin.ui.declarative.DesignContext; /** * Tests declarative support for TabSheet. @@ -69,30 +65,4 @@ public class TabSheetDeclarativeTest extends DeclarativeTestBase<TabSheet> { testRead(design, ts); testWrite(design, ts); } - - @Test - public void testWriteRemovesOldContent() { - // create old content that should be removed when writing - Element design = new Element(Tag.valueOf("v-tab-sheet"), "", - new Attributes()); - design.appendChild(new Element(Tag.valueOf("tab"), "", new Attributes())); - design.appendChild(new Element(Tag.valueOf("tab"), "", new Attributes())); - design.appendChild(new Element(Tag.valueOf("tab"), "", new Attributes())); - // create a new TabSheet with one tab - TabSheet ts = new TabSheet(); - ts.setTabIndex(5); - ts.addTab(new TextField()); - Tab tab = ts.getTab(0); - tab.setVisible(false); - tab.setClosable(true); - tab.setEnabled(false); - // write the design and check written contents - ts.writeDesign(design, new DesignContext()); - assertEquals("There should be only one child", 1, design.children() - .size()); - assertEquals("v-text-field", design.child(0).child(0).tagName()); - assertEquals("5", design.attr("tabindex")); - Element tabDesign = design.child(0); - assertEquals("false", tabDesign.attr("visible")); - } }
\ No newline at end of file diff --git a/uitest/integration_tests.xml b/uitest/integration_tests.xml index 1e040b04f7..d9945a9a45 100644 --- a/uitest/integration_tests.xml +++ b/uitest/integration_tests.xml @@ -276,31 +276,6 @@ </antcall> </target> - <target name="integration-test-liferay6ee"> - <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6EE/integration-test-liferay-6ee.html" /> - <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> - - <antcall target="run-generic-integration-test"> - <param name="startDelay" value="600" /> - <param name="test_browsers" value="winxp-firefox17-esr" /> - <param name="target-server" value="liferay6ee" /> - </antcall> - </target> - - <target name="integration-test-liferay6ee-theme"> - <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/Liferay6-and-6EE-theme-deploy.html" /> - <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> - - <fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6EE/Liferay6EE-theme.html" /> - <pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" /> - - <antcall target="run-generic-integration-test"> - <param name="startDelay" value="600" /> - <param name="test_browsers" value="winxp-firefox17-esr" /> - <param name="target-server" value="liferay6ee" /> - </antcall> - </target> - <target name="integration-test-gatein3"> <fileset dir="integration-testscripts" id="html-test-files" includes="GateIn-3/integration-test-GateIn-3.1.0-portlet2.html" /> <pathconvert pathsep=" " property="testfiles" refid="html-test-files" /> @@ -400,9 +375,7 @@ </catch> </antcontrib:trycatch> <antcall target="integration-test-liferay6" /> - <antcall target="integration-test-liferay6ee" /> <antcall target="integration-test-liferay6-theme" /> - <antcall target="integration-test-liferay6ee-theme" /> <antcall target="integration-test-weblogicPortal" /> <antcall target="integration-test-liferay5" /> <antcall target="integration-test-weblogic10" /> diff --git a/uitest/src/com/vaadin/tests/components/grid/GridResizeTerror.java b/uitest/src/com/vaadin/tests/components/grid/GridResizeTerror.java deleted file mode 100644 index 365461caa9..0000000000 --- a/uitest/src/com/vaadin/tests/components/grid/GridResizeTerror.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2000-2014 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.grid; - -import com.vaadin.annotations.Widgetset; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.util.ResizeTerrorizer; -import com.vaadin.tests.widgetset.TestingWidgetSet; -import com.vaadin.ui.Grid; -import com.vaadin.ui.UI; - -@Widgetset(TestingWidgetSet.NAME) -public class GridResizeTerror extends UI { - @Override - protected void init(VaadinRequest request) { - Grid grid = new Grid(); - - int cols = 10; - Object[] data = new Object[cols]; - - for (int i = 0; i < cols; i++) { - grid.addColumn("Col " + i); - data[i] = "Data " + i; - } - - for (int i = 0; i < 500; i++) { - grid.addRow(data); - } - - setContent(new ResizeTerrorizer(grid)); - } -} diff --git a/uitest/src/com/vaadin/tests/components/grid/declarative/GridDeclarativeMultiSelect.java b/uitest/src/com/vaadin/tests/components/grid/declarative/GridDeclarativeMultiSelect.java new file mode 100644 index 0000000000..83dbdf541e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/grid/declarative/GridDeclarativeMultiSelect.java @@ -0,0 +1,26 @@ +/* + * Copyright 2000-2014 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.grid.declarative; + +import com.vaadin.annotations.Theme; +import com.vaadin.tests.components.DeclarativeTestUI; +import com.vaadin.tests.components.DeclarativeTestUI.DeclarativeUI; + +@Theme("valo") +@SuppressWarnings("serial") +@DeclarativeUI("GridMultiSelect.html") +public class GridDeclarativeMultiSelect extends DeclarativeTestUI { +} diff --git a/uitest/src/com/vaadin/tests/components/grid/declarative/GridMultiSelect.html b/uitest/src/com/vaadin/tests/components/grid/declarative/GridMultiSelect.html new file mode 100644 index 0000000000..b7b1fdaf60 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/grid/declarative/GridMultiSelect.html @@ -0,0 +1,118 @@ +<v-grid width='100%' height='100%' selection-mode='multi' editable='false'> +<table> + <colgroup> + <col /> + <col /> + <col /> + </colgroup> + <thead> + <tr> + <th>Description</th> + <th>Milestone</th> + <th>Status</th> + </tr> + </thead> + <tbody> + <tr> + <td>Issue #0</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #1</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #2</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #3</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #4</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #5</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #6</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #7</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #8</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #9</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #10</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #11</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #12</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #13</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #14</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #15</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #16</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #17</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #18</td> + <td>1.0</td> + <td>New</td> + </tr> + <tr> + <td>Issue #19</td> + <td>1.0</td> + <td>New</td> + </tr> + </tbody> +</table> +</v-grid> diff --git a/uitest/src/com/vaadin/tests/components/window/ModalWindowFocus.java b/uitest/src/com/vaadin/tests/components/window/ModalWindowFocus.java new file mode 100644 index 0000000000..574a2d4991 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/ModalWindowFocus.java @@ -0,0 +1,74 @@ +/* + * Copyright 2000-2014 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.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Window; + +public class ModalWindowFocus extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest req) { + + Button button = new Button("Open windows"); + button.setId("firstButton"); + addComponent(button); + button.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + Window w = new Window("This is first window"); + w.setModal(true); + addWindow(w); + + Window w2 = new Window("This is second window"); + w2.setModal(true); + addWindow(w2); + + HorizontalLayout lay = new HorizontalLayout(); + Button buttonInWindow = new Button("Open window"); + buttonInWindow.setId("windowButton"); + lay.addComponent(buttonInWindow); + w2.setContent(lay); + + buttonInWindow.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent e) { + Window w3 = new Window("This is third window"); + w3.setModal(true); + w3.setId("window3"); + addWindow(w3); + } + }); + } + }); + } + + @Override + protected String getTestDescription() { + return "Topmost modal window should be focused on opening " + + "and on closing an overlying window"; + } + + @Override + protected Integer getTicketNumber() { + return 17021; + } + +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/window/ModalWindowFocusTest.java b/uitest/src/com/vaadin/tests/components/window/ModalWindowFocusTest.java new file mode 100644 index 0000000000..75b6eaa15c --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/ModalWindowFocusTest.java @@ -0,0 +1,102 @@ +/* + * Copyright 2000-2014 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 static org.junit.Assert.assertTrue; + +import java.io.IOException; + +import org.junit.Test; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +import com.vaadin.testbench.By; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Tests that a modal window is focused on creation and that on closing a window + * focus is given to underlying modal window + * + * @author Vaadin Ltd + */ +public class ModalWindowFocusTest extends MultiBrowserTest { + + @Override + public void setup() throws Exception { + super.setup(); + openTestURL(); + } + + /** + * First scenario: press button -> two windows appear, press Esc two times + * -> all windows should be closed + */ + @Test + public void testModalWindowFocusTwoWindows() throws IOException { + + waitForElementPresent(By.id("firstButton")); + WebElement button = findElement(By.id("firstButton")); + button.click(); + + waitForElementPresent(By.id("windowButton")); + assertTrue("Second window should be opened", + findElements(By.id("windowButton")).size() == 1); + + pressEscAndWait(); + pressEscAndWait(); + assertTrue("All windows should be closed", + findElements(By.className("v-window")).size() == 0); + + } + + /** + * Second scenario: press button -> two windows appear, press button in the + * 2nd window -> 3rd window appears on top, press Esc three times -> all + * windows should be closed + */ + @Test + public void testModalWindowFocusPressButtonInWindow() throws IOException { + + waitForElementPresent(By.id("firstButton")); + WebElement button = findElement(By.id("firstButton")); + button.click(); + + waitForElementPresent(By.id("windowButton")); + WebElement buttonInWindow = findElement(By.id("windowButton")); + buttonInWindow.click(); + + waitForElementPresent(By.id("window3")); + assertTrue("Third window should be opened", + findElements(By.id("window3")).size() == 1); + + pressEscAndWait(); + pressEscAndWait(); + pressEscAndWait(); + assertTrue("All windows should be closed", + findElements(By.className("v-window")).size() == 0); + + } + + private void pressEscAndWait() { + new Actions(driver).sendKeys(Keys.ESCAPE).build().perform(); + try { + sleep(100); + } catch (InterruptedException e) { + } + } + +} diff --git a/uitest/src/com/vaadin/tests/tb3/ServletIntegrationTests.java b/uitest/src/com/vaadin/tests/tb3/ServletIntegrationTests.java index 2f97ce27c3..469428a357 100644 --- a/uitest/src/com/vaadin/tests/tb3/ServletIntegrationTests.java +++ b/uitest/src/com/vaadin/tests/tb3/ServletIntegrationTests.java @@ -66,6 +66,11 @@ public class ServletIntegrationTests { notWebsocketCompatible.add("tomcat6"); notWebsocketCompatible.add("tomcat7apacheproxy"); notWebsocketCompatible.add("weblogic10"); + + // Requires an update to 8.5.5 and a fix for + // https://dev.vaadin.com/ticket/16354 + // https://developer.ibm.com/answers/questions/186066/websocket-paths-using-uri-templates-do-not-work-pr/ + notWebsocketCompatible.add("websphere8"); } public static class ServletIntegrationTestSuite extends TB3TestSuite { diff --git a/uitest/src/com/vaadin/tests/themes/ThemeChangeFavicon.java b/uitest/src/com/vaadin/tests/themes/ThemeChangeFavicon.java new file mode 100644 index 0000000000..8995583975 --- /dev/null +++ b/uitest/src/com/vaadin/tests/themes/ThemeChangeFavicon.java @@ -0,0 +1,44 @@ +/* + * Copyright 2000-2014 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.themes; + +import java.util.Arrays; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; + +public class ThemeChangeFavicon extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + for (final String theme : Arrays.asList("valo", "reindeer")) { + addComponent(new Button(theme, new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + setTheme(theme); + } + })); + } + } + + @Override + public String getDescription() { + return "UI for testing that the favicon changes when changing themes"; + } + +} diff --git a/uitest/src/com/vaadin/tests/themes/ThemeChangeFaviconTest.java b/uitest/src/com/vaadin/tests/themes/ThemeChangeFaviconTest.java new file mode 100644 index 0000000000..e4788f93f5 --- /dev/null +++ b/uitest/src/com/vaadin/tests/themes/ThemeChangeFaviconTest.java @@ -0,0 +1,87 @@ +/* + * Copyright 2000-2014 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.themes; + +import java.util.Collections; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.remote.DesiredCapabilities; +import org.openqa.selenium.support.ui.ExpectedCondition; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.parallel.Browser; +import com.vaadin.tests.tb3.SingleBrowserTest; + +public class ThemeChangeFaviconTest extends SingleBrowserTest { + + @Override + public List<DesiredCapabilities> getBrowsersToTest() { + // Seems like stylesheet onload is not fired on PhantomJS + // https://github.com/ariya/phantomjs/issues/12332 + return Collections.singletonList(Browser.FIREFOX + .getDesiredCapabilities()); + } + + @Test + public void changeFavicon() throws InterruptedException { + setDebug(true); + openTestURL(); + assertFavicon("reindeer"); + + changeTheme("valo"); + assertFavicon("valo"); + + changeTheme("reindeer"); + assertFavicon("reindeer"); + } + + private void changeTheme(final String theme) { + $(ButtonElement.class).caption(theme).first().click(); + + final WebElement rootDiv = findElement(By + .xpath("//div[contains(@class,'v-app')]")); + waitUntil(new ExpectedCondition<Boolean>() { + + @Override + public Boolean apply(WebDriver input) { + String rootClass = rootDiv.getAttribute("class").trim(); + + return rootClass.contains(theme); + } + }, 30); + } + + private void assertFavicon(String theme) { + String faviconUrl = "/VAADIN/themes/" + theme + "/favicon.ico"; + + List<WebElement> elements = findElements(By + .cssSelector("link[rel~=\"icon\"]")); + + Assert.assertEquals(2, elements.size()); + + for (WebElement element : elements) { + Assert.assertTrue(element.getAttribute("href") + + " does not end with " + faviconUrl, + element.getAttribute("href").endsWith(faviconUrl)); + } + } + +} diff --git a/uitest/src/com/vaadin/tests/util/ResizeTerrorizer.java b/uitest/src/com/vaadin/tests/util/ResizeTerrorizer.java deleted file mode 100644 index f124305d8a..0000000000 --- a/uitest/src/com/vaadin/tests/util/ResizeTerrorizer.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2000-2014 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.util; - -import com.vaadin.tests.widgetset.client.ResizeTerrorizerControlConnector.ResizeTerorrizerState; -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.Component; -import com.vaadin.ui.VerticalLayout; - -public class ResizeTerrorizer extends VerticalLayout { - private final ResizeTerrorizerControl control; - - public class ResizeTerrorizerControl extends AbstractComponent implements - Component { - - public ResizeTerrorizerControl(Component target) { - getState().target = target; - } - - @Override - protected ResizeTerorrizerState getState() { - return (ResizeTerorrizerState) super.getState(); - } - } - - public ResizeTerrorizer(Component target) { - target.setWidth("700px"); - setSizeFull(); - addComponent(target); - setExpandRatio(target, 1); - control = new ResizeTerrorizerControl(target); - addComponent(control); - } - - public void setDefaultWidthOffset(int px) { - control.getState().defaultWidthOffset = px; - } -} diff --git a/uitest/src/com/vaadin/tests/widgetset/client/ResizeTerrorizerControlConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/ResizeTerrorizerControlConnector.java deleted file mode 100644 index 9fe037706b..0000000000 --- a/uitest/src/com/vaadin/tests/widgetset/client/ResizeTerrorizerControlConnector.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2000-2014 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.widgetset.client; - -import com.google.gwt.animation.client.AnimationScheduler; -import com.google.gwt.animation.client.AnimationScheduler.AnimationCallback; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.IntegerBox; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.RequiresResize; -import com.vaadin.client.ui.AbstractComponentConnector; -import com.vaadin.client.ui.PostLayoutListener; -import com.vaadin.shared.AbstractComponentState; -import com.vaadin.shared.Connector; -import com.vaadin.shared.ui.Connect; -import com.vaadin.tests.util.ResizeTerrorizer; - -@Connect(ResizeTerrorizer.ResizeTerrorizerControl.class) -public class ResizeTerrorizerControlConnector extends - AbstractComponentConnector implements PostLayoutListener { - - public static class ResizeTerorrizerState extends AbstractComponentState { - public Connector target; - public int defaultWidthOffset = 200; - } - - public class ResizeTerrorizerControlPanel extends FlowPanel { - private Label results = new Label("Results"); - private IntegerBox startWidth = new IntegerBox(); - private IntegerBox endWidth = new IntegerBox(); - private final Button terrorizeButton = new Button("Terrorize", - new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - terrorize(startWidth.getValue(), endWidth.getValue(), - 1000); - } - }); - - public ResizeTerrorizerControlPanel() { - add(new Label("Start width")); - add(startWidth); - - add(new Label("End width")); - add(endWidth); - - add(terrorizeButton); - add(results); - - startWidth.getElement().setId("terror-start-width"); - endWidth.getElement().setId("terror-end-width"); - terrorizeButton.getElement().setId("terror-button"); - results.getElement().setId("terror-results"); - } - - private void showResults(String results) { - Integer temp = startWidth.getValue(); - startWidth.setValue(endWidth.getValue()); - endWidth.setValue(temp); - - this.results.setText(results); - } - } - - private void terrorize(final double startWidth, final double endWidth, - final double duration) { - final AbstractComponentConnector target = getTarget(); - - final AnimationScheduler scheduler = AnimationScheduler.get(); - AnimationCallback callback = new AnimationCallback() { - double startTime = -1; - int frameCount = 0; - - @Override - public void execute(double timestamp) { - frameCount++; - - boolean done = false; - if (startTime == -1) { - startTime = timestamp; - } - - double time = timestamp - startTime; - if (time > duration) { - time = duration; - done = true; - } - - double progress = time / duration; - double widthToSet = startWidth + (endWidth - startWidth) - * progress; - - // TODO Optionally inform LayoutManager as well - target.getWidget().setWidth(widthToSet + "px"); - if (target.getWidget() instanceof RequiresResize) { - ((RequiresResize) target.getWidget()).onResize(); - } - - if (!done) { - scheduler.requestAnimationFrame(this); - } else { - double fps = Math.round(frameCount / (duration / 1000)); - String results = frameCount + " frames, " + fps + " fps"; - - getWidget().showResults(results); - } - } - }; - scheduler.requestAnimationFrame(callback); - } - - private AbstractComponentConnector getTarget() { - return (AbstractComponentConnector) getState().target; - } - - @Override - public ResizeTerorrizerState getState() { - return (ResizeTerorrizerState) super.getState(); - } - - @Override - public ResizeTerrorizerControlPanel getWidget() { - return (ResizeTerrorizerControlPanel) super.getWidget(); - } - - @Override - protected ResizeTerrorizerControlPanel createWidget() { - return new ResizeTerrorizerControlPanel(); - } - - @Override - public void postLayout() { - if (getWidget().startWidth.getValue() == null) { - int width = getTarget().getWidget().getElement().getOffsetWidth(); - getWidget().startWidth.setValue(width); - getWidget().endWidth - .setValue(width + getState().defaultWidthOffset); - } - } - -} diff --git a/uitest/src/com/vaadin/tests/widgetset/rebind/TestWidgetRegistryGenerator.java b/uitest/src/com/vaadin/tests/widgetset/rebind/TestWidgetRegistryGenerator.java index c7b29e271b..1bdbba2c36 100644 --- a/uitest/src/com/vaadin/tests/widgetset/rebind/TestWidgetRegistryGenerator.java +++ b/uitest/src/com/vaadin/tests/widgetset/rebind/TestWidgetRegistryGenerator.java @@ -136,9 +136,6 @@ public class TestWidgetRegistryGenerator extends Generator { } else if (!widgetType.getPackage().getName() .startsWith(TestWidgetConnector.class.getPackage().getName())) { return false; - } else if (widgetType.getEnclosingType() != null - && !widgetType.isStatic()) { - return false; } return true; |