Author: ayukhovich
Date: 2007-08-14 06:14:44 -0400 (Tue, 14 Aug 2007)
New Revision: 3110
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSeparatorTemplate.java
Log:
http://jira.jboss.com/jira/browse/EXIN-435
change using Node to nsIDOMNode and Element to nsIDOMElement for classes:
RichFacesSeparatorTemplate
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSeparatorTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSeparatorTemplate.java 2007-08-14
09:57:22 UTC (rev 3109)
+++
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSeparatorTemplate.java 2007-08-14
10:14:44 UTC (rev 3110)
@@ -16,6 +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.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMNodeList;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -54,13 +57,6 @@
final static String DEFAULT_WIDTH = "100%";
/**
- * Constructor
- */
- public RichFacesSeparatorTemplate() {
- super();
- }
-
- /**
* Creates a node of the visual tree on the node of the source tree. This
* visual node should not have the parent node This visual node can have
* child nodes.
@@ -73,17 +69,15 @@
* 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) {
ComponentUtil.setCSSLink(pageContext, STYLE_PATH, "richFacesSeparator");
Element sourceElement = (Element) sourceNode;
/* Create new html element table */
- Element separator = visualDocument
+ nsIDOMElement separator = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- Element line = visualDocument
+ nsIDOMElement line = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- // TODO A. Yukhovich please fix it
- VpeCreationData creationData = new VpeCreationData(null/*separator*/);
+ VpeCreationData creationData = new VpeCreationData(separator);
String width = sourceElement
.getAttribute(HtmlComponentUtil.HTML_ATR_WIDTH);
String height = sourceElement
@@ -121,23 +115,15 @@
/**
* Method for remove attributes in separator
*/
- // 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;
- Element line = getLineElement(element);
- String style = sourceElement
- .getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
- String width = sourceElement
- .getAttribute(HtmlComponentUtil.HTML_ATR_WIDTH);
+ 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);
+ nsIDOMElement line = getLineElement(element);
+ String style = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ String width = sourceElement.getAttribute(HtmlComponentUtil.HTML_ATR_WIDTH);
String newStyle;
- String height = sourceElement
- .getAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT);
+ String height = sourceElement.getAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT);
String lineType = sourceElement.getAttribute(LINE_TYPE_ATTR);
if (lineType == null) {
@@ -174,24 +160,19 @@
line.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) {
String newStyle;
super.setAttribute(pageContext, sourceElement, visualDocument,
visualNode, data, name, value);
- Element element = (Element) visualNode;
- Element line = getLineElement(element);
+ nsIDOMElement element = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ nsIDOMElement line = getLineElement(element);
String style = sourceElement
.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
String width = sourceElement
@@ -266,7 +247,6 @@
line.setAttribute(name, value);
}
}
- */
/**
* Method add in size extention prefix(default 'px').
@@ -328,9 +308,11 @@
return false;
}
- private Element getLineElement(Element parent) {
- NodeList list = parent.getChildNodes();
- return (Element) list.item(0);
+ private nsIDOMElement getLineElement(nsIDOMElement parent) {
+ nsIDOMNodeList list = parent.getChildNodes();
+ nsIDOMNode node = list.item(0);
+ nsIDOMElement element = (nsIDOMElement)
node.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ return element;
}
/**
@@ -345,12 +327,9 @@
private String setStyle(String lineType, String width, String height,
String style) {
StringBuffer newStyle = new StringBuffer();
- newStyle.append(HtmlComponentUtil.CSS_BORDER_STYLE + ":"
- + (lineType == null ? LINE_SOLID : lineType) + ";");
- newStyle.append(HtmlComponentUtil.CSS_BORDER_WIDTH + ":"
- + (height == null ? DEFAULT_HEIGHT : height) + " 0px 0px;");
- newStyle.append(HtmlComponentUtil.HTML_ATR_WIDTH + ":"
- + (width == null ? DEFAULT_WIDTH : width) + ";");
+ newStyle.append(HtmlComponentUtil.CSS_BORDER_STYLE + ":" + (lineType == null
? LINE_SOLID : lineType) + ";");
+ newStyle.append(HtmlComponentUtil.CSS_BORDER_WIDTH + ":" + (height == null ?
DEFAULT_HEIGHT : height) + " 0px 0px;");
+ newStyle.append(HtmlComponentUtil.HTML_ATR_WIDTH + ":" + (width == null ?
DEFAULT_WIDTH : width) + ";");
newStyle.append((style == null ? "" : style));
return newStyle.toString();
}
@@ -365,17 +344,10 @@
*/
private String setBeveledStyle(String width, String height, String style) {
StringBuffer newStyle = new StringBuffer();
- newStyle.append(HtmlComponentUtil.HTML_ATR_HEIGHT + ":"
- + (height == null ? DEFAULT_HEIGHT : height) + ";");
- newStyle.append(HtmlComponentUtil.HTML_ATR_WIDTH + ":"
- + (width == null ? DEFAULT_WIDTH : width) + ";");
+ newStyle.append(HtmlComponentUtil.HTML_ATR_HEIGHT + ":" + (height == null ?
DEFAULT_HEIGHT : height) + ";");
+ newStyle.append(HtmlComponentUtil.HTML_ATR_WIDTH + ":" + (width == null ?
DEFAULT_WIDTH : width) + ";");
newStyle.append((style == null ? "" : style));
return newStyle.toString();
}
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
- // TODO Auto-generated method stub
- return null;
- }
}
\ No newline at end of file