diff options
author | Artur Signell <artur@vaadin.com> | 2014-12-15 23:07:42 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2014-12-15 23:12:14 +0200 |
commit | 10b30728e94ecfc19208dc387f5dbd7b9b6f71b1 (patch) | |
tree | 9c20e5ba80e57143ddbcbaa20a87cbb259f89b3c | |
parent | 353206974a542d0aadc278dea4adeff226fb3a9e (diff) | |
download | vaadin-framework-10b30728e94ecfc19208dc387f5dbd7b9b6f71b1.tar.gz vaadin-framework-10b30728e94ecfc19208dc387f5dbd7b9b6f71b1.zip |
createNode -> createElement
Change-Id: Ifb7342a860fa73d51dc462b788a4530abb0bb52f
12 files changed, 35 insertions, 34 deletions
diff --git a/server/src/com/vaadin/ui/AbsoluteLayout.java b/server/src/com/vaadin/ui/AbsoluteLayout.java index 3e1e7bfbdb..47ebdd12cd 100644 --- a/server/src/com/vaadin/ui/AbsoluteLayout.java +++ b/server/src/com/vaadin/ui/AbsoluteLayout.java @@ -723,22 +723,23 @@ public class AbsoluteLayout extends AbstractLayout implements // handle children Element designElement = design; for (Component child : this) { - Element childNode = designContext.createNode(child); - designElement.appendChild(childNode); - child.writeDesign(childNode, designContext); + Element childElement = designContext.createElement(child); + designElement.appendChild(childElement); + child.writeDesign(childElement, designContext); // handle position ComponentPosition position = getPosition(child); - writePositionAttribute(childNode, ATTR_TOP, position.getTopUnits() - .getSymbol(), position.getTopValue()); - writePositionAttribute(childNode, ATTR_RIGHT, position + writePositionAttribute(childElement, ATTR_TOP, position + .getTopUnits().getSymbol(), position.getTopValue()); + writePositionAttribute(childElement, ATTR_RIGHT, position .getRightUnits().getSymbol(), position.getRightValue()); - writePositionAttribute(childNode, ATTR_BOTTOM, position + writePositionAttribute(childElement, ATTR_BOTTOM, position .getBottomUnits().getSymbol(), position.getBottomValue()); - writePositionAttribute(childNode, ATTR_LEFT, position + writePositionAttribute(childElement, ATTR_LEFT, position .getLeftUnits().getSymbol(), position.getLeftValue()); // handle z-index if (position.getZIndex() >= 0) { - childNode.attr(ATTR_Z_INDEX, String.valueOf(position.zIndex)); + childElement + .attr(ATTR_Z_INDEX, String.valueOf(position.zIndex)); } } } diff --git a/server/src/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/com/vaadin/ui/AbstractOrderedLayout.java index b105d53fce..c347449ab8 100644 --- a/server/src/com/vaadin/ui/AbstractOrderedLayout.java +++ b/server/src/com/vaadin/ui/AbstractOrderedLayout.java @@ -545,26 +545,26 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements } for (Component child : this) { - Element childNode = designContext.createNode(child); - designElement.appendChild(childNode); + Element childElement = designContext.createElement(child); + designElement.appendChild(childElement); // handle alignment Alignment alignment = getComponentAlignment(child); if (alignment.isMiddle()) { - childNode.attr(":middle", ""); + childElement.attr(":middle", ""); } else if (alignment.isBottom()) { - childNode.attr(":bottom", ""); + childElement.attr(":bottom", ""); } if (alignment.isCenter()) { - childNode.attr(":center", ""); + childElement.attr(":center", ""); } else if (alignment.isRight()) { - childNode.attr(":right", ""); + childElement.attr(":right", ""); } // handle expand ratio float expandRatio = getExpandRatio(child); if (expandRatio == 1.0f) { - childNode.attr(":expand", ""); + childElement.attr(":expand", ""); } else if (expandRatio > 0) { - childNode.attr(":expand", + childElement.attr(":expand", DesignAttributeHandler.formatFloat(expandRatio)); } } diff --git a/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java b/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java index 330fcfeae1..23fa8a78c7 100644 --- a/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java +++ b/server/src/com/vaadin/ui/AbstractSingleComponentContainer.java @@ -317,7 +317,7 @@ public abstract class AbstractSingleComponentContainer extends // handle child component Component child = getContent(); if (child != null) { - Element childNode = designContext.createNode(child); + Element childNode = designContext.createElement(child); design.appendChild(childNode); } } diff --git a/server/src/com/vaadin/ui/AbstractSplitPanel.java b/server/src/com/vaadin/ui/AbstractSplitPanel.java index 4c85311075..8d1db549a9 100644 --- a/server/src/com/vaadin/ui/AbstractSplitPanel.java +++ b/server/src/com/vaadin/ui/AbstractSplitPanel.java @@ -654,11 +654,11 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { Component firstComponent = getFirstComponent(); Component secondComponent = getSecondComponent(); if (firstComponent != null) { - Element childElement = designContext.createNode(firstComponent); + Element childElement = designContext.createElement(firstComponent); design.appendChild(childElement); } if (secondComponent != null) { - Element childElement = designContext.createNode(secondComponent); + Element childElement = designContext.createElement(secondComponent); if (firstComponent == null) { childElement.attr(":second", ""); } diff --git a/server/src/com/vaadin/ui/CssLayout.java b/server/src/com/vaadin/ui/CssLayout.java index 5c7471522d..1042947f21 100644 --- a/server/src/com/vaadin/ui/CssLayout.java +++ b/server/src/com/vaadin/ui/CssLayout.java @@ -393,7 +393,7 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { // handle children Element designElement = design; for (Component child : this) { - Element childNode = designContext.createNode(child); + Element childNode = designContext.createElement(child); designElement.appendChild(childNode); } } diff --git a/server/src/com/vaadin/ui/TabSheet.java b/server/src/com/vaadin/ui/TabSheet.java index a264692acb..442be21825 100644 --- a/server/src/com/vaadin/ui/TabSheet.java +++ b/server/src/com/vaadin/ui/TabSheet.java @@ -1571,7 +1571,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, // create element for tab Element tabElement = design.appendElement("tab"); // add tab content - tabElement.appendChild(designContext.createNode(tab.getComponent())); + tabElement.appendChild(designContext.createElement(tab.getComponent())); Attributes attr = tabElement.attributes(); // write attributes DesignAttributeHandler.writeAttribute("visible", attr, tab.isVisible(), diff --git a/server/src/com/vaadin/ui/declarative/Design.java b/server/src/com/vaadin/ui/declarative/Design.java index db656937ef..138214af6b 100644 --- a/server/src/com/vaadin/ui/declarative/Design.java +++ b/server/src/com/vaadin/ui/declarative/Design.java @@ -243,7 +243,7 @@ public class Design implements Serializable { // creates the entire component hierarchy rooted at the // given root node. Component root = designContext.getRootComponent(); - Node rootNode = designContext.createNode(root); + Node rootNode = designContext.createElement(root); body.appendChild(rootNode); return doc; } diff --git a/server/src/com/vaadin/ui/declarative/DesignContext.java b/server/src/com/vaadin/ui/declarative/DesignContext.java index 214040b54d..c5094d7927 100644 --- a/server/src/com/vaadin/ui/declarative/DesignContext.java +++ b/server/src/com/vaadin/ui/declarative/DesignContext.java @@ -360,7 +360,7 @@ public class DesignContext implements Serializable { * name of the created node is derived from the class name of * childComponent. */ - public Element createNode(Component childComponent) { + public Element createElement(Component childComponent) { Class<?> componentClass = childComponent.getClass(); String packageName = componentClass.getPackage().getName(); String prefix = packageToPrefix.get(packageName); diff --git a/server/tests/src/com/vaadin/tests/design/TestLocale.java b/server/tests/src/com/vaadin/tests/design/TestLocale.java index b12e390aed..273e611dcf 100644 --- a/server/tests/src/com/vaadin/tests/design/TestLocale.java +++ b/server/tests/src/com/vaadin/tests/design/TestLocale.java @@ -120,7 +120,7 @@ public class TestLocale extends TestCase { // creates the entire component hierarchy rooted at the // given root node. Component root = dc.getRootComponent(); - Node rootNode = dc.createNode(root); + Node rootNode = dc.createElement(root); body.appendChild(rootNode); return doc; diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/TestWriteDesign.java b/server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/TestWriteDesign.java index 1027414c2d..649498c20b 100644 --- a/server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/TestWriteDesign.java +++ b/server/tests/src/com/vaadin/tests/server/component/abstractsplitpanel/TestWriteDesign.java @@ -43,7 +43,7 @@ public class TestWriteDesign extends TestCase { public void testHorizontalWithDefaultValues() { // no attributes or child elements should appear HorizontalSplitPanel sp = new HorizontalSplitPanel(); - Element e = ctx.createNode(sp); + Element e = ctx.createElement(sp); assertEquals("Wrong tag name.", "v-horizontal-split-panel", e.nodeName()); assertEquals("The split panel should not have attributes.", 0, e @@ -60,7 +60,7 @@ public class TestWriteDesign extends TestCase { sp.setMinSplitPosition(5.5f, Unit.PERCENTAGE); sp.setMaxSplitPosition(95, Unit.PERCENTAGE); sp.setLocked(true); - Element e = ctx.createNode(sp); + Element e = ctx.createElement(sp); assertEquals("Wrong tag name.", "v-vertical-split-panel", e.nodeName()); assertEquals("Unexpected number of attributes.", 5, e.attributes() .size()); @@ -82,7 +82,7 @@ public class TestWriteDesign extends TestCase { HorizontalSplitPanel sp = new HorizontalSplitPanel(); sp.setSplitPosition(25f); sp.setFirstComponent(new Button("First slot")); - Element e = ctx.createNode(sp); + Element e = ctx.createElement(sp); assertEquals("Wrong split position.", "25%", e.attr("split-position")); assertEquals("Wrong number of child elements.", 1, e.children().size()); Element eb = e.children().get(0); @@ -97,7 +97,7 @@ public class TestWriteDesign extends TestCase { VerticalSplitPanel sp = new VerticalSplitPanel(); sp.setMinSplitPosition(25f, Unit.PIXELS); sp.setSecondComponent(new Label("Second slot")); - Element e = ctx.createNode(sp); + Element e = ctx.createElement(sp); assertEquals("Wrong minimum split position.", "25px", e.attr("min-split-position")); assertEquals("Wrong number of child elements.", 1, e.children().size()); @@ -115,7 +115,7 @@ public class TestWriteDesign extends TestCase { VerticalSplitPanel sp = new VerticalSplitPanel(); sp.setFirstComponent(new Button("First slot")); sp.setSecondComponent(new Label("Second slot")); - Element e = ctx.createNode(sp); + Element e = ctx.createElement(sp); assertEquals("Wrong number of child elements.", 2, e.children().size()); Element eb = e.children().get(0); assertEquals("Wrong tag name of first child element.", "v-button", @@ -140,7 +140,7 @@ public class TestWriteDesign extends TestCase { sp.setMaxSplitPosition(95, Unit.PERCENTAGE); sp.setFirstComponent(new Button("First slot")); sp.setSecondComponent(new Label("Second slot")); - Element e = ctx.createNode(sp); + Element e = ctx.createElement(sp); sp = new VerticalSplitPanel(); sp.writeDesign(e, ctx); assertTrue("There should be no attributes in the node.", e.attributes() diff --git a/server/tests/src/com/vaadin/tests/server/component/button/TestWriteDesign.java b/server/tests/src/com/vaadin/tests/server/component/button/TestWriteDesign.java index a8cf83522c..dff80769f4 100644 --- a/server/tests/src/com/vaadin/tests/server/component/button/TestWriteDesign.java +++ b/server/tests/src/com/vaadin/tests/server/component/button/TestWriteDesign.java @@ -84,7 +84,7 @@ public class TestWriteDesign extends TestCase { // we need to set this on, since the plain-text attribute will appear // otherwise b1.setHtmlContentAllowed(true); - Element e1 = ctx.createNode(b1); + Element e1 = ctx.createElement(b1); assertEquals("Wrong tag name for button.", "v-button", e1.tagName()); assertEquals("Unexpected content in the v-button element.", content, e1.html()); @@ -92,7 +92,7 @@ public class TestWriteDesign extends TestCase { .attributes().size() == 0); NativeButton b2 = new NativeButton(content); b2.setHtmlContentAllowed(true); - Element e2 = ctx.createNode(b2); + Element e2 = ctx.createElement(b2); assertEquals("Wrong tag name for button.", "v-native-button", e2.tagName()); assertEquals("Unexpected content in the v-button element.", content, diff --git a/server/tests/src/com/vaadin/tests/server/component/label/TestWriteDesign.java b/server/tests/src/com/vaadin/tests/server/component/label/TestWriteDesign.java index fab7c1d8eb..3368a7d22e 100644 --- a/server/tests/src/com/vaadin/tests/server/component/label/TestWriteDesign.java +++ b/server/tests/src/com/vaadin/tests/server/component/label/TestWriteDesign.java @@ -106,7 +106,7 @@ public class TestWriteDesign extends TestCase { if (caption != null) { l.setCaption(caption); } - Element e = ctx.createNode(l); + Element e = ctx.createElement(l); assertEquals("Wrong tag name for label.", "v-label", e.tagName()); if (content != null) { assertEquals("Unexpected content in the v-label element.", content, |