Author: dgolovin
Date: 2011-09-30 21:08:44 -0400 (Fri, 30 Sep 2011)
New Revision: 35256
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/src/org/jboss/tools/jsf/vpe/myfaces/template/VpeMyFacesDataScrollerTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
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
Log:
https://issues.jboss.org/browse/JBIDE-9807 testForSimpleText & testForElText
code cleanup after debugging
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/src/org/jboss/tools/jsf/vpe/myfaces/template/VpeMyFacesDataScrollerTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/src/org/jboss/tools/jsf/vpe/myfaces/template/VpeMyFacesDataScrollerTemplate.java 2011-10-01
01:05:15 UTC (rev 35255)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/src/org/jboss/tools/jsf/vpe/myfaces/template/VpeMyFacesDataScrollerTemplate.java 2011-10-01
01:08:44 UTC (rev 35256)
@@ -112,10 +112,6 @@
public void removeAttribute(VpePageContext pageContext, Element sourceElement, Document
visualDocument, Node visualNode, Object data, String name) {
}
- public String[] getOutputAttributeNames() {
- return null;
- }
-
/* (non-Javadoc)
* @see
org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#getOutputTextNode(org.jboss.tools.vpe.editor.context.VpePageContext,
org.w3c.dom.Element, java.lang.Object)
*/
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java 2011-10-01
01:05:15 UTC (rev 35255)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java 2011-10-01
01:08:44 UTC (rev 35256)
@@ -920,7 +920,7 @@
if (nm instanceof VpeElementMapping) {
VpeElementMapping mapping = (VpeElementMapping)nm;
String[] names = mapping.getTemplate().getOutputAttributeNames();
- if(names!=null) {
+ if(names.length>0) {
String name = names[0];
return (Attr)node.getAttributes().getNamedItem(name);
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2011-10-01
01:05:15 UTC (rev 35255)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2011-10-01
01:08:44 UTC (rev 35256)
@@ -118,6 +118,8 @@
/** The Constant ATTR_PSEUDOCONTENT_ATTRNAME. */
private static final String ATTR_PSEUDOCONTENT_ATTRNAME = "attrName";
//$NON-NLS-1$
+ protected static final String[] EMPTY_ARRAY = new String[0];;
+
/** The breaker type. */
private int breakerType = BREAKER_TYPE_NONE;
@@ -1120,7 +1122,7 @@
* @return attrubute name array
*/
public String[] getOutputAttributeNames() {
- return null;
+ return EMPTY_ARRAY;
}
/**
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 2011-10-01
01:05:15 UTC (rev 35255)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableColumnCreator.java 2011-10-01
01:08:44 UTC (rev 35256)
@@ -154,7 +154,7 @@
creatorInfo.addChildrenInfo(info);
String columnClasses = getNodeAttrValue(sourceNode.getParentNode(),
VpeTemplateManager.ATTR_DATATABLE_COLUMN_CLASSES);
- if (null != columnClasses) {
+ if (null != columnClasses && cell != null) {
setColumnClassesToCell(cell, columnClasses, index);
}
visualColumnElements.setBodyCell(cell);
@@ -227,47 +227,28 @@
* @param columnClasses the column classes
* @param index the index of the column in the table
*/
- private void setColumnClassesToCell(nsIDOMElement cell,
- String columnClasses, int index) {
- if (cell != null) {
- String[] classes = splitClasses(columnClasses);
- if ((null != classes) && (classes.length > 0)) {
- int classesCount = classes.length;
- int columnCount = index + 1;
- String className = ""; //$NON-NLS-1$
-
- // Finds correct css style class index
- // for the column
- if (columnCount <= classesCount) {
- className = classes[columnCount - 1];
- } else {
- int remainder = columnCount % classesCount;
- int classesIndex = ((0 == remainder) ? (classesCount-1) : (remainder-1));
- className = classes[classesIndex];
- }
- if (className.trim().length() > 0) {
- cell.setAttribute("class", className); //$NON-NLS-1$
- }
+ private void setColumnClassesToCell(nsIDOMElement cell,String columnClasses, int index)
{
+ String[] classes = columnClasses.split(",");
+ if (classes.length > 0) {
+ int classesCount = classes.length;
+ int columnCount = index + 1;
+ String className = ""; //$NON-NLS-1$
+ // Finds correct css style class index
+ // for the column
+ if (columnCount <= classesCount) {
+ className = classes[columnCount - 1];
+ } else {
+ int remainder = columnCount % classesCount;
+ int classesIndex = ((0 == remainder) ? (classesCount-1) : (remainder-1));
+ className = classes[classesIndex];
}
-
+ if (className.trim().length() > 0) {
+ cell.setAttribute("class", className); //$NON-NLS-1$
+ }
}
}
/**
- * Splits a sequence of classes to an array of separate classes.
- *
- * @param value the sequence of classes
- *
- * @return the array of separate classes
- */
- private String[] splitClasses(String value) {
- if (value != null) {
- return value.split(","); //$NON-NLS-1$
- }
- return null;
- }
-
- /**
* Sets the css class to the cell.
*
* @param cell the cell
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 2011-10-01
01:05:15 UTC (rev 35255)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java 2011-10-01
01:08:44 UTC (rev 35256)
@@ -367,7 +367,7 @@
return ((VpeOutputAttributes)creators[i]).getOutputAttributes();
}
}
- return null;
+ return EMPTY_ARRAY;
}
@Override
public nsIDOMText getOutputTextNode(VpePageContext pageContext, Element sourceElement,
Object data) {