JBoss Tools SVN: r12540 - in trunk/jsf: plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: izhukov
Date: 2008-12-10 10:34:03 -0500 (Wed, 10 Dec 2008)
New Revision: 12540
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSlider/numberSlider.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/inputNumberSpinner.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/InputNumberSliderTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inputNumberSlider.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inputNumberSlider.xhtml.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inputNumberSpinner.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inputNumberSpinner.xhtml.xml
Log:
JBIDE-3225: fixed for <rich:inputNumberSlider>, <rich:inputNumberSpinner>
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSlider/numberSlider.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSlider/numberSlider.css 2008-12-10 14:46:27 UTC (rev 12539)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSlider/numberSlider.css 2008-12-10 15:34:03 UTC (rev 12540)
@@ -1,15 +1,36 @@
.dr-insldr {
- width: 200px;
height: 20px;
}
+.dr-insldr-field {
+ background-image: url(input.gif);
+ background-color: #FFFFFF;
+ background-position: left top;
+ background-repeat: repeat-x;
+ border: 1px inset;
+ border-color: #C4C0B9;
+ padding: 0 0 0 3px;
+ margin-top: 0;
+ margin-bottom: 0;
+ font-family: Arial, Verdana, sans-serif;
+ font-size: 11px;
+}
+
+.dr-insldr-field-left {
+ margin-right: 10px;
+}
+
+.dr-insldr-field-right {
+ margin-left: 10px;
+}
+
.dr-insldr-left-num {
text-align: left;
border-left: 1px solid;
- padding: 0 3px 0 3px;
+ padding: 0 3px;
font-family: Arial, Verdana, sans-serif;
font-size: 11px;
- color: #000;
+ color: #000000;
border-color: #C4C0B9;
line-height: 11px;
}
@@ -17,38 +38,14 @@
.dr-insldr-right-num {
text-align: right;
border-right: 1px solid;
- padding: 0 3px 0 3px;
+ padding: 0 3px;
font-family: Arial, Verdana, sans-serif;
font-size: 11px;
- color: #000;
+ color: #000000;
border-color: #C4C0B9;
line-height: 11px;
}
-.dr-insldr-field {
- border: 1px solid;
- padding: 0 0 0 3px;
- margin-top: 0;
- margin-bottom: 0;
- background-position: left top;
- background-repeat: repeat-x;
- //background-color: #fff;
- font-family: Arial, Verdana, sans-serif;
- font-size: 11px;
- //color: #000;
- border-color: #C4C0B9;
- border-bottom-color: #fff;
- border-right-color: #fff;
-}
-
-.dr-insldr-field-left {
- margin-right: 10px;
-}
-
-.dr-insldr-field-right {
- margin-left: 10px;
-}
-
.dr-insldr-size {
width: 100%;
}
@@ -57,14 +54,29 @@
padding-top: 3px;
}
+.dr-insldr-handler {
+ background-image: url(handler.gif);
+ background-color: transparent;
+ width: 7px;
+ height: 8px;
+ font-size: 1px;
+ position: absolute;
+ text-align: center;
+ z-index: 1;
+}
+
.dr-insldr-track {
- background-position: left top;
+ background-image: url(track.gif);
+ background-color: #ffffff;
+ background-position: left top;
background-repeat: repeat-x;
height: 8px;
font-size: 1px;
- background-color: #fff;
}
+.rich-inslider-track {
+}
+
.dr-insldr-track-decor-1 {
height: 100%;
width: 100%;
@@ -74,14 +86,5 @@
.dr-insldr-track-decor-2 {
border: 1px solid white;
- border-color: #fff;
-}
-.dr-insldr-handler {
- background-color: transparent;
- width: 7px;
- height: 8px;
- font-size: 1px;
- position: absolute;
- text-align: center;
- z-index: 1;
+ border-color: #ffffff;
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/inputNumberSpinner.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/inputNumberSpinner.css 2008-12-10 14:46:27 UTC (rev 12539)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/inputNumberSpinner/inputNumberSpinner.css 2008-12-10 15:34:03 UTC (rev 12540)
@@ -1,3 +1,6 @@
+.dr-spnr-c {
+}
+
.dr-spnr-i {
border: 0 none;
padding: 0px 0px 0px 3px;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/InputNumberSliderTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/InputNumberSliderTemplate.java 2008-12-10 14:46:27 UTC (rev 12539)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/InputNumberSliderTemplate.java 2008-12-10 15:34:03 UTC (rev 12540)
@@ -11,6 +11,7 @@
package org.jboss.tools.jsf.vpe.richfaces.template;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -20,343 +21,334 @@
import org.jboss.tools.vpe.editor.mapping.AttributeData;
import org.jboss.tools.vpe.editor.mapping.NodeData;
import org.jboss.tools.vpe.editor.mapping.VpeElementData;
-import org.jboss.tools.vpe.editor.mapping.VpeElementMapping;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMHTMLInputElement;
-import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
/**
- *
+ * Template for input number slider control
+ *
* @author Sergey Dzmitrovich
- *
*/
-public class InputNumberSliderTemplate extends
- AbstractEditableRichFacesTemplate {
+public class InputNumberSliderTemplate extends AbstractEditableRichFacesTemplate {
- /**
- * path to file which contains css styles for component
- */
+ /** path to file which contains css styles for component */
private static final String STYLE_PATH = "/inputNumberSlider/numberSlider.css"; //$NON-NLS-1$
- /**
- * path to bar image
- */
+ /** path to bar image */
private static final String SPACER_IMAGE_PATH = "/inputNumberSlider/spacer.gif"; //$NON-NLS-1$
- /**
- * path to bar image
- */
- private static final String INPUT_BACKGROUND_IMAGE_PATH = "/inputNumberSlider/input.gif"; //$NON-NLS-1$
-
- /**
- * path to bar image
- */
- private static final String BAR_BACKGROUND_IMAGE_PATH = "/inputNumberSlider/track.gif"; //$NON-NLS-1$
-
- /**
- * path to handler image
- */
- private static final String HANDLER_IMAGE_PATH = "/inputNumberSlider/handler.gif"; //$NON-NLS-1$
-
- /**
- * "showInput" attribute
- */
+ /** "showInput" attribute */
private static final String SHOW_INPUT_ATTR = "showInput"; //$NON-NLS-1$
-
- /**
- * "showBoundaryValues" attribute
- */
+ /** "showBoundaryValues" attribute */
private static final String SHOW_BOUNDARY_VALUES = "showBoundaryValues"; //$NON-NLS-1$
- /**
- * "inputPosition" attribute
- */
+ /** "inputPosition" attribute */
private static final String INPUT_POSITION_ATTR = "inputPosition"; //$NON-NLS-1$
-
- /**
- * "minValue" attribute
- */
+ /** "minValue" attribute */
private static final String MIN_VALUE_ATTR = "minValue"; //$NON-NLS-1$
-
- /**
- * "maxValue" attribute
- */
+ /** "maxValue" attribute */
private static final String MAX_VALUE_ATTR = "maxValue"; //$NON-NLS-1$
-
- /**
- * "barStyle" attribute
- */
+ /** "barStyle" attribute */
private static final String BAR_STYLE_ATTR = "barStyle"; //$NON-NLS-1$
- /**
- * default min value
- */
+ /** default min value */
private static final String MIN_VALUE_DEFAULT = "0"; //$NON-NLS-1$
-
- /**
- * default max value
- */
+ /** default max value */
private static final String MAX_VALUE_DEFAULT = "100"; //$NON-NLS-1$
-
- /**
- * default input size
- */
+ /** default input size */
private static final String INPUT_SIZE_DEFAULT = "3"; //$NON-NLS-1$
-
- /**
- * default slyder width
- */
+ /** default slider width */
private static final String SLYDER_WIDTH_DEFAULT = "200"; //$NON-NLS-1$
-
- /**
- * default max value
- */
+ /** default input field block style */
private static final String INPUT_FIELD_STYLE = "text-align: left; vertical-align: bottom;"; //$NON-NLS-1$
-
- /**
- * spacer image style
- */
+ /** spacer image style */
private static final String SPACER_IMAGE_STYLE = "display: block;"; //$NON-NLS-1$
-
- /**
- * default max value
- */
+ /** HANDLER_WRAPPER_STYLE */
private static final String HANDLER_WRAPPER_STYLE = "position: relative;"; //$NON-NLS-1$
+ /** HANDLER_STYLE */
+ private static final String HANDLER_STYLE = "visibility: visible;"; //$NON-NLS-1$
/**
- * contains default css styles for different elements which can define using
- * attributes
- *
+ * Contains default CSS styles for different elements which can define using attributes
* key + "Class" = name of some element's style attribute
*/
private static final Map<String, String> defaultStyleClasses;
-
static {
defaultStyleClasses = new HashMap<String, String>();
// general style
defaultStyleClasses.put("style", "dr-insldr rich-slider"); //$NON-NLS-1$//$NON-NLS-2$
-
// input style
defaultStyleClasses.put("input", "rich-inslider-field"); //$NON-NLS-1$//$NON-NLS-2$
-
// bar style
defaultStyleClasses.put("bar", "dr-insldr-track rich-inslider-track"); //$NON-NLS-1$//$NON-NLS-2$
-
// bar style
- defaultStyleClasses.put(
- "handle", "dr-insldr-handler rich-inslider-handler"); //$NON-NLS-1$//$NON-NLS-2$
-
+ defaultStyleClasses.put("handle", "dr-insldr-handler rich-inslider-handler"); //$NON-NLS-1$//$NON-NLS-2$
}
- /**
- * min value style classes
- */
+ /* Default and RichFaces styles */
+ /** min value style classes */
private static final String MIN_VALUE_STYLE_CLASSES = "dr-insldr-left-num rich-inslider-left-num"; //$NON-NLS-1$
-
- /**
- * max value style classes
- */
+ /** max value style classes */
private static final String MAX_VALUE_STYLE_CLASSES = "dr-insldr-right-num rich-inslider-right-num"; //$NON-NLS-1$
-
- /**
- * input left style classes
- */
+ /** input left style classes */
private static final String INPUT_LEFT_STYLE_CLASSES = "dr-insldr-field dr-insldr-field-left"; //$NON-NLS-1$
-
- /**
- * input right style classes
- */
+ /** input right style classes */
private static final String INPUT_RIGHT_STYLE_CLASSES = "dr-insldr-field dr-insldr-field-right"; //$NON-NLS-1$
-
- /**
- * slider style classes
- */
+ /** slider style classes */
private static final String SLIDER_STYLE_CLASSES = "dr-insldr-size dr-insldr-vert-spacer"; //$NON-NLS-1$
-
- /**
- * track decor style classes
- */
+ /** track decor style classes */
private static final String TRACK_DECOR_1_CLASSES = "dr-insldr-track-decor-1"; //$NON-NLS-1$
-
- /**
- * slider style classes
- */
+ /** slider style classes */
private static final String TRACK_DECOR_2_CLASSES = "dr-insldr-track-decor-2"; //$NON-NLS-1$
- /**
- * contains prepare css styles ( added user css classes besides default
- * styles )
- */
+ /** contains prepare css styles (added user css classes besides default styles) */
private static final Map<String, String> styleClasses = new HashMap<String, String>();
- public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
- nsIDOMDocument visualDocument) {
-
+ /**
+ * 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) {
+ // Set a css for this element
+ ComponentUtil.setCSSLink(pageContext, STYLE_PATH, "inputNumberSlider"); //$NON-NLS-1$
// cast to Element
Element sourceElement = (Element) sourceNode;
- ComponentUtil.setCSSLink(pageContext, STYLE_PATH, "inputNumberSlider"); //$NON-NLS-1$
-
+ // prepare style classes for input number slider part controls
prepareData(sourceElement);
- VpeElementData elementData = new VpeElementData();
-
// create and initialize basic table element
nsIDOMElement basicTable = visualDocument.createElement(HTML.TAG_TABLE);
- basicTable.setAttribute(HTML.ATTR_STYLE, HTML.ATTR_WIDTH
- + ":" //$NON-NLS-1$
- + getNumberValue(sourceElement, RichFaces.ATTR_WIDTH,
- SLYDER_WIDTH_DEFAULT) + ";" //$NON-NLS-1$
- + getAttribute(sourceElement, RichFaces.ATTR_STYLE));
+ String style = new StringBuffer(HTML.STYLE_PARAMETER_WIDTH).append(Constants.COLON).
+ append(getNumberValue(sourceElement, RichFaces.ATTR_WIDTH, SLYDER_WIDTH_DEFAULT)).
+ append(Constants.PIXEL).append(Constants.SEMICOLON).
+ append(getAttribute(sourceElement, RichFaces.ATTR_STYLE)).append(Constants.SEMICOLON).toString();
+ basicTable.setAttribute(HTML.ATTR_STYLE, style);
basicTable.setAttribute(HTML.ATTR_CLASS, styleClasses.get("style")); //$NON-NLS-1$
basicTable.setAttribute(HTML.ATTR_CELLPADDING, MIN_VALUE_DEFAULT);
basicTable.setAttribute(HTML.ATTR_CELLSPACING, MIN_VALUE_DEFAULT);
basicTable.setAttribute(HTML.ATTR_BORDER, MIN_VALUE_DEFAULT);
- nsIDOMElement valuesBlock = createValuesBlock(sourceElement,
- visualDocument, elementData);
+ VpeElementData elementData = new VpeElementData();
+ // create block with min/max and input components
+ nsIDOMElement valuesBlock = createValuesBlock(sourceElement, visualDocument, elementData);
+ // create slider component
+ nsIDOMElement sliderBlock = createSliderBlock(sourceElement, visualDocument);
- nsIDOMElement sliderBlock = createSliderBlock(sourceElement,
- visualDocument);
-
basicTable.appendChild(valuesBlock);
basicTable.appendChild(sliderBlock);
- // create creation data
- VpeCreationData creationData = new VpeCreationData(basicTable);
+ // ================================================================================
+ // Check if template component has children elements
+ // ================================================================================
+ List<Node> list = ComponentUtil.getChildren(sourceElement, true);
+ VpeCreationData creationData = null;
+ if (list != null && list.size() > 0) {
+ nsIDOMElement rootDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ // this element is used to contains template children
+ nsIDOMElement childDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ rootDiv.appendChild(childDiv);
+ rootDiv.appendChild(basicTable);
+
+ // Create return variable contains template
+ creationData = new VpeCreationData(rootDiv);
+ VpeChildrenInfo divInfo = new VpeChildrenInfo(childDiv);
+ creationData.addChildrenInfo(divInfo);
+ for (Node child : list) {
+ divInfo.addSourceChild(child);
+ }
+ } else {
+ creationData = new VpeCreationData(basicTable);
+ }
creationData.setElementData(elementData);
+
return creationData;
}
/**
- * prepare
- *
- * @param sourceElement
+ * Prepare style classes.
+ *
+ * @param sourceElement Element source object
*/
private void prepareData(Element sourceElement) {
-
// prepare style classes
Set<String> styleClassesKeys = defaultStyleClasses.keySet();
styleClasses.clear();
for (String key : styleClassesKeys) {
-
- if (sourceElement.hasAttribute(key + "Class")) //$NON-NLS-1$
- styleClasses.put(key, defaultStyleClasses.get(key) + " " //$NON-NLS-1$
+ if (sourceElement.hasAttribute(key + "Class")) { //$NON-NLS-1$
+ styleClasses.put(key, defaultStyleClasses.get(key) + Constants.WHITE_SPACE
+ sourceElement.getAttribute(key + "Class")); //$NON-NLS-1$
- else
+ } else {
styleClasses.put(key, defaultStyleClasses.get(key));
+ }
}
-
}
/**
- *
- * @param sourceElement
- * @param visualDocument
- * @param elementData
- * @return
+ * Create value block container with min, max, input components.
+ *
+ * @param sourceElement The current node of the source tree.
+ * @param visualDocument The document of the visual tree.
+ * @param elementData the VpeElementData object
+ * @return nsIDOMElement object
*/
- private nsIDOMElement createInputBlock(Element sourceElement,
- nsIDOMDocument visualDocument, VpeElementData elementData) {
+ private nsIDOMElement createValuesBlock(Element sourceElement, nsIDOMDocument visualDocument,
+ VpeElementData elementData) {
+ // create numbers block
+ nsIDOMElement valuesBlock = visualDocument.createElement(HTML.TAG_TR);
+ // create minValue block
+ nsIDOMElement minValueTD = visualDocument.createElement(HTML.TAG_TD);
+ minValueTD.setAttribute(HTML.ATTR_CLASS, MIN_VALUE_STYLE_CLASSES);
+
+ // create maxValue block
+ nsIDOMElement maxValueTD = visualDocument.createElement(HTML.TAG_TD);
+ maxValueTD.setAttribute(HTML.ATTR_CLASS, MAX_VALUE_STYLE_CLASSES);
+
+ // checks if min/max values should be shown on component
+ if (isShowBoundaryValues(sourceElement)) {
+ NodeData minValueData = null;
+ // create minValue text
+ nsIDOMText minValueText = visualDocument.createTextNode(getNumberValue(sourceElement, MIN_VALUE_ATTR,
+ MIN_VALUE_DEFAULT));
+ if (sourceElement.hasAttribute(MIN_VALUE_ATTR)) {
+ minValueData = new NodeData(sourceElement.getAttributeNode(MIN_VALUE_ATTR), minValueText);
+ } else {
+ minValueData = new AttributeData(MIN_VALUE_ATTR, minValueText);
+ }
+ // add text to TD
+ minValueTD.appendChild(minValueText);
+ elementData.addNodeData(minValueData);
+
+ NodeData maxValueData;
+ // create maxValue text
+ nsIDOMText maxValueText = visualDocument.createTextNode(getNumberValue(sourceElement, MAX_VALUE_ATTR,
+ MAX_VALUE_DEFAULT));
+ if (sourceElement.hasAttribute(MAX_VALUE_ATTR)) {
+ maxValueData = new NodeData(sourceElement.getAttributeNode(MAX_VALUE_ATTR), maxValueText);
+ } else {
+ maxValueData = new AttributeData(MAX_VALUE_ATTR, maxValueText);
+ }
+ // add text to tD
+ maxValueTD.appendChild(maxValueText);
+ elementData.addNodeData(maxValueData);
+ }
+
+ valuesBlock.appendChild(minValueTD);
+ valuesBlock.appendChild(maxValueTD);
+
+ // checks if input field should be shown on component
+ if (isShowInput(sourceElement)) {
+ nsIDOMElement inputTd = createInputBlock(sourceElement, visualDocument, elementData);
+ // the location of input field (left/right)
+ if (isRightInputPosition(sourceElement)) {
+ valuesBlock.appendChild(inputTd);
+ } else {
+ valuesBlock.insertBefore(inputTd, minValueTD);
+ }
+ }
+
+ return valuesBlock;
+ }
+
+ /**
+ * Create input block container with input component.
+ *
+ * @param sourceElement The current node of the source tree.
+ * @param visualDocument The document of the visual tree.
+ * @param elementData the VpeElementData object
+ * @return nsIDOMElement object
+ */
+ private nsIDOMElement createInputBlock(Element sourceElement, nsIDOMDocument visualDocument,
+ VpeElementData elementData) {
// create input block
- nsIDOMElement inputTd = visualDocument.createElement(HTML.TAG_TD);
- inputTd.setAttribute(HTML.ATTR_STYLE, INPUT_FIELD_STYLE);
- inputTd.setAttribute(HTML.ATTR_ROWSPAN, "2"); //$NON-NLS-1$
+ nsIDOMElement inputTD = visualDocument.createElement(HTML.TAG_TD);
+ inputTD.setAttribute(HTML.ATTR_STYLE, INPUT_FIELD_STYLE);
+ inputTD.setAttribute(HTML.ATTR_ROWSPAN, "2"); //$NON-NLS-1$
// create input field
nsIDOMElement inputField = visualDocument.createElement(HTML.TAG_INPUT);
inputField.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_TEXT);
-
inputField.setAttribute(HTML.ATTR_SIZE, getNumberValue(sourceElement,
RichFaces.ATTR_INPUT_SIZE, INPUT_SIZE_DEFAULT));
- inputField.setAttribute(HTML.ATTR_STYLE, ComponentUtil
- .getBackgoundImgStyle(INPUT_BACKGROUND_IMAGE_PATH)
- + getAttribute(sourceElement, RichFaces.ATTR_INPUT_STYLE));
+ inputField.setAttribute(HTML.ATTR_STYLE, getAttribute(sourceElement, RichFaces.ATTR_INPUT_STYLE));
- NodeData attributeData;
-
+ NodeData attributeData = null;
+ inputField.setAttribute(HTML.ATTR_VALUE, ComponentUtil.getAttribute(sourceElement, RichFaces.ATTR_VALUE));
if (sourceElement.hasAttribute(RichFaces.ATTR_VALUE)) {
-
- inputField.setAttribute(HTML.ATTR_VALUE, sourceElement
- .getAttribute(RichFaces.ATTR_VALUE));
-
- attributeData = new NodeData(sourceElement
- .getAttributeNode(RichFaces.ATTR_VALUE), inputField);
-
+ attributeData = new NodeData(sourceElement.getAttributeNode(RichFaces.ATTR_VALUE), inputField);
} else {
- inputField.setAttribute(HTML.ATTR_VALUE, ""); //$NON-NLS-1$
-
- attributeData = new AttributeData(RichFaces.ATTR_VALUE,
- inputField);
+ attributeData = new AttributeData(RichFaces.ATTR_VALUE, inputField);
}
-
elementData.addNodeData(attributeData);
- // get class attribute
+ // get input class attribute
String inputClass = null;
-
- if (isRightInputPosition(sourceElement))
+ if (isRightInputPosition(sourceElement)) {
inputClass = INPUT_RIGHT_STYLE_CLASSES;
- else
+ } else {
inputClass = INPUT_LEFT_STYLE_CLASSES;
-
- inputClass += " " + styleClasses.get("input"); //$NON-NLS-1$ //$NON-NLS-2$
-
+ }
+ inputClass = new StringBuffer(inputClass).append(Constants.WHITE_SPACE).
+ append(styleClasses.get("input")).toString(); //$NON-NLS-1$
inputField.setAttribute(HTML.ATTR_CLASS, inputClass);
nsIDOMHTMLInputElement iDOMInputElement = (nsIDOMHTMLInputElement) inputField
.queryInterface(nsIDOMHTMLInputElement.NS_IDOMHTMLINPUTELEMENT_IID);
iDOMInputElement.setReadOnly(false);
- inputTd.appendChild(inputField);
+ inputTD.appendChild(inputField);
- return inputTd;
-
+ return inputTD;
}
/**
- *
- * @param sourceElement
- * @param visualDocument
- * @return
+ * Create slider block container with corresponding components.
+ *
+ * @param sourceElement The current node of the source tree.
+ * @param visualDocument The document of the visual tree.
+ * @return nsIDOMElement object
*/
- private nsIDOMElement createSliderBlock(Element sourceElement,
- nsIDOMDocument visualDocument) {
-
- // create slider block - tr tag
+ private nsIDOMElement createSliderBlock(Element sourceElement, nsIDOMDocument visualDocument) {
+ // create slider block - TR tag
nsIDOMElement sliderBlock = visualDocument.createElement(HTML.TAG_TR);
- // create td
- nsIDOMElement sliderTd = visualDocument.createElement(HTML.TAG_TD);
- sliderTd.setAttribute(HTML.ATTR_CLASS, SLIDER_STYLE_CLASSES);
- sliderTd.setAttribute(HTML.ATTR_COLSPAN, "2"); //$NON-NLS-1$
+ // create TD
+ nsIDOMElement sliderTD = visualDocument.createElement(HTML.TAG_TD);
+ sliderTD.setAttribute(HTML.ATTR_CLASS, SLIDER_STYLE_CLASSES);
+ sliderTD.setAttribute(HTML.ATTR_COLSPAN, "2"); //$NON-NLS-1$
- nsIDOMElement handlerWrapper = visualDocument
- .createElement(HTML.TAG_DIV);
+ // create wrapper DIV component for slider element
+ nsIDOMElement handlerWrapper = visualDocument.createElement(HTML.TAG_DIV);
handlerWrapper.setAttribute(HTML.ATTR_STYLE, HANDLER_WRAPPER_STYLE);
nsIDOMElement handler = visualDocument.createElement(HTML.TAG_DIV);
+ handler.setAttribute(HTML.ATTR_STYLE, HANDLER_STYLE);
handler.setAttribute(HTML.ATTR_CLASS, styleClasses.get("handle")); //$NON-NLS-1$
- handler.setAttribute(HTML.ATTR_STYLE, ComponentUtil
- .getBackgoundImgStyle(HANDLER_IMAGE_PATH));
handlerWrapper.appendChild(handler);
- // create bar - div tag
- nsIDOMElement bar = visualDocument.createElement(HTML.TAG_DIV);
- bar.setAttribute(HTML.ATTR_CLASS, styleClasses.get("bar")); //$NON-NLS-1$
- bar.setAttribute(HTML.TAG_STYLE, ComponentUtil
- .getBackgoundImgStyle(BAR_BACKGROUND_IMAGE_PATH)
- + getAttribute(sourceElement, BAR_STYLE_ATTR));
+ // create bar DIV tag
+ nsIDOMElement barDiv = visualDocument.createElement(HTML.TAG_DIV);
+ barDiv.setAttribute(HTML.TAG_STYLE, ComponentUtil.getAttribute(sourceElement, BAR_STYLE_ATTR));
+ barDiv.setAttribute(HTML.ATTR_CLASS, styleClasses.get("bar")); //$NON-NLS-1$
// create table
nsIDOMElement barTable = visualDocument.createElement(HTML.TAG_TABLE);
@@ -364,221 +356,106 @@
barTable.setAttribute(HTML.ATTR_CELLPADDING, MIN_VALUE_DEFAULT);
barTable.setAttribute(HTML.ATTR_CELLSPACING, MIN_VALUE_DEFAULT);
- // create tr
- nsIDOMElement barTr = visualDocument.createElement(HTML.TAG_TR);
+ // create TR
+ nsIDOMElement barTR = visualDocument.createElement(HTML.TAG_TR);
+ // create TD
+ nsIDOMElement barTD = visualDocument.createElement(HTML.TAG_TD);
+ barTD.setAttribute(HTML.ATTR_CLASS, TRACK_DECOR_2_CLASSES);
- // create td
- nsIDOMElement barTd = visualDocument.createElement(HTML.TAG_TD);
- barTd.setAttribute(HTML.ATTR_CLASS, TRACK_DECOR_2_CLASSES);
-
// create image
nsIDOMElement barImage = visualDocument.createElement(HTML.TAG_IMG);
ComponentUtil.setImg(barImage, SPACER_IMAGE_PATH);
barImage.setAttribute(HTML.ATTR_STYLE, SPACER_IMAGE_STYLE);
- // insert image to td
- barTd.appendChild(barImage);
-
- // insert td to tr
- barTr.appendChild(barTd);
-
- // insert tr to table
- barTable.appendChild(barTr);
-
+ // insert image to TD
+ barTD.appendChild(barImage);
+ // insert TD to TR
+ barTR.appendChild(barTD);
+ // insert TR to table
+ barTable.appendChild(barTR);
// insert table to bar
- bar.appendChild(barTable);
+ barDiv.appendChild(barTable);
- sliderTd.appendChild(handlerWrapper);
- sliderTd.appendChild(bar);
- sliderBlock.appendChild(sliderTd);
+ sliderTD.appendChild(handlerWrapper);
+ sliderTD.appendChild(barDiv);
+ sliderBlock.appendChild(sliderTD);
return sliderBlock;
}
/**
- *
- * @param sourceElement
- * @param visualDocument
- * @param elementData
- * @return
+ * Method is used retrieve attribute value from sourceElement for corresponding attributeName.
+ * If sourceElement doesn't contain attribute with name equals attributeName return default value.
+ *
+ * @param sourceElement DOM Element
+ * @param attributeName the name of attribute
+ * @param defaultValue the default value
+ * @return the value of attribute with corresponding name for source element
*/
- private nsIDOMElement createValuesBlock(Element sourceElement,
- nsIDOMDocument visualDocument, VpeElementData elementData) {
-
- // create numbers block
- nsIDOMElement valuesBlock = visualDocument.createElement(HTML.TAG_TR);
-
- // create minValue block
- nsIDOMElement minValueTd = visualDocument.createElement(HTML.TAG_TD);
- minValueTd.setAttribute(HTML.ATTR_CLASS, MIN_VALUE_STYLE_CLASSES);
-
- // create maxValue block
- nsIDOMElement maxValueTd = visualDocument.createElement(HTML.TAG_TD);
- maxValueTd.setAttribute(HTML.ATTR_CLASS, MAX_VALUE_STYLE_CLASSES);
-
- if (isShowBoundaryValues(sourceElement)) {
-
- nsIDOMText minValueText;
- NodeData minValueData;
- if (sourceElement.hasAttribute(MIN_VALUE_ATTR)) {
-
- // create minValue text
- minValueText = visualDocument.createTextNode(sourceElement
- .getAttribute(MIN_VALUE_ATTR));
-
- minValueData = new NodeData(sourceElement
- .getAttributeNode(MIN_VALUE_ATTR), minValueText);
-
- } else {
-
- // create minValue text
- minValueText = visualDocument.createTextNode(MIN_VALUE_DEFAULT);
-
- minValueData = new AttributeData(MIN_VALUE_ATTR,
- minValueText);
-
- }
- // add text to td
- minValueTd.appendChild(minValueText);
- elementData.addNodeData(minValueData);
-
- nsIDOMText maxValueText;
- NodeData maxValueData;
- if (sourceElement.hasAttribute(MAX_VALUE_ATTR)) {
-
- // create minValue text
- maxValueText = visualDocument.createTextNode(sourceElement
- .getAttribute(MAX_VALUE_ATTR));
-
- maxValueData = new NodeData(sourceElement
- .getAttributeNode(MAX_VALUE_ATTR), maxValueText);
-
- } else {
-
- // create minValue text
- maxValueText = visualDocument.createTextNode(MAX_VALUE_DEFAULT);
-
- maxValueData = new AttributeData(MAX_VALUE_ATTR,
- maxValueText);
-
- }
- // add text to td
- maxValueTd.appendChild(maxValueText);
- elementData.addNodeData(maxValueData);
- }
-
- valuesBlock.appendChild(minValueTd);
- valuesBlock.appendChild(maxValueTd);
-
- // if input field is showed
- if (isShowInput(sourceElement)) {
-
- nsIDOMElement inputTd = createInputBlock(sourceElement,
- visualDocument, elementData);
-
- if (isRightInputPosition(sourceElement))
- valuesBlock.appendChild(inputTd);
- else
- valuesBlock.insertBefore(inputTd, minValueTd);
- }
-
- return valuesBlock;
- }
-
- /**
- *
- * @param sourceElement
- * @param attributeName
- * @param defaultValue
- * @return
- */
- private String getNumberValue(Element sourceElement, String attributeName,
- String defaultValue) {
-
+ private String getNumberValue(Element sourceElement, String attributeName, String defaultValue) {
// if source element has attribute
if (sourceElement.hasAttribute(attributeName)) {
- // getAttribute
String stringValue = sourceElement.getAttribute(attributeName);
-
try {
// decode attribute's value
Integer.decode(stringValue);
- // if it is number (there is not exception) return attribute's
- // value
+ // if it is number (there is not exception) return attribute's value
return stringValue;
} catch (NumberFormatException e) {
- // if attribute's value is not number do nothing and then return
- // default value
+ // if attribute's value is not number do nothing and then return default value
}
-
}
return defaultValue;
-
}
/**
- * if input field must represent return true
- *
- * @param sourceElement
- * @return
+ * If input field must be represented. In this case return true, false - otherwise.
+ *
+ * @param sourceElement DOM source Element object
+ * @return true if input field must be represented, false - otherwise
*/
private boolean isShowInput(Element sourceElement) {
-
// if source element has "showInput" attribute
if (sourceElement.hasAttribute(SHOW_INPUT_ATTR)) {
-
- // get this attribute
String showInput = sourceElement.getAttribute(SHOW_INPUT_ATTR);
-
// if this attribute equals "true"
- if ("true".equalsIgnoreCase(showInput)) //$NON-NLS-1$
+ if (Constants.TRUE.equalsIgnoreCase(showInput)) {
return true;
+ }
// in other cases return false
return false;
-
}
-
// default value is true
return true;
-
}
/**
- * Return true if input position is right. Return false if input position is
- * left
- *
- * @param sourceElement
- * @return
+ * Return true if input position is right. Return false if input position is left.
+ *
+ * @param sourceElement DOM source Element object
+ * @return false if input position is "left", true - otherwise
*/
private boolean isRightInputPosition(Element sourceElement) {
if (sourceElement.hasAttribute(INPUT_POSITION_ATTR)
- && ("left".equalsIgnoreCase(sourceElement //$NON-NLS-1$
- .getAttribute(INPUT_POSITION_ATTR))))
+ && ("left".equalsIgnoreCase(sourceElement.getAttribute(INPUT_POSITION_ATTR)))) { //$NON-NLS-1$
return false;
-
+ }
return true;
-
}
/**
- *
- * @param sourceElement
- * @return
+ * Method checks if the min/max values are shown on the right/left borders of a control.
+ *
+ * @param sourceElement DOM source Element object
+ * @return true if min/max value must be shown, false - otherwise
*/
private boolean isShowBoundaryValues(Element sourceElement) {
- if ((sourceElement.hasAttribute(SHOW_BOUNDARY_VALUES) && "false" //$NON-NLS-1$
- .equalsIgnoreCase(sourceElement.getAttribute(SHOW_BOUNDARY_VALUES))))
+ if ((sourceElement.hasAttribute(SHOW_BOUNDARY_VALUES) &&
+ Constants.FALSE.equalsIgnoreCase(sourceElement.getAttribute(SHOW_BOUNDARY_VALUES)))) {
return false;
+ }
return true;
}
-
- @Override
- public boolean isRecreateAtAttrChange(VpePageContext pageContext,
- Element sourceElement, nsIDOMDocument visualDocument,
- nsIDOMElement visualNode, Object data, String name, String value) {
- return true;
- }
-
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java 2008-12-10 14:46:27 UTC (rev 12539)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java 2008-12-10 15:34:03 UTC (rev 12540)
@@ -10,12 +10,15 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces.template;
+import java.util.List;
+
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.mapping.AttributeData;
import org.jboss.tools.vpe.editor.mapping.NodeData;
import org.jboss.tools.vpe.editor.mapping.VpeElementData;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.editor.util.HTML;
@@ -43,8 +46,12 @@
final static private String DEFAULT_INPUT_SIZE = "10px"; //$NON-NLS-1$
final static private String DEFAULT_ZERO_SIZE = "0px"; //$NON-NLS-1$
final static private String DEFAULT_WIDTH = "1%"; //$NON-NLS-1$
+ final static private String DEFAULT_CONTAINER_WRAPPER_WIDTH = "2%"; //$NON-NLS-1$
/* Default and RichFaces styles */
+ /** DEFAULT_CONTAINER_STYLE */
+ final static private String DEFAULT_CONTAINER_STYLE = "dr-spnr-c"; //$NON-NLS-1$
+
/** DEFAULT_INPUT_STYLE */
final static private String DEFAULT_INPUT_STYLE = "dr-spnr-i"; //$NON-NLS-1$
@@ -96,18 +103,16 @@
* 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) {
-
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
// Set a css for this element
ComponentUtil.setCSSLink(pageContext, CSS_FILE_NAME, "richFacesInputNumberSpinner"); //$NON-NLS-1$
-
Element sourceElement = (Element) sourceNode;
nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
table.setAttribute(HTML.ATTR_BORDER, DEFAULT_ZERO_SIZE);
table.setAttribute(HTML.ATTR_CELLPADDING, DEFAULT_ZERO_SIZE);
table.setAttribute(HTML.ATTR_CELLSPACING, DEFAULT_ZERO_SIZE);
+ table.setAttribute(HTML.ATTR_WIDTH, DEFAULT_CONTAINER_WRAPPER_WIDTH);
VpeElementData elementData = new VpeElementData();
@@ -132,15 +137,39 @@
table.appendChild(row);
String tmp = getAttribute(sourceElement, RichFaces.ATTR_STYLE);
- table.setAttribute(HTML.ATTR_STYLE, tmp);
+ if (!tmp.equals(Constants.EMPTY)) {
+ table.setAttribute(HTML.ATTR_STYLE, tmp);
+ }
tmp = getAttribute(sourceElement, RichFaces.ATTR_STYLE_CLASS);
- tmp = new StringBuffer().append(RICH_SPINNER_C_STYLE).append(Constants.WHITE_SPACE).append(tmp).toString();
+ tmp = new StringBuffer(DEFAULT_CONTAINER_STYLE).append(Constants.WHITE_SPACE).
+ append(RICH_SPINNER_C_STYLE).append(Constants.WHITE_SPACE).append(tmp).toString();
table.setAttribute(HTML.ATTR_CLASS, tmp);
- // Create return variable contains template
- VpeCreationData creationData = new VpeCreationData(table);
- creationData.setElementData(elementData);
+ // ================================================================================
+ // Check if template component has children elements
+ // ================================================================================
+ List<Node> list = ComponentUtil.getChildren(sourceElement, true);
+ VpeCreationData creationData = null;
+ if (list != null && list.size() > 0) {
+ nsIDOMElement rootDiv = visualDocument.createElement(HTML.TAG_DIV);
+ // this element is used to contains template children
+ nsIDOMElement childDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ rootDiv.appendChild(childDiv);
+ rootDiv.appendChild(table);
+
+ // Create return variable contains template
+ creationData = new VpeCreationData(rootDiv);
+ VpeChildrenInfo divInfo = new VpeChildrenInfo(childDiv);
+ creationData.addChildrenInfo(divInfo);
+ for (Node child : list) {
+ divInfo.addSourceChild(child);
+ }
+ } else {
+ creationData = new VpeCreationData(table);
+ }
+
return creationData;
}
@@ -210,11 +239,13 @@
nsIDOMElement inputElement = visualDocument.createElement(HTML.TAG_INPUT);
inputElement.setAttribute(HTML.ATTR_CLASS, getInputClass(sourceElement));
- inputElement.setAttribute(HTML.ATTR_STYLE, getInputStyle(sourceElement));
+ String attrStyle = getInputStyle(sourceElement);
+ if (!attrStyle.equals(Constants.EMPTY)) {
+ inputElement.setAttribute(HTML.ATTR_STYLE, attrStyle);
+ }
inputElement.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_TEXT);
inputElement.setAttribute(HTML.ATTR_SIZE, getInputSize(sourceElement));
inputElement.setAttribute(HTML.ATTR_VALUE, getInputValue(sourceElement));
- inputElement.setAttribute(HTML.ATTR_VALUE, getInputValue(sourceElement));
if ((sourceElement).hasAttribute(RichFaces.ATTR_VALUE)) {
elementData.addNodeData(new NodeData(sourceElement
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-12-10 14:46:27 UTC (rev 12539)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-12-10 15:34:03 UTC (rev 12540)
@@ -149,7 +149,7 @@
</vpe:template>
</vpe:tag>
<vpe:tag name="rich:inputNumberSpinner" case-sensitive="yes">
- <vpe:template children="no" modify="no"
+ <vpe:template children="yes" modify="no"
class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesInputNumberSpinnerTemplate">
<vpe:resize>
<vpe:width width-attr="style.width" />
@@ -159,6 +159,7 @@
<vpe:drag start-enable="yes" />
<vpe:drop container="no" />
</vpe:dnd>
+ <vpe:pseudoContent defaultText="no"/>
</vpe:template>
</vpe:tag>
<vpe:tag name="rich:columns" case-sensitive="yes">
@@ -166,7 +167,7 @@
</vpe:template>
</vpe:tag>
<vpe:tag name="rich:inputNumberSlider" case-sensitive="yes">
- <vpe:template children="no" modify="yes"
+ <vpe:template children="yes" modify="yes"
class="org.jboss.tools.jsf.vpe.richfaces.template.InputNumberSliderTemplate">
<vpe:resize>
<vpe:width width-attr="style.width" />
@@ -175,6 +176,7 @@
<vpe:drag start-enable="yes" />
<vpe:drop container="no" />
</vpe:dnd>
+ <vpe:pseudoContent defaultText="no"/>
</vpe:template>
</vpe:tag>
<vpe:tag name="rich:progressBar" case-sensitive="yes">
@@ -266,7 +268,7 @@
</vpe:tag>
<vpe:tag name="rich:dataFilterSlider" case-sensitive="yes">
- <vpe:template children="no" modify="no"
+ <vpe:template children="yes" modify="no"
class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesDataFilterSliderTemplate">
<vpe:resize>
<vpe:width width-attr="width" />
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inputNumberSlider.xhtml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inputNumberSlider.xhtml 2008-12-10 14:46:27 UTC (rev 12539)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inputNumberSlider.xhtml 2008-12-10 15:34:03 UTC (rev 12540)
@@ -10,8 +10,17 @@
</head>
<body>
<f:view>
- <rich:inputNumberSlider id="inputNumberSlider" value="50">
- </rich:inputNumberSlider>
+ <rich:inputNumberSlider id="inputNumberSlider" value="50"/>
+ <rich:inputNumberSlider id="inputNumberSliderCustomCSS" value="50"
+ barClass="customBarClass" barStyle="color:red"
+ handleClass="customHandleClass" handleSelectedClass="customHandleSelectedClass"
+ inputClass="customInputClass" inputStyle="color:blue"
+ style="color:green" styleClass="customStyleClass"/>
+ <rich:inputNumberSlider id="inputNumberSpinnerTextChild" value="50"
+ barClass="customBarClass" barStyle="color:red"
+ handleClass="customHandleClass" handleSelectedClass="customHandleSelectedClass"
+ inputClass="customInputClass" inputStyle="color:blue"
+ style="color:green" styleClass="customStyleClass">Text Child</rich:inputNumberSlider>
</f:view>
</body>
</html>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inputNumberSlider.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inputNumberSlider.xhtml.xml 2008-12-10 14:46:27 UTC (rev 12539)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inputNumberSlider.xhtml.xml 2008-12-10 15:34:03 UTC (rev 12540)
@@ -1,36 +1,102 @@
<tests>
<test id="inputNumberSlider">
- <TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0" CLASS="dr-insldr rich-slider">
- <TR>
- <TD CLASS="dr-insldr-left-num rich-inslider-left-num"> 0</TD>
- <TD CLASS="dr-insldr-right-num rich-inslider-right-num"> 100</TD>
- <TD STYLE="text-align: left; vertical-align: bottom;" ROWSPAN="2">
- <INPUT TYPE="text" SIZE="3"
- STYLE="/background-image: url\(.*resources/inputNumberSlider/input.gif\);/"
- VALUE="50" CLASS="dr-insldr-field dr-insldr-field-right rich-inslider-field"/>
- </TD>
- </TR>
- <TR>
- <TD CLASS="dr-insldr-size dr-insldr-vert-spacer" COLSPAN="2">
- <DIV STYLE="position: relative;">
- <DIV CLASS="dr-insldr-handler rich-inslider-handler"
- STYLE="/background-image: url\(.*resources/inputNumberSlider/handler.gif\);/">
- </DIV>
- </DIV>
- <DIV CLASS="dr-insldr-track rich-inslider-track"
- STYLE="/background-image: url\(.*resources/inputNumberSlider/track.gif\);/">
- <TABLE CELLSPACING="0" CELLPADDING="0" CLASS="dr-insldr-track-decor-1">
- <TR>
- <TD CLASS="dr-insldr-track-decor-2">
- <IMG
- SRC="/.*resources/inputNumberSlider/spacer.gif/"
- STYLE="display: block;"/>
- </TD>
- </TR>
- </TABLE>
- </DIV>
- </TD>
- </TR>
- </TABLE>
+ <TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0" STYLE="width: 200px;" CLASS="dr-insldr rich-slider">
+ <TR>
+ <TD CLASS="dr-insldr-left-num rich-inslider-left-num">0</TD>
+ <TD CLASS="dr-insldr-right-num rich-inslider-right-num">100</TD>
+ <TD STYLE="text-align: left; vertical-align: bottom;" ROWSPAN="2">
+ <INPUT TYPE="text" SIZE="3" VALUE="50"
+ CLASS="dr-insldr-field dr-insldr-field-right rich-inslider-field"/>
+ </TD>
+ </TR>
+ <TR>
+ <TD CLASS="dr-insldr-size dr-insldr-vert-spacer" COLSPAN="2">
+ <DIV STYLE="position: relative;">
+ <DIV STYLE="visibility: visible;" CLASS="dr-insldr-handler rich-inslider-handler"></DIV>
+ </DIV>
+ <DIV CLASS="dr-insldr-track rich-inslider-track">
+ <TABLE CELLSPACING="0" CELLPADDING="0" CLASS="dr-insldr-track-decor-1">
+ <TR>
+ <TD CLASS="dr-insldr-track-decor-2">
+ <IMG
+ SRC="/.*resources/inputNumberSlider/spacer.gif/"
+ STYLE="display: block;"/>
+ </TD>
+ </TR>
+ </TABLE>
+ </DIV>
+ </TD>
+ </TR>
+ </TABLE>
</test>
+ <test id="inputNumberSliderCustomCSS">
+ <TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0" STYLE="width: 200px; color: green;"
+ CLASS="dr-insldr rich-slider customStyleClass">
+ <TR>
+ <TD CLASS="dr-insldr-left-num rich-inslider-left-num">0</TD>
+ <TD CLASS="dr-insldr-right-num rich-inslider-right-num">100</TD>
+ <TD STYLE="text-align: left; vertical-align: bottom;" ROWSPAN="2">
+ <INPUT TYPE="text" SIZE="3" STYLE="color: blue;" VALUE="50"
+ CLASS="dr-insldr-field dr-insldr-field-right rich-inslider-field customInputClass"/>
+
+ </TD>
+ </TR>
+ <TR>
+ <TD CLASS="dr-insldr-size dr-insldr-vert-spacer" COLSPAN="2">
+ <DIV STYLE="position: relative;">
+ <DIV STYLE="visibility: visible;"
+ CLASS="dr-insldr-handler rich-inslider-handler customHandleClass"></DIV>
+ </DIV>
+ <DIV STYLE="color: red;" CLASS="dr-insldr-track rich-inslider-track customBarClass">
+ <TABLE CELLSPACING="0" CELLPADDING="0" CLASS="dr-insldr-track-decor-1">
+ <TR>
+ <TD CLASS="dr-insldr-track-decor-2">
+ <IMG
+ SRC="/.*resources/inputNumberSlider/spacer.gif/"
+ STYLE="display: block;"/>
+ </TD>
+ </TR>
+ </TABLE>
+ </DIV>
+ </TD>
+ </TR>
+ </TABLE>
+ </test>
+ <test id="inputNumberSpinnerTextChild">
+ <DIV>
+ <DIV>
+ <SPAN>Text Child</SPAN>
+ </DIV>
+ <TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0" STYLE="width: 200px; color: green;"
+ CLASS="dr-insldr rich-slider customStyleClass">
+ <TR>
+ <TD CLASS="dr-insldr-left-num rich-inslider-left-num">0</TD>
+ <TD CLASS="dr-insldr-right-num rich-inslider-right-num">100</TD>
+ <TD STYLE="text-align: left; vertical-align: bottom;" ROWSPAN="2">
+ <INPUT TYPE="text" SIZE="3" STYLE="color: blue;" VALUE="50"
+ CLASS="dr-insldr-field dr-insldr-field-right rich-inslider-field customInputClass"/>
+ </TD>
+ </TR>
+ <TR>
+ <TD CLASS="dr-insldr-size dr-insldr-vert-spacer" COLSPAN="2">
+ <DIV STYLE="position: relative;">
+ <DIV STYLE="visibility: visible;"
+ CLASS="dr-insldr-handler rich-inslider-handler customHandleClass"></DIV>
+ </DIV>
+ <DIV STYLE="color: red;" CLASS="dr-insldr-track rich-inslider-track customBarClass">
+ <TABLE CELLSPACING="0" CELLPADDING="0" CLASS="dr-insldr-track-decor-1">
+ <TR>
+ <TD CLASS="dr-insldr-track-decor-2">
+ <IMG
+ SRC="/.*resources/inputNumberSlider/spacer.gif/"
+ STYLE="display: block;"/>
+ </TD>
+ </TR>
+ </TABLE>
+ </DIV>
+ </TD>
+ </TR>
+ </TABLE>
+ </DIV>
+ </test>
</tests>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inputNumberSpinner.xhtml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inputNumberSpinner.xhtml 2008-12-10 14:46:27 UTC (rev 12539)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inputNumberSpinner.xhtml 2008-12-10 15:34:03 UTC (rev 12540)
@@ -9,12 +9,11 @@
</head>
<body>
<f:view>
- <rich:inputNumberSpinner id="inputNumberSpinner" value="50">
- </rich:inputNumberSpinner>
+ <rich:inputNumberSpinner id="inputNumberSpinner" value="50"/>
<rich:inputNumberSpinner id="inputNumberSpinnerCustomCSS" value="50"
styleClass="componentStyleClass" inputClass="inputStyleClass"
- inputStyle="font-style: italic;">
- </rich:inputNumberSpinner>
+ inputStyle="font-style: italic;"></rich:inputNumberSpinner>
+ <rich:inputNumberSpinner id="inputNumberSpinnerTextChild" value="50">Text Child</rich:inputNumberSpinner>
</f:view>
</body>
</html>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inputNumberSpinner.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inputNumberSpinner.xhtml.xml 2008-12-10 14:46:27 UTC (rev 12539)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/inputNumberSpinner.xhtml.xml 2008-12-10 15:34:03 UTC (rev 12540)
@@ -1,11 +1,11 @@
<tests>
<test id="inputNumberSpinner">
- <TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0" STYLE=""
- CLASS="rich-spinner-c">
+ <TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0"
+ CLASS="dr-spnr-c rich-spinner-c">
<TR>
<TD CLASS="dr-spnr-e rich-spinner-input-container">
<INPUT TYPE="text" CLASS="dr-spnr-i rich-spinner-input"
- STYLE="" SIZE="10" VALUE="50" />
+ SIZE="10" VALUE="50" />
</TD>
<TD CLASS="dr-spnr-b rich-spinner-buttons">
<TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0">
@@ -29,8 +29,8 @@
</TABLE>
</test>
<test id="inputNumberSpinnerCustomCSS">
- <TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0" STYLE=""
- CLASS="rich-spinner-c componentStyleClass">
+ <TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0"
+ CLASS="dr-spnr-c rich-spinner-c componentStyleClass">
<TR>
<TD CLASS="dr-spnr-e rich-spinner-input-container">
<INPUT TYPE="text" CLASS="dr-spnr-i rich-spinner-input inputStyleClass"
@@ -57,4 +57,38 @@
</TR>
</TABLE>
</test>
+ <test id="inputNumberSpinnerTextChild">
+ <DIV>
+ <DIV>
+ <SPAN>Text Child</SPAN>
+ </DIV>
+ <TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0"
+ CLASS="dr-spnr-c rich-spinner-c">
+ <TR>
+ <TD CLASS="dr-spnr-e rich-spinner-input-container">
+ <INPUT TYPE="text" CLASS="dr-spnr-i rich-spinner-input"
+ SIZE="10" VALUE="50" />
+ </TD>
+ <TD CLASS="dr-spnr-b rich-spinner-buttons">
+ <TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0">
+ <TR>
+ <TD>
+ <INPUT TYPE="image" BORDER="0"
+ SRC="/.*resources/inputNumberSpinner/up.gif/"
+ CLASS="dr-spnr-bn rich-spinner-button" />
+ </TD>
+ </TR>
+ <TR>
+ <TD>
+ <INPUT TYPE="image" BORDER="0"
+ SRC="/.*resources/inputNumberSpinner/down.gif/"
+ CLASS="dr-spnr-bn rich-spinner-button" />
+ </TD>
+ </TR>
+ </TABLE>
+ </TD>
+ </TR>
+ </TABLE>
+ </DIV>
+ </test>
</tests>
\ No newline at end of file
17 years, 4 months
JBoss Tools SVN: r12539 - in trunk: jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-12-10 09:46:27 -0500 (Wed, 10 Dec 2008)
New Revision: 12539
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3376/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3376/jbide3376.jsp
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3376/jbide3376.jsp.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3376Test.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCommandLinkTemplate.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionParentName.java
Log:
JBIDE-3376
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCommandLinkTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCommandLinkTemplate.java 2008-12-10 14:36:05 UTC (rev 12538)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCommandLinkTemplate.java 2008-12-10 14:46:27 UTC (rev 12539)
@@ -14,6 +14,7 @@
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
@@ -41,7 +42,7 @@
boolean disabled = ComponentUtil.string2boolean(ComponentUtil
.getAttribute(element, HTML.ATTR_DISABLED));
String value = ComponentUtil.getAttribute(element, HTML.ATTR_VALUE);
- boolean hasParentForm = hasParentForm(element);
+ boolean hasParentForm = hasParentForm(pageContext, element);
if (!hasParentForm) {
parentElement = visualDocument.createElement(HTML.TAG_SPAN);
@@ -79,11 +80,12 @@
}
- private boolean hasParentForm(Element sourceElement) {
+ private boolean hasParentForm(VpePageContext pageContext, Element sourceElement) {
Node parent = sourceElement.getParentNode();
while (parent != null && parent instanceof Element && parent.getNodeName() != null) {
- if (parent.getNodeName().indexOf(H_FORM) >= 0
- || parent.getNodeName().indexOf(A4J_FORM) >= 0) {
+ String parentTemplateName = VpeTemplateManager.getInstance().getTemplateName(pageContext, parent);
+ if (H_FORM.equals(parentTemplateName)
+ || A4J_FORM.equals(parentTemplateName)) {
return true;
}
parent = parent.getParentNode();
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3376/jbide3376.jsp
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3376/jbide3376.jsp (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3376/jbide3376.jsp 2008-12-10 14:46:27 UTC (rev 12539)
@@ -0,0 +1,30 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="j"%>
+<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+
+<html>
+<head></head>
+<body id="jbide3376">
+<f:view >
+ <j:form>
+ <j:dataTable value="#{bookList.bookList}" var="book">
+ <f:facet name="header">
+ <j:outputText value="Header" />
+ </f:facet>
+ <f:facet name="footer">
+ <j:outputText value="Header" />
+ </f:facet>
+ <j:column>
+ <j:outputText value="#{book.name}" />
+ </j:column>
+ <j:column>
+ <j:outputText value="#{book.name}" />
+ </j:column>
+ </j:dataTable>
+ <j:commandLink action="none" value="Go next page:" />
+ <br></br>
+ <j:outputText value="Begin" />
+ </j:form>
+</f:view>
+</body>
+</html>
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3376/jbide3376.jsp.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3376/jbide3376.jsp.xml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3376/jbide3376.jsp.xml 2008-12-10 14:46:27 UTC (rev 12539)
@@ -0,0 +1,82 @@
+<tests>
+ <test id="jbide3376">
+ <DIV ID="jbide3376">
+<TABLE STYLE="border: 1px dotted rgb(255, 102, 0); padding: 5px; width: 100%;">
+<TR>
+<TD>
+<DIV>
+<FORM STYLE="border: 1px dotted rgb(255, 102, 0); padding: 5px;">
+<TABLE STYLE="-moz-user-modify: read-only;">
+<TR>
+<TD>
+<DIV>
+<TABLE>
+<CAPTION>
+</CAPTION>
+<THEAD>
+<TR>
+<TH>
+<DIV>
+<SPAN>
+Header
+</SPAN>
+</DIV>
+</TH>
+</TR>
+</THEAD>
+<TFOOT>
+<TR>
+<TD>
+<DIV>
+<SPAN>
+Header
+</SPAN>
+</DIV>
+</TD>
+</TR>
+</TFOOT>
+<TBODY>
+<TR>
+<TD STYLE="border: 0px hidden ; padding: 0px;">
+<TABLE WIDTH="100%" BORDER="0">
+<TBODY>
+<TR>
+<TD>
+<SPAN>
+#{book.name}
+</SPAN>
+</TD>
+<TD>
+<SPAN>
+#{book.name}
+</SPAN>
+</TD>
+</TR>
+</TBODY>
+<COLGROUP>
+<COL STYLE="-moz-user-modify: read-write;"/>
+
+<COL STYLE="-moz-user-modify: read-write;"/>
+
+</COLGROUP>
+</TABLE>
+</TD>
+</TR>
+</TBODY>
+</TABLE>
+</DIV>
+</TD>
+</TR>
+</TABLE><A>Go next page:</A><BR STYLE="-moz-user-modify: read-write;"/>
+
+<SPAN>
+Begin
+</SPAN>
+</FORM>
+</DIV>
+</TD>
+</TR>
+</TABLE>
+</DIV>
+</test>
+</tests>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-12-10 14:36:05 UTC (rev 12538)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-12-10 14:46:27 UTC (rev 12539)
@@ -44,6 +44,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3127Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3144Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3163Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3376Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE675Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE788Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE924Test;
@@ -113,6 +114,7 @@
suite.addTestSuite(JBIDE3144Test.class);
suite.addTestSuite(JBIDE2354Test.class);
suite.addTestSuite(JBIDE3163Test.class);
+ suite.addTestSuite(JBIDE3376Test.class);
// $JUnit-END$
// added by Max Areshkau
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3376Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3376Test.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3376Test.java 2008-12-10 14:46:27 UTC (rev 12539)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+
+import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
+import org.jboss.tools.vpe.ui.test.ComponentContentTest;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class JBIDE3376Test extends ComponentContentTest{
+
+ public JBIDE3376Test(String name) {
+ super(name);
+ }
+
+ @Override
+ protected String getTestProjectName() {
+ return JsfAllTests.IMPORT_PROJECT_NAME;
+ }
+
+ public void testJBIDE3144Test2() throws Throwable {
+ performContentTest("JBIDE/3376/jbide3376.jsp"); //$NON-NLS-1$
+ }
+
+}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-12-10 14:36:05 UTC (rev 12538)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-12-10 14:46:27 UTC (rev 12539)
@@ -23,8 +23,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-
-import org.apache.commons.httpclient.methods.GetMethod;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.Path;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2008-12-10 14:36:05 UTC (rev 12538)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2008-12-10 14:46:27 UTC (rev 12539)
@@ -332,7 +332,7 @@
* @param sourceNode
* @return name of template
*/
- private String getTemplateName(VpePageContext pageContext, Node sourceNode) {
+ public String getTemplateName(VpePageContext pageContext, Node sourceNode) {
if(sourceNode==null) {
return null;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionParentName.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionParentName.java 2008-12-10 14:36:05 UTC (rev 12538)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionParentName.java 2008-12-10 14:46:27 UTC (rev 12539)
@@ -13,6 +13,7 @@
import org.w3c.dom.Node;
import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
/**
*
* @author mareshkau
@@ -25,6 +26,8 @@
public VpeValue exec(VpePageContext pageContext, Node sourceNode) {
Node parentNode = sourceNode.getParentNode();
- return new VpeValue(parentNode != null ? parentNode.getNodeName() : "");
+ String parentTemplateName = VpeTemplateManager.getInstance().getTemplateName(pageContext, parentNode);
+
+ return new VpeValue(parentTemplateName != null ? parentTemplateName : "");
}
}
17 years, 4 months
JBoss Tools SVN: r12538 - trunk/jsf/docs/userguide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: smukhina
Date: 2008-12-10 09:36:05 -0500 (Wed, 10 Dec 2008)
New Revision: 12538
Modified:
trunk/jsf/docs/userguide/en/modules/editors.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-419
Modified: trunk/jsf/docs/userguide/en/modules/editors.xml
===================================================================
--- trunk/jsf/docs/userguide/en/modules/editors.xml 2008-12-10 13:34:53 UTC (rev 12537)
+++ trunk/jsf/docs/userguide/en/modules/editors.xml 2008-12-10 14:36:05 UTC (rev 12538)
@@ -1004,7 +1004,7 @@
<para>The pages you are working with in <property>VPE</property> can use external
stylesheets. <property>VPE</property> allows you to create new style classes in
existing stylesheets and/or edit them as well. For these purposes <property>CSS
- Style Class Dialog</property> is provided.</para>
+ Style Class Dialog</property> is provided (hot keys - CTRL+SHIT+C).</para>
<para>Select the element for which you need to create or edit style class and press
button next to <emphasis>
<property>styleClass</property>
17 years, 4 months
JBoss Tools SVN: r12537 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor: context and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-12-10 08:34:53 -0500 (Wed, 10 Dec 2008)
New Revision: 12537
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionParentName.java
Log:
JBIDE-883
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-12-10 11:28:51 UTC (rev 12536)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-12-10 13:34:53 UTC (rev 12537)
@@ -202,7 +202,6 @@
// private nsIPresShell presShell;
private VpeSelectionController visualSelectionController;
VpeDomMapping domMapping;
- private VpeTemplateManager templateManager;
private VpeSourceDomBuilder sourceBuilder;
private VpeVisualDomBuilder visualBuilder;
/**
@@ -278,15 +277,13 @@
}
this.visualEditor = visualEditor;
visualEditor.setController(this);
- templateManager = VpeTemplateManager.getInstance();
bundle = new BundleMap();
bundle.init(sourceEditor);
- pageContext = new VpePageContext(templateManager, bundle, editPart);
+ pageContext = new VpePageContext(bundle, editPart);
domMapping = new VpeDomMapping(pageContext);
sourceBuilder = new VpeSourceDomBuilder(domMapping, this,
- templateManager, sourceEditor, pageContext);
- visualBuilder = new VpeVisualDomBuilder(domMapping, this,
- templateManager, visualEditor, pageContext);
+ VpeTemplateManager.getInstance(), sourceEditor, pageContext);
+ visualBuilder = new VpeVisualDomBuilder(domMapping, this, visualEditor, pageContext);
pageContext.setSourceDomBuilder(sourceBuilder);
pageContext.setVisualDomBuilder(visualBuilder);
IDOMModel sourceModel = (IDOMModel) getModel();
@@ -314,7 +311,7 @@
visualBuilder.refreshExternalLinks();
visualBuilder.buildDom(sourceDocument);
- templateManager.addTemplateListener(this);
+ VpeTemplateManager.getInstance().addTemplateListener(this);
xulRunnerEditor = visualEditor.getXulRunnerEditor();
// TODO Sergey Vasilyev figure out with nsIPressShell
@@ -419,10 +416,9 @@
switcher.destroyActiveEditor();
switcher = null;
- if (templateManager != null) {
- templateManager.removeTemplateListener(this);
- templateManager = null;
- }
+
+ VpeTemplateManager.getInstance().removeTemplateListener(this);
+
if (visualBuilder != null) {
visualBuilder.dispose();
visualBuilder = null;
@@ -1504,7 +1500,7 @@
data = editAnyData(sourceEditor, isCorrectNS,
data);
if (data != null && data.isChanged())
- templateManager.setAnyTemplate(data);
+ VpeTemplateManager.getInstance().setAnyTemplate(data);
}
});
@@ -1977,9 +1973,9 @@
if (includeList.includesRefresh()) {
visualRefresh();
}
- if (templateManager != null) {
- templateManager.reload();
- }
+
+ VpeTemplateManager.getInstance().reload();
+
if (bundle != null) {
bundle.refresh();
if (pageContext != null) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDomBuilder.java 2008-12-10 11:28:51 UTC (rev 12536)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDomBuilder.java 2008-12-10 13:34:53 UTC (rev 12537)
@@ -24,14 +24,12 @@
public class VpeDomBuilder {
protected VpeDomMapping domMapping;
- protected VpeTemplateManager templateManager;
private INodeAdapter sorceAdapter;
private List sourceNodes = new ArrayList();
- public VpeDomBuilder(VpeDomMapping domMapping, INodeAdapter sorceAdapter, VpeTemplateManager templateManager) {
+ public VpeDomBuilder(VpeDomMapping domMapping, INodeAdapter sorceAdapter) {
this.domMapping = domMapping;
this.sorceAdapter = sorceAdapter;
- this.templateManager = templateManager;
}
public VpeDomMapping getDomMapping () {
@@ -39,7 +37,7 @@
}
public VpeTemplateManager getTemplateManager () {
- return templateManager;
+ return VpeTemplateManager.getInstance();
}
public void registerNodes(VpeNodeMapping nodeMapping) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java 2008-12-10 11:28:51 UTC (rev 12536)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java 2008-12-10 13:34:53 UTC (rev 12537)
@@ -46,7 +46,7 @@
* @param pageContext
*/
public VpePreviewDomBuilder(VpeDomMapping domMapping, INodeAdapter sorceAdapter, VpeTemplateManager templateManager, MozillaEditor visualEditor, VpePageContext pageContext) {
- super(domMapping, sorceAdapter, templateManager, visualEditor, pageContext);
+ super(domMapping, sorceAdapter, visualEditor, pageContext);
}
/**
@@ -67,7 +67,7 @@
return null;
}
getPageContext().setCurrentVisualNode(visualOldContainer);
- VpeTemplate template = templateManager.getTemplate(getPageContext(), sourceNode, ifDependencySet);
+ VpeTemplate template = getTemplateManager().getTemplate(getPageContext(), sourceNode, ifDependencySet);
VpeCreationData creationData;
//FIX FOR JBIDE-1568, added by Max Areshkau
@@ -92,7 +92,7 @@
}
}catch (XPCOMException ex) {
VpePlugin.getPluginLog().logError(ex);
- VpeTemplate defTemplate = templateManager.getDefTemplate();
+ VpeTemplate defTemplate = getTemplateManager().getDefTemplate();
creationData = defTemplate.create(getPageContext(), sourceNode, getVisualDocument());
}
getPageContext().setCurrentVisualNode(null);
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java 2008-12-10 11:28:51 UTC (rev 12536)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java 2008-12-10 13:34:53 UTC (rev 12537)
@@ -58,7 +58,7 @@
private StructuredTextEditor sourceEditor;
public VpeSourceDomBuilder(VpeDomMapping domMapping, INodeAdapter sorceAdapter, VpeTemplateManager templateManager, StructuredTextEditor sourceEditor, VpePageContext pageContext) {
- super(domMapping, sorceAdapter, templateManager);
+ super(domMapping, sorceAdapter);
this.sourceEditor = sourceEditor;
structuredTextViewer = sourceEditor.getTextViewer();
outline = (IContentOutlinePage)sourceEditor.getAdapter(IContentOutlinePage.class);
@@ -227,7 +227,7 @@
Set ifDependencySet = new HashSet();
//VpeVisualDomBuilder visualBuildet =
pageContext.getVisualBuilder();
- VpeTemplate template = templateManager.getTemplate(pageContext, sourceNewElement, ifDependencySet);
+ VpeTemplate template = getTemplateManager().getTemplate(pageContext, sourceNewElement, ifDependencySet);
registerNodes(new VpeElementMapping(sourceNewElement, (nsIDOMElement)visualNewNode, null, template, ifDependencySet, null));
addChildren(visualNewNode, sourceNewElement);
return sourceNewElement;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-12-10 11:28:51 UTC (rev 12536)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-12-10 13:34:53 UTC (rev 12537)
@@ -172,10 +172,10 @@
private boolean showInvisibleTags;
public VpeVisualDomBuilder(VpeDomMapping domMapping,
- INodeAdapter sorceAdapter, VpeTemplateManager templateManager,
+ INodeAdapter sorceAdapter,
MozillaEditor visualEditor, VpePageContext pageContext) {
- super(domMapping, sorceAdapter, templateManager);
+ super(domMapping, sorceAdapter);
this.visualEditor = visualEditor;
xulRunnerEditor = visualEditor.getXulRunnerEditor();
@@ -437,7 +437,7 @@
Set<Node> ifDependencySet = new HashSet<Node>();
pageContext.setCurrentVisualNode(visualOldContainer);
- VpeTemplate template = templateManager.getTemplate(pageContext,
+ VpeTemplate template = getTemplateManager().getTemplate(pageContext,
sourceNode, ifDependencySet);
VpeCreationData creationData = null;
@@ -470,7 +470,7 @@
} catch (XPCOMException ex) {
VpePlugin.getPluginLog().logError(ex);
- VpeTemplate defTemplate = templateManager.getDefTemplate();
+ VpeTemplate defTemplate = getTemplateManager().getDefTemplate();
creationData = defTemplate.create(getPageContext(), sourceNode,
getVisualDocument());
}
@@ -711,7 +711,7 @@
// get template
Set<Node> ifDependencySet = new HashSet<Node>();
- VpeTemplate template = templateManager.getTemplate(pageContext, node,
+ VpeTemplate template = getTemplateManager().getTemplate(pageContext, node,
ifDependencySet);
// check if invisible tag
if (template.isInvisible())
@@ -892,13 +892,10 @@
}
}
- // if (isEmptyElement(visualContainer)) {
- // addPseudoElementImpl(visualContainer);
- // }
}
private void addPseudoElementImpl(nsIDOMNode visualParent) {
- if (!templateManager.isWithoutPseudoElementContainer(visualParent
+ if (!getTemplateManager().isWithoutPseudoElementContainer(visualParent
.getNodeName())) {
if (VpeDebug.VISUAL_ADD_PSEUDO_ELEMENT) {
System.out.println("-------------------- addPseudoElement: " //$NON-NLS-1$
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java 2008-12-10 11:28:51 UTC (rev 12536)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java 2008-12-10 13:34:53 UTC (rev 12537)
@@ -65,7 +65,7 @@
WtpKbConnector connector;
private nsIDOMNode currentVisualNode;
- public VpePageContext(VpeTemplateManager templateManager, BundleMap bundle, VpeEditorPart editPart) {
+ public VpePageContext(BundleMap bundle, VpeEditorPart editPart) {
this.bundle = bundle;
this.editPart = editPart;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java 2008-12-10 11:28:51 UTC (rev 12536)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java 2008-12-10 13:34:53 UTC (rev 12537)
@@ -173,7 +173,7 @@
BundleMap bundle = new BundleMap();
bundle.init(getSourceEditor());
- setPageContext(new VpePageContext(getTemplateManager(), bundle, getEditPart()));
+ setPageContext(new VpePageContext(bundle, getEditPart()));
VpeDomMapping domMapping = new VpeDomMapping(getPageContext());
VpeSourceDomBuilder sourceBuilder = new VpeSourceDomBuilder(domMapping, null, getTemplateManager(), getSourceEditor(), getPageContext());
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2008-12-10 11:28:51 UTC (rev 12536)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2008-12-10 13:34:53 UTC (rev 12537)
@@ -21,9 +21,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-
-import javax.swing.text.Style;
-
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
@@ -335,7 +332,7 @@
* @param sourceNode
* @return name of template
*/
- private String getTemplateName(VpePageContext pageContext, Node sourceNode) {
+ private String getTemplateName(VpePageContext pageContext, Node sourceNode) {
if(sourceNode==null) {
return null;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionParentName.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionParentName.java 2008-12-10 11:28:51 UTC (rev 12536)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionParentName.java 2008-12-10 13:34:53 UTC (rev 12537)
@@ -13,11 +13,18 @@
import org.w3c.dom.Node;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-
+/**
+ *
+ * @author mareshkau
+ *
+ */
public class VpeFunctionParentName extends VpeFunction {
-
+ /**
+ * Returns parent node name, with changed prefix like in template*.xml File
+ */
public VpeValue exec(VpePageContext pageContext, Node sourceNode) {
Node parentNode = sourceNode.getParentNode();
+
return new VpeValue(parentNode != null ? parentNode.getNodeName() : "");
}
}
17 years, 4 months
JBoss Tools SVN: r12536 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-12-10 06:28:51 -0500 (Wed, 10 Dec 2008)
New Revision: 12536
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
Log:
JBIDE-3376, we doesn't support tomahawk ui components, so x:* and t* was removed
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-12-10 11:24:33 UTC (rev 12535)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-12-10 11:28:51 UTC (rev 12536)
@@ -667,7 +667,7 @@
<vpe:tag name="h:column" case-sensitive="yes">
<vpe:if
- test="parentname()='h:dataTable'|parentname()='h:panelGrid'|parentname()='x:dataTable'|parentname()='t:dataTable'|parentname()='t:newspaperTable'|parentname()='t:tree'">
+ test="parentname()='h:dataTable'|parentname()='h:panelGrid'">
<!-- Gavr --><!-- added x: 8.02.05 -->
<vpe:template children="yes" modify="yes">
<vpe:column title="{tagstring()}" />
17 years, 4 months
JBoss Tools SVN: r12535 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-12-10 06:24:33 -0500 (Wed, 10 Dec 2008)
New Revision: 12535
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataOrderedListTemplate.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3263, fixed.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataOrderedListTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataOrderedListTemplate.java 2008-12-10 09:14:38 UTC (rev 12534)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataOrderedListTemplate.java 2008-12-10 11:24:33 UTC (rev 12535)
@@ -11,11 +11,11 @@
package org.jboss.tools.jsf.vpe.richfaces.template;
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.editor.util.VisualDomUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
@@ -35,7 +35,7 @@
Element sourceElement = (Element)sourceNode;
nsIDOMElement orderedList = visualDocument.createElement(HTML.TAG_OL);
- ComponentUtil.setCSSLink(pageContext, CSS_FILE_NAME, "richFacesDataOrderList");
+ ComponentUtil.setCSSLink(pageContext, CSS_FILE_NAME, "richFacesDataOrderList"); //$NON-NLS-1$
VisualDomUtil.copyAttributes(sourceNode, orderedList);
ComponentUtil.correctAttribute(sourceElement, orderedList,
@@ -56,16 +56,32 @@
} catch (NumberFormatException x) {
// this is OK, rows still equals 1
}
-
- for (int i = 0; i < rows; i++) {
+
+ String rowClassesString = sourceElement.getAttribute(RichFaces.ATTR_ROW_CLASSES);
+ String[] rowClasses = null;
+ if (ComponentUtil.isNotBlank(rowClassesString)) {
+ rowClasses = rowClassesString.split(Constants.COMMA);
+ }
+
+ /*
+ * If rows==0 display at least one row.
+ */
+ int i = 0;
+ do {
nsIDOMElement listItem = visualDocument.createElement(HTML.TAG_LI);
- listItem.setAttribute(HTML.ATTR_CLASS, LIST_ITEM_CLASSES);
+ String rowClass = LIST_ITEM_CLASSES;
+ if ((null != rowClasses) && (rowClasses.length > 0)) {
+ rowClass += Constants.WHITE_SPACE + rowClasses[i % rowClasses.length];
+ }
+
+ listItem.setAttribute(HTML.ATTR_CLASS, rowClass);
orderedList.appendChild(listItem);
VpeChildrenInfo info = new VpeChildrenInfo(listItem);
encodeListItem(info, sourceElement);
creatorInfo.addChildrenInfo(info);
- }
+ i++;
+ } while (i < rows);
return creatorInfo;
}
@@ -85,4 +101,14 @@
}
}
}
+
+
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+
}
17 years, 4 months
JBoss Tools SVN: r12534 - in trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks: ui/editors and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-12-10 04:14:38 -0500 (Wed, 10 Dec 2008)
New Revision: 12534
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java
Log:
JBIDE-3379
synchronize CR1 branch
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-12-10 09:09:51 UTC (rev 12533)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-12-10 09:14:38 UTC (rev 12534)
@@ -96,6 +96,10 @@
private HashMap usedBeanIDMap = new HashMap();
+ private List sourceModelList = null;
+
+ private List targetModelList = null;
+
public JavaBeanAnalyzer() {
adapterFactory = new ComposedAdapterFactory(
@@ -237,8 +241,8 @@
.iterator(); iterator3.hasNext();) {
LineConnectionModel childConnection = (LineConnectionModel) iterator3
.next();
- analyzeChildrenConnectionsToCreateBindingType(childConnection,
- child,
+ analyzeChildrenConnectionsToCreateBindingType(
+ childConnection, child,
(AbstractStructuredDataModel) source,
resourceConfig, root, resourceList,
getBindingsParamType(resourceConfig));
@@ -526,11 +530,13 @@
SmooksResourceListType listType, Object sourceObject,
Object targetObject) {
if (sourceObject instanceof List) {
+ sourceModelList = (List) sourceObject;
if (!((List) sourceObject).isEmpty()) {
sourceObject = (JavaBeanModel) ((List) sourceObject).get(0);
}
}
if (targetObject instanceof List) {
+ targetModelList = (List) targetObject;
if (!((List) targetObject).isEmpty()) {
targetObject = (JavaBeanModel) ((List) targetObject).get(0);
}
@@ -552,6 +558,9 @@
ResourceType rt = rc.getResource();
// find the first BeanPopulator resource config , this is the root.
String resourceClazz = null;
+ if(resourceConfigIsUsed(rc)){
+ continue;
+ }
if (rt != null) {
resourceClazz = rt.getStringValue();
}
@@ -567,6 +576,15 @@
if (selector != null) {
selector = selector.trim();
}
+ if(!sourceName.equals(selector)){
+ source = findJavaBeanModelFormList(selector, sourceModelList);
+ if(source != null){
+ sourceClazz = source.getBeanClass();
+ if (sourceClazz != null) {
+ sourceName = sourceClazz.getName();
+ }
+ }
+ }
if (sourceName.equals(selector)) {
String targetName = target.getName();
Class targetClazz = target.getBeanClass();
@@ -577,12 +595,20 @@
SmooksModelUtils.BEAN_CLASS, rc);
if (targetName != null
&& targetName.trim().equals(beanClass)) {
- // create the first connection
+ } else {
+ JavaBeanModel temptarget = findJavaBeanModelFormList(
+ beanClass, targetModelList);
+ if (temptarget != null) {
+ target = temptarget;
+ }
+ }
+ if (target != null) {
mappingModelList.add(new MappingModel(source, target));
resourceConfigList.addResourceConfig(rc);
analyzeMappingModelFromResourceConfig(mappingModelList,
resourceConfigList, listType, rc, source,
target);
+ setResourceConfigUsed(rc);
}
}
}
@@ -591,6 +617,22 @@
return resourceConfigList;
}
+ private JavaBeanModel findJavaBeanModelFormList(String beanClassString,
+ List objectList) {
+ if (beanClassString == null)
+ return null;
+ for (Iterator iterator = objectList.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+ if (object instanceof JavaBeanModel) {
+ if (beanClassString.equals(((JavaBeanModel) object)
+ .getBeanClassString())) {
+ return (JavaBeanModel) object;
+ }
+ }
+ }
+ return null;
+ }
+
protected boolean isReferenceSelector(String selector) {
return (selector.startsWith(COMPLEX_PRIX_START) && selector
.endsWith(COMPLEX_PRIX_END));
@@ -612,7 +654,6 @@
if (bindingList == null)
return;
- setResourceConfigUsed(resourceConfig);
registeSourceJavaBeanWithResourceConfig(resourceConfig, source);
for (Iterator<Object> iterator = bindingList.iterator(); iterator
.hasNext();) {
@@ -648,6 +689,7 @@
analyzeMappingModelFromResourceConfig(mappingModelList,
mappingResourceConfigList, resourceList, rc,
sourceModel, childTargetModel);
+ setResourceConfigUsed(rc);
}
}
} else {
@@ -739,12 +781,16 @@
List resourceConfigList = listType.getAbstractResourceConfig();
String rootClassName = null;
ResourceConfigType current = null;
+ List<JavaBeanModel> list = new ArrayList<JavaBeanModel>();
for (Iterator iterator = resourceConfigList.iterator(); iterator
.hasNext();) {
AbstractResourceConfig ar = (AbstractResourceConfig) iterator
.next();
if (ar instanceof ResourceConfigType) {
ResourceConfigType rc = (ResourceConfigType) ar;
+ if (resourceConfigIsUsed(rc)) {
+ continue;
+ }
ResourceType resourceType = rc.getResource();
if (resourceType == null)
continue;
@@ -755,57 +801,62 @@
// create root beanmodel
rootClassName = rc.getSelector();
current = rc;
- break;
+ if (rootClassName == null) {
+ rootClassName = this.getDataSourceClass(graphInfo,
+ SOURCE_DATA);
+ }
+ if (rootClassName == null) {
+ return null;
+ } else {
+ rootClassName = rootClassName.trim();
+ }
+ boolean isWarning = false;
+ boolean isError = false;
+ Class clazz = null;
+ try {
+ if (classLoader == null) {
+ IProject project = sourceFile.getProject();
+ classLoader = new ProjectClassLoader(JavaCore
+ .create(project));
+ }
+
+ clazz = classLoader.loadClass(rootClassName);
+ } catch (ClassNotFoundException e) {
+ // TODO if can't find the class throws exception
+ // MODIFY by Dart 2008.11.12
+ throw new RuntimeException("Can't find the class : \""
+ + rootClassName
+ + "\" to create the JavaBean model");
+ } catch (JavaModelException e) {
+ e.printStackTrace();
+ }
+ JavaBeanModel model = null;
+ if (clazz != null) {
+ model = JavaBeanModelFactory
+ .getJavaBeanModelWithLazyLoad(clazz);
+ } else {
+ model = new JavaBeanModel(null, rootClassName);
+ model.setRootClassModel(true);
+ model
+ .setError(Messages
+ .getString("JavaBeanAnalyzer.ClassNotExist") + rootClassName); //$NON-NLS-1$
+ model.setProperties(new ArrayList());
+ isError = true;
+ }
+ if (model != null) {
+ setCollectionsInstanceClassName(model, current);
+ this.setSelectorIsUsed(rootClassName);
+ buildSourceInputProperties(listType, model, false,
+ isError, current, classLoader);
+ this.setResourceConfigUsed(current);
+ }
+ if (model != null) {
+ if (!modelIsInList(list, model.getBeanClassString()))
+ list.add(model);
+ }
}
}
}
- if (rootClassName == null) {
- rootClassName = this.getDataSourceClass(graphInfo, SOURCE_DATA);
- }
- if (rootClassName == null) {
- return null;
- } else {
- rootClassName = rootClassName.trim();
- }
- boolean isWarning = false;
- boolean isError = false;
- Class clazz = null;
- try {
- if (classLoader == null) {
- IProject project = sourceFile.getProject();
- classLoader = new ProjectClassLoader(JavaCore.create(project));
- }
-
- clazz = classLoader.loadClass(rootClassName);
- } catch (ClassNotFoundException e) {
- // TODO if can't find the class throws exception
- // MODIFY by Dart 2008.11.12
- throw new RuntimeException("Can't find the class : \""
- + rootClassName + "\" to create the JavaBean model");
- } catch (JavaModelException e) {
- e.printStackTrace();
- }
- JavaBeanModel model = null;
- if (clazz != null) {
- model = JavaBeanModelFactory.getJavaBeanModelWithLazyLoad(clazz);
- } else {
- model = new JavaBeanModel(null, rootClassName);
- model.setRootClassModel(true);
- model
- .setError(Messages
- .getString("JavaBeanAnalyzer.ClassNotExist") + rootClassName); //$NON-NLS-1$
- model.setProperties(new ArrayList());
- isError = true;
- }
- if (model != null) {
- setCollectionsInstanceClassName(model, current);
- this.setSelectorIsUsed(rootClassName);
- buildSourceInputProperties(listType, model, false, isError,
- current, classLoader);
- }
- List<JavaBeanModel> list = new ArrayList<JavaBeanModel>();
- if (model != null)
- list.add(model);
return list;
}
@@ -891,8 +942,8 @@
throw new RuntimeException(e);
}
}
-// throw new RuntimeException(
-// "Can't load Java bean model form the config file.");
+ // throw new RuntimeException(
+ // "Can't load Java bean model form the config file.");
}
// if can't load the source from GraphicalInformation , return NULL
if (current == null && rootClassName == null)
@@ -924,8 +975,8 @@
} catch (ClassNotFoundException e) {
// TODO if can't find the class throws exception
// MODIFY by Dart 2008.11.12
-// throw new RuntimeException("Can't find the class : \""
-// + rootClassName + "\" to create the JavaBean model");
+ // throw new RuntimeException("Can't find the class : \""
+ // + rootClassName + "\" to create the JavaBean model");
}
}
boolean rootIsError = false;
@@ -937,6 +988,9 @@
rootModel = new JavaBeanModel(null, rootClassName);
rootIsError = true;
}
+ if (modelIsInList(list, rootModel.getBeanClassString())) {
+ continue;
+ }
if (resourceConfig != null) {
rootModel.setBeanClassString(SmooksModelUtils.getParmaText(
SmooksModelUtils.BEAN_CLASS, resourceConfig));
@@ -949,6 +1003,21 @@
return list;
}
+ private boolean modelIsInList(List list, String modelClassString) {
+ if (list == null || modelClassString == null)
+ return false;
+ for (Iterator iterator = list.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+ if (object instanceof JavaBeanModel) {
+ if (modelClassString.equals(((JavaBeanModel) object)
+ .getBeanClassString())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
protected void buildChildrenOfTargetInputModel(
SmooksResourceListType listType, JavaBeanModel beanModel,
boolean rootIsWarning, boolean rootIsError,
@@ -1096,7 +1165,7 @@
selector = this.getBeanIdWithRawSelectorString(selector);
ResourceConfigType resourceConfig = findResourceConfigTypeWithBeanId(
selector, listType);
- if (resourceConfig != null) {
+ if (resourceConfig != null && !resourceConfigIsUsed(resourceConfig)) {
String referenceSelector = resourceConfig.getSelector();
JavaBeanModel model = findTheChildJavaBeanModel(
referenceSelector, currentModel);
@@ -1133,6 +1202,7 @@
}
buildSourceInputProperties(listType, model, false, true,
resourceConfig, classLoader);
+ setResourceConfigUsed(resourceConfig);
}
} else {
selector = selector.trim();
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-12-10 09:09:51 UTC (rev 12533)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-12-10 09:14:38 UTC (rev 12534)
@@ -890,7 +890,10 @@
commandStackChanged = true;
analyzeDesignGraph();
updateSelectionActions();
- getManagedForm().dirtyStateChanged();
+ IManagedForm form = getManagedForm();
+ if(form != null){
+ form.dirtyStateChanged();
+ }
}
});
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java 2008-12-10 09:09:51 UTC (rev 12533)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java 2008-12-10 09:14:38 UTC (rev 12534)
@@ -56,6 +56,7 @@
*/
public class UIUtils {
+
public static final String[] SELECTORE_SPLITER = new String[] { "\\", //$NON-NLS-1$
"/" }; //$NON-NLS-1$
@@ -346,11 +347,8 @@
command
.setResolveDescription(Messages
.getString("UIUtils.InstanceLoadedResolveMessage1") //$NON-NLS-1$
- + ((JavaBeanModel) refObj)
- .getBeanClass()
- .getCanonicalName() + "\""); //$NON-NLS-1$
- command.setInstanceName(((JavaBeanModel) refObj)
- .getBeanClass().getCanonicalName());
+ + instanceName + "\""); //$NON-NLS-1$
+ command.setInstanceName(instanceName);
command.setJavaBean((JavaBeanModel) refObj);
result.addResolveCommand(command);
resultList.add(result);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java 2008-12-10 09:09:51 UTC (rev 12533)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java 2008-12-10 09:14:38 UTC (rev 12534)
@@ -43,7 +43,6 @@
import org.jboss.tools.smooks.xml.model.DocumentObject;
import org.jboss.tools.smooks.xml.model.TagObject;
import org.jboss.tools.smooks.xml.model.TagPropertyObject;
-import org.w3c.dom.ranges.DocumentRange;
/**
* @author Dart Peng
17 years, 4 months
JBoss Tools SVN: r12533 - in branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks: ui/editors and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-12-10 04:09:51 -0500 (Wed, 10 Dec 2008)
New Revision: 12533
Modified:
branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java
branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java
Log:
JBIDE-3379
fix some multiple mapping bugs
Modified: branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
===================================================================
--- branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-12-10 08:03:21 UTC (rev 12532)
+++ branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-12-10 09:09:51 UTC (rev 12533)
@@ -96,6 +96,10 @@
private HashMap usedBeanIDMap = new HashMap();
+ private List sourceModelList = null;
+
+ private List targetModelList = null;
+
public JavaBeanAnalyzer() {
adapterFactory = new ComposedAdapterFactory(
@@ -134,7 +138,8 @@
public void analyzeGraphicalModel(AbstractStructuredDataModel root,
List resouceList) {
- if(root == null) return;
+ if (root == null)
+ return;
List children = root.getChildren();
for (Iterator iterator = children.iterator(); iterator.hasNext();) {
TreeItemRelationModel dataModel = (TreeItemRelationModel) iterator
@@ -237,8 +242,8 @@
.iterator(); iterator3.hasNext();) {
LineConnectionModel childConnection = (LineConnectionModel) iterator3
.next();
- analyzeChildrenConnectionsToCreateBindingType(childConnection,
- child,
+ analyzeChildrenConnectionsToCreateBindingType(
+ childConnection, child,
(AbstractStructuredDataModel) source,
resourceConfig, root, resourceList,
getBindingsParamType(resourceConfig));
@@ -526,11 +531,13 @@
SmooksResourceListType listType, Object sourceObject,
Object targetObject) {
if (sourceObject instanceof List) {
+ sourceModelList = (List) sourceObject;
if (!((List) sourceObject).isEmpty()) {
sourceObject = (JavaBeanModel) ((List) sourceObject).get(0);
}
}
if (targetObject instanceof List) {
+ targetModelList = (List) targetObject;
if (!((List) targetObject).isEmpty()) {
targetObject = (JavaBeanModel) ((List) targetObject).get(0);
}
@@ -552,6 +559,9 @@
ResourceType rt = rc.getResource();
// find the first BeanPopulator resource config , this is the root.
String resourceClazz = null;
+ if(resourceConfigIsUsed(rc)){
+ continue;
+ }
if (rt != null) {
resourceClazz = rt.getStringValue();
}
@@ -567,6 +577,15 @@
if (selector != null) {
selector = selector.trim();
}
+ if(!sourceName.equals(selector)){
+ source = findJavaBeanModelFormList(selector, sourceModelList);
+ if(source != null){
+ sourceClazz = source.getBeanClass();
+ if (sourceClazz != null) {
+ sourceName = sourceClazz.getName();
+ }
+ }
+ }
if (sourceName.equals(selector)) {
String targetName = target.getName();
Class targetClazz = target.getBeanClass();
@@ -577,12 +596,20 @@
SmooksModelUtils.BEAN_CLASS, rc);
if (targetName != null
&& targetName.trim().equals(beanClass)) {
- // create the first connection
+ } else {
+ JavaBeanModel temptarget = findJavaBeanModelFormList(
+ beanClass, targetModelList);
+ if (temptarget != null) {
+ target = temptarget;
+ }
+ }
+ if (target != null) {
mappingModelList.add(new MappingModel(source, target));
resourceConfigList.addResourceConfig(rc);
analyzeMappingModelFromResourceConfig(mappingModelList,
resourceConfigList, listType, rc, source,
target);
+ setResourceConfigUsed(rc);
}
}
}
@@ -591,6 +618,22 @@
return resourceConfigList;
}
+ private JavaBeanModel findJavaBeanModelFormList(String beanClassString,
+ List objectList) {
+ if (beanClassString == null)
+ return null;
+ for (Iterator iterator = objectList.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+ if (object instanceof JavaBeanModel) {
+ if (beanClassString.equals(((JavaBeanModel) object)
+ .getBeanClassString())) {
+ return (JavaBeanModel) object;
+ }
+ }
+ }
+ return null;
+ }
+
protected boolean isReferenceSelector(String selector) {
return (selector.startsWith(COMPLEX_PRIX_START) && selector
.endsWith(COMPLEX_PRIX_END));
@@ -612,7 +655,6 @@
if (bindingList == null)
return;
- setResourceConfigUsed(resourceConfig);
registeSourceJavaBeanWithResourceConfig(resourceConfig, source);
for (Iterator<Object> iterator = bindingList.iterator(); iterator
.hasNext();) {
@@ -648,6 +690,7 @@
analyzeMappingModelFromResourceConfig(mappingModelList,
mappingResourceConfigList, resourceList, rc,
sourceModel, childTargetModel);
+ setResourceConfigUsed(rc);
}
}
} else {
@@ -739,12 +782,16 @@
List resourceConfigList = listType.getAbstractResourceConfig();
String rootClassName = null;
ResourceConfigType current = null;
+ List<JavaBeanModel> list = new ArrayList<JavaBeanModel>();
for (Iterator iterator = resourceConfigList.iterator(); iterator
.hasNext();) {
AbstractResourceConfig ar = (AbstractResourceConfig) iterator
.next();
if (ar instanceof ResourceConfigType) {
ResourceConfigType rc = (ResourceConfigType) ar;
+ if (resourceConfigIsUsed(rc)) {
+ continue;
+ }
ResourceType resourceType = rc.getResource();
if (resourceType == null)
continue;
@@ -755,57 +802,62 @@
// create root beanmodel
rootClassName = rc.getSelector();
current = rc;
- break;
+ if (rootClassName == null) {
+ rootClassName = this.getDataSourceClass(graphInfo,
+ SOURCE_DATA);
+ }
+ if (rootClassName == null) {
+ return null;
+ } else {
+ rootClassName = rootClassName.trim();
+ }
+ boolean isWarning = false;
+ boolean isError = false;
+ Class clazz = null;
+ try {
+ if (classLoader == null) {
+ IProject project = sourceFile.getProject();
+ classLoader = new ProjectClassLoader(JavaCore
+ .create(project));
+ }
+
+ clazz = classLoader.loadClass(rootClassName);
+ } catch (ClassNotFoundException e) {
+ // TODO if can't find the class throws exception
+ // MODIFY by Dart 2008.11.12
+ throw new RuntimeException("Can't find the class : \""
+ + rootClassName
+ + "\" to create the JavaBean model");
+ } catch (JavaModelException e) {
+ e.printStackTrace();
+ }
+ JavaBeanModel model = null;
+ if (clazz != null) {
+ model = JavaBeanModelFactory
+ .getJavaBeanModelWithLazyLoad(clazz);
+ } else {
+ model = new JavaBeanModel(null, rootClassName);
+ model.setRootClassModel(true);
+ model
+ .setError(Messages
+ .getString("JavaBeanAnalyzer.ClassNotExist") + rootClassName); //$NON-NLS-1$
+ model.setProperties(new ArrayList());
+ isError = true;
+ }
+ if (model != null) {
+ setCollectionsInstanceClassName(model, current);
+ this.setSelectorIsUsed(rootClassName);
+ buildSourceInputProperties(listType, model, false,
+ isError, current, classLoader);
+ this.setResourceConfigUsed(current);
+ }
+ if (model != null) {
+ if (!modelIsInList(list, model.getBeanClassString()))
+ list.add(model);
+ }
}
}
}
- if (rootClassName == null) {
- rootClassName = this.getDataSourceClass(graphInfo, SOURCE_DATA);
- }
- if (rootClassName == null) {
- return null;
- } else {
- rootClassName = rootClassName.trim();
- }
- boolean isWarning = false;
- boolean isError = false;
- Class clazz = null;
- try {
- if (classLoader == null) {
- IProject project = sourceFile.getProject();
- classLoader = new ProjectClassLoader(JavaCore.create(project));
- }
-
- clazz = classLoader.loadClass(rootClassName);
- } catch (ClassNotFoundException e) {
- // TODO if can't find the class throws exception
- // MODIFY by Dart 2008.11.12
- throw new RuntimeException("Can't find the class : \""
- + rootClassName + "\" to create the JavaBean model");
- } catch (JavaModelException e) {
- e.printStackTrace();
- }
- JavaBeanModel model = null;
- if (clazz != null) {
- model = JavaBeanModelFactory.getJavaBeanModelWithLazyLoad(clazz);
- } else {
- model = new JavaBeanModel(null, rootClassName);
- model.setRootClassModel(true);
- model
- .setError(Messages
- .getString("JavaBeanAnalyzer.ClassNotExist") + rootClassName); //$NON-NLS-1$
- model.setProperties(new ArrayList());
- isError = true;
- }
- if (model != null) {
- setCollectionsInstanceClassName(model, current);
- this.setSelectorIsUsed(rootClassName);
- buildSourceInputProperties(listType, model, false, isError,
- current, classLoader);
- }
- List<JavaBeanModel> list = new ArrayList<JavaBeanModel>();
- if (model != null)
- list.add(model);
return list;
}
@@ -891,8 +943,8 @@
throw new RuntimeException(e);
}
}
-// throw new RuntimeException(
-// "Can't load Java bean model form the config file.");
+ // throw new RuntimeException(
+ // "Can't load Java bean model form the config file.");
}
// if can't load the source from GraphicalInformation , return NULL
if (current == null && rootClassName == null)
@@ -924,8 +976,8 @@
} catch (ClassNotFoundException e) {
// TODO if can't find the class throws exception
// MODIFY by Dart 2008.11.12
-// throw new RuntimeException("Can't find the class : \""
-// + rootClassName + "\" to create the JavaBean model");
+ // throw new RuntimeException("Can't find the class : \""
+ // + rootClassName + "\" to create the JavaBean model");
}
}
boolean rootIsError = false;
@@ -937,6 +989,9 @@
rootModel = new JavaBeanModel(null, rootClassName);
rootIsError = true;
}
+ if (modelIsInList(list, rootModel.getBeanClassString())) {
+ continue;
+ }
if (resourceConfig != null) {
rootModel.setBeanClassString(SmooksModelUtils.getParmaText(
SmooksModelUtils.BEAN_CLASS, resourceConfig));
@@ -949,6 +1004,21 @@
return list;
}
+ private boolean modelIsInList(List list, String modelClassString) {
+ if (list == null || modelClassString == null)
+ return false;
+ for (Iterator iterator = list.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+ if (object instanceof JavaBeanModel) {
+ if (modelClassString.equals(((JavaBeanModel) object)
+ .getBeanClassString())) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
protected void buildChildrenOfTargetInputModel(
SmooksResourceListType listType, JavaBeanModel beanModel,
boolean rootIsWarning, boolean rootIsError,
@@ -1096,7 +1166,7 @@
selector = this.getBeanIdWithRawSelectorString(selector);
ResourceConfigType resourceConfig = findResourceConfigTypeWithBeanId(
selector, listType);
- if (resourceConfig != null) {
+ if (resourceConfig != null && !resourceConfigIsUsed(resourceConfig)) {
String referenceSelector = resourceConfig.getSelector();
JavaBeanModel model = findTheChildJavaBeanModel(
referenceSelector, currentModel);
@@ -1133,6 +1203,7 @@
}
buildSourceInputProperties(listType, model, false, true,
resourceConfig, classLoader);
+ setResourceConfigUsed(resourceConfig);
}
} else {
selector = selector.trim();
Modified: branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
===================================================================
--- branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-12-10 08:03:21 UTC (rev 12532)
+++ branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-12-10 09:09:51 UTC (rev 12533)
@@ -896,7 +896,10 @@
commandStackChanged = true;
analyzeDesignGraph();
updateSelectionActions();
- getManagedForm().dirtyStateChanged();
+ IManagedForm form = getManagedForm();
+ if(form != null){
+ form.dirtyStateChanged();
+ }
}
});
Modified: branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java
===================================================================
--- branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java 2008-12-10 08:03:21 UTC (rev 12532)
+++ branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/utils/UIUtils.java 2008-12-10 09:09:51 UTC (rev 12533)
@@ -56,6 +56,7 @@
*/
public class UIUtils {
+
public static final String[] SELECTORE_SPLITER = new String[] { "\\", //$NON-NLS-1$
"/" }; //$NON-NLS-1$
@@ -348,11 +349,8 @@
command
.setResolveDescription(Messages
.getString("UIUtils.InstanceLoadedResolveMessage1") //$NON-NLS-1$
- + ((JavaBeanModel) refObj)
- .getBeanClass()
- .getCanonicalName() + "\""); //$NON-NLS-1$
- command.setInstanceName(((JavaBeanModel) refObj)
- .getBeanClass().getCanonicalName());
+ + instanceName + "\""); //$NON-NLS-1$
+ command.setInstanceName(instanceName);
command.setJavaBean((JavaBeanModel) refObj);
result.addResolveCommand(command);
resultList.add(result);
Modified: branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java
===================================================================
--- branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java 2008-12-10 08:03:21 UTC (rev 12532)
+++ branches/jbosstools-3.0.0.CR1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java 2008-12-10 09:09:51 UTC (rev 12533)
@@ -43,7 +43,6 @@
import org.jboss.tools.smooks.xml.model.DocumentObject;
import org.jboss.tools.smooks.xml.model.TagObject;
import org.jboss.tools.smooks.xml.model.TagPropertyObject;
-import org.w3c.dom.ranges.DocumentRange;
/**
* @author Dart Peng
17 years, 4 months
JBoss Tools SVN: r12532 - workspace/grid/esb-example.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2008-12-10 03:03:21 -0500 (Wed, 10 Dec 2008)
New Revision: 12532
Modified:
workspace/grid/esb-example/webservice_producer.zip
Log:
modify a esb example
Modified: workspace/grid/esb-example/webservice_producer.zip
===================================================================
(Binary files differ)
17 years, 4 months
JBoss Tools SVN: r12531 - workspace/examples.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2008-12-10 03:01:26 -0500 (Wed, 10 Dec 2008)
New Revision: 12531
Modified:
workspace/examples/projectExamples.xml
Log:
modify esb examples
Modified: workspace/examples/projectExamples.xml
===================================================================
--- workspace/examples/projectExamples.xml 2008-12-10 07:37:00 UTC (rev 12530)
+++ workspace/examples/projectExamples.xml 2008-12-10 08:01:26 UTC (rev 12531)
@@ -182,7 +182,7 @@
<shortDescription>JBoss ESB Web Service producer Example</shortDescription>
<description>This sample demonstrates how to deploy a JSR181 Webservice endpoint on
JBossESB using the SOAPProcessor action.</description>
- <size>17600</size>
+ <size>53000</size>
<url>
http://anonsvn.jboss.org/repos/jbosstools/workspace/grid/esb-example/webs...
</url>
17 years, 4 months