Author: dmaliarevich
Date: 2008-02-21 06:41:22 -0500 (Thu, 21 Feb 2008)
New Revision: 6492
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfForm.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSubView.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfView.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-1742, bug resolved
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfForm.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfForm.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfForm.java 2008-02-21
11:41:22 UTC (rev 6492)
@@ -0,0 +1,88 @@
+/**
+ *
+ */
+package org.jboss.tools.jsf.vpe.jsf.template;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author dmaliarevich
+ *
+ */
+public class JsfForm extends VpeAbstractTemplate {
+
+ private static String STYLE_FOR_DIV = "border: 1px dotted #FF6600; padding:
5px;";
+
+ /**
+ * Instantiates a new jsf form.
+ */
+ public JsfForm() {
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext,
org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+ Element sourceElement = (Element)sourceNode;
+ nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
+ nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+ nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+
+ div.setAttribute(VpeStyleUtil.ATTRIBUTE_STYLE, STYLE_FOR_DIV);
+ td.appendChild(div);
+ tr.appendChild(td);
+ table.appendChild(tr);
+
+ VpeCreationData creationData = new VpeCreationData(table);
+ VpeChildrenInfo divInfo = new VpeChildrenInfo(div);
+ creationData.addChildrenInfo(divInfo);
+
+ for (Node child : getChildren(sourceElement)) {
+ divInfo.addSourceChild(child);
+ }
+
+ return creationData;
+ }
+
+ /**
+ * Gets the children.
+ *
+ * @param sourceElement the source element
+ *
+ * @return the children
+ */
+ public static List<Node> getChildren(Element sourceElement) {
+ ArrayList<Node> children = new ArrayList<Node>();
+ NodeList nodeList = sourceElement.getChildNodes();
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node child = nodeList.item(i);
+ children.add(child);
+ }
+ return children;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#isRecreateAtAttrChange(org.jboss.tools.vpe.editor.context.VpePageContext,
org.w3c.dom.Element, org.mozilla.interfaces.nsIDOMDocument,
org.mozilla.interfaces.nsIDOMElement, java.lang.Object, java.lang.String,
java.lang.String)
+ */
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+}
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfForm.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSubView.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSubView.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSubView.java 2008-02-21
11:41:22 UTC (rev 6492)
@@ -0,0 +1,85 @@
+package org.jboss.tools.jsf.vpe.jsf.template;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class JsfSubView.
+ */
+public class JsfSubView extends VpeAbstractTemplate {
+
+ private static String STYLE_FOR_DIV = "border: 1px dotted #FF6600; padding:
5px;";
+
+ /**
+ * Instantiates a new jsf sub view.
+ */
+ public JsfSubView() {
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext,
org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+ Element sourceElement = (Element)sourceNode;
+ nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
+ nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+ nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+
+ div.setAttribute(VpeStyleUtil.ATTRIBUTE_STYLE, STYLE_FOR_DIV);
+ td.appendChild(div);
+ tr.appendChild(td);
+ table.appendChild(tr);
+
+ VpeCreationData creationData = new VpeCreationData(table);
+ VpeChildrenInfo divInfo = new VpeChildrenInfo(div);
+ creationData.addChildrenInfo(divInfo);
+
+ for (Node child : getChildren(sourceElement)) {
+ divInfo.addSourceChild(child);
+ }
+
+ return creationData;
+ }
+
+ /**
+ * Gets the children.
+ *
+ * @param sourceElement the source element
+ *
+ * @return the children
+ */
+ public static List<Node> getChildren(Element sourceElement) {
+ ArrayList<Node> children = new ArrayList<Node>();
+ NodeList nodeList = sourceElement.getChildNodes();
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node child = nodeList.item(i);
+ children.add(child);
+ }
+ return children;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#isRecreateAtAttrChange(org.jboss.tools.vpe.editor.context.VpePageContext,
org.w3c.dom.Element, org.mozilla.interfaces.nsIDOMDocument,
org.mozilla.interfaces.nsIDOMElement, java.lang.Object, java.lang.String,
java.lang.String)
+ */
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+}
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfSubView.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfView.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfView.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfView.java 2008-02-21
11:41:22 UTC (rev 6492)
@@ -0,0 +1,89 @@
+/**
+ *
+ */
+package org.jboss.tools.jsf.vpe.jsf.template;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author dmaliarevich
+ *
+ */
+public class JsfView extends VpeAbstractTemplate {
+
+ private static String STYLE_FOR_DIV = "border: 1px dotted #FF6600; padding:
5px;";
+
+ /**
+ * Instantiates a new jsf view.
+ */
+ public JsfView() {
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext,
org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+
+ Element sourceElement = (Element)sourceNode;
+ nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
+ nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
+ nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+
+ div.setAttribute(VpeStyleUtil.ATTRIBUTE_STYLE, STYLE_FOR_DIV);
+ td.appendChild(div);
+ tr.appendChild(td);
+ table.appendChild(tr);
+
+ VpeCreationData creationData = new VpeCreationData(table);
+ VpeChildrenInfo divInfo = new VpeChildrenInfo(div);
+ creationData.addChildrenInfo(divInfo);
+
+ for (Node child : getChildren(sourceElement)) {
+ divInfo.addSourceChild(child);
+ }
+
+ return creationData;
+ }
+
+ /**
+ * Gets the children.
+ *
+ * @param sourceElement the source element
+ *
+ * @return the children
+ */
+ public static List<Node> getChildren(Element sourceElement) {
+ ArrayList<Node> children = new ArrayList<Node>();
+ NodeList nodeList = sourceElement.getChildNodes();
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node child = nodeList.item(i);
+ children.add(child);
+ }
+ return children;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#isRecreateAtAttrChange(org.jboss.tools.vpe.editor.context.VpePageContext,
org.w3c.dom.Element, org.mozilla.interfaces.nsIDOMDocument,
org.mozilla.interfaces.nsIDOMElement, java.lang.Object, java.lang.String,
java.lang.String)
+ */
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+}
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfView.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-02-21
11:39:16 UTC (rev 6491)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-02-21
11:41:22 UTC (rev 6492)
@@ -1011,8 +1011,8 @@
</vpe:tag>
<vpe:tag name="f:view" case-sensitive="yes">
- <vpe:template children="yes" modify="yes"
haveVisualPreview="no">
- <div style="border:1px dotted #FF6600;padding: 5px;"
title="{tagstring()}"/>
+ <vpe:template children="yes" modify="yes"
haveVisualPreview="no"
+ class="org.jboss.tools.jsf.vpe.jsf.template.JsfView">
<vpe:dnd>
<vpe:drag start-enable="yes"/>
<vpe:drop container="yes"/>
@@ -1029,8 +1029,8 @@
</vpe:tag>
<vpe:tag name="f:subview" case-sensitive="yes">
- <vpe:template children="yes" modify="yes"
haveVisualPreview="no">
- <div style="border:1px dotted #FF6600;padding: 5px;"
title="{tagstring()}"/>
+ <vpe:template children="yes" modify="yes"
haveVisualPreview="no"
+ class="org.jboss.tools.jsf.vpe.jsf.template.JsfSubView">
<vpe:dnd>
<vpe:drag start-enable="yes"/>
<vpe:drop container="yes"/>
@@ -1047,8 +1047,8 @@
</vpe:tag>
<vpe:tag name="h:form" case-sensitive="yes">
- <vpe:template children="yes" modify="yes"
haveVisualPreview="no">
- <div style="border:1px dotted #FF6600;padding: 5px;{@style}"
class="{@styleClass}" title="{tagstring()}"/>
+ <vpe:template children="yes" modify="yes"
haveVisualPreview="no"
+ class="org.jboss.tools.jsf.vpe.jsf.template.JsfForm">
<vpe:dnd>
<vpe:drag start-enable="yes"/>
<vpe:drop container="yes"/>