Author: sdzmitrovich
Date: 2008-01-17 10:44:01 -0500 (Thu, 17 Jan 2008)
New Revision: 5769
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1639/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1639/JBIDE-1639.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1639Test.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSpacerTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1639
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSpacerTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSpacerTemplate.java 2008-01-17
15:19:49 UTC (rev 5768)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSpacerTemplate.java 2008-01-17
15:44:01 UTC (rev 5769)
@@ -48,16 +48,9 @@
.createElement(HtmlComponentUtil.HTML_TAG_IMG);
ComponentUtil.setImg(img, IMAGE_NAME);
- if (sourceNode instanceof Element) {
- // ComponentUtil.copyAttributes(sourceNode, img);
- img.setAttribute("style", ((Element) sourceNode)
- .getAttribute("style"));
- img.setAttribute("class", ((Element) sourceNode)
- .getAttribute("styleClass"));
- img.setAttribute("width", getSize((Element) sourceNode,
"width"));
- img.setAttribute("height", getSize((Element) sourceNode,
"height"));
+ Element sourceElement = (Element) sourceNode;
- }
+ setData(sourceElement, img);
VpeCreationData creationData = new VpeCreationData(img);
@@ -88,11 +81,23 @@
nsIDOMElement img = (nsIDOMElement) visualNode
.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- // ComponentUtil.copyAttributes(sourceElement, img);
- img.setAttribute("style", sourceElement.getAttribute("style"));
- img.setAttribute("class",
sourceElement.getAttribute("styleClass"));
- img.setAttribute("width", getSize(sourceElement, "width"));
- img.setAttribute("height", getSize(sourceElement, "height"));
+ setData(sourceElement, img);
}
+
+ /**
+ *
+ * @param sourceElement
+ * @param visualElement
+ */
+ private void setData(Element sourceElement, nsIDOMElement visualElement) {
+
+ visualElement
+ .setAttribute("style", sourceElement.getAttribute("style"));
+ visualElement.setAttribute("class", sourceElement
+ .getAttribute("styleClass"));
+ visualElement.setAttribute("width", getSize(sourceElement,
"width"));
+ visualElement.setAttribute("height", getSize(sourceElement,
"height"));
+
+ }
}
\ No newline at end of file
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-01-17
15:19:49 UTC (rev 5768)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-01-17
15:44:01 UTC (rev 5769)
@@ -157,7 +157,7 @@
</vpe:tag>
<vpe:tag name="rich:spacer" case-sensitive="yes">
- <vpe:template children="no" modify="yes"
+ <vpe:template children="no" modify="yes"
class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesSpacerTemplate">
<vpe:resize>
<vpe:width width-attr="width" />
@@ -167,6 +167,12 @@
<vpe:drag start-enable="yes" />
<vpe:drop container="no" />
</vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+
</vpe:template>
</vpe:tag>
@@ -730,7 +736,6 @@
</vpe:drop>
</vpe:dnd>
<vpe:textFormating>
- <vpe:format type="BlockFormat" addChildren="deny" />
<vpe:format type="UnderlineFormat">
<vpe:formatAttribute type="style" />
</vpe:format>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1639/JBIDE-1639.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1639/JBIDE-1639.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/JBIDE/1639/JBIDE-1639.xhtml 2008-01-17
15:44:01 UTC (rev 5769)
@@ -0,0 +1,21 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+
+<head>
+<style type="text/css">
+.spacerStyle {
+ background: blue;
+}
+</style>
+</head>
+
+<body>
+<!-- Spacer component -->
+<rich:spacer width="720" height="50"
styleClass="spacerStyle"/>
+</body>
+</html>
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java 2008-01-17
15:19:49 UTC (rev 5768)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesAllTests.java 2008-01-17
15:44:01 UTC (rev 5769)
@@ -19,6 +19,7 @@
import org.jboss.tools.jsf.vpe.richfaces.test.jbide.JBIDE1613Test;
import org.jboss.tools.jsf.vpe.richfaces.test.jbide.Jbide1580Test;
import org.jboss.tools.jsf.vpe.richfaces.test.jbide.Jbide1614Test;
+import org.jboss.tools.jsf.vpe.richfaces.test.jbide.Jbide1639Test;
import org.jboss.tools.vpe.ui.test.VpeTestSetup;
import org.jboss.tools.vpe.ui.test.beans.ImportBean;
@@ -40,7 +41,8 @@
suite.addTestSuite(Jbide1580Test.class);
suite.addTestSuite(JBIDE1613Test.class);
suite.addTestSuite(Jbide1614Test.class);
-
+ suite.addTestSuite(Jbide1639Test.class);
+
// $JUnit-END$
List<ImportBean> projectToImport = new ArrayList<ImportBean>();
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1639Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1639Test.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1639Test.java 2008-01-17
15:44:01 UTC (rev 5769)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jsf.vpe.richfaces.test.jbide;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNamedNodeMap;
+import org.mozilla.interfaces.nsIDOMNode;
+
+/**
+ *
+ * @author sdzmitrovich
+ *
+ */
+public class Jbide1639Test extends VpeTest {
+
+ public static final String IMPORT_PROJECT_NAME = "richFacesTest";
+
+ public static final String FILE_NAME = "JBIDE/1639/JBIDE-1639.xhtml";
+
+ public Jbide1639Test(String name) {
+ super(name);
+ }
+
+ public void testStyleClass() throws Throwable {
+
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+
+ // get test page path
+ IFile file = (IFile) TestUtil.getComponentPath(FILE_NAME,
+ IMPORT_PROJECT_NAME);
+
+ IEditorInput input = new FileEditorInput(file);
+
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+
+ // get dom document
+ nsIDOMDocument document = getVpeVisualDocument(part);
+ assertNotNull(document);
+
+ // get dom element
+ nsIDOMElement element = document.getDocumentElement();
+ assertNotNull(element);
+
+ // get root node
+ nsIDOMNode node = (nsIDOMNode) element
+ .queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
+
+ List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
+
+ // find "img" elements
+ TestUtil.findElementsByName(node, elements, HTML.TAG_IMG);
+
+ Assert.assertEquals(1, elements.size());
+
+ nsIDOMNode img = elements.get(0);
+
+ nsIDOMNamedNodeMap attributes = img.getAttributes();
+
+ // "img" must have attributes
+ assertNotNull(attributes);
+
+ // "img" must have "multiple" attribute
+ nsIDOMNode classAttribute = attributes.getNamedItem(HTML.ATTR_CLASS);
+ assertNotNull(classAttribute);
+ assertNotNull(classAttribute.getNodeValue());
+ assertEquals(true, classAttribute.getNodeValue().length() > 0);
+
+ // check exception
+ if (getException() != null) {
+ throw getException();
+ }
+
+ }
+
+}