Author: sdzmitrovich
Date: 2008-01-23 04:13:18 -0500 (Wed, 23 Jan 2008)
New Revision: 5906
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/header.gif
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/shuttle.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSliderTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesListShuttleTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-1580
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/header.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/header.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/shuttle.css
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/shuttle.css 2008-01-23
06:32:12 UTC (rev 5905)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/shuttle/shuttle.css 2008-01-23
09:13:18 UTC (rev 5906)
@@ -1,31 +1,44 @@
-.rich-shuttle-box {
- background-color: #FFF;
- border-color: #C0C0C0;
- border-width: 1px;
- border-style: solid;
- overflow: auto;
- //display:block;
+.rich-list-shuttle {
+
}
-.rich-shuttle-caption-label {
+.rich-shuttle-source-caption,.rich-shuttle-target-caption {
font-family: Arial, Verdana, sans-serif;
font-size: 11px;
font-weight: bold;
}
-.rich-shuttle-button-content {
- padding: 0 4px 0 1px;
- text-align: left;
+.rich-shuttle-list-header {
+ overflow: hidden;
+}
+
+.rich-shuttle-header-tab-cell,.rich-shuttle-header-tab-cell-last {
+ padding: 2px;
+ border-style: solid;
+ font-weight: normal;
white-space: nowrap;
- font-family: Arial, Verdana, sans-serif;
- font-size: 11px;
+ background-repeat: repeat-x;
+ border-top: 0;
+ border-left: 0;
}
-.rich-shuttle-button-content img {
- margin-right: 2px;
- vertical-align: middle;
+.rich-shuttle-list-content {
+ background-color: #FFF;
+ border-color: #C0C0C0;
+ border-width: 1px;
+ border-style: solid;
+ overflow: auto; //
+ display: block;
}
+.rich-shuttle-source-row,.rich-shuttle-target-row {
+
+}
+
+.rich-shuttle-controls {
+ padding: 0 8px 5px 8px;
+}
+
.rich-shuttle-control {
border: 1px solid;
margin-bottom: 3px;
@@ -42,6 +55,15 @@
font-size: 11px;
}
-.rich-shuttle-controls {
- padding: 0 8px 5px 8px;
+.rich-shuttle-button-content {
+ padding: 0 4px 0 1px;
+ text-align: left;
+ white-space: nowrap;
+ font-family: Arial, Verdana, sans-serif;
+ font-size: 11px;
+}
+
+.rich-shuttle-button-content img {
+ margin-right: 2px;
+ vertical-align: middle;
}
\ No newline at end of file
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2008-01-23
06:32:12 UTC (rev 5905)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2008-01-23
09:13:18 UTC (rev 5906)
@@ -12,6 +12,7 @@
import java.io.File;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IFile;
@@ -49,7 +50,8 @@
NodeList children = sourceElement.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
- if (node instanceof Element && node.getNodeName()!=null &&
node.getNodeName().indexOf(":facet")>0) {
+ if (node instanceof Element && node.getNodeName() != null
+ && node.getNodeName().indexOf(":facet") > 0) {
Element element = (Element) node;
String name = element.getAttribute("name");
if (facetName.equals(name)) {
@@ -249,23 +251,47 @@
NamedNodeMap namedNodeMap = sourceNode.getAttributes();
for (int i = 0; i < namedNodeMap.getLength(); i++) {
Node attribute = namedNodeMap.item(i);
- //added by Max Areshkau fix for JBIDE-1568
+ // added by Max Areshkau fix for JBIDE-1568
try {
- visualElement.setAttribute(attribute.getNodeName(), attribute
- .getNodeValue());
- } catch(XPCOMException ex) {
- //if error-code not equals error for incorrect name throws exception
+ visualElement.setAttribute(attribute.getNodeName(), attribute
+ .getNodeValue());
+ } catch (XPCOMException ex) {
+ // if error-code not equals error for incorrect name throws
+ // exception
// error code is NS_ERROR_DOM_INVALID_CHARACTER_ERR=0x80530005
- if(ex.errorcode!=2152923141L) {
+ if (ex.errorcode != 2152923141L) {
throw ex;
}
- //else we ignore this exception
+ // else we ignore this exception
}
}
}
/**
+ * Copies attributes from source node to visual node.
+ *
+ * @param attributes -
+ * list names of attributes which will copy
+ * @param sourceNode
+ * @param visualNode
+ */
+ public static void copyAttributes(Element sourceElement,
+ List<String> attributes, nsIDOMElement visualElement) {
+
+ if (attributes == null)
+ return;
+
+ for (String attributeName : attributes) {
+
+ String attributeValue = sourceElement.getAttribute(attributeName);
+ if (attributeValue != null)
+ visualElement.setAttribute(attributeName, attributeValue);
+ }
+
+ }
+
+ /**
* Returns true if sourceNode is Facet
*
* @param sourceNode
@@ -303,6 +329,10 @@
+ imgPath.replace('\\', '/') + ");";
return style;
}
+
+// public static createStyleClass(String content){
+//
+// }
/**
* Returns value of attribute.
@@ -456,24 +486,25 @@
} else
visualNode.removeAttribute(attrName);
}
-
+
/**
- * Parses string value retrieved from
- * sourceElement.getAttribure(..) method
+ * Parses string value retrieved from sourceElement.getAttribure(..) method
* to its boolean value.
* <p>
* <code>false</code> is returned only if it specified explicitly,
* otherwise <code>true</code> is returned.
*
- * @param str the string to parse
+ * @param str
+ * the string to parse
* @return boolean value from string
*/
public static boolean string2boolean(String str) {
if ((str == null) || ("".equals(str))) {
return true;
- } else if (("true".equalsIgnoreCase(str)) ||
("false".equalsIgnoreCase(str))) {
+ } else if (("true".equalsIgnoreCase(str))
+ || ("false".equalsIgnoreCase(str))) {
return new Boolean(str).booleanValue();
- }
+ }
return true;
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSliderTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSliderTemplate.java 2008-01-23
06:32:12 UTC (rev 5905)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSliderTemplate.java 2008-01-23
09:13:18 UTC (rev 5906)
@@ -7,9 +7,9 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.vpe.richfaces.template;
-
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
@@ -18,8 +18,10 @@
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.VpeSourceDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.mozilla.interfaces.nsIDOMAttr;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -27,256 +29,286 @@
import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-
-/**
- * Template for input number slider control
- * // TODO We should refactor this class. There is a lot of reflection and a lot of
direct work with mozzila.
- */
-public class RichFacesInputNumberSliderTemplate extends
- AbstractRichFacesInputNumberTemplate {
-
- private static final String CSS_FILE =
"/inputNumberSlider/inputNumberSlider.css";
-
- private static final String MIN_VALUE_STALE_CLASS = "minValueStyle";
-
- private static final String MAX_VALUE_STALE_CLASS = "maxValueStyle";
-
- private static final String TABLE_INPUT_CELL_STYLE =
"manualInputFieldTableCellClass";
-
- private static final String CELL_FOR_TABLE_STYLE = "cellForTableStyleClass";
-
- private static final String INNER_TABLE_STYLE = "innerTableStyle";
-
- final static private String HTML_INPUTSIZE_DEFAULT = "3";
-
- final static private String HTML_INPUTTYPE_HIDDEN = "hidden";
-
- final static private String HTML_INPUTTYPE_TEXT = "text";
-
- final static private String HTML_INPUTVALUE_DEFAULT = "50";
-
- final static private String IMAGE_SLIDER = "/inputNumberSlider/pos.gif";
-
- final static private String SLIDER_MAXVALUE_ATTR = "maxValue";
-
- final static private String SLIDER_MAXVALUE_DEFAULT = "100";
-
- final static private String SLIDER_MINVALUE_ATTR = "minValue";
-
- final static private String SLIDER_VALUE_ATTR = "value";
-
- final static private String SLIDER_MINVALUE_DEFAULT = "0";
-
- final static private String SLIDER_SHOWBOUNDARY_ATTR = "showBoundaryValues";
-
- final static private String SLIDER_SHOWINPUT_ATTR = "showInput";
-
- final static private String SLIDER_STEP_ATTR = "step";
-
- /** INPUT_STYLE_CLASS */
- private static final String INPUT_STYLE_CLASS = "inputStyleClass";
-
- /** */
- final private Map<String, Method> mapAttributeToMethod;
-
- final private static Class<?>[] defaultArgsMappedMethods = new Class<?>[2];
-
- static {
- defaultArgsMappedMethods[0] = nsIDOMElement.class;
- defaultArgsMappedMethods[1] = Element.class;
- }
- private boolean rightInputPosition = true;
+/**
+ * Template for input number slider control // TODO We should refactor this
+ * class. There is a lot of reflection and a lot of direct work with mozzila.
+ */
+public class RichFacesInputNumberSliderTemplate extends
+ AbstractRichFacesInputNumberTemplate {
- /**
- * Default constructor
- */
- public RichFacesInputNumberSliderTemplate() {
- mapAttributeToMethod = new HashMap<String, Method>();
-
- addMapAttibuteToMethod("value", "setInputValue");
- addMapAttibuteToMethod("inputSize", "setInputSize");
- addMapAttibuteToMethod("inputClass", "setInputClass");
- addMapAttibuteToMethod("inputStyle", "setInputStyle");
+ private static final String CSS_FILE =
"/inputNumberSlider/inputNumberSlider.css";
+
+ private static final String MIN_VALUE_STALE_CLASS = "minValueStyle";
+
+ private static final String MAX_VALUE_STALE_CLASS = "maxValueStyle";
+
+ private static final String TABLE_INPUT_CELL_STYLE =
"manualInputFieldTableCellClass";
+
+ private static final String CELL_FOR_TABLE_STYLE = "cellForTableStyleClass";
+
+ private static final String INNER_TABLE_STYLE = "innerTableStyle";
+
+ final static private String HTML_INPUTSIZE_DEFAULT = "3";
+
+ final static private String HTML_INPUTTYPE_HIDDEN = "hidden";
+
+ final static private String HTML_INPUTTYPE_TEXT = "text";
+
+ final static private String HTML_INPUTVALUE_DEFAULT = "50";
+
+ final static private String IMAGE_SLIDER = "/inputNumberSlider/pos.gif";
+
+ final static private String SLIDER_MAXVALUE_ATTR = "maxValue";
+
+ final static private String SLIDER_MAXVALUE_DEFAULT = "100";
+
+ final static private String SLIDER_MINVALUE_ATTR = "minValue";
+
+ final static private String SLIDER_VALUE_ATTR = "value";
+
+ final static private String SLIDER_MINVALUE_DEFAULT = "0";
+
+ final static private String SLIDER_SHOWBOUNDARY_ATTR = "showBoundaryValues";
+
+ final static private String SLIDER_SHOWINPUT_ATTR = "showInput";
+
+ final static private String SLIDER_STEP_ATTR = "step";
+
+ /** INPUT_STYLE_CLASS */
+ private static final String INPUT_STYLE_CLASS = "inputStyleClass";
+
+ /** */
+ final private Map<String, Method> mapAttributeToMethod;
+
+ final private static Class<?>[] defaultArgsMappedMethods = new Class<?>[2];
+
+ static {
+ defaultArgsMappedMethods[0] = nsIDOMElement.class;
+ defaultArgsMappedMethods[1] = Element.class;
+ }
+
+ private boolean rightInputPosition = true;
+
+ /**
+ * Default constructor
+ */
+ public RichFacesInputNumberSliderTemplate() {
+ mapAttributeToMethod = new HashMap<String, Method>();
+
+ addMapAttibuteToMethod("value", "setInputValue");
+ addMapAttibuteToMethod("inputSize", "setInputSize");
+ addMapAttibuteToMethod("inputClass", "setInputClass");
+ addMapAttibuteToMethod("inputStyle", "setInputStyle");
addMapAttibuteToMethod("inputPosition", "setInputPosition");
- addMapAttibuteToMethod("maxlength", "setMaxlength");
- addMapAttibuteToMethod("showInput", "showInput");
- addMapAttibuteToMethod("showBoundaryValues",
"showBoundaryValues");
- addMapAttibuteToMethod("maxValue", "setMaxValue");
- addMapAttibuteToMethod("minValue", "setMinValue");
- addMapAttibuteToMethod("width", "setWidth");
- addMapAttibuteToMethod("style", "setStyle");
- addMapAttibuteToMethod("class", "setClass");
- }
-
- /**
- *
- * @param methodName
- * @return
- */
- private Method getMethodByName(String methodName) {
- Class<?> clazz = this.getClass();
- Method m1 = null;
- try {
- m1 = clazz.getMethod(methodName, defaultArgsMappedMethods);
- } catch (SecurityException e) {
- RichFacesTemplatesActivator.getPluginLog().logError("SecurityException: " +
e.getMessage() );
- } catch (NoSuchMethodException e) {
- RichFacesTemplatesActivator.getPluginLog().logWarning("NoSuchMethodException:
" + methodName + ":" + e.getMessage() );
- }
-
- return m1;
- }
-
- /**
- *
- * @param attributeName
- * @param methodName
- */
- private void addMapAttibuteToMethod(String attributeName, String methodName) {
- Method method = getMethodByName(methodName);
-
- if (method != null) {
- mapAttributeToMethod.put(attributeName, method);
- }
- }
-
- /**
- * Creates a node of the visual tree on the node of the source tree. This
- * visual node should not have the parent node This visual node can have
- * child nodes.
- *
- * @param pageContext
- * Contains the information on edited page.
- * @param sourceNode
- * The current node of the source tree.
- * @param visualDocument
- * The document of the visual tree.
- * @return The information on the created node of the visual tree.
- */
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
- setInputPosition(sourceNode);
+ addMapAttibuteToMethod("maxlength", "setMaxlength");
+ addMapAttibuteToMethod("showInput", "showInput");
+ addMapAttibuteToMethod("showBoundaryValues",
"showBoundaryValues");
+ addMapAttibuteToMethod("maxValue", "setMaxValue");
+ addMapAttibuteToMethod("minValue", "setMinValue");
+ addMapAttibuteToMethod("width", "setWidth");
+ addMapAttibuteToMethod("style", "setStyle");
+ addMapAttibuteToMethod("class", "setClass");
+ }
- nsIDOMElement table1 = null;
- nsIDOMElement table1Tr1 = null;
- nsIDOMElement table1Tr1Td1 = null;
- nsIDOMText table1Tr1Td1Text = null;
- nsIDOMElement table1Tr1Td2 = null;
- nsIDOMText table1Tr1Td2Text = null;
- nsIDOMElement table1Tr1Td3 = null;
- nsIDOMElement table1Tr1Td3input = null;
- nsIDOMElement table1Tr2 = null;
- nsIDOMElement table1Tr2Td1 = null;
- nsIDOMElement table1Tr2Td1Table2 = null;
- nsIDOMElement table1Tr2Td1Table2Tr1 = null;
+ /**
+ *
+ * @param methodName
+ * @return
+ */
+ private Method getMethodByName(String methodName) {
+ Class<?> clazz = this.getClass();
+ Method m1 = null;
+ try {
+ m1 = clazz.getMethod(methodName, defaultArgsMappedMethods);
+ } catch (SecurityException e) {
+ RichFacesTemplatesActivator.getPluginLog().logError(
+ "SecurityException: " + e.getMessage());
+ } catch (NoSuchMethodException e) {
+ RichFacesTemplatesActivator.getPluginLog().logWarning(
+ "NoSuchMethodException: " + methodName + ":"
+ + e.getMessage());
+ }
+
+ return m1;
+ }
+
+ /**
+ *
+ * @param attributeName
+ * @param methodName
+ */
+ private void addMapAttibuteToMethod(String attributeName, String methodName) {
+ Method method = getMethodByName(methodName);
+
+ if (method != null) {
+ mapAttributeToMethod.put(attributeName, method);
+ }
+ }
+
+ /**
+ * Creates a node of the visual tree on the node of the source tree. This
+ * visual node should not have the parent node This visual node can have
+ * child nodes.
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceNode
+ * The current node of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @return The information on the created node of the visual tree.
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+ setInputPosition(sourceNode);
+
+ nsIDOMElement table1 = null;
+ nsIDOMElement table1Tr1 = null;
+ nsIDOMElement table1Tr1Td1 = null;
+ nsIDOMText table1Tr1Td1Text = null;
+ nsIDOMElement table1Tr1Td2 = null;
+ nsIDOMText table1Tr1Td2Text = null;
+ nsIDOMElement table1Tr1Td3 = null;
+ nsIDOMElement table1Tr1Td3input = null;
+ nsIDOMElement table1Tr2 = null;
+ nsIDOMElement table1Tr2Td1 = null;
+ nsIDOMElement table1Tr2Td1Table2 = null;
+ nsIDOMElement table1Tr2Td1Table2Tr1 = null;
nsIDOMElement table1Tr2Td1Table2Tr1Td = null;
nsIDOMElement table1Tr2Td1Table2Tr1TdTable = null;
nsIDOMElement table1Tr2Td1Table2Tr1TdTableTr = null;
- nsIDOMElement table1Tr2Td1Table2Tr1TdTableTrTd1 = null;
- nsIDOMElement table1Tr2Td1Table2Tr1TdTableTrTd2 = null;
- nsIDOMElement table1Tr2Td1Table2Tr1TdTableTrTd2Img = null;
+ nsIDOMElement table1Tr2Td1Table2Tr1TdTableTrTd1 = null;
+ nsIDOMElement table1Tr2Td1Table2Tr1TdTableTrTd2 = null;
+ nsIDOMElement table1Tr2Td1Table2Tr1TdTableTrTd2Img = null;
nsIDOMElement table1Tr2Td1Table2Tr1TdTableTrTd3 = null;
-
- // sets css link
- ComponentUtil.setCSSLink(pageContext, CSS_FILE, "inputNumberSlider");
-
- // create table1
- table1 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
- addBasicTableAttributes(table1);
-
- // creates first row in table 1
- table1Tr1 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
- table1Tr1Td1 = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- table1Tr1Td1.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- MIN_VALUE_STALE_CLASS);
- table1Tr1Td1Text = visualDocument.createTextNode("0");
- table1Tr1Td2 = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- table1Tr1Td2.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- MAX_VALUE_STALE_CLASS);
- table1Tr1Td2Text = visualDocument.createTextNode("100");
- table1Tr1Td3 = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- table1Tr1Td3.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- TABLE_INPUT_CELL_STYLE);
- table1Tr1Td3.setAttribute(HtmlComponentUtil.HTML_ROWSPAN_ATTR, "2");
- table1Tr1Td3input = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_INPUT);
- table1Tr1Td3input.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- INPUT_STYLE_CLASS);
- table1Tr1Td3input.setAttribute(HtmlComponentUtil.HTML_SIZE_ATTR, "3");
- table1Tr1Td3input.setAttribute(HtmlComponentUtil.HTML_VALUE_ATTR, "50");
+
+ // sets css link
+ ComponentUtil.setCSSLink(pageContext, CSS_FILE, "inputNumberSlider");
+
+ // create table1
+ table1 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ addBasicTableAttributes(table1);
+
+ VpeCreationData creationData = new VpeCreationData(table1);
+
+ // creates first row in table 1
+ table1Tr1 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ table1Tr1Td1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ table1Tr1Td1.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ MIN_VALUE_STALE_CLASS);
+ table1Tr1Td1Text = visualDocument.createTextNode("0");
+ table1Tr1Td2 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ table1Tr1Td2.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ MAX_VALUE_STALE_CLASS);
+ table1Tr1Td2Text = visualDocument.createTextNode("100");
+ table1Tr1Td3 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ table1Tr1Td3.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ TABLE_INPUT_CELL_STYLE);
+ table1Tr1Td3.setAttribute(HtmlComponentUtil.HTML_ROWSPAN_ATTR, "2");
+ table1Tr1Td3input = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_INPUT);
+
+ table1Tr1Td3input.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ /* INPUT_STYLE_CLASS+ */"-moz-user-modify:read-write");
+
+// nsIDOMAttr newVisualDOMAttribute = visualDocument
+// .createAttribute("value");
+// newVisualDOMAttribute.setValue("50");
+// table1Tr1Td3input.appendChild(newVisualDOMAttribute);
+
+ // table1Tr1Td3input.setAttribute(HtmlComponentUtil.HTML_SIZE_ATTR,
+ // "3");
+ table1Tr1Td3input.setAttribute(HtmlComponentUtil.HTML_VALUE_ATTR,
+ "50");
+
+ creationData.setData(table1Tr1Td3input);
+
String positionStyle = "margin-left: 10px;";
- if(!rightInputPosition) {
+ if (!rightInputPosition) {
positionStyle = "margin-right: 10px;";
}
- table1Tr1Td3input.setAttribute("style", positionStyle +
ComponentUtil.getBackgoundImgStyle("inputNumberSlider/inputbg.gif"));
-
- table1Tr2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
- table1Tr2Td1 = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- table1Tr2Td1.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- CELL_FOR_TABLE_STYLE);
- table1Tr2Td1.setAttribute(HtmlComponentUtil.HTML_COLSPAN_ATTR, "2");
- table1Tr2Td1Table2 = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
- addBasicTableAttributes(table1Tr2Td1Table2);
-
- table1Tr2Td1Table2.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- INNER_TABLE_STYLE);
- table1Tr2Td1Table2.setAttribute(
- HtmlComponentUtil.HTML_CELLPADDING_ATTR, "1");
- table1Tr2Td1Table2.setAttribute(
- HtmlComponentUtil.HTML_CELLSPACING_ATTR, "0");
-
- table1Tr2Td1Table2Tr1 = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TR);
+ table1Tr1Td3input.setAttribute("style", positionStyle
+ + ComponentUtil
+ .getBackgoundImgStyle("inputNumberSlider/inputbg.gif"));
- table1Tr2Td1Table2Tr1Td = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TD);
- table1Tr2Td1Table2Tr1TdTable =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
- table1Tr2Td1Table2Tr1TdTable.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR,
"0");
- table1Tr2Td1Table2Tr1TdTable.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR,
"0");
- table1Tr2Td1Table2Tr1TdTable.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR,
"0");
+ table1Tr2 = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
+ table1Tr2Td1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ table1Tr2Td1.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ CELL_FOR_TABLE_STYLE);
+ table1Tr2Td1.setAttribute(HtmlComponentUtil.HTML_COLSPAN_ATTR, "2");
+ table1Tr2Td1Table2 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ addBasicTableAttributes(table1Tr2Td1Table2);
- table1Tr2Td1Table2Tr1TdTableTr =
visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
-
- table1Tr2Td1Table2Tr1TdTableTrTd1 = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- table1Tr2Td1Table2Tr1TdTableTrTd1.setAttribute(
- HtmlComponentUtil.HTML_CLASS_ATTR, "empty-cell-style");
+ table1Tr2Td1Table2.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ INNER_TABLE_STYLE);
+ table1Tr2Td1Table2.setAttribute(
+ HtmlComponentUtil.HTML_CELLPADDING_ATTR, "1");
+ table1Tr2Td1Table2.setAttribute(
+ HtmlComponentUtil.HTML_CELLSPACING_ATTR, "0");
- table1Tr2Td1Table2Tr1TdTableTrTd1.setAttribute("style",
ComponentUtil.getBackgoundImgStyle("inputNumberSlider/sliderbg.gif"));
+ table1Tr2Td1Table2Tr1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
- table1Tr2Td1Table2Tr1TdTableTrTd1.setAttribute(
- HtmlComponentUtil.HTML_WIDTH_ATTR, "50%");
-
- table1Tr2Td1Table2Tr1TdTableTrTd2 = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- table1Tr2Td1Table2Tr1TdTableTrTd2.setAttribute(
+ table1Tr2Td1Table2Tr1Td = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ table1Tr2Td1Table2Tr1TdTable = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TABLE);
+ table1Tr2Td1Table2Tr1TdTable.setAttribute(
+ HtmlComponentUtil.HTML_CELLPADDING_ATTR, "0");
+ table1Tr2Td1Table2Tr1TdTable.setAttribute(
+ HtmlComponentUtil.HTML_CELLSPACING_ATTR, "0");
+ table1Tr2Td1Table2Tr1TdTable.setAttribute(
+ HtmlComponentUtil.HTML_BORDER_ATTR, "0");
+
+ table1Tr2Td1Table2Tr1TdTableTr = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TR);
+
+ table1Tr2Td1Table2Tr1TdTableTrTd1 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ table1Tr2Td1Table2Tr1TdTableTrTd1.setAttribute(
+ HtmlComponentUtil.HTML_CLASS_ATTR, "empty-cell-style");
+
+ table1Tr2Td1Table2Tr1TdTableTrTd1.setAttribute("style", ComponentUtil
+ .getBackgoundImgStyle("inputNumberSlider/sliderbg.gif"));
+
+ table1Tr2Td1Table2Tr1TdTableTrTd1.setAttribute(
+ HtmlComponentUtil.HTML_WIDTH_ATTR, "50%");
+
+ table1Tr2Td1Table2Tr1TdTableTrTd2 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ table1Tr2Td1Table2Tr1TdTableTrTd2.setAttribute(
HtmlComponentUtil.HTML_CLASS_ATTR, "cell-with-picture");
- table1Tr2Td1Table2Tr1TdTableTrTd2.setAttribute("style",
ComponentUtil.getBackgoundImgStyle("inputNumberSlider/inputbg.gif"));
-
- table1Tr2Td1Table2Tr1TdTableTrTd2Img = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_IMG);
- ComponentUtil.setImg(table1Tr2Td1Table2Tr1TdTableTrTd2Img, IMAGE_SLIDER);
+ table1Tr2Td1Table2Tr1TdTableTrTd2.setAttribute("style", ComponentUtil
+ .getBackgoundImgStyle("inputNumberSlider/inputbg.gif"));
- table1Tr2Td1Table2Tr1TdTableTrTd3 = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- table1Tr2Td1Table2Tr1TdTableTrTd3.setAttribute(
- HtmlComponentUtil.HTML_CLASS_ATTR, "empty-cell-style");
+ table1Tr2Td1Table2Tr1TdTableTrTd2Img = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_IMG);
+ ComponentUtil
+ .setImg(table1Tr2Td1Table2Tr1TdTableTrTd2Img, IMAGE_SLIDER);
- table1Tr2Td1Table2Tr1TdTableTrTd3.setAttribute("style",
ComponentUtil.getBackgoundImgStyle("inputNumberSlider/sliderbg.gif"));
+ table1Tr2Td1Table2Tr1TdTableTrTd3 = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_TD);
+ table1Tr2Td1Table2Tr1TdTableTrTd3.setAttribute(
+ HtmlComponentUtil.HTML_CLASS_ATTR, "empty-cell-style");
- table1Tr2Td1Table2Tr1TdTableTrTd3.setAttribute(
- HtmlComponentUtil.HTML_WIDTH_ATTR, "50%");
-
- table1.appendChild(table1Tr1);
- table1.appendChild(table1Tr2);
+ table1Tr2Td1Table2Tr1TdTableTrTd3.setAttribute("style", ComponentUtil
+ .getBackgoundImgStyle("inputNumberSlider/sliderbg.gif"));
- if(rightInputPosition) {
+ table1Tr2Td1Table2Tr1TdTableTrTd3.setAttribute(
+ HtmlComponentUtil.HTML_WIDTH_ATTR, "50%");
+
+ table1.appendChild(table1Tr1);
+ table1.appendChild(table1Tr2);
+
+ if (rightInputPosition) {
table1Tr1.appendChild(table1Tr1Td1);
table1Tr1.appendChild(table1Tr1Td2);
table1Tr1.appendChild(table1Tr1Td3);
@@ -284,341 +316,359 @@
table1Tr1.appendChild(table1Tr1Td3);
table1Tr1.appendChild(table1Tr1Td1);
table1Tr1.appendChild(table1Tr1Td2);
- }
+ }
- table1Tr2.appendChild(table1Tr2Td1);
- table1Tr1Td1.appendChild(table1Tr1Td1Text);
- table1Tr1Td2.appendChild(table1Tr1Td2Text);
+ table1Tr2.appendChild(table1Tr2Td1);
+ table1Tr1Td1.appendChild(table1Tr1Td1Text);
+ table1Tr1Td2.appendChild(table1Tr1Td2Text);
- table1Tr1Td3.appendChild(table1Tr1Td3input);
+ table1Tr1Td3.appendChild(table1Tr1Td3input);
- table1Tr2Td1.appendChild(table1Tr2Td1Table2);
+ table1Tr2Td1.appendChild(table1Tr2Td1Table2);
table1Tr2Td1Table2.appendChild(table1Tr2Td1Table2Tr1);
table1Tr2Td1Table2Tr1.appendChild(table1Tr2Td1Table2Tr1Td);
table1Tr2Td1Table2Tr1Td.appendChild(table1Tr2Td1Table2Tr1TdTable);
- table1Tr2Td1Table2Tr1TdTable.appendChild(table1Tr2Td1Table2Tr1TdTableTr);
- table1Tr2Td1Table2Tr1TdTableTr.appendChild(table1Tr2Td1Table2Tr1TdTableTrTd1);
- table1Tr2Td1Table2Tr1TdTableTr.appendChild(table1Tr2Td1Table2Tr1TdTableTrTd2);
- table1Tr2Td1Table2Tr1TdTableTr.appendChild(table1Tr2Td1Table2Tr1TdTableTrTd3);
- table1Tr2Td1Table2Tr1TdTableTrTd2.appendChild(table1Tr2Td1Table2Tr1TdTableTrTd2Img);
-
- //
- // set a default values
- //
-
- Object[] inPatams = new Object[2];
- inPatams[0] = table1;
- inPatams[1] = sourceNode;
-
- for (Map.Entry<String, Method> e : mapAttributeToMethod.entrySet()) {
- Method function = e.getValue();
- if (function != null) {
- try {
- function.invoke(this, inPatams);
- } catch (IllegalArgumentException e1) {
- RichFacesTemplatesActivator.getPluginLog().logWarning("IllegalArgumentException:
" + e.getKey() + ":" + e1.getMessage(), e1);
- } catch (IllegalAccessException e2) {
- RichFacesTemplatesActivator.getPluginLog().logWarning("IllegalAccessException:
" + e.getKey() + ":" + e2.getMessage(), e2);
- } catch (InvocationTargetException e3) {
-// RichFacesTemplatesActivator.getPluginLog().logWarning("InvocationTargetException:
" + e3.getMessage(), e3);
- }
- }
- }
+ table1Tr2Td1Table2Tr1TdTable
+ .appendChild(table1Tr2Td1Table2Tr1TdTableTr);
+ table1Tr2Td1Table2Tr1TdTableTr
+ .appendChild(table1Tr2Td1Table2Tr1TdTableTrTd1);
+ table1Tr2Td1Table2Tr1TdTableTr
+ .appendChild(table1Tr2Td1Table2Tr1TdTableTrTd2);
+ table1Tr2Td1Table2Tr1TdTableTr
+ .appendChild(table1Tr2Td1Table2Tr1TdTableTrTd3);
+ table1Tr2Td1Table2Tr1TdTableTrTd2
+ .appendChild(table1Tr2Td1Table2Tr1TdTableTrTd2Img);
-
- VpeCreationData creationData = new VpeCreationData(table1);
- return creationData;
- }
+ //
+ // set a default values
+ //
+ Object[] inPatams = new Object[2];
+ inPatams[0] = table1;
+ inPatams[1] = sourceNode;
+
+ for (Map.Entry<String, Method> e : mapAttributeToMethod.entrySet()) {
+ Method function = e.getValue();
+ if (function != null) {
+ try {
+ function.invoke(this, inPatams);
+ } catch (IllegalArgumentException e1) {
+ RichFacesTemplatesActivator.getPluginLog().logWarning(
+ "IllegalArgumentException: " + e.getKey() + ":"
+ + e1.getMessage(), e1);
+ } catch (IllegalAccessException e2) {
+ RichFacesTemplatesActivator.getPluginLog().logWarning(
+ "IllegalAccessException: " + e.getKey() + ":"
+ + e2.getMessage(), e2);
+ } catch (InvocationTargetException e3) {
+ //
RichFacesTemplatesActivator.getPluginLog().logWarning("InvocationTargetException:
+ // " + e3.getMessage(), e3);
+ }
+ }
+ }
+
+ return creationData;
+ }
+
private void setInputPosition(Node sourceNode) {
String position = getAttribute("inputPosition", sourceNode);
rightInputPosition = !"left".equalsIgnoreCase(position);
}
- /**
- *
- * @see
com.exadel.vpe.editor.template.VpeAbstractTemplate#setAttribute(com.exadel.vpe.editor.context.VpePageContext,
- * org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
- * java.lang.Object, java.lang.String, java.lang.String)
+ /**
+ *
+ * @see
com.exadel.vpe.editor.template.VpeAbstractTemplate#setAttribute(com.exadel.vpe.editor.context.VpePageContext,
+ * org.w3c.dom.Element, org.w3c.dom.Document, org.w3c.dom.Node,
+ * java.lang.Object, java.lang.String, java.lang.String)
*/
- @Override
- public void setAttribute(VpePageContext pageContext, Element sourceElement,
nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data, String name, String
value) {
-
- Method function = mapAttributeToMethod.get(name);
- if (function != null) {
- Object[] inPatams = new Object[2];
- inPatams[0] = visualNode;
- inPatams[1] = sourceElement;
- try {
- function.invoke(this, inPatams);
- } catch (IllegalArgumentException e1) {
- RichFacesTemplatesActivator.getPluginLog().logWarning("IllegalArgumentException:
" + name + ":" + e1.getMessage() );
- } catch (IllegalAccessException e2) {
- RichFacesTemplatesActivator.getPluginLog().logWarning("IllegalAccessException:
" + name + ":" + e2.getMessage() );
- } catch (InvocationTargetException e3) {
-// RichFacesTemplatesActivator.getPluginLog().logWarning("InvocationTargetException:
" + name + ":"+ e3.getMessage() );
- }
+ @Override
+ public void setAttribute(VpePageContext pageContext, Element sourceElement,
+ nsIDOMDocument visualDocument, nsIDOMNode visualNode, Object data,
+ String name, String value) {
+
+ Method function = mapAttributeToMethod.get(name);
+ if (function != null) {
+ Object[] inPatams = new Object[2];
+ inPatams[0] = visualNode;
+ inPatams[1] = sourceElement;
+ try {
+ function.invoke(this, inPatams);
+ } catch (IllegalArgumentException e1) {
+ RichFacesTemplatesActivator.getPluginLog().logWarning(
+ "IllegalArgumentException: " + name + ":"
+ + e1.getMessage());
+ } catch (IllegalAccessException e2) {
+ RichFacesTemplatesActivator.getPluginLog().logWarning(
+ "IllegalAccessException: " + name + ":"
+ + e2.getMessage());
+ } catch (InvocationTargetException e3) {
+ //
RichFacesTemplatesActivator.getPluginLog().logWarning("InvocationTargetException:
+ // " + name + ":"+ e3.getMessage() );
+ }
}
-
- nsIDOMElement visualtElement = (nsIDOMElement)
visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- correctArrowPosition(sourceElement, visualtElement);
+
+ nsIDOMElement visualtElement = (nsIDOMElement) visualNode
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ correctArrowPosition(sourceElement, visualtElement);
}
-
- /**
- *
- */
- public String getDefaultInputSize() {
- return HTML_INPUTSIZE_DEFAULT;
- }
-
- /**
- *
- */
- public String getDefaultInputClass() {
- return INPUT_STYLE_CLASS;
- }
-
- /**
- * Sets some attributes which necessary for displaying table as tree
- *
- * @param tree
- */
- private void addBasicTableAttributes(nsIDOMElement table) {
- table.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, "0");
- table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, "0");
- table.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, "0");
- }
-
- /**
- *
- * @param visualNode
- * @return
- */
- private nsIDOMElement getInputElement(nsIDOMElement visualNode) {
- nsIDOMElement table = visualNode;
- nsIDOMNodeList tableList = table.getChildNodes();
- nsIDOMNode tr = tableList.item(0);
+
+ /**
+ *
+ */
+ public String getDefaultInputSize() {
+ return HTML_INPUTSIZE_DEFAULT;
+ }
+
+ /**
+ *
+ */
+ public String getDefaultInputClass() {
+ return INPUT_STYLE_CLASS;
+ }
+
+ /**
+ * Sets some attributes which necessary for displaying table as tree
+ *
+ * @param tree
+ */
+ private void addBasicTableAttributes(nsIDOMElement table) {
+ table.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, "0");
+ table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, "0");
+ table.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, "0");
+ }
+
+ /**
+ *
+ * @param visualNode
+ * @return
+ */
+ private nsIDOMElement getInputElement(nsIDOMElement visualNode) {
+ nsIDOMElement table = visualNode;
+ nsIDOMNodeList tableList = table.getChildNodes();
+ nsIDOMNode tr = tableList.item(0);
nsIDOMNodeList trList = tr.getChildNodes();
nsIDOMNode td1 = null;
- if(rightInputPosition) {
+ if (rightInputPosition) {
td1 = trList.item(2);
} else {
td1 = trList.item(0);
- }
- nsIDOMNodeList td1List = td1.getChildNodes();
- nsIDOMNode input = td1List.item(0);
- nsIDOMElement inputElement = (nsIDOMElement)
input.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- return inputElement;
- }
-
- /**
- *
- * @param visualNode
- * @return
- */
- private nsIDOMNode getMaxValueElement(nsIDOMElement visualNode) {
- nsIDOMElement table = visualNode;
- nsIDOMNodeList tableList = table.getChildNodes();
- nsIDOMNode tr = tableList.item(0);
- nsIDOMNodeList trList = tr.getChildNodes();
- nsIDOMNode td1 = trList.item(1);
- nsIDOMNodeList td1List = td1.getChildNodes();
+ }
+ nsIDOMNodeList td1List = td1.getChildNodes();
+ nsIDOMNode input = td1List.item(0);
+ nsIDOMElement inputElement = (nsIDOMElement) input
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ return inputElement;
+ }
+
+ /**
+ *
+ * @param visualNode
+ * @return
+ */
+ private nsIDOMNode getMaxValueElement(nsIDOMElement visualNode) {
+ nsIDOMElement table = visualNode;
+ nsIDOMNodeList tableList = table.getChildNodes();
+ nsIDOMNode tr = tableList.item(0);
+ nsIDOMNodeList trList = tr.getChildNodes();
+ nsIDOMNode td1 = trList.item(1);
+ nsIDOMNodeList td1List = td1.getChildNodes();
nsIDOMNode maxValue = td1List.item(0);
- return maxValue;
- }
-
- /**
- *
- * @param visualNode
- * @return
- */
- private nsIDOMNode getMinValueElement(nsIDOMElement visualNode) {
- nsIDOMElement table = visualNode;
- nsIDOMNodeList tableList = table.getChildNodes();
- nsIDOMNode tr = tableList.item(0);
- nsIDOMNodeList trList = tr.getChildNodes();
- nsIDOMNode td1 = trList.item(0);
- nsIDOMNodeList td1List = td1.getChildNodes();
+ return maxValue;
+ }
+
+ /**
+ *
+ * @param visualNode
+ * @return
+ */
+ private nsIDOMNode getMinValueElement(nsIDOMElement visualNode) {
+ nsIDOMElement table = visualNode;
+ nsIDOMNodeList tableList = table.getChildNodes();
+ nsIDOMNode tr = tableList.item(0);
+ nsIDOMNodeList trList = tr.getChildNodes();
+ nsIDOMNode td1 = trList.item(0);
+ nsIDOMNodeList td1List = td1.getChildNodes();
nsIDOMNode minValue = td1List.item(0);
- return minValue;
- }
-
- /**
- *
- * @param visualNode
- * @param sourceNode
- */
- public void showInput(nsIDOMElement visualNode, Element sourceNode) {
- nsIDOMElement input = getInputElement(visualNode);
- if (getAttribute(SLIDER_SHOWINPUT_ATTR, sourceNode).equalsIgnoreCase(
- "false")) {
- input.setAttribute(HtmlComponentUtil.HTML_TYPE_ATTR,
- HTML_INPUTTYPE_HIDDEN);
- } else {
- input.setAttribute(HtmlComponentUtil.HTML_TYPE_ATTR,
- HTML_INPUTTYPE_TEXT);
- }
- }
-
- /**
- *
- * @param visualNode
- * @param sourceNode
- */
- public void showBoundaryValues(nsIDOMElement visualNode, Element sourceNode) {
- setMaxValue(visualNode, sourceNode);
- setMinValue(visualNode, sourceNode);
- }
-
- /**
- *
- * @param visualNode
- * @param sourceNode
- */
- public void setInputSize(nsIDOMElement visualNode, Element sourceNode) {
- nsIDOMElement input = getInputElement(visualNode);
- if (input != null) {
- input.setAttribute("size", getInputSize(sourceNode));
- }
- }
-
- /**
- *
- * @param visualNode
- * @param sourceNode
- */
- public void setInputClass(nsIDOMElement visualNode, Element sourceNode) {
- nsIDOMElement input = getInputElement(visualNode);
- if (input != null) {
- String tmp = getInputClass(sourceNode);
- input.setAttribute("class", tmp);
- }
- }
-
- /**
- *
- * @param visualNode
- * @param sourceNode
- */
- public void setMaxValue(nsIDOMElement visualNode, Element sourceNode) {
- nsIDOMNode maxValue = getMaxValueElement(visualNode);
- if (maxValue != null) {
- if (getAttribute(SLIDER_SHOWBOUNDARY_ATTR, sourceNode)
- .equalsIgnoreCase("false")) {
- maxValue.setNodeValue("");
- } else {
- String tmp = getAttribute(SLIDER_MAXVALUE_ATTR, sourceNode);
-
- if (tmp.length() == 0) {
- maxValue.setNodeValue(SLIDER_MAXVALUE_DEFAULT);
- } else {
- maxValue.setNodeValue(tmp);
- }
- }
- }
- correctArrowPosition(sourceNode, visualNode);
- }
-
- /**
- *
- * @param visualNode
- * @param sourceNode
- */
- public void setMinValue(nsIDOMElement visualNode, Element sourceNode) {
- nsIDOMNode minValue = getMinValueElement(visualNode);
- if (minValue != null) {
- if (getAttribute(SLIDER_SHOWBOUNDARY_ATTR, sourceNode)
- .equalsIgnoreCase("false")) {
- minValue.setNodeValue("");
- } else {
- String tmp = getAttribute(SLIDER_MINVALUE_ATTR, sourceNode);
- if (tmp.length() == 0) {
- minValue.setNodeValue(SLIDER_MINVALUE_DEFAULT);
- } else {
- minValue.setNodeValue(tmp);
- }
- }
- }
- correctArrowPosition(sourceNode, visualNode);
- }
-
- /**
- *
- * @param visualNode
- * @param sourceNode
- */
- public void setWidth(nsIDOMElement visualNode, Element sourceNode) {
- nsIDOMElement table = visualNode;
- String tmp = getAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, sourceNode);
- if (tmp.length() == 0) {
- tmp = parseStyleWidth(sourceNode);
- }
- if (tmp.length() == 0) {
- table.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, "200px;");
- } else {
- table.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, tmp);
- }
- }
-
- /**
- *
- * @param visualNode
- * @param sourceNode
- */
- public void setStyle(nsIDOMElement visualNode, Element sourceNode) {
- /*
- * Element table= visualNode; String tmp =
- * getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,sourceNode);
- */
-
- }
-
- /**
- * Corrects arrow position accordinlye max, min and inputValues
- *
- * @param sourceNode
- * @param visualElement
- */
- private void correctArrowPosition(Element sourceNode, nsIDOMElement visualElement) {
-
- String minValue = sourceNode.getAttribute(SLIDER_MINVALUE_ATTR);
- String maxValue = sourceNode.getAttribute(SLIDER_MAXVALUE_ATTR);
- String valueValue = sourceNode.getAttribute(SLIDER_VALUE_ATTR);
- String stepValue = sourceNode.getAttribute(SLIDER_STEP_ATTR);
- double min = 0;
- double max = 0;
- double value = 50;
- double step = 1;
- try {
- min = Integer.parseInt(minValue);
- } catch (NumberFormatException ex) {
- min = 0;
- }
- try {
- max = Integer.parseInt(maxValue);
- } catch (NumberFormatException ex) {
- max = 100;
- }
-
- try {
- value = Integer.parseInt(valueValue);
- } catch (NumberFormatException ex) {
- value = 50;
- }
- try {
- step = Integer.parseInt(stepValue);
- if (step < 1) {
- step=1;
- }
- } catch (NumberFormatException ex) {
- step = 1;
- }
- double h1 = ((roundForStep(step, value) - min) / (max - min)) * 100;
+ return minValue;
+ }
+
+ /**
+ *
+ * @param visualNode
+ * @param sourceNode
+ */
+ public void showInput(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMElement input = getInputElement(visualNode);
+ if (getAttribute(SLIDER_SHOWINPUT_ATTR, sourceNode).equalsIgnoreCase(
+ "false")) {
+ input.setAttribute(HtmlComponentUtil.HTML_TYPE_ATTR,
+ HTML_INPUTTYPE_HIDDEN);
+ } else {
+ input.setAttribute(HtmlComponentUtil.HTML_TYPE_ATTR,
+ HTML_INPUTTYPE_TEXT);
+ }
+ }
+
+ /**
+ *
+ * @param visualNode
+ * @param sourceNode
+ */
+ public void showBoundaryValues(nsIDOMElement visualNode, Element sourceNode) {
+ setMaxValue(visualNode, sourceNode);
+ setMinValue(visualNode, sourceNode);
+ }
+
+ /**
+ *
+ * @param visualNode
+ * @param sourceNode
+ */
+ public void setInputSize(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMElement input = getInputElement(visualNode);
+ if (input != null) {
+ input.setAttribute("size", getInputSize(sourceNode));
+ }
+ }
+
+ /**
+ *
+ * @param visualNode
+ * @param sourceNode
+ */
+ public void setInputClass(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMElement input = getInputElement(visualNode);
+ if (input != null) {
+ String tmp = getInputClass(sourceNode);
+ input.setAttribute("class", tmp);
+ }
+ }
+
+ /**
+ *
+ * @param visualNode
+ * @param sourceNode
+ */
+ public void setMaxValue(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMNode maxValue = getMaxValueElement(visualNode);
+ if (maxValue != null) {
+ if (getAttribute(SLIDER_SHOWBOUNDARY_ATTR, sourceNode)
+ .equalsIgnoreCase("false")) {
+ maxValue.setNodeValue("");
+ } else {
+ String tmp = getAttribute(SLIDER_MAXVALUE_ATTR, sourceNode);
+
+ if (tmp.length() == 0) {
+ maxValue.setNodeValue(SLIDER_MAXVALUE_DEFAULT);
+ } else {
+ maxValue.setNodeValue(tmp);
+ }
+ }
+ }
+ correctArrowPosition(sourceNode, visualNode);
+ }
+
+ /**
+ *
+ * @param visualNode
+ * @param sourceNode
+ */
+ public void setMinValue(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMNode minValue = getMinValueElement(visualNode);
+ if (minValue != null) {
+ if (getAttribute(SLIDER_SHOWBOUNDARY_ATTR, sourceNode)
+ .equalsIgnoreCase("false")) {
+ minValue.setNodeValue("");
+ } else {
+ String tmp = getAttribute(SLIDER_MINVALUE_ATTR, sourceNode);
+ if (tmp.length() == 0) {
+ minValue.setNodeValue(SLIDER_MINVALUE_DEFAULT);
+ } else {
+ minValue.setNodeValue(tmp);
+ }
+ }
+ }
+ correctArrowPosition(sourceNode, visualNode);
+ }
+
+ /**
+ *
+ * @param visualNode
+ * @param sourceNode
+ */
+ public void setWidth(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMElement table = visualNode;
+ String tmp = getAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, sourceNode);
+ if (tmp.length() == 0) {
+ tmp = parseStyleWidth(sourceNode);
+ }
+ if (tmp.length() == 0) {
+ table.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, "200px;");
+ } else {
+ table.setAttribute(HtmlComponentUtil.HTML_WIDTH_ATTR, tmp);
+ }
+ }
+
+ /**
+ *
+ * @param visualNode
+ * @param sourceNode
+ */
+ public void setStyle(nsIDOMElement visualNode, Element sourceNode) {
+ /*
+ * Element table= visualNode; String tmp =
+ * getAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,sourceNode);
+ */
+
+ }
+
+ /**
+ * Corrects arrow position accordinlye max, min and inputValues
+ *
+ * @param sourceNode
+ * @param visualElement
+ */
+ private void correctArrowPosition(Element sourceNode,
+ nsIDOMElement visualElement) {
+
+ String minValue = sourceNode.getAttribute(SLIDER_MINVALUE_ATTR);
+ String maxValue = sourceNode.getAttribute(SLIDER_MAXVALUE_ATTR);
+ String valueValue = sourceNode.getAttribute(SLIDER_VALUE_ATTR);
+ String stepValue = sourceNode.getAttribute(SLIDER_STEP_ATTR);
+ double min = 0;
+ double max = 0;
+ double value = 50;
+ double step = 1;
+ try {
+ min = Integer.parseInt(minValue);
+ } catch (NumberFormatException ex) {
+ min = 0;
+ }
+ try {
+ max = Integer.parseInt(maxValue);
+ } catch (NumberFormatException ex) {
+ max = 100;
+ }
+
+ try {
+ value = Integer.parseInt(valueValue);
+ } catch (NumberFormatException ex) {
+ value = 50;
+ }
+ try {
+ step = Integer.parseInt(stepValue);
+ if (step < 1) {
+ step = 1;
+ }
+ } catch (NumberFormatException ex) {
+ step = 1;
+ }
+ double h1 = ((roundForStep(step, value) - min) / (max - min)) * 100;
double h2 = 100 - h1;
nsIDOMNodeList nodeList = visualElement.getChildNodes();
- nsIDOMNode node_01 = nodeList.item(1);
+ nsIDOMNode node_01 = nodeList.item(1);
nsIDOMNodeList nodeList_01 = node_01.getChildNodes();
nsIDOMNode node_01_00 = nodeList_01.item(0);
nsIDOMNodeList nodeList_01_00 = node_01_00.getChildNodes();
@@ -628,76 +678,81 @@
nsIDOMNodeList nodeList_01_00_00_00 = node_01_00_00_00.getChildNodes();
nsIDOMNode node_01_00_00_00_00 = nodeList_01_00_00_00.item(0);
nsIDOMNode node_01_00_00_00_02 = nodeList_01_00_00_00.item(2);
-
- nsIDOMElement table1Tr2Td1Table2Tr1Td1 =
(nsIDOMElement)node_01_00_00_00_00.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- table1Tr2Td1Table2Tr1Td1.setAttribute(
+
+ nsIDOMElement table1Tr2Td1Table2Tr1Td1 = (nsIDOMElement) node_01_00_00_00_00
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ table1Tr2Td1Table2Tr1Td1.setAttribute(
HtmlComponentUtil.HTML_WIDTH_ATTR, (int) h1 + "%");
- if(node_01_00_00_00_02!=null) {
- nsIDOMElement table1Tr2Td1Table2Tr1Td2 =
(nsIDOMElement)node_01_00_00_00_02.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- table1Tr2Td1Table2Tr1Td2.setAttribute(
- HtmlComponentUtil.HTML_WIDTH_ATTR, (int) h2 + "%");
- }
- }
-
- /**
- * Round result accordinly step
- *
- * @param step
- * @param value
- * @return
- */
- private double roundForStep(double step, double value) {
- return Math.round(value / step) * step;
- }
-
- /**
- *
- * @param visualNode
- * @param sourceNode
- */
- public void setClass(nsIDOMElement visualNode, Element sourceNode) {
- nsIDOMElement table = visualNode;
- String tmp = getAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, sourceNode);
- table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- new StringBuffer().append(tmp).toString());
- }
-
- /**
- *
- * @param visualNode
- * @param sourceNode
- */
- public void setInputValue(nsIDOMElement visualNode, Element sourceNode) {
- nsIDOMElement input = getInputElement(visualNode);
- if (input != null) {
- String tmp = getAttribute("value", sourceNode);
- if (tmp.length() == 0) {
- input.setAttribute("value", HTML_INPUTVALUE_DEFAULT);
- } else {
- input.setAttribute("value", tmp);
- }
- }
- correctArrowPosition(sourceNode, visualNode);
- }
-
- /**
- *
- * @param visualNode
- * @param sourceNode
- */
- public void setInputStyle(nsIDOMElement visualNode, Element sourceNode) {
- nsIDOMElement input = getInputElement(visualNode);
- if (input != null) {
- String tmp = getAttribute("inputStyle", sourceNode);
- String style = getAttribute("style", (Element)input);
- if(style!=null) {
- input.setAttribute("style", tmp + style);
+ if (node_01_00_00_00_02 != null) {
+ nsIDOMElement table1Tr2Td1Table2Tr1Td2 = (nsIDOMElement) node_01_00_00_00_02
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ table1Tr2Td1Table2Tr1Td2.setAttribute(
+ HtmlComponentUtil.HTML_WIDTH_ATTR, (int) h2 + "%");
+ }
+ }
+
+ /**
+ * Round result accordinly step
+ *
+ * @param step
+ * @param value
+ * @return
+ */
+ private double roundForStep(double step, double value) {
+ return Math.round(value / step) * step;
+ }
+
+ /**
+ *
+ * @param visualNode
+ * @param sourceNode
+ */
+ public void setClass(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMElement table = visualNode;
+ String tmp = getAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, sourceNode);
+ table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ new StringBuffer().append(tmp).toString());
+ }
+
+ /**
+ *
+ * @param visualNode
+ * @param sourceNode
+ */
+ public void setInputValue(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMElement input = getInputElement(visualNode);
+ if (input != null) {
+ String tmp = getAttribute("value", sourceNode);
+ if (tmp.length() == 0) {
+ // input.setAttribute("value", HTML_INPUTVALUE_DEFAULT);
+ input.getAttributeNode("value").setNodeValue(
+ HTML_INPUTVALUE_DEFAULT);
} else {
+ // input.setAttribute("value", tmp);
+ input.getAttributeNode("value").setNodeValue(tmp);
+ }
+ }
+ correctArrowPosition(sourceNode, visualNode);
+ }
+
+ /**
+ *
+ * @param visualNode
+ * @param sourceNode
+ */
+ public void setInputStyle(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMElement input = getInputElement(visualNode);
+ if (input != null) {
+ String tmp = getAttribute("inputStyle", sourceNode);
+ String style = getAttribute("style", (Element) input);
+ if (style != null) {
+ input.setAttribute("style", tmp + style);
+ } else {
input.setAttribute("style", tmp);
}
- }
- }
+ }
+ }
/**
*
@@ -706,24 +761,43 @@
*/
public void setInputPosition(nsIDOMElement visualNode, Element sourceNode) {
}
-
- /**
- *
- * @param visualNode
- * @param sourceNode
- */
- public void setMaxlength(nsIDOMElement visualNode, Element sourceNode) {
- nsIDOMElement input = getInputElement(visualNode);
- if (input != null) {
- String tmp = getAttribute("maxlength", sourceNode);
- input.setAttribute("maxlength", tmp);
- }
+
+ /**
+ *
+ * @param visualNode
+ * @param sourceNode
+ */
+ public void setMaxlength(nsIDOMElement visualNode, Element sourceNode) {
+ nsIDOMElement input = getInputElement(visualNode);
+ if (input != null) {
+ String tmp = getAttribute("maxlength", sourceNode);
+ input.setAttribute("maxlength", tmp);
+ }
}
@Override
public boolean isRecreateAtAttrChange(VpePageContext pageContext,
Element sourceElement, nsIDOMDocument visualDocument,
nsIDOMElement visualNode, Object data, String name, String value) {
- return true;
- }
+ return true;
+ }
+
+ @Override
+ public void setSourceAttributeSelection(VpePageContext pageContext,
+ Element sourceElement, int offset, int length, Object data) {
+ System.out.print("\n sourceElement:" + sourceElement.getNodeName()
+ + "\toffset:" + offset + "\tlength:" + length + "\tdata :
"
+ + data);
+ VpeSourceDomBuilder sourceBuilder = pageContext.getSourceBuilder();
+ sourceBuilder.setAttributeSelection(sourceElement.getAttributeNode("value"),
offset, length);
+ super.setSourceAttributeSelection(pageContext, sourceElement, offset,
+ length, data);
+ }
+ @Override
+ public void refreshBundleValues(VpePageContext pageContext,
+ Element sourceElement, Object data) {
+ System.out.print("\nrefresh");
+ // TODO Auto-generated method stub
+ super.refreshBundleValues(pageContext, sourceElement, data);
+ }
}
\ No newline at end of file
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesListShuttleTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesListShuttleTemplate.java 2008-01-23
06:32:12 UTC (rev 5905)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesListShuttleTemplate.java 2008-01-23
09:13:18 UTC (rev 5906)
@@ -24,9 +24,11 @@
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
/**
* @author Sergey Dzmitrovich
@@ -34,7 +36,13 @@
*/
public class RichFacesListShuttleTemplate extends VpeAbstractTemplate {
+ private static final String ATTR_CONTROLS_TYPE = "controlsType";
/**
+ *
+ */
+ private static final String ATTR_SHOW_BUTTON_LABELS = "showButtonLabels";
+
+ /**
* source caption key
*/
private static final String SOURCE_CAPTION = "sourceCaption";
@@ -50,6 +58,16 @@
private static final String STYLE_PATH = "shuttle/shuttle.css";
/**
+ * path to img
+ */
+ private static final String BUTTON_IMG_PATH = "shuttle/button.gif";
+
+ /**
+ * path to img
+ */
+ private static final String HEADER_IMG_PATH = "shuttle/button.gif";
+
+ /**
* default value of width of box(list)
*/
private static final String DEFAULT_LIST_WIDTH = "140px";
@@ -60,6 +78,16 @@
private static final String DEFAULT_LIST_HEIGHT = "140px";
/**
+ * rowClasses attribute name
+ */
+ private static final String ATTR_ROW_CLASSES = "rowClasses";
+
+ /**
+ * columnClasses attribute name
+ */
+ private static final String ATTR_COLUMN_CLASSES = "columnClasses";
+
+ /**
* attribute name of width of source list
*/
private static final String ATTR_SOURCE_LIST_WIDTH = "sourceListWidth";
@@ -138,6 +166,57 @@
}
/**
+ * style classes
+ */
+ private static final Map<String, String> defaultStyleClasses;
+
+ static {
+ defaultStyleClasses = new HashMap<String, String>();
+
+ // general style
+ defaultStyleClasses.put("style", "rich-list-shuttle");
+
+ // styles of the lists
+ defaultStyleClasses.put("list-header",
"rich-shuttle-list-header");
+ defaultStyleClasses.put("list", "rich-shuttle-list-content");
+
+ // styles of button's block
+ defaultStyleClasses.put("controls", "rich-shuttle-controls");
+
+ // styles of the first set of buttons
+ defaultStyleClasses.put("copyAllControl",
+ "rich-shuttle-button rich-shuttle-copyAll");
+ defaultStyleClasses.put("copyControl",
+ "rich-shuttle-button rich-shuttle-copy");
+ defaultStyleClasses.put("removeControl",
+ "rich-shuttle-button rich-shuttle-remove");
+ defaultStyleClasses.put("removeAllControl",
+ "rich-shuttle-button rich-shuttle-removeAll");
+
+ // styles of the second set of buttons
+ defaultStyleClasses.put("topControl",
+ "rich-shuttle-button rich-shuttle-top");
+ defaultStyleClasses.put("upControl",
+ "rich-shuttle-button rich-shuttle-up");
+ defaultStyleClasses.put("downControl",
+ "rich-shuttle-button rich-shuttle-down");
+ defaultStyleClasses.put("bottomControl",
+ "rich-shuttle-button rich-shuttle-bottom");
+
+ // styles of captions
+ defaultStyleClasses.put("sourceCaption",
"rich-shuttle-source-caption");
+ defaultStyleClasses.put("targetCaption",
"rich-shuttle-target-caption");
+
+ // styles of rows
+ defaultStyleClasses.put("sourceRow", "rich-shuttle-source-row");
+ defaultStyleClasses.put("targetRow", "rich-shuttle-target-row");
+
+ // styles of rows
+ defaultStyleClasses.put("columns", "");
+
+ }
+
+ /**
* default labels
*/
private static final Map<String, String> defaultLabels;
@@ -225,6 +304,11 @@
private final List<String> targetButtons = new ArrayList<String>();
/**
+ *
+ */
+ private static final Map<String, String> styleClasses = new HashMap<String,
String>();
+
+ /**
* value of vertical-align attribute for source (copy/remove) buttons
*/
private String sourceButtonsAlign;
@@ -250,8 +334,28 @@
private String targetListsWidth;
/**
+ * row style class
+ */
+ private String rowClass;
+
+ /**
+ * column style class
+ */
+ private List<String> columnClasses;
+
+ /**
+ * facetLabels
+ */
+ private final Map<String, Node> facetLabels = new HashMap<String, Node>();
+
+ /**
*
*/
+ private boolean isShowButtonLabels;
+
+ /**
+ *
+ */
public RichFacesListShuttleTemplate() {
}
@@ -292,11 +396,14 @@
// create table element
nsIDOMElement basicTable = visualDocument.createElement(HTML.TAG_TABLE);
- ComponentUtil.copyAttributes(sourceNode, basicTable);
+ // ComponentUtil.copyAttributes(sourceNode, basicTable);
+
+ basicTable.setAttribute("class", styleClasses.get("style"));
+
VpeCreationData creationData = new VpeCreationData(basicTable);
// create caption
- nsIDOMElement caption = createCaption(visualDocument);
+ nsIDOMElement caption = createCaption(visualDocument, creationData);
if (caption != null)
basicTable.appendChild(caption);
@@ -306,7 +413,7 @@
// create source box
nsIDOMElement sourceBoxTd = visualDocument.createElement(HTML.TAG_TD);
nsIDOMElement sourceBox = createBox(visualDocument, creationData,
- children);
+ children, "source");
sourceBox.setAttribute(HTML.ATTR_STYLE, "width:" + sourceListsWidth
+ ";height:" + listsHeight + ";");
sourceBoxTd.appendChild(sourceBox);
@@ -315,7 +422,7 @@
nsIDOMElement sourceButtonsTd = visualDocument
.createElement(HTML.TAG_TD);
nsIDOMElement sourceButtonsBlock = createButtonsBlock(visualDocument,
- sourceButtons);
+ creationData, sourceButtons);
sourceButtonsTd.appendChild(sourceButtonsBlock);
// set vertical-align attribute for source buttons
@@ -325,7 +432,7 @@
// create target box
nsIDOMElement targetBoxTd = visualDocument.createElement(HTML.TAG_TD);
nsIDOMElement targetBox = createBox(visualDocument, creationData,
- children);
+ children, "target");
targetBox.setAttribute(HTML.ATTR_STYLE, "width:" + targetListsWidth
+ ";height:" + listsHeight + ";");
targetBoxTd.appendChild(targetBox);
@@ -334,7 +441,7 @@
nsIDOMElement targetButtonsTd = visualDocument
.createElement(HTML.TAG_TD);
nsIDOMElement targetButtonsBlock = createButtonsBlock(visualDocument,
- targetButtons);
+ creationData, targetButtons);
targetButtonsTd.appendChild(targetButtonsBlock);
// set vertical-align attribute for target buttons
@@ -350,6 +457,8 @@
// add "tr" to table
basicTable.appendChild(basicTr);
+ clearData();
+
return creationData;
}
@@ -361,24 +470,29 @@
* @param sourceCaptionLabel
* @param targetCaptionLabel
* @param visualDocument
+ * @param creationData
+ * @param sourceElement
* @return
*/
- private nsIDOMElement createCaption(nsIDOMDocument visualDocument) {
+ private nsIDOMElement createCaption(nsIDOMDocument visualDocument,
+ VpeCreationData creationData) {
// check sourceCaptionLabel
if ((labels.get(SOURCE_CAPTION).length() == 0)
- && (labels.get(TARGET_CAPTION).length() == 0))
+ && (!facetLabels.containsKey(SOURCE_CAPTION))
+ && (labels.get(TARGET_CAPTION).length() == 0)
+ && (!facetLabels.containsKey(TARGET_CAPTION)))
return null;
// basic element for caption is "tr" tag
nsIDOMElement caption = visualDocument.createElement(HTML.TAG_TR);
// create source caption label
- caption.appendChild(createCaptionLabel(visualDocument, labels
- .get(SOURCE_CAPTION)));
+ caption.appendChild(createCaptionLabel(visualDocument, creationData,
+ SOURCE_CAPTION));
// create target caption label
- caption.appendChild(createCaptionLabel(visualDocument, labels
- .get(TARGET_CAPTION)));
+ caption.appendChild(createCaptionLabel(visualDocument, creationData,
+ TARGET_CAPTION));
return caption;
@@ -388,11 +502,13 @@
* create caption label
*
* @param visualDocument
+ * @param creationData
+ * @param sourceElement
* @param label
* @return
*/
private nsIDOMElement createCaptionLabel(nsIDOMDocument visualDocument,
- String label) {
+ VpeCreationData creationData, String labelId) {
// create "td" for target caption label
nsIDOMElement captionLabelTd = visualDocument
@@ -400,14 +516,25 @@
// set attributes
captionLabelTd.setAttribute(HTML.ATTR_COLSPAN, "2");
- captionLabelTd.setAttribute(HTML.ATTR_CLASS,
- "rich-shuttle-caption-label");
+ captionLabelTd.setAttribute(HTML.ATTR_CLASS, styleClasses.get(labelId));
+ // if facet is defined for this label add facet to "td"
+ if (facetLabels.containsKey(labelId)) {
+
+ VpeChildrenInfo captionLabelTdInfo = new VpeChildrenInfo(
+ captionLabelTd);
+ creationData.addChildrenInfo(captionLabelTdInfo);
+
+ captionLabelTdInfo.addSourceChild(facetLabels.get(labelId));
+ }
// add to "td" value of captionLabel
- nsIDOMText captionLabelText = visualDocument.createTextNode(label);
+ else {
+ nsIDOMText captionLabelText = visualDocument.createTextNode(labels
+ .get(labelId));
- captionLabelTd.appendChild(captionLabelText);
+ captionLabelTd.appendChild(captionLabelText);
+ }
return captionLabelTd;
}
@@ -420,17 +547,21 @@
* @return
*/
private nsIDOMElement createBox(nsIDOMDocument visualDocument,
- VpeCreationData creationData, List<Node> children) {
+ VpeCreationData creationData, List<Node> children, String boxId) {
nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
- div.setAttribute(HTML.ATTR_CLASS, "rich-shuttle-box");
+ div.setAttribute(HTML.ATTR_CLASS, styleClasses.get("list"));
// create table element
nsIDOMElement box = visualDocument.createElement(HTML.TAG_TABLE);
- // box.setAttribute(HTML.ATTR_CLASS, "rich-shuttle-box");
+ box.setAttribute("cellspacing", "0");
+ box.setAttribute("cellpadding", "0");
+ box.setAttribute("width", "100%");
// create "tr" for box
nsIDOMElement tr = visualDocument.createElement(HTML.TAG_TR);
tr.setAttribute(HTML.ATTR_STYLE, "vertical-align:top");
+ tr.setAttribute(HTML.ATTR_CLASS, styleClasses.get(boxId + "Row") + "
"
+ + rowClass);
VpeChildrenInfo trInfo = new VpeChildrenInfo(tr);
creationData.addChildrenInfo(trInfo);
@@ -452,20 +583,22 @@
* create buttons block
*
* @param visualDocument
+ * @param creationData
* @param buttonNames
* @return
*/
private nsIDOMElement createButtonsBlock(nsIDOMDocument visualDocument,
- List<String> buttonNames) {
+ VpeCreationData creationData, List<String> buttonNames) {
// create "div"
nsIDOMElement buttonsBlock = visualDocument.createElement(HTML.TAG_DIV);
- buttonsBlock.setAttribute(HTML.ATTR_CLASS, "rich-shuttle-controls");
+ buttonsBlock
+ .setAttribute(HTML.ATTR_CLASS, styleClasses.get("controls"));
for (String buttonId : buttonNames) {
- buttonsBlock.appendChild(createButton(visualDocument, labels
- .get(buttonId), buttonImages.get(buttonId)));
+ buttonsBlock.appendChild(createButton(visualDocument, creationData,
+ buttonId));
}
@@ -477,44 +610,57 @@
* create button
*
* @param visualDocument
+ * @param creationData
* @param buttonValue
* @param buttonImage
* @return
*/
private nsIDOMElement createButton(nsIDOMDocument visualDocument,
- String buttonValue, String buttonImageFile) {
+ VpeCreationData creationData, String buttonId) {
nsIDOMElement buttonSpace = visualDocument.createElement(HTML.TAG_DIV);
buttonSpace.setAttribute(HTML.ATTR_CLASS, "rich-shuttle-control");
- // button represent "div" element
- nsIDOMElement button = visualDocument.createElement(HTML.TAG_DIV);
- button.setAttribute(HTML.ATTR_CLASS, "rich-shuttle-button");
- button.setAttribute(HTML.ATTR_STYLE, ComponentUtil
- .getBackgoundImgStyle("shuttle/button.gif"));
+ if (facetLabels.containsKey(buttonId)) {
- // button represent "div" element
- nsIDOMElement buttonContent = visualDocument
- .createElement(HTML.TAG_DIV);
- buttonContent.setAttribute(HTML.ATTR_CLASS,
- "rich-shuttle-button-content");
+ VpeChildrenInfo buttonInfo = new VpeChildrenInfo(buttonSpace);
+ creationData.addChildrenInfo(buttonInfo);
- nsIDOMElement buttonImage = visualDocument.createElement(HTML.TAG_IMG);
+ buttonInfo.addSourceChild(facetLabels.get(buttonId));
- buttonImage.setAttribute(HTML.ATTR_WIDTH, "15");
- buttonImage.setAttribute(HTML.ATTR_HEIGHT, "15");
- buttonImage
- .setAttribute(HTML.ATTR_CLASS, "rich-shuttle-button-content");
- ComponentUtil.setImg(buttonImage, buttonImageFile);
+ } else {
+ // button represent "div" element
+ nsIDOMElement button = visualDocument.createElement(HTML.TAG_DIV);
+ button.setAttribute(HTML.ATTR_CLASS, styleClasses.get(buttonId));
+ button.setAttribute(HTML.ATTR_STYLE, ComponentUtil
+ .getBackgoundImgStyle(BUTTON_IMG_PATH));
+ // button represent "div" element
+ nsIDOMElement buttonContent = visualDocument
+ .createElement(HTML.TAG_DIV);
+ buttonContent.setAttribute(HTML.ATTR_CLASS,
+ "rich-shuttle-button-content");
- nsIDOMText buttonText = visualDocument.createTextNode(buttonValue);
+ nsIDOMElement buttonImage = visualDocument
+ .createElement(HTML.TAG_IMG);
- buttonContent.appendChild(buttonImage);
- buttonContent.appendChild(buttonText);
+ buttonImage.setAttribute(HTML.ATTR_WIDTH, "15");
+ buttonImage.setAttribute(HTML.ATTR_HEIGHT, "15");
+ buttonImage.setAttribute(HTML.ATTR_CLASS,
+ "rich-shuttle-button-content");
+ ComponentUtil.setImg(buttonImage, buttonImages.get(buttonId));
+ buttonContent.appendChild(buttonImage);
- button.appendChild(buttonContent);
- buttonSpace.appendChild(button);
+ if (isShowButtonLabels) {
+ nsIDOMText buttonText = visualDocument.createTextNode(labels
+ .get(buttonId));
+ buttonContent.appendChild(buttonText);
+ }
+
+ button.appendChild(buttonContent);
+
+ buttonSpace.appendChild(button);
+ }
return buttonSpace;
}
@@ -527,38 +673,82 @@
void prepareData(Element sourceElement) {
// prepare labels
- labels.clear();
+ Set<String> labelsKeys = defaultLabels.keySet();
- Set<String> labelsKeys = defaultLabels.keySet();
+ isShowButtonLabels = !"false".equalsIgnoreCase(sourceElement
+ .getAttribute(ATTR_SHOW_BUTTON_LABELS));
+
for (String key : labelsKeys) {
String label = sourceElement.getAttribute(key + "Label");
+
if (label != null)
labels.put(key, label);
else
labels.put(key, defaultLabels.get(key));
}
- // prepare source buttons
- sourceButtons.clear();
- if (!"false".equalsIgnoreCase(sourceElement
- .getAttribute(ATTR_FAST_MOVE_CONTROLS_VIZIBLE)))
- sourceButtons.addAll(fastMoveButtons);
- if (!"false".equalsIgnoreCase(sourceElement
- .getAttribute(ATTR_MOVE_CONTROLS_VIZIBLE)))
- sourceButtons
- .addAll(sourceButtons.size() == 0 ? 0 : 1, moveButtons);
+ // prepare style classes
+ Set<String> styleClassesKeys = defaultStyleClasses.keySet();
+ for (String key : styleClassesKeys) {
- // prepare target buttons
- targetButtons.clear();
- if (!"false".equalsIgnoreCase(sourceElement
- .getAttribute(ATTR_FAST_ORDER_CONTROLS_VIZIBLE)))
- targetButtons.addAll(fastOrderButtons);
- if (!"false".equalsIgnoreCase(sourceElement
- .getAttribute(ATTR_ORDER_CONTROLS_VIZIBLE)))
- targetButtons.addAll(targetButtons.size() == 0 ? 0 : 1,
- orderButtons);
+ String styleClass = sourceElement.getAttribute(key + "Class");
+ if (styleClass != null)
+ styleClasses.put(key, defaultStyleClasses.get(key) + " "
+ + styleClass);
+ else
+ styleClasses.put(key, defaultStyleClasses.get(key));
+ }
+ // prepare facets
+ NodeList children = sourceElement.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+
+ Node child = children.item(i);
+
+ if ((child instanceof Element)
+ && ("facet".equals(child.getLocalName()))
+ && (defaultLabels.containsKey(((Element) child)
+ .getAttribute("name")))) {
+
+ facetLabels.put(((Element) child).getAttribute("name"), child);
+
+ }
+
+ }
+
+ // get rowClass
+ String rowClasses = sourceElement.getAttribute(ATTR_ROW_CLASSES);
+
+ // if this attribue exist then
+ if (rowClasses != null) {
+ rowClass = rowClasses.split(",")[0];
+ }
+
+ // if "controlsType" attribute is not "none" (if buttons are
visible)
+ if (!"none".equalsIgnoreCase(sourceElement
+ .getAttribute(ATTR_CONTROLS_TYPE))) {
+
+ // prepare source buttons
+ if (!"false".equalsIgnoreCase(sourceElement
+ .getAttribute(ATTR_FAST_MOVE_CONTROLS_VIZIBLE)))
+ sourceButtons.addAll(fastMoveButtons);
+ if (!"false".equalsIgnoreCase(sourceElement
+ .getAttribute(ATTR_MOVE_CONTROLS_VIZIBLE)))
+ sourceButtons.addAll(sourceButtons.size() == 0 ? 0 : 1,
+ moveButtons);
+
+ // prepare target buttons
+ if (!"false".equalsIgnoreCase(sourceElement
+ .getAttribute(ATTR_FAST_ORDER_CONTROLS_VIZIBLE)))
+ targetButtons.addAll(fastOrderButtons);
+ if (!"false".equalsIgnoreCase(sourceElement
+ .getAttribute(ATTR_ORDER_CONTROLS_VIZIBLE)))
+ targetButtons.addAll(targetButtons.size() == 0 ? 0 : 1,
+ orderButtons);
+
+ }
+
// prepare buttons attributes
sourceButtonsAlign = sourceElement
.getAttribute(ATTR_MOVE_CONTROLS_VERTICAL_ALIGN) != null ? sourceElement
@@ -583,4 +773,22 @@
.getAttribute(ATTR_TARGET_LIST_WIDTH)
: DEFAULT_LIST_WIDTH;
}
+
+ private void clearData() {
+
+ labels.clear();
+ styleClasses.clear();
+ sourceButtons.clear();
+ targetButtons.clear();
+ facetLabels.clear();
+
+ }
+
+ /**
+ *
+ * @param sourceElement
+ * @param name
+ * @return
+ */
+
}
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-01-23
06:32:12 UTC (rev 5905)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-01-23
09:13:18 UTC (rev 5906)
@@ -727,6 +727,7 @@
</vpe:tag>
<vpe:tag name="rich:listShuttle" case-sensitive="yes">
+ <vpe:copy attrs="style" />
<vpe:template children="yes" modify="yes"
class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesListShuttleTemplate">
<vpe:dnd>
@@ -735,6 +736,9 @@
<vpe:container-child tag-name="column" />
</vpe:drop>
</vpe:dnd>
+ <vpe:resize>
+ <vpe:height height-attr="listsHeight" />
+ </vpe:resize>
<vpe:textFormating>
<vpe:format type="UnderlineFormat">
<vpe:formatAttribute type="style" />