Author: dgolovin
Date: 2012-04-06 17:59:16 -0400 (Fri, 06 Apr 2012)
New Revision: 40099
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableColumnCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpePanelGridCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeStyleCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/ZoomEventManager.java
Log:
fix for PMD warnings in VPE
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableColumnCreator.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableColumnCreator.java 2012-04-06
21:31:08 UTC (rev 40098)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableColumnCreator.java 2012-04-06
21:59:16 UTC (rev 40099)
@@ -202,7 +202,7 @@
@Override
public void removeElement(VpePageContext pageContext, Element sourceElement, Map
visualNodeMap) {
Object elements = visualNodeMap.get(this);
- if (elements != null && elements instanceof VisualColumnElements) {
+ if (elements instanceof VisualColumnElements) {
removeChild(((VisualColumnElements)elements).getHeaderCell());
removeChild(((VisualColumnElements)elements).getBodyCell());
removeChild(((VisualColumnElements)elements).getFooterCell());
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java 2012-04-06
21:31:08 UTC (rev 40098)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java 2012-04-06
21:59:16 UTC (rev 40099)
@@ -564,7 +564,7 @@
@Override
public IRegion getSourceRegionForOpenOn(VpePageContext pageContext,
Node sourceNode, nsIDOMNode domNode) {
- if(sourceNode != null && sourceNode instanceof Element) {
+ if(sourceNode instanceof Element) {
Element sourceElement = (Element) sourceNode;
String templateName = VpeTemplateManager.getInstance()
.getTemplateName(pageContext, sourceElement);
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpePanelGridCreator.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpePanelGridCreator.java 2012-04-06
21:31:08 UTC (rev 40098)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpePanelGridCreator.java 2012-04-06
21:59:16 UTC (rev 40099)
@@ -51,21 +51,18 @@
// private Set dependencySet;
- VpePanelGridCreator(Element gridElement, VpeDependencyMap dependencyMap,
- boolean caseSensitive) {
+ VpePanelGridCreator(Element gridElement, VpeDependencyMap dependencyMap, boolean
caseSensitive) {
this.caseSensitive = caseSensitive;
build(gridElement, dependencyMap);
}
private void build(Element gridElement, VpeDependencyMap dependencyMap) {
- Attr tableSizeAttr = gridElement
- .getAttributeNode(VpeTemplateManager.ATTR_PANELGRID_TABLE_SIZE);
+ Attr tableSizeAttr =
gridElement.getAttributeNode(VpeTemplateManager.ATTR_PANELGRID_TABLE_SIZE);
if (tableSizeAttr != null) {
try {
- VpeExpressionInfo info = VpeExpressionBuilder
- .buildCompletedExpression(tableSizeAttr.getValue(),
- caseSensitive);
+ VpeExpressionInfo info =
VpeExpressionBuilder.buildCompletedExpression(tableSizeAttr.getValue(),
+ caseSensitive);
tableSizeExpr = info.getExpression();
dependencyMap.setCreator(this, info.getDependencySet());
} catch (VpeExpressionBuilderException e) {
@@ -73,13 +70,11 @@
}
}
- Attr headerClassAttr = gridElement
- .getAttributeNode(VpeTemplateManager.ATTR_PANELGRID_HEADER_CLASS);
+ Attr headerClassAttr =
gridElement.getAttributeNode(VpeTemplateManager.ATTR_PANELGRID_HEADER_CLASS);
if (headerClassAttr != null) {
try {
- VpeExpressionInfo info = VpeExpressionBuilder
- .buildCompletedExpression(headerClassAttr.getValue(),
- caseSensitive);
+ VpeExpressionInfo info =
VpeExpressionBuilder.buildCompletedExpression(headerClassAttr.getValue(),
+ caseSensitive);
headerClassExpr = info.getExpression();
dependencyMap.setCreator(this, info.getDependencySet());
} catch (VpeExpressionBuilderException e) {
@@ -87,13 +82,11 @@
}
}
- Attr footerClassAttr = gridElement
- .getAttributeNode(VpeTemplateManager.ATTR_PANELGRID_FOOTER_CLASS);
+ Attr footerClassAttr =
gridElement.getAttributeNode(VpeTemplateManager.ATTR_PANELGRID_FOOTER_CLASS);
if (footerClassAttr != null) {
try {
- VpeExpressionInfo info = VpeExpressionBuilder
- .buildCompletedExpression(footerClassAttr.getValue(),
- caseSensitive);
+ VpeExpressionInfo info =
VpeExpressionBuilder.buildCompletedExpression(footerClassAttr.getValue(),
+ caseSensitive);
footerClassExpr = info.getExpression();
dependencyMap.setCreator(this, info.getDependencySet());
} catch (VpeExpressionBuilderException e) {
@@ -101,13 +94,11 @@
}
}
- Attr rowClassesAttr = gridElement
- .getAttributeNode(VpeTemplateManager.ATTR_PANELGRID_ROW_CLASSES);
+ Attr rowClassesAttr =
gridElement.getAttributeNode(VpeTemplateManager.ATTR_PANELGRID_ROW_CLASSES);
if (rowClassesAttr != null) {
try {
- VpeExpressionInfo info = VpeExpressionBuilder
- .buildCompletedExpression(rowClassesAttr.getValue(),
- caseSensitive);
+ VpeExpressionInfo info =
VpeExpressionBuilder.buildCompletedExpression(rowClassesAttr.getValue(),
+ caseSensitive);
rowClassesExpr = info.getExpression();
dependencyMap.setCreator(this, info.getDependencySet());
} catch (VpeExpressionBuilderException e) {
@@ -115,13 +106,11 @@
}
}
- Attr columnClassesAttr = gridElement
- .getAttributeNode(VpeTemplateManager.ATTR_PANELGRID_COLUMN_CLASSES);
+ Attr columnClassesAttr =
gridElement.getAttributeNode(VpeTemplateManager.ATTR_PANELGRID_COLUMN_CLASSES);
if (columnClassesAttr != null) {
try {
- VpeExpressionInfo info = VpeExpressionBuilder
- .buildCompletedExpression(columnClassesAttr.getValue(),
- caseSensitive);
+ VpeExpressionInfo info =
VpeExpressionBuilder.buildCompletedExpression(columnClassesAttr.getValue(),
+ caseSensitive);
columnClassesExpr = info.getExpression();
dependencyMap.setCreator(this, info.getDependencySet());
} catch (VpeExpressionBuilderException e) {
@@ -129,13 +118,11 @@
}
}
- Attr captionClassesAttr = gridElement
- .getAttributeNode(VpeTemplateManager.ATTR_PANELGRID_CAPTION_CLASS);
+ Attr captionClassesAttr =
gridElement.getAttributeNode(VpeTemplateManager.ATTR_PANELGRID_CAPTION_CLASS);
if (captionClassesAttr != null) {
try {
- VpeExpressionInfo info = VpeExpressionBuilder
- .buildCompletedExpression(
- captionClassesAttr.getValue(), caseSensitive);
+ VpeExpressionInfo info =
VpeExpressionBuilder.buildCompletedExpression(captionClassesAttr.getValue(),
+ caseSensitive);
captionClassExpr = info.getExpression();
dependencyMap.setCreator(this, info.getDependencySet());
} catch (VpeExpressionBuilderException e) {
@@ -143,13 +130,11 @@
}
}
- Attr captionStyleAttr = gridElement
- .getAttributeNode(VpeTemplateManager.ATTR_PANELGRID_CAPTION_STYLE);
+ Attr captionStyleAttr =
gridElement.getAttributeNode(VpeTemplateManager.ATTR_PANELGRID_CAPTION_STYLE);
if (captionStyleAttr != null) {
try {
- VpeExpressionInfo info = VpeExpressionBuilder
- .buildCompletedExpression(captionStyleAttr.getValue(),
- caseSensitive);
+ VpeExpressionInfo info =
VpeExpressionBuilder.buildCompletedExpression(captionStyleAttr.getValue(),
+ caseSensitive);
captionStyleExpr = info.getExpression();
dependencyMap.setCreator(this, info.getDependencySet());
} catch (VpeExpressionBuilderException e) {
@@ -157,13 +142,11 @@
}
}
- Attr rulesAttr = gridElement
- .getAttributeNode(VpeTemplateManager.ATTR_PANELGRID_RULES);
+ Attr rulesAttr =
gridElement.getAttributeNode(VpeTemplateManager.ATTR_PANELGRID_RULES);
if (rulesAttr != null) {
try {
- VpeExpressionInfo info = VpeExpressionBuilder
- .buildCompletedExpression(rulesAttr.getValue(),
- caseSensitive);
+ VpeExpressionInfo info =
VpeExpressionBuilder.buildCompletedExpression(rulesAttr.getValue(),
+ caseSensitive);
rulesExpr = info.getExpression();
dependencyMap.setCreator(this, info.getDependencySet());
} catch (VpeExpressionBuilderException e) {
@@ -178,17 +161,16 @@
if (attr != null) {
if (propertyCreators == null)
propertyCreators = new ArrayList();
- propertyCreators.add(new VpeAttributeCreator(attrName, attr
- .getValue(), dependencyMap, caseSensitive));
+ propertyCreators.add(new VpeAttributeCreator(attrName, attr.getValue(),
dependencyMap,
+ caseSensitive));
}
}
}
}
@Override
- public VpeCreatorInfo create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument, nsIDOMElement visualElement,
- Map visualNodeMap) throws VpeExpressionException {
+ public VpeCreatorInfo create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument
visualDocument,
+ nsIDOMElement visualElement, Map visualNodeMap) throws VpeExpressionException {
int tableSize = 1;
if (tableSizeExpr != null) {
VpeValue vpeValue = tableSizeExpr.exec(pageContext, sourceNode);
@@ -211,8 +193,7 @@
for (int i = 0; i < propertyCreators.size(); i++) {
VpeCreator creator = (VpeCreator) propertyCreators.get(i);
if (creator != null) {
- VpeCreatorInfo info = creator.create(pageContext,
- sourceNode, visualDocument, visualTable,
+ VpeCreatorInfo info = creator.create(pageContext, sourceNode, visualDocument,
visualTable,
visualNodeMap);
if (info != null && info.getVisualNode() != null) {
nsIDOMAttr attr = (nsIDOMAttr) info.getVisualNode();
@@ -223,229 +204,219 @@
}
if (rulesExpr != null) {
- String rules = rulesExpr.exec(pageContext, sourceNode)
- .stringValue();
+ String rules = rulesExpr.exec(pageContext, sourceNode).stringValue();
if (rules.length() > 0)
- visualTable.setAttribute(
- VpeTemplateManager.ATTR_PANELGRID_RULES, rules);
+ visualTable.setAttribute(VpeTemplateManager.ATTR_PANELGRID_RULES, rules);
}
NodeList children = sourceNode.getChildNodes();
int count = children != null ? children.getLength() : 0;
if (count > 0) {
- Node header = null;
- Node footer = null;
- Node caption = null;
- Node[] sourceChildren = new Node[count];
- int childrenCount = 0;
- for (int i = 0; i < count; i++) {
- Node node = children.item(i);
- int type = node.getNodeType();
- if ((type == Node.ELEMENT_NODE)
- || ((type == Node.TEXT_NODE)
- && (node.getNodeValue() != null)
- && (node.getNodeValue().trim().length() > 0))) {
- switch (VpeCreatorUtil.getFacetType(node, pageContext)) {
- case VpeCreatorUtil.FACET_TYPE_HEADER:
- header = node;
- break;
- case VpeCreatorUtil.FACET_TYPE_FOOTER:
- footer = node;
- break;
- case VpeCreatorUtil.FACET_TYPE_CAPTION:
- caption = node;
- break;
- default:
- sourceChildren[childrenCount] = node;
- childrenCount++;
- break;
- }
+ Node header = null;
+ Node footer = null;
+ Node caption = null;
+ Node[] sourceChildren = new Node[count];
+ int childrenCount = 0;
+ for (int i = 0; i < count; i++) {
+ Node node = children.item(i);
+ int type = node.getNodeType();
+ if ((type == Node.ELEMENT_NODE)
+ || ((type == Node.TEXT_NODE) && (node.getNodeValue() != null) &&
(node.getNodeValue().trim()
+ .length() > 0))) {
+ switch (VpeCreatorUtil.getFacetType(node, pageContext)) {
+ case VpeCreatorUtil.FACET_TYPE_HEADER:
+ header = node;
+ break;
+ case VpeCreatorUtil.FACET_TYPE_FOOTER:
+ footer = node;
+ break;
+ case VpeCreatorUtil.FACET_TYPE_CAPTION:
+ caption = node;
+ break;
+ default:
+ sourceChildren[childrenCount] = node;
+ childrenCount++;
+ break;
+ }
+ }
}
- }
- if (childrenCount > 0) {
- if (tableSize == 0) {
- tableSize = childrenCount;
- }
- Map<String, List<Node>> captionFacetChildren = null;
- Map<String, List<Node>> headerFacetChildren = null;
- Map<String, List<Node>> footerFacetChildren = null;
- captionFacetChildren = VisualDomUtil.findFacetElements(caption, pageContext);
- headerFacetChildren = VisualDomUtil.findFacetElements(header, pageContext);
- footerFacetChildren = VisualDomUtil.findFacetElements(footer, pageContext);
- /*
- * Add additional table cell for odd facet's elements.
- */
- boolean captionHtmlElementsPresents = ((null != captionFacetChildren) &&
(captionFacetChildren.get(VisualDomUtil.FACET_HTML_TAGS).size() > 0));
- boolean headerHtmlElementsPresents = ((null != headerFacetChildren) &&
(headerFacetChildren.get(VisualDomUtil.FACET_HTML_TAGS).size() > 0));
- boolean footerHtmlElementsPresents = ((null != footerFacetChildren) &&
(footerFacetChildren.get(VisualDomUtil.FACET_HTML_TAGS).size() > 0));
- boolean htmlFacetsElementsPresents = captionHtmlElementsPresents ||
headerHtmlElementsPresents || footerHtmlElementsPresents;
- boolean htmlFacetsElementsRendered = false;
- if (htmlFacetsElementsPresents) {
- childrenCount++;
- }
- int rowCount = (childrenCount + tableSize - 1) / tableSize;
+ if (childrenCount > 0) {
+ if (tableSize == 0) {
+ tableSize = childrenCount;
+ }
+ Map<String, List<Node>> captionFacetChildren = null;
+ Map<String, List<Node>> headerFacetChildren = null;
+ Map<String, List<Node>> footerFacetChildren = null;
+ captionFacetChildren = VisualDomUtil.findFacetElements(caption, pageContext);
+ headerFacetChildren = VisualDomUtil.findFacetElements(header, pageContext);
+ footerFacetChildren = VisualDomUtil.findFacetElements(footer, pageContext);
+ /*
+ * Add additional table cell for odd facet's elements.
+ */
+ boolean captionHtmlElementsPresents = ((null != captionFacetChildren) &&
(captionFacetChildren.get(
+ VisualDomUtil.FACET_HTML_TAGS).size() > 0));
+ boolean headerHtmlElementsPresents = ((null != headerFacetChildren) &&
(headerFacetChildren.get(
+ VisualDomUtil.FACET_HTML_TAGS).size() > 0));
+ boolean footerHtmlElementsPresents = ((null != footerFacetChildren) &&
(footerFacetChildren.get(
+ VisualDomUtil.FACET_HTML_TAGS).size() > 0));
+ boolean htmlFacetsElementsPresents = captionHtmlElementsPresents ||
headerHtmlElementsPresents
+ || footerHtmlElementsPresents;
+ boolean htmlFacetsElementsRendered = false;
+ if (htmlFacetsElementsPresents) {
+ childrenCount++;
+ }
+ int rowCount = (childrenCount + tableSize - 1) / tableSize;
- nsIDOMElement visualHead = null;
- nsIDOMElement visualFoot = null;
- nsIDOMElement visualCaption = null;
+ nsIDOMElement visualHead = null;
+ nsIDOMElement visualFoot = null;
+ nsIDOMElement visualCaption = null;
- if (caption != null) {
- visualCaption = visualDocument
- .createElement(HTML.TAG_CAPTION);
- visualTable.appendChild(visualCaption);
- VpeChildrenInfo childrenInfo = new VpeChildrenInfo(visualCaption);
- childrenInfo.addSourceChild(caption);
- creatorInfo.addChildrenInfo(childrenInfo);
- if (captionClassExpr != null
- && caption.getParentNode() != null) {
- String captionClass = captionClassExpr.exec(
- pageContext, caption.getParentNode())
- .stringValue();
- visualCaption.setAttribute(HTML.ATTR_CLASS, captionClass);
- }
+ if (caption != null) {
+ visualCaption = visualDocument.createElement(HTML.TAG_CAPTION);
+ visualTable.appendChild(visualCaption);
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(visualCaption);
+ childrenInfo.addSourceChild(caption);
+ creatorInfo.addChildrenInfo(childrenInfo);
+ if (captionClassExpr != null && caption.getParentNode() != null) {
+ String captionClass = captionClassExpr.exec(pageContext,
caption.getParentNode()).stringValue();
+ visualCaption.setAttribute(HTML.ATTR_CLASS, captionClass);
+ }
- if (captionStyleExpr != null
- && caption.getParentNode() != null) {
- String captionStyle = captionStyleExpr.exec(
- pageContext, caption.getParentNode())
- .stringValue();
- visualCaption.setAttribute(HTML.ATTR_STYLE, captionStyle);
- }
- }
- if (header != null) {
- visualHead = visualDocument.createElement(HTML.TAG_THEAD);
- visualTable.appendChild(visualHead);
- }
- if (footer != null) {
- visualFoot = visualDocument.createElement(HTML.TAG_TFOOT);
- visualTable.appendChild(visualFoot);
- }
+ if (captionStyleExpr != null && caption.getParentNode() != null) {
+ String captionStyle = captionStyleExpr.exec(pageContext,
caption.getParentNode()).stringValue();
+ visualCaption.setAttribute(HTML.ATTR_STYLE, captionStyle);
+ }
+ }
+ if (header != null) {
+ visualHead = visualDocument.createElement(HTML.TAG_THEAD);
+ visualTable.appendChild(visualHead);
+ }
+ if (footer != null) {
+ visualFoot = visualDocument.createElement(HTML.TAG_TFOOT);
+ visualTable.appendChild(visualFoot);
+ }
- nsIDOMElement visualBody = visualDocument
- .createElement(HTML.TAG_TBODY);
- visualTable.appendChild(visualBody);
+ nsIDOMElement visualBody = visualDocument.createElement(HTML.TAG_TBODY);
+ visualTable.appendChild(visualBody);
- List<String> rowClasses = VpeClassUtil.getClasses(rowClassesExpr, sourceNode,
- pageContext);
- List<String> columnClasses = VpeClassUtil.getClasses(columnClassesExpr,
sourceNode,
- pageContext);
+ List<String> rowClasses = VpeClassUtil.getClasses(rowClassesExpr, sourceNode,
pageContext);
+ List<String> columnClasses = VpeClassUtil.getClasses(columnClassesExpr,
sourceNode, pageContext);
- int rci = 0; // index of row class
- for (int i = 0; i < rowCount; i++) {
- int cci = 0; // index of column class. Reset on every new row.
+ int rci = 0; // index of row class
+ for (int i = 0; i < rowCount; i++) {
+ int cci = 0; // index of column class. Reset on every new
+ // row.
- nsIDOMElement visualRow = visualDocument.createElement(HTML.TAG_TR);
- if (rowClasses.size() > 0) {
- visualRow.setAttribute(HTML.ATTR_CLASS, rowClasses.get(rci)
- .toString());
- rci++;
- if (rci >= rowClasses.size())
- rci = 0;
- }
- for (int j = 0; j < tableSize; j++) {
- if (i*tableSize+j >= childrenCount) {
- break;
+ nsIDOMElement visualRow = visualDocument.createElement(HTML.TAG_TR);
+ if (!rowClasses.isEmpty()) {
+ visualRow.setAttribute(HTML.ATTR_CLASS, rowClasses.get(rci).toString());
+ rci++;
+ if (rci >= rowClasses.size()) {
+ rci = 0;
+ }
+ }
+ for (int j = 0; j < tableSize; j++) {
+ if (i * tableSize + j >= childrenCount) {
+ break;
+ }
+ nsIDOMElement visualCell = visualDocument.createElement(HTML.TAG_TD);
+ if (!columnClasses.isEmpty()) {
+ visualCell.setAttribute(HTML.ATTR_CLASS, columnClasses.get(cci).toString());
+ cci++;
+ if (cci >= columnClasses.size()) {
+ cci = 0;
+ }
+ }
+ visualRow.appendChild(visualCell);
+ /*
+ *
https://jira.jboss.org/jira/browse/JBIDE-3373 Add odd
+ * facets elements to the first table cell
+ */
+ if (htmlFacetsElementsPresents && !htmlFacetsElementsRendered) {
+ VpeChildrenInfo childrenInfo = null;
+ if (captionHtmlElementsPresents) {
+ for (Node node : captionFacetChildren.get(VisualDomUtil.FACET_HTML_TAGS)) {
+ childrenInfo = new VpeChildrenInfo(visualCell);
+ childrenInfo.addSourceChild(node);
+ creatorInfo.addChildrenInfo(childrenInfo);
+ }
+ }
+ if (headerHtmlElementsPresents) {
+ for (Node node : headerFacetChildren.get(VisualDomUtil.FACET_HTML_TAGS)) {
+ childrenInfo = new VpeChildrenInfo(visualCell);
+ childrenInfo.addSourceChild(node);
+ creatorInfo.addChildrenInfo(childrenInfo);
+ }
+ }
+ if (footerHtmlElementsPresents) {
+ for (Node node : footerFacetChildren.get(VisualDomUtil.FACET_HTML_TAGS)) {
+ childrenInfo = new VpeChildrenInfo(visualCell);
+ childrenInfo.addSourceChild(node);
+ creatorInfo.addChildrenInfo(childrenInfo);
+ }
+ }
+ htmlFacetsElementsRendered = true;
+ } else {
+
+ int sourceIndex = tableSize * i + j;
+ if (sourceIndex < childrenCount) {
+ /*
+ *
https://jira.jboss.org/jira/browse/JBIDE-3373
+ * Correct index when odd facets elements
+ * presents
+ */
+ if (htmlFacetsElementsPresents) {
+ sourceIndex = sourceIndex - 1;
+ }
+ Node child = sourceChildren[sourceIndex];
+ if (child != header && child != footer) {
+ VpeChildrenInfo childrenInfo = new VpeChildrenInfo(visualCell);
+ childrenInfo.addSourceChild(child);
+ creatorInfo.addChildrenInfo(childrenInfo);
+ }
+ }
+ }
+ }
+ if (visualBody != null) {
+ visualBody.appendChild(visualRow);
+ } else {
+ visualTable.appendChild(visualRow);
+ }
}
- nsIDOMElement visualCell = visualDocument.createElement(HTML.TAG_TD);
- if (columnClasses.size() > 0) {
- visualCell.setAttribute(HTML.ATTR_CLASS, columnClasses.get(
- cci).toString());
- cci++;
- if (cci >= columnClasses.size())
- cci = 0;
- }
- visualRow.appendChild(visualCell);
- /*
- *
https://jira.jboss.org/jira/browse/JBIDE-3373
- * Add odd facets elements to the first table cell
- */
- if (htmlFacetsElementsPresents && !htmlFacetsElementsRendered) {
- VpeChildrenInfo childrenInfo = null;
- if (captionHtmlElementsPresents) {
- for (Node node : captionFacetChildren.get(VisualDomUtil.FACET_HTML_TAGS)) {
- childrenInfo = new VpeChildrenInfo(visualCell);
- childrenInfo.addSourceChild(node);
- creatorInfo.addChildrenInfo(childrenInfo);
- }
- }
- if (headerHtmlElementsPresents) {
- for (Node node : headerFacetChildren.get(VisualDomUtil.FACET_HTML_TAGS)) {
- childrenInfo = new VpeChildrenInfo(visualCell);
- childrenInfo.addSourceChild(node);
- creatorInfo.addChildrenInfo(childrenInfo);
- }
- }
- if (footerHtmlElementsPresents) {
- for (Node node : footerFacetChildren.get(VisualDomUtil.FACET_HTML_TAGS)) {
- childrenInfo = new VpeChildrenInfo(visualCell);
- childrenInfo.addSourceChild(node);
- creatorInfo.addChildrenInfo(childrenInfo);
- }
- }
- htmlFacetsElementsRendered = true;
- } else {
-
- int sourceIndex = tableSize * i + j;
- if (sourceIndex < childrenCount) {
- /*
- *
https://jira.jboss.org/jira/browse/JBIDE-3373
- * Correct index when odd facets elements presents
- */
- if (htmlFacetsElementsPresents) {
- sourceIndex = sourceIndex-1;
- }
- Node child = sourceChildren[sourceIndex];
- if (child != header && child != footer) {
- VpeChildrenInfo childrenInfo = new VpeChildrenInfo(visualCell);
- childrenInfo.addSourceChild(child);
- creatorInfo.addChildrenInfo(childrenInfo);
- }
- }
- }
- }
- if (visualBody != null) {
- visualBody.appendChild(visualRow);
- } else {
- visualTable.appendChild(visualRow);
- }
- }
- makeSpecial(header, "header", visualHead, visualDocument, tableSize,
//$NON-NLS-1$
- creatorInfo, HTML.TAG_TH, headerClassExpr, pageContext);
- makeSpecial(footer, "footer", visualFoot, visualDocument, tableSize,
//$NON-NLS-1$
- creatorInfo, HTML.TAG_TD, footerClassExpr, pageContext);
+ makeSpecial(header, "header", visualHead, visualDocument, tableSize,
//$NON-NLS-1$
+ creatorInfo, HTML.TAG_TH, headerClassExpr, pageContext);
+ makeSpecial(footer, "footer", visualFoot, visualDocument, tableSize,
//$NON-NLS-1$
+ creatorInfo, HTML.TAG_TD, footerClassExpr, pageContext);
- for (int i = 0; i < propertyCreators.size(); i++) {
- VpeCreator creator = (VpeCreator) propertyCreators.get(i);
- if (creator != null) {
- VpeCreatorInfo info = creator.create(pageContext,
- sourceNode, visualDocument,
- visualTable, visualNodeMap);
- if (info != null && info.getVisualNode() != null) {
- nsIDOMAttr attr = (nsIDOMAttr) info.getVisualNode();
- if (attr.getValue().length() > 0) {
- visualTable.setAttributeNode(attr);
- }
+ for (int i = 0; i < propertyCreators.size(); i++) {
+ VpeCreator creator = (VpeCreator) propertyCreators.get(i);
+ if (creator != null) {
+ VpeCreatorInfo info = creator.create(pageContext, sourceNode, visualDocument,
visualTable,
+ visualNodeMap);
+ if (info != null && info.getVisualNode() != null) {
+ nsIDOMAttr attr = (nsIDOMAttr) info.getVisualNode();
+ if (attr.getValue().length() > 0) {
+ visualTable.setAttributeNode(attr);
+ }
+ }
+ }
}
- }
}
- }
}
return creatorInfo;
}
- private void makeSpecial(Node facet, String facetName, nsIDOMElement visualHead,
- nsIDOMDocument visualDocument, int tableSize,
- VpeCreatorInfo creatorInfo, String cellTag,
- VpeExpression headerClassExpr, VpePageContext pageContext) throws
VpeExpressionException {
+ private void makeSpecial(Node facet, String facetName, nsIDOMElement visualHead,
nsIDOMDocument visualDocument,
+ int tableSize, VpeCreatorInfo creatorInfo, String cellTag, VpeExpression
headerClassExpr,
+ VpePageContext pageContext) throws VpeExpressionException {
if (facet != null && visualHead != null) {
nsIDOMElement visualRow = visualDocument.createElement(HTML.TAG_TR);
visualHead.appendChild(visualRow);
nsIDOMElement visualCell = visualDocument.createElement(cellTag);
visualCell.setAttribute(HTML.ATTR_COLSPAN, "" + tableSize); //$NON-NLS-1$
if (headerClassExpr != null && facet.getParentNode() != null) {
- String headerClass = headerClassExpr.exec(pageContext,
- facet.getParentNode()).stringValue();
+ String headerClass = headerClassExpr.exec(pageContext,
facet.getParentNode()).stringValue();
visualCell.setAttribute(HTML.ATTR_CLASS, headerClass);
}
visualRow.appendChild(visualCell);
@@ -470,13 +441,18 @@
return null;
}
- /* (non-Javadoc)
- * @see
org.jboss.tools.vpe.editor.template.VpeAbstractCreator#isRecreateAtAttrChange(org.jboss.tools.vpe.editor.context.VpePageContext,
org.w3c.dom.Element, org.mozilla.interfaces.nsIDOMDocument,
org.mozilla.interfaces.nsIDOMNode, java.lang.Object, java.lang.String, java.lang.String)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.jboss.tools.vpe.editor.template.VpeAbstractCreator#isRecreateAtAttrChange
+ * (org.jboss.tools.vpe.editor.context.VpePageContext, org.w3c.dom.Element,
+ * org.mozilla.interfaces.nsIDOMDocument, org.mozilla.interfaces.nsIDOMNode,
+ * java.lang.Object, java.lang.String, java.lang.String)
*/
@Override
- public boolean isRecreateAtAttrChange(VpePageContext pageContext,
- Element sourceElement, nsIDOMDocument visualDocument,
- nsIDOMNode visualNode, Object data, String name, String value) {
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext, Element
sourceElement,
+ nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name, String
value) {
return true;
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeStyleCreator.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeStyleCreator.java 2012-04-06
21:31:08 UTC (rev 40098)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeStyleCreator.java 2012-04-06
21:59:16 UTC (rev 40099)
@@ -46,7 +46,7 @@
text = VpeStyleUtil.removeAllCssComments(text);
List<String> imports = VpeStyleUtil.findCssImportConstruction(text,
pageContext);
VpeVisualDomBuilder vvdb = pageContext.getVisualBuilder();
- if (imports.size() > 0) {
+ if (!imports.isEmpty()) {
for (String key : imports) {
/*
* Add inline <style> element for each found css @import.
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/ZoomEventManager.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/ZoomEventManager.java 2012-04-06
21:31:08 UTC (rev 40098)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/ZoomEventManager.java 2012-04-06
21:59:16 UTC (rev 40099)
@@ -27,13 +27,13 @@
public class ZoomEventManager implements IZoomEventManager{
- private final float basicZoom = 1f;
- private final float minZoom = 0.3f;
- private final float maxZoom = 4f;
+ private static final float basicZoom = 1f;
+ private static final float minZoom = 0.3f;
+ private static final float maxZoom = 4f;
private float[] availableZoomValues;
private int currentZoomPos = 5;
- private final float decreaseValue = 0.14f;
- private final float increaseValue = 0.375f;
+ private static final float decreaseValue = 0.14f;
+ private static final float increaseValue = 0.375f;
private nsIMarkupDocumentViewer documentViewer;
public ZoomEventManager(XulRunnerEditor editor) {