Author: estherbin
Date: 2008-06-09 07:21:42 -0400 (Mon, 09 Jun 2008)
New Revision: 8640
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceInputTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceSelectTemplate.java
Log:
Fix templates.
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java 2008-06-09
09:55:05 UTC (rev 8639)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java 2008-06-09
11:21:42 UTC (rev 8640)
@@ -336,59 +336,8 @@
}
- /**
- * Removes the attribute.
- *
- * @param sourceElement the source element
- * @param visualDocument the visual document
- * @param visualNode the visual node
- * @param data the data
- * @param pageContext the page context
- * @param name the name
- */
- @Override
- public void removeAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode,
- Object data, String name) {
- super.removeAttribute(pageContext, sourceElement, visualDocument, visualNode,
data, name);
- final nsIDOMElement span = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- if (RichFaces.ATTR_STYLE_CLASS.equals(name)) {
- span.setAttribute(HTML.ATTR_CLASS, DEFAULT_NULL_VALUE);
- } else if (RichFaces.ATTR_VALUE.equals(name)) {
- span.removeChild(span.getFirstChild());
- span.appendChild(visualDocument.createTextNode(DEFAULT_NULL_VALUE));
- }
-
- }
-
/**
- * Sets the attribute.
- *
- * @param sourceElement the source element
- * @param value the value
- * @param visualDocument the visual document
- * @param visualNode the visual node
- * @param data the data
- * @param pageContext the page context
- * @param name the name
- */
- @Override
- 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);
-
- final nsIDOMElement span = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- if (RichFaces.ATTR_VALUE.equals(name)) {
- final nsIDOMText text = visualDocument.createTextNode(((value == null) ||
(value.length() == 0) ? DEFAULT_NULL_VALUE : value));
-
- span.removeChild(span.getFirstChild());
- span.appendChild(text);
- } else if (RichFaces.ATTR_STYLE_CLASS.equals(name)) {
- span.setAttribute(HTML.ATTR_CLASS, ((value == null) || (value.length() == 0)
? RICH_INPLACE_VIEW_DEFAULT_STYLE_CLASS : value));
- }
- }
-
- /**
* Sets the up img.
*
* @param i * @param width the width
@@ -457,6 +406,8 @@
}
+ protected abstract String getCssStylesControlSuffix();
+
/**
* Creates the controls div.
@@ -470,13 +421,13 @@
protected nsIDOMElement createControlsDiv(VpePageContext pageContext, Node
sourceNode, nsIDOMDocument visualDocument) {
final nsIDOMElement element =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- element.setAttribute(HTML.ATTR_CLASS,
"rich-inplace"+getCssStylesSuffix()+"-controls-set");
+ element.setAttribute(HTML.ATTR_CLASS,
"rich-inplace"+getCssStylesControlSuffix()+"-controls-set");
element.setAttribute(HTML.ATTR_STYLE, "position: absolute; top: " +
controlsVerticalPositions.get(this.controlsVerticalPosition)
+ ";left:" + " " +
controlsHorizontalPositions.get(this.controlsHorizontalPosition) + ";");
final nsIDOMElement divShadov =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- divShadov.setAttribute(HTML.ATTR_CLASS,
"rich-inplace"+getCssExtension()+"-shadow");
+ divShadov.setAttribute(HTML.ATTR_CLASS,
"rich-inplace"+getCssStylesSuffix()+"-shadow");
final nsIDOMElement divShadovTable =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
divShadovTable.setAttribute(HTML.ATTR_CELLPADDING, "0");
divShadovTable.setAttribute(HTML.ATTR_CELLSPACING, "0");
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceInputTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceInputTemplate.java 2008-06-09
09:55:05 UTC (rev 8639)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceInputTemplate.java 2008-06-09
11:21:42 UTC (rev 8640)
@@ -18,6 +18,7 @@
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.xulrunner.browser.util.DOMTreeDumper;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.w3c.dom.Element;
@@ -68,6 +69,7 @@
innerInput1.setAttribute(HTML.ATTR_STYLE, "top: 0px; width: " +
this.inputWidth + ";");
innerInput1.setAttribute(HTML.ATTR_TYPE, "text");
innerInput1.setAttribute("autocomplete", "off");
+
if (showControls) {
rootSpan.appendChild(createControlsDiv(pageContext, sourceNode,
visualDocument));
}
@@ -76,15 +78,24 @@
innerInput1.setAttribute(HTML.ATTR_TYPE, "button");
}
data = new VpeCreationData(rootSpan);
-// final DOMTreeDumper dumper = new DOMTreeDumper();
+ final DOMTreeDumper dumper = new DOMTreeDumper();
if (!isToggle) {
-
- rootSpan.appendChild(visualDocument.createTextNode(getValue()));
+ final String value = getValue();
+
+ if (value.equals(DEFAULT_NULL_VALUE)) {
+ final nsIDOMElement pre =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
+
+ pre.appendChild(visualDocument.createTextNode("aaaa"));
+ pre.setAttribute(HTML.ATTR_STYLE,"width:100px;");
+ rootSpan.appendChild(pre);
+ } else {
+ rootSpan.appendChild(visualDocument.createTextNode(value));
+ }
} else {
innerInput1.setAttribute(HTML.ATTR_VALUE, this.sourceValue);
}
-// dumper.dumpToStream(System.err, rootSpan);
+ dumper.dumpToStream(System.err, rootSpan);
return data;
}
@@ -162,4 +173,12 @@
}
+ /**
+ * @see
org.jboss.tools.jsf.vpe.richfaces.template.RichFacesAbstractInplaceTemplate#getCssStylesControlSuffix()
+ */
+ @Override
+ public String getCssStylesControlSuffix() {
+ return "-input";
+ }
+
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceSelectTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceSelectTemplate.java 2008-06-09
09:55:05 UTC (rev 8639)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInplaceSelectTemplate.java 2008-06-09
11:21:42 UTC (rev 8640)
@@ -288,4 +288,12 @@
this.controlsVerticalPositions.put("center", "100px");
}
+ /**
+ * @see
org.jboss.tools.jsf.vpe.richfaces.template.RichFacesAbstractInplaceTemplate#getCssStylesControlSuffix()
+ */
+ @Override
+ protected String getCssStylesControlSuffix() {
+ return this.getCssStylesSuffix();
+ }
+
}