Author: dmaliarevich
Date: 2011-10-27 13:14:56 -0400 (Thu, 27 Oct 2011)
New Revision: 36050
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mapping/VpeDomMapping.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mapping/VpeElementMapping.java
Log:
https://issues.jboss.org/browse/JBIDE-9417 - templates rendering was updated,
"border" variable was removed from VVDB and other files.
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2011-10-27
16:46:32 UTC (rev 36049)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2011-10-27
17:14:56 UTC (rev 36050)
@@ -320,7 +320,6 @@
nsIDOMNode visualOldContainer) throws VpeDisposeException {
boolean registerFlag = isCurrentMainDocument();
-
//it's check for initialization visualController,
//if we trying to process some event when controller
//hasn't been initialized, it's causes
@@ -387,21 +386,21 @@
} catch (XPCOMException ex) {
VpePlugin.getPluginLog().logError(ex);
VpeTemplate defTemplate = getTemplateManager().getDefTemplate();
- creationData = defTemplate.create(getPageContext(), sourceNode,
- getVisualDocument());
+ creationData = defTemplate.create(
+ getPageContext(), sourceNode, getVisualDocument());
} catch (RuntimeException ex) {
VpePlugin.getPluginLog().logError(ex);
VpeTemplate defTemplate = getTemplateManager().getDefTemplate();
- creationData = defTemplate.create(getPageContext(), sourceNode,
- getVisualDocument());
+ creationData = defTemplate.create(
+ getPageContext(), sourceNode, getVisualDocument());
}
if (creationData == null) {
VpePlugin.getDefault().logError(
"!ERROR! VpeCreationData is not initialized for source node '"
//$NON-NLS-1$
+ sourceNode.getNodeName() + "'"); //$NON-NLS-1$
VpeTemplate defTemplate = getTemplateManager().getDefTemplate();
- creationData = defTemplate.create(getPageContext(), sourceNode,
- getVisualDocument());
+ creationData = defTemplate.create(
+ getPageContext(), sourceNode, getVisualDocument());
}
getPageContext().setCurrentVisualNode(null);
/*
@@ -411,7 +410,6 @@
if (sourceNode.getNodeType() == Node.ELEMENT_NODE && visualNewNode == null
&& isShowInvisibleTags()) {
visualNewNode = createInvisbleElementLabel(sourceNode);
}
- nsIDOMElement border = null;
if (visualNewNode != null
&& visualNewNode.getNodeType() == nsIDOMNode.ELEMENT_NODE) {
nsIDOMElement visualNewElement = queryInterface(visualNewNode, nsIDOMElement.class);
@@ -468,25 +466,41 @@
}
VpeElementMapping elementMapping = new VpeElementMapping(
- sourceNode, visualNewNode, border, template,
+ sourceNode, visualNewNode, template,
ifDependencySet, creationData.getData(), data);
registerNodes(elementMapping);
}
+ /*
+ * When in templates xml file specified that particular template
+ * cannot have children -- childrenInfoList will be ignored.
+ * But tags could have other html tags in value attribute.
+ * And while creating the template they will be put into childrenInfoList.
+ * Thus childrenInfoList should be checked in any way!
+ */
+ List<VpeChildrenInfo> childrenInfoList = creationData.getChildrenInfoList();
if (template.hasChildren()) {
- List<?> childrenInfoList = creationData.getChildrenInfoList();
if (childrenInfoList == null) {
addChildren(template, sourceNode,
- visualNewNode != null ? visualNewNode
- : visualOldContainer);
+ visualNewNode != null ? visualNewNode : visualOldContainer);
} else {
- addChildren(template, sourceNode, visualOldContainer,
- childrenInfoList);
+ addChildren(template, sourceNode, visualOldContainer, childrenInfoList);
}
- } else if(sourceNode.getNodeType() == Node.ELEMENT_NODE&&visualNewNode != null
&& isShowInvisibleTags()){
- nsIDOMElement span = getVisualDocument().createElement(HTML.TAG_SPAN);
- span.appendChild(visualNewNode);
- addChildren(template, sourceNode,span);
- visualNewNode= span;
+ } else {
+ /*
+ *
https://issues.jboss.org/browse/JBIDE-9417
+ * Template has no children, but should add
+ * any additional children from childrenInfoList
+ */
+ if (childrenInfoList != null) {
+ addChildren(template, sourceNode, visualOldContainer, childrenInfoList);
+ }
+ if ((sourceNode.getNodeType() == Node.ELEMENT_NODE)
+ && (visualNewNode != null) && isShowInvisibleTags()) {
+ nsIDOMElement span = getVisualDocument().createElement(HTML.TAG_SPAN);
+ span.appendChild(visualNewNode);
+ addChildren(template, sourceNode,span);
+ visualNewNode= span;
+ }
}
getPageContext().setCurrentVisualNode(visualOldContainer);
try {
@@ -495,9 +509,6 @@
VpePlugin.getPluginLog().logError(ex);
}
getPageContext().setCurrentVisualNode(null);
- if (border != null) {
- return border;
- }
return visualNewNode;
}
@@ -823,12 +834,6 @@
((INodeNotifier) sourceNode).removeAdapter(getSorceAdapter());
}
if (visualOldNode != null) {
- if (elementMapping != null) {
- nsIDOMElement border = elementMapping.getBorder();
- if (border != null) {
- visualOldNode = border;
- }
- }
nsIDOMNode visualContainer = visualOldNode.getParentNode();
nsIDOMNode visualNextNode = visualOldNode.getNextSibling();
if (visualContainer != null) {
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mapping/VpeDomMapping.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mapping/VpeDomMapping.java 2011-10-27
16:46:32 UTC (rev 36049)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mapping/VpeDomMapping.java 2011-10-27
17:14:56 UTC (rev 36050)
@@ -37,11 +37,6 @@
sourceMap.put(nodeMapping.getSourceNode(), nodeMapping);
if (nodeMapping.getVisualNode() != null) {
visualMap.put(nodeMapping.getVisualNode(), nodeMapping);
- if (nodeMapping instanceof VpeElementMapping) {
- if (((VpeElementMapping)nodeMapping).getBorder() != null) {
- visualMap.put(((VpeElementMapping)nodeMapping).getBorder(), nodeMapping);
- }
- }
}
}
@@ -298,9 +293,6 @@
// }
// elementMapping.setXmlnsMap(null);
// }
- if (elementMapping.getBorder() != null) {
- visualMap.remove(elementMapping.getBorder());
- }
elementMapping.getTemplate().beforeRemove(pageContext,
elementMapping.getSourceNode(), elementMapping.getVisualNode(),
elementMapping.getData());
}
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mapping/VpeElementMapping.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mapping/VpeElementMapping.java 2011-10-27
16:46:32 UTC (rev 36049)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mapping/VpeElementMapping.java 2011-10-27
17:14:56 UTC (rev 36050)
@@ -29,10 +29,8 @@
*/
private Object data;
private VpeElementData elementData;
- private nsIDOMElement border;
- public VpeElementMapping(Node sourceElement,
- nsIDOMNode visualNode, nsIDOMElement border,
+ public VpeElementMapping(Node sourceElement, nsIDOMNode visualNode,
VpeTemplate template, Set ifDependencySet, Object data, VpeElementData elementData) {
super(sourceElement, visualNode);
this.template = template;
@@ -41,7 +39,6 @@
}
this.data = data;
this.elementData = elementData;
- this.border = border;
}
public VpeElementMapping(Element sourceElement,
@@ -54,7 +51,6 @@
this.ifDependencySet = ifDependencySet;
}
this.elementData = elementData;
- this.border = border;
}
public nsIDOMElement getVisualElement() {
@@ -84,26 +80,6 @@
return ifDependencySet.contains(VpeExpressionBuilder.SIGNATURE_ANY_ATTR);
}
- public nsIDOMElement getBorder() {
- return border;
- }
-
- public boolean isBorder(nsIDOMNode border) {
- if (this.border == null) return false;
- if (this.border.equals(border)) return true;
-
- nsIDOMNode element = border;
-
- while(true){
- if(this.border.equals(element)) return true;
- if(this.visualNode.equals(element)) return false;
-
- element = element.getParentNode();
- if(element == null) break;
- }
- return false;
- }
-
/**
* get element data
* @return