diff options
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal')
16 files changed, 0 insertions, 929 deletions
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/AppendChildElementOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/AppendChildElementOperation.java deleted file mode 100644 index dd03f013b..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/AppendChildElementOperation.java +++ /dev/null @@ -1,71 +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.dtmanager.converter.operations.internal; - -import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; -import org.w3c.dom.Element; - -/** - * ITransformOperation implementation that appends a child Element and - * optionally makes the new Element current. - * - * <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 AppendChildElementOperation extends AbstractTransformOperation { - - private String tagName; - private boolean makeChildCurrent; - - /** - * Constructs an instance with the specified tag name, and defaults to - * making the new child Element current. - * - * @param tagName Name of child Element to be created. - */ - public AppendChildElementOperation(String tagName) { - this(tagName, true); - } - - /** - * Constructs an instance with the specified tag name and optionally makes - * the new child Element current. - * - * @param tagName Name of child Element to be created. - * @param makeChildCurrent If true, make new child Element current. - */ - public AppendChildElementOperation(String tagName, boolean makeChildCurrent) { - this.tagName = tagName; - this.makeChildCurrent = makeChildCurrent; - } - - /* - * (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 element = null; - if (tagConverterContext != null && curElement != null && tagName != null && tagName.length() > 0) { - Element childElement = tagConverterContext.createElement(tagName); - curElement.appendChild(childElement); - if (makeChildCurrent) { - element = childElement; - } else { - element = curElement; - } - } - return element; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/AppendChildTextFromXPathOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/AppendChildTextFromXPathOperation.java deleted file mode 100644 index f20d60869..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/AppendChildTextFromXPathOperation.java +++ /dev/null @@ -1,66 +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.dtmanager.converter.operations.internal; - -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; -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/AppendChildTextOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/AppendChildTextOperation.java deleted file mode 100644 index df9e93946..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/AppendChildTextOperation.java +++ /dev/null @@ -1,51 +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.dtmanager.converter.operations.internal; - -import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -/** - * ITransformOperation implementation that appends a child Text. - * - * <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 AppendChildTextOperation extends AbstractTransformOperation { - - private String content; - - /** - * Constructs an instance with the specified content. - * - * @param content Content of child Text to be created. - */ - public AppendChildTextOperation(String content) { - this.content = content; - } - - /* - * (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 (tagConverterContext != null && curElement != null && content != null && content.length() > 0) { - Text childText = tagConverterContext.createText(content); - curElement.appendChild(childText); - } - return curElement; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/ConvertAttributeToTextOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/ConvertAttributeToTextOperation.java deleted file mode 100644 index 314c3080c..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/ConvertAttributeToTextOperation.java +++ /dev/null @@ -1,75 +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.dtmanager.converter.operations.internal; - -import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; -import org.w3c.dom.Element; -import org.w3c.dom.Text; - -/** - * ITransformOperation implementation that converts an attribute to a child - * Text Node and optionally removes the specified attribute. - * - * <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 ConvertAttributeToTextOperation extends AbstractTransformOperation { - - private String attributeName; - private boolean removeAttribute; - - /** - * Constructs an instance with the specified attribute name, and defaults - * to removing the attribute. - * - * @param attributeName Name of attribute to be converted to a child Text - * Node. - */ - public ConvertAttributeToTextOperation(String attributeName) { - this(attributeName, true); - } - - /** - * Constructs an instance with the specified attribute name and optionally - * removes the attribute. - * - * @param attributeName Name of attribute to be converted to a child Text - * Node. - * @param removeAttribute It true, attribute is removed after child Text - * Node is created. - */ - public ConvertAttributeToTextOperation(String attributeName, boolean removeAttribute) { - this.attributeName = attributeName; - this.removeAttribute = removeAttribute; - } - - /* - * (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 (tagConverterContext != null && srcElement != null && curElement != null) { - String content = srcElement.getAttribute(attributeName); - if (content != null && content.length() > 0) { - Text text = tagConverterContext.createText(content); - curElement.appendChild(text); - if (removeAttribute) { - curElement.removeAttribute(attributeName); - } - } - } - return curElement; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CopyAllAttributesOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CopyAllAttributesOperation.java deleted file mode 100644 index 59b13f590..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CopyAllAttributesOperation.java +++ /dev/null @@ -1,41 +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.dtmanager.converter.operations.internal; - -import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; - -/** - * ITransformOperation implementation that copies all attributes from the - * source Element instance to the current Element instance. - * - * @author Ian Trimble - Oracle - */ -public class CopyAllAttributesOperation 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) { - if (srcElement != null && curElement != null) { - NamedNodeMap attributes = srcElement.getAttributes(); - for (int i = 0; i < attributes.getLength(); i++) { - Attr attribute = (Attr)attributes.item(i); - curElement.setAttribute(attribute.getName(), attribute.getValue()); - } - } - return curElement; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CopyAttributeOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CopyAttributeOperation.java deleted file mode 100644 index 5d77840af..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CopyAttributeOperation.java +++ /dev/null @@ -1,74 +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.dtmanager.converter.operations.internal; - -import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -/** - * Copies a single attribute from the source Element instance to the current - * Element instance, and optionally creates a new attribute on the current - * Element instance if no such attribute exists on the source Element instance. - * - * @author Ian Trimble - Oracle - */ -public class CopyAttributeOperation extends AbstractTransformOperation { - - private String attributeName; - private boolean create; - private String newAttributeValue; - - /** - * Constructs an instance with the specified attribute name, and defaults - * to not creating an attribute unless the named attribute exists on the - * source Element instance. - * - * @param attributeName Name of attribute to be copied. - */ - public CopyAttributeOperation(String attributeName) { - this(attributeName, false, null); - } - - /** - * Constructs an instance with the specified attribute name and optionally - * forces creation of a new attribute on the current Element even if the - * named attribute does not exist on the source Element instance. - * - * @param attributeName Name of attribute to be copied. - * @param create If true, create attribute on the current Element even if - * the named attribute does not exist on the source Element. - * @param newAttributeValue Value to set for the new attribute if not found - * on the source Element. - */ - public CopyAttributeOperation(String attributeName, boolean create, String newAttributeValue) { - this.attributeName = attributeName; - this.create = create; - this.newAttributeValue = newAttributeValue; - } - - /* - * (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 && curElement != null) { - Attr attribute = srcElement.getAttributeNode(attributeName); - if (attribute != null) { - curElement.setAttribute(attributeName, attribute.getValue()); - } else if (create && newAttributeValue != null) { - curElement.setAttribute(attributeName, newAttributeValue); - } - } - return curElement; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CopyChildrenOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CopyChildrenOperation.java deleted file mode 100644 index 206e595b3..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CopyChildrenOperation.java +++ /dev/null @@ -1,39 +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.dtmanager.converter.operations.internal; - -import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; -import org.w3c.dom.Element; - -/** - * ITransformOperation implementation that copies all child Elements as Nodes - * requiring subsequent tag conversion. - * - * <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 CopyChildrenOperation 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) { - if (tagConverterContext != null) { - tagConverterContext.copyChildren(srcElement, curElement); - } - return curElement; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CreateAttributeFromXPathOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CreateAttributeFromXPathOperation.java deleted file mode 100644 index 480428df7..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CreateAttributeFromXPathOperation.java +++ /dev/null @@ -1,63 +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.dtmanager.converter.operations.internal; - -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; -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/CreateAttributeOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CreateAttributeOperation.java deleted file mode 100644 index 9b5d2601b..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CreateAttributeOperation.java +++ /dev/null @@ -1,49 +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.dtmanager.converter.operations.internal; - -import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; -import org.w3c.dom.Element; - -/** - * ITransformOperation implementation that creates a new attribute on the - * current Element. - * - * @author Ian Trimble - Oracle - */ -public class CreateAttributeOperation extends AbstractTransformOperation { - - private String attributeName; - private String attributeValue; - - /** - * Constructs an instance with the specified attribute name and value. - * - * @param attributeName Name of attribute to be created. - * @param attributeValue Value of attribute to be set. - */ - public CreateAttributeOperation(String attributeName, String attributeValue) { - this.attributeName = attributeName; - this.attributeValue = attributeValue; - } - - /* - * (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 (curElement != null) { - curElement.setAttribute(attributeName, attributeValue); - } - return curElement; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CreateElementOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CreateElementOperation.java deleted file mode 100644 index c8d98a266..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CreateElementOperation.java +++ /dev/null @@ -1,50 +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.dtmanager.converter.operations.internal; - -import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; -import org.w3c.dom.Element; - -/** - * ITransformOperation implementation that creates a new 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 CreateElementOperation extends AbstractTransformOperation { - - private String tagName; - - /** - * Constructs an instance with the specified Element name. - * - * @param tagName Name of Element to be created. - */ - public CreateElementOperation(String tagName) { - this.tagName = tagName; - } - - /* - * (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 element = null; - if (tagConverterContext != null && tagName != null && tagName.length() > 0) { - element = tagConverterContext.createElement(tagName); - } - return element; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/IfNotOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/IfNotOperation.java deleted file mode 100644 index a83b89699..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/IfNotOperation.java +++ /dev/null @@ -1,66 +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.dtmanager.converter.operations.internal; - -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; -import org.w3c.dom.Element; - -/** - * ITransformOperation implementation that executes child ITransformOperation - * instances if the XPath expression evaluated against the source Element - * instance returns a "false" result. - * - * <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 IfNotOperation 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 IfNotOperation(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.BOOLEAN); - if (!((Boolean)resultObject).booleanValue()) { - retElement = executeChildOperations(srcElement, retElement); - } - } catch(XPathExpressionException xee) { - //could not evaluate - return curElement - } - } - return retElement; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/IfOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/IfOperation.java deleted file mode 100644 index 3d94bc7b8..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/IfOperation.java +++ /dev/null @@ -1,66 +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.dtmanager.converter.operations.internal; - -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; -import org.w3c.dom.Element; - -/** - * ITransformOperation implementation that executes child ITransformOperation - * instances if the XPath expression evaluated against the source Element - * instance returns a "true" result. - * - * <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 IfOperation 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 IfOperation(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.BOOLEAN); - if (((Boolean)resultObject).booleanValue()) { - retElement = executeChildOperations(srcElement, retElement); - } - } catch(XPathExpressionException xee) { - //could not evaluate - return curElement - } - } - return retElement; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/IterateOverElementsOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/IterateOverElementsOperation.java deleted file mode 100644 index f72afe09c..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/IterateOverElementsOperation.java +++ /dev/null @@ -1,74 +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.dtmanager.converter.operations.internal; - -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; -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; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/MakeParentElementCurrentOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/MakeParentElementCurrentOperation.java deleted file mode 100644 index b0e32aff8..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/MakeParentElementCurrentOperation.java +++ /dev/null @@ -1,44 +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.dtmanager.converter.operations.internal; - -import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * ITransformOperation implementation that makes the current Element's parent - * Element the new current Element. - * - * @author Ian Trimble - Oracle - */ -public class MakeParentElementCurrentOperation 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 resultElement = null; - if (curElement != null) { - Node parentNode = curElement.getParentNode(); - while (parentNode != null && parentNode.getNodeType() != Node.DOCUMENT_NODE) { - if (parentNode.getNodeType() == Node.ELEMENT_NODE) { - resultElement = (Element)parentNode; - break; - } - parentNode = parentNode.getParentNode(); - } - } - return resultElement; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/RemoveAttributeOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/RemoveAttributeOperation.java deleted file mode 100644 index 689d01917..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/RemoveAttributeOperation.java +++ /dev/null @@ -1,46 +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.dtmanager.converter.operations.internal; - -import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; -import org.w3c.dom.Element; - -/** - * ITransformOperation implementation that removes an attribute from the - * current Element. - * - * @author Ian Trimble - Oracle - */ -public class RemoveAttributeOperation extends AbstractTransformOperation { - - private String attributeName; - - /** - * Constructs an instance with the specified attribute name. - * - * @param attributeName Name of attribute to be removed. - */ - public RemoveAttributeOperation(String attributeName) { - this.attributeName = attributeName; - } - - /* - * (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 (curElement != null) { - curElement.removeAttribute(attributeName); - } - return curElement; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/RenameAttributeOperation.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/RenameAttributeOperation.java deleted file mode 100644 index 420ff1da0..000000000 --- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/RenameAttributeOperation.java +++ /dev/null @@ -1,54 +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.dtmanager.converter.operations.internal; - -import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -/** - * ITransformOperation implementation that renames an attribute of the current - * Element. - * - * @author Ian Trimble - Oracle - */ -public class RenameAttributeOperation extends AbstractTransformOperation { - - private String oldAttributeName; - private String newAttributeName; - - /** - * Constructs an instance with the specified old and new attribute names. - * - * @param oldAttributeName Old name of the attribute to be renamed. - * @param newAttributeName New name of the attribute to be renamed. - */ - public RenameAttributeOperation(String oldAttributeName, String newAttributeName) { - this.oldAttributeName = oldAttributeName; - this.newAttributeName = newAttributeName; - } - - /* - * (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 (curElement != null) { - Attr oldAttribute = curElement.getAttributeNode(oldAttributeName); - if (oldAttribute != null) { - curElement.setAttribute(newAttributeName, oldAttribute.getValue()); - curElement.removeAttribute(oldAttributeName); - } - } - return curElement; - } - -} |