Author: estherbin
Date: 2008-09-08 11:50:26 -0400 (Mon, 08 Sep 2008)
New Revision: 10146
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java
Log:
Fixed JBIDE-1605
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java 2008-09-08
15:50:22 UTC (rev 10145)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java 2008-09-08
15:50:26 UTC (rev 10146)
@@ -156,28 +156,37 @@
nsIDOMDocument visualDocument) {
Element groupSourceElement = (Element) sourceNode;
+ Element srcNode = null;
+
+ if ((groupSourceElement.getUserData(VpeVisualDomBuilder.SRC_NODE) != null)
+ && (groupSourceElement.getUserData(VpeVisualDomBuilder.SRC_NODE)
instanceof Element)) {
+ srcNode = (Element)
groupSourceElement.getUserData(VpeVisualDomBuilder.SRC_NODE);
+ }
nsIDOMElement creationDataDiv = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_DIV);
VpeCreationData creationData = new VpeCreationData(creationDataDiv);
+ //added by estherbin fixed
https://jira.jboss.org/jira/browse/JBIDE-1605 issue.
+ final Element elementToPass = (srcNode != null ? srcNode : groupSourceElement);
- expandedIds = (List<String>) sourceNode.getUserData(VPE_EXPANDED_TOGGLE_IDS);
- String childId = (String)
sourceNode.getUserData(VpeVisualDomBuilder.VPE_USER_TOGGLE_ID);
+ expandedIds = (List<String>) elementToPass.getUserData(VPE_EXPANDED_TOGGLE_IDS);
+ String childId = (String)
elementToPass.getUserData(VpeVisualDomBuilder.VPE_USER_TOGGLE_ID);
/*
* Counts child groups in a parent group
*/
int childGroupCount = 1;
+
+
+ Element anySuitableParent = getGroupParent(elementToPass, false);
+ Element panelMenuParent = getGroupParent(elementToPass, true);
- Element anySuitableParent = getGroupParent(groupSourceElement, false);
- Element panelMenuParent = getGroupParent(groupSourceElement, true);
-
readPanelMenuGroupAttributes(groupSourceElement);
readPanelMenuAttributes(panelMenuParent);
-
+
ComponentUtil.setCSSLink(pageContext, STYLE_PATH, NAME_COMPONENT);
boolean expanded = false;
if (null != expandedIds) {
- expanded = expandedIds.contains(childId);
+ expanded = expandedIds.contains(childId);
}
nsIDOMElement div = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_DIV);
@@ -191,8 +200,15 @@
nsIDOMElement childSpan = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
VpeChildrenInfo childrenInfo = new VpeChildrenInfo(childSpan);
-
- List<Node> children = ComponentUtil.getChildren(groupSourceElement);
+
+
+ List<Node> children = null;
+
+ if (srcNode != null) {
+ children = ComponentUtil.getChildren((Element)
groupSourceElement.getUserData(VpeVisualDomBuilder.SRC_NODE));
+ } else {
+ children = ComponentUtil.getChildren(groupSourceElement);
+ }
if (expanded) {
for (Node child : children) {
boolean isGroup = child.getNodeName().endsWith(
@@ -486,13 +502,14 @@
private static final Element getGroupParent(Element sourceElement,
boolean findOnlyPanelMenuParent) {
Element parent = (Element) sourceElement.getParentNode();
+
while (true) {
if (findOnlyPanelMenuParent) {
- if (parent.getNodeName().endsWith(PANEL_MENU_END_TAG)) {
+ if ((parent!=null) && parent.getNodeName().endsWith(PANEL_MENU_END_TAG)) {
break;
}
} else {
- if (parent.getNodeName().endsWith(PANEL_MENU_END_TAG)
+ if ((parent!=null) && parent.getNodeName().endsWith(PANEL_MENU_END_TAG)
|| parent.getNodeName().endsWith(
PANEL_MENU_GROUP_END_TAG)) {
break;
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java 2008-09-08
15:50:22 UTC (rev 10145)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java 2008-09-08
15:50:26 UTC (rev 10146)
@@ -16,6 +16,7 @@
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
import org.jboss.tools.vpe.editor.VpeSourceDomBuilder;
+import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
@@ -127,13 +128,24 @@
.createElement(HtmlComponentUtil.HTML_TAG_DIV);
VpeCreationData creationData = new VpeCreationData(creationDataDiv);
Element itemSourceElement = (Element) sourceNode;
- String childId = (String) sourceNode.getUserData(VPE_PANEL_MENU_ITEM_ID);
+ Element srcElement = null;
+ //added by estherbin fixed
https://jira.jboss.org/jira/browse/JBIDE-1605
+ if ((itemSourceElement.getUserData(VpeVisualDomBuilder.SRC_NODE) != null)
+ && (itemSourceElement.getUserData(VpeVisualDomBuilder.SRC_NODE)
instanceof Element)) {
+ srcElement = (Element)
itemSourceElement.getUserData(VpeVisualDomBuilder.SRC_NODE);
+ }
+
ComponentUtil.setCSSLink(pageContext, STYLE_PATH, COMPONENT_NAME);
-
- Element anySuitableParent = getItemParent(itemSourceElement, false);
- Element panelMenuParent = getItemParent(itemSourceElement, true);
+ //added by estherbin fixed
https://jira.jboss.org/jira/browse/JBIDE-1605
+ final Element elementToPass = ((srcElement != null) ? srcElement :
itemSourceElement);
+
+ Element anySuitableParent = getItemParent(elementToPass, false);
+ Element panelMenuParent = getItemParent(elementToPass, true);
+
+ String childId = (String) elementToPass.getUserData(VPE_PANEL_MENU_ITEM_ID);
+
readPanelMenuAttributes(panelMenuParent);
readPanelMenuItemAttributes(itemSourceElement);