Author: dmaliarevich
Date: 2008-03-14 09:56:03 -0400 (Fri, 14 Mar 2008)
New Revision: 6932
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableElements.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeFacetCreator.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1744, caption creation was gathered in
VpeDataTableCreator, duplicate caption creation was removed from VpeFacetCreator.
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java 2008-03-14
13:06:30 UTC (rev 6931)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java 2008-03-14
13:56:03 UTC (rev 6932)
@@ -45,6 +45,8 @@
private VpeExpression rowClassesExpr;
private VpeExpression columnClassesExpr;
+ private static final String ATTR_CAPTION_STYLE = "captionStyle";
+ private static final String ATTR_CAPTION_CLASS = "captionClass";
private static final String ATTR_STYLE = "style";
private static final String ATTR_CLASS = "class";
private static final String ATTR_WIDTH = "width";
@@ -135,12 +137,22 @@
if (true || sourceElements.hasTableCaption()) {
caption = visualDocument.createElement(HTML.TAG_CAPTION);
- visualElements.setTableCaptionTag(caption);
if (sourceElements.getTableCaption() != null) {
VpeChildrenInfo info = new VpeChildrenInfo(caption);
info.addSourceChild(sourceElements.getTableCaption());
creatorInfo.addChildrenInfo(info);
}
+
+ // Everything concerning table caption
+ // lies here (was removed from VpeFacetCreator)
+ Node attr = sourceNode.getAttributes().getNamedItem(ATTR_CAPTION_STYLE);
+ if (attr != null) {
+ caption.setAttribute(ATTR_STYLE, attr.getNodeValue());
+ }
+ attr = sourceNode.getAttributes().getNamedItem(ATTR_CAPTION_CLASS);
+ if (attr != null) {
+ caption.setAttribute(ATTR_CLASS, attr.getNodeValue());
+ }
outterTable.appendChild(caption);
visualElements.setCaption(caption);
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableElements.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableElements.java 2008-03-14
13:06:30 UTC (rev 6931)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableElements.java 2008-03-14
13:56:03 UTC (rev 6932)
@@ -315,14 +315,6 @@
public void setColumnsHeaderRow(nsIDOMElement columnsHeaderRow) {
this.columnsHeaderRow = columnsHeaderRow;
}
-
- public nsIDOMElement getTableCaptionTag() {
- return tableCaptionTag;
- }
-
- public void setTableCaptionTag(nsIDOMElement tableCaptionTag) {
- this.tableCaptionTag = tableCaptionTag;
- }
public nsIDOMElement getTableFooter() {
return tableFooter;
@@ -447,7 +439,7 @@
VpeDataTableElements.getNamedChild(visualParent, HTML.TAG_TFOOT)
);
- visualDataTableElements.setTableCaptionTag(VpeDataTableElements.getNamedChild(visualDataTableElements.getCaption(),
"caption"));
+ visualDataTableElements.setCaption(VpeDataTableElements.getNamedChild(visualDataTableElements.getCaption(),
"caption"));
visualDataTableElements.setTableHeaderRow(VpeDataTableElements.getNamedChild(visualDataTableElements.getTableHeader(),
"tr"));
visualDataTableElements.setColumnsHeaderRow(VpeDataTableElements.getNamedChild(visualDataTableElements.getColumnsHeader(),
"tr"));
visualDataTableElements.setBodyRow(VpeDataTableElements.getNamedChild(visualDataTableElements.getBody(),
"tr"));
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeFacetCreator.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeFacetCreator.java 2008-03-14
13:06:30 UTC (rev 6931)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeFacetCreator.java 2008-03-14
13:56:03 UTC (rev 6932)
@@ -43,10 +43,9 @@
String name = nameAttr.getNodeValue();
isHeader = name.equals("header");
isFooter = name.equals("footer");
- isCaption = name.equals("caption");
}
- if (isHeader || isFooter || isCaption) {
+ if (isHeader || isFooter) {
Node sourceParent = sourceNode.getParentNode();
if (sourceParent != null) {
nsIDOMNode visualParent = null;
@@ -57,7 +56,6 @@
nsIDOMNode header = null;
nsIDOMNode footer = null;
- nsIDOMNode caption = null;
if (visualParent != null &&
visualParent.getNodeName().equalsIgnoreCase("table")) {
nsIDOMNodeList children = visualParent.getChildNodes();
@@ -84,17 +82,12 @@
cell = makeCell(columnsCount, HTML.TAG_TH, visualDocument);
} else if (isFooter) {
cell = makeCell(columnsCount, HTML.TAG_TD, visualDocument);
- } else if (isCaption) {
- cell = visualDocument.createElement(HTML.TAG_CAPTION);
}
if (cell != null) {
if (isHeader) {
setCellClass(cell, getTableAttrValue(sourceParent, "headerClass"));
} else if (isFooter) {
setCellClass(cell, getTableAttrValue(sourceParent, "footerClass"));
- } else if (isCaption) {
- setCellClass(cell, getTableAttrValue(sourceParent, "captionClass"));
- setCaptionStyle(sourceParent, cell, getTableAttrValue(sourceParent,
"captionStyle"));
}
creatorInfo = new VpeCreatorInfo(cell);
}
@@ -119,26 +112,6 @@
}
}
- /**
- * Sets the caption style and stretches caption to fit the full table width.
- *
- * @param sourceParent the source parent
- * @param cell the cell
- * @param captionStyle the caption style
- */
- private void setCaptionStyle(Node sourceParent, nsIDOMElement cell, String captionStyle)
{
- if (cell != null) {
- String resultStyle = "";
- if (captionStyle != null) {
- if (!(captionStyle.lastIndexOf("width") > -1)) {
- resultStyle += "width: 100%; ";
- }
- resultStyle += captionStyle;
- }
- cell.setAttribute(HTML.ATTR_STYLE, resultStyle);
- }
- }
-
private String getTableAttrValue(Node dataTableNode, String attrName) {
if (dataTableNode != null) {
Node attr = dataTableNode.getAttributes().getNamedItem(attrName);