Author: dmaliarevich
Date: 2011-08-19 10:12:32 -0400 (Fri, 19 Aug 2011)
New Revision: 34094
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTemplate.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/html.html.xml
Log:
https://issues.jboss.org/browse/JBIDE-9567 , xmlns attribute was added to HTML template.
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2011-08-19
11:24:38 UTC (rev 34093)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2011-08-19
14:12:32 UTC (rev 34094)
@@ -114,6 +114,7 @@
public static final String ATTR_SPAN = "span"; //$NON-NLS-1$
public static final String ATTR_BACKGROUND = "background"; //$NON-NLS-1$
public static final String ATTR_BGCOLOR = "bgcolor"; //$NON-NLS-1$
+ public static final String ATTR_XMLNS = "xmlns"; //$NON-NLS-1$
/*
* Use this constant if you have to span a column to entire row.
Added:
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTemplate.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTemplate.java 2011-08-19
14:12:32 UTC (rev 34094)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2011 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.html.template;
+
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class HtmlTemplate extends VpeAbstractTemplate {
+
+ @Override
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+ Element sourceElement = (Element) sourceNode;
+ /*
+ * Set "xmlns" attribute to the generated by VPE html stub.
+ */
+ if (sourceElement.hasAttribute(HTML.ATTR_XMLNS)) {
+ String xmlnsAttr = sourceElement.getAttribute(HTML.ATTR_XMLNS);
+ nsIDOMNode htmlNode = visualDocument.getElementsByTagName(HTML.TAG_HTML).item(0);
+ nsIDOMElement htmlElement =
(nsIDOMElement)htmlNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ htmlElement.setAttribute(HTML.ATTR_XMLNS, xmlnsAttr);
+ }
+ nsIDOMNode divElement = visualDocument.createElement(HTML.TAG_DIV);
+ return new VpeCreationData(divElement);
+ }
+}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml 2011-08-19
11:24:38 UTC (rev 34093)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.html/templates/vpe-templates-html.xml 2011-08-19
14:12:32 UTC (rev 34094)
@@ -1153,8 +1153,7 @@
</vpe:tag>
<vpe:tag name="html" case-sensitive="no">
- <vpe:template children="yes" modify="yes">
- <div/>
+ <vpe:template children="yes" modify="yes"
class="org.jboss.tools.vpe.html.template.HtmlTemplate">
<vpe:dnd>
<vpe:drop container="yes" />
</vpe:dnd>
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/html.html.xml
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/html.html.xml 2011-08-19
11:24:38 UTC (rev 34093)
+++
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/core/html.html.xml 2011-08-19
14:12:32 UTC (rev 34094)
@@ -1,6 +1,6 @@
<tests>
<test id="html">
- <DIV STYLE="-moz-user-modify: read-write;">
+ <DIV>
<DIV STYLE="display: none; -moz-user-modify: read-only;">
<BR VPE:PSEUDO-ELEMENT="yes"
STYLE="font-style: italic; color: green; -moz-user-modify: read-only;"
/>
@@ -8,7 +8,7 @@
</DIV>
<DIV>
<H1 STYLE="-moz-user-modify: read-write;">
- <SPAN>
+ <SPAN CLASS="vpe-text">
html
</SPAN>
</H1>