Author: dsakovich
Date: 2007-10-17 15:09:00 -0400 (Wed, 17 Oct 2007)
New Revision: 4306
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodesAdaptorTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-847 Fix treeNodeAdaptor and recursiveNodeAdaptor
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java 2007-10-17
19:05:41 UTC (rev 4305)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java 2007-10-17
19:09:00 UTC (rev 4306)
@@ -60,7 +60,7 @@
visualElement.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
"dr-tree-h-ic-div");
if (getShowLinesAttr(sourceNode)
- && isHasNextParentAdaptorElement(sourceNode)) {
+ && (isAdapterBetweenNodes(sourceNode) ||
isHasNextParentAdaptorElement(sourceNode))) {
String path = RichFacesTemplatesActivator
.getPluginResourcePath()
+ ICON_DIV_LINE;
@@ -199,4 +199,44 @@
}
return false;
}
+
+ /**
+ * Is adapter between treeNodes
+ *
+ * @param sourceNode
+ * @return
+ */
+ private boolean isAdapterBetweenNodes(Node sourceNode) {
+ Node parentNode = sourceNode.getParentNode();
+ NodeList childs = parentNode.getChildNodes();
+ Node beforeAdapterNode = null;
+ Node afterAdapterNode = null;
+ Node adapterNode = null;
+ String treeNodeName = sourceNode.getPrefix() + ":"
+ + RichFacesTreeTemplate.TREE_NODE_NAME;
+ for (int i = 0; i < childs.getLength(); i++) {
+ Node el = childs.item(i);
+ if (!(el instanceof Element)) {
+ continue;
+ }
+ if (el.equals(sourceNode)) {
+ adapterNode = el;
+ } else {
+ if (el.getNodeName().equals(treeNodeName)) {
+ if (adapterNode == null) {
+ beforeAdapterNode = el;
+ } else {
+ afterAdapterNode = el;
+ }
+ }
+
+ }
+
+ }
+
+ if (beforeAdapterNode != null && afterAdapterNode != null) {
+ return true;
+ }
+ return false;
+ }
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java 2007-10-17
19:05:41 UTC (rev 4305)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java 2007-10-17
19:09:00 UTC (rev 4306)
@@ -224,6 +224,9 @@
// creates icon with status of node(collapsed or not) node
nsIDOMElement td1 = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_TD);
+
+ Element element = (Element) sourceNode;
+ String id = element.getAttribute("id");
// sets icon node
if (!isLastElement(sourceNode) && isAdaptorChild(sourceNode)
&& !isHasNextAdaptorElement(sourceNode)) {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodesAdaptorTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodesAdaptorTemplate.java 2007-10-17
19:05:41 UTC (rev 4305)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodesAdaptorTemplate.java 2007-10-17
19:09:00 UTC (rev 4306)
@@ -57,7 +57,7 @@
visualElement.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
"dr-tree-h-ic-div");
if (getShowLinesAttr(sourceNode)
- && isHasNextParentAdaptorElement(sourceNode)) {
+ && (isAdapterBetweenNodes(sourceNode) ||
isHasNextParentAdaptorElement(sourceNode))) {
String path = RichFacesTemplatesActivator
.getPluginResourcePath()
+ ICON_DIV_LINE;
@@ -162,7 +162,11 @@
* @return
*/
private boolean isHasNextParentAdaptorElement(Node sourceNode) {
- Node parentTree = sourceNode.getParentNode();
+ Node tree = sourceNode.getParentNode();
+ if (!(tree instanceof Element)) {
+ return true;
+ }
+ Node parentTree = tree.getParentNode();
if (!(parentTree instanceof Element)) {
return true;
}
@@ -185,10 +189,11 @@
if (lastElement != null) {
break;
}
- if (el.equals(sourceNode)) {
+ if (el.equals(tree)) {
lastElement = el;
}
}
+
if (el.getNodeName().equals(treeNodeName)
|| el.getNodeName().equals(treeNodesAdaptorName)
|| el.getNodeName().equals(treeRecursiveNodesAdaptorName)) {
@@ -196,4 +201,44 @@
}
return false;
}
+
+ /**
+ * Is adapter between treeNodes
+ * @param sourceNode
+ * @return
+ */
+ private boolean isAdapterBetweenNodes(Node sourceNode) {
+ Node parentNode = sourceNode.getParentNode();
+ NodeList childs = parentNode.getChildNodes();
+ Node beforeAdapterNode = null;
+ Node afterAdapterNode = null;
+ Node adapterNode = null;
+ String treeNodeName = sourceNode.getPrefix() + ":"
+ + RichFacesTreeTemplate.TREE_NODE_NAME;
+ for (int i = 0; i < childs.getLength(); i++) {
+ Node el = childs.item(i);
+ if (!(el instanceof Element)) {
+ continue;
+ }
+ if (el.equals(sourceNode)) {
+ adapterNode = el;
+ } else {
+ if (el.getNodeName().equals(treeNodeName)) {
+ if (adapterNode == null) {
+ beforeAdapterNode = el;
+ } else {
+ afterAdapterNode = el;
+ }
+ }
+
+ }
+
+ }
+
+ if (beforeAdapterNode != null && afterAdapterNode != null) {
+ return true;
+ }
+ return false;
+ }
+
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java 2007-10-17
19:05:41 UTC (rev 4305)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeTemplate.java 2007-10-17
19:09:00 UTC (rev 4306)
@@ -178,7 +178,30 @@
super.validate(pageContext, sourceNode, visualDocument, data);
revertTableRows(data.getNode());
}
+
+ public void checkConnectingLines(nsIDOMNode node) {
+ try {
+ nsIDOMNodeList list = node.getChildNodes();
+ nsIDOMElement element = (nsIDOMElement) node
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ String id = element
+ .getAttribute(RichFacesTreeNodesAdaptorTemplate.ID_ATTR_NAME);
+ if (id == null)
+ id = "";
+ if (node.getNodeName().equalsIgnoreCase(
+ HtmlComponentUtil.HTML_TAG_DIV)) {
+
+ }
+ nsIDOMNodeList list2 = node.getChildNodes();
+ for (int i = 0; i < list2.getLength(); i++) {
+ revertTableRows(list2.item(i));
+ }
+ } catch (XPCOMException e) {
+ return;
+ }
+ }
+
/**
* Revert tree elements in right order.
*