Author: dmaliarevich
Date: 2008-12-09 12:47:05 -0500 (Tue, 09 Dec 2008)
New Revision: 12493
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTabPanelTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3224, for these templates resizing was fixed,
others worked fine without any fixing. JUnits were updated.
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java 2008-12-09
17:21:36 UTC (rev 12492)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java 2008-12-09
17:47:05 UTC (rev 12493)
@@ -11,7 +11,7 @@
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.jsf.vpe.richfaces.template.util.RichFaces;
import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
@@ -19,6 +19,7 @@
import org.jboss.tools.vpe.editor.template.VpeTemplate;
import org.jboss.tools.vpe.editor.template.VpeToggableTemplate;
import org.jboss.tools.vpe.editor.util.Constants;
+import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
@@ -42,28 +43,29 @@
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
Element sourceElement = (Element) sourceNode;
- nsIDOMElement table =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+ nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
+ div.appendChild(table);
+ VpeCreationData creationData = new VpeCreationData(div);
- VpeCreationData creationData = new VpeCreationData(table);
-
ComponentUtil.setCSSLink(pageContext, PANEL_BAR_PANEL_BAR_CSS,
"richFacesPanelBar"); //$NON-NLS-1$
- String styleClass =
sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR);
- table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ String styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
+ table.setAttribute(HTML.ATTR_CLASS,
DR_PNLBAR_RICH_PANELBAR_DR_PNLBAR_B + ((styleClass == null) ? Constants.EMPTY
: styleClass));
// Set style attribute
StringBuffer styleValue = new StringBuffer("padding: 0px; ");
//$NON-NLS-1$
styleValue.append(height(sourceElement)).append(Constants.WHITE_SPACE)
.append(width(sourceElement)).append(Constants.WHITE_SPACE)
- .append(ComponentUtil.getAttribute(sourceElement,
HtmlComponentUtil.HTML_STYLE_ATTR));
+ .append(ComponentUtil.getAttribute(sourceElement, HTML.ATTR_STYLE));
// Encode Body
List<Node> children = ComponentUtil.getChildren(sourceElement);
int activeId = getActiveId(sourceElement, children);
int i = 0;
- String style = ComponentUtil.getAttribute(sourceElement,
HtmlComponentUtil.HTML_STYLE_ATTR);
+ String style = ComponentUtil.getAttribute(sourceElement, HTML.ATTR_STYLE);
String contentClass = ComponentUtil.getAttribute(sourceElement,
RichFacesPanelItemTemplate.CONTENT_CLASS);
@@ -84,7 +86,7 @@
if (child.getNodeName().endsWith(PANEL_BAR_ITEM)) {
RichFacesPanelItemTemplate.encode(creationData, pageContext, (Element)
child,
visualDocument, table, active,
- ComponentUtil.getAttribute(sourceElement,
HtmlComponentUtil.HTML_STYLECLASS_ATTR),
+ ComponentUtil.getAttribute(sourceElement,
RichFaces.ATTR_STYLE_CLASS),
style, headerClass, headerStyle, headerActiveClass,
headerActiveStyle, contentClass,
contentStyle, String.valueOf(i));
@@ -92,8 +94,7 @@
}
}
- table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, styleValue.toString());
-
+ table.setAttribute(HTML.ATTR_STYLE, styleValue.toString());
return creationData;
}
@@ -103,7 +104,7 @@
* @return
*/
private String height(Element sourceElement) {
- String height = sourceElement.getAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR);
+ String height = sourceElement.getAttribute(HTML.ATTR_HEIGHT);
if ((height == null) || (height.length() == 0)) {
height = PERCENT_100;
@@ -129,7 +130,7 @@
* @return
*/
public String width(Element sourceElement) {
- String width = sourceElement.getAttribute(HtmlComponentUtil.HTML_ATR_WIDTH);
+ String width = sourceElement.getAttribute(HTML.ATTR_WIDTH);
if ((width == null) || (width.length() == 0)) {
width = PERCENT_100;
@@ -222,12 +223,13 @@
@Override
public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element
sourceElement,
nsIDOMDocument visualDocument, nsIDOMElement visualNode, Object data, String
name, String value) {
- if (name.equalsIgnoreCase(HtmlComponentUtil.HTML_WIDTH_ATTR) ||
- name.equalsIgnoreCase(HtmlComponentUtil.HTML_HEIGHT_ATTR) ||
- name.equalsIgnoreCase(HtmlComponentUtil.HTML_STYLE_ATTR)) {
- return true;
- }
-
- return false;
+// if (name.equalsIgnoreCase(HTML.WIDTH_ATTR) ||
+// name.equalsIgnoreCase(HTML.ATTR_HEIGHT) ||
+// name.equalsIgnoreCase(HTML.ATTR_STYLE)) {
+// return true;
+// }
+//
+// return false;
+ return true;
}
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java 2008-12-09
17:21:36 UTC (rev 12492)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java 2008-12-09
17:47:05 UTC (rev 12493)
@@ -11,11 +11,11 @@
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.jsf.vpe.richfaces.RichFacesTemplatesActivator;
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.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -32,23 +32,23 @@
public class RichFacesRecursiveTreeNodesAdaptorTemplate extends
RichFacesTreeNodeTemplate {
- private static final String TREE_NAME = "tree";
+ private static final String TREE_NAME = "tree"; //$NON-NLS-1$
- private final static String TREE_NODE_NAME = "treeNode";
+ private final static String TREE_NODE_NAME = "treeNode"; //$NON-NLS-1$
- public final static String TREE_NODES_ADAPTOR_NAME = "treeNodesAdaptor";
+ public final static String TREE_NODES_ADAPTOR_NAME = "treeNodesAdaptor";
//$NON-NLS-1$
- public final static String RECURSIVE_TREE_NODES_ADAPTOR_NAME =
"recursiveTreeNodesAdaptor";
+ public final static String RECURSIVE_TREE_NODES_ADAPTOR_NAME =
"recursiveTreeNodesAdaptor"; //$NON-NLS-1$
- private static final String STYLE_PATH = "/tree/tree.css";
+ private static final String STYLE_PATH = "/tree/tree.css"; //$NON-NLS-1$
- public static final String ICON_DIV_LINE = "/tree/divLine.gif";
+ public static final String ICON_DIV_LINE = "/tree/divLine.gif";
//$NON-NLS-1$
- private static final String ADAPTER_LINES_STYLE = "background-position: left
center; background-repeat: repeat-y;";
+ private static final String ADAPTER_LINES_STYLE = "background-position: left
center; background-repeat: repeat-y;"; //$NON-NLS-1$
- public static final String ID_ATTR_NAME = "ID";
+ public static final String ID_ATTR_NAME = "ID"; //$NON-NLS-1$
- public static final String NODES_NAME = "nodes";
+ public static final String NODES_NAME = "nodes"; //$NON-NLS-1$
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
@@ -56,21 +56,21 @@
return super.create(pageContext, sourceNode, visualDocument);
} else {
ComponentUtil.setCSSLink(pageContext, STYLE_PATH,
- "treeNodesAdaptor");
+ "treeNodesAdaptor"); //$NON-NLS-1$
nsIDOMElement visualElement = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ .createElement(HTML.TAG_DIV);
visualElement.setAttribute(ID_ATTR_NAME, TREE_NODES_ADAPTOR_NAME);
if (isHasParentAdapter(sourceNode)) {
- visualElement.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- "dr-tree-h-ic-div");
+ visualElement.setAttribute(HTML.ATTR_CLASS,
+ "dr-tree-h-ic-div"); //$NON-NLS-1$
if (getShowLinesAttr(sourceNode)
&& (isAdapterBetweenNodes(sourceNode) ||
isHasNextParentAdaptorElement(sourceNode))) {
String path = RichFacesTemplatesActivator
.getPluginResourcePath()
+ ICON_DIV_LINE;
visualElement.setAttribute(
- HtmlComponentUtil.HTML_STYLE_ATTR,
- "background-image: url(file://" + path + "); "
+ HTML.ATTR_STYLE,
+ "background-image: url(file://" + path + "); " //$NON-NLS-1$
//$NON-NLS-2$
+ ADAPTER_LINES_STYLE);
}
}
@@ -96,10 +96,10 @@
NodeList nodeList = sourceNode.getChildNodes();
Element element = null;
int lenght = nodeList.getLength();
- String treeNodeName = sourceNode.getPrefix() + ":" + TREE_NODE_NAME;
- String treeNodesAdaptorName = sourceNode.getPrefix() + ":"
+ String treeNodeName = sourceNode.getPrefix() + ":" + TREE_NODE_NAME;
//$NON-NLS-1$
+ String treeNodesAdaptorName = sourceNode.getPrefix() + ":" //$NON-NLS-1$
+ TREE_NODES_ADAPTOR_NAME;
- String recursiveTreeNodesAdaptorName = sourceNode.getPrefix() + ":"
+ String recursiveTreeNodesAdaptorName = sourceNode.getPrefix() + ":"
//$NON-NLS-1$
+ RECURSIVE_TREE_NODES_ADAPTOR_NAME;
VpeChildrenInfo vpeChildrenInfo = null;
for (int i = 0; i < lenght; i++) {
@@ -127,9 +127,9 @@
* @return
*/
public boolean isHasParentAdapter(Node sourceNode) {
- String treeNodesAdaptorName = sourceNode.getPrefix() + ":"
+ String treeNodesAdaptorName = sourceNode.getPrefix() + ":" //$NON-NLS-1$
+ TREE_NODES_ADAPTOR_NAME;
- String recursiveTreeNodesAdaptorName = sourceNode.getPrefix() + ":"
+ String recursiveTreeNodesAdaptorName = sourceNode.getPrefix() + ":"
//$NON-NLS-1$
+ RECURSIVE_TREE_NODES_ADAPTOR_NAME;
Node node = sourceNode.getParentNode();
if (node.getNodeName().equals(treeNodesAdaptorName)
@@ -146,7 +146,7 @@
* @return
*/
private boolean getShowLinesAttr(Node sourceNode) {
- String treeName = sourceNode.getPrefix() + ":" + TREE_NAME;
+ String treeName = sourceNode.getPrefix() + ":" + TREE_NAME; //$NON-NLS-1$
do {
sourceNode = sourceNode.getParentNode();
if (!(sourceNode instanceof Element)) {
@@ -158,7 +158,7 @@
.getAttribute(RichFacesTreeTemplate.SHOW_LINES_ATTR_NAME);
boolean showLinesValue = true;
- if (showLinesParam != null &&
showLinesParam.equalsIgnoreCase("false")) {
+ if (showLinesParam != null &&
showLinesParam.equalsIgnoreCase("false")) { //$NON-NLS-1$
showLinesValue = false;
}
return showLinesValue;
@@ -180,11 +180,11 @@
return true;
}
NodeList childs = parentTree.getChildNodes();
- String treeNodeName = parentTree.getPrefix() + ":"
+ String treeNodeName = parentTree.getPrefix() + ":" //$NON-NLS-1$
+ RichFacesTreeTemplate.TREE_NODE_NAME;
- String treeNodesAdaptorName = parentTree.getPrefix() + ":"
+ String treeNodesAdaptorName = parentTree.getPrefix() + ":" //$NON-NLS-1$
+ RichFacesTreeTemplate.TREE_NODES_ADAPTOR;
- String treeRecursiveNodesAdaptorName = parentTree.getPrefix() + ":"
+ String treeRecursiveNodesAdaptorName = parentTree.getPrefix() + ":"
//$NON-NLS-1$
+ RichFacesTreeTemplate.TREE_RECURSIVE_NODES_ADAPTOR;
Node lastElement = null;
Node el = null;
@@ -223,7 +223,7 @@
Node beforeAdapterNode = null;
Node afterAdapterNode = null;
Node adapterNode = null;
- String treeNodeName = sourceNode.getPrefix() + ":"
+ String treeNodeName = sourceNode.getPrefix() + ":" //$NON-NLS-1$
+ RichFacesTreeTemplate.TREE_NODE_NAME;
for (int i = 0; i < childs.getLength(); i++) {
Node el = childs.item(i);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTabPanelTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTabPanelTemplate.java 2008-12-09
17:21:36 UTC (rev 12492)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTabPanelTemplate.java 2008-12-09
17:47:05 UTC (rev 12493)
@@ -16,13 +16,14 @@
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.template.util.RichFaces;
import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
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.jboss.tools.vpe.editor.template.VpeToggableTemplate;
+import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -79,45 +80,46 @@
Element sourceElement = (Element)sourceNode;
- nsIDOMElement table = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
-
- VpeCreationData creationData = new VpeCreationData(table);
+ nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+ div.appendChild(table);
+ VpeCreationData creationData = new VpeCreationData(div);
ComponentUtil.setCSSLink(pageContext, CSS_FILE_PATH, RICH_FACES_TAB_PANEL);
setDirAttr(table, sourceElement);
- table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- ComponentUtil.getAttribute(sourceElement, HtmlComponentUtil.HTML_STYLECLASS_ATTR)
+ table.setAttribute(HTML.ATTR_CLASS,
+ ComponentUtil.getAttribute(sourceElement, RichFaces.ATTR_STYLE_CLASS)
+ SPACE + CSS_PANEL);
- table.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, ZERO);
- table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, ZERO);
- table.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, ZERO);
- table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, getStyle(sourceElement));
+ table.setAttribute(HTML.ATTR_BORDER, ZERO);
+ table.setAttribute(HTML.ATTR_CELLPADDING, ZERO);
+ table.setAttribute(HTML.ATTR_CELLSPACING, ZERO);
+ table.setAttribute(HTML.ATTR_STYLE, getStyle(sourceElement));
- nsIDOMElement tbody = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TBODY);
+ nsIDOMElement tbody = visualDocument.createElement(HTML.TAG_TBODY);
table.appendChild(tbody);
- nsIDOMElement tr = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
tbody.appendChild(tr);
- nsIDOMElement td = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ nsIDOMElement td = visualDocument.createElement(HTML.TAG_TD);
tr.appendChild(td);
- td.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR, getHeaderAlignment(sourceElement));
- td.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, ComponentUtil
+ td.setAttribute(HTML.ATTR_ALIGN, getHeaderAlignment(sourceElement));
+ td.setAttribute(HTML.ATTR_CLASS, ComponentUtil
.getAttribute(sourceElement, HEADER_CLASS));
- nsIDOMElement inerTable =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ nsIDOMElement inerTable = visualDocument.createElement(HTML.TAG_TABLE);
td.appendChild(inerTable);
- inerTable.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, ZERO);
- inerTable.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, ZERO);
- inerTable.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, ZERO);
+ inerTable.setAttribute(HTML.ATTR_BORDER, ZERO);
+ inerTable.setAttribute(HTML.ATTR_CELLPADDING, ZERO);
+ inerTable.setAttribute(HTML.ATTR_CELLSPACING, ZERO);
// Encode header
- nsIDOMElement inerTr = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ nsIDOMElement inerTr = visualDocument.createElement(HTML.TAG_TR);
inerTable.appendChild(inerTr);
- nsIDOMElement inerTd = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ nsIDOMElement inerTd = visualDocument.createElement(HTML.TAG_TD);
inerTr.appendChild(inerTd);
- nsIDOMElement img = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ nsIDOMElement img = visualDocument.createElement(HTML.TAG_IMG);
inerTd.appendChild(img);
ComponentUtil.setImg(img, SPACER_FILE_PATH);
- img.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, TWO);
- img.setAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR, ONE);
- img.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, ZERO);
+ img.setAttribute(HTML.ATTR_WIDTH, TWO);
+ img.setAttribute(HTML.ATTR_HEIGHT, ONE);
+ img.setAttribute(HTML.ATTR_BORDER, ZERO);
String headerSpacing = sourceElement.getAttribute(HEADER_SPACING);
List<Node> children = ComponentUtil.getChildren(sourceElement);
@@ -163,17 +165,17 @@
}
}
- inerTd = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ inerTd = visualDocument.createElement(HTML.TAG_TD);
inerTr.appendChild(inerTd);
- img = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ img = visualDocument.createElement(HTML.TAG_IMG);
inerTd.appendChild(img);
ComponentUtil.setImg(img, SPACER_FILE_PATH);
- img.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, ONE);
- img.setAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR, ONE);
- img.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, ZERO);
+ img.setAttribute(HTML.ATTR_WIDTH, ONE);
+ img.setAttribute(HTML.ATTR_HEIGHT, ONE);
+ img.setAttribute(HTML.ATTR_BORDER, ZERO);
// Encode first child tab
- inerTr = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ inerTr = visualDocument.createElement(HTML.TAG_TR);
tbody.appendChild(inerTr);
children = ComponentUtil.getChildren(sourceElement);
i = 0;
@@ -208,17 +210,17 @@
* @param headerSpacing the header spacing
*/
private void addSpacer(nsIDOMDocument visualDocument, nsIDOMElement parentTr, String
headerSpacing) {
- nsIDOMElement spaceTd = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ nsIDOMElement spaceTd = visualDocument.createElement(HTML.TAG_TD);
parentTr.appendChild(spaceTd);
- nsIDOMElement spaceImg = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ nsIDOMElement spaceImg = visualDocument.createElement(HTML.TAG_IMG);
spaceTd.appendChild(spaceImg);
ComponentUtil.setImg(spaceImg, SPACER_FILE_PATH);
- spaceImg.setAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR, ONE);
- spaceImg.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, ZERO);
+ spaceImg.setAttribute(HTML.ATTR_HEIGHT, ONE);
+ spaceImg.setAttribute(HTML.ATTR_BORDER, ZERO);
if(headerSpacing==null) {
headerSpacing = ONE;
}
- spaceImg.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, "width: " +
headerSpacing + "px"); //$NON-NLS-1$ //$NON-NLS-2$
+ spaceImg.setAttribute(HTML.ATTR_STYLE, "width: " + headerSpacing +
"px"); //$NON-NLS-1$ //$NON-NLS-2$
}
private int getActiveId(Element sourceElement, List<Node> children) {
@@ -274,17 +276,17 @@
private String getStyle(Element sourceElement) {
- String widthAttrValue = sourceElement.getAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR);
- String heightAttrValue =
sourceElement.getAttribute(HtmlComponentUtil.HTML_HEIGHT_ATTR);
- String styleAttrValue = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ String widthAttrValue = sourceElement.getAttribute(HTML.ATTR_WIDTH);
+ String heightAttrValue = sourceElement.getAttribute(HTML.ATTR_HEIGHT);
+ String styleAttrValue = sourceElement.getAttribute(HTML.ATTR_STYLE);
String style = styleAttrValue != null ? styleAttrValue : EMPTY;
- if (!ComponentUtil.parameterPresent(styleAttrValue, HtmlComponentUtil.HTML_WIDTH_ATTR))
{
+ if (!ComponentUtil.parameterPresent(styleAttrValue, HTML.ATTR_WIDTH)) {
String width = (widthAttrValue != null && widthAttrValue.length() > 0) ?
widthAttrValue : "100%"; //$NON-NLS-1$
style = ComponentUtil.addParameter(style, "width:" + width); //$NON-NLS-1$
}
- if (!ComponentUtil.parameterPresent(styleAttrValue,
HtmlComponentUtil.HTML_HEIGHT_ATTR)) {
+ if (!ComponentUtil.parameterPresent(styleAttrValue, HTML.ATTR_HEIGHT)) {
String height = (heightAttrValue != null && heightAttrValue.length() > 0) ?
heightAttrValue : EMPTY;
if (height.length() > 0) {
style =ComponentUtil.addParameter(style, "height:" + height);
//$NON-NLS-1$
@@ -313,7 +315,7 @@
private String getHeaderAlignment(Element sourceElement) {
String headerAlignment = sourceElement.getAttribute(HEADER_ALINGMENT);
if(headerAlignment==null) {
- headerAlignment = HtmlComponentUtil.HTML_ALIGN_LEFT_VALUE;
+ headerAlignment = HTML.VALUE_ALIGN_LEFT;
}
return headerAlignment;
}
@@ -346,15 +348,15 @@
public void validate(VpePageContext pageContext, Node sourceNode, nsIDOMDocument
visualDocument, VpeCreationData data) {
List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
- ComponentUtil.findAllElementsByName(data.getNode(), elements,
HtmlComponentUtil.HTML_TAG_TABLE);
+ ComponentUtil.findAllElementsByName(data.getNode(), elements, HTML.TAG_TABLE);
for (nsIDOMNode node : elements) {
try {
nsIDOMElement element = (nsIDOMElement)
node.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
if (ComponentUtil.getAttribute(element,
RichFacesTabTemplate.TAB_HEADER_ATTR).equalsIgnoreCase(YES)) {
- element.removeAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ element.removeAttribute(HTML.ATTR_STYLE);
}
if (ComponentUtil.getAttribute(element,
RichFacesTabTemplate.TAB_BODY_ATTR).equalsIgnoreCase(YES)) {
- element.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
HtmlComponentUtil.CSS_DISPLAY+" :
"+RichFacesTabTemplate.DISABLED_ELEMENT_STYLE+";");
//$NON-NLS-1$//$NON-NLS-2$
+ element.setAttribute(HTML.ATTR_STYLE, HTML.ATTR_DISPLAY+" :
"+RichFacesTabTemplate.DISABLED_ELEMENT_STYLE+";");
//$NON-NLS-1$//$NON-NLS-2$
}
} catch (XPCOMException exeption) {
// Ignore
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java 2008-12-09
17:21:36 UTC (rev 12492)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java 2008-12-09
17:47:05 UTC (rev 12493)
@@ -15,11 +15,11 @@
import java.util.List;
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.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMText;
@@ -45,8 +45,8 @@
static final String CONTENTCLASS_ATTR_NAME = "contentClass"; //$NON-NLS-1$
static final String CONTENTSTYLE_ATTR_NAME = "contentStyle"; //$NON-NLS-1$
- static final String STYLECLASS_ATTR_NAME = "styleClass"; //$NON-NLS-1$
- static final String STYLE_ATTR_NAME = "style"; //$NON-NLS-1$
+ static final String STYLEATTR_CLASS_NAME = "styleClass"; //$NON-NLS-1$
+ static final String ATTR_STYLE_NAME = "style"; //$NON-NLS-1$
static final String ITEMSEPARATOR_ATTR_NAME = "itemSeparator"; //$NON-NLS-1$
static final String SEPARATORCLASS_ATTR_NAME = "separatorClass";
//$NON-NLS-1$
static final String WIDTH_ATTR_NAME = "width"; //$NON-NLS-1$
@@ -60,9 +60,10 @@
private static final String SPACE = " "; //$NON-NLS-1$
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
- VpeCreationData creationData = null;
- nsIDOMElement visualNode = null;
-
+ nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
+ nsIDOMElement visualNode = visualDocument.createElement(HTML.TAG_TABLE);
+ div.appendChild(visualNode);
+ VpeCreationData creationData = new VpeCreationData(div);
Element sourceElement = (Element) sourceNode;
String itemSeparator = sourceElement.getAttribute(ITEMSEPARATOR_ATTR_NAME);
@@ -71,49 +72,45 @@
String itemSeparatorImageUrl =
getSeparatorImageUrlString(sourceToolBarItems.getItemSeparator());
ComponentUtil.setCSSLink(pageContext, "toolBar/toolBar.css",
"richFacesToolBar"); //$NON-NLS-1$ //$NON-NLS-2$
-
- visualNode = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
ComponentUtil.correctAttribute(sourceElement, visualNode,
WIDTH_ATTR_NAME,
- HtmlComponentUtil.HTML_WIDTH_ATTR, null, "100%"); //$NON-NLS-1$
+ HTML.ATTR_WIDTH, null, "100%"); //$NON-NLS-1$
ComponentUtil.correctAttribute(sourceElement, visualNode,
HEIGHT_ATTR_NAME,
- HtmlComponentUtil.HTML_HEIGHT_ATTR, null, null);
+ HTML.ATTR_HEIGHT, null, null);
ComponentUtil.correctAttribute(sourceElement, visualNode,
- STYLECLASS_ATTR_NAME, HtmlComponentUtil.HTML_CLASS_ATTR,
+ STYLEATTR_CLASS_NAME, HTML.ATTR_CLASS,
CSS_DR_TOOLBAR_EXT + SPACE + CSS_RICH_TOOLBAR,
CSS_DR_TOOLBAR_EXT + SPACE + CSS_RICH_TOOLBAR);
String style = ComponentUtil.getHeaderBackgoundImgStyle() + ";";
//$NON-NLS-1$
ComponentUtil.correctAttribute(sourceElement, visualNode,
- STYLE_ATTR_NAME,
- HtmlComponentUtil.HTML_STYLE_ATTR, style, style);
+ ATTR_STYLE_NAME,
+ HTML.ATTR_STYLE, style, style);
- creationData = new VpeCreationData(visualNode);
-
nsIDOMElement body = null;
nsIDOMElement row = null;
nsIDOMElement cell = null;
- body = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TBODY);
- row = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
- row.setAttribute(HtmlComponentUtil.HTML_ATTR_VALIGN,
HtmlComponentUtil.HTML_ATTR_VALIGN_MIDDLE_VALUE);
+ body = visualDocument.createElement(HTML.TAG_TBODY);
+ row = visualDocument.createElement(HTML.TAG_TR);
+ row.setAttribute(HTML.ATTR_VALIGN, HTML.VALUE_ALIGN_MIDDLE);
SourceToolBarItem toolBarItem;
Iterator<SourceToolBarItem> iterator =
sourceToolBarItems.getLeftItemsIterator();
while (iterator.hasNext()) {
toolBarItem = iterator.next();
- cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ cell = visualDocument.createElement(HTML.TAG_TD);
if (toolBarItem.isItem()) {
ComponentUtil.correctAttribute(sourceElement, cell,
CONTENTCLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR,
+ HTML.ATTR_CLASS,
CSS_DR_TOOLBAR_INT + SPACE + CSS_RICH_TOOLBAR_ITEM,
CSS_DR_TOOLBAR_INT + SPACE + CSS_RICH_TOOLBAR_ITEM);
ComponentUtil.correctAttribute(sourceElement, cell,
CONTENTSTYLE_ATTR_NAME,
- HtmlComponentUtil.HTML_STYLE_ATTR,
+ HTML.ATTR_STYLE,
toolBarItem.isToolBarGroupItem() ? "padding: 0px 0px 0px 0px;" : null,
//$NON-NLS-1$
toolBarItem.isToolBarGroupItem() ? "padding: 0px 0px 0px 0px;" : null);
//$NON-NLS-1$
@@ -122,14 +119,14 @@
childrenInfo.addSourceChild(toolBarItem.getToolBarItem());
} else {
if (itemSeparatorImageUrl != null) {
- cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
- cell.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR,
- HtmlComponentUtil.HTML_ALIGN_CENTER_VALUE);
+ cell = visualDocument.createElement(HTML.TAG_TD);
+ cell.setAttribute(HTML.ATTR_ALIGN,
+ HTML.VALUE_ALIGN_CENTER);
ComponentUtil.correctAttribute(sourceElement, cell,
SEPARATORCLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, null, null);
+ HTML.ATTR_CLASS, null, null);
nsIDOMElement separatorImage = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ .createElement(HTML.TAG_IMG);
ComponentUtil.setImg(separatorImage, itemSeparatorImageUrl);
cell.appendChild(separatorImage);
}
@@ -139,21 +136,21 @@
}
// Empty column
- cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
- cell.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, "100%"); //$NON-NLS-1$
+ cell = visualDocument.createElement(HTML.TAG_TD);
+ cell.setAttribute(HTML.ATTR_WIDTH, "100%"); //$NON-NLS-1$
row.appendChild(cell);
iterator = sourceToolBarItems.getRightItemsIterator();
while (iterator.hasNext()) {
toolBarItem = iterator.next();
- cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
+ cell = visualDocument.createElement(HTML.TAG_TD);
if (toolBarItem.isItem()) {
ComponentUtil.correctAttribute(sourceElement, cell,
CONTENTCLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, CSS_DR_TOOLBAR_INT + SPACE +
CSS_RICH_TOOLBAR_ITEM, CSS_DR_TOOLBAR_INT + SPACE + CSS_RICH_TOOLBAR_ITEM);
+ HTML.ATTR_CLASS, CSS_DR_TOOLBAR_INT + SPACE + CSS_RICH_TOOLBAR_ITEM,
CSS_DR_TOOLBAR_INT + SPACE + CSS_RICH_TOOLBAR_ITEM);
ComponentUtil.correctAttribute(sourceElement, cell,
CONTENTSTYLE_ATTR_NAME,
- HtmlComponentUtil.HTML_STYLE_ATTR,
+ HTML.ATTR_STYLE,
toolBarItem.isToolBarGroupItem() ? "padding: 0px;" : null,
//$NON-NLS-1$
toolBarItem.isToolBarGroupItem() ? "padding: 0px;" : null);
//$NON-NLS-1$
@@ -162,12 +159,12 @@
childrenInfo.addSourceChild(toolBarItem.getToolBarItem());
} else {
if (itemSeparatorImageUrl != null) {
- cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
- cell.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR,
HtmlComponentUtil.HTML_ALIGN_CENTER_VALUE);
+ cell = visualDocument.createElement(HTML.TAG_TD);
+ cell.setAttribute(HTML.ATTR_ALIGN, HTML.VALUE_ALIGN_CENTER);
ComponentUtil.correctAttribute(sourceElement, cell,
SEPARATORCLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, null, null);
- nsIDOMElement separatorImage =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ HTML.ATTR_CLASS, null, null);
+ nsIDOMElement separatorImage = visualDocument.createElement(HTML.TAG_IMG);
ComponentUtil.setImg(separatorImage, itemSeparatorImageUrl);
cell.appendChild(separatorImage);
}
@@ -191,8 +188,8 @@
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);
+ visualNode = visualDocument.createElement(HTML.TAG_SPAN);
+ visualNode.setAttribute(HTML.ATTR_STYLE, EXCEPTION_ATTR_STYLE_VALUE);
nsIDOMText text = visualDocument.createTextNode(message);
visualNode.appendChild(text);
@@ -212,19 +209,19 @@
// Element visualTable = visualDocument.createElement("table");
//
// ComponentUtil.correctAttribute(sourceElement, visualTable,
-// WIDTH_ATTR_NAME,
-// HtmlComponentUtil.HTML_WIDTH_ATTR, null, "100%");
+// ATTR_WIDTH_NAME,
+// HTML.ATTR_WIDTH, null, "100%");
// ComponentUtil.correctAttribute(sourceElement, visualTable,
-// HEIGHT_ATTR_NAME,
-// HtmlComponentUtil.HTML_HEIGHT_ATTR, null, null);
+// ATTR_HEIGHT_NAME,
+// HTML.ATTR_HEIGHT, null, null);
// ComponentUtil.correctAttribute(sourceElement, visualTable,
-// STYLECLASS_ATTR_NAME,
-// HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-ext rich-toolbar",
"dr-toolbar-ext rich-toolbar");
+// STYLEATTR_CLASS_NAME,
+// HTML.ATTR_CLASS, "dr-toolbar-ext rich-toolbar", "dr-toolbar-ext
rich-toolbar");
//
// String style = ComponentUtil.getHeaderBackgoundImgStyle() + ";";
// ComponentUtil.correctAttribute(sourceElement, visualTable,
-// STYLE_ATTR_NAME,
-// HtmlComponentUtil.HTML_STYLE_ATTR, style, style);
+// ATTR_STYLE_NAME,
+// HTML.ATTR_STYLE, style, style);
//
//
// VpeCreationData creatorInfo = new VpeCreationData(visualTable);
@@ -246,11 +243,11 @@
// Node columnBody = column.getColumn();
// cell = visualDocument.createElement("td");
// ComponentUtil.correctAttribute(sourceElement, cell,
-// CONTENTCLASS_ATTR_NAME,
-// HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-int rich-toolbar-item",
"dr-toolbar-int rich-toolbar-item");
+// CONTENTATTR_CLASS_NAME,
+// HTML.ATTR_CLASS, "dr-toolbar-int rich-toolbar-item",
"dr-toolbar-int rich-toolbar-item");
// ComponentUtil.correctAttribute(sourceElement, cell,
-// CONTENTSTYLE_ATTR_NAME,
-// HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
+// CONTENTATTR_STYLE_NAME,
+// HTML.ATTR_STYLE, null, null);
//
// row.appendChild(cell);
//
@@ -268,8 +265,8 @@
// cell = visualDocument.createElement("td");
// cell.setAttribute("align", "center");
// ComponentUtil.correctAttribute(sourceElement, cell,
-// SEPARATORCLASS_ATTR_NAME,
-// HtmlComponentUtil.HTML_CLASS_ATTR, null, null);
+// SEPARATORATTR_CLASS_NAME,
+// HTML.ATTR_CLASS, null, null);
// Element separatorImage = visualDocument.createElement("img");
// ComponentUtil.setImg(separatorImage, separatorImageUrl);
// cell.appendChild(separatorImage);
@@ -293,11 +290,11 @@
// Node columnBody = column.getColumn();
// cell = visualDocument.createElement("td");
// ComponentUtil.correctAttribute(sourceElement, cell,
-// CONTENTCLASS_ATTR_NAME,
-// HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-int rich-toolbar-item",
"dr-toolbar-int rich-toolbar-item");
+// CONTENTATTR_CLASS_NAME,
+// HTML.ATTR_CLASS, "dr-toolbar-int rich-toolbar-item",
"dr-toolbar-int rich-toolbar-item");
// ComponentUtil.correctAttribute(sourceElement, cell,
-// CONTENTSTYLE_ATTR_NAME,
-// HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
+// CONTENTATTR_STYLE_NAME,
+// HTML.ATTR_STYLE, null, null);
// row.appendChild(cell);
//
// VpeChildrenInfo info = new VpeChildrenInfo(cell);
@@ -314,8 +311,8 @@
// cell = visualDocument.createElement("td");
// cell.setAttribute("align", "center");
// ComponentUtil.correctAttribute(sourceElement, cell,
-// SEPARATORCLASS_ATTR_NAME,
-// HtmlComponentUtil.HTML_CLASS_ATTR, null, null);
+// SEPARATORATTR_CLASS_NAME,
+// HTML.ATTR_CLASS, null, null);
// Element separatorImage = visualDocument.createElement("img");
// ComponentUtil.setImg(separatorImage, separatorImageUrl);
// cell.appendChild(separatorImage);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java 2008-12-09
17:21:36 UTC (rev 12492)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java 2008-12-09
17:47:05 UTC (rev 12493)
@@ -112,10 +112,12 @@
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
+ nsIDOMElement div = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_DIV);
nsIDOMElement visualElement = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
addBasicTreeNodeAttributes(visualElement);
-
+ div.appendChild(visualElement);
nsIDOMElement tbody = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_TBODY);
@@ -125,7 +127,7 @@
visualElement.appendChild(tbody);
tbody.appendChild(tableRow);
- VpeCreationData vpeCreationData = new VpeCreationData(visualElement);
+ VpeCreationData vpeCreationData = new VpeCreationData(div);
createBasicTree(pageContext, visualDocument, tableRow, sourceNode,
vpeCreationData);
return vpeCreationData;