Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoritrimble2007-03-30 18:31:17 +0000
committeritrimble2007-03-30 18:31:17 +0000
commit94c1c0d8f24cc7886e2fb474331e79dfae0273ea (patch)
treee7b9069528816e8d0a8f2b5466b6946bfed4de6c
parentc6ea3f003704a98ef0d85621563a41dccdcd020d (diff)
downloadwebtools.jsf-94c1c0d8f24cc7886e2fb474331e79dfae0273ea.tar.gz
webtools.jsf-94c1c0d8f24cc7886e2fb474331e79dfae0273ea.tar.xz
webtools.jsf-94c1c0d8f24cc7886e2fb474331e79dfae0273ea.zip
Added new system-provided transform operations. Updated DTInfo metadata. Removed now-obsolete custom transform operations.
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/metadata/jsf_html_dti.xml268
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectBasedOperation.java90
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectManyListboxOperation.java48
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectManyMenuOperation.java36
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectOneListboxOperation.java48
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectOneMenuOperation.java36
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/provisional/DTHTMLOutputRenderer.java62
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/provisional/DTTagConverterDecorator.java7
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/provisional/AppendChildTextFromXPathOperation.java65
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/provisional/CreateAttributeFromXPathOperation.java62
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/provisional/IterateOverElementsOperation.java73
11 files changed, 527 insertions, 268 deletions
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/metadata/jsf_html_dti.xml b/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/metadata/jsf_html_dti.xml
index 7c54df83f..ba46243d1 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/metadata/jsf_html_dti.xml
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/metadata/jsf_html_dti.xml
@@ -520,8 +520,75 @@
<trait id="dt-info">
<value xsi:type="dti:DTInfo">
<tag-convert-info>
- <operation id="CustomTransformOperation">
- <parameter value="org.eclipse.jst.pagedesigner.jsf.ui.converter.operations.jsf.SelectManyListboxOperation"/>
+ <operation id="CreateElementOperation">
+ <parameter value="select"/>
+ </operation>
+ <operation id="CopyAllAttributesOperation"/>
+ <operation id="RenameAttributeOperation">
+ <parameter value="styleClass"/>
+ <parameter value="class"/>
+ </operation>
+ <operation id="RenameAttributeOperation">
+ <parameter value="id"/>
+ <parameter value="name"/>
+ </operation>
+ <!-- multiple select allowed -->
+ <operation id="CreateAttributeOperation">
+ <parameter value="multiple"/>
+ <parameter value="multiple"/>
+ </operation>
+ <!-- if no "size" attribute -->
+ <operation id="IfNotOperation">
+ <parameter value="@size"/>
+ <operation id="CreateAttributeFromXPathOperation">
+ <parameter value="size"/>
+ <parameter value="count(selectItem)"/>
+ </operation>
+ </operation>
+ <!-- iterate over "selectItem" children -->
+ <operation id="IterateOverElementsOperation">
+ <parameter value="selectItem"/>
+ <operation id="AppendChildElementOperation">
+ <parameter value="option"/>
+ </operation>
+ <operation id="CopyAttributeOperation">
+ <parameter value="itemValue"/>
+ </operation>
+ <operation id="RenameAttributeOperation">
+ <parameter value="itemValue"/>
+ <parameter value="value"/>
+ </operation>
+ <operation id="IfOperation">
+ <parameter value="@itemLabel"/>
+ <operation id="AppendChildTextFromXPathOperation">
+ <parameter value="@itemLabel"/>
+ </operation>
+ </operation>
+ <operation id="IfNotOperation">
+ <parameter value="@itemLabel"/>
+ <operation id="IfOperation">
+ <parameter value="@value"/>
+ <operation id="AppendChildTextFromXPathOperation">
+ <parameter value="@value"/>
+ </operation>
+ </operation>
+ <operation id="IfNotOperation">
+ <parameter value="@value"/>
+ <operation id="IfOperation">
+ <parameter value="@itemValue"/>
+ <operation id="AppendChildTextFromXPathOperation">
+ <parameter value="@itemValue"/>
+ </operation>
+ </operation>
+ <operation id="IfNotOperation">
+ <parameter value="@itemValue"/>
+ <operation id="AppendChildTextOperation">
+ <parameter value="selectItem"/>
+ </operation>
+ </operation>
+ </operation>
+ </operation>
+ <operation id="MakeParentElementCurrentOperation"/>
</operation>
</tag-convert-info>
<tag-decorate-info id="vpd-decorate-design"
@@ -536,8 +603,72 @@
<trait id="dt-info">
<value xsi:type="dti:DTInfo">
<tag-convert-info>
- <operation id="CustomTransformOperation">
- <parameter value="org.eclipse.jst.pagedesigner.jsf.ui.converter.operations.jsf.SelectManyMenuOperation"/>
+ <operation id="CreateElementOperation">
+ <parameter value="select"/>
+ </operation>
+ <operation id="CopyAllAttributesOperation"/>
+ <operation id="RenameAttributeOperation">
+ <parameter value="styleClass"/>
+ <parameter value="class"/>
+ </operation>
+ <operation id="RenameAttributeOperation">
+ <parameter value="id"/>
+ <parameter value="name"/>
+ </operation>
+ <!-- multiple select allowed -->
+ <operation id="CreateAttributeOperation">
+ <parameter value="multiple"/>
+ <parameter value="multiple"/>
+ </operation>
+ <!-- size fixed at 1 -->
+ <operation id="CreateAttributeOperation">
+ <parameter value="size"/>
+ <parameter value="1"/>
+ </operation>
+ <!-- iterate over "selectItem" children -->
+ <operation id="IterateOverElementsOperation">
+ <parameter value="selectItem"/>
+ <operation id="AppendChildElementOperation">
+ <parameter value="option"/>
+ </operation>
+ <operation id="CopyAttributeOperation">
+ <parameter value="itemValue"/>
+ </operation>
+ <operation id="RenameAttributeOperation">
+ <parameter value="itemValue"/>
+ <parameter value="value"/>
+ </operation>
+ <operation id="IfOperation">
+ <parameter value="@itemLabel"/>
+ <operation id="AppendChildTextFromXPathOperation">
+ <parameter value="@itemLabel"/>
+ </operation>
+ </operation>
+ <operation id="IfNotOperation">
+ <parameter value="@itemLabel"/>
+ <operation id="IfOperation">
+ <parameter value="@value"/>
+ <operation id="AppendChildTextFromXPathOperation">
+ <parameter value="@value"/>
+ </operation>
+ </operation>
+ <operation id="IfNotOperation">
+ <parameter value="@value"/>
+ <operation id="IfOperation">
+ <parameter value="@itemValue"/>
+ <operation id="AppendChildTextFromXPathOperation">
+ <parameter value="@itemValue"/>
+ </operation>
+ </operation>
+ <operation id="IfNotOperation">
+ <parameter value="@itemValue"/>
+ <operation id="AppendChildTextOperation">
+ <parameter value="selectItem"/>
+ </operation>
+ </operation>
+ </operation>
+ </operation>
+ <operation id="MakeParentElementCurrentOperation"/>
</operation>
</tag-convert-info>
<tag-decorate-info id="vpd-decorate-design"
@@ -552,8 +683,70 @@
<trait id="dt-info">
<value xsi:type="dti:DTInfo">
<tag-convert-info>
- <operation id="CustomTransformOperation">
- <parameter value="org.eclipse.jst.pagedesigner.jsf.ui.converter.operations.jsf.SelectOneListboxOperation"/>
+ <operation id="CreateElementOperation">
+ <parameter value="select"/>
+ </operation>
+ <operation id="CopyAllAttributesOperation"/>
+ <operation id="RenameAttributeOperation">
+ <parameter value="styleClass"/>
+ <parameter value="class"/>
+ </operation>
+ <operation id="RenameAttributeOperation">
+ <parameter value="id"/>
+ <parameter value="name"/>
+ </operation>
+ <!-- if no "size" attribute -->
+ <operation id="IfNotOperation">
+ <parameter value="@size"/>
+ <operation id="CreateAttributeFromXPathOperation">
+ <parameter value="size"/>
+ <parameter value="count(selectItem)"/>
+ </operation>
+ </operation>
+ <!-- iterate over "selectItem" children -->
+ <operation id="IterateOverElementsOperation">
+ <parameter value="selectItem"/>
+ <operation id="AppendChildElementOperation">
+ <parameter value="option"/>
+ </operation>
+ <operation id="CopyAttributeOperation">
+ <parameter value="itemValue"/>
+ </operation>
+ <operation id="RenameAttributeOperation">
+ <parameter value="itemValue"/>
+ <parameter value="value"/>
+ </operation>
+ <operation id="IfOperation">
+ <parameter value="@itemLabel"/>
+ <operation id="AppendChildTextFromXPathOperation">
+ <parameter value="@itemLabel"/>
+ </operation>
+ </operation>
+ <operation id="IfNotOperation">
+ <parameter value="@itemLabel"/>
+ <operation id="IfOperation">
+ <parameter value="@value"/>
+ <operation id="AppendChildTextFromXPathOperation">
+ <parameter value="@value"/>
+ </operation>
+ </operation>
+ <operation id="IfNotOperation">
+ <parameter value="@value"/>
+ <operation id="IfOperation">
+ <parameter value="@itemValue"/>
+ <operation id="AppendChildTextFromXPathOperation">
+ <parameter value="@itemValue"/>
+ </operation>
+ </operation>
+ <operation id="IfNotOperation">
+ <parameter value="@itemValue"/>
+ <operation id="AppendChildTextOperation">
+ <parameter value="selectItem"/>
+ </operation>
+ </operation>
+ </operation>
+ </operation>
+ <operation id="MakeParentElementCurrentOperation"/>
</operation>
</tag-convert-info>
<tag-decorate-info id="vpd-decorate-design"
@@ -568,8 +761,67 @@
<trait id="dt-info">
<value xsi:type="dti:DTInfo">
<tag-convert-info>
- <operation id="CustomTransformOperation">
- <parameter value="org.eclipse.jst.pagedesigner.jsf.ui.converter.operations.jsf.SelectOneMenuOperation"/>
+ <operation id="CreateElementOperation">
+ <parameter value="select"/>
+ </operation>
+ <operation id="CopyAllAttributesOperation"/>
+ <operation id="RenameAttributeOperation">
+ <parameter value="styleClass"/>
+ <parameter value="class"/>
+ </operation>
+ <operation id="RenameAttributeOperation">
+ <parameter value="id"/>
+ <parameter value="name"/>
+ </operation>
+ <!-- size fixed at 1 -->
+ <operation id="CreateAttributeOperation">
+ <parameter value="size"/>
+ <parameter value="1"/>
+ </operation>
+ <!-- iterate over "selectItem" children -->
+ <operation id="IterateOverElementsOperation">
+ <parameter value="selectItem"/>
+ <operation id="AppendChildElementOperation">
+ <parameter value="option"/>
+ </operation>
+ <operation id="CopyAttributeOperation">
+ <parameter value="itemValue"/>
+ </operation>
+ <operation id="RenameAttributeOperation">
+ <parameter value="itemValue"/>
+ <parameter value="value"/>
+ </operation>
+ <operation id="IfOperation">
+ <parameter value="@itemLabel"/>
+ <operation id="AppendChildTextFromXPathOperation">
+ <parameter value="@itemLabel"/>
+ </operation>
+ </operation>
+ <operation id="IfNotOperation">
+ <parameter value="@itemLabel"/>
+ <operation id="IfOperation">
+ <parameter value="@value"/>
+ <operation id="AppendChildTextFromXPathOperation">
+ <parameter value="@value"/>
+ </operation>
+ </operation>
+ <operation id="IfNotOperation">
+ <parameter value="@value"/>
+ <operation id="IfOperation">
+ <parameter value="@itemValue"/>
+ <operation id="AppendChildTextFromXPathOperation">
+ <parameter value="@itemValue"/>
+ </operation>
+ </operation>
+ <operation id="IfNotOperation">
+ <parameter value="@itemValue"/>
+ <operation id="AppendChildTextOperation">
+ <parameter value="selectItem"/>
+ </operation>
+ </operation>
+ </operation>
+ </operation>
+ <operation id="MakeParentElementCurrentOperation"/>
</operation>
</tag-convert-info>
<tag-decorate-info id="vpd-decorate-design"
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectBasedOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectBasedOperation.java
deleted file mode 100644
index 9768ce91a..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectBasedOperation.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 Oracle Corporation.
- * All rights reserved. This program and the accompanying materials
- * are 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
- *
- * Contributors:
- * Ian Trimble - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.jsf.ui.converter.operations.jsf;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.AbstractTransformOperation;
-import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.CopyAllAttributesOperation;
-import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.RenameAttributeOperation;
-import org.w3c.dom.Element;
-
-/**
- * Abstract ITransformOperation implementation intended as super class for HTML
- * "select"-based "selectXXX" JSF (HTML) Elements.
- *
- * <br><b>Note:</b> requires ITransformOperation.setTagConverterContext(...) to
- * have been called to provide a valid ITagConverterContext instance prior to
- * a call to the transform(...) method.
- *
- * @author Ian Trimble - Oracle
- */
-public abstract class SelectBasedOperation extends AbstractTransformOperation {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.AbstractTransformOperation#transform(org.w3c.dom.Element, org.w3c.dom.Element)
- */
- public Element transform(Element srcElement, Element curElement) {
- Element selectElement = createElement("select");
- new CopyAllAttributesOperation().transform(srcElement, selectElement);
- new RenameAttributeOperation("id", "name").transform(srcElement, selectElement);
- new RenameAttributeOperation("styleClass", "style").transform(srcElement, selectElement);
- handleMultipleAndSizeAttributes(srcElement, selectElement);
- List selectItemList = getChildElements(srcElement, "selectItem");
- Iterator itSelectItemList = selectItemList.iterator();
- while (itSelectItemList.hasNext()) {
- Element selectItem = (Element)itSelectItemList.next();
- Element optionElement = appendChildElement("option", selectElement);
- optionElement.setAttribute("value", selectItem.getAttribute("itemValue"));
- String label = getSelectItemLabel(selectItem);
- appendChildText(label, optionElement);
- }
- return selectElement;
- }
-
- /**
- * Subclasses override this in order to set the "multiple" and "size"
- * attributes of the "select" Element.
- *
- * @param srcElement Source Element instance.
- * @param selectElement "select" Element instance.
- */
- protected abstract void handleMultipleAndSizeAttributes(Element srcElement, Element selectElement);
-
- /**
- * Attempts to get a label for the selectItem Element instance.
- *
- * @param selectItem "selectItem" source Element instance.
- * @return Label for the specified selectItem Element instance.
- */
- private String getSelectItemLabel(Element selectItem) {
- String attribute = selectItem.getAttribute("itemLabel");
- if (attribute != null && attribute.length() > 0) {
- return attribute;
- }
- attribute = selectItem.getAttribute("value");
- if (attribute != null && attribute.length() > 0) {
- return attribute;
- }
- attribute = selectItem.getAttribute("itemDescription");
- if (attribute != null && attribute.length() > 0) {
- return attribute;
- }
- attribute = selectItem.getAttribute("itemValue");
- if (attribute != null && attribute.length() > 0) {
- return attribute;
- }
- return "selectItem";
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectManyListboxOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectManyListboxOperation.java
deleted file mode 100644
index 519abc292..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectManyListboxOperation.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 Oracle Corporation.
- * All rights reserved. This program and the accompanying materials
- * are 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
- *
- * Contributors:
- * Ian Trimble - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.jsf.ui.converter.operations.jsf;
-
-import java.util.List;
-
-import org.w3c.dom.Element;
-
-/**
- * ITransformOperation implementation specifically for the "selectManyListbox"
- * JSF (HTML) Element.
- *
- * <br><b>Note:</b> requires ITransformOperation.setTagConverterContext(...) to
- * have been called to provide a valid ITagConverterContext instance prior to
- * a call to the transform(...) method.
- *
- * @author Ian Trimble - Oracle
- */
-public class SelectManyListboxOperation extends SelectBasedOperation {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jst.pagedesigner.jsf.ui.converter.operations.jsf.SelectBasedOperation#handleMultipleAndSizeAttributes(org.w3c.dom.Element, org.w3c.dom.Element)
- */
- protected void handleMultipleAndSizeAttributes(Element srcElement, Element selectElement) {
- selectElement.setAttribute("multiple", "multiple");
-
- String size = srcElement.getAttribute("size");
- if (size == null || size.length() < 1) {
- List selectItems = getChildElements(srcElement, "selectItem");
- if (selectItems.size() > 0) {
- size = String.valueOf(selectItems.size());
- } else {
- size = "3";
- }
- }
- selectElement.setAttribute("size", size);
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectManyMenuOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectManyMenuOperation.java
deleted file mode 100644
index dd28f4545..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectManyMenuOperation.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 Oracle Corporation.
- * All rights reserved. This program and the accompanying materials
- * are 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
- *
- * Contributors:
- * Ian Trimble - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.jsf.ui.converter.operations.jsf;
-
-import org.w3c.dom.Element;
-
-/**
- * ITransformOperation implementation specifically for the "selectManyMenu"
- * JSF (HTML) Element.
- *
- * <br><b>Note:</b> requires ITransformOperation.setTagConverterContext(...) to
- * have been called to provide a valid ITagConverterContext instance prior to
- * a call to the transform(...) method.
- *
- * @author Ian Trimble - Oracle
- */
-public class SelectManyMenuOperation extends SelectBasedOperation {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jst.pagedesigner.jsf.ui.converter.operations.jsf.SelectBasedOperation#handleMultipleAndSizeAttributes(org.w3c.dom.Element, org.w3c.dom.Element)
- */
- protected void handleMultipleAndSizeAttributes(Element srcElement, Element selectElement) {
- selectElement.setAttribute("multiple", "multiple");
- selectElement.setAttribute("size", "1");
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectOneListboxOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectOneListboxOperation.java
deleted file mode 100644
index bb95c3dcd..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectOneListboxOperation.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 Oracle Corporation.
- * All rights reserved. This program and the accompanying materials
- * are 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
- *
- * Contributors:
- * Ian Trimble - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.jsf.ui.converter.operations.jsf;
-
-import java.util.List;
-
-import org.w3c.dom.Element;
-
-/**
- * ITransformOperation implementation specifically for the "selectOneListbox"
- * JSF (HTML) Element.
- *
- * <br><b>Note:</b> requires ITransformOperation.setTagConverterContext(...) to
- * have been called to provide a valid ITagConverterContext instance prior to
- * a call to the transform(...) method.
- *
- * @author Ian Trimble - Oracle
- */
-public class SelectOneListboxOperation extends SelectBasedOperation {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jst.pagedesigner.jsf.ui.converter.operations.jsf.SelectBasedOperation#handleMultipleAndSizeAttributes(org.w3c.dom.Element, org.w3c.dom.Element)
- */
- protected void handleMultipleAndSizeAttributes(Element srcElement, Element selectElement) {
- selectElement.removeAttribute("multiple");
-
- String size = srcElement.getAttribute("size");
- if (size == null || size.length() < 1) {
- List selectItems = getChildElements(srcElement, "selectItem");
- if (selectItems.size() > 0) {
- size = String.valueOf(selectItems.size());
- } else {
- size = "3";
- }
- }
- selectElement.setAttribute("size", size);
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectOneMenuOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectOneMenuOperation.java
deleted file mode 100644
index 68c751da8..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/converter/operations/jsf/SelectOneMenuOperation.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 Oracle Corporation.
- * All rights reserved. This program and the accompanying materials
- * are 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
- *
- * Contributors:
- * Ian Trimble - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.jsf.ui.converter.operations.jsf;
-
-import org.w3c.dom.Element;
-
-/**
- * ITransformOperation implementation specifically for the "selectOneMenu"
- * JSF (HTML) Element.
- *
- * <br><b>Note:</b> requires ITransformOperation.setTagConverterContext(...) to
- * have been called to provide a valid ITagConverterContext instance prior to
- * a call to the transform(...) method.
- *
- * @author Ian Trimble - Oracle
- */
-public class SelectOneMenuOperation extends SelectBasedOperation {
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jst.pagedesigner.jsf.ui.converter.operations.jsf.SelectBasedOperation#handleMultipleAndSizeAttributes(org.w3c.dom.Element, org.w3c.dom.Element)
- */
- protected void handleMultipleAndSizeAttributes(Element srcElement, Element selectElement) {
- selectElement.removeAttribute("multiple");
- selectElement.setAttribute("size", "1");
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/provisional/DTHTMLOutputRenderer.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/provisional/DTHTMLOutputRenderer.java
index 39876d35a..0ee7a266d 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/provisional/DTHTMLOutputRenderer.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/provisional/DTHTMLOutputRenderer.java
@@ -18,15 +18,18 @@ import org.eclipse.jst.jsf.common.metadata.internal.provisional.Trait;
import org.eclipse.jst.jsf.common.ui.internal.logging.Logger;
import org.eclipse.jst.pagedesigner.PDPlugin;
import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.AppendChildElementOperation;
+import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.AppendChildTextFromXPathOperation;
import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.AppendChildTextOperation;
import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.ConvertAttributeToTextOperation;
import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.CopyAllAttributesOperation;
import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.CopyAttributeOperation;
import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.CopyChildrenOperation;
+import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.CreateAttributeFromXPathOperation;
import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.CreateAttributeOperation;
import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.CreateElementOperation;
import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.IfNotOperation;
import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.IfOperation;
+import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.IterateOverElementsOperation;
import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.MakeParentElementCurrentOperation;
import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.RemoveAttributeOperation;
import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.RenameAttributeOperation;
@@ -58,6 +61,9 @@ public class DTHTMLOutputRenderer implements IOutputRenderer {
private static final String OP_CustomTransformOperation = "CustomTransformOperation";
private static final String OP_IfOperation = "IfOperation";
private static final String OP_IfNotOperation = "IfNotOperation";
+ private static final String OP_IterateOverElementsOperation = "IterateOverElementsOperation";
+ private static final String OP_CreateAttributeFromXPathOperation = "CreateAttributeFromXPathOperation";
+ private static final String OP_AppendChildTextFromXPathOperation = "AppendChildTextFromXPathOperation";
private ITagConverterContext tagConverterContext;
@@ -267,6 +273,34 @@ public class DTHTMLOutputRenderer implements IOutputRenderer {
String xPathExpression = ((Parameter)parameters.get(0)).getValue();
currentTransformOperation = new IfNotOperation(xPathExpression);
transformer.appendTransformOperation(currentTransformOperation);
+ } else if (opID.equals(OP_IterateOverElementsOperation)) {
+ EList parameters = operation.getParameters();
+ if (parameters.size() < 1) {
+ log.error("Warning.DTHTMLOutputRenderer.TooFewParameters", opID);
+ return false;
+ }
+ String xPathExpression = ((Parameter)parameters.get(0)).getValue();
+ currentTransformOperation = new IterateOverElementsOperation(xPathExpression);
+ transformer.appendTransformOperation(currentTransformOperation);
+ } else if (opID.equals(OP_CreateAttributeFromXPathOperation)) {
+ EList parameters = operation.getParameters();
+ if (parameters.size() < 2) {
+ log.error("Warning.DTHTMLOutputRenderer.TooFewParameters", opID);
+ return false;
+ }
+ String attributeName = ((Parameter)parameters.get(0)).getValue();
+ String xPathExpression = ((Parameter)parameters.get(1)).getValue();
+ currentTransformOperation = new CreateAttributeFromXPathOperation(attributeName, xPathExpression);
+ transformer.appendTransformOperation(currentTransformOperation);
+ } else if (opID.equals(OP_AppendChildTextFromXPathOperation)) {
+ EList parameters = operation.getParameters();
+ if (parameters.size() < 1) {
+ log.error("Warning.DTHTMLOutputRenderer.TooFewParameters", opID);
+ return false;
+ }
+ String xPathExpression = ((Parameter)parameters.get(0)).getValue();
+ currentTransformOperation = new AppendChildTextFromXPathOperation(xPathExpression);
+ transformer.appendTransformOperation(currentTransformOperation);
} else {
log.error("Warning.DTHTMLOutputRenderer.UnknownOperationID", opID);
return false;
@@ -444,6 +478,34 @@ public class DTHTMLOutputRenderer implements IOutputRenderer {
String xPathExpression = ((Parameter)parameters.get(0)).getValue();
currentTransformOperation = new IfNotOperation(xPathExpression);
parentOperation.appendChildOperation(currentTransformOperation);
+ } else if (opID.equals(OP_IterateOverElementsOperation)) {
+ EList parameters = operation.getParameters();
+ if (parameters.size() < 1) {
+ log.error("Warning.DTHTMLOutputRenderer.TooFewParameters", opID);
+ return false;
+ }
+ String xPathExpression = ((Parameter)parameters.get(0)).getValue();
+ currentTransformOperation = new IterateOverElementsOperation(xPathExpression);
+ parentOperation.appendChildOperation(currentTransformOperation);
+ } else if (opID.equals(OP_CreateAttributeFromXPathOperation)) {
+ EList parameters = operation.getParameters();
+ if (parameters.size() < 2) {
+ log.error("Warning.DTHTMLOutputRenderer.TooFewParameters", opID);
+ return false;
+ }
+ String attributeName = ((Parameter)parameters.get(0)).getValue();
+ String xPathExpression = ((Parameter)parameters.get(1)).getValue();
+ currentTransformOperation = new CreateAttributeFromXPathOperation(attributeName, xPathExpression);
+ parentOperation.appendChildOperation(currentTransformOperation);
+ } else if (opID.equals(OP_AppendChildTextFromXPathOperation)) {
+ EList parameters = operation.getParameters();
+ if (parameters.size() < 1) {
+ log.error("Warning.DTHTMLOutputRenderer.TooFewParameters", opID);
+ return false;
+ }
+ String xPathExpression = ((Parameter)parameters.get(0)).getValue();
+ currentTransformOperation = new AppendChildTextFromXPathOperation(xPathExpression);
+ parentOperation.appendChildOperation(currentTransformOperation);
} else {
log.error("Warning.DTHTMLOutputRenderer.UnknownOperationID", opID);
return false;
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/provisional/DTTagConverterDecorator.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/provisional/DTTagConverterDecorator.java
index 84743ac46..045e6f147 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/provisional/DTTagConverterDecorator.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/provisional/DTTagConverterDecorator.java
@@ -32,6 +32,9 @@ import org.w3c.dom.Text;
*/
public class DTTagConverterDecorator implements ITagConverterDecorator {
+ private static final String DECORATE_INFO_ID_DESIGN = "vpd-decorate-design";
+ private static final String DECORATE_INFO_ID_PREVIEW = "vpd-decorate-preview";
+
/*
* (non-Javadoc)
* @see org.eclipse.jst.pagedesigner.dtmanager.converter.internal.provisional.ITagConverterDecorator#decorate(org.eclipse.jst.pagedesigner.converter.ITagConverter)
@@ -43,9 +46,9 @@ public class DTTagConverterDecorator implements ITagConverterDecorator {
DTTagConverter dtTagConverter = (DTTagConverter)tagConverter;
if (dtTagConverter.getMode() == IConverterFactory.MODE_DESIGNER) {
- decorateFromDTInfo(dtTagConverter, "vpd-decorate-design");
+ decorateFromDTInfo(dtTagConverter, DECORATE_INFO_ID_DESIGN);
} else if (dtTagConverter.getMode() == IConverterFactory.MODE_PREVIEW) {
- decorateFromDTInfo(dtTagConverter, "vpd-decorate-preview");
+ decorateFromDTInfo(dtTagConverter, DECORATE_INFO_ID_PREVIEW);
}
if (tagConverter.getResultElement() == null && tagConverter.isVisualByHTML()) {
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/provisional/AppendChildTextFromXPathOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/provisional/AppendChildTextFromXPathOperation.java
new file mode 100644
index 000000000..0c9c5f28a
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/provisional/AppendChildTextFromXPathOperation.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Oracle Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are 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
+ *
+ * Contributors:
+ * Ian Trimble - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+
+/**
+ * ITransformOperation implementation that creates a new child Text node by
+ * getting a value from the specified XPath expression.
+ *
+ * <br><b>Note:</b> requires ITransformOperation.setTagConverterContext(...) to
+ * have been called to provide a valid ITagConverterContext instance prior to
+ * a call to the transform(...) method.
+ *
+ * @author Ian Trimble - Oracle
+ */
+public class AppendChildTextFromXPathOperation extends AbstractTransformOperation {
+
+ private String xPathExpression;
+
+ /**
+ * Constructs an instance with the specified XPath expression.
+ *
+ * @param xPathExpression XPath expression to be evaluated against the
+ * source Element instance.
+ */
+ public AppendChildTextFromXPathOperation(String xPathExpression) {
+ this.xPathExpression = xPathExpression;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.AbstractTransformOperation#transform(org.w3c.dom.Element, org.w3c.dom.Element)
+ */
+ public Element transform(Element srcElement, Element curElement) {
+ if (srcElement != null) {
+ XPath xPath = XPathFactory.newInstance().newXPath();
+ try {
+ Object resultObject = xPath.evaluate(xPathExpression, srcElement, XPathConstants.STRING);
+ if (tagConverterContext != null && resultObject instanceof String && curElement != null) {
+ Text childText = tagConverterContext.createText((String)resultObject);
+ curElement.appendChild(childText);
+ }
+ } catch(XPathExpressionException xee) {
+ //could not evaluate - return curElement
+ }
+ }
+ return curElement;
+ }
+
+}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/provisional/CreateAttributeFromXPathOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/provisional/CreateAttributeFromXPathOperation.java
new file mode 100644
index 000000000..6b82196a9
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/provisional/CreateAttributeFromXPathOperation.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Oracle Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are 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
+ *
+ * Contributors:
+ * Ian Trimble - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.w3c.dom.Element;
+
+/**
+ * ITransformOperation implementation that creates a new attribute on the
+ * current Element by getting a value from the specified XPath expression.
+ *
+ * @author Ian Trimble - Oracle
+ */
+public class CreateAttributeFromXPathOperation extends AbstractTransformOperation {
+
+ private String attributeName;
+ private String xPathExpression;
+
+ /**
+ * Constructs an instance with the specified XPath expression.
+ *
+ * @param attributeName Name of attribute to be created.
+ * @param xPathExpression XPath expression to be evaluated against the
+ * source Element instance.
+ */
+ public CreateAttributeFromXPathOperation(String attributeName, String xPathExpression) {
+ this.attributeName = attributeName;
+ this.xPathExpression = xPathExpression;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.AbstractTransformOperation#transform(org.w3c.dom.Element, org.w3c.dom.Element)
+ */
+ public Element transform(Element srcElement, Element curElement) {
+ if (srcElement != null) {
+ XPath xPath = XPathFactory.newInstance().newXPath();
+ try {
+ Object resultObject = xPath.evaluate(xPathExpression, srcElement, XPathConstants.STRING);
+ if (resultObject instanceof String && curElement != null) {
+ curElement.setAttribute(attributeName, (String)resultObject);
+ }
+ } catch(XPathExpressionException xee) {
+ //could not evaluate - return curElement
+ }
+ }
+ return curElement;
+ }
+
+}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/provisional/IterateOverElementsOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/provisional/IterateOverElementsOperation.java
new file mode 100644
index 000000000..8e9143bb7
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/provisional/IterateOverElementsOperation.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Oracle Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are 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
+ *
+ * Contributors:
+ * Ian Trimble - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * ITransformOperation implementation that executes child ITransformOperation
+ * instances for each Element in the NodeList returned by the XPath expression,
+ * which is evaluated against the source Element.
+ *
+ * <br><b>Note:</b> requires ITransformOperation.setTagConverterContext(...) to
+ * have been called to provide a valid ITagConverterContext instance prior to
+ * a call to the transform(...) method.
+ *
+ * @author Ian Trimble - Oracle
+ */
+public class IterateOverElementsOperation extends AbstractTransformOperation {
+
+ private String xPathExpression;
+
+ /**
+ * Constructs an instance with the specified XPath expression.
+ *
+ * @param xPathExpression XPath expression to be evaluated against the
+ * source Element instance.
+ */
+ public IterateOverElementsOperation(String xPathExpression) {
+ this.xPathExpression = xPathExpression;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.provisional.AbstractTransformOperation#transform(org.w3c.dom.Element, org.w3c.dom.Element)
+ */
+ public Element transform(Element srcElement, Element curElement) {
+ Element retElement = curElement;
+ if (srcElement != null) {
+ XPath xPath = XPathFactory.newInstance().newXPath();
+ try {
+ Object resultObject = xPath.evaluate(xPathExpression, srcElement, XPathConstants.NODESET);
+ if (resultObject instanceof NodeList) {
+ NodeList nodes = (NodeList)resultObject;
+ for (int i = 0; i < nodes.getLength(); i++) {
+ Node node = nodes.item(i);
+ if (node instanceof Element) {
+ retElement = executeChildOperations((Element)node, retElement);
+ }
+ }
+ }
+ } catch(XPathExpressionException xee) {
+ //could not evaluate - return curElement
+ }
+ }
+ return retElement;
+ }
+
+}

Back to the top