Author: ayukhovich
Date: 2007-08-13 05:23:03 -0400 (Mon, 13 Aug 2007)
New Revision: 3083
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/AbstractRichFacesInputNumberTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataDefinitionListTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataGridTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataListTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataOrderedListTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableScrollerTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesGMapTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSliderTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPaint2DTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSpacerTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarGroupTemplate.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java
Log:
http://jira.jboss.com/jira/browse/EXIN-435
change using Node to nsIDOMNode and Element to nsIDOMElement for classes:
RichFacesGridTemplate
RichFacesColumntTemplate
RichFacesData*Template
RichFacesGMapTemplate
RichFacesInputNumber*Template
RichFacesPaint2DTemplate
RichFacesSuTableTemplate
RichFacesToolBarr*Template
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -207,6 +207,19 @@
}
}
+ /**
+ * Copies all attributes from source node to visual node.
+ * @param sourceNode
+ * @param visualNode
+ */
+ public static void copyAttributes(Node sourceNode, nsIDOMElement visualElement) {
+ NamedNodeMap namedNodeMap = sourceNode.getAttributes();
+ for (int i = 0; i < namedNodeMap.getLength(); i++) {
+ Node attribute = namedNodeMap.item(i);
+ visualElement.setAttribute(attribute.getNodeName(), attribute.getNodeValue());
+ }
+ }
+
/**
* Returns true if sourceNode is Facet
* @param sourceNode
@@ -248,6 +261,20 @@
}
/**
+ * Returns value of attribute.
+ * @param sourceElement
+ * @param attributeName
+ * @return
+ */
+ public static String getAttribute(nsIDOMElement sourceElement, String attributeName) {
+ String attribute = sourceElement.getAttribute(attributeName);
+ if(attribute==null) {
+ attribute = "";
+ }
+ return attribute;
+ }
+
+ /**
* @param style
* @param name
* @return
@@ -340,4 +367,26 @@
visualNode.removeAttribute(attrName);
}
+ /**
+ * Move attributes from sourceNode to html
+ * @param sourceNode
+ * @param visualNode
+ * @param attrName
+ * @param htmlAttrName
+ * @param prefValue
+ * @param defValue
+ */
+ public static void correctAttribute(Element sourceNode, nsIDOMElement visualNode,
+ String attrName, String htmlAttrName, String prefValue, String defValue) {
+ String attrValue = ((Element) sourceNode).getAttribute(attrName);
+ if (prefValue != null && prefValue.trim().length() > 0 && attrValue
!= null) {
+ attrValue = prefValue.trim() + " " + attrValue;
+ }
+ if (attrValue != null) {
+ visualNode.setAttribute(htmlAttrName, attrValue);
+ } else if (defValue != null) {
+ visualNode.setAttribute(htmlAttrName, defValue);
+ } else
+ visualNode.removeAttribute(attrName);
+ }
}
\ No newline at end of file
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -64,6 +64,9 @@
public static final String HTML_HEIGHT_ATTR = "height";
/** HTML_CLASS_ATTR * */
+ public static final String HTML_STYLECLASS_ATTR = "styleClass";
+
+ /** HTML_CLASS_ATTR * */
public static final String HTML_CLASS_ATTR = "class";
/** HTML_CELLSPACING_ATTR * */
@@ -104,6 +107,9 @@
/** HTML_ROWSPAN_ATTR * */
public static final String HTML_ROWSPAN_ATTR = "rowspan";
+
+ /** HTML_ROW_ATTR * */
+ public static final String HTML_ROW_ATTR = "row";
/** HTML_SIZE_ATTR * */
public static final String HTML_SIZE_ATTR = "size";
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/AbstractRichFacesInputNumberTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/AbstractRichFacesInputNumberTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/AbstractRichFacesInputNumberTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -10,10 +10,11 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces.template;
-import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
public abstract class AbstractRichFacesInputNumberTemplate extends
AbstractRichFacesTemplate {
/** INPUTSIZE_ATTRIBURE */
@@ -28,20 +29,17 @@
* org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
* java.lang.Object, java.lang.String)
*/
- // TODO A. Yukhovich please fix it
- /*
@Override
public void removeAttribute(VpePageContext pageContext,
- Element sourceElement, Document visualDocument, Node visualNode,
- Object data, String name) {
+ Element sourceElement, nsIDOMDocument visualDocument, nsIDOMNode visualNode,
+ Object data, String name) {
+
super.removeAttribute(pageContext, sourceElement, visualDocument,
visualNode, data, name);
setAttribute(pageContext, sourceElement, visualDocument, visualNode,
data, name, "");
-
}
- */
/**
* Return a input size
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesColumnTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -18,24 +18,17 @@
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.mozilla.interfaces.nsIDOMDocument;
-import org.w3c.dom.Document;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
public class RichFacesColumnTemplate extends VpeAbstractTemplate {
- // TODO A. Yukhovich please fix it
- /*
- @Override
- public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement,
Document visualDocument, Node visualNode, Object data, String name, String value) {
- return true;
- }
- */
-
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode, Document
visualDocument) {
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
Element sourceElement = (Element)sourceNode;
- Element td = visualDocument.createElement("td");
+ nsIDOMElement td = visualDocument.createElement("td");
if(isHeader(sourceElement)) {
td.setAttribute("class", "dr-table-headercell
rich-table-headercell");
} else if(isFooter(sourceElement)) {
@@ -44,12 +37,10 @@
td.setAttribute("class", "dr-table-cell rich-table-cell");
}
ComponentUtil.copyAttributes(sourceNode, td);
- // TODO A. Yukhovich please fix it
- VpeCreationData creationData = new VpeCreationData(null/*td*/);
+ VpeCreationData creationData = new VpeCreationData(td);
// Create mapping to Encode body
- // TODO A. Yukhovich please fix it
- VpeChildrenInfo tdInfo = new VpeChildrenInfo(null/*td*/);
+ VpeChildrenInfo tdInfo = new VpeChildrenInfo(td);
List<Node> children = ComponentUtil.getChildren(sourceElement);
for (Node child : children) {
tdInfo.addSourceChild(child);
@@ -79,22 +70,15 @@
return false;
}
- // TODO A. Yukhovich please fix it
- /*
@Override
- public void removeAttribute(VpePageContext pageContext, Element sourceElement, Document
visualDocument, Node visualNode, Object data, String name) {
- ((Element)visualNode).removeAttribute(name);
+ public void removeAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name) {
+ nsIDOMElement visualElement =
(nsIDOMElement)visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ visualElement.removeAttribute(name);
}
@Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement, Document
visualDocument, Node visualNode, Object data, String name, String value) {
- ((Element)visualNode).setAttribute(name, value);
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name, String
value) {
+ nsIDOMElement visualElement =
(nsIDOMElement)visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ visualElement.setAttribute(name, value);
}
- */
-
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
}
\ No newline at end of file
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataDefinitionListTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataDefinitionListTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataDefinitionListTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -17,7 +17,9 @@
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.mozilla.interfaces.nsIDOMDocument;
-import org.w3c.dom.Document;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMNodeList;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -61,25 +63,23 @@
* The document of the visual tree.
* @return The information on the created node of the visual tree.
*/
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- Document visualDocument) {
- Element listElement = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DL);
- ComponentUtil.setCSSLink(pageContext, STYLE_RESOURCES_PATH,
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
+ nsIDOMElement listElement =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DL);
+ ComponentUtil.setCSSLink(
+ pageContext,
+ STYLE_RESOURCES_PATH,
"dataDefinitionList");
- // TODO A. Yukhovich please fix it
- VpeCreationData creationData = new VpeCreationData(null/*listElement*/);
+ VpeCreationData creationData = new VpeCreationData(listElement);
+
Element el = null;
Node tempNode = null;
NodeList list = sourceNode.getChildNodes();
+
// sets attributes for list
- correctAttribute((Element) sourceNode, listElement,
- HtmlComponentUtil.HTML_STYLE_ATTR,
- HtmlComponentUtil.HTML_STYLE_ATTR, null);
- correctAttribute((Element) sourceNode, listElement,
- HtmlComponentUtil.HTML_CLASS_ATTR,
- HtmlComponentUtil.HTML_CLASS_ATTR, "listClass");
+ ComponentUtil.correctAttribute((Element)sourceNode, listElement,
HtmlComponentUtil.HTML_STYLE_ATTR, HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
+
+ ComponentUtil.correctAttribute((Element)sourceNode, listElement,
HtmlComponentUtil.HTML_CLASS_ATTR, HtmlComponentUtil.HTML_CLASS_ATTR, null,
"listClass");
for (int i = 0; i < list.getLength(); i++) {
tempNode = list.item(i);
@@ -115,21 +115,15 @@
* @param parentList
* @param childElement
*/
- private void parseListElement(VpePageContext pageContext, Node sourceNode,
- Document visualDocument, VpeCreationData creationData,
- Element parentList, Element childElement) {
- Element dd = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DD);
- correctAttribute((Element) sourceNode, dd, ROWCLASSES_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, null);
- if (dd.getAttribute(HtmlComponentUtil.HTML_CLASS_ATTR) == null
- || dd.getAttribute(HtmlComponentUtil.HTML_CLASS_ATTR).length() == 0) {
- correctAttribute((Element) sourceNode, dd, COLUMNCLASSES_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, "columnClass");
+ private void parseListElement(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument, VpeCreationData creationData, nsIDOMElement parentList,
Element childElement) {
+ nsIDOMElement dd = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DD);
+ ComponentUtil.correctAttribute((Element) sourceNode, dd, ROWCLASSES_ATTR_NAME,
HtmlComponentUtil.HTML_CLASS_ATTR, null, null);
+ if (dd.getAttribute(HtmlComponentUtil.HTML_CLASS_ATTR) == null ||
dd.getAttribute(HtmlComponentUtil.HTML_CLASS_ATTR).length() == 0) {
+ ComponentUtil.correctAttribute((Element) sourceNode, dd, COLUMNCLASSES_ATTR_NAME,
HtmlComponentUtil.HTML_CLASS_ATTR, null, "columnClass");
}
parentList.appendChild(dd);
- // TODO A. Yukhovich please fix it
- VpeChildrenInfo vpeChildrenInfo = new VpeChildrenInfo(null/*dd*/);
+
+ VpeChildrenInfo vpeChildrenInfo = new VpeChildrenInfo(dd);
vpeChildrenInfo.addSourceChild(childElement);
creationData.addChildrenInfo(vpeChildrenInfo);
}
@@ -148,59 +142,33 @@
* @facet facetElement
*/
private void parseListFacetDefinitionElement(VpePageContext pageContext,
- Node sourceNode, Document visualDocument,
- VpeCreationData creationData, Element parentList,
+ Node sourceNode, nsIDOMDocument visualDocument,
+ VpeCreationData creationData, nsIDOMElement parentList,
Element facetElement) {
- Element dt = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DT);
- correctAttribute((Element) sourceNode, dt, HEADER_CLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, "headerClass");
+ nsIDOMElement dt = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DT);
+ ComponentUtil.correctAttribute(
+ (Element) sourceNode,
+ dt,
+ HEADER_CLASS_ATTR_NAME,
+ HtmlComponentUtil.HTML_CLASS_ATTR,
+ null,
+ "headerClass");
parentList.appendChild(dt);
- // TODO A. Yukhovich please fix it
- VpeChildrenInfo child = new VpeChildrenInfo(null/*dt*/);
+ VpeChildrenInfo child = new VpeChildrenInfo(dt);
child.addSourceChild(facetElement);
creationData.addChildrenInfo(child);
}
- /**
- * Move attributes from sourceNode to html
- *
- * @param sourceNode
- * The current node of the source tree.
- * @param visualNode
- * @param attrName
- * @param htmlAttrName
- * @param defValue
- */
- private void correctAttribute(Element sourceNode, Element visualNode,
- String attrName, String htmlAttrName, String defValue) {
- String attrValue = ((Element) sourceNode).getAttribute(attrName);
- if (attrValue != null) {
- visualNode.setAttribute(htmlAttrName, attrValue);
- } else if (defValue != null) {
- visualNode.setAttribute(htmlAttrName, defValue);
- } else
- visualNode.removeAttribute(attrName);
- }
-
- // TODO A. Yukhovich please fix it
- /*
@Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement,
- Document visualDocument, Node visualNode, Object data, String name,
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name,
String value) {
- processAttributeChanges(pageContext, sourceElement, visualDocument,
- visualNode, data, name);
+ processAttributeChanges(pageContext, sourceElement, visualDocument, visualNode, data,
name);
}
@Override
- public void removeAttribute(VpePageContext pageContext,
- Element sourceElement, Document visualDocument, Node visualNode,
- Object data, String name) {
- processAttributeChanges(pageContext, sourceElement, visualDocument,
- visualNode, data, name);
+ public void removeAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name) {
+ processAttributeChanges(pageContext, sourceElement, visualDocument, visualNode, data,
name);
}
- */
/**
* Correct list style accordinly parameters
@@ -215,61 +183,65 @@
* @param data
* @param name
*/
-
- private void processAttributeChanges(VpePageContext pageContext,
- Element sourceElement, Document visualDocument, Node visualNode,
- Object data, String name) {
- Element el = (Element) visualNode;
+ private void processAttributeChanges(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name) {
+ nsIDOMElement el = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
if (HtmlComponentUtil.HTML_STYLE_ATTR.equals(name)) {
- correctAttribute(sourceElement, el, name, name, null);
+ ComponentUtil.correctAttribute(sourceElement, el, name, name, null, null);
} else if (STYLECLASSES_ATTR_NAME.equals(name)) {
- correctAttribute(sourceElement, el, name,
- HtmlComponentUtil.HTML_CLASS_ATTR, "listClass");
+ ComponentUtil.correctAttribute(sourceElement, el, name,
+ HtmlComponentUtil.HTML_CLASS_ATTR, null, "listClass");
} else if (HEADER_CLASS_ATTR_NAME.equals(name)) {
- NodeList nodeList = el.getChildNodes();
- Node temp = null;
+ nsIDOMNodeList nodeList = el.getChildNodes();
+ nsIDOMNode temp = null;
for (int i = 0; i < nodeList.getLength(); i++) {
temp = nodeList.item(i);
- if ((temp instanceof Element)
+ if ((temp != null)
&& (temp.getNodeName()
.equalsIgnoreCase(HtmlComponentUtil.HTML_TAG_DT))) {
- correctAttribute(sourceElement, (Element) temp,
+ nsIDOMElement tempVisualElement =
(nsIDOMElement)temp.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ ComponentUtil.correctAttribute(sourceElement,
+ tempVisualElement,
HEADER_CLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, "headerClass");
+ HtmlComponentUtil.HTML_CLASS_ATTR,
+ null,
+ "headerClass");
}
}
} else if (ROWCLASSES_ATTR_NAME.equals(name)) {
- NodeList nodeList = el.getChildNodes();
- Node temp = null;
+ nsIDOMNodeList nodeList = el.getChildNodes();
+ nsIDOMNode temp = null;
for (int i = 0; i < nodeList.getLength(); i++) {
temp = nodeList.item(i);
- if ((temp instanceof Element)
+ if ((temp != null )
&& (temp.getNodeName()
.equalsIgnoreCase(HtmlComponentUtil.HTML_TAG_DD))) {
- correctAttribute(sourceElement, (Element) temp,
+ nsIDOMElement tempVisualElement =
(nsIDOMElement)temp.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ ComponentUtil.correctAttribute(sourceElement,
+ tempVisualElement,
ROWCLASSES_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, "columnClass");
+ HtmlComponentUtil.HTML_CLASS_ATTR,
+ null,
+ "columnClass");
}
}
} else if (COLUMNCLASSES_ATTR_NAME.equals(name)) {
- NodeList nodeList = el.getChildNodes();
- Node temp = null;
+ nsIDOMNodeList nodeList = el.getChildNodes();
+ nsIDOMNode temp = null;
for (int i = 0; i < nodeList.getLength(); i++) {
temp = nodeList.item(i);
- if ((temp instanceof Element)
+ if ((temp != null)
&& (temp.getNodeName()
.equalsIgnoreCase(HtmlComponentUtil.HTML_TAG_DD))) {
- correctAttribute(sourceElement, (Element) temp,
+ nsIDOMElement tempVisualElement =
(nsIDOMElement)temp.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ ComponentUtil.correctAttribute(
+ sourceElement,
+ tempVisualElement,
COLUMNCLASSES_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, "columnClass");
+ HtmlComponentUtil.HTML_CLASS_ATTR,
+ null,
+ "columnClass");
}
}
}
}
-
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
}
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -15,10 +15,11 @@
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.mozilla.interfaces.nsIDOMDocument;
-import org.w3c.dom.Document;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMNodeList;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
* Template for Rich Faces DataTableFilterSlider
@@ -82,16 +83,12 @@
* The document of the visual tree.
* @return The information on the created node of the visual tree.
*/
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- Document visualDocument) {
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
int numWidth = 0;
- ComponentUtil.setCSSLink(pageContext, STYLE_PATH,
- "richFacesDataFilterSlider");
+ ComponentUtil.setCSSLink(pageContext, STYLE_PATH,
"richFacesDataFilterSlider");
Element sourceElement = (Element) sourceNode;
- String style = ComponentUtil.getAttribute(sourceElement,
- HtmlComponentUtil.HTML_STYLE_ATTR);
- String width = sourceElement
- .getAttribute(HtmlComponentUtil.HTML_ATR_WIDTH);
+ String style = ComponentUtil.getAttribute(sourceElement,
HtmlComponentUtil.HTML_STYLE_ATTR);
+ String width = sourceElement.getAttribute(HtmlComponentUtil.HTML_ATR_WIDTH);
if (width != null) {
numWidth = getSize(width);
if (numWidth < DEFAULT_WIDTH) {
@@ -100,43 +97,33 @@
} else {
numWidth = DEFAULT_WIDTH;
}
- String defaultStyle = style + ";" + HtmlComponentUtil.HTML_ATR_WIDTH
- + " : " + numWidth + "px ; ";
- Element parentDiv = createDIV(visualDocument, "slider-container",
- defaultStyle);
- String rangeStyleClass = ComponentUtil.getAttribute(sourceElement,
- RANGE_STYLE_CLASS_ATR);
- Element rangeDiv = createDIV(visualDocument,
- "range " + rangeStyleClass, HtmlComponentUtil.HTML_ATR_WIDTH
- + " : " + (numWidth - DEFAULT_PARAGRAPH) + "px;");
- Element rangeDecorDiv = createDIV(visualDocument, "range-decor", null);
+ String defaultStyle = style + ";" + HtmlComponentUtil.HTML_ATR_WIDTH + "
: " + numWidth + "px ; ";
+ nsIDOMElement parentDiv = createDIV(visualDocument,
"slider-container", defaultStyle);
+ String rangeStyleClass =
ComponentUtil.getAttribute(sourceElement, RANGE_STYLE_CLASS_ATR);
+ nsIDOMElement rangeDiv = createDIV(visualDocument, "range " +
rangeStyleClass,
+ HtmlComponentUtil.HTML_ATR_WIDTH + " : " + (numWidth - DEFAULT_PARAGRAPH) +
"px;");
+ nsIDOMElement rangeDecorDiv = createDIV(visualDocument, "range-decor",
null);
String trailerStyleClass = ComponentUtil.getAttribute(sourceElement,
TRAILER_STYLE_CLASS_ATR);
- Element trailerDiv = createDIV(visualDocument, "trailer "
+ nsIDOMElement trailerDiv = createDIV(visualDocument, "trailer "
+ trailerStyleClass, DEFAULT_SLIDER_POSITION);
String trackStyleClass = ComponentUtil.getAttribute(sourceElement,
TRACK_STYLE_CLASS_ATR);
- Element trackDiv = createDIV(visualDocument,
+ nsIDOMElement trackDiv = createDIV(visualDocument,
"track " + trackStyleClass, HtmlComponentUtil.HTML_ATR_WIDTH
+ " : " + (numWidth - DEFAULT_PARAGRAPH) + "px;");
String handleStyleClass =
ComponentUtil.getAttribute(sourceElement,HANDLE_STYLE_CLASS_ATR);
- Element handleDiv = createDIV(visualDocument, "handle " + handleStyleClass,
null);
+ nsIDOMElement handleDiv = createDIV(visualDocument, "handle " +
handleStyleClass, null);
- Element img = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ nsIDOMElement img = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
ComponentUtil.setImg(img, CENTER_SLIDER);
- img
- .setAttribute(HtmlComponentUtil.HTML_ATR_WIDTH,
- DEFAULT_SLIDER_WIDTH);
- img.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR,
- DEFAULT_SLIDER_BORDER);
- img.setAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT,
- DEFAULT_SLIDER_HEIGHT);
+ img.setAttribute(HtmlComponentUtil.HTML_ATR_WIDTH, DEFAULT_SLIDER_WIDTH);
+ img.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR,DEFAULT_SLIDER_BORDER);
+ img.setAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT, DEFAULT_SLIDER_HEIGHT);
/* Set input component */
- Element input = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_INPUT);
+ nsIDOMElement input = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
input.setAttribute(HtmlComponentUtil.HTML_TYPE_ATTR, "text");
setAttributesToInputElement(input, sourceElement);
@@ -149,21 +136,21 @@
trackDiv.appendChild(handleDiv);
handleDiv.appendChild(img);
- Element tableSpacer2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ nsIDOMElement tableSpacer2 =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
tableSpacer2.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, "0px");
tableSpacer2.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, "0px");
tableSpacer2.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, "0px");
tableSpacer2.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, "100%" );
tableSpacer2.setAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR, "100%" );
- Element trSpacer2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ nsIDOMElement trSpacer2 =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
- Element tdSpacer2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ nsIDOMElement tdSpacer2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
tdSpacer2.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR, "right");
tdSpacer2.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,"font-family: Arial,
Verdana, sans-serif; font-size: 5px; color: white;");
trSpacer2.appendChild(tdSpacer2);
- Element imageSpacer2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ nsIDOMElement imageSpacer2 =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
ComponentUtil.setImg(imageSpacer2, IMAGE_SPACER);
imageSpacer2.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, "100%");
imageSpacer2.setAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR, "100%");
@@ -174,12 +161,10 @@
parentDiv.appendChild(input);
- // TODO A. Yukhovich please fix it
- VpeCreationData creationData = new VpeCreationData(null/*parentDiv*/);
+ VpeCreationData creationData = new VpeCreationData(parentDiv);
return creationData;
}
- // TODO A. Yukhovich please fix it
/*
* (non-Javadoc)
*
@@ -187,40 +172,39 @@
* org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
* java.lang.Object, java.lang.String)
*/
- /*
@Override
- public void removeAttribute(VpePageContext pageContext,
- Element sourceElement, Document visualDocument, Node visualNode,
+ public void removeAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode,
Object data, String name) {
int numWidth = 0;
super.removeAttribute(pageContext, sourceElement, visualDocument,
visualNode, data, name);
- Element element = (Element) visualNode;
- Element input = getInputElement(element);
+ nsIDOMElement element = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ nsIDOMElement input = getInputElement(element);
setAttributesToInputElement(input, sourceElement);
if (name.equalsIgnoreCase(RANGE_STYLE_CLASS_ATR)) {
- Element range = getRangeElement(element);
+ nsIDOMElement range = getRangeElement(element);
range.removeAttribute(HtmlComponentUtil.HTML_CLASS_ATTR);
range.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "range");
} else if (name.equalsIgnoreCase(TRAILER_STYLE_CLASS_ATR)) {
- Element trailer = getTrailerElement(element);
+ nsIDOMElement trailer = getTrailerElement(element);
trailer.removeAttribute(HtmlComponentUtil.HTML_CLASS_ATTR);
trailer.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "trailer");
} else if (name.equalsIgnoreCase(TRACK_STYLE_CLASS_ATR)) {
- Element track = getTrackElement(element);
+ nsIDOMElement track = getTrackElement(element);
track.removeAttribute(HtmlComponentUtil.HTML_CLASS_ATTR);
track.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "track");
} else if (name.equalsIgnoreCase(HANDLE_STYLE_CLASS_ATR)) {
- Element handle = getHandleElement(element);
+ nsIDOMElement handle = getHandleElement(element);
handle.removeAttribute(HtmlComponentUtil.HTML_CLASS_ATTR);
handle.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "handle");
} else if (name.equalsIgnoreCase(FIELD_STYLE_CLASS_ATR)) {
- Element field = getInputElement(element);
+ nsIDOMElement field = getInputElement(element);
setAttributesToInputElement( field, sourceElement );
} else if (name.equalsIgnoreCase(HtmlComponentUtil.HTML_ATR_WIDTH)) {
- Element range = getRangeElement(element);
+ nsIDOMElement range = getRangeElement(element);
String style = ComponentUtil.getAttribute(sourceElement,
HtmlComponentUtil.HTML_STYLE_ATTR);
element.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, style + ";"
@@ -249,9 +233,8 @@
element.removeAttribute(name);
}
}
-*/
+
- // TODO A. Yukhovich please fix it
/*
* (non-Javadoc)
*
@@ -259,16 +242,14 @@
* org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
* java.lang.Object, java.lang.String, java.lang.String)
*/
- /*
@Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement,
- Document visualDocument, Node visualNode, Object data, String name,
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name,
String value) {
- super.setAttribute(pageContext, sourceElement, visualDocument,
- visualNode, data, name, value);
- Element parentDiv = (Element) visualNode;
+ super.setAttribute(pageContext, sourceElement, visualDocument, visualNode, data, name,
value);
- Element input = getInputElement(parentDiv);
+ nsIDOMElement parentDiv = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ nsIDOMElement input = getInputElement(parentDiv);
setAttributesToInputElement(input, sourceElement);
@@ -278,8 +259,8 @@
if (size < DEFAULT_WIDTH) {
size = DEFAULT_WIDTH;
}
- Element rangeDiv = getRangeElement(parentDiv);
- Element trackDiv = getTrackElement(parentDiv);
+ nsIDOMElement rangeDiv = getRangeElement(parentDiv);
+ nsIDOMElement trackDiv = getTrackElement(parentDiv);
String style = ComponentUtil.getAttribute(parentDiv,
HtmlComponentUtil.HTML_STYLE_ATTR);
@@ -298,19 +279,19 @@
+ (size - DEFAULT_PARAGRAPH) + "px;");
} else if (name.equalsIgnoreCase(RANGE_STYLE_CLASS_ATR)) {
- Element range = getRangeElement(parentDiv);
+ nsIDOMElement range = getRangeElement(parentDiv);
range.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "range "
+ value);
} else if (name.equalsIgnoreCase(TRACK_STYLE_CLASS_ATR)) {
- Element track = getTrackElement(parentDiv);
+ nsIDOMElement track = getTrackElement(parentDiv);
track.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "track "
+ value);
} else if (name.equalsIgnoreCase(TRAILER_STYLE_CLASS_ATR)) {
- Element trailer = getTrailerElement(parentDiv);
+ nsIDOMElement trailer = getTrailerElement(parentDiv);
trailer.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "trailer "
+ value);
} else if (name.equalsIgnoreCase(HANDLE_STYLE_CLASS_ATR)) {
- Element handle = getHandleElement(parentDiv);
+ nsIDOMElement handle = getHandleElement(parentDiv);
handle.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "handle "
+ value);
} else if (name.equalsIgnoreCase(FIELD_STYLE_CLASS_ATR)) {
@@ -332,7 +313,6 @@
parentDiv.setAttribute(name, value);
}
}
- */
/**
* Method for create DIV tag and set attributes
@@ -341,10 +321,8 @@
* @param styleClass
* @param style
*/
- private Element createDIV(Document visualDocument, String styleClass,
- String style) {
- Element div = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ private nsIDOMElement createDIV(nsIDOMDocument visualDocument, String styleClass, String
style) {
+ nsIDOMElement div = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
if (styleClass != null) {
div.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, styleClass);
}
@@ -387,25 +365,35 @@
* element
* @return range element
*/
- private Element getRangeElement(Element parent) {
- NodeList list = parent.getChildNodes();
- return (Element) list.item(0);
+ private nsIDOMElement getRangeElement(nsIDOMElement parent) {
+ nsIDOMNodeList list = parent.getChildNodes();
+ nsIDOMNode tempNode = list.item(0);
+ nsIDOMElement returnElement =
(nsIDOMElement)tempNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ return returnElement;
}
/**
* Get Trailer element from parent element.
*
- * @param parent
- * element
+ * @param parent element
* @return trailer element
*/
- private Element getTrailerElement(Element parent) {
- NodeList list = parent.getChildNodes();
- Element slider = (Element) list.item(0);
- NodeList sliderList = slider.getChildNodes();
- Element trailer = (Element) sliderList.item(0);
- NodeList trailerList = trailer.getChildNodes();
- return (Element) trailerList.item(0);
+ private nsIDOMElement getTrailerElement(nsIDOMElement parent) {
+ // get a slider element
+ nsIDOMNodeList list = parent.getChildNodes();
+ nsIDOMNode tempNode = list.item(0);
+ nsIDOMElement slider =
(nsIDOMElement)tempNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ // get a trailer element
+ nsIDOMNodeList sliderList = slider.getChildNodes();
+ nsIDOMNode tempTrailerNode = sliderList.item(0);
+ nsIDOMElement trailer =
(nsIDOMElement)tempTrailerNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ // get a element
+ nsIDOMNodeList trailerList = trailer.getChildNodes();
+ nsIDOMNode temp2 = trailerList.item(0);
+ nsIDOMElement returnElement =
(nsIDOMElement)temp2.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ return returnElement;
}
/**
@@ -415,15 +403,28 @@
* element
* @return track element
*/
- private Element getTrackElement(Element parent) {
- NodeList list = parent.getChildNodes();
- Element range = (Element) list.item(0);
- NodeList rangeList = range.getChildNodes();
- Element rangeDecor = (Element) rangeList.item(0);
- NodeList rangeDecorList = rangeDecor.getChildNodes();
- Element trailer = (Element) rangeDecorList.item(0);
- NodeList trailerList = trailer.getChildNodes();
- return (Element) trailerList.item(0);
+ private nsIDOMElement getTrackElement(nsIDOMElement parent) {
+
+ // get a range element
+ nsIDOMNodeList list = parent.getChildNodes();
+ nsIDOMNode tempRangeNode = list.item(0);
+ nsIDOMElement range =
(nsIDOMElement)tempRangeNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ // get a range decoder element
+ nsIDOMNodeList rangeList = range.getChildNodes();
+ nsIDOMNode tempRangeDecorNode = rangeList.item(0);
+ nsIDOMElement rangeDecor =
(nsIDOMElement)tempRangeDecorNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ // get a trailer
+ nsIDOMNodeList rangeDecorList = rangeDecor.getChildNodes();
+ nsIDOMNode tempTrailerNode = rangeDecorList.item(0);
+ nsIDOMElement trailer =
(nsIDOMElement)tempTrailerNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ // get a element
+ nsIDOMNodeList trailerList = trailer.getChildNodes();
+ nsIDOMNode temp = trailerList.item(0);
+ nsIDOMElement returnElement =
(nsIDOMElement)temp.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ return returnElement;
}
/**
@@ -433,17 +434,32 @@
* element
* @return handle element
*/
- private Element getHandleElement(Element parent) {
- NodeList list = parent.getChildNodes();
- Element range = (Element) list.item(0);
- NodeList rangeList = range.getChildNodes();
- Element rangeDecor = (Element) rangeList.item(0);
- NodeList rangeDecorList = rangeDecor.getChildNodes();
- Element trailer = (Element) rangeDecorList.item(0);
- NodeList trailerList = trailer.getChildNodes();
- Element track = (Element) trailerList.item(0);
- NodeList trackList = track.getChildNodes();
- return (Element) trackList.item(0);
+ private nsIDOMElement getHandleElement(nsIDOMElement parent) {
+ // get a range element
+ nsIDOMNodeList list = parent.getChildNodes();
+ nsIDOMNode tempRangeNode = list.item(0);
+ nsIDOMElement range =
(nsIDOMElement)tempRangeNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ // get a range decoder element
+ nsIDOMNodeList rangeList = range.getChildNodes();
+ nsIDOMNode tempRangeDecorNode = rangeList.item(0);
+ nsIDOMElement rangeDecor =
(nsIDOMElement)tempRangeDecorNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ // get a trailer
+ nsIDOMNodeList rangeDecorList = rangeDecor.getChildNodes();
+ nsIDOMNode tempTrailerNode = rangeDecorList.item(0);
+ nsIDOMElement trailer =
(nsIDOMElement)tempTrailerNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ // get a track
+ nsIDOMNodeList trailerList = trailer.getChildNodes();
+ nsIDOMNode tempTrackNode = trailerList.item(0);
+ nsIDOMElement track =
(nsIDOMElement)tempTrackNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ // get a element
+ nsIDOMNodeList trackList = track.getChildNodes();
+ nsIDOMNode temp = trackList.item(0);
+ nsIDOMElement returnElement =
(nsIDOMElement)temp.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ return returnElement;
}
/**
@@ -453,13 +469,15 @@
* element
* @return input element
*/
- private Element getInputElement(Element parent) {
- NodeList list = parent.getChildNodes();
- return (Element) list.item(1);
+ private nsIDOMElement getInputElement(nsIDOMElement parent) {
+ nsIDOMNodeList list = parent.getChildNodes();
+ nsIDOMNode tempNode = list.item(1);
+ nsIDOMElement returnElement =
(nsIDOMElement)tempNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ return returnElement;
}
- private void setAttributesToInputElement( Element inputElement, Element sourceElement)
{
+ private void setAttributesToInputElement( nsIDOMElement inputElement, Element
sourceElement) {
String styleClass = getAttribute(FIELD_STYLE_CLASS_ATR, sourceElement);
String value = getAttribute("handleValue", sourceElement);
@@ -477,10 +495,4 @@
value
);
}
-
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
}
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataGridTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataGridTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataGridTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -18,7 +18,9 @@
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
-import org.w3c.dom.Document;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -28,17 +30,16 @@
private String[] rowClasses;
private String[] columnClasses;
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode, Document
visualDocument) {
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
Element sourceElement = (Element)sourceNode;
initStyleClasses(sourceElement);
- Element table = visualDocument.createElement("table");
+ nsIDOMElement table = visualDocument.createElement("table");
ComponentUtil.copyAttributes(sourceNode, table);
- // TODO A. Yukhovich please fix it
- VpeCreationData creationData = new VpeCreationData(null/*table*/);
+ VpeCreationData creationData = new VpeCreationData(table);
ComponentUtil.setCSSLink(pageContext, "dataTable/dataTable.css",
"richFacesDataGrid");
String tableClass = sourceElement.getAttribute("styleClass");
@@ -46,7 +47,7 @@
// Encode colgroup definition.
int columnsLength = getColumnsCount(sourceElement);
- Element colgroup = visualDocument.createElement("colgroup");
+ nsIDOMElement colgroup = visualDocument.createElement("colgroup");
colgroup.setAttribute("span", String.valueOf(columnsLength));
table.appendChild(colgroup);
@@ -56,7 +57,7 @@
// Encode Header
Element header = ComponentUtil.getFacet(sourceElement, "header");
if(header!=null) {
- Element thead = visualDocument.createElement("thead");
+ nsIDOMElement thead = visualDocument.createElement("thead");
table.appendChild(thead);
String headerClass = (String) sourceElement.getAttribute("headerClass");
encodeTableHeaderOrFooterFacet(creationData, thead, columnsLength, visualDocument,
header,
@@ -69,7 +70,7 @@
// Encode Footer
Element footer = ComponentUtil.getFacet(sourceElement, "footer");
if (footer != null) {
- Element tfoot = visualDocument.createElement("tfoot");
+ nsIDOMElement tfoot = visualDocument.createElement("tfoot");
table.appendChild(tfoot);
String footerClass = (String) sourceElement.getAttribute("footerClass");
encodeTableHeaderOrFooterFacet(creationData, tfoot, columnsLength, visualDocument,
footer,
@@ -79,7 +80,7 @@
footerClass, "td");
}
- Element tbody = visualDocument.createElement("tbody");
+ nsIDOMElement tbody = visualDocument.createElement("tbody");
table.appendChild(tbody);
// Create mapping to Encode body
@@ -90,16 +91,15 @@
if(columnsLength>0) {
int rowIndex = 0;
for(int elementIndex = 0; elementIndex<elementsCount; rowIndex++) {
- Element tr = visualDocument.createElement("tr");
+ nsIDOMElement tr = visualDocument.createElement("tr");
tbody.appendChild(tr);
tr.setAttribute("class", "dr-table-row rich-table-row " +
getRowClass(rowIndex));
for(int columnIndex = 0; columnIndex<columnsLength &&
elementIndex<elementsCount; columnIndex++) {
- Element td = visualDocument.createElement("td");
+ nsIDOMElement td = visualDocument.createElement("td");
tr.appendChild(td);
td.setAttribute("class", "dr-table-cell rich-table-cell " +
getColumnClass(columnIndex));
if(!children.isEmpty()) {
- // TODO A. Yukhovich please fix it
- VpeChildrenInfo childInfo = new VpeChildrenInfo(null/*td*/);
+ VpeChildrenInfo childInfo = new VpeChildrenInfo(td);
for (Node child : children) {
childInfo.addSourceChild(child);
}
@@ -176,17 +176,17 @@
return elements;
}
-
- // TODO A. Yukhovich please fix it
- /*
+
@Override
- public void removeAttribute(VpePageContext pageContext, Element sourceElement, Document
visualDocument, Node visualNode, Object data, String name) {
- ((Element)visualNode).removeAttribute(name);
+ public void removeAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name) {
+ nsIDOMElement visualElement =
(nsIDOMElement)visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ visualElement.removeAttribute(name);
}
@Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement, Document
visualDocument, Node visualNode, Object data, String name, String value) {
- ((Element)visualNode).setAttribute(name, value);
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name, String
value) {
+ nsIDOMElement visualElement =
(nsIDOMElement)visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ visualElement.setAttribute(name, value);
}
- */
+
}
\ No newline at end of file
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataListTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataListTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataListTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -16,64 +16,53 @@
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
-// TODO A. Yukhovich please fix it
-//import org.jboss.tools.vpe.editor.util.MozillaSupports;
import org.mozilla.interfaces.nsIDOMDocument;
-import org.w3c.dom.Document;
+import org.mozilla.interfaces.nsIDOMElement;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+/**
+ *
+ */
public class RichFacesDataListTemplate extends VpeAbstractTemplate {
+ /** CSS_FILE_NAME */
+ final static private String CSS_FILE_NAME = "dataList/dataList.css";
- static final String STYLECLASS_ATTR_NAME = "styleClass";
- static final String STYLE_ATTR_NAME = "style";
- static final String ROWS_ATTR_NAME = "rows";
- // TODO A. Yukhovich please fix if
- /*
- @Override
- public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement,
Document visualDocument, Node visualNode, Object data, String name, String value) {
- return true;
- }
- */
-
-
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode, Document
visualDocument) {
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
Element sourceElement = (Element)sourceNode;
- Element unorderedList = visualDocument.createElement("ul");
+ nsIDOMElement unorderedList = visualDocument.createElement("ul");
- ComponentUtil.setCSSLink(pageContext, "dataList/dataList.css",
"richFacesDataList");
+ ComponentUtil.setCSSLink(pageContext, CSS_FILE_NAME, "richFacesDataList");
ComponentUtil.copyAttributes(sourceNode, unorderedList);
ComponentUtil.correctAttribute(sourceElement, unorderedList,
- STYLECLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, "dr-list rich-datalist", "dr-list
rich-datalist");
+ HtmlComponentUtil.HTML_STYLECLASS_ATTR,
+ HtmlComponentUtil.HTML_CLASS_ATTR,
+ "dr-list rich-datalist",
+ "dr-list rich-datalist");
ComponentUtil.correctAttribute(sourceElement, unorderedList,
- STYLE_ATTR_NAME,
+ HtmlComponentUtil.HTML_STYLE_ATTR,
HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
- // TODO A. Yukhovich please fix if
- VpeCreationData creatorInfo = new VpeCreationData(null/*unorderedList*/);
+ VpeCreationData creatorInfo = new VpeCreationData(unorderedList);
int rows = -1;
try {
- rows = Integer.valueOf(sourceElement.getAttribute(ROWS_ATTR_NAME));
+ rows = Integer.valueOf(sourceElement.getAttribute(HtmlComponentUtil.HTML_ROW_ATTR));
} catch (Exception x) {
rows = -1;
}
for (int i = 0; i < (rows == -1 ? 3 : rows); i++) {
- Element listItem = visualDocument.createElement("li");
- listItem.setAttribute("class", "dr-list-item rich-list-item");
+ nsIDOMElement listItem = visualDocument.createElement("li");
+ listItem.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "dr-list-item
rich-list-item");
unorderedList.appendChild(listItem);
- // TODO A. Yukhovich please fix if
- VpeChildrenInfo info = null /* new VpeChildrenInfo(listItem)*/;
+ VpeChildrenInfo info = new VpeChildrenInfo(listItem);
creatorInfo.addChildrenInfo(info);
encodeListItem(info, sourceElement);
-// TODO A. Yukhovich please fix if
-// MozillaSupports.release(listItem);
}
return creatorInfo;
@@ -100,11 +89,4 @@
}
}
}
-
-
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
}
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataOrderedListTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataOrderedListTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataOrderedListTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -17,63 +17,48 @@
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.mozilla.interfaces.nsIDOMDocument;
-//TODO A. Yukhovich please fix if
-//import org.jboss.tools.vpe.editor.util.MozillaSupports;
-import org.w3c.dom.Document;
+import org.mozilla.interfaces.nsIDOMElement;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class RichFacesDataOrderedListTemplate extends VpeAbstractTemplate {
+ /** CSS_FILE_NAME */
+ final static private String CSS_FILE_NAME =
"dataOrderedList/dataOrderedList.css";
- static final String STYLECLASS_ATTR_NAME = "styleClass";
- static final String STYLE_ATTR_NAME = "style";
- static final String ROWS_ATTR_NAME = "rows";
-
-
- // TODO A. Yukhovich please fix if
- /*
- @Override
- public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement,
Document visualDocument, Node visualNode, Object data, String name, String value) {
- return true;
- }
- */
-
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode, Document
visualDocument) {
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
Element sourceElement = (Element)sourceNode;
- Element orderedList = visualDocument.createElement("ol");
+ nsIDOMElement orderedList = visualDocument.createElement("ol");
- ComponentUtil.setCSSLink(pageContext, "dataOrderedList/dataOrderedList.css",
"richFacesDataOrderList");
+ ComponentUtil.setCSSLink(pageContext, CSS_FILE_NAME,
"richFacesDataOrderList");
ComponentUtil.copyAttributes(sourceNode, orderedList);
ComponentUtil.correctAttribute(sourceElement, orderedList,
- STYLECLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, "dr-list rich-orderedlist",
"dr-list rich-orderedlist");
+ HtmlComponentUtil.HTML_STYLECLASS_ATTR,
+ HtmlComponentUtil.HTML_CLASS_ATTR,
+ "dr-list rich-orderedlist",
+ "dr-list rich-orderedlist");
ComponentUtil.correctAttribute(sourceElement, orderedList,
- STYLE_ATTR_NAME,
+ HtmlComponentUtil.HTML_STYLE_ATTR,
HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
- // TODO A. Yukhovich please fix if
- VpeCreationData creatorInfo = new VpeCreationData(null/*orderedList*/);
+ VpeCreationData creatorInfo = new VpeCreationData(orderedList);
int rows = -1;
try {
- rows = Integer.valueOf(sourceElement.getAttribute(ROWS_ATTR_NAME));
+ rows = Integer.valueOf(sourceElement.getAttribute(HtmlComponentUtil.HTML_ROW_ATTR));
} catch (Exception x) {
rows = -1;
}
for (int i = 0; i < (rows == -1 ? 3 : rows); i++) {
- Element listItem = visualDocument.createElement("li");
+ nsIDOMElement listItem = visualDocument.createElement("li");
listItem.setAttribute("class", "dr-list-item rich-list-item");
orderedList.appendChild(listItem);
- // TODO A. Yukhovich please fix if
- VpeChildrenInfo info = null /*new VpeChildrenInfo(listItem)*/;
+ VpeChildrenInfo info = new VpeChildrenInfo(listItem);
creatorInfo.addChildrenInfo(info);
encodeListItem(info, sourceElement);
- // TODO A. Yukhovich please fix if
- /*MozillaSupports.release(listItem);*/
}
return creatorInfo;
@@ -100,10 +85,4 @@
}
}
}
-
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
}
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableScrollerTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableScrollerTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableScrollerTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -16,10 +16,12 @@
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.mozilla.interfaces.nsIDOMDocument;
-import org.w3c.dom.Document;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMNodeList;
+import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
* Template for Rich Faces DataTableScroller
@@ -82,42 +84,34 @@
* The document of the visual tree.
* @return The information on the created node of the visual tree.
*/
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- Document visualDocument) {
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
Element source = (Element) sourceNode;
ComponentUtil.setCSSLink(pageContext, STYLE_PATH,
"richFacesDataScrollerTable");
- Element div = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ nsIDOMElement div = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
String style = source.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
div.setAttribute("class", "dr-div-heigth");
if (style == null) {
style = DEFAULT_STYLE_WIDTH;
}
- Element table = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ nsIDOMElement table = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
"dr-dscr-t dr-tbpnl-cntnt");
table.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, "1");
table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, "0");
table.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, "0");
- Element tbody = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TBODY);
- Element tr = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ nsIDOMElement tbody = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TBODY);
+ nsIDOMElement tr = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
tbody.appendChild(tr);
table.appendChild(tbody);
- // TODO A. Yukhovich please fix it
- VpeCreationData creationData = new VpeCreationData(null/*div*/);
+ VpeCreationData creationData = new VpeCreationData(div);
/* Add scroll cells */
- Element child1 = createCell(visualDocument, false,
- LEFT_DOUBLE_SCROLL_SYMBOL, SCROLL_CELL);
- Element child2 = createCell(visualDocument, false,
- LEFT_SINGLE_SCROLL_SYMBOL, SCROLL_CELL);
+ nsIDOMElement child1 = createCell(visualDocument, false, LEFT_DOUBLE_SCROLL_SYMBOL,
SCROLL_CELL);
+ nsIDOMElement child2 = createCell(visualDocument, false, LEFT_SINGLE_SCROLL_SYMBOL,
SCROLL_CELL);
/* Add empty cells */
- Element child3 = createCell(visualDocument, false, "", EMPTY_CELL);
+ nsIDOMElement child3 = createCell(visualDocument, false, "", EMPTY_CELL);
tr.appendChild(child1);
tr.appendChild(child2);
tr.appendChild(child3);
@@ -133,8 +127,7 @@
size /= (minSize / MIN_NUM_CELLS);
/* Add number cells in datascroller */
for (int i = 0; i < (size - 6); i++) {
- Element child = createCell(visualDocument, (i == 0 ? true : false),
- "" + (i + 1), NUM_CELL);
+ nsIDOMElement child = createCell(visualDocument, (i == 0 ? true : false), ""
+ (i + 1), NUM_CELL);
tr.appendChild(child);
}
/* Add empty cell */
@@ -164,12 +157,10 @@
* text in cell
* @return Element
*/
- private Element createCell(Document visualDocument, boolean active,
- String text, int sellType) {
- Element td = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ private nsIDOMElement createCell(nsIDOMDocument visualDocument, boolean active, String
text, int sellType) {
+ nsIDOMElement td = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
td.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR, "center");
- Node d = visualDocument.createTextNode(text);
+ nsIDOMText d = visualDocument.createTextNode(text);
if (sellType == NUM_CELL) {
td.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
(active ? "dr-dscr-act" : "dr-dscr-inact"));
@@ -190,34 +181,25 @@
/**
* Method for remove attributes .
*/
- // TODO A. Yukhovich please fix it
- /*
@Override
- public void removeAttribute(VpePageContext pageContext,
- Element sourceElement, Document visualDocument, Node visualNode,
- Object data, String name) {
- super.removeAttribute(pageContext, sourceElement, visualDocument,
- visualNode, data, name);
- Element element = (Element) visualNode;
+ public void removeAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode,Object data, String name) {
+ super.removeAttribute(pageContext, sourceElement, visualDocument, visualNode, data,
name);
+ nsIDOMElement element = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
element.removeAttribute(name);
-
}
- */
+
/*
* @see
com.exadel.vpe.editor.template.VpeAbstractTemplate#setAttribute(com.exadel.vpe.editor.context.VpePageContext,
* org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
* java.lang.Object, java.lang.String, java.lang.String)
*/
- // TODO A. Yukhovich please fix it
- /*
@Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement,
- Document visualDocument, Node visualNode, Object data, String name,
- String value) {
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name, String
value) {
super.setAttribute(pageContext, sourceElement, visualDocument,
visualNode, data, name, value);
- Element element = (Element) visualNode;
+ nsIDOMElement element = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
int size = 45;
if (name.equalsIgnoreCase(HtmlComponentUtil.HTML_STYLE_ATTR)) {
String str = getWidth(value);
@@ -228,9 +210,9 @@
value = MIN_STYLE_WIDTH;
}
size /= (minSize / MIN_NUM_CELLS);
- Element tr = getTR(element);
- NodeList nodes = tr.getChildNodes();
- int nodesLength = nodes.getLength();
+ nsIDOMElement tr = getTR(element);
+ nsIDOMNodeList nodes = tr.getChildNodes();
+ long nodesLength = nodes.getLength();
if (nodesLength != size) {
if (size < nodesLength) {
// Remove cells in datascroller
@@ -244,16 +226,12 @@
}
// Add cells in datascroller
for (int i = 0; i < (size - nodesLength); i++) {
- Element cell = createCell(visualDocument, false, ""
- + (nodesLength - 5 + i), NUM_CELL);
+ nsIDOMElement cell = createCell(visualDocument, false, "" + (nodesLength
- 5 + i), NUM_CELL);
tr.appendChild(cell);
}
- Element child1 = createCell(visualDocument, false, "",
- EMPTY_CELL);
- Element child2 = createCell(visualDocument, false,
- RIGHT_SINGLE_SCROLL_SYMBOL, SCROLL_CELL);
- Element child3 = createCell(visualDocument, false,
- RIGHT_DOUBLE_SCROLL_SYMBOL, SCROLL_CELL);
+ nsIDOMElement child1 = createCell(visualDocument, false, "", EMPTY_CELL);
+ nsIDOMElement child2 = createCell(visualDocument, false,RIGHT_SINGLE_SCROLL_SYMBOL,
SCROLL_CELL);
+ nsIDOMElement child3 = createCell(visualDocument, false, RIGHT_DOUBLE_SCROLL_SYMBOL,
SCROLL_CELL);
tr.appendChild(child1);
tr.appendChild(child2);
tr.appendChild(child3);
@@ -263,7 +241,7 @@
element.setAttribute(name, value);
}
- */
+
/**
* Method for parse style and get width.
*
@@ -318,18 +296,19 @@
* Element
* @return Element Tag TR
*/
- private Element getTR(Element parent) {
- NodeList list = parent.getChildNodes();
- Element table = (Element) list.item(0);
- NodeList tableList = table.getChildNodes();
- Element tbody = (Element) tableList.item(0);
- NodeList tbodyList = tbody.getChildNodes();
- return (Element) tbodyList.item(0);
- }
+ private nsIDOMElement getTR(nsIDOMElement parent) {
+ nsIDOMNodeList list = parent.getChildNodes();
+ nsIDOMNode tableNode = list.item(0);
+ nsIDOMElement table = (nsIDOMElement)
tableNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ nsIDOMNodeList tableList = table.getChildNodes();
+ nsIDOMNode tbodyNode = tableList.item(0);
+ nsIDOMElement tbody = (nsIDOMElement)
tbodyNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
+ nsIDOMNodeList tbodyList = tbody.getChildNodes();
+ nsIDOMNode tempNode = tbodyList.item(0);
+ nsIDOMElement returnElement = (nsIDOMElement)
tempNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ return returnElement;
}
}
\ No newline at end of file
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -19,29 +19,23 @@
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.mozilla.interfaces.nsIDOMDocument;
-import org.w3c.dom.Document;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class RichFacesDataTableTemplate extends VpeAbstractTemplate {
- // TODO A. Yukhovich please fix it
- /*
- @Override
- public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement,
Document visualDocument, Node visualNode, Object data, String name, String value) {
- return true;
- }
- */
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode, Document
visualDocument) {
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
+
Element sourceElement = (Element)sourceNode;
- Element table = visualDocument.createElement("table");
+ nsIDOMElement table = visualDocument.createElement("table");
ComponentUtil.copyAttributes(sourceNode, table);
- // TODO A. Yukhovich please fix it
- VpeCreationData creationData = new VpeCreationData(null/*table*/);
+ VpeCreationData creationData = new VpeCreationData(table);
ComponentUtil.setCSSLink(pageContext, "dataTable/dataTable.css",
"richFacesDataTable");
String tableClass = sourceElement.getAttribute("styleClass");
@@ -50,7 +44,7 @@
// Encode colgroup definition.
ArrayList<Element> columns = getColumns(sourceElement);
int columnsLength = getColumnsCount(sourceElement, columns);
- Element colgroup = visualDocument.createElement("colgroup");
+ nsIDOMElement colgroup = visualDocument.createElement("colgroup");
colgroup.setAttribute("span", String.valueOf(columnsLength));
table.appendChild(colgroup);
@@ -58,7 +52,7 @@
if (null != columnsWidth) {
String[] widths = columnsWidth.split(",");
for (int i = 0; i < widths.length; i++) {
- Element col = visualDocument.createElement("col");
+ nsIDOMElement col = visualDocument.createElement("col");
col.setAttribute("width", widths[i]);
colgroup.appendChild(col);
}
@@ -71,7 +65,7 @@
Element header = ComponentUtil.getFacet(sourceElement, "header");
ArrayList<Element> columnsHeaders = getColumnsWithFacet(columns,
"header");
if(header!=null || !columnsHeaders.isEmpty()) {
- Element thead = visualDocument.createElement("thead");
+ nsIDOMElement thead = visualDocument.createElement("thead");
table.appendChild(thead);
String headerClass = (String) sourceElement.getAttribute("headerClass");
if(header != null) {
@@ -82,7 +76,7 @@
headerClass, "td");
}
if(!columnsHeaders.isEmpty()) {
- Element tr = visualDocument.createElement("tr");
+ nsIDOMElement tr = visualDocument.createElement("tr");
thead.appendChild(tr);
String styleClass = encodeStyleClass(null, "dr-table-subheader
rich-table-subheader", null, headerClass);
if(styleClass!=null) {
@@ -98,11 +92,11 @@
Element footer = ComponentUtil.getFacet(sourceElement, "footer");
ArrayList<Element> columnsFooters = getColumnsWithFacet(columns,
"footer");
if (footer != null || !columnsFooters.isEmpty()) {
- Element tfoot = visualDocument.createElement("tfoot");
+ nsIDOMElement tfoot = visualDocument.createElement("tfoot");
table.appendChild(tfoot);
String footerClass = (String) sourceElement.getAttribute("footerClass");
if(!columnsFooters.isEmpty()) {
- Element tr = visualDocument.createElement("tr");
+ nsIDOMElement tr = visualDocument.createElement("tr");
tfoot.appendChild(tr);
String styleClass = encodeStyleClass(null, "dr-table-subfooter
rich-table-subfooter", null, footerClass);
if(styleClass!=null) {
@@ -121,13 +115,13 @@
}
}
- Element tbody = visualDocument.createElement("tbody");
+ nsIDOMElement tbody = visualDocument.createElement("tbody");
table.appendChild(tbody);
// Create mapping to Encode body
List<Node> children = ComponentUtil.getChildren(sourceElement);
boolean firstRow = true;
- Element tr = null;
+ nsIDOMElement tr = null;
VpeChildrenInfo trInfo = null;
for (Node child : children) {
if(child.getNodeName().endsWith(":column")) {
@@ -143,8 +137,7 @@
} else {
tr.setAttribute("class", "dr-table-row rich-table-row");
}
- // TODO A. Yukhovich please fix it
- trInfo = new VpeChildrenInfo(null/*tr*/);
+ trInfo = new VpeChildrenInfo(tr);
tbody.appendChild(tr);
creationData.addChildrenInfo(trInfo);
}
@@ -156,8 +149,7 @@
RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(creationData, (Element)child,
visualDocument, tbody);
tr = null;
} else {
- // TODO A. Yukhovich please fix it
- VpeChildrenInfo childInfo = new VpeChildrenInfo(null/*tbody*/);
+ VpeChildrenInfo childInfo = new VpeChildrenInfo(tbody);
childInfo.addSourceChild(child);
creationData.addChildrenInfo(childInfo);
tr = null;
@@ -167,14 +159,14 @@
return creationData;
}
- protected void encodeCaption(VpeCreationData creationData, Element sourceElement,
Document visualDocument, Element table) {
+ protected void encodeCaption(VpeCreationData creationData, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMElement table) {
//Encode caption
Element captionFromFacet = ComponentUtil.getFacet(sourceElement, "caption");
if (captionFromFacet != null) {
String captionClass = (String) table.getAttribute("captionClass");
String captionStyle = (String) table.getAttribute("captionStyle");
- Element caption = visualDocument.createElement("caption");
+ nsIDOMElement caption = visualDocument.createElement("caption");
table.appendChild(caption);
if (captionClass != null && captionClass.length()>0) {
captionClass = "dr-table-caption rich-table-caption " + captionClass;
@@ -186,19 +178,18 @@
caption.setAttribute("style", captionStyle);
}
- // TODO A. Yukhovich please fix it
- VpeChildrenInfo cap = new VpeChildrenInfo(null/*caption*/);
+ VpeChildrenInfo cap = new VpeChildrenInfo(caption);
cap.addSourceChild(captionFromFacet);
creationData.addChildrenInfo(cap);
}
}
- public static void encodeHeaderOrFooterFacets(VpeCreationData creationData, Element
parentTr, Document visualDocument, ArrayList<Element> headersOrFooters, String
skinCellClass, String headerClass, String facetName, String element) {
+ public static void encodeHeaderOrFooterFacets(VpeCreationData creationData,
nsIDOMElement parentTr, nsIDOMDocument visualDocument, ArrayList<Element>
headersOrFooters, String skinCellClass, String headerClass, String facetName, String
element) {
for (Element column : headersOrFooters) {
String classAttribute = facetName + "Class";
String columnHeaderClass = column.getAttribute(classAttribute);
- Element td = visualDocument.createElement(element);
+ nsIDOMElement td = visualDocument.createElement(element);
parentTr.appendChild(td);
String styleClass = encodeStyleClass(null, skinCellClass, headerClass,
columnHeaderClass);
td.setAttribute("class", styleClass);
@@ -209,14 +200,13 @@
}
Element facetBody = ComponentUtil.getFacet(column, facetName);
- // TODO A. Yukhovich please fix it
- VpeChildrenInfo child = new VpeChildrenInfo(null/*td*/);
+ VpeChildrenInfo child = new VpeChildrenInfo(td);
child.addSourceChild(facetBody);
creationData.addChildrenInfo(child);
}
}
- protected void encodeTableHeaderOrFooterFacet(VpeCreationData creationData, Element
parentTheadOrTfood, int columns, Document visualDocument, Element facetBody, String
skinFirstRowClass, String skinRowClass, String skinCellClass, String facetBodyClass,
String element) {
+ protected void encodeTableHeaderOrFooterFacet(VpeCreationData creationData,
nsIDOMElement parentTheadOrTfood, int columns, nsIDOMDocument visualDocument, Element
facetBody, String skinFirstRowClass, String skinRowClass, String skinCellClass, String
facetBodyClass, String element) {
boolean isColumnGroup = facetBody.getNodeName().endsWith(":columnGroup");
boolean isSubTable = facetBody.getNodeName().endsWith(":subTable");
if(isColumnGroup) {
@@ -224,7 +214,7 @@
} else if(isSubTable) {
RichFacesSubTableTemplate.DEFAULT_INSTANCE.encode(creationData, facetBody,
visualDocument, parentTheadOrTfood);
} else {
- Element tr = visualDocument.createElement("tr");
+ nsIDOMElement tr = visualDocument.createElement("tr");
parentTheadOrTfood.appendChild(tr);
String styleClass = encodeStyleClass(null, skinFirstRowClass, facetBodyClass, null);
@@ -234,7 +224,7 @@
String style = ComponentUtil.getHeaderBackgoundImgStyle();
tr.setAttribute("style", style);
- Element td = visualDocument.createElement(element);
+ nsIDOMElement td = visualDocument.createElement(element);
tr.appendChild(td);
styleClass = encodeStyleClass(null, skinCellClass, facetBodyClass, null);
@@ -247,8 +237,7 @@
}
td.setAttribute("scope", "colgroup");
- // TODO A. Yukhovich please fix it
- VpeChildrenInfo child = new VpeChildrenInfo(null/*td*/);
+ VpeChildrenInfo child = new VpeChildrenInfo(td);
child.addSourceChild(facetBody);
creationData.addChildrenInfo(child);
}
@@ -380,23 +369,17 @@
}
return count;
}
-
- // TODO A. Yukhovich please fix it
- /*
+
@Override
- public void removeAttribute(VpePageContext pageContext, Element sourceElement, Document
visualDocument, Node visualNode, Object data, String name) {
- ((Element)visualNode).removeAttribute(name);
+ public void removeAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name) {
+ nsIDOMElement visualElement =
(nsIDOMElement)visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ visualElement.removeAttribute(name);
}
@Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement, Document
visualDocument, Node visualNode, Object data, String name, String value) {
- ((Element)visualNode).setAttribute(name, value);
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name, String
value) {
+ nsIDOMElement visualElement =
(nsIDOMElement)visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ visualElement.setAttribute(name, value);
}
- */
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
}
\ No newline at end of file
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesGMapTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesGMapTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesGMapTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -16,7 +16,8 @@
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.mozilla.interfaces.nsIDOMDocument;
-import org.w3c.dom.Document;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -39,21 +40,16 @@
* org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
* java.lang.Object, java.lang.String)
*/
- /*
@Override
- public void removeAttribute(VpePageContext pageContext,
- Element sourceElement, Document visualDocument, Node visualNode,
- Object data, String name) {
- super.removeAttribute(pageContext, sourceElement, visualDocument,
- visualNode, data, name);
- Element img = (Element) visualNode;
+ public void removeAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name) {
+ super.removeAttribute(pageContext, sourceElement, visualDocument, visualNode, data,
name);
+ nsIDOMElement img = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
if(STYLE_CLASS_ATTR_NAME.equals(name)){
- img.removeAttribute(HtmlComponentUtil.HTML_CLASS_ATTR);
+ img.removeAttribute(HtmlComponentUtil.HTML_CLASS_ATTR);
} else{
img.removeAttribute(name);
}
}
- */
/*
* (non-Javadoc)
@@ -62,15 +58,10 @@
* org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
* java.lang.Object, java.lang.String, java.lang.String)
*/
- // TODO A. Yukhovich please fix it
- /*
@Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement,
- Document visualDocument, Node visualNode, Object data, String name,
- String value) {
- super.setAttribute(pageContext, sourceElement, visualDocument,
- visualNode, data, name, value);
- Element img = (Element) visualNode;
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name, String
value) {
+ super.setAttribute(pageContext, sourceElement, visualDocument, visualNode, data, name,
value);
+ nsIDOMElement img = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
img.setAttribute(name, value);
if(STYLE_CLASS_ATTR_NAME.equals(name)){
img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,value);
@@ -78,7 +69,6 @@
img.setAttribute(name,value);
}
}
- */
/**
* Create html instead of rich:faces component.
@@ -91,30 +81,19 @@
* The document of the visual tree.
* @return The information on the created node of the visual tree.
*/
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- Document visualDocument) {
- Element img = visualDocument.createElement("img");
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
+ nsIDOMElement img = visualDocument.createElement("img");
ComponentUtil.setImg(img, IMAGE_NAME);
ComponentUtil.copyAttributes(sourceNode, img);
if(((Element)sourceNode).getAttribute(STYLE_CLASS_ATTR_NAME)!=null){
img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,((Element)sourceNode).getAttribute("styleClass"));
}
- // TODO A. Yukhovich please fix it
- VpeCreationData creationData = new VpeCreationData(null/*img*/);
+ VpeCreationData creationData = new VpeCreationData(img);
return creationData;
}
- // TODO A. Yukhovich please fix it
- public void resize(VpePageContext pageContext, Element sourceElement,
- Document visualDocument, Element visualElement, Object data,
- int resizerConstrains, int top, int left, int width, int height) {
-// super.resize(pageContext, sourceElement, visualDocument, visualElement,
-// data, resizerConstrains, top, left, width, height);
+ public void resize(VpePageContext pageContext, Element sourceElement, nsIDOMDocument
visualDocument, nsIDOMElement visualElement, Object data, int resizerConstrains, int top,
int left, int width, int height) {
+ super.resize(pageContext, sourceElement, visualDocument, visualElement, data,
resizerConstrains, top, left, width, height);
}
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
}
\ No newline at end of file
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSliderTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSliderTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSliderTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -10,22 +10,23 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces.template;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.RichFacesTemplatesActivator;
-import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.RichFacesTemplatesActivator;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.mozilla.interfaces.nsIDOMDocument;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMNodeList;
+import org.mozilla.interfaces.nsIDOMText;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
/**
* Template for input number slider control
@@ -77,11 +78,11 @@
/** */
final private Map<String, Method> mapAttributeToMethod;
- final private static Class[] defaultArgsMappedMethods = new Class[2];
+ final private static Class<?>[] defaultArgsMappedMethods = new Class<?>[2];
static {
defaultArgsMappedMethods[0] = Element.class;
- defaultArgsMappedMethods[1] = Element.class;
+ defaultArgsMappedMethods[1] = nsIDOMElement.class;
}
/**
@@ -110,7 +111,7 @@
* @return
*/
private Method getMethodByName(String methodName) {
- Class clazz = this.getClass();
+ Class<?> clazz = this.getClass();
Method m1 = null;
try {
m1 = clazz.getMethod(methodName, defaultArgsMappedMethods);
@@ -149,25 +150,24 @@
* The document of the visual tree.
* @return The information on the created node of the visual tree.
*/
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- Document visualDocument) {
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
- Element table1 = null;
- Element table1Tr1 = null;
- Element table1Tr1Td1 = null;
- Text table1Tr1Td1Text = null;
- Element table1Tr1Td2 = null;
- Text table1Tr1Td2Text = null;
- Element table1Tr1Td3 = null;
- Element table1Tr1Td3input = null;
- Element table1Tr2 = null;
- Element table1Tr2Td1 = null;
- Element table1Tr2Td1Table2 = null;
- Element table1Tr2Td1Table2Tr1 = null;
- Element table1Tr2Td1Table2Tr1Td1 = null;
- Element table1Tr2Td1Table2Tr1Td2 = null;
- Element table1Tr2Td1Table2Tr1Td2Img = null;
- Element table1Tr2Td1Table2Tr1Td3 = null;
+ nsIDOMElement table1 = null;
+ nsIDOMElement table1Tr1 = null;
+ nsIDOMElement table1Tr1Td1 = null;
+ nsIDOMText table1Tr1Td1Text = null;
+ nsIDOMElement table1Tr1Td2 = null;
+ nsIDOMText table1Tr1Td2Text = null;
+ nsIDOMElement table1Tr1Td3 = null;
+ nsIDOMElement table1Tr1Td3input = null;
+ nsIDOMElement table1Tr2 = null;
+ nsIDOMElement table1Tr2Td1 = null;
+ nsIDOMElement table1Tr2Td1Table2 = null;
+ nsIDOMElement table1Tr2Td1Table2Tr1 = null;
+ nsIDOMElement table1Tr2Td1Table2Tr1Td1 = null;
+ nsIDOMElement table1Tr2Td1Table2Tr1Td2 = null;
+ nsIDOMElement table1Tr2Td1Table2Tr1Td2Img = null;
+ nsIDOMElement table1Tr2Td1Table2Tr1Td3 = null;
// sets css link
ComponentUtil.setCSSLink(pageContext, CSS_FILE, "inputNumberSlider");
@@ -282,8 +282,8 @@
}
}
- // TODO A. Yukhovich please fix it
- VpeCreationData creationData = new VpeCreationData(null/*table1*/);
+
+ VpeCreationData creationData = new VpeCreationData(table1);
return creationData;
}
@@ -293,11 +293,8 @@
* org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
* java.lang.Object, java.lang.String, java.lang.String)
*/
- /*
@Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement,
- Document visualDocument, Node visualNode, Object data, String name,
- String value) {
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name, String
value) {
Method function = mapAttributeToMethod.get(name);
if (function != null) {
@@ -313,10 +310,12 @@
} catch (InvocationTargetException e3) {
RichFacesTemplatesActivator.getPluginLog().logWarning("InvocationTargetException:
" + name + ":"+ e3.getMessage() );
}
- }
- correctArrowPosition(sourceElement, visualNode);
+ }
+
+ nsIDOMElement visualtElement = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ correctArrowPosition(sourceElement, visualtElement);
}
- */
/**
*
@@ -337,7 +336,7 @@
*
* @param tree
*/
- private void addBasicTableAttributes(Element table) {
+ private void addBasicTableAttributes(nsIDOMElement table) {
table.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, "0");
table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, "0");
table.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, "0");
@@ -348,15 +347,16 @@
* @param visualNode
* @return
*/
- private Element getInputElement(Element visualNode) {
- Element table = (Element) visualNode;
- NodeList tableList = table.getChildNodes();
- Node tr = tableList.item(0);
- NodeList trList = tr.getChildNodes();
- Node td1 = trList.item(2);
- NodeList td1List = td1.getChildNodes();
- Element input = (Element) td1List.item(0);
- return input;
+ private nsIDOMElement getInputElement(nsIDOMElement visualNode) {
+ nsIDOMElement table = visualNode;
+ nsIDOMNodeList tableList = table.getChildNodes();
+ nsIDOMNode tr = tableList.item(0);
+ nsIDOMNodeList trList = tr.getChildNodes();
+ nsIDOMNode td1 = trList.item(2);
+ nsIDOMNodeList td1List = td1.getChildNodes();
+ nsIDOMNode input = td1List.item(0);
+ nsIDOMElement inputElement = (nsIDOMElement)
input.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ return inputElement;
}
/**
@@ -364,15 +364,16 @@
* @param visualNode
* @return
*/
- private Node getMaxValueElement(Element visualNode) {
- Element table = (Element) visualNode;
- NodeList tableList = table.getChildNodes();
- Node tr = tableList.item(0);
- NodeList trList = tr.getChildNodes();
- Node td1 = trList.item(1);
- NodeList td1List = td1.getChildNodes();
- Node maxValue = td1List.item(0);
- return maxValue;
+ private nsIDOMElement getMaxValueElement(nsIDOMElement visualNode) {
+ nsIDOMElement table = visualNode;
+ nsIDOMNodeList tableList = table.getChildNodes();
+ nsIDOMNode tr = tableList.item(0);
+ nsIDOMNodeList trList = tr.getChildNodes();
+ nsIDOMNode td1 = trList.item(1);
+ nsIDOMNodeList td1List = td1.getChildNodes();
+ nsIDOMNode maxValue = td1List.item(0);
+ nsIDOMElement maxValueElement = (nsIDOMElement)
maxValue.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ return maxValueElement;
}
/**
@@ -380,15 +381,16 @@
* @param visualNode
* @return
*/
- private Node getMinValueElement(Element visualNode) {
- Element table = (Element) visualNode;
- NodeList tableList = table.getChildNodes();
- Node tr = tableList.item(0);
- NodeList trList = tr.getChildNodes();
- Node td1 = trList.item(0);
- NodeList td1List = td1.getChildNodes();
- Node minValue = td1List.item(0);
- return minValue;
+ private nsIDOMElement getMinValueElement(nsIDOMElement visualNode) {
+ nsIDOMElement table = visualNode;
+ nsIDOMNodeList tableList = table.getChildNodes();
+ nsIDOMNode tr = tableList.item(0);
+ nsIDOMNodeList trList = tr.getChildNodes();
+ nsIDOMNode td1 = trList.item(0);
+ nsIDOMNodeList td1List = td1.getChildNodes();
+ nsIDOMNode minValue = td1List.item(0);
+ nsIDOMElement minValueElement = (nsIDOMElement)
minValue.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ return minValueElement;
}
/**
@@ -396,8 +398,8 @@
* @param visualNode
* @param sourceNode
*/
- public void showInput(Element visualNode, Element sourceNode) {
- Element input = getInputElement(visualNode);
+ public void showInput(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMElement input = getInputElement(visualNode);
if (getAttribute(SLIDER_SHOWINPUT_ATTR, sourceNode).equalsIgnoreCase(
"false")) {
input.setAttribute(HtmlComponentUtil.HTML_TYPE_ATTR,
@@ -413,7 +415,7 @@
* @param visualNode
* @param sourceNode
*/
- public void showBoundaryValues(Element visualNode, Element sourceNode) {
+ public void showBoundaryValues(nsIDOMElement visualNode, Element sourceNode) {
setMaxValue(visualNode, sourceNode);
setMinValue(visualNode, sourceNode);
}
@@ -423,8 +425,8 @@
* @param visualNode
* @param sourceNode
*/
- public void setInputSize(Element visualNode, Element sourceNode) {
- Element input = getInputElement(visualNode);
+ public void setInputSize(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMElement input = getInputElement(visualNode);
if (input != null) {
input.setAttribute("size", getInputSize(sourceNode));
}
@@ -435,8 +437,8 @@
* @param visualNode
* @param sourceNode
*/
- public void setInputClass(Element visualNode, Element sourceNode) {
- Element input = getInputElement(visualNode);
+ public void setInputClass(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMElement input = getInputElement(visualNode);
if (input != null) {
String tmp = getInputClass(sourceNode);
input.setAttribute("class", tmp);
@@ -448,8 +450,8 @@
* @param visualNode
* @param sourceNode
*/
- public void setMaxValue(Element visualNode, Element sourceNode) {
- Node maxValue = getMaxValueElement(visualNode);
+ public void setMaxValue(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMElement maxValue = getMaxValueElement(visualNode);
if (maxValue != null) {
if (getAttribute(SLIDER_SHOWBOUNDARY_ATTR, sourceNode)
.equalsIgnoreCase("false")) {
@@ -472,8 +474,8 @@
* @param visualNode
* @param sourceNode
*/
- public void setMinValue(Element visualNode, Element sourceNode) {
- Node minValue = getMinValueElement(visualNode);
+ public void setMinValue(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMElement minValue = getMinValueElement(visualNode);
if (minValue != null) {
if (getAttribute(SLIDER_SHOWBOUNDARY_ATTR, sourceNode)
.equalsIgnoreCase("false")) {
@@ -526,9 +528,9 @@
* Corrects arrow position accordinlye max, min and inputValues
*
* @param sourceNode
- * @param visulaNode
+ * @param visualElement
*/
- private void correctArrowPosition(Element sourceNode, Node visulaNode) {
+ private void correctArrowPosition(Element sourceNode, nsIDOMElement visualElement) {
String minValue = sourceNode.getAttribute(SLIDER_MINVALUE_ATTR);
String maxValue = sourceNode.getAttribute(SLIDER_MAXVALUE_ATTR);
@@ -563,15 +565,28 @@
step = 1;
}
double h1 = ((roundForStep(step, value) - min) / (max - min)) * 100;
- double h2 = 100 - h1;
- Element table1Tr2Td1Table2Tr1Td1 = (Element) visulaNode.getChildNodes()
- .item(1).getChildNodes().item(0).getChildNodes().item(0)
- .getChildNodes().item(0).getChildNodes().item(0);
+ double h2 = 100 - h1;
+
+
+ nsIDOMNodeList nodeList = visualElement.getChildNodes();
+ nsIDOMNode node_01 = nodeList.item(1);
+ nsIDOMNodeList nodeList_01 = node_01.getChildNodes();
+ nsIDOMNode node_01_00 = nodeList_01.item(0);
+ nsIDOMNodeList nodeList_01_00 = node_01_00.getChildNodes();
+ nsIDOMNode node_01_00_00 = nodeList_01_00.item(0);
+ nsIDOMNodeList nodeList_01_00_00 = node_01_00_00.getChildNodes();
+ nsIDOMNode node_01_00_00_00 = nodeList_01_00_00.item(0);
+ nsIDOMNodeList nodeList_01_00_00_00 = node_01_00_00_00.getChildNodes();
+ nsIDOMNode node_01_00_00_00_00 = nodeList_01_00_00_00.item(0);
+ nsIDOMNode node_01_00_00_00_02 = nodeList_01_00_00_00.item(2);
+
+ nsIDOMElement table1Tr2Td1Table2Tr1Td1 =
(nsIDOMElement)node_01_00_00_00_00.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
table1Tr2Td1Table2Tr1Td1.setAttribute(
- HtmlComponentUtil.HTML_WIDTH_ATTR, (int) h1 + "%");
- Element table1Tr2Td1Table2Tr1Td2 = (Element) visulaNode.getChildNodes()
- .item(1).getChildNodes().item(0).getChildNodes().item(0)
- .getChildNodes().item(0).getChildNodes().item(2);
+ HtmlComponentUtil.HTML_WIDTH_ATTR, (int) h1 + "%");
+
+ nsIDOMElement table1Tr2Td1Table2Tr1Td2 =
(nsIDOMElement)node_01_00_00_00_02.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
table1Tr2Td1Table2Tr1Td2.setAttribute(
HtmlComponentUtil.HTML_WIDTH_ATTR, (int) h2 + "%");
}
@@ -604,8 +619,8 @@
* @param visualNode
* @param sourceNode
*/
- public void setInputValue(Element visualNode, Element sourceNode) {
- Element input = getInputElement(visualNode);
+ public void setInputValue(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMElement input = getInputElement(visualNode);
if (input != null) {
String tmp = getAttribute("value", sourceNode);
if (tmp.length() == 0) {
@@ -622,8 +637,8 @@
* @param visualNode
* @param sourceNode
*/
- public void setInputStyle(Element visualNode, Element sourceNode) {
- Element input = getInputElement(visualNode);
+ public void setInputStyle(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMElement input = getInputElement(visualNode);
if (input != null) {
String tmp = getAttribute("inputStyle", sourceNode);
input.setAttribute("style", tmp);
@@ -635,18 +650,11 @@
* @param visualNode
* @param sourceNode
*/
- public void setMaxlength(Element visualNode, Element sourceNode) {
- Element input = getInputElement(visualNode);
+ public void setMaxlength(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMElement input = getInputElement(visualNode);
if (input != null) {
String tmp = getAttribute("maxlength", sourceNode);
input.setAttribute("maxlength", tmp);
}
- }
-
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
-
+ }
}
\ No newline at end of file
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -10,15 +10,16 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces.template;
-import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
-import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.mozilla.interfaces.nsIDOMDocument;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMNodeList;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
/**
* Template for input number spinner control
@@ -61,22 +62,21 @@
* The document of the visual tree.
* @return The information on the created node of the visual tree.
*/
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- Document visualDocument) {
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
// Set a css for this element
ComponentUtil.setCSSLink(pageContext, CSS_FILE_NAME,
"richFacesInputNumberSpinner");
- Element table = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ nsIDOMElement table = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
table.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, "0px");
table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, "0");
table.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, "0");
- Element row = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ nsIDOMElement row = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
// create input element
- Element cellInput = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ nsIDOMElement cellInput =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
cellInput.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "ins-dr-spnr-e");
cellInput.setAttribute("valign", "top");
cellInput.appendChild(createInputElement(visualDocument, sourceNode));
@@ -84,7 +84,7 @@
// create arrows cell
- Element cellArrows = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ nsIDOMElement cellArrows =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
cellArrows.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "dr-spnr-b");
cellArrows.setAttribute("valign", "middle");
cellArrows.appendChild(createArrowsElement(visualDocument, sourceNode));
@@ -96,8 +96,7 @@
table.setAttribute("style", tmp);
// Create return variable contain template
- // TODO A. Yukhovich please fix it
- VpeCreationData creationData = new VpeCreationData(null/*table*/);
+ VpeCreationData creationData = new VpeCreationData(table);
return creationData;
}
@@ -108,17 +107,17 @@
* @param sourceNode The document of the visual tree.
* @return a HTML-part containg arrows elements
*/
- private Element createArrowsElement(Document visualDocument, Node sourceNode) {
- Element table = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ private nsIDOMElement createArrowsElement(nsIDOMDocument visualDocument, Node
sourceNode) {
+ nsIDOMElement table = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
table.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, "0");
table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, "0");
table.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, "0");
- Element rowUp = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
- Element cellUp = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ nsIDOMElement rowUp = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ nsIDOMElement cellUp = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
- Element imageUpElement =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
+ nsIDOMElement imageUpElement =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
ComponentUtil.setImg(imageUpElement, IMAGE_NAME_UP);
@@ -130,10 +129,10 @@
rowUp.appendChild(cellUp);
table.appendChild(rowUp);
- Element rowDown = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
- Element cellDown = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ nsIDOMElement rowDown = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ nsIDOMElement cellDown = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
- Element imageDownElement =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
+ nsIDOMElement imageDownElement =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
ComponentUtil.setImg(imageDownElement, IMAGE_NAME_DOWN);
@@ -154,8 +153,8 @@
* @param sourceNode The document of the visual tree.
* @return a HTML-part containg input element
*/
- private Element createInputElement(Document visualDocument, Node sourceNode) {
- Element inputElement = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
+ private nsIDOMElement createInputElement(nsIDOMDocument visualDocument, Node sourceNode)
{
+ nsIDOMElement inputElement =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_INPUT);
inputElement.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
getInputClass(sourceNode));
@@ -199,30 +198,24 @@
* java.lang.Object, java.lang.String, java.lang.String)
*/
@Override
- // TODO A. Yukhovich please fix it
- /*
- public void setAttribute(VpePageContext pageContext, Element sourceElement,
- Document visualDocument, Node visualNode, Object data, String name,
- String value) {
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name, String
value) {
// 1. Call super method
- super.setAttribute(pageContext, sourceElement, visualDocument,
- visualNode, data, name, value);
+ super.setAttribute(pageContext, sourceElement, visualDocument, visualNode, data, name,
value);
- Element table = (Element) visualNode;
- NodeList listTable = table.getChildNodes();
- Node nodeTr = listTable.item(0);
- NodeList listTr = nodeTr.getChildNodes();
- Node nodeTd = listTr.item(0);
+ nsIDOMElement table = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ nsIDOMNodeList listTable = table.getChildNodes();
+ nsIDOMNode nodeTr = listTable.item(0);
+ nsIDOMNodeList listTr = nodeTr.getChildNodes();
+ nsIDOMNode nodeTd = listTr.item(0);
- NodeList listTd = nodeTd.getChildNodes();
+ nsIDOMNodeList listTd = nodeTd.getChildNodes();
+ nsIDOMNode entry0 = listTd.item(0);
- Element inputElement = (Element) listTd.item(0);
+ nsIDOMElement inputElement = (nsIDOMElement)
entry0.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- inputElement.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- getInputClass(sourceElement));
+ inputElement.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
getInputClass(sourceElement));
- inputElement.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
- getInputStyle(sourceElement));
+ inputElement.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
getInputStyle(sourceElement));
inputElement.setAttribute(HtmlComponentUtil.HTML_SIZE_ATTR,
getInputSize(sourceElement));
inputElement.setAttribute("value", getInputValue(sourceElement));
@@ -230,8 +223,7 @@
// 3. Set a style for main container
String strStyle = getAttribute("style", sourceElement);
table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, strStyle);
- }
- */
+ }
@@ -243,10 +235,4 @@
return DEFAULT_INPUT_STYLE;
}
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
-
}
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPaint2DTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPaint2DTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPaint2DTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -16,10 +16,9 @@
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.mozilla.interfaces.nsIDOMDocument;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
/**
@@ -34,12 +33,6 @@
private String PAINT2D_CSS_FILE = "/paint2D/paint2D.css";
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
-
/*
* (non-Javadoc)
*
@@ -47,28 +40,18 @@
* org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
* java.lang.Object, java.lang.String)
*/
- // TODO A. Yukhovich please fix it
- /*
@Override
- public void removeAttribute(VpePageContext pageContext,
- Element sourceElement, Document visualDocument, Node visualNode,
- Object data, String name) {
- super.removeAttribute(pageContext, sourceElement, visualDocument,
- visualNode, data, name);
- Element img = (Element) visualNode;
+ public void removeAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name) {
+ super.removeAttribute(pageContext, sourceElement, visualDocument, visualNode, data,
name);
+ nsIDOMElement img =
(nsIDOMElement)visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
if (name.equals("styleClass")
- && sourceElement
- .getAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR) == null
- && sourceElement
- .getAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR) == null) {
- img
- .setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- "imgStyleClass");
+ && sourceElement.getAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR) == null
+ && sourceElement.getAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR) == null) {
+ img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,"imgStyleClass");
} else
img.removeAttribute(name);
}
- */
/*
* (non-Javadoc)
@@ -77,21 +60,15 @@
* org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
* java.lang.Object, java.lang.String, java.lang.String)
*/
- // TODO A. Yukhovich please fix it
- /*
@Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement,
- Document visualDocument, Node visualNode, Object data, String name,
- String value) {
- super.setAttribute(pageContext, sourceElement, visualDocument,
- visualNode, data, name, value);
- Element img = (Element) visualNode;
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name, String
value) {
+ super.setAttribute(pageContext, sourceElement, visualDocument, visualNode, data, name,
value);
+ nsIDOMElement img = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
if (name.equals("styleClass")) {
img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, value);
} else
img.setAttribute(name, value);
}
- */
/**
* Create html instead rich:faces component.
@@ -104,11 +81,8 @@
* The document of the visual tree.
* @return The information on the created node of the visual tree.
*/
- // TODO A. Yukhovich please fix it
- /*
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- Document visualDocument) {
- Element img = visualDocument.createElement("img");
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
+ nsIDOMElement img = visualDocument.createElement("img");
ComponentUtil.setImg(img, IMAGE_NAME);
ComponentUtil.setCSSLink(pageContext, PAINT2D_CSS_FILE, "paint2d");
String attrValue = ((Element) sourceNode).getAttribute("styleClass");
@@ -122,35 +96,8 @@
.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
"imgStyleClass");
}
- copyAtrributes(sourceNode, img, visualDocument);
+ ComponentUtil.copyAttributes(sourceNode, img);
VpeCreationData creationData = new VpeCreationData(img);
return creationData;
}
- */
-
- /**
- * Copy attributes from one node to another node.
- *
- * @param sourceNode
- * @param distinitionNode
- */
- // TODO A. Yukhovich please fix it
- /*
- private void copyAtrributes(Node sourceNode, Element distinitionNode,
- Document visualDocument) {
- NamedNodeMap sourceAttrbutes = sourceNode.getAttributes();
- for (int i = 0; i < sourceAttrbutes.getLength(); i++) {
- Attr attr = visualDocument.createAttribute(sourceAttrbutes.item(i)
- .getNodeName());
- attr.setNodeValue(sourceAttrbutes.item(i).getNodeValue());
- distinitionNode.setAttributeNode(attr);
- }
- }
-
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
- */
}
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSpacerTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSpacerTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSpacerTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -16,7 +16,8 @@
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.mozilla.interfaces.nsIDOMDocument;
-import org.w3c.dom.Document;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -34,17 +35,13 @@
*
* @param pageContext
* Contains the information on edited page.
- * @param sourceNode
- * The current node of the source tree.
- * @param visualDocument
- * The document of the visual tree.
+ * @param sourceNode The current node of the source tree.
+ * @param visualDocument The document of the visual tree.
* @return The information on the created node of the visual tree.
*/
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- Document visualDocument) {
+ public VpeCreationData create(VpePageContext pageContext, Node
sourceNode, nsIDOMDocument visualDocument) {
- Element img = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ nsIDOMElement img = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
ComponentUtil.setImg(img, IMAGE_NAME);
if(sourceNode instanceof Element) {
@@ -52,8 +49,7 @@
img.setAttribute("height", getSize((Element)sourceNode,
"height"));
}
- // TODO A. Yukhovich please fix it
- VpeCreationData creationData = new VpeCreationData(null/*img*/);
+ VpeCreationData creationData = new VpeCreationData(img);
return creationData;
}
@@ -67,41 +63,19 @@
}
}
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
-
/**
*
* @see
com.exadel.vpe.editor.template.VpeAbstractTemplate#setAttribute(com.exadel.vpe.editor.context.VpePageContext,
* org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
* java.lang.Object, java.lang.String, java.lang.String)
*/
- // TODO A. Yukhovich please fix it
- /*
@Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement,
- Document visualDocument, Node visualNode, Object data, String name,
- String value) {
- super.setAttribute(pageContext, sourceElement, visualDocument,
- visualNode, data, name, value);
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name, String
value) {
+ super.setAttribute(pageContext, sourceElement, visualDocument, visualNode, data, name,
value);
- Element img = (Element) visualNode;
+ nsIDOMElement img = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
img.setAttribute("width", getSize(sourceElement, "width"));
img.setAttribute("height", getSize(sourceElement, "height"));
}
- */
-
-
- // TODO A. Yukhovich please fix it
- /*
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
- */
}
\ No newline at end of file
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -19,7 +19,8 @@
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.mozilla.interfaces.nsIDOMDocument;
-import org.w3c.dom.Document;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -31,13 +32,6 @@
super();
}
- // TODO A. Yukhovich please fix it
- /*
- @Override
- public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement,
Document visualDocument, Node visualNode, Object data, String name, String value) {
- return true;
- }
- */
/**
* Encode columnGroup
@@ -47,13 +41,13 @@
* @param parentVisualNode
* @return
*/
- public VpeCreationData encode(VpeCreationData creationData, Element sourceElement,
Document visualDocument, Element parentVisualNode) {
+ public VpeCreationData encode(VpeCreationData creationData, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMElement parentVisualNode) {
if(creationData!=null) {
// Encode header
encodeHeader(creationData, sourceElement, visualDocument, parentVisualNode);
}
- Element tr = visualDocument.createElement("tr");
+ nsIDOMElement tr = visualDocument.createElement("tr");
ComponentUtil.copyAttributes(sourceElement, tr);
boolean header = false;
@@ -74,16 +68,14 @@
if(creationData==null) {
// Method was called from create()
- // TODO A. Yukhovich please fix it
- creationData = new VpeCreationData(null/*tr*/);
+ creationData = new VpeCreationData(tr);
} else {
// Method was called from dataTable
parentVisualNode.appendChild(tr);
}
// Create mapping to Encode body
- // TODO A. Yukhovich please fix it
- VpeChildrenInfo trInfo = new VpeChildrenInfo(null/*tr*/);
+ VpeChildrenInfo trInfo = new VpeChildrenInfo(tr);
creationData.addChildrenInfo(trInfo);
List<Node> children = ComponentUtil.getChildren(sourceElement);
for (Node child : children) {
@@ -101,11 +93,9 @@
}
ComponentUtil.copyAttributes(sourceElement, tr);
if(parentVisualNode!=null) {
- // TODO A. Yukhovich please fix it
- parentVisualNode.appendChild(null/*tr*/);
+ parentVisualNode.appendChild(tr);
}
- // TODO A. Yukhovich please fix it
- trInfo = new VpeChildrenInfo(null/*tr*/);
+ trInfo = new VpeChildrenInfo(tr);
creationData.addChildrenInfo(trInfo);
}
}
@@ -120,26 +110,26 @@
return creationData;
}
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode, Document
visualDocument) {
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
Element sourceElement = (Element)sourceNode;
VpeCreationData creationData = encode(null, sourceElement, visualDocument, null);
return creationData;
}
- protected void encodeHeader(VpeCreationData creationData, Element sourceElement,
Document visualDocument, Element parentVisualNode) {
+ protected void encodeHeader(VpeCreationData creationData, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMElement parentVisualNode) {
encodeHeaderOrFooter(creationData, sourceElement, visualDocument, parentVisualNode,
"header", "dr-subtable-header rich-subtable-header",
"dr-subtable-headercell rich-subtable-headercell");
}
- protected void encodeFooter(VpeCreationData creationData, Element sourceElement,
Document visualDocument, Element parentVisualNode) {
+ protected void encodeFooter(VpeCreationData creationData, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMElement parentVisualNode) {
encodeHeaderOrFooter(creationData, sourceElement, visualDocument, parentVisualNode,
"footer", "dr-subtable-footer rich-subtable-footer",
"dr-subtable-footercell rich-subtable-footercell");
}
- protected void encodeHeaderOrFooter(VpeCreationData creationData, Element sourceElement,
Document visualDocument, Element parentVisualNode, String facetName, String trClass,
String tdClass) {
+ protected void encodeHeaderOrFooter(VpeCreationData creationData, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMElement parentVisualNode, String facetName, String
trClass, String tdClass) {
ArrayList<Element> columns =
RichFacesDataTableTemplate.getColumns(sourceElement);
ArrayList<Element> columnsHeaders =
RichFacesDataTableTemplate.getColumnsWithFacet(columns, facetName);
if(!columnsHeaders.isEmpty()) {
- Element tr = visualDocument.createElement("tr");
+ nsIDOMElement tr = visualDocument.createElement("tr");
parentVisualNode.appendChild(tr);
String styleClass = trClass;
if(styleClass!=null) {
@@ -189,22 +179,15 @@
return null;
}
- // TODO A. Yukhovich please fix it
- /*
@Override
- public void removeAttribute(VpePageContext pageContext, Element sourceElement, Document
visualDocument, Node visualNode, Object data, String name) {
- ((Element)visualNode).removeAttribute(name);
+ public void removeAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name) {
+ nsIDOMElement visualElement =
(nsIDOMElement)visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ visualElement.removeAttribute(name);
}
@Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement, Document
visualDocument, Node visualNode, Object data, String name, String value) {
- ((Element)visualNode).setAttribute(name, value);
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name, String
value) {
+ nsIDOMElement visualElement =
(nsIDOMElement)visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ visualElement.setAttribute(name, value);
}
- */
-
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
}
\ No newline at end of file
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarGroupTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarGroupTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarGroupTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -11,24 +11,19 @@
package org.jboss.tools.jsf.vpe.richfaces.template;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
-import org.jboss.tools.vpe.VpePlugin;
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.mozilla.interfaces.nsIDOMDocument;
-//TODO A. Yukhovich please fix if
-//import org.jboss.tools.vpe.editor.util.MozillaSupports;
-import org.w3c.dom.Document;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -41,14 +36,6 @@
public static final String ATTR_LOCATION_RIGHT_VALUE = "right";
- // TODO A. Yukhovich please fix if
- /*
- @Override
- public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement,
Document visualDocument, Node visualNode, Object data, String name, String value) {
- return true;
- }
- */
-
private class SourceToolBarGroupItem {
private Node toolBarGroupItem;
private String itemSeparator;
@@ -144,9 +131,8 @@
}
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- Document visualDocument) {
- Element visualNode = null;
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
+ nsIDOMElement visualNode = null;
VpeCreationData creationData = null;
Element sourceElement = (Element)sourceNode;
@@ -154,14 +140,12 @@
if (!sourceNode.getParentNode().getNodeName().endsWith(":" +
RichFacesToolBarTemplate.TAG_NAME)) {
visualNode = RichFacesToolBarTemplate.createExceptionNode(visualDocument, "Parent
should be toolBar");
- // TODO A. Yukhovich please fix if
- creationData = new VpeCreationData(null/*visualNode*/);
+ creationData = new VpeCreationData(visualNode);
} else if (!RichFacesToolBarTemplate.isValidItemSeparatorName(itemSeparator)) {
visualNode = RichFacesToolBarTemplate.createExceptionNode(visualDocument,
"Unknown type of separator \"" + itemSeparator +
"\"");
- // TODO A. Yukhovich please fix if
- creationData = new VpeCreationData(null/*visualNode*/);
+ creationData = new VpeCreationData(visualNode);
} else {
SourceToolBarGroupItems sourceToolBarGroupItems = new
SourceToolBarGroupItems(sourceNode,
@@ -171,18 +155,17 @@
visualNode = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
visualNode.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, "border: 0px none;
margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;");
- Element body = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TBODY);
- Element row = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ nsIDOMElement body = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TBODY);
+ nsIDOMElement row = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
row.setAttribute(HtmlComponentUtil.HTML_ATTR_VALIGN,
HtmlComponentUtil.HTML_ATTR_VALIGN_MIDDLE_VALUE);
- // TODO A. Yukhovich please fix if
- creationData = new VpeCreationData(null/*visualNode*/);
+ creationData = new VpeCreationData(visualNode);
Iterator<SourceToolBarGroupItem> iterator = sourceToolBarGroupItems.iterator();
while(iterator.hasNext()) {
SourceToolBarGroupItem toolBarGroupItem = iterator.next();
- Element cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ nsIDOMElement cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
if (toolBarGroupItem.isItem()) {
ComponentUtil.correctAttribute(sourceElement, cell,
RichFacesToolBarTemplate.CONTENTCLASS_ATTR_NAME,
@@ -191,8 +174,7 @@
RichFacesToolBarTemplate.CONTENTSTYLE_ATTR_NAME,
HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
- // TODO A. Yukhovich please fix if
- VpeChildrenInfo childrenInfo = new VpeChildrenInfo(null/*cell*/);
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(cell);
creationData.addChildrenInfo(childrenInfo);
childrenInfo.addSourceChild(toolBarGroupItem.getToolBarGroupItem());
} else {
@@ -202,35 +184,24 @@
HtmlComponentUtil.HTML_CLASS_ATTR, null, null);
String separatorImageUrl = RichFacesToolBarTemplate
.getSeparatorImageUrlString(toolBarGroupItem.getItemSeparator());
- Element separatorImage =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ nsIDOMElement separatorImage =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
ComponentUtil.setImg(separatorImage, separatorImageUrl);
cell.appendChild(separatorImage);
- // TODO A. Yukhovich please fix if
- // MozillaSupports.release(separatorImage);
}
row.appendChild(cell);
- // TODO A. Yukhovich please fix if
- //MozillaSupports.release(cell);
}
body.appendChild(row);
- // TODO A. Yukhovich please fix if
- // MozillaSupports.release(row);
visualNode.appendChild(body);
- // TODO A. Yukhovich please fix if
- // MozillaSupports.release(body);
}
return creationData;
}
- // TODO A. Yukhovich please fix if
- /*
@Override
- public Node getNodeForUptate(VpePageContext pageContext, Node sourceNode,
- Node visualNode, Object data) {
+ public Node getNodeForUptate(VpePageContext pageContext, Node sourceNode, nsIDOMNode
visualNode, Object data) {
String prefix = sourceNode.getPrefix();
if (prefix == null) {
return null;
@@ -249,13 +220,5 @@
return parent;
}
- */
-
-
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
}
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java 2007-08-13
07:26:17 UTC (rev 3082)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java 2007-08-13
09:23:03 UTC (rev 3083)
@@ -10,12 +10,9 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces.template;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.Map;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
@@ -24,14 +21,11 @@
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.mozilla.interfaces.nsIDOMDocument;
-//TODO A. Yukhovich please fix if
-// import org.jboss.tools.vpe.editor.util.MozillaSupports;
-import org.w3c.dom.Document;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
public class RichFacesToolBarTemplate extends VpeAbstractTemplate {
public static final String TAG_NAME = "toolBar";
@@ -58,26 +52,16 @@
static final String WIDTH_ATTR_NAME = "width";
static final String HEIGHT_ATTR_NAME = "height";
- // TODO A. Yukhovich please fix if
- /*
- @Override
- public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement,
Document visualDocument, Node visualNode, Object data, String name, String value) {
- return true;
- }
- */
-
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- Document visualDocument) {
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
VpeCreationData creationData = null;
- Element visualNode = null;
+ nsIDOMElement visualNode = null;
Element sourceElement = (Element) sourceNode;
String itemSeparator = sourceElement.getAttribute(ITEMSEPARATOR_ATTR_NAME);
if (!isValidItemSeparatorName(itemSeparator)) {
visualNode = createExceptionNode(visualDocument,
"Unknown type of separator \"" + itemSeparator +
"\"");
- // TODO A. Yukhovich please fix it
- creationData = new VpeCreationData(null/*visualNode*/);
+ creationData = new VpeCreationData(visualNode);
} else {
SourceToolBarItems sourceToolBarItems = new SourceToolBarItems(sourceNode,
itemSeparator);
String itemSeparatorImageUrl =
getSeparatorImageUrlString(sourceToolBarItems.getItemSeparator());
@@ -101,10 +85,11 @@
STYLE_ATTR_NAME,
HtmlComponentUtil.HTML_STYLE_ATTR, style, style);
- // TODO A. Yukhovich please fix if
- creationData = new VpeCreationData(null/*visualNode*/);
+ creationData = new VpeCreationData(visualNode);
- Element body = null, row = null, cell = null;
+ nsIDOMElement body = null;
+ nsIDOMElement row = null;
+ nsIDOMElement cell = null;
body = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TBODY);
row = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
@@ -125,8 +110,7 @@
toolBarItem.isToolBarGroupItem() ? "padding: 0px 0px 0px 0px;" : null,
toolBarItem.isToolBarGroupItem() ? "padding: 0px 0px 0px 0px;" : null);
- // TODO A. Yukhovich please fix if
- VpeChildrenInfo childrenInfo = new VpeChildrenInfo(null/*cell*/);
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(cell);
creationData.addChildrenInfo(childrenInfo);
childrenInfo.addSourceChild(toolBarItem.getToolBarItem());
} else {
@@ -136,25 +120,19 @@
ComponentUtil.correctAttribute(sourceElement, cell,
SEPARATORCLASS_ATTR_NAME,
HtmlComponentUtil.HTML_CLASS_ATTR, null, null);
- Element separatorImage =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ nsIDOMElement separatorImage =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
ComponentUtil.setImg(separatorImage, itemSeparatorImageUrl);
cell.appendChild(separatorImage);
- // TODO A. Yukhovich please fix if
- // MozillaSupports.release(separatorImage);
}
}
row.appendChild(cell);
- // TODO A. Yukhovich please fix if
- // MozillaSupports.release(cell);
}
// Empty column
cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
cell.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, "100%");
row.appendChild(cell);
- // TODO A. Yukhovich please fix if
- // MozillaSupports.release(cell);
iterator = sourceToolBarItems.getRightItemsIterator();
while (iterator.hasNext()) {
@@ -170,8 +148,7 @@
toolBarItem.isToolBarGroupItem() ? "padding: 0px;" : null,
toolBarItem.isToolBarGroupItem() ? "padding: 0px;" : null);
- // TODO A. Yukhovich please fix if
- VpeChildrenInfo childrenInfo = new VpeChildrenInfo(null/*cell*/);
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(cell);
creationData.addChildrenInfo(childrenInfo);
childrenInfo.addSourceChild(toolBarItem.getToolBarItem());
} else {
@@ -181,39 +158,36 @@
ComponentUtil.correctAttribute(sourceElement, cell,
SEPARATORCLASS_ATTR_NAME,
HtmlComponentUtil.HTML_CLASS_ATTR, null, null);
- Element separatorImage =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ nsIDOMElement separatorImage =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
ComponentUtil.setImg(separatorImage, itemSeparatorImageUrl);
cell.appendChild(separatorImage);
- // TODO A. Yukhovich please fix if
- // MozillaSupports.release(separatorImage);
}
}
row.appendChild(cell);
- // TODO A. Yukhovich please fix if
- // MozillaSupports.release(cell);
}
body.appendChild(row);
- // TODO A. Yukhovich please fix if
- // MozillaSupports.release(row);
visualNode.appendChild(body);
- // TODO A. Yukhovich please fix if
- // MozillaSupports.release(body);
}
return creationData;
}
- static Element createExceptionNode(Document visualDocument, String message) {
- Element visualNode;
+ /**
+ *
+ * @param visualDocument
+ * @param message
+ * @return
+ */
+ static nsIDOMElement createExceptionNode(nsIDOMDocument visualDocument, String message)
{
+ nsIDOMElement visualNode;
+
visualNode = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_SPAN);
visualNode.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
EXCEPTION_ATTR_STYLE_VALUE);
- Text text = visualDocument.createTextNode(message);
+ nsIDOMText text = visualDocument.createTextNode(message);
visualNode.appendChild(text);
- // TODO A. Yukhovich please fix if
- // MozillaSupports.release(text);
-
+
return visualNode;
}
@@ -513,10 +487,4 @@
return itemSeparator;
}
}
-
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
}
\ No newline at end of file