Author: sdzmitrovich
Date: 2009-02-26 09:37:34 -0500 (Thu, 26 Feb 2009)
New Revision: 13833
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractCheckboxSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractOptionSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/VpeElementProxyData.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3860
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java 2009-02-26
14:18:56 UTC (rev 13832)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java 2009-02-26
14:37:34 UTC (rev 13833)
@@ -150,7 +150,7 @@
creationData.setElementData(elementData);
}
- @Deprecated
+// @Deprecated
// protected String prepareAttrValue(VpePageContext pageContext,
// Element parent, Attr attr) {
//
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractCheckboxSelectItemTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractCheckboxSelectItemTemplate.java 2009-02-26
14:18:56 UTC (rev 13832)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractCheckboxSelectItemTemplate.java 2009-02-26
14:37:34 UTC (rev 13833)
@@ -58,7 +58,6 @@
nsIDOMElement label = visualDocument.createElement(HTML.TAG_LABEL);
// create span element
nsIDOMElement span = visualDocument.createElement(HTML.TAG_SPAN);
- nsIDOMElement labelSpan = visualDocument.createElement(HTML.TAG_SPAN);
VpeCreationData creationData = new VpeCreationData(span);
@@ -78,11 +77,10 @@
label.setAttribute(HTML.ATTR_CLASS, enabledClass);
}
- label.appendChild(labelSpan);
span.appendChild(input);
span.appendChild(label);
- processOutputAttribute(pageContext, visualDocument, element, labelSpan,
+ processOutputAttribute(pageContext, visualDocument, element, label,
creationData);
return creationData;
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractOptionSelectItemTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractOptionSelectItemTemplate.java 2009-02-26
14:18:56 UTC (rev 13832)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractOptionSelectItemTemplate.java 2009-02-26
14:37:34 UTC (rev 13833)
@@ -10,23 +10,15 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.template.selectitem;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
-import org.jboss.tools.jsf.vpe.jsf.template.util.NodeProxyUtil;
-import org.jboss.tools.jsf.vpe.jsf.template.util.model.VpeElementProxyData;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.mapping.AttributeData;
-import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMText;
-import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
* @author dmaliarevich
@@ -78,77 +70,6 @@
return creationData;
}
- protected void processOutputAttribute(VpePageContext pageContext,
- nsIDOMDocument visualDocument, Element sourceElement,
- nsIDOMElement targetVisualElement, VpeCreationData creationData) {
-
- VpeElementProxyData elementData = new VpeElementProxyData();
-
- Attr outputAttr = getOutputAttributeNode(sourceElement);
-
- if (outputAttr != null) {
-
- // prepare value
- String newValue = outputAttr.getValue();
-
- // if escape then contents of value (or other attribute) is only
- // text
- if (!sourceElement.hasAttribute(JSF.ATTR_ESCAPE)
- || Constants.TRUE.equalsIgnoreCase(sourceElement
- .getAttribute(JSF.ATTR_ESCAPE))) {
-
- String value = outputAttr.getNodeValue();
-
- nsIDOMText text;
- // if bundleValue differ from value then will be represent
- // bundleValue, but text will be not edit
- boolean isEditable = value.equals(newValue);
-
- text = visualDocument.createTextNode(newValue);
- // add attribute for ability of editing
-
- elementData.addNodeData(new AttributeData(outputAttr,
- targetVisualElement, isEditable));
-
- targetVisualElement.appendChild(text);
-
- }
- // then text can be html code
- else {
-
- // create info
- VpeChildrenInfo targetVisualInfo = new VpeChildrenInfo(
- targetVisualElement);
-
- // get atribute's offset
- int offset = ((IDOMAttr) outputAttr)
- .getValueRegionStartOffset();
-
- // reparse attribute's value
- NodeList list = NodeProxyUtil.reparseAttributeValue(
- elementData, newValue, offset + 1);
-
- // add children to info
- for (int i = 0; i < list.getLength(); i++) {
-
- Node child = list.item(i);
-
- // add info to creation data
- targetVisualInfo.addSourceChild(child);
- }
-
- elementData.addNodeData(new AttributeData(outputAttr,
- targetVisualElement, false));
-
- creationData.addChildrenInfo(targetVisualInfo);
-
- }
-
- }
-
- creationData.setElementData(elementData);
- }
-
/**
* Checks is attribute presents.
*
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractSelectItemTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractSelectItemTemplate.java 2009-02-26
14:18:56 UTC (rev 13832)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/selectitem/AbstractSelectItemTemplate.java 2009-02-26
14:37:34 UTC (rev 13833)
@@ -10,9 +10,23 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.template.selectitem;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.jboss.tools.jsf.vpe.jsf.template.AbstractOutputJsfTemplate;
+import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
+import org.jboss.tools.jsf.vpe.jsf.template.util.NodeProxyUtil;
+import org.jboss.tools.jsf.vpe.jsf.template.util.model.VpeElementProxyData;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.mapping.AttributeData;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
/**
* This class is the base class for all templates of
@@ -38,4 +52,75 @@
public final Attr getOutputAttributeNode(Element element) {
return selectItemType.getOutputAttributeNode(element);
}
+
+ protected void processOutputAttribute(VpePageContext pageContext,
+ nsIDOMDocument visualDocument, Element sourceElement,
+ nsIDOMElement targetVisualElement, VpeCreationData creationData) {
+
+ VpeElementProxyData elementData = new VpeElementProxyData();
+
+ Attr outputAttr = getOutputAttributeNode(sourceElement);
+
+ if (outputAttr != null) {
+
+ // prepare value
+ String newValue = outputAttr.getValue();
+
+ // if escape then contents of value (or other attribute) is only
+ // text
+ if (!sourceElement.hasAttribute(JSF.ATTR_ESCAPE)
+ || Constants.TRUE.equalsIgnoreCase(sourceElement
+ .getAttribute(JSF.ATTR_ESCAPE))) {
+
+ String value = outputAttr.getNodeValue();
+
+ nsIDOMText text;
+ // if bundleValue differ from value then will be represent
+ // bundleValue, but text will be not edit
+ boolean isEditable = value.equals(newValue);
+
+ text = visualDocument.createTextNode(newValue);
+ // add attribute for ability of editing
+
+ elementData.addNodeData(new AttributeData(outputAttr,
+ targetVisualElement, isEditable));
+
+ targetVisualElement.appendChild(text);
+
+ }
+ // then text can be html code
+ else {
+
+ // create info
+ VpeChildrenInfo targetVisualInfo = new VpeChildrenInfo(
+ targetVisualElement);
+
+ // get atribute's offset
+ int offset = ((IDOMAttr) outputAttr)
+ .getValueRegionStartOffset();
+
+ // reparse attribute's value
+ NodeList list = NodeProxyUtil.reparseAttributeValue(
+ elementData, newValue, offset + 1);
+
+ // add children to info
+ for (int i = 0; i < list.getLength(); i++) {
+
+ Node child = list.item(i);
+
+ // add info to creation data
+ targetVisualInfo.addSourceChild(child);
+ }
+
+ elementData.addNodeData(new AttributeData(outputAttr,
+ targetVisualElement, false));
+
+ creationData.addChildrenInfo(targetVisualInfo);
+
+ }
+
+ }
+
+ creationData.setElementData(elementData);
+ }
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/VpeElementProxyData.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/VpeElementProxyData.java 2009-02-26
14:18:56 UTC (rev 13832)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/model/VpeElementProxyData.java 2009-02-26
14:37:34 UTC (rev 13833)
@@ -3,6 +3,10 @@
import org.jboss.tools.vpe.editor.mapping.VpeElementData;
import org.w3c.dom.NodeList;
+/**
+ * TODO check if this class is necessary
+ *
+ */
public class VpeElementProxyData extends VpeElementData {
// private IStructuredModel model;