Author: dmaliarevich
Date: 2008-04-08 11:03:01 -0400 (Tue, 08 Apr 2008)
New Revision: 7421
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/toolBar/toolBar.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarGroupTemplate.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/templates/vpe-templates-richfaces.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-1969, styles added, size attributes fixed,
itemSeparator height fixed.
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/toolBar/toolBar.css
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/toolBar/toolBar.css 2008-04-08
14:52:32 UTC (rev 7420)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/toolBar/toolBar.css 2008-04-08
15:03:01 UTC (rev 7421)
@@ -1,5 +1,17 @@
+.dr-toolbar-ext {
+ border:1px solid;
+ border-color:#C4C0B9;
+ padding:0px;
+ background-color:#D4CFC7;
+ background-position:top left;
+ background-repeat:repeat-x;
+}
-.dr-toolbar-ext{
-border:1px
solid;border-color:#C4C0B9;padding:0px;background-color:#D4CFC7;background-position:top
left;background-repeat:repeat-x;}
.dr-toolbar-int{
-font-size:11px;color:#000000;font-weight:bold;font-family:Arial, Verdana,
sans-serif;padding:2px 10px 2px 10px;white-space:nowrap;}
\ No newline at end of file
+ font-size:11px;
+ color:#000000;
+ font-weight:bold;
+ font-family:Arial, Verdana, sans-serif;
+ padding:2px 10px 2px 10px;
+ white-space:nowrap;
+}
\ No newline at end of file
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarGroupTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarGroupTemplate.java 2008-04-08
14:52:32 UTC (rev 7420)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarGroupTemplate.java 2008-04-08
15:03:01 UTC (rev 7421)
@@ -28,14 +28,22 @@
import org.w3c.dom.NodeList;
public class RichFacesToolBarGroupTemplate extends VpeAbstractTemplate {
- public static final String TAG_NAME = "toolBarGroup";
- public static final String ATTR_ITEMSEPARATOR_NAME = "itemSeparator";
+ public static final String TAG_NAME = "toolBarGroup"; //$NON-NLS-1$
+ public static final String ATTR_ITEMSEPARATOR_NAME = "itemSeparator";
//$NON-NLS-1$
+ public static final String ATTR_LOCATION_NAME = "location"; //$NON-NLS-1$
+ public static final String ATTR_LOCATION_RIGHT_VALUE = "right"; //$NON-NLS-1$
+
+ private static final String TOOLBAR_PARENT_WARNING = "Parent should be
toolBar"; //$NON-NLS-1$
- public static final String ATTR_LOCATION_NAME = "location";
+ private static final String CSS_DR_TOOLBAR_INT = "dr-toolbar-int";
//$NON-NLS-1$
+ private static final String CSS_RICH_TOOLBAR_ITEM = "rich-toolbar-item";
//$NON-NLS-1$
- public static final String ATTR_LOCATION_RIGHT_VALUE = "right";
+ private static final String SPACE = " "; //$NON-NLS-1$
+ private static final String EMPTY = ""; //$NON-NLS-1$
+ private static final String GROUP_TABLE_STYLE = "border: 0px none; margin: 0px 0px
0px 0px; padding: 0px 0px 0px 0px; width: 100%; height: 100%"; //$NON-NLS-1$
+
private class SourceToolBarGroupItem {
private Node toolBarGroupItem;
private String itemSeparator;
@@ -138,8 +146,8 @@
Element sourceElement = (Element)sourceNode;
String itemSeparator = sourceElement.getAttribute(ATTR_ITEMSEPARATOR_NAME);
- if (!sourceNode.getParentNode().getNodeName().endsWith(":" +
RichFacesToolBarTemplate.TAG_NAME)) {
- visualNode = RichFacesToolBarTemplate.createExceptionNode(visualDocument, "Parent
should be toolBar");
+ if (!sourceNode.getParentNode().getNodeName().endsWith(":" +
RichFacesToolBarTemplate.TAG_NAME)) { //$NON-NLS-1$
+ visualNode = RichFacesToolBarTemplate.createExceptionNode(visualDocument,
TOOLBAR_PARENT_WARNING);
creationData = new VpeCreationData(visualNode);
} else {
itemSeparator =
RichFacesToolBarTemplate.checkAndUpdateItemSeparatorName(itemSeparator);
@@ -149,7 +157,7 @@
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;");
+ visualNode.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, GROUP_TABLE_STYLE);
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);
@@ -162,13 +170,30 @@
nsIDOMElement cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
if (toolBarGroupItem.isItem()) {
- ComponentUtil.correctAttribute(sourceElement, cell,
- RichFacesToolBarTemplate.CONTENTCLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-int rich-toolbar-item",
"dr-toolbar-int rich-toolbar-item");
- ComponentUtil.correctAttribute(sourceElement, cell,
- RichFacesToolBarTemplate.CONTENTSTYLE_ATTR_NAME,
- HtmlComponentUtil.HTML_STYLE_ATTR, null, null);
-
+
+ Node parentNode = sourceElement.getParentNode();
+
+ String styleClass =
sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLECLASS_ATTR);
+ String style = sourceElement.getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR);
+ if (null == styleClass) {
+ styleClass = EMPTY;
+ }
+ if (null == style) {
+ style = EMPTY;
+ }
+ if ((null != parentNode) && (parentNode instanceof Element)) {
+ String contentClass =
((Element)parentNode).getAttribute(RichFacesToolBarTemplate.CONTENTCLASS_ATTR_NAME);
+ String contentStyle =
((Element)parentNode).getAttribute(RichFacesToolBarTemplate.CONTENTSTYLE_ATTR_NAME);
+ if (null != contentClass) {
+ styleClass += SPACE + contentClass;
+ }
+ if (null != contentStyle) {
+ style += SPACE + contentStyle;
+ }
+ }
+ styleClass += SPACE + CSS_DR_TOOLBAR_INT + SPACE + CSS_RICH_TOOLBAR_ITEM;
+ cell.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, styleClass);
+ cell.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, style);
VpeChildrenInfo childrenInfo = new VpeChildrenInfo(cell);
creationData.addChildrenInfo(childrenInfo);
childrenInfo.addSourceChild(toolBarGroupItem.getToolBarGroupItem());
@@ -181,6 +206,7 @@
.getSeparatorImageUrlString(toolBarGroupItem.getItemSeparator());
nsIDOMElement separatorImage =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
ComponentUtil.setImg(separatorImage, separatorImageUrl);
+ visualNode.appendChild(separatorImage);
cell.appendChild(separatorImage);
}
@@ -202,7 +228,7 @@
return null;
}
- String parentNodeName = prefix + ":" + RichFacesToolBarTemplate.TAG_NAME;
+ String parentNodeName = prefix + ":" + RichFacesToolBarTemplate.TAG_NAME;
//$NON-NLS-1$
Node parent = sourceNode.getParentNode();
while (parent != null) {
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-04-08
14:52:32 UTC (rev 7420)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesToolBarTemplate.java 2008-04-08
15:03:01 UTC (rev 7421)
@@ -28,29 +28,36 @@
import org.w3c.dom.NodeList;
public class RichFacesToolBarTemplate extends VpeAbstractTemplate {
- public static final String TAG_NAME = "toolBar";
+ public static final String TAG_NAME = "toolBar"; //$NON-NLS-1$
- public static final String ITEM_SEPARATOR_NONE = "none";
- public static final String ITEM_SEPARATOR_LINE = "line";
- public static final String ITEM_SEPARATOR_GRID = "grid";
- public static final String ITEM_SEPARATOR_DISC = "disc";
- public static final String ITEM_SEPARATOR_SQUARE = "square";
+ public static final String ITEM_SEPARATOR_NONE = "none"; //$NON-NLS-1$
+ public static final String ITEM_SEPARATOR_LINE = "line"; //$NON-NLS-1$
+ public static final String ITEM_SEPARATOR_GRID = "grid"; //$NON-NLS-1$
+ public static final String ITEM_SEPARATOR_DISC = "disc"; //$NON-NLS-1$
+ public static final String ITEM_SEPARATOR_SQUARE = "square"; //$NON-NLS-1$
- public static final String ITEM_SEPARATOR_LINE_URL =
"toolBar/separatorLine.gif";
- public static final String ITEM_SEPARATOR_GRID_URL =
"toolBar/separatorGrid.gif";
- public static final String ITEM_SEPARATOR_DISC_URL =
"toolBar/separatorDisc.gif";
- public static final String ITEM_SEPARATOR_SQUARE_URL =
"toolBar/separatorSquare.gif";
+ public static final String ITEM_SEPARATOR_LINE_URL =
"toolBar/separatorLine.gif"; //$NON-NLS-1$
+ public static final String ITEM_SEPARATOR_GRID_URL =
"toolBar/separatorGrid.gif"; //$NON-NLS-1$
+ public static final String ITEM_SEPARATOR_DISC_URL =
"toolBar/separatorDisc.gif"; //$NON-NLS-1$
+ public static final String ITEM_SEPARATOR_SQUARE_URL =
"toolBar/separatorSquare.gif"; //$NON-NLS-1$
- public static final String EXCEPTION_ATTR_STYLE_VALUE = "color: red;
font-weight:bold;";
+ public static final String EXCEPTION_ATTR_STYLE_VALUE = "color: red;
font-weight:bold;"; //$NON-NLS-1$
- static final String CONTENTCLASS_ATTR_NAME = "contentClass";
- static final String CONTENTSTYLE_ATTR_NAME = "contentStyle";
- static final String STYLECLASS_ATTR_NAME = "styleClass";
- static final String STYLE_ATTR_NAME = "style";
- static final String ITEMSEPARATOR_ATTR_NAME = "itemSeparator";
- static final String SEPARATORCLASS_ATTR_NAME = "separatorClass";
- static final String WIDTH_ATTR_NAME = "width";
- static final String HEIGHT_ATTR_NAME = "height";
+ 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 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$
+ static final String HEIGHT_ATTR_NAME = "height"; //$NON-NLS-1$
+
+ private static final String CSS_DR_TOOLBAR_INT = "dr-toolbar-int";
//$NON-NLS-1$
+ private static final String CSS_DR_TOOLBAR_EXT = "dr-toolbar-ext";
//$NON-NLS-1$
+ private static final String CSS_RICH_TOOLBAR = "rich-toolbar"; //$NON-NLS-1$
+ private static final String CSS_RICH_TOOLBAR_ITEM = "rich-toolbar-item";
//$NON-NLS-1$
+
+ private static final String SPACE = " "; //$NON-NLS-1$
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
VpeCreationData creationData = null;
@@ -63,21 +70,22 @@
SourceToolBarItems sourceToolBarItems = new SourceToolBarItems(sourceNode,
itemSeparator);
String itemSeparatorImageUrl =
getSeparatorImageUrlString(sourceToolBarItems.getItemSeparator());
- ComponentUtil.setCSSLink(pageContext, "toolBar/toolBar.css",
"richFacesToolBar");
+ 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%");
+ HtmlComponentUtil.HTML_WIDTH_ATTR, null, "100%"); //$NON-NLS-1$
ComponentUtil.correctAttribute(sourceElement, visualNode,
HEIGHT_ATTR_NAME,
HtmlComponentUtil.HTML_HEIGHT_ATTR, null, null);
ComponentUtil.correctAttribute(sourceElement, visualNode,
- STYLECLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-ext rich-toolbar",
"dr-toolbar-ext rich-toolbar");
+ STYLECLASS_ATTR_NAME, HtmlComponentUtil.HTML_CLASS_ATTR,
+ CSS_DR_TOOLBAR_EXT + SPACE + CSS_RICH_TOOLBAR,
+ CSS_DR_TOOLBAR_EXT + SPACE + CSS_RICH_TOOLBAR);
- String style = ComponentUtil.getHeaderBackgoundImgStyle() + ";";
+ String style = ComponentUtil.getHeaderBackgoundImgStyle() + ";";
//$NON-NLS-1$
ComponentUtil.correctAttribute(sourceElement, visualNode,
STYLE_ATTR_NAME,
HtmlComponentUtil.HTML_STYLE_ATTR, style, style);
@@ -99,13 +107,15 @@
cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
if (toolBarItem.isItem()) {
ComponentUtil.correctAttribute(sourceElement, cell,
- CONTENTCLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-int rich-toolbar-item",
"dr-toolbar-int rich-toolbar-item");
+ 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);
ComponentUtil.correctAttribute(sourceElement, cell,
CONTENTSTYLE_ATTR_NAME,
HtmlComponentUtil.HTML_STYLE_ATTR,
- toolBarItem.isToolBarGroupItem() ? "padding: 0px 0px 0px 0px;" : null,
- toolBarItem.isToolBarGroupItem() ? "padding: 0px 0px 0px 0px;" : null);
+ toolBarItem.isToolBarGroupItem() ? "padding: 0px 0px 0px 0px;" : null,
//$NON-NLS-1$
+ toolBarItem.isToolBarGroupItem() ? "padding: 0px 0px 0px 0px;" : null);
//$NON-NLS-1$
VpeChildrenInfo childrenInfo = new VpeChildrenInfo(cell);
creationData.addChildrenInfo(childrenInfo);
@@ -113,11 +123,13 @@
} else {
if (itemSeparatorImageUrl != null) {
cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
- cell.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR,
HtmlComponentUtil.HTML_ALIGN_CENTER_VALUE);
+ cell.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR,
+ HtmlComponentUtil.HTML_ALIGN_CENTER_VALUE);
ComponentUtil.correctAttribute(sourceElement, cell,
SEPARATORCLASS_ATTR_NAME,
HtmlComponentUtil.HTML_CLASS_ATTR, null, null);
- nsIDOMElement separatorImage =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ nsIDOMElement separatorImage = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_IMG);
ComponentUtil.setImg(separatorImage, itemSeparatorImageUrl);
cell.appendChild(separatorImage);
}
@@ -128,7 +140,7 @@
// Empty column
cell = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
- cell.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, "100%");
+ cell.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, "100%"); //$NON-NLS-1$
row.appendChild(cell);
iterator = sourceToolBarItems.getRightItemsIterator();
@@ -138,12 +150,12 @@
if (toolBarItem.isItem()) {
ComponentUtil.correctAttribute(sourceElement, cell,
CONTENTCLASS_ATTR_NAME,
- HtmlComponentUtil.HTML_CLASS_ATTR, "dr-toolbar-int rich-toolbar-item",
"dr-toolbar-int rich-toolbar-item");
+ HtmlComponentUtil.HTML_CLASS_ATTR, 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,
- toolBarItem.isToolBarGroupItem() ? "padding: 0px;" : null,
- toolBarItem.isToolBarGroupItem() ? "padding: 0px;" : null);
+ toolBarItem.isToolBarGroupItem() ? "padding: 0px;" : null,
//$NON-NLS-1$
+ toolBarItem.isToolBarGroupItem() ? "padding: 0px;" : null);
//$NON-NLS-1$
VpeChildrenInfo childrenInfo = new VpeChildrenInfo(cell);
creationData.addChildrenInfo(childrenInfo);
@@ -374,7 +386,7 @@
if (toolBarItem.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) toolBarItem;
- this.isToolBarGroupItem = element.getNodeName().endsWith(":" +
RichFacesToolBarGroupTemplate.TAG_NAME);
+ this.isToolBarGroupItem = element.getNodeName().endsWith(":" +
RichFacesToolBarGroupTemplate.TAG_NAME); //$NON-NLS-1$
if (isToolBarGroupItem()) {
isToolBarItemLocationRight = RichFacesToolBarGroupTemplate
.ATTR_LOCATION_RIGHT_VALUE
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-04-08
14:52:32 UTC (rev 7420)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-04-08
15:03:01 UTC (rev 7421)
@@ -204,8 +204,8 @@
<vpe:template
class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesToolBarTemplate"
children="yes" modify="no">
<vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
+ <vpe:width width-attr="width" />
+ <vpe:height height-attr="height" />
</vpe:resize>
<vpe:dnd>
<vpe:drag start-enable="yes"/>