Browse Source

Rename LayoutHandler to Design (#7749)

Change-Id: I86fcf9062804c7eb71d460d2003a3f5eb8d775eb
tags/7.4.0.beta1
Artur Signell 9 years ago
parent
commit
2789f70167

server/src/com/vaadin/ui/declarative/LayoutHandler.java → server/src/com/vaadin/ui/declarative/Design.java View File

@@ -35,16 +35,16 @@ import com.vaadin.ui.declarative.DesignContext.ComponentCreatedEvent;
import com.vaadin.ui.declarative.DesignContext.ComponentCreationListener;

/**
* LayoutHandler is used for parsing a component hierarchy from an html file
* and, conversely, for generating an html tree representation corresponding to
* a given component hierarchy. For both parsing and tree generation the
* component hierarchy must contain a single root.
* Design is used for parsing a component hierarchy from an html file and,
* conversely, for generating an html tree representation corresponding to a
* given component hierarchy. For both parsing and tree generation the component
* hierarchy must contain a single root.
*
*
* @since 7.4
* @author Vaadin Ltd
*/
public class LayoutHandler implements Serializable {
public class Design implements Serializable {
/**
* Constructs a component hierarchy from the design specified as an html
* document. The component hierarchy must contain exactly one top-level

server/tests/src/com/vaadin/tests/layoutparser/InvalidLayoutTemplate.java → server/tests/src/com/vaadin/tests/design/InvalidLayoutTemplate.java View File

@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.tests.layoutparser;
package com.vaadin.tests.design;

import org.junit.Ignore;


server/tests/src/com/vaadin/tests/layoutparser/LayoutTemplate.java → server/tests/src/com/vaadin/tests/design/LayoutTemplate.java View File

@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.tests.layoutparser;
package com.vaadin.tests.design;

import org.junit.Ignore;


server/tests/src/com/vaadin/tests/layoutparser/ParseAllSupportedComponentsTest.java → server/tests/src/com/vaadin/tests/design/ParseAllSupportedComponentsTest.java View File

@@ -13,15 +13,15 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.tests.layoutparser;
package com.vaadin.tests.design;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

import junit.framework.TestCase;

import com.vaadin.ui.declarative.Design;
import com.vaadin.ui.declarative.DesignContext;
import com.vaadin.ui.declarative.LayoutHandler;

/**
* Just top level test case that contains all synchronizable components
@@ -32,9 +32,9 @@ public class ParseAllSupportedComponentsTest extends TestCase {

public void testParsing() {
try {
DesignContext ctx = LayoutHandler
DesignContext ctx = Design
.parse(new FileInputStream(
"server/tests/src/com/vaadin/tests/layoutparser/all-components.html"));
"server/tests/src/com/vaadin/tests/design/all-components.html"));
assertNotNull("The returned design context can not be null", ctx);
assertNotNull("the component root can not be null",
ctx.getComponentRoot());

server/tests/src/com/vaadin/tests/layoutparser/ParseLayoutTest.java → server/tests/src/com/vaadin/tests/design/ParseLayoutTest.java View File

@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.tests.layoutparser;
package com.vaadin.tests.design;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -35,9 +35,9 @@ import com.vaadin.ui.NativeButton;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.declarative.Design;
import com.vaadin.ui.declarative.DesignContext;
import com.vaadin.ui.declarative.DesignException;
import com.vaadin.ui.declarative.LayoutHandler;

/**
* A test for checking that parsing a layout preserves the IDs and the mapping
@@ -54,9 +54,8 @@ public class ParseLayoutTest extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
ctx = LayoutHandler
.parse(new FileInputStream(
"server/tests/src/com/vaadin/tests/layoutparser/testFile.html"));
ctx = Design.parse(new FileInputStream(
"server/tests/src/com/vaadin/tests/design/testFile.html"));
}

/*
@@ -79,8 +78,8 @@ public class ParseLayoutTest extends TestCase {
*/
@Test
public void testThatSerializationPreservesProperties() throws IOException {
Document doc = LayoutHandler.createHtml(ctx);
DesignContext newContext = LayoutHandler.parse(doc.toString());
Document doc = Design.createHtml(ctx);
DesignContext newContext = Design.parse(doc.toString());
// Check that the elements can still be found by id and caption
findElements(newContext);
checkHierarchy(newContext);
@@ -116,8 +115,8 @@ public class ParseLayoutTest extends TestCase {
public void testFieldBinding() throws IOException {
LayoutTemplate template = new LayoutTemplate();
InputStream htmlFile = new FileInputStream(
"server/tests/src/com/vaadin/tests/layoutparser/testFile.html");
LayoutHandler.parse(htmlFile, template);
"server/tests/src/com/vaadin/tests/design/testFile.html");
Design.parse(htmlFile, template);
assertNotNull(template.getFirstButton());
assertNotNull(template.getSecondButton());
assertNotNull(template.getYetanotherbutton());
@@ -134,9 +133,9 @@ public class ParseLayoutTest extends TestCase {
public void testUnboundFields() throws IOException {
InvalidLayoutTemplate template = new InvalidLayoutTemplate();
InputStream htmlFile = new FileInputStream(
"server/tests/src/com/vaadin/tests/layoutparser/testFile.html");
"server/tests/src/com/vaadin/tests/design/testFile.html");
try {
LayoutHandler.parse(htmlFile, template);
Design.parse(htmlFile, template);
// we are expecting an exception
fail();
} catch (DesignException e) {

server/tests/src/com/vaadin/tests/layoutparser/TestLocale.java → server/tests/src/com/vaadin/tests/design/TestLocale.java View File

@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.tests.layoutparser;
package com.vaadin.tests.design;

import java.util.Locale;

@@ -28,7 +28,7 @@ import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.declarative.DesignContext;
import com.vaadin.ui.declarative.LayoutHandler;
import com.vaadin.ui.declarative.Design;

/**
* Tests the handling of the locale property in parsing and html generation.
@@ -73,7 +73,7 @@ public class TestLocale extends TestCase {
hlayout2.addComponent(l2);
ctx.setComponentRoot(vLayout);
// create the html tree corresponding to the component hierarchy
Document doc = LayoutHandler.createHtml(ctx);
Document doc = Design.createHtml(ctx);
// check the created html
Element body = doc.body();
Element evLayout = body.child(0);
@@ -131,7 +131,7 @@ public class TestLocale extends TestCase {

// parse the created document and check the constructed component
// hierarchy
VerticalLayout vLayout = (VerticalLayout) LayoutHandler.parse(
VerticalLayout vLayout = (VerticalLayout) Design.parse(
doc.toString()).getComponentRoot();
assertEquals("Wrong locale.", new Locale("en", "US"),
vLayout.getLocale());

server/tests/src/com/vaadin/tests/layoutparser/all-components.html → server/tests/src/com/vaadin/tests/design/all-components.html View File


server/tests/src/com/vaadin/tests/layoutparser/testFile.html → server/tests/src/com/vaadin/tests/design/testFile.html View File


Loading…
Cancel
Save