OW2 Consortium mobe

Compare Revisions

Ignore whitespace Rev 2 → Rev 3

/trunk/mobe/examples/loan.bpel
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/mobe/examples/auction.bpel
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/mobe/.classpath
New file
0,0 → 1,11
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="C:/Projecten/MOBEDesigner/lib/xstream-1.0.2.jar"/>
<classpathentry kind="lib" path="C:/Projecten/MOBEDesigner/lib/xml-apis.jar"/>
<classpathentry kind="lib" path="C:/Projecten/MOBEDesigner/lib/xmlParserAPIs.jar"/>
<classpathentry kind="lib" path="C:/Projecten/MOBEDesigner/lib/xpp3_min-1.1.3.4.I.jar"/>
<classpathentry kind="lib" path="C:/Projecten/MOBEDesigner/lib/xercesImpl.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
/trunk/mobe/JHotDraw.txt
New file
0,0 → 1,3
JHotDraw is copyright 1996, 1997 by IFA Informatik and Erich Gamma.
 
It is hereby granted that this software can be used, copied, modified, anddistributed without fee provided that this copyright noticeappears in all copies.
/trunk/mobe/LICENSE.txt
New file
0,0 → 1,16
MOBE 1.3B AND MOBE Desinger 0.2B LICENSE
==============================================================================
 
MOBE 1.3B and MOBE Designer 0.2B are distributed under the Gnu General Public License, see the
LICENSE.GPL file for the full text.
 
In addition to the terms and conditions defined in the GPL, eMAXX grants you
the right to write new classes, templates, modules, widgets and installation
scripts, which are extensions on existing MOBE and MOBE Designer files and distribute these
under any license you choose, as long as these files are distributed
seperately from MOBE and MOBE Designer itself.
 
17 december 2004
Michel Veenhuis ( michel@emaxx.nl )
 
eMAXX
/trunk/mobe/xsds/business-process.xsd
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/mobe/xsds/wsdl.xsd
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/mobe/LICENSE.GPL
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/mobe/.project
New file
0,0 → 1,17
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MOBEDesigner</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
/trunk/mobe/MOBEDesigner.zip
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/mobe/lib/xml-apis.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/mobe/lib/xmlParserAPIs.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/mobe/lib/xercesImpl.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/mobe/lib/xstream-1.0.2.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/mobe/lib/xpp3_min-1.1.3.4.I.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/trunk/mobe/src/org/emaxx/bpeldesigner/utils/XMLUtils.java
New file
0,0 → 1,733
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.utils;
 
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.StringReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
 
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
 
import org.apache.xerces.parsers.DOMParser;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
 
/**
* The XMLUtils class contains utility methods for XML document en element manipulation.
*
* The selectors that can be passed to several of these methods consist of element names
* (qualified or unqualified) separated dots. Specific elements can be selected by appending a
* (zero-based) index between brackets to an element name. For example:
* "subelement.subsubelement[3].subsubsubelement".
* <br><br>
* Copyright (c) 2004, eMAXX B.V.
*
* @author A.K. Boerma [AKB]
* @author J.G. de Vries [JDV]
* @version $Revision: 1.1 $ $Date: 2005-01-17 12:01:01 $
*/
public final class XMLUtils {
 
/*
* Internal fields.
*/
private static final boolean NAME_CHECKING = true;
private static final boolean VALUE_CHECKING = true;
 
/*
* Private constructor.
*/
private XMLUtils() {
}
 
/**
* Converts the specified <code>document</code> to a String.
*
* @param document The document to convert.
* @return A string representation of the document.
* @throws DOMException If an error occurs while transforming the document to
* a string.
*/
public static String documentToString(Document document) throws DOMException {
return elementToString(document.getDocumentElement());
}
 
/**
* Tests <code>node1</code> and <code>node2</code> for equality. The nodes are deemed equal when
* type, name, value, all attributes and all children are equal. Note: attributes and children
* must be present in the same order.
*
* @param node1 The first node to use in the comparison.
* @param node2 The second node to use in the comparison.
* @return True if the both nodes are equal; false otherwise.
*/
public static boolean elementsEqual(Node node1, Node node2) {
 
// Check parameters and types.
if ((node1 == null) && (node2 == null)) {
return true;
} else if (((node1 == null) && (node2 != null)) || ((node1 != null) && (node2 == null))) {
return false;
}
 
if (node1.getNodeType() != node2.getNodeType()) {
return false;
}
 
// Check equality of name and value.
if (!safeEquals(node1.getNodeName(), node2.getNodeName())
|| !safeEquals(node1.getNodeValue(), node2.getNodeValue())) {
return false;
}
 
// Check equality of attributes.
if (((node1.getAttributes() == null) && (node2.getAttributes() != null))
|| ((node1.getAttributes() != null) && (node2.getAttributes() == null))) {
return false;
} else if ((node1.getAttributes() != null) && (node2.getAttributes() != null)) {
if (node1.getAttributes().getLength() == node2.getAttributes().getLength()) {
for (int i = 0; i < node1.getAttributes().getLength(); i++) {
Node attr1 = node1.getAttributes().item(i);
Node attr2 = node2.getAttributes().getNamedItem(attr1.getNodeName());
 
if (attr2 != null) {
if (!safeEquals(attr1.getNodeName(), attr2.getNodeName())
|| !safeEquals(attr1.getNodeValue(), attr2.getNodeValue())) {
return false;
}
} else {
return false;
}
}
}
}
 
// Check equality of children (recursively).
Node child1 = node1.getFirstChild();
Node child2 = node2.getFirstChild();
 
while ((child1 != null) || (child2 != null)) {
if (!elementsEqual(child1, child2)) {
return false;
}
 
child1 = child1.getNextSibling();
child2 = child2.getNextSibling();
}
 
return true;
}
 
/**
* Converts the specified <code>node</code> to a String.
*
* @param node The node to convert.
* @return A string representation of the element.
* @throws DOMException If an error occurs while transforming the element to
* a string.
* TODO: refactor to nodeToString.
*/
public static String elementToString(Node node) throws DOMException {
try {
TransformerFactory tf = TransformerFactory.newInstance();
Transformer optimusPrime = tf.newTransformer();
 
optimusPrime.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
optimusPrime.setOutputProperty(OutputKeys.METHOD, "xml");
optimusPrime.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
 
StreamResult result = new StreamResult(new ByteArrayOutputStream());
optimusPrime.transform(new DOMSource(node), result);
 
return result.getOutputStream().toString();
} catch (Exception e) {
throw new DOMException((short) -1, e.getMessage());
}
}
 
/**
* Returns the first child element of the specified <code>element</code> that has the specified
* <code>name</code>.
*
* @param element The element to search the children of.
* @param name The name of the element to return.
* @return The element with the specified name, null if no match was found.
*/
public static Element getChildElement(Element element, String name) {
return getChildElement(element, name, 0);
}
 
/**
* Returns the first child element of the specified <code>document</code> element that has the
* specified <code>name</code>.
*
* @param document The document to search the children of.
* @param name The name of the element to return.
* @return The element with the specified name, null if no match was found.
*/
public static Element getChildElement(Document document, String name) {
return getChildElement(document.getDocumentElement(), name, 0);
}
 
/**
* Returns the first child element of the specified <code>element</code> that has the specified
* <code>name</code> and an index of at least <code>fromIndex</code>.
*
* @param element The element to search the children of.
* @param name The name of the element to return.
* @param fromIndex The minimum index of the element.
* @return The element with the specified name, null if no match was found.
*/
public static Element getChildElement(Element element, String name, int fromIndex) {
 
for (int i = fromIndex; i < element.getChildNodes().getLength(); i++) {
if ((element.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE)
&& (element.getChildNodes().item(i).getNodeName().equals(name) || element.getChildNodes().item(
i).getLocalName().equals(name))) {
return (Element) element.getChildNodes().item(i);
}
}
 
return null;
}
 
/**
* Returns all child elements of the specified <code>document</code> that have the specified
* <code>name</code>.
*
* @param document The document to search the children of.
* @param name The name of the element(s) to return.
* @return A list of elements with the specified name.
*/
public static NodeList getChildElements(Document document, String name) {
return getChildElements(document.getDocumentElement(), name);
}
 
/**
* Returns all child elements of the specified <code>element</code> that have the specified
* <code>name</code>.
*
* @param element The element to search the children of.
* @param name The name of the element(s) to return.
* @return A list of elements with the specified name.
* TODO: getElementsByTagName could return too many elements, the original method bombed.
*/
public static NodeList getChildElements(Element element, String name) {
NodeList list = element.getElementsByTagName(name);
 
if (list.getLength() == 0) {
list = element.getElementsByTagNameNS(element.getNamespaceURI(), name);
}
 
return list;
}
 
/**
* Returns all child elements of the specified <code>element</code> that have the specified
* <code>name</code>.
*
* @param element The element to search the children of.
* @param name The name of the element(s) to return.
* @return A list of elements with the specified name.
*/
public static NodeList getChildElements(Document document, String selector, String name) {
return getChildElements(getSubElement(document.getDocumentElement(), selector), name);
}
 
/**
* Returns all child elements of the specified <code>element</code> that have the specified
* <code>name</code>.
*
* @param element The element to search the children of.
* @param name The name of the element(s) to return.
* @return A list of elements with the specified name.
*/
public static NodeList getChildElements(Element element, String selector, String name) {
return getChildElements(getSubElement(element, selector), name);
}
 
/**
*
* @param element
* @param selector
* @param value
*/
public static void setElementText(Element element, String selector, String value) {
setElementText(getSubElement(element, selector), value);
}
 
/**
* Sets the text of the specified <code>element</code> to <code>value</code>.
*
* @param element The element to set the text of.
* @param value The new text.
*/
public static void setElementText(Element element, String value) {
 
if ((element.getChildNodes().getLength() == 1)
&& (element.getChildNodes().item(0).getNodeType() == Node.TEXT_NODE)) {
Text text = (Text) element.getChildNodes().item(0);
text.setData(value);
} else {
element.appendChild(element.getOwnerDocument().createTextNode(value));
}
}
 
/**
*
* @param document
* @param selector
* @return
*/
public static String getElementText(Document document, String selector) {
return getElementText(getSubElement(document, selector));
}
 
/**
*
* @param element
* @param selector
* @return
*/
public static String getElementText(Element element, String selector) {
return getElementText(getSubElement(element, selector));
}
 
/**
* Returns the text of the specified <code>element</code>.
*
* @param element The element to return the text of.
* @return The text of the element, or an empty string if no text was found.
*/
public static String getElementText(Element element) {
 
if ((element.getChildNodes().getLength() == 1)
&& (element.getChildNodes().item(0).getNodeType() == Node.TEXT_NODE)) {
Text text = (Text) element.getChildNodes().item(0);
 
return (text.getData() != null) ? text.getData() : "";
}
 
return "";
}
 
/**
* Sets the prefix of the specified <code>element</code>, and all it's descendants, to the
* specified <code>prefix</code>.
*
* @param element The root element.
* @param prefix The prefix.
*/
public static void setPrefixRecusive(Element element, String prefix) {
 
element.setPrefix(prefix);
for (int i = 0; i < element.getChildNodes().getLength(); i++) {
if (element.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE) {
Element child = (Element) element.getChildNodes().item(i);
setPrefixRecusive(child, prefix);
}
}
}
 
/**
* Returns the sub element of the specified <code>document</code> that matches the specified
* <code>selector</code>. See above for more details on the format of the selector.
*
* @param parent The document used as root of the search.
* @param selector The selector.
* @return The requested sub element.
* @throws DOMException If the requested sub element was not found.
*/
public static Element getSubElement(Document document, String selector) throws DOMException {
return getSubElement(document.getDocumentElement(), selector);
}
 
/**
* Returns the sub element of the specified <code>parent</code> element that matches the
* specified <code>selector</code>. See above for more details on the format of the selector.
*
* @param parent The element used as root of the search.
* @param selector The selector.
* @return The requested sub element.
* @throws DOMException If the requested sub element was not found.
*/
public static Element getSubElement(Element parent, String selectorString) throws DOMException {
 
try {
int fromIndex = 0;
int dotPosition = 0;
Element subElement = parent;
Pattern pattern = Pattern.compile("([a-zA-Z]{1}[a-zA-Z_0-9$]*)(\\[(\\d+)\\])*");
Matcher matcher = null;
 
while (dotPosition < selectorString.length()) {
dotPosition = selectorString.indexOf(".", fromIndex);
dotPosition = (dotPosition == -1) ? selectorString.length() : dotPosition;
matcher = pattern.matcher(selectorString.substring(fromIndex, dotPosition));
 
if (matcher.lookingAt()) {
String elementName = matcher.group(1);
NodeList list = subElement.getElementsByTagName(elementName);
list = (list.getLength() == 0) ? subElement.getElementsByTagNameNS(
subElement.getNamespaceURI(), elementName) : list;
 
if (matcher.group(2) != null) {
subElement = (Element) list.item(new Integer(matcher.group(3)).intValue());
} else {
subElement = (Element) list.item(0);
}
}
 
fromIndex = dotPosition + 1;
}
 
return subElement;
} catch (Exception e) {
throw new DOMException((short) -1, e.getMessage());
}
}
 
/**
* Sets the CDATA of the first sub element of the specified <code>document</code> that matches
* the specified <code>selector</code> to <code>value</code>. See above for more details on the
* format of the selector.
*
* @param document The document used as root of the search.
* @param selector The selector.
* @return The requested sub element.
* @throws DOMException If the requested sub element was not found.
*/
public static void setSubElementCData(Document document, String selector, String value)
throws DOMException {
setSubElementCData(document.getDocumentElement(), selector, value);
}
 
/**
* Sets the CDATA of the first sub element of the specified <code>element</code> that matches
* the specified <code>selector</code> to <code>value</code>. See above for more details on the
* format of the selector.
*
* @param element The element used as root of the search.
* @param selector The selector.
* @param value The value to set.
* @throws DOMException If the requested sub element was not found.
*/
public static void setSubElementCData(Element element, String selector, String value)
throws DOMException {
Element parent = (selector == null) ? element : getSubElement(element, selector);
 
if (parent != null) {
while (parent.getChildNodes().getLength() > 0) {
parent.removeChild(parent.getChildNodes().item(0));
}
 
if (value != null) {
parent.appendChild(element.getOwnerDocument().createCDATASection(value));
} else {
parent.appendChild(element.getOwnerDocument().createCDATASection(value));
}
}
}
 
/**
* Gets the CDATA of the first sub element of the specified <code>document</code> that matches
* the specified <code>selector</code> to <code>value</code>. See above for more details on the
* format of the selector.
*
* @param document The document used as root of the search.
* @param selector The selector.
* @return The value of the CDATA sub element if it exists, null otherwise.
* @throws DOMException If the requested sub element was not found.
*/
public static String getSubElementCData(Document document, String selector) throws DOMException {
return getSubElementCData(document.getDocumentElement(), selector);
}
 
/**
* Gets the CDATA of the first sub element of the specified <code>element</code> that matches
* the specified <code>selector</code> to <code>value</code>. See above for more details on the
* format of the selector.
*
* @param element The element used as root of the search.
* @param selector The selector.
* @return The value of the CDATA sub element if it exists, null otherwise.
* @throws DOMException If the requested sub element was not found.
*/
public static String getSubElementCData(Element element, String selector) throws DOMException {
Element parent = (selector == null) ? element : getSubElement(element, selector);
 
if ((parent != null) && (parent.getChildNodes().getLength() > 0)) {
return parent.getChildNodes().item(0).getNodeValue();
}
 
return null;
}
 
/**
* Sets the text of the first sub element of the specified <code>document</code> that matches
* the specified <code>selector</code> to <code>value</code>. See above for more details on the
* format of the selector.
*
* @param parent The document used as root of the search.
* @param selector The selector.
* @return The requested sub element.
* @throws DOMException If the requested sub element was not found.
*/
public static void setSubElementText(Document document, String selector, String value)
throws DOMException {
setElementText(getSubElement(document.getDocumentElement(), selector), value);
}
 
/**
* Sets the text of the first sub element of the specified <code>parent</code> element that
* matches the specified <code>selector</code> to <code>value</code>. See above for more details
* on the format of the selector.
*
* @param parent The root element used in the search.
* @param selector The search path string.
* @param value The new text.
* @throws DOMException If the requested sub element was not found.
*/
public static void setSubElementText(Element parent, String selector, String value)
throws DOMException {
setElementText(getSubElement(parent, selector), value);
}
 
/**
* Returns the text of the sub element of the specified <code>document</code> that matches the
* specified <code>selector</code>. See above for more details on the format of the selector.
*
* @param parent The root element used in the search.
* @param selector The search path string.
* @return The text of the sub element.
* @throws DOMException If the requested sub element was not found.
*/
public static String getSubElementText(Document document, String selector) throws DOMException {
return getElementText(getSubElement(document.getDocumentElement(), selector));
}
 
/**
* Returns the text of the sub element of the specified <code>parent</code> element that matches
* the specified <code>selector</code>. See above for more details on the format of the selector.
*
* @param parent The root element used in the search.
* @param selector The search path string.
* @return The text of the sub element.
* @throws DOMException If the requested sub element was not found.
*/
public static String getSubElementText(Element parent, String selector) throws DOMException {
return getElementText(getSubElement(parent, selector));
}
 
/**
* Sets the XML of the first sub element of the specified <code>document</code> that matches
* the specified <code>selector</code> to <code>value</code>. See above for more details on the
* format of the selector.
*
* @param parent The document used as root of the search.
* @param selector The selector.
* @param value The new XML.
* @throws DOMException If the requested sub element was not found.
*/
public static void setSubElementXML(Document document, String selector, String value)
throws DOMException {
setSubElementXML(document.getDocumentElement(), selector, value);
}
 
/**
* Sets the XML of the first sub element of the specified <code>parent</code> element that
* matches the specified <code>selector</code> to <code>value</code>. See above for more details
* on the format of the selector.
*
* @param parent The root element used in the search.
* @param selector The selector.
* @param value The new XML.
* @throws DOMException If the requested sub element was not found.
*/
public static void setSubElementXML(Element parent, String selector, String value)
throws DOMException {
 
try {
Element element = getSubElement(parent, selector);
 
for (int i = element.getChildNodes().getLength() - 1; i >= 0; i--) {
element.removeChild(element.getChildNodes().item(i));
}
 
Document document = parse(value, false);
element.appendChild(element.getOwnerDocument().importNode(
document.getDocumentElement(), true));
} catch (IOException ioe) {
throw new DOMException((short) -1, ioe.getMessage());
} catch (SAXException se) {
throw new DOMException((short) -1, se.getMessage());
}
}
 
/**
* Returns the XML of the sub element of the specified <code>document</code> that matches the
* specified <code>selector</code>. See above for more details on the format of the selector.
*
* @param parent The root element used in the search.
* @param selector The search path string.
* @return The XML of the sub element.
* @throws DOMException If the requested sub element was not found.
*/
public static String getSubElementXML(Document document, String selector) throws DOMException {
return getSubElementXML(document.getDocumentElement(), selector);
}
 
/**
* Returns the XML of the sub element of the specified <code>parent</code> element that matches
* the specified <code>selector</code>. See above for more details on the format of the selector.
*
* @param parent The root element used in the search.
* @param selector The search path string.
* @return The XML of the sub element.
* @throws DOMException If the requested sub element was not found.
*/
public static String getSubElementXML(Element parent, String selector) throws DOMException {
StringBuffer result = new StringBuffer();
Element element = getSubElement(parent, selector);
 
for (int i = 0; i < element.getChildNodes().getLength(); i++) {
result.append(elementToString(element.getChildNodes().item(i)));
}
 
return result.toString();
}
 
/**
* Returns a new empty document.
*
* @return A Document.
*/
public static Document newDocument() {
 
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
return builder.newDocument();
} catch (ParserConfigurationException e) {
return null;
}
}
 
/**
*
* @param xml
* @param validate
* @return
* @throws SAXException
* @throws IOException
*/
public final static Document parse(String xml, boolean validate) throws SAXException,
IOException {
DOMParser parser = new DOMParser();
 
parser.setFeature("http://xml.org/sax/features/validation", validate);
parser.setFeature("http://apache.org/xml/features/validation/schema", validate);
parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking",
validate);
 
//parser.setEntityResolver(new ProcessEntityResolver());
//parser.setErrorHandler(new ProcessErrorHandler());
parser.parse(new InputSource(new StringReader(xml)));
 
return parser.getDocument();
}
 
/**
* Removes all children of the specified <code>element</code>.
*
* @param element The element to remove the children of.
*/
public static void removeChildren(Element element) {
 
for (int i = element.getChildNodes().getLength() - 1; i >= 0; i--) {
element.removeChild(element.getChildNodes().item(i));
}
}
 
/**
* Removes the specified <code>element</code> from the list of child nodes of its parent.
*
* @param element The element to remove.
*/
public static void removeElement(Element element) {
element.getParentNode().removeChild(element);
}
 
/**
* Removes the first sub element of the specified <code>parent</code> element that matches the
* specified <code>selector</code>. The removed element is returned. See above for more details
* on the format of the selector.
*
* @param parent The parent of the element to remove.
* @param selector The selector of the element to remove.
* @return The removed element.
*/
public static Element removeElement(Element parent, String selector) {
Element result = getSubElement(parent, selector);
 
if (result != null) {
parent.removeChild(result);
}
 
return result;
}
 
/**
* Returns true if <code>object1</code> is equal to <code>object2</code>, false otherwise. The
* two objects are deemed to be equal when:
* (1) They are both null.
* (2) The are equal according to equals method of object1.
*
* @param object1 The first object to compare.
* @param object2 The second object to compare.
* @return True if the objects are equal; false otherwise.
*/
private static final boolean safeEquals(Object object1, Object object2) {
 
if ((object1 == null) && (object2 == null)) {
return true;
} else if (((object1 == null) && (object2 != null))
|| ((object1 != null) && (object2 == null))) {
return false;
}
 
return object1.equals(object2);
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Variables.java
New file
0,0 → 1,174
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.Editable;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL Variables element, BPEL Variables Nodes can be converted to this class.
* This class supports certain modifying attributes and elements. This class can be saved to a BPEL Node.
* It contains a method to get the CustomTable, ie a list of variables
*/
public class Variables extends ExtensibleElements implements Editable {
 
private Vector m_Variables = new Vector();
 
public Variables() {
}
 
public void addVariable(Variable a_Variable) {
m_Variables.add(a_Variable);
}
 
public Vector getVariables() {
return m_Variables;
}
 
public void setVariables(Vector a_Variables) {
m_Variables = a_Variables;
return;
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_Variables the instance with the data that should be updated into this instance
*/
public void update(Variables a_Variables) {
super.update(a_Variables);
m_Variables.removeAllElements();
Enumeration l_Enum = a_Variables.getVariables().elements();
while (l_Enum.hasMoreElements()) {
addVariable((Variable) l_Enum.nextElement());
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NodeList children = a_Node.getChildNodes();
if (children != null) {
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_TempNodeName.equals("variable")) {
Variable l_Variable = new Variable();
l_Variable.handleParse(children.item(i));
addVariable(l_Variable);
}
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getEditPanel(CustomTable a_CustomTable) {
int l_RowNr = a_CustomTable.getSelectedRow();
if (l_RowNr >= 0) {
TabbedDialog l_TabbedDialog = ((Variable) m_Variables.get(l_RowNr)).getSelectedEditPanel(a_CustomTable);
return l_TabbedDialog;
} else {
return null;
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveEditPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveEditPanel(TabbedDialog a_TabbedDialog) {
Variable l_Variable = (Variable) a_TabbedDialog.getEditPanelHolderOriginal();
l_Variable.update((Variable) a_TabbedDialog.getEditPanelHolderClone());
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveAddPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveAddPanel(TabbedDialog a_TabbedDialog) {
Variable l_Variable = (Variable) a_TabbedDialog.getEditPanelHolderOriginal();
l_Variable.update((Variable) a_TabbedDialog.getEditPanelHolderClone());
addVariable(l_Variable);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditName()
*/
public String getEditName() {
return "Variables";
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getPanelTable()
*/
public CustomTable getPanelTable() {
CustomTable l_VariablesTable = new CustomTable(this);
l_VariablesTable.addColumnNames(Variable.getColumnNames());
l_VariablesTable.setRows(m_Variables);
l_VariablesTable.updateTable();
return l_VariablesTable;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getNewPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getNewPanel(CustomTable a_CustomTable) {
Variable l_Variable = new Variable();
TabbedDialog l_TabbedDialog = l_Variable.getAddPanel(a_CustomTable);
return l_TabbedDialog;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("variables");
Enumeration l_Enum = getVariables().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element, ((Variable) l_Enum.nextElement()).writeToXML(a_Document));
}
if (l_Element.hasChildNodes()) {
return l_Element;
} else {
return null;
}
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Scope.java
New file
0,0 → 1,259
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import org.emaxx.bpeldesigner.bpel.figures.BPELActivityFigure;
import org.emaxx.bpeldesigner.bpel.figures.BPELCompensationHandlerFigure;
import org.emaxx.bpeldesigner.bpel.figures.BPELEventHandlersFigure;
import org.emaxx.bpeldesigner.bpel.figures.BPELFaultHandlersFigure;
import org.emaxx.bpeldesigner.bpel.standard.BPELDrawing;
import org.emaxx.bpeldesigner.bpel.standard.BPELFigureHolder;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL Scope element, BPEL Scope Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class Scope extends Activity implements ActivityGroup {
 
private BPELDrawing m_Drawing;
private Variables m_Variables = new Variables();
private CorrelationSets m_CorrelationSets = new CorrelationSets();
private FaultHandlers m_FaultHandlers = new FaultHandlers();
private CompensationHandler m_CompensationHandler = new CompensationHandler();
private EventHandlers m_EventHandlers = new EventHandlers();
private ActivityGroup m_ActivityGroup;
private BPBoolean m_VariableAccessSerializable = new BPBoolean("no");
 
public Scope() {
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ExtensibleElements#getBPELDrawing(CH.ifa.draw.standard.BPELFigureHolder)
*/
public BPELDrawing getBPELDrawing(BPELFigureHolder a_BPELFigureHolder) {
if (m_Drawing == null) {
if (a_BPELFigureHolder.getHolderParent() != null) {
m_Drawing = new BPELDrawing(a_BPELFigureHolder,
a_BPELFigureHolder.getHolderParent().getBPELDrawing().getRootDocument());
} else {
m_Drawing = new BPELDrawing(a_BPELFigureHolder, null);
}
if (this.getFaultHandlers() != null) {
BPELFaultHandlersFigure l_FaultHandlersFigure = new BPELFaultHandlersFigure();
l_FaultHandlersFigure.setFaultHandlers(this.getFaultHandlers());
m_Drawing.add(l_FaultHandlersFigure);
}
if (this.getCompensationHandler() != null) {
BPELCompensationHandlerFigure l_CompensationHandlerFigure = new BPELCompensationHandlerFigure();
l_CompensationHandlerFigure.setCompensationHandler(this.getCompensationHandler());
m_Drawing.add(l_CompensationHandlerFigure);
}
if (this.getEventHandlers() != null) {
BPELEventHandlersFigure l_EventHandlersFigure = new BPELEventHandlersFigure();
l_EventHandlersFigure.setEventHandlers(this.getEventHandlers());
m_Drawing.add(l_EventHandlersFigure);
}
if (this.getActivityGroup() != null) {
BPELActivityFigure l_ActivityFigure = BPELActivityFigure.giveFigure(this.getActivityGroup());
l_ActivityFigure.setActivity((Activity) this.getActivityGroup());
m_Drawing.add(l_ActivityFigure);
}
}
return m_Drawing;
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_Reply the instance with the data that should be updated into this instance
*/
public void update(Scope a_Scope) {
super.update(a_Scope);
getVariables().update(a_Scope.getVariables());
getCorrelationSets().update(a_Scope.getCorrelationSets());
getVariableAccessSerializable().update(a_Scope.getVariableAccessSerializable());
}
 
public ActivityGroup getActivityGroup() {
return m_ActivityGroup;
}
 
public void setActivityGroup(ActivityGroup a_ActivityGroup) {
m_ActivityGroup = a_ActivityGroup;
return;
}
 
public EventHandlers getEventHandlers() {
return m_EventHandlers;
}
 
public void setEventHandlers(EventHandlers a_EventHandlers) {
m_EventHandlers = a_EventHandlers;
return;
}
 
public CompensationHandler getCompensationHandler() {
return m_CompensationHandler;
}
 
public void setCompensationHandler(CompensationHandler a_CompensationHandler) {
m_CompensationHandler = a_CompensationHandler;
return;
}
 
public FaultHandlers getFaultHandlers() {
return m_FaultHandlers;
}
 
public void setFaultHandlers(FaultHandlers a_FaultHandlers) {
m_FaultHandlers = a_FaultHandlers;
return;
}
 
public CorrelationSets getCorrelationSets() {
return m_CorrelationSets;
}
 
public void setCorrelationSets(CorrelationSets a_CorrelationSets) {
m_CorrelationSets = a_CorrelationSets;
return;
}
 
public Variables getVariables() {
return m_Variables;
}
 
public void setVariables(Variables a_Variables) {
m_Variables = a_Variables;
return;
}
 
public BPBoolean getVariableAccessSerializable() {
return m_VariableAccessSerializable;
}
 
public void setVariableAccessSerializable(BPBoolean a_VariableAccessSerializable) {
m_VariableAccessSerializable = a_VariableAccessSerializable;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("variableAccessSerializable")) {
setVariableAccessSerializable(new BPBoolean(l_CurrentValue));
}
}
NodeList children = a_Node.getChildNodes();
if (children != null) {
KeyClassVector l_KeyClassVector = new KeyClassVector();
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_TempNodeName.equals("variables")) {
Variables l_Variables = new Variables();
l_Variables.handleParse(children.item(i));
setVariables(l_Variables);
} else if (l_TempNodeName.equals("correlationSets")) {
CorrelationSets l_CorrelationSets = new CorrelationSets();
l_CorrelationSets.handleParse(children.item(i));
setCorrelationSets(l_CorrelationSets);
} else if (l_TempNodeName.equals("faultHandlers")) {
FaultHandlers l_FaultHandlers = new FaultHandlers();
l_FaultHandlers.handleParse(children.item(i));
setFaultHandlers(l_FaultHandlers);
} else if (l_TempNodeName.equals("compensationHandler")) {
CompensationHandler l_CompensationHandler = new CompensationHandler();
l_CompensationHandler.handleParse(children.item(i));
setCompensationHandler(l_CompensationHandler);
} else if (l_TempNodeName.equals("eventHandlers")) {
EventHandlers l_EventHandlers = new EventHandlers();
l_EventHandlers.handleParse(children.item(i));
setEventHandlers(l_EventHandlers);
} else if (l_KeyClassVector.getAContaining(l_TempNodeName) != null) {
ActivityGroup l_ActivityGroup = l_KeyClassVector.getAContaining(l_TempNodeName);
l_ActivityGroup.handleParse(children.item(i));
setActivityGroup(l_ActivityGroup);
}
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_ScopeClone) {
if (a_ScopeClone instanceof Scope) {
super.saveEditPanel(a_ScopeClone);
Scope l_Scope = (Scope) a_ScopeClone;
m_Variables = l_Scope.getVariables();
m_CorrelationSets = l_Scope.getCorrelationSets();
m_VariableAccessSerializable = l_Scope.getVariableAccessSerializable();
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
TabbedDialog l_EditPanel = super.getShowEditPanel(a_ShowPanel);
Scope l_Scope = (Scope) l_EditPanel.getEditPanelHolderClone();
l_EditPanel.addAttribute(l_Scope.getVariableAccessSerializable(),
"VariableAccessSerializable");
l_EditPanel.addTab(l_Scope.getVariables());
l_EditPanel.addTab(l_Scope.getCorrelationSets());
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("scope");
super.writeToXML(a_Document, l_Element);
addXMLattribute(l_Element, "variableAccessSerializable",
getVariableAccessSerializable().toXML());
addXMLChild(l_Element, getVariables().writeToXML(a_Document));
addXMLChild(l_Element, getCorrelationSets().writeToXML(a_Document));
addXMLChild(l_Element, getFaultHandlers().writeToXML(a_Document));
addXMLChild(l_Element, getCompensationHandler().writeToXML(a_Document));
addXMLChild(l_Element, getEventHandlers().writeToXML(a_Document));
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/PartnerLinks.java
New file
0,0 → 1,173
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.Editable;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL PartnerLinks element, BPEL PartnerLinks Nodes can be converted to this class.
* This class supports certain modifying attributes and elements. This class can be saved to a BPEL Node.
* It contains a method to get the CustomTable, ie a list of partnerlinks
*/
public class PartnerLinks extends ExtensibleElements implements Editable {
 
private Vector m_PartnerLink = new Vector();
 
public PartnerLinks() {
}
 
public void addPartnerLink(PartnerLink a_PartnerLink) {
m_PartnerLink.add(a_PartnerLink);
return;
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_PartnerLinks the instance with the data that should be updated into this instance
*/
public void update(PartnerLinks a_PartnerLinks) {
m_PartnerLink.removeAllElements();
Enumeration l_Enum = a_PartnerLinks.getPartnerLinks().elements();
while (l_Enum.hasMoreElements()) {
addPartnerLink((PartnerLink) l_Enum.nextElement());
}
}
 
public Vector getPartnerLinks() {
return m_PartnerLink;
}
 
public void setPartnerLink(Vector a_PartnerLink) {
m_PartnerLink = a_PartnerLink;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
NodeList children = a_Node.getChildNodes();
if (children != null) {
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_TempNodeName.equals("partnerLink")) {
PartnerLink l_PartnerLink = new PartnerLink();
l_PartnerLink.handleParse(children.item(i));
addPartnerLink(l_PartnerLink);
}
}
}
}
 
public String checkEditPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getEditPanel(CustomTable a_CustomTable) {
int l_RowNr = a_CustomTable.getSelectedRow();
if (l_RowNr >= 0) {
return ((PartnerLink) m_PartnerLink.get(l_RowNr)).getSelectedEditPanel(a_CustomTable);
} else {
return null;
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveEditPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveEditPanel(TabbedDialog a_TabbedDialog) {
PartnerLink l_PartnerLink = (PartnerLink) a_TabbedDialog.getEditPanelHolderOriginal();
l_PartnerLink.update((PartnerLink) a_TabbedDialog.getEditPanelHolderClone());
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveAddPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveAddPanel(TabbedDialog a_TabbedDialog) {
PartnerLink l_PartnerLink = (PartnerLink) a_TabbedDialog.getEditPanelHolderOriginal();
l_PartnerLink.update((PartnerLink) a_TabbedDialog.getEditPanelHolderClone());
addPartnerLink(l_PartnerLink);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditName()
*/
public String getEditName() {
return "PartnerLinks";
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getPanelTable()
*/
public CustomTable getPanelTable() {
CustomTable l_PartnerLinksTable = new CustomTable(this);
l_PartnerLinksTable.addColumnNames(PartnerLink.getColumnNames());
l_PartnerLinksTable.setRows(m_PartnerLink);
l_PartnerLinksTable.updateTable();
return l_PartnerLinksTable;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getNewPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getNewPanel(CustomTable a_CustomTable) {
PartnerLink l_PartnerLink = new PartnerLink();
return l_PartnerLink.getAddPanel(a_CustomTable);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("partnerLinks");
Enumeration l_Enum = getPartnerLinks().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element, ((PartnerLink) l_Enum.nextElement()).writeToXML(a_Document));
}
if (l_Element.hasChildNodes()) {
return l_Element;
} else {
return null;
}
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/framework/adv/AdvancedStandardDrawingView.java
New file
0,0 → 1,119
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.framework.adv;
 
import java.awt.Color;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
 
import javax.swing.JTextPane;
 
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedCopyCommand;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedCutCommand;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedDeleteCommand;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedDuplicateCommand;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedPasteCommand;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedRedoCommand;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedUndoCommand;
 
import CH.ifa.draw.framework.DrawingEditor;
import CH.ifa.draw.framework.Painter;
import CH.ifa.draw.framework.Tool;
import CH.ifa.draw.standard.StandardDrawingView;
import CH.ifa.draw.util.Command;
 
/**
* An implementation of StandardDrawingView which adds some common shortcuts
* which are undoable, like copy, cut, paste, delete etc
* @see StandardDrawingView
* @see Painter
* @see Tool
*/
public class AdvancedStandardDrawingView extends StandardDrawingView {
 
private JTextPane textPane = new JTextPane();
 
public AdvancedStandardDrawingView(DrawingEditor editor, int width, int height) {
super(editor, width, height);
setBackground(Color.white);
}
 
/**
* On certain keycombinations AdvancedCommands are executed
*/
public void keyPressed(KeyEvent e) {
int code = e.getKeyCode();
if ((code == KeyEvent.VK_BACK_SPACE) || (code == KeyEvent.VK_DELETE)) {
Command cmd = new AdvancedDeleteCommand("Delete");
cmd.execute();
editor().showStatus("Backspace or Delete PRESSED");
} else if (code == KeyEvent.VK_DOWN || code == KeyEvent.VK_UP || code == KeyEvent.VK_RIGHT
|| code == KeyEvent.VK_LEFT) {
handleCursorKey(code);
} else if (code == KeyEvent.VK_C) {
int ctrlMask = InputEvent.CTRL_DOWN_MASK;
if (((e.getModifiersEx() & ctrlMask)) == ctrlMask) {
Command cmd = new AdvancedCopyCommand("Copy");
cmd.execute();
editor().showStatus("CTRL-C PRESSED");
}
} else if (code == KeyEvent.VK_D) {
int ctrlMask = InputEvent.CTRL_DOWN_MASK;
if (((e.getModifiersEx() & ctrlMask)) == ctrlMask) {
Command cmd = new AdvancedDuplicateCommand("Duplicate");
cmd.execute();
editor().showStatus("CTRL-D PRESSED");
}
} else if (code == KeyEvent.VK_V) {
int ctrlMask = InputEvent.CTRL_DOWN_MASK;
if (((e.getModifiersEx() & ctrlMask)) == ctrlMask) {
Command cmd = new AdvancedPasteCommand("Paste");
cmd.execute();
editor().showStatus("CTRL-V PRESSED");
}
} else if (code == KeyEvent.VK_X) {
int ctrlMask = InputEvent.CTRL_DOWN_MASK;
if (((e.getModifiersEx() & ctrlMask)) == ctrlMask) {
Command cmd = new AdvancedCutCommand("Cut");
cmd.execute();
editor().showStatus("CTRL-X PRESSED");
}
} else if (code == KeyEvent.VK_Y) {
int ctrlMask = InputEvent.CTRL_DOWN_MASK;
if (((e.getModifiersEx() & ctrlMask)) == ctrlMask) {
Command cmd = new AdvancedRedoCommand("Redo");
cmd.execute();
editor().showStatus("CTRL-Y PRESSED");
}
} else if (code == KeyEvent.VK_Z) {
int ctrlMask = InputEvent.CTRL_DOWN_MASK;
if (((e.getModifiersEx() & ctrlMask)) == ctrlMask) {
Command cmd = new AdvancedUndoCommand("Undo");
cmd.execute();
editor().showStatus("CTRL-Z PRESSED");
}
} else {
tool().keyDown(e, code);
}
checkDamage();
}
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/framework/adv/UndoManage.java
New file
0,0 → 1,100
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.framework.adv;
 
import javax.swing.JMenuBar;
import javax.swing.event.UndoableEditEvent;
import javax.swing.event.UndoableEditListener;
import javax.swing.undo.UndoManager;
import javax.swing.undo.UndoableEdit;
import javax.swing.undo.UndoableEditSupport;
 
import CH.ifa.draw.util.CommandMenu;
 
/**
* This class holds the UndoManager
*/
public class UndoManage {
 
CommandMenu undoMenu;
 
/**
* Maximum number of undo's in the undo history list
* (to save memory)
*/
static final int MAXUNDOLIST = 50;
/**
* undo history list
*/
static UndoManager fUndoManager = new UndoManager();
/**
* undo event support
*/
static UndoableEditSupport undoSupport = new UndoableEditSupport();
static JMenuBar fJMenuBar;
 
public UndoManage(JMenuBar menubar) {
undoSupport = new UndoableEditSupport();
undoSupport.addUndoableEditListener(new UndoAdapter());
fJMenuBar = menubar;
refreshUndoRedo();
}
 
public static UndoManager getUndoManager() {
fUndoManager.setLimit(MAXUNDOLIST);
return fUndoManager;
}
 
public static UndoableEditSupport getUndoableEditSupport() {
return undoSupport;
}
 
/**
* This method is called after each undoable operation
* in order to refresh the presentation state of the
* undo/redo GUI
*/
 
public static void refreshUndoRedo() {
CommandMenu editMenu = (CommandMenu) fJMenuBar.getMenu(CH.ifa.draw.application.DrawApplication.EDIT_MENU);
editMenu.checkEnabled();
}
 
/**
* An undo/redo adpater. The adpater is notified when
* an undo edit occur(e.g. add or remove from the list)
* The adptor extract the edit from the event, add it
* to the UndoManager, and refresh the GUI
*/
 
private class UndoAdapter implements UndoableEditListener {
 
public UndoAdapter() {
super();
}
 
public void undoableEditHappened(UndoableEditEvent evt) {
UndoableEdit edit = evt.getEdit();
fUndoManager.addEdit(edit);
refreshUndoRedo();
}
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/framework/adv/PopupAble.java
New file
0,0 → 1,41
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.framework.adv;
 
import CH.ifa.draw.util.CommandPopupMenu;
 
/**
* Interface used for Objects which hold a PopupMenu
*/
public interface PopupAble {
 
/**
* Adds or overwrites a PopupMenu
*/
public void addPopup();
 
/**
* Adds a CommandPopupMenu
* @param a_CommandPopupMenu the CommandPopupMenu that needs to be added
*/
public void addPopupItems(CommandPopupMenu a_CommandPopupMenu);
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/framework/adv/DeepCopy.java
New file
0,0 → 1,60
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.framework.adv;
 
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
 
/**
* This class is useful for cloning objects. Java serialization is used for this
* Attention: Listeners can't be serialized so these need to be added manually later
* Popups experience this problem for example
*/
public class DeepCopy {
 
public static Object deepCopy(Object oldObj) throws Exception {
ObjectOutputStream oos = null;
ObjectInputStream ois = null;
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
oos = new ObjectOutputStream(bos);
// serialize and pass the object
oos.writeObject(oldObj);
oos.flush();
ByteArrayInputStream bin = new ByteArrayInputStream(bos.toByteArray());
ois = new ObjectInputStream(bin);
// return the new object
return ois.readObject();
} catch (IOException e) {
System.out.println("Exception in ObjectCloner = " + e);
throw (e);
} catch (ClassNotFoundException e) {
System.out.println("Exception in ObjectCloner = " + e);
throw (e);
} finally {
oos.close();
ois.close();
}
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/framework/BPELView.java
New file
0,0 → 1,133
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.framework;
 
import java.awt.Point;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.AdvancedStandardDrawingView;
import org.emaxx.bpeldesigner.bpel.standard.BPELCopyCommand;
import org.emaxx.bpeldesigner.bpel.standard.BPELCutCommand;
import org.emaxx.bpeldesigner.bpel.standard.BPELDeleteCommand;
import org.emaxx.bpeldesigner.bpel.standard.BPELDrawing;
import org.emaxx.bpeldesigner.bpel.standard.BPELDuplicateCommand;
import org.emaxx.bpeldesigner.bpel.standard.BPELFigureHolder;
import org.emaxx.bpeldesigner.bpel.standard.BPELPasteCommand;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedRedoCommand;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedUndoCommand;
 
import CH.ifa.draw.framework.Drawing;
import CH.ifa.draw.framework.DrawingEditor;
import CH.ifa.draw.framework.Painter;
import CH.ifa.draw.framework.Tool;
import CH.ifa.draw.util.Command;
 
/**
* An implementation of StandardDrawingView which adds some common BPELshortcuts
* which are undoable, like copy, cut, paste, delete etc, these are made suitable for
* BPEL
* @see AdvancedStandardDrawingView
* @see Painter
* @see Tool
*/
public class BPELView extends AdvancedStandardDrawingView {
 
public BPELView(DrawingEditor editor, int width, int height) {
super(editor, width, height);
}
 
/**
* On certain keycombinations AdvancedCommands are executed
*/
public void keyPressed(KeyEvent e) {
int code = e.getKeyCode();
if ((code == KeyEvent.VK_BACK_SPACE) || (code == KeyEvent.VK_DELETE)) {
Command cmd = new BPELDeleteCommand("Delete");
cmd.execute();
editor().showStatus("Backspace or Delete PRESSED");
} else if (code == KeyEvent.VK_DOWN || code == KeyEvent.VK_UP || code == KeyEvent.VK_RIGHT
|| code == KeyEvent.VK_LEFT) {
handleCursorKey(code);
} else if (code == KeyEvent.VK_C) {
int ctrlMask = InputEvent.CTRL_DOWN_MASK;
if (((e.getModifiersEx() & ctrlMask)) == ctrlMask) {
Command cmd = new BPELCopyCommand("Copy");
cmd.execute();
editor().showStatus("CTRL-C PRESSED");
}
} else if (code == KeyEvent.VK_D) {
int ctrlMask = InputEvent.CTRL_DOWN_MASK;
if (((e.getModifiersEx() & ctrlMask)) == ctrlMask) {
Command cmd = new BPELDuplicateCommand("Duplicate");
cmd.execute();
editor().showStatus("CTRL-D PRESSED");
}
} else if (code == KeyEvent.VK_V) {
int ctrlMask = InputEvent.CTRL_DOWN_MASK;
if (((e.getModifiersEx() & ctrlMask)) == ctrlMask) {
Command cmd = new BPELPasteCommand("Paste");
cmd.execute();
editor().showStatus("CTRL-V PRESSED");
}
} else if (code == KeyEvent.VK_X) {
int ctrlMask = InputEvent.CTRL_DOWN_MASK;
if (((e.getModifiersEx() & ctrlMask)) == ctrlMask) {
Command cmd = new BPELCutCommand("Cut");
cmd.execute();
editor().showStatus("CTRL-X PRESSED");
}
} else if (code == KeyEvent.VK_Y) {
int ctrlMask = InputEvent.CTRL_DOWN_MASK;
if (((e.getModifiersEx() & ctrlMask)) == ctrlMask) {
Command cmd = new AdvancedRedoCommand("Redo");
cmd.execute();
editor().showStatus("CTRL-Y PRESSED");
}
} else if (code == KeyEvent.VK_Z) {
int ctrlMask = InputEvent.CTRL_DOWN_MASK;
if (((e.getModifiersEx() & ctrlMask)) == ctrlMask) {
Command cmd = new AdvancedUndoCommand("Undo");
cmd.execute();
editor().showStatus("CTRL-Z PRESSED");
}
} else {
tool().keyDown(e, code);
}
checkDamage();
}
 
/**
* Sets and installs another drawing in the view.
* Layouts the BPELDrawing as well
*/
public void setDrawing(Drawing a_Drawing) {
super.setDrawing(a_Drawing);
if (a_Drawing instanceof BPELDrawing) {
BPELFigureHolder l_Owner = ((BPELDrawing) a_Drawing).getOwner();
if (l_Owner != null) {
l_Owner.getBPELLayouter().layout(new Point(0, 0), new Point(0, 0));
l_Owner.setCurrentLevels(l_Owner.getLevels());
}
}
}
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/BooleanExpr.java
New file
0,0 → 1,78
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.io.Serializable;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.DeepCopy;
 
/**
* This class represents the BooleanExpr BPEL-type
*/
public class BooleanExpr implements Serializable, Cloneable {
 
private BPString m_BooleanExpr = new BPString();
 
public BooleanExpr() {
}
 
public BooleanExpr(String a_BooleanExpr) {
m_BooleanExpr = new BPString(a_BooleanExpr);
}
 
public BooleanExpr(BPString a_BooleanExpr) {
m_BooleanExpr = a_BooleanExpr;
}
 
public void update(BooleanExpr a_BooleanExpr) {
m_BooleanExpr = a_BooleanExpr.getBooleanExpr();
}
 
public Object clone() {
try {
return DeepCopy.deepCopy(this);
} catch (Exception e) {
System.out.println("Caught an exception while cloning");
return null;
}
}
 
public BPString getBooleanExpr() {
return m_BooleanExpr;
}
 
public void setBooleanExpr(BPString a_BooleanExpr) {
m_BooleanExpr = a_BooleanExpr;
return;
}
 
public String toString() {
return m_BooleanExpr.toString();
}
 
/**
* Returns this attribute in XML-value
* @return this attribute in XML-value
*/
public String toXML() {
return m_BooleanExpr.toXML();
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/BPProperties.java
New file
0,0 → 1,141
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.io.Serializable;
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.DeepCopy;
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.Editable;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
 
/**
* This class is created for displaying the (BPEL) Property attribute in a table. It is necessary
* to keep the uniformity in the property dialog part.
*/
public class BPProperties implements Cloneable, Editable, Serializable {
 
private Vector m_Properties = new Vector();
 
public BPProperties() {
 
}
 
public Object clone() {
try {
return DeepCopy.deepCopy(this);
} catch (Exception e) {
System.out.println("Caught an exception while cloning");
return null;
}
}
 
public void addProperty(BPProperty a_Property) {
m_Properties.add(a_Property);
}
 
public Vector getProperties() {
return m_Properties;
}
 
public void setProperties(Vector a_Properties) {
m_Properties = a_Properties;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getEditPanel(CustomTable a_CustomTable) {
int l_RowNr = a_CustomTable.getSelectedRow();
if (l_RowNr >= 0) {
return ((BPProperty) m_Properties.get(l_RowNr)).getSelectedEditPanel(a_CustomTable);
} else {
return null;
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveEditPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveEditPanel(TabbedDialog a_TabbedDialog) {
BPProperty l_BPProperty = (BPProperty) a_TabbedDialog.getEditPanelHolderOriginal();
l_BPProperty.update((BPProperty) a_TabbedDialog.getEditPanelHolderClone());
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveAddPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveAddPanel(TabbedDialog a_TabbedDialog) {
BPProperty l_BPProperty = (BPProperty) a_TabbedDialog.getEditPanelHolderOriginal();
l_BPProperty.update((BPProperty) a_TabbedDialog.getEditPanelHolderClone());
m_Properties.add(l_BPProperty);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditName()
*/
public String getEditName() {
return "Properties";
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getPanelTable()
*/
public CustomTable getPanelTable() {
CustomTable l_BPPropertiesTable = new CustomTable(this);
l_BPPropertiesTable.addColumnNames(BPProperty.getColumnNames());
l_BPPropertiesTable.setRows(m_Properties);
l_BPPropertiesTable.updateTable();
return l_BPPropertiesTable;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getNewPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getNewPanel(CustomTable a_CustomTable) {
BPProperty l_BPProperty = new BPProperty();
return l_BPProperty.getAddPanel(a_CustomTable);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
/**
* Returns this attribute in XML-value
* @return this attribute in XML-value
*/
public String toXML() {
Enumeration l_Enum = getProperties().elements();
String l_String = new String("");
while (l_Enum.hasMoreElements()) {
l_String += ((BPProperty) l_Enum.nextElement()).toXML() + " ";
}
return l_String;
}
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/CorrelationSets.java
New file
0,0 → 1,177
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.Editable;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL CorrelationSets element, BPEL CorrelationSets Nodes can be converted to this class.
* This class supports certain modifying attributes. This class can be saved to a BPEL Node.
* It contains a method to get the CustomTable, ie a list of correlationsets
*/
public class CorrelationSets extends ExtensibleElements implements Editable {
 
private Vector m_CorrelationSets = new Vector();
 
public CorrelationSets() {
}
 
public void addCorrelationSet(CorrelationSet a_CorrelationSet) {
m_CorrelationSets.add(a_CorrelationSet);
}
 
public Vector getCorrelationSets() {
return m_CorrelationSets;
}
 
public void setCorrelationSets(Vector a_CorrelationSets) {
m_CorrelationSets = a_CorrelationSets;
return;
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_CorrelationSets the instance with the data that should be updated into this instance
*/
public void update(CorrelationSets a_CorrelationSets) {
super.update(a_CorrelationSets);
m_CorrelationSets.removeAllElements();
Enumeration l_Enum = a_CorrelationSets.getCorrelationSets().elements();
while (l_Enum.hasMoreElements()) {
addCorrelationSet((CorrelationSet) l_Enum.nextElement());
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NodeList children = a_Node.getChildNodes();
if (children != null) {
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_TempNodeName.equals("correlationSet")) {
CorrelationSet l_CorrelationSet = new CorrelationSet();
l_CorrelationSet.handleParse(children.item(i));
addCorrelationSet(l_CorrelationSet);
}
}
}
}
 
public String checkEditPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getEditPanel(CustomTable a_CustomTable) {
int l_RowNr = a_CustomTable.getSelectedRow();
if (l_RowNr >= 0) {
return ((CorrelationSet) m_CorrelationSets.get(l_RowNr)).getSelectedEditPanel(a_CustomTable);
} else {
return null;
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveEditPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveEditPanel(TabbedDialog a_TabbedDialog) {
CorrelationSet l_CorrelationSet = (CorrelationSet) a_TabbedDialog.getEditPanelHolderOriginal();
l_CorrelationSet.update((CorrelationSet) a_TabbedDialog.getEditPanelHolderClone());
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveAddPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveAddPanel(TabbedDialog a_TabbedDialog) {
CorrelationSet l_CorrelationSet = (CorrelationSet) a_TabbedDialog.getEditPanelHolderOriginal();
l_CorrelationSet.update((CorrelationSet) a_TabbedDialog.getEditPanelHolderClone());
addCorrelationSet(l_CorrelationSet);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditName()
*/
public String getEditName() {
return "CorrelationSets";
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getPanelTable()
*/
public CustomTable getPanelTable() {
CustomTable l_CorrelationSetsTable = new CustomTable(this);
l_CorrelationSetsTable.addColumnNames(CorrelationSet.getColumnNames());
l_CorrelationSetsTable.setRows(m_CorrelationSets);
l_CorrelationSetsTable.updateTable();
return l_CorrelationSetsTable;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getNewPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getNewPanel(CustomTable a_CustomTable) {
CorrelationSet l_CorrelationSet = new CorrelationSet();
return l_CorrelationSet.getAddPanel(a_CustomTable);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("correlationSets");
Enumeration l_Enum = getCorrelationSets().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element, ((CorrelationSet) l_Enum.nextElement()).writeToXML(a_Document));
}
if (l_Element.hasChildNodes()) {
return l_Element;
} else {
return null;
}
}
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/OnMessage.java
New file
0,0 → 1,250
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import org.emaxx.bpeldesigner.bpel.figures.BPELActivityFigure;
import org.emaxx.bpeldesigner.bpel.standard.BPELDrawing;
import org.emaxx.bpeldesigner.bpel.standard.BPELFigureHolder;
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.EditPanelHolder;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL OnMessage element, BPEL OnMessage Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class OnMessage extends ExtensibleElements implements EditPanelHolder {
 
private BPELDrawing m_Drawing;
private Correlations m_Correlations = new Correlations();
private ActivityGroup m_ActivityGroup;
private NCName m_PartnerLink = new NCName();
private QName m_PortType = new QName();
private NCName m_Operation = new NCName();
private NCName m_Variable = new NCName();
 
public OnMessage() {
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ExtensibleElements#getBPELDrawing(CH.ifa.draw.standard.BPELFigureHolder)
*/
public BPELDrawing getBPELDrawing(BPELFigureHolder a_BPELFigureHolder) {
if (m_Drawing == null) {
if (a_BPELFigureHolder.getHolderParent() != null) {
m_Drawing = new BPELDrawing(a_BPELFigureHolder,
a_BPELFigureHolder.getHolderParent().getBPELDrawing().getRootDocument());
} else {
m_Drawing = new BPELDrawing(a_BPELFigureHolder, null);
}
if (this.getActivityGroup() != null) {
BPELActivityFigure l_ActivityFigure = BPELActivityFigure.giveFigure(this.getActivityGroup());
l_ActivityFigure.setActivity((Activity) this.getActivityGroup());
m_Drawing.add(l_ActivityFigure);
}
}
return m_Drawing;
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_OnMessage the instance with the data that should be updated into this instance
*/
public void update(OnMessage a_OnMessage) {
super.update(a_OnMessage);
getCorrelations().update((a_OnMessage.getCorrelations()));
getPartnerLink().update((a_OnMessage.getPartnerLink()));
getPortType().update(a_OnMessage.getPortType());
getOperation().update((a_OnMessage.getOperation()));
getVariable().update(a_OnMessage.getVariable());
}
 
public Correlations getCorrelations() {
return m_Correlations;
}
 
public ActivityGroup getActivityGroup() {
return m_ActivityGroup;
}
 
public void setActivityGroup(ActivityGroup a_ActivityGroup) {
m_ActivityGroup = a_ActivityGroup;
return;
}
 
public NCName getPartnerLink() {
return m_PartnerLink;
}
 
public QName getPortType() {
return m_PortType;
}
 
public NCName getOperation() {
return m_Operation;
}
 
public NCName getVariable() {
return m_Variable;
}
 
public void setCorrelations(Correlations a_Correlations) {
m_Correlations = a_Correlations;
}
 
public void setPartnerLink(NCName a_PartnerLink) {
m_PartnerLink = a_PartnerLink;
}
 
public void setPortType(QName a_PortType) {
m_PortType = a_PortType;
}
 
public void setOperation(NCName a_Operation) {
m_Operation = a_Operation;
}
 
public void setVariable(NCName a_Variable) {
m_Variable = a_Variable;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("partnerLink")) {
setPartnerLink(new NCName(l_CurrentValue));
} else if (l_CurrentName.equals("portType")) {
setPortType(new QName(l_CurrentValue));
} else if (l_CurrentName.equals("operation")) {
setOperation(new NCName(l_CurrentValue));
} else if (l_CurrentName.equals("variable")) {
setVariable(new NCName(l_CurrentValue));
}
}
NodeList children = a_Node.getChildNodes();
if (children != null) {
KeyClassVector l_KeyClassVector = new KeyClassVector();
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_TempNodeName.equals("correlations")) {
Correlations l_Correlations = new Correlations();
l_Correlations.handleParse(children.item(i));
setCorrelations(l_Correlations);
} else if (l_KeyClassVector.getAContaining(l_TempNodeName) != null) {
ActivityGroup l_ActivityGroup = l_KeyClassVector.getAContaining(l_TempNodeName);
l_ActivityGroup.handleParse(children.item(i));
setActivityGroup(l_ActivityGroup);
}
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#checkEditPanel()
*/
public String checkEditPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getAddPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getAddPanel(CustomTable a_CustomTable) {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getSelectedEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getSelectedEditPanel(CustomTable a_CustomTable) {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_OnMessageClone) {
if (a_OnMessageClone instanceof OnMessage) {
OnMessage l_OnMessage = (OnMessage) a_OnMessageClone;
m_Correlations = l_OnMessage.getCorrelations();
m_PartnerLink = l_OnMessage.getPartnerLink();
m_PortType = l_OnMessage.getPortType();
m_Operation = l_OnMessage.getOperation();
m_Variable = l_OnMessage.getVariable();
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
OnMessage l_OnMessage = (OnMessage) this.clone();
TabbedDialog l_EditPanel = new TabbedDialog("OnMessage", l_OnMessage, this, a_ShowPanel);
l_EditPanel.addAttribute(l_OnMessage.getPartnerLink(), "PartnerLink*");
l_EditPanel.addAttribute(l_OnMessage.getPortType(), "PortType*");
l_EditPanel.addAttribute(l_OnMessage.getOperation(), "Operation*");
l_EditPanel.addAttribute(l_OnMessage.getVariable(), "Variable");
l_EditPanel.addTab(l_OnMessage.getCorrelations());
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("onMessage");
addXMLattribute(l_Element, "partnerLink", getPartnerLink().toXML());
addXMLattribute(l_Element, "portType", getPortType().toXML());
addXMLattribute(l_Element, "operation", getOperation().toXML());
addXMLattribute(l_Element, "variable", getVariable().toXML());
addXMLChild(l_Element, getCorrelations().writeToXML(a_Document));
if (getActivityGroup() != null) {
addXMLChild(l_Element, getActivityGroup().writeToXML(a_Document));
}
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/BPELDocument.java
New file
0,0 → 1,111
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.io.Serializable;
 
import org.apache.xerces.dom.DocumentImpl;
import org.emaxx.bpeldesigner.bpel.figures.BPELDocumentFigure;
import org.emaxx.bpeldesigner.bpel.figures.BPELProcessFigure;
import org.emaxx.bpeldesigner.bpel.standard.BPELDrawing;
import org.emaxx.bpeldesigner.bpel.standard.BPELFigureHolder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* This class is the top level 'Node' of a BPEL-document. It has a method to return
* the complete document in BPEL.
*/
public class BPELDocument implements Serializable {
 
private BPELDrawing m_Drawing;
private BPELProcess m_Process = new BPELProcess();
 
public BPELDocument() {
}
 
/**
* Returns an existing or new BPELDrawing if the BPELFigureHolder can contain a BPELDrawing,
* returns null otherwise
* @param a_BPELFigureHolder the figure that contains this Element
* @return an existing or new BPELDrawing if the BPELFigureHolder can contain a BPELDrawing,
* returns null otherwise
*/
public BPELDrawing getBPELDrawing(BPELFigureHolder a_BPELFigureHolder) {
if (m_Drawing == null) {
m_Drawing = new BPELDrawing(a_BPELFigureHolder, this);
if (this.getProcess() != null) {
BPELProcessFigure l_ProcessFigure = new BPELProcessFigure();
l_ProcessFigure.setProcess(this.getProcess());
BPELDocumentFigure l_BPELDocumentFigure = new BPELDocumentFigure();
l_BPELDocumentFigure.setDocument(this);
m_Drawing.setOwner(l_BPELDocumentFigure);
m_Drawing.add(l_ProcessFigure);
}
}
return m_Drawing;
}
 
public BPELProcess getProcess() {
return m_Process;
}
 
public void setProcess(BPELProcess a_Process) {
m_Process = a_Process;
return;
}
 
/**
* Returns a complete Document (BPEL)
* @return a complete Document (BPEL)
*/
public Document writeToXML() {
Document l_Doc = new DocumentImpl();
Element l_RootElement = m_Process.writeToXML(l_Doc);
l_Doc.appendChild(l_RootElement);
return l_Doc;
}
 
/**
* Parse a Node and extract the information
* @param a_Node this Node should be parsed
*/
public void handleParse(Node a_Node) {
switch (a_Node.getNodeType()) {
 
case Node.DOCUMENT_NODE:
NodeList nodes = a_Node.getChildNodes();
if (nodes != null) {
for (int i = 0; i < nodes.getLength(); i++) {
//voorlopig wordt eerste process gelijk teruggegeven (eventuele volgende (dit zou niet mogen)
//worden niet bekeken)
if (nodes.item(i).getNodeName().equals("process")) {
BPELProcess l_Process = new BPELProcess();
l_Process.handleParse(nodes.item(i));
m_Process = l_Process;
}
}
}
}
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/DurationExpr.java
New file
0,0 → 1,83
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.io.Serializable;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.DeepCopy;
 
/**
* This class represents the DurationExpr BPEL-type
*/
public class DurationExpr implements Serializable, Cloneable {
 
private BPString m_DurationExpr = new BPString();
 
public DurationExpr() {
}
 
public DurationExpr(String a_DurationExpr) {
m_DurationExpr = new BPString(a_DurationExpr);
}
 
public DurationExpr(BPString a_DurationExpr) {
m_DurationExpr = a_DurationExpr;
}
 
public Object clone() {
try {
return DeepCopy.deepCopy(this);
} catch (Exception e) {
System.out.println("Caught an exception while cloning");
return null;
}
}
 
public void update(DurationExpr a_DurationExpr) {
m_DurationExpr = a_DurationExpr.getDurationExpr();
}
 
public BPString getDurationExpr() {
return m_DurationExpr;
}
 
public void setDurationExpr(BPString a_DurationExpr) {
m_DurationExpr = a_DurationExpr;
return;
}
 
public void setDurationExpr(DurationExpr a_DurationExpr) {
m_DurationExpr = a_DurationExpr.getDurationExpr();
return;
}
 
public String toString() {
return m_DurationExpr.toString();
}
 
/**
* Returns this attribute in XML-value
* @return this attribute in XML-value
*/
public String toXML() {
return m_DurationExpr.toXML();
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Variable.java
New file
0,0 → 1,278
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.io.Serializable;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.DeepCopy;
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.EditPanelHolder;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.emaxx.bpeldesigner.input.Tableable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
 
/**
* Represents the BPEL Variable element, BPEL Variable Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class Variable implements ParseAble, Serializable, Tableable, EditPanelHolder, Cloneable {
 
private NCName m_Name = new NCName();
private QName m_MessageType = new QName();
private QName m_Type = new QName();
private QName m_Element = new QName();
private BPString m_AnyElement = new BPString();
private BPString m_AnyElementName = new BPString();
 
public Variable() {
}
 
public Object clone() {
try {
return DeepCopy.deepCopy(this);
} catch (Exception e) {
System.out.println("Caught an exception while cloning");
return null;
}
}
 
public void update(Variable a_Variable) {
getName().update(a_Variable.getName());
getMessageType().update(a_Variable.getMessageType());
getType().update(a_Variable.getType());
getElement().update(a_Variable.getElement());
m_AnyElement = a_Variable.getAnyElement();
m_AnyElementName = a_Variable.getAnyElementName();
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Tableable#getRow()
*/
public Vector getRow() {
Vector l_Vector = new Vector();
l_Vector.add(m_Name.toString());
l_Vector.add(m_MessageType.toString());
l_Vector.add(m_Type.toString());
l_Vector.add(m_Element.toString());
return l_Vector;
}
 
public static Vector getColumnNames() {
Vector l_Vector = new Vector();
l_Vector.add("Name*");
l_Vector.add("MessageType");
l_Vector.add("Type");
l_Vector.add("Element");
return l_Vector;
}
 
public BPString getAnyElementName() {
return m_AnyElementName;
}
 
public void setAnyElementName(BPString a_AnyElementName) {
m_AnyElementName = a_AnyElementName;
return;
}
 
public NCName getName() {
return m_Name;
}
 
public QName getMessageType() {
return m_MessageType;
}
 
public QName getType() {
return m_Type;
}
 
public QName getElement() {
return m_Element;
}
 
public BPString getAnyElement() {
return m_AnyElement;
}
 
public void setName(NCName a_Name) {
m_Name = a_Name;
return;
}
 
public void setMessageType(QName a_MessageType) {
m_MessageType = a_MessageType;
return;
}
 
public void setType(QName a_Type) {
m_Type = a_Type;
return;
}
 
public void setElement(QName a_Element) {
m_Element = a_Element;
return;
}
 
public void setAnyElement(BPString a_AnyElement) {
m_AnyElement = a_AnyElement;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("name")) {
setName(new NCName(l_CurrentValue));
} else if (l_CurrentName.equals("messageType")) {
setMessageType(new QName(l_CurrentValue));
} else if (l_CurrentName.equals("type")) {
setType(new QName(l_CurrentValue));
} else if (l_CurrentName.equals("element")) {
setElement(new QName(l_CurrentValue));
} else {
setAnyElementName(new BPString(l_CurrentName));
setAnyElement(new BPString(l_CurrentValue));
}
}
}
 
public String toString() {
if (m_Name != null) {
return m_Name.getName();
} else {
return "";
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#checkEditPanel()
*/
public String checkEditPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getAddPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getAddPanel(CustomTable a_CustomTable) {
TabbedDialog l_EditPanel = new TabbedDialog("Variable", this, this, a_CustomTable, true);
l_EditPanel.addAttribute(this.getName(), "Name*");
l_EditPanel.addAttribute(this.getMessageType(), "MessageType");
l_EditPanel.addAttribute(this.getType(), "Type");
l_EditPanel.addAttribute(this.getElement(), "Element");
l_EditPanel.addAttribute(this.getAnyElement(), "AnyElement");
l_EditPanel.addAttribute(this.getAnyElementName(), "AnyElementName");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getSelectedEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getSelectedEditPanel(CustomTable a_CustomTable) {
Variable l_Variable = (Variable) this.clone();
TabbedDialog l_EditPanel = new TabbedDialog("Variable", l_Variable, this, a_CustomTable,
false);
l_EditPanel.addAttribute(l_Variable.getName(), "Name*");
l_EditPanel.addAttribute(l_Variable.getMessageType(), "MessageType");
l_EditPanel.addAttribute(l_Variable.getType(), "Type");
l_EditPanel.addAttribute(l_Variable.getElement(), "Element");
l_EditPanel.addAttribute(l_Variable.getAnyElement(), "AnyElement");
l_EditPanel.addAttribute(l_Variable.getAnyElementName(), "AnyElementName");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_VariableClone) {
if (a_VariableClone instanceof Variable) {
Variable l_Variable = (Variable) a_VariableClone;
getName().update(l_Variable.getName());
getMessageType().update(m_MessageType = l_Variable.getMessageType());
getType().update(l_Variable.getType());
getElement().update(l_Variable.getElement());
getAnyElement().update(l_Variable.getAnyElement());
getAnyElementName().update(l_Variable.getAnyElementName());
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("variable");
addXMLattribute(l_Element, "name", getName().toXML());
addXMLattribute(l_Element, "messageType", getMessageType().toXML());
addXMLattribute(l_Element, "type", getType().toXML());
addXMLattribute(l_Element, "element", getElement().toXML());
if (m_AnyElementName != null) {
addXMLattribute(l_Element, getAnyElementName().toXML(), getAnyElement().toXML());
}
return l_Element;
}
 
/**
* This method adds an attribute to a XML-element
* @param a_ParentElement the XML-element to which the attribute is added
* @param a_AttributeName the attribute name
* @param a_Attribute the attribute value
*/
public void addXMLattribute(Element a_ParentElement, String a_AttributeName, String a_Attribute) {
if (a_AttributeName != null && a_Attribute != null) {
if ((!a_AttributeName.equals("")) && (!a_Attribute.equals(""))) {
a_ParentElement.setAttribute(a_AttributeName, a_Attribute);
}
}
}
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Pick.java
New file
0,0 → 1,168
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL Pick element, BPEL Pick Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class Pick extends Activity implements ActivityGroup {
 
private Vector m_OnMessages = new Vector();
private Vector m_OnAlarms = new Vector();
private BPBoolean m_CreateInstance = new BPBoolean("no");
 
public Pick() {
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_Pick the instance with the data that should be updated into this instance
*/
public void update(Pick a_Pick) {
super.update(a_Pick);
getCreateInstance().update(a_Pick.getCreateInstance());
}
 
public void addOnMessages(OnMessage a_OnMessage) {
m_OnMessages.add(a_OnMessage);
return;
}
 
public Vector getOnMessages() {
return m_OnMessages;
}
 
public void setOnMessages(Vector a_OnMessages) {
m_OnMessages = a_OnMessages;
return;
}
 
public void addOnAlarms(OnAlarm a_OnAlarm) {
m_OnAlarms.add(a_OnAlarm);
return;
}
 
public Vector getOnAlarms() {
return m_OnAlarms;
}
 
public void setOnAlarms(Vector a_OnAlarms) {
m_OnAlarms = a_OnAlarms;
return;
}
 
public BPBoolean getCreateInstance() {
return m_CreateInstance;
}
 
public void setCreateInstance(BPBoolean a_CreateInstance) {
m_CreateInstance = a_CreateInstance;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("createInstance")) {
setCreateInstance(new BPBoolean(l_CurrentValue));
}
}
NodeList children = a_Node.getChildNodes();
if (children != null) {
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_TempNodeName.equals("onMessage")) {
OnMessage l_OnMessage = new OnMessage();
l_OnMessage.handleParse(children.item(i));
addOnMessages(l_OnMessage);
} else if (l_TempNodeName.equals("onAlarm")) {
OnAlarm l_OnAlarm = new OnAlarm();
l_OnAlarm.handleParse(children.item(i));
addOnAlarms(l_OnAlarm);
}
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_PickClone) {
if (a_PickClone instanceof Pick) {
super.saveEditPanel(a_PickClone);
Pick l_Pick = (Pick) a_PickClone;
m_CreateInstance = l_Pick.getCreateInstance();
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
TabbedDialog l_EditPanel = super.getShowEditPanel(a_ShowPanel);
l_EditPanel.addAttribute(
((Pick) l_EditPanel.getEditPanelHolderClone()).getCreateInstance(), "CreateInstance");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("pick");
super.writeToXML(a_Document, l_Element);
addXMLattribute(l_Element, "createInstance", getCreateInstance().toXML());
Enumeration l_Enum = getOnMessages().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element, ((OnMessage) l_Enum.nextElement()).writeToXML(a_Document));
}
l_Enum = getOnAlarms().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element, ((OnAlarm) l_Enum.nextElement()).writeToXML(a_Document));
}
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/BPString.java
New file
0,0 → 1,87
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.io.Serializable;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.DeepCopy;
 
/**
* This class represents the String BPEL-type
*/
public class BPString implements Cloneable, Serializable {
 
private String m_BPString = new String("");
 
public BPString() {
}
 
public BPString(String a_BPString) {
m_BPString = a_BPString;
}
 
public String getBPString() {
return m_BPString;
}
 
public void setBPString(String a_String) {
m_BPString = a_String;
}
 
public void setBPString(BPString a_BPString) {
m_BPString = a_BPString.getBPString();
}
 
public Object clone() {
try {
return DeepCopy.deepCopy(this);
} catch (Exception e) {
System.out.println("Caught an exception while cloning");
return null;
}
}
 
public void update(BPString a_BPString) {
m_BPString = a_BPString.getBPString();
}
 
public String toString() {
if (m_BPString != null) {
return m_BPString;
}
return "";
}
 
/**
* Returns this attribute in XML-value
* @return this attribute in XML-value
*/
public String toXML() {
if (m_BPString != null) {
if (m_BPString.equals("")) {
return null;
} else {
return m_BPString;
}
}
return null;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/PartnerLink.java
New file
0,0 → 1,222
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Vector;
 
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.EditPanelHolder;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.emaxx.bpeldesigner.input.Tableable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
 
/**
* Represents the BPEL PartnerLink element, BPEL PartnerLink Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class PartnerLink extends ExtensibleElements implements Tableable, EditPanelHolder {
 
private NCName m_Name = new NCName();
private QName m_PartnerLinkType = new QName();
private NCName m_MyRole = new NCName();
private NCName m_PartnerRole = new NCName();
 
public PartnerLink() {
 
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Tableable#getRow()
*/
public Vector getRow() {
Vector l_Vector = new Vector();
l_Vector.add(m_Name.toString());
l_Vector.add(m_PartnerLinkType.toString());
return l_Vector;
}
 
public static Vector getColumnNames() {
Vector l_Vector = new Vector();
l_Vector.add("Name*");
l_Vector.add("PartnerLinkType*");
return l_Vector;
}
 
public NCName getName() {
return m_Name;
}
 
public QName getPartnerLinkType() {
return m_PartnerLinkType;
}
 
public NCName getMyRole() {
return m_MyRole;
}
 
public NCName getPartnerRole() {
return m_PartnerRole;
}
 
public void setName(NCName a_Name) {
m_Name = a_Name;
return;
}
 
public void setPartnerLinkType(QName a_PartnerLinkType) {
m_PartnerLinkType = a_PartnerLinkType;
return;
}
 
public void setMyRole(NCName a_MyRole) {
m_MyRole = a_MyRole;
return;
}
 
public void setPartnerRole(NCName a_PartnerRole) {
m_PartnerRole = a_PartnerRole;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("name")) {
setName(new NCName(l_CurrentValue));
} else if (l_CurrentName.equals("partnerLinkType")) {
setPartnerLinkType(new QName(l_CurrentValue));
} else if (l_CurrentName.equals("myRole")) {
setMyRole(new NCName(l_CurrentValue));
} else if (l_CurrentName.equals("partnerRole")) {
setPartnerRole(new NCName(l_CurrentValue));
}
}
}
 
public String toString() {
if (m_Name != null) {
return m_Name.getName();
} else {
return "";
}
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_PartnerLink the instance with the data that should be updated into this instance
*/
public void update(PartnerLink a_PartnerLink) {
super.update(a_PartnerLink);
getName().update((a_PartnerLink.getName()));
getPartnerLinkType().update(a_PartnerLink.getPartnerLinkType());
getMyRole().update(a_PartnerLink.getMyRole());
getPartnerRole().update(a_PartnerLink.getPartnerRole());
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#checkEditPanel()
*/
public String checkEditPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getAddPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getAddPanel(CustomTable a_CustomTable) {
TabbedDialog l_EditPanel = new TabbedDialog("PartnerLink", this, this, a_CustomTable, true);
l_EditPanel.addAttribute(this.getName(), "Name*");
l_EditPanel.addAttribute(this.getPartnerLinkType(), "PartnerLinkType*");
l_EditPanel.addAttribute(this.getMyRole(), "MyRole");
l_EditPanel.addAttribute(this.getPartnerRole(), "PartnerRole");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getSelectedEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getSelectedEditPanel(CustomTable a_CustomTable) {
PartnerLink l_PartnerLink = (PartnerLink) this.clone();
TabbedDialog l_EditPanel = new TabbedDialog("PartnerLink", l_PartnerLink, this,
a_CustomTable, false);
l_EditPanel.addAttribute(l_PartnerLink.getName(), "Name*");
l_EditPanel.addAttribute(l_PartnerLink.getPartnerLinkType(), "PartnerLinkType*");
l_EditPanel.addAttribute(l_PartnerLink.getMyRole(), "MyRole");
l_EditPanel.addAttribute(l_PartnerLink.getPartnerRole(), "PartnerRole");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_PartnerLinkClone) {
if (a_PartnerLinkClone instanceof PartnerLink) {
PartnerLink l_PartnerLink = (PartnerLink) a_PartnerLinkClone;
m_Name = l_PartnerLink.getName();
m_PartnerLinkType = l_PartnerLink.getPartnerLinkType();
m_MyRole = l_PartnerLink.getMyRole();
m_PartnerRole = l_PartnerLink.getPartnerRole();
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("partnerLink");
addXMLattribute(l_Element, "name", getName().toXML());
addXMLattribute(l_Element, "partnerLinkType", getPartnerLinkType().toXML());
addXMLattribute(l_Element, "myRole", getMyRole().toXML());
addXMLattribute(l_Element, "partnerRole", getPartnerRole().toXML());
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/OnAlarm.java
New file
0,0 → 1,161
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.EditPanelHolder;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
 
/**
* Represents the BPEL OnAlarm element, BPEL OnAlarm Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class OnAlarm extends ActivityContainer implements EditPanelHolder {
 
private DurationExpr m_For = new DurationExpr();
private DeadlineExpr m_Until = new DeadlineExpr();
 
public OnAlarm() {
}
 
public OnAlarm(DurationExpr a_For, DeadlineExpr a_Until) {
m_For = a_For;
m_Until = a_Until;
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_OnAlarm the instance with the data that should be updated into this instance
*/
public void update(OnAlarm a_OnAlarm) {
super.update(a_OnAlarm);
getFor().update((a_OnAlarm.getFor()));
getUntil().update(a_OnAlarm.getUntil());
}
 
public DurationExpr getFor() {
return m_For;
}
 
public DeadlineExpr getUntil() {
return m_Until;
}
 
public void setFor(DurationExpr a_For) {
m_For = a_For;
return;
}
 
public void setUntil(DeadlineExpr a_Until) {
m_Until = a_Until;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("for")) {
setFor(new DurationExpr(l_CurrentValue));
} else if (l_CurrentName.equals("until")) {
setUntil(new DeadlineExpr(l_CurrentValue));
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#checkEditPanel()
*/
public String checkEditPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getAddPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getAddPanel(CustomTable a_CustomTable) {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getSelectedEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getSelectedEditPanel(CustomTable a_CustomTable) {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_OnAlarmClone) {
if (a_OnAlarmClone instanceof OnAlarm) {
OnAlarm l_OnAlarm = (OnAlarm) a_OnAlarmClone;
m_For = l_OnAlarm.getFor();
m_Until = l_OnAlarm.getUntil();
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
OnAlarm l_OnAlarm = (OnAlarm) this.clone();
TabbedDialog l_EditPanel = new TabbedDialog("OnAlarm", l_OnAlarm, this, a_ShowPanel);
l_EditPanel.addAttribute(l_OnAlarm.getFor(), "For");
l_EditPanel.addAttribute(l_OnAlarm.getUntil(), "Until");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("onAlarm");
super.writeToXML(a_Document, l_Element);
addXMLattribute(l_Element, "for", getFor().toXML());
addXMLattribute(l_Element, "until", getUntil().toXML());
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Activity.java
New file
0,0 → 1,254
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Enumeration;
 
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.EditPanelHolder;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL Activity element, BPEL Activity Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class Activity extends ExtensibleElements implements EditPanelHolder {
 
private Targets m_Targets = new Targets();
private Sources m_Sources = new Sources();
private NCName m_Name = new NCName();
private BooleanExpr m_JoinCondition = new BooleanExpr();
private BPBoolean m_SuppressJoinFailure = new BPBoolean("no");
 
public Activity() {
}
 
/**
* This method updates this instance with an instance of the sameclass, such that
* reference to this instance sub-elements remain intact
* @param a_Activity the instance with the data that should be updated into this instance
*/
public void update(Activity a_Activity) {
super.update(a_Activity);
getName().update((a_Activity.getName()));
getJoinCondition().update(a_Activity.getJoinCondition());
getSuppressJoinFailure().update(a_Activity.getSuppressJoinFailure());
getTargets().update(a_Activity.getTargets());
getSources().update(a_Activity.getSources());
}
 
public void addSource(Source a_Source) {
m_Sources.addSource(a_Source);
return;
}
 
public Sources getSources() {
return m_Sources;
}
 
public void setSources(Sources a_Sources) {
m_Sources = a_Sources;
return;
}
 
public void addTarget(Target a_Target) {
m_Targets.addTarget(a_Target);
return;
}
 
public Targets getTargets() {
return m_Targets;
}
 
public void setTargets(Targets a_Targets) {
m_Targets = a_Targets;
return;
}
 
public NCName getName() {
return m_Name;
}
 
public BooleanExpr getJoinCondition() {
return m_JoinCondition;
}
 
public BPBoolean getSuppressJoinFailure() {
return m_SuppressJoinFailure;
}
 
public void setName(NCName a_Name) {
m_Name = a_Name;
return;
}
 
public void setJoinCondition(BooleanExpr a_JoinCondition) {
m_JoinCondition = a_JoinCondition;
return;
}
 
public void setSuppressJoinFailure(BPBoolean a_SuppressJoinFailure) {
m_SuppressJoinFailure = a_SuppressJoinFailure;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("name")) {
setName(new NCName(l_CurrentValue));
} else if (l_CurrentName.equals("joinCondition")) {
setJoinCondition(new BooleanExpr(l_CurrentValue));
} else if (l_CurrentName.equals("suppressJoinFailure")) {
setSuppressJoinFailure(new BPBoolean(l_CurrentValue));
}
}
NodeList children = a_Node.getChildNodes();
if (children != null) {
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_TempNodeName.equals("target")) {
Target l_Target = new Target();
l_Target.handleParse(children.item(i));
addTarget(l_Target);
} else if (l_TempNodeName.equals("source")) {
Source l_Source = new Source();
l_Source.handleParse(children.item(i));
addSource(l_Source);
}
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#checkEditPanel()
*/
public String checkEditPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getAddPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getAddPanel(CustomTable a_CustomTable) {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getSelectedEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getSelectedEditPanel(CustomTable a_CustomTable) {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_ActivityClone) {
if (a_ActivityClone instanceof Activity) {
Activity l_Activity = (Activity) a_ActivityClone;
m_Name = l_Activity.getName();
m_JoinCondition = l_Activity.getJoinCondition();
m_SuppressJoinFailure = l_Activity.getSuppressJoinFailure();
m_Targets = l_Activity.getTargets();
m_Sources = l_Activity.getSources();
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
Activity l_Activity = (Activity) this.clone();
TabbedDialog l_EditPanel = new TabbedDialog("Activity", l_Activity, this, a_ShowPanel);
l_EditPanel.addAttribute(l_Activity.getName(), "Name");
l_EditPanel.addAttribute(l_Activity.getJoinCondition(), "JoinCondition");
l_EditPanel.addAttribute(l_Activity.getSuppressJoinFailure(), "SuppressJoinFailure");
l_EditPanel.addTab(l_Activity.getTargets());
l_EditPanel.addTab(l_Activity.getSources());
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("activity");
addXMLattribute(l_Element, "name", getName().toXML());
addXMLattribute(l_Element, "joinCondition", getJoinCondition().toXML());
addXMLattribute(l_Element, "suppressJoinFailure", getSuppressJoinFailure().toXML());
Enumeration l_Enum = getTargets().getTargets().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element, ((Target) l_Enum.nextElement()).writeToXML(a_Document));
}
l_Enum = getSources().getSources().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element, ((Source) l_Enum.nextElement()).writeToXML(a_Document));
}
return l_Element;
}
 
/**
* This method should be called by subclasses, the elementname can be the subclasses name
* @param a_Document The general document in which this element is placed
* @param a_Element The XML-element of which the super-attributes and elements should be added
* @return The parameter XML-element (with added attributes)
*/
public Element writeToXML(Document a_Document, Element a_Element) {
addXMLattribute(a_Element, "name", getName().toXML());
addXMLattribute(a_Element, "joinCondition", getJoinCondition().toXML());
addXMLattribute(a_Element, "suppressJoinFailure", getSuppressJoinFailure().toXML());
Enumeration l_Enum = getTargets().getTargets().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(a_Element, ((Target) l_Enum.nextElement()).writeToXML(a_Document));
}
l_Enum = getSources().getSources().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(a_Element, ((Source) l_Enum.nextElement()).writeToXML(a_Document));
}
return a_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/CorrelationSet.java
New file
0,0 → 1,202
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.StringTokenizer;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.EditPanelHolder;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.emaxx.bpeldesigner.input.Tableable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
 
/**
* Represents the BPEL CorrelationSet element, BPEL CorrelationSet Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class CorrelationSet extends ExtensibleElements implements Tableable, EditPanelHolder {
 
private BPProperties m_Properties = new BPProperties();
private NCName m_Name = new NCName();
 
public CorrelationSet() {
}
 
public CorrelationSet(BPProperties a_Properties, NCName a_Name) {
m_Properties = a_Properties;
m_Name = a_Name;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Tableable#getRow()
*/
public Vector getRow() {
Vector l_Vector = new Vector();
l_Vector.add(m_Name.toString());
return l_Vector;
}
 
public static Vector getColumnNames() {
Vector l_Vector = new Vector();
l_Vector.add("Name*");
return l_Vector;
}
 
public void addProperty(BPProperty a_Property) {
m_Properties.addProperty(a_Property);
}
 
public BPProperties getProperties() {
return m_Properties;
}
 
public NCName getName() {
return m_Name;
}
 
public void setProperties(BPProperties a_Properties) {
m_Properties = a_Properties;
return;
}
 
public void setName(NCName a_Name) {
m_Name = a_Name;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("properties")) {
StringTokenizer l_ST = new StringTokenizer(l_CurrentValue);
String l_Temp;
while (l_ST.hasMoreTokens()) {
l_Temp = l_ST.nextToken();
addProperty(new BPProperty(new QName(l_Temp)));
}
} else if (l_CurrentName.equals("name")) {
setName(new NCName(l_CurrentValue));
}
 
}
}
 
public String toString() {
if (m_Name != null) {
return m_Name.getName();
} else {
return "";
}
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_CorrelationSet the instance with the data that should be updated into this instance
*/
public void update(CorrelationSet a_CorrelationSet) {
super.update(a_CorrelationSet);
getName().update((a_CorrelationSet.getName()));
m_Properties = (a_CorrelationSet.getProperties());
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#checkEditPanel()
*/
public String checkEditPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getAddPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getAddPanel(CustomTable a_CustomTable) {
TabbedDialog l_EditPanel = new TabbedDialog("CorrelationSet", this, this, a_CustomTable,
true);
l_EditPanel.addAttribute(this.getName(), "Name*");
l_EditPanel.addTab(this.getProperties());
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getSelectedEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getSelectedEditPanel(CustomTable a_CustomTable) {
CorrelationSet l_CorrelationSet = (CorrelationSet) this.clone();
TabbedDialog l_EditPanel = new TabbedDialog("CorrelationSet", l_CorrelationSet, this,
a_CustomTable, false);
l_EditPanel.addAttribute(l_CorrelationSet.getName(), "Name*");
l_EditPanel.addTab(this.getProperties());
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_CorrelationSetClone) {
if (a_CorrelationSetClone instanceof CorrelationSet) {
CorrelationSet l_CorrelationSet = (CorrelationSet) a_CorrelationSetClone;
m_Name = l_CorrelationSet.getName();
m_Properties = l_CorrelationSet.getProperties();
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("correlationSet");
addXMLattribute(l_Element, "properties", getProperties().toXML());
addXMLattribute(l_Element, "name", getName().toXML());
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/URI.java
New file
0,0 → 1,83
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.io.Serializable;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.DeepCopy;
 
/**
* This class represents the URI BPEL-type
*/
public class URI implements Cloneable, Serializable {
 
private String m_URI = new String("");
 
public URI() {
}
 
public URI(String a_URI) {
m_URI = a_URI;
}
 
public String getURI() {
return m_URI;
}
 
public void setURI(String a_URI) {
m_URI = a_URI;
}
 
public Object clone() {
try {
return DeepCopy.deepCopy(this);
} catch (Exception e) {
System.out.println("Caught an exception while cloning");
return null;
}
}
 
public void update(URI a_URI) {
m_URI = a_URI.getURI();
}
 
public String toString() {
if (m_URI != null) {
return m_URI;
}
return "";
}
 
/**
* Returns this attribute in XML-value
* @return this attribute in XML-value
*/
public String toXML() {
if (m_URI != null) {
if (m_URI.equals("")) {
return null;
} else {
return m_URI;
}
}
return null;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/QName.java
New file
0,0 → 1,103
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.io.Serializable;
import java.util.StringTokenizer;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.DeepCopy;
 
/**
* This class represents the QName BPEL-type
*/
public class QName implements Serializable, Cloneable {
 
private NCName m_Prefix = new NCName();
private NCName m_LocalPart = new NCName();
 
public QName() {
}
 
public QName(String a_QNameString) {
StringTokenizer l_ST = new StringTokenizer(a_QNameString, ":");
String l_Temp;
if (l_ST.hasMoreTokens()) {
l_Temp = l_ST.nextToken();
if (l_ST.hasMoreTokens()) {
m_Prefix = new NCName(l_Temp);
m_LocalPart = new NCName(l_ST.nextToken());
} else {
m_LocalPart = new NCName(l_Temp);
}
}
}
 
public void update(QName a_QName) {
getPrefix().update(a_QName.getPrefix());
getLocalPart().update(a_QName.getLocalPart());
}
 
public Object clone() {
try {
return DeepCopy.deepCopy(this);
} catch (Exception e) {
System.out.println("Caught an exception while cloning");
return null;
}
}
 
public NCName getPrefix() {
return m_Prefix;
}
 
public NCName getLocalPart() {
return m_LocalPart;
}
 
public void setPrefix(NCName a_Prefix) {
m_Prefix = a_Prefix;
}
 
public void setLocalPart(NCName a_LocalPart) {
m_LocalPart = a_LocalPart;
}
 
public String toString() {
if (m_Prefix.getName().equals("")) {
return m_LocalPart.getName();
} else {
return m_Prefix.getName() + ":" + m_LocalPart.getName();
}
}
 
/**
* Returns this attribute in XML-value
* @return this attribute in XML-value
*/
public String toXML() {
if (m_Prefix.getName().equals("")) {
return m_LocalPart.getName();
} else if (!m_LocalPart.getName().equals("")) {
return m_Prefix.getName() + ":" + m_LocalPart.getName();
}
return "";
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Switch.java
New file
0,0 → 1,137
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.bpel.figures.BPELCaseFigure;
import org.emaxx.bpeldesigner.bpel.figures.BPELOtherwiseFigure;
import org.emaxx.bpeldesigner.bpel.standard.BPELDrawing;
import org.emaxx.bpeldesigner.bpel.standard.BPELFigureHolder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL Switch element, BPEL Switch Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class Switch extends Activity implements ActivityGroup {
 
private BPELDrawing m_Drawing;
private Vector m_Case = new Vector();
private Otherwise m_Otherwise;
 
public Switch() {
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ExtensibleElements#getBPELDrawing(CH.ifa.draw.standard.BPELFigureHolder)
*/
public BPELDrawing getBPELDrawing(BPELFigureHolder a_BPELFigureHolder) {
if (m_Drawing == null) {
if (a_BPELFigureHolder.getHolderParent() != null) {
m_Drawing = new BPELDrawing(a_BPELFigureHolder,
a_BPELFigureHolder.getHolderParent().getBPELDrawing().getRootDocument());
} else {
m_Drawing = new BPELDrawing(a_BPELFigureHolder, null);
}
if (this.getCase() != null) {
Enumeration l_Enum = this.getCase().elements();
while (l_Enum.hasMoreElements()) {
BPELCaseFigure l_CaseFigure = new BPELCaseFigure();
l_CaseFigure.setCase((Case) l_Enum.nextElement());
m_Drawing.add(l_CaseFigure);
}
}
if (this.getOtherwise() != null) {
BPELOtherwiseFigure l_OtherwiseFigure = new BPELOtherwiseFigure();
l_OtherwiseFigure.setOtherwise(this.getOtherwise());
m_Drawing.add(l_OtherwiseFigure);
}
}
return m_Drawing;
}
 
public void setOtherwise(Otherwise a_Otherwise) {
m_Otherwise = a_Otherwise;
return;
}
 
public Otherwise getOtherwise() {
return m_Otherwise;
}
 
public void addCase(Case a_Case) {
m_Case.add(a_Case);
}
 
public boolean removeCase(Case a_Case) {
return m_Case.remove(a_Case);
}
 
public Vector getCase() {
return m_Case;
}
 
public void setCase(Vector a_Case) {
m_Case = a_Case;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
NodeList children = a_Node.getChildNodes();
if (children != null) {
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_TempNodeName.equals("case")) {
Case l_Case = new Case();
l_Case.handleParse(children.item(i));
addCase(l_Case);
} else if (l_TempNodeName.equals("otherwise")) {
Otherwise l_Otherwise = new Otherwise();
l_Otherwise.handleParse(children.item(i));
setOtherwise(l_Otherwise);
}
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("switch");
super.writeToXML(a_Document, l_Element);
Enumeration l_Enum = getCase().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element, ((Case) l_Enum.nextElement()).writeToXML(a_Document));
}
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/DeadlineExpr.java
New file
0,0 → 1,80
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.io.Serializable;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.DeepCopy;
 
public class DeadlineExpr implements Serializable, Cloneable {
 
private BPString m_DeadlineExpr = new BPString();
 
public DeadlineExpr() {
}
 
public DeadlineExpr(String a_DeadlineExpr) {
m_DeadlineExpr = new BPString(a_DeadlineExpr);
}
 
public DeadlineExpr(BPString a_DeadlineExpr) {
m_DeadlineExpr = a_DeadlineExpr;
}
 
public Object clone() {
try {
return DeepCopy.deepCopy(this);
} catch (Exception e) {
System.out.println("Caught an exception while cloning");
return null;
}
}
 
public void update(DeadlineExpr a_DeadlineExpr) {
m_DeadlineExpr = a_DeadlineExpr.getDeadlineExpr();
}
 
public BPString getDeadlineExpr() {
return m_DeadlineExpr;
}
 
public void setDeadlineExpr(BPString a_DeadlineExpr) {
m_DeadlineExpr = a_DeadlineExpr;
return;
}
 
public void setDeadlineExpr(DeadlineExpr a_DeadlineExpr) {
m_DeadlineExpr = a_DeadlineExpr.getDeadlineExpr();
return;
}
 
public String toString() {
return m_DeadlineExpr.toString();
}
 
/**
* Returns this attribute in XML-value
* @return this attribute in XML-value
*/
public String toXML() {
return m_DeadlineExpr.toXML();
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Correlations.java
New file
0,0 → 1,172
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.Editable;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL Correlations element, BPEL Correlations Nodes can be converted to this class.
* This class supports certain modifying attributes and elements. This class can be saved to a BPEL Node.
* It contains a method to get the CustomTable, ie a list of correlations
*/
public class Correlations extends ExtensibleElements implements Editable {
 
private Vector m_Correlations = new Vector();
 
public Correlations() {
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getEditPanel(CustomTable a_CustomTable) {
int l_RowNr = a_CustomTable.getSelectedRow();
if (l_RowNr >= 0) {
return ((Correlation) m_Correlations.get(l_RowNr)).getSelectedEditPanel(a_CustomTable);
} else {
return null;
}
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_Correlations the instance with the data that should be updated into this instance
*/
public void update(Correlations a_Correlations) {
m_Correlations.removeAllElements();
Enumeration l_Enum = a_Correlations.getCorrelations().elements();
while (l_Enum.hasMoreElements()) {
addCorrelation((Correlation) l_Enum.nextElement());
}
}
 
public void addCorrelation(Correlation a_Correlation) {
m_Correlations.add(a_Correlation);
return;
}
 
public Vector getCorrelations() {
return m_Correlations;
}
 
public void setCorrelations(Vector a_Correlation) {
m_Correlations = a_Correlation;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NodeList children = a_Node.getChildNodes();
if (children != null) {
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_TempNodeName.equals("correlation")) {
Correlation l_Correlation = new Correlation();
l_Correlation.handleParse(children.item(i));
addCorrelation(l_Correlation);
}
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveEditPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveEditPanel(TabbedDialog a_TabbedDialog) {
Correlation l_Correlation = (Correlation) a_TabbedDialog.getEditPanelHolderOriginal();
l_Correlation.update((Correlation) a_TabbedDialog.getEditPanelHolderClone());
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveAddPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveAddPanel(TabbedDialog a_TabbedDialog) {
Correlation l_Correlation = (Correlation) a_TabbedDialog.getEditPanelHolderOriginal();
l_Correlation.update((Correlation) a_TabbedDialog.getEditPanelHolderClone());
m_Correlations.add(l_Correlation);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditName()
*/
public String getEditName() {
return "Correlations";
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getPanelTable()
*/
public CustomTable getPanelTable() {
CustomTable l_CorrelationsTable = new CustomTable(this);
l_CorrelationsTable.addColumnNames(Correlation.getColumnNames());
l_CorrelationsTable.setRows(m_Correlations);
l_CorrelationsTable.updateTable();
return l_CorrelationsTable;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getNewPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getNewPanel(CustomTable a_CustomTable) {
Correlation l_Correlation = new Correlation();
return l_Correlation.getAddPanel(a_CustomTable);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("correlations");
Enumeration l_Enum = getCorrelations().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element, ((Correlation) l_Enum.nextElement()).writeToXML(a_Document));
}
if (l_Element.hasChildNodes()) {
return l_Element;
} else {
return null;
}
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/BPProperty.java
New file
0,0 → 1,142
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.io.Serializable;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.DeepCopy;
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.EditPanelHolder;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.emaxx.bpeldesigner.input.Tableable;
 
/**
* This class is used for the Properties BPEL-element which has multiple properties separated by spaces.
*/
public class BPProperty implements Tableable, Cloneable, EditPanelHolder, Serializable {
 
private QName m_Property = new QName();
 
public BPProperty() {
}
 
public Object clone() {
try {
return DeepCopy.deepCopy(this);
} catch (Exception e) {
System.out.println("Caught an exception while cloning");
return null;
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Tableable#getRow()
*/
public Vector getRow() {
Vector l_Vector = new Vector();
l_Vector.add(m_Property.toString());
return l_Vector;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
return null;
}
 
public void update(BPProperty a_Property) {
getProperty().update(a_Property.getProperty());
}
 
public BPProperty(QName a_Property) {
m_Property = a_Property;
}
 
public static Vector getColumnNames() {
Vector l_Vector = new Vector();
l_Vector.add("Property");
return l_Vector;
}
 
public QName getProperty() {
return m_Property;
}
 
public void setProperty(QName a_Property) {
m_Property = a_Property;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#checkEditPanel()
*/
public String checkEditPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getAddPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getAddPanel(CustomTable a_CustomTable) {
TabbedDialog l_EditPanel = new TabbedDialog("Property", this, this, a_CustomTable, true);
l_EditPanel.addAttribute(this.getProperty(), "Property");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getSelectedEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getSelectedEditPanel(CustomTable a_CustomTable) {
BPProperty l_BPProperty = (BPProperty) this.clone();
TabbedDialog l_EditPanel = new TabbedDialog("Property", l_BPProperty, this, a_CustomTable,
false);
l_EditPanel.addAttribute(l_BPProperty.getProperty(), "Property");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_BPPropertyClone) {
if (a_BPPropertyClone instanceof BPProperty) {
BPProperty l_BPProperty = (BPProperty) a_BPPropertyClone;
m_Property = l_BPProperty.getProperty();
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
/**
* Returns this attribute in XML-value
* @return this attribute in XML-value
*/
public String toXML() {
return m_Property.toXML();
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Sequence.java
New file
0,0 → 1,167
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.bpel.figures.BPELActivityFigure;
import org.emaxx.bpeldesigner.bpel.standard.BPELDrawing;
import org.emaxx.bpeldesigner.bpel.standard.BPELFigureHolder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL Sequence element, BPEL Sequence Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class Sequence extends Activity implements ActivityGroup {
 
private BPELDrawing m_Drawing;
private Vector m_ActivityGroups = new Vector();
 
public Sequence() {
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ExtensibleElements#getBPELDrawing(CH.ifa.draw.standard.BPELFigureHolder)
*/
public BPELDrawing getBPELDrawing(BPELFigureHolder a_BPELFigureHolder) {
if (m_Drawing == null) {
if (a_BPELFigureHolder.getHolderParent() != null) {
m_Drawing = new BPELDrawing(a_BPELFigureHolder,
a_BPELFigureHolder.getHolderParent().getBPELDrawing().getRootDocument());
} else {
m_Drawing = new BPELDrawing(a_BPELFigureHolder, null);
}
if (this.getActivityGroups() != null) {
Enumeration l_Enum = this.getActivityGroups().elements();
BPELActivityFigure l_BPELActivityFigure = null;
while (l_Enum.hasMoreElements()) {
ActivityGroup l_ActivityGroup = (ActivityGroup) l_Enum.nextElement();
BPELActivityFigure l_ActivityFigure = BPELActivityFigure.giveFigure(l_ActivityGroup);
l_ActivityFigure.setActivity((Activity) l_ActivityGroup);
m_Drawing.add(l_ActivityFigure);
l_BPELActivityFigure = l_ActivityFigure;
}
}
}
return m_Drawing;
}
 
public void addActivityGroup(ActivityGroup a_ActivityGroup) {
m_ActivityGroups.add(a_ActivityGroup);
return;
}
 
public int getActivityGroupPosition(ActivityGroup a_ActivityGroup) {
return m_ActivityGroups.indexOf(a_ActivityGroup);
}
 
public void insertActivityGroup(int a_Position, ActivityGroup a_ActivityGroup) {
m_ActivityGroups.add(a_Position, a_ActivityGroup);
return;
}
 
public void insertAfterActivityGroup(ActivityGroup a_ExistingActivityGroup,
ActivityGroup a_NewActivityGroup) {
int l_FoundPosition = m_ActivityGroups.indexOf(a_ExistingActivityGroup);
if (l_FoundPosition >= 0) {
m_ActivityGroups.add(l_FoundPosition + 1, a_NewActivityGroup);
}
 
return;
}
 
public void insertBeforeActivityGroup(ActivityGroup a_ExistingActivityGroup,
ActivityGroup a_NewActivityGroup) {
int l_FoundPosition = m_ActivityGroups.indexOf(a_ExistingActivityGroup);
if (l_FoundPosition >= 0) {
m_ActivityGroups.add(l_FoundPosition, a_NewActivityGroup);
}
return;
}
 
public void moveActivityGroup(ActivityGroup a_ExistingActivityGroup,
ActivityGroup a_MovingActivityGroup) {
int l_FoundPosition = m_ActivityGroups.indexOf(a_ExistingActivityGroup);
int l_FoundPositionMoving = m_ActivityGroups.indexOf(a_MovingActivityGroup);
if (l_FoundPosition >= 0 && l_FoundPositionMoving >= 0) {
if (l_FoundPosition > l_FoundPositionMoving) {
m_ActivityGroups.add(l_FoundPosition, a_MovingActivityGroup);
m_ActivityGroups.remove(l_FoundPositionMoving);
} else if (l_FoundPosition < l_FoundPositionMoving) {
m_ActivityGroups.add(l_FoundPosition, a_MovingActivityGroup);
m_ActivityGroups.remove(l_FoundPositionMoving + 1);
}
m_ActivityGroups.add(l_FoundPosition, a_MovingActivityGroup);
}
return;
}
 
public boolean removeActivityGroup(ActivityGroup a_ActivityGroup) {
return m_ActivityGroups.remove(a_ActivityGroup);
}
 
public Vector getActivityGroups() {
return m_ActivityGroups;
}
 
public void setActivityGroups(Vector a_ActivityGroups) {
m_ActivityGroups = a_ActivityGroups;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
NodeList children = a_Node.getChildNodes();
if (children != null) {
KeyClassVector l_KeyClassVector = new KeyClassVector();
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_KeyClassVector.getAContaining(l_TempNodeName) != null) {
ActivityGroup l_ActivityGroup = l_KeyClassVector.getAContaining(l_TempNodeName);
l_ActivityGroup.handleParse(children.item(i));
addActivityGroup(l_ActivityGroup);
}
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("sequence");
super.writeToXML(a_Document, l_Element);
Enumeration l_Enum = getActivityGroups().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element, ((ActivityGroup) l_Enum.nextElement()).writeToXML(a_Document));
}
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELCopyCommand.java
New file
0,0 → 1,94
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import java.util.Enumeration;
import java.util.Vector;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedCopyCommand;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedStandardDrawing;
 
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.util.Clipboard;
 
/**
* Copy the selection to the clipboard and Undo and Redo this action
* @see Clipboard
*/
public class BPELCopyCommand extends AdvancedCopyCommand {
 
/**
* @param a_Name the command name
*/
 
public BPELCopyCommand(String a_Name) {
super(a_Name);
}
 
/**
* @param name the command name
* @param a_Drawing the drawing that this command should be executed on
* @param a_FiguresOld the previous clipboard contents
* @param a_FiguresNew the new clipboard contents
*/
public BPELCopyCommand(String name, AdvancedStandardDrawing a_Drawing, Vector a_FiguresOld,
Vector a_FiguresNew) {
super(name, a_Drawing, a_FiguresOld, a_FiguresNew);
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
Vector l_VectorOld = (Vector) Clipboard.getClipboard().getContents();
Vector l_Vector = new Vector();
this.setSelectionZOrdered();
Enumeration l_Enum = getSelectionZOrdered().elements();
 
while (l_Enum.hasMoreElements()) {
l_Vector.add(((Figure) l_Enum.nextElement()).clone());
}
UndoableEdit edit = new BPELCopyCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing(), l_VectorOld, l_Vector);
Clipboard.getClipboard().setContents(l_Vector);
UndoManage.getUndoableEditSupport().postEdit(edit);
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
Clipboard.getClipboard().setContents(m_NewClipBoard);
m_HasBeenDone = true;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
Clipboard.getClipboard().setContents(m_OldClipBoard);
m_HasBeenDone = false;
}
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELDuplicateCommand.java
New file
0,0 → 1,152
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import java.awt.Point;
import java.util.Enumeration;
import java.util.Vector;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedDuplicateCommand;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedStandardDrawing;
 
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.util.Clipboard;
 
/**
* Duplicate the selection and Undo and Redo this action
*/
public class BPELDuplicateCommand extends AdvancedDuplicateCommand {
 
public Vector m_DuplicateSelection = new Vector();
 
/**
* @param a_Name the name of the command
*/
public BPELDuplicateCommand(String a_Name) {
super(a_Name);
}
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
*/
public BPELDuplicateCommand(String a_Name, AdvancedStandardDrawing a_Drawing,
Vector a_DuplicateSelection) {
super(a_Name, a_Drawing);
m_DuplicateSelection = a_DuplicateSelection;
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
Vector l_Vector = new Vector();
this.setSelectionZOrdered();
Enumeration l_Enum = getSelectionZOrdered().elements();
 
while (l_Enum.hasMoreElements()) {
l_Vector.add(((Figure) l_Enum.nextElement()).clone());
}
UndoableEdit edit = new BPELDuplicateCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing(), l_Vector);
Enumeration l_Enum1 = l_Vector.elements();
getView().clearSelection();
Vector l_Figures = new Vector();
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
Enumeration l_Enum2 = l_Vector.elements();
while (l_Enum2.hasMoreElements()) {
Figure l_Figure = (Figure) l_Enum2.nextElement();
boolean l_Possible = ((BPELDrawing) m_Drawing).getOwner().addToScope(l_Figure);
if (l_Possible) {
l_Figure.moveBy(10, 10);
m_Drawing.add(l_Figure);
l_Figures.add(l_Figure);
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(
new Point(0, 0), new Point(0, 0));
}
}
}
}
m_Drawing.checkDamage();
}
if (l_Figures.size() > 0) {
UndoManage.getUndoableEditSupport().postEdit(edit);
Clipboard.getClipboard().setContents(l_Vector);
}
}
 
public boolean isExecutable() {
return getView().selectionCount() > 0;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
Enumeration l_Enum = m_DuplicateSelection.elements();
while (l_Enum.hasMoreElements()) {
Figure l_Figure = (Figure) l_Enum.nextElement();
if (((BPELDrawing) m_Drawing).getOwner().removeFromScope(l_Figure)) {
m_Drawing.remove(l_Figure);
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(
new Point(0, 0), new Point(0, 0));
}
}
}
}
m_Drawing.checkDamage();
}
m_HasBeenDone = false;
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
Enumeration l_Enum2 = m_DuplicateSelection.elements();
while (l_Enum2.hasMoreElements()) {
Figure l_Figure = (Figure) l_Enum2.nextElement();
boolean l_Possible = ((BPELDrawing) m_Drawing).getOwner().addToScope(l_Figure);
if (l_Possible) {
l_Figure.moveBy(10, 10);
m_Drawing.add(l_Figure);
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(
new Point(0, 0), new Point(0, 0));
}
}
}
}
m_Drawing.checkDamage();
}
m_HasBeenDone = true;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELPasteCommand.java
New file
0,0 → 1,163
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import java.awt.Point;
import java.awt.Rectangle;
import java.util.Enumeration;
import java.util.Vector;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedPasteCommand;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedStandardDrawing;
 
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.util.Clipboard;
 
/**
* Insert the clipboard into the drawing and Undo and Redo this action.
* @see Clipboard
*/
public class BPELPasteCommand extends AdvancedPasteCommand {
 
/**
* @param a_Name the name of the command
*/
public BPELPasteCommand(String a_Name) {
super(a_Name);
}
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param a_LastClick the point that was clicked last (point where figure will be inserted)
*/
public BPELPasteCommand(String a_Name, AdvancedStandardDrawing a_Drawing, Point a_LastClick,
Vector a_Figures) {
super(a_Name, a_Drawing, a_LastClick, a_Figures);
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
Point lastClick = getView().lastClick();
Vector l_Vector = (Vector) Clipboard.getClipboard().getContents();
if (l_Vector != null) {
Enumeration l_Enum1 = l_Vector.elements();
Vector tempvector = new Vector();
while (l_Enum1.hasMoreElements()) {
tempvector.add(((Figure) l_Enum1.nextElement()).clone());
}
UndoableEdit edit = new BPELPasteCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing(), lastClick, tempvector);
if (tempvector.size() == 0)
return;
Vector l_Figures = new Vector();
Rectangle r = bounds(tempvector.elements());
getView().clearSelection();
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
Enumeration l_Enum2 = tempvector.elements();
while (l_Enum2.hasMoreElements()) {
Figure l_Figure = (Figure) l_Enum2.nextElement();
boolean l_Possible = ((BPELDrawing) m_Drawing).getOwner().addToScope(
l_Figure);
if (l_Possible) {
l_Figure.moveBy(lastClick.x - r.x, lastClick.y - r.y);
m_Drawing.add(l_Figure);
l_Figures.add(l_Figure);
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(
new Point(0, 0), new Point(0, 0));
}
}
}
}
}
if (l_Figures.size() > 0) {
UndoManage.getUndoableEditSupport().postEdit(edit);
Clipboard.getClipboard().setContents(l_Vector);
}
m_Drawing.checkDamage();
}
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
Enumeration l_Enum = m_Figures.elements();
while (l_Enum.hasMoreElements()) {
Figure l_Figure = (Figure) l_Enum.nextElement();
if (((BPELDrawing) m_Drawing).getOwner().removeFromScope(l_Figure)) {
m_Drawing.remove(l_Figure);
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(
new Point(0, 0), new Point(0, 0));
}
}
}
}
m_Drawing.checkDamage();
}
m_Drawing.checkDamage();
m_HasBeenDone = false;
 
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
Vector tempvector = m_Figures;
if (tempvector != null) {
if (tempvector.size() == 0)
return;
 
Rectangle r = bounds(tempvector.elements());
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
Enumeration l_Enum = tempvector.elements();
while (l_Enum.hasMoreElements()) {
Figure l_Figure = (Figure) l_Enum.nextElement();
boolean l_Possible = ((BPELDrawing) m_Drawing).getOwner().addToScope(
l_Figure);
if (l_Possible) {
l_Figure.moveBy(m_Insertpoint.x - r.x, m_Insertpoint.y - r.y);
m_Drawing.add(l_Figure);
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(
new Point(0, 0), new Point(0, 0));
}
}
}
}
}
m_Drawing.checkDamage();
}
m_HasBeenDone = true;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELChangeScopeCommand.java
New file
0,0 → 1,99
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.BPELDesigner;
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedStandardDrawing;
import org.emaxx.bpeldesigner.bpel.util.adv.AdvancedCommand;
 
/**
* Insert a figure or a Vector of figures and Undo and Redo this action
*/
public class BPELChangeScopeCommand extends AdvancedCommand {
 
public BPELFigureHolder m_OldScopeFigure;
public BPELFigureHolder m_NewScopeFigure;
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param a_NewScopeFigure the figure which scope we want to see
*/
public BPELChangeScopeCommand(String a_Name, BPELFigureHolder a_NewScopeFigure) {
super(a_Name);
m_NewScopeFigure = a_NewScopeFigure;
}
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param m_OldScopeFigure the figure which scope we saw
* @param a_NewScopeFigure the figure which scope we want to see
*/
public BPELChangeScopeCommand(String a_Name, BPELFigureHolder a_OldScopeFigure,
BPELFigureHolder a_NewScopeFigure) {
super(a_Name);
m_NewScopeFigure = a_NewScopeFigure;
m_OldScopeFigure = a_OldScopeFigure;
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
if (m_Drawing instanceof BPELDrawing) {
BPELFigureHolder l_FigureHolder = ((BPELDrawing) m_Drawing).getOwner();
BPELDrawing l_Drawing = m_NewScopeFigure.getBPELDrawing();
((BPELDesigner) m_DrawApp).changeScope(m_NewScopeFigure.getHierarchyName(), l_Drawing,
m_NewScopeFigure);
UndoableEdit edit = new BPELChangeScopeCommand(this.getPresentationName(),
l_FigureHolder, m_NewScopeFigure);
UndoManage.getUndoableEditSupport().postEdit(edit);
}
}
 
public boolean isExecutable() {
return getView().selectionCount() > 0;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
BPELDrawing l_Drawing = m_OldScopeFigure.getBPELDrawing();
((BPELDesigner) m_DrawApp).changeScope(m_OldScopeFigure.getHierarchyName(), l_Drawing,
m_OldScopeFigure);
m_HasBeenDone = false;
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
BPELDrawing l_Drawing = m_NewScopeFigure.getBPELDrawing();
((BPELDesigner) m_DrawApp).changeScope(m_NewScopeFigure.getHierarchyName(), l_Drawing,
m_NewScopeFigure);
m_HasBeenDone = true;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELFigureHolder.java
New file
0,0 → 1,119
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import org.emaxx.bpeldesigner.bpel.contrib.BPELLayoutable;
import org.emaxx.bpeldesigner.bpel.framework.adv.PopupAble;
import org.emaxx.bpeldesigner.input.TabbedDialog;
 
import CH.ifa.draw.framework.Figure;
 
/**
* The interface of a figure that can contain figures
* It can be used to layout a drawing and to show children in a new drawing
*/
 
public interface BPELFigureHolder extends BPELLayoutable, PopupAble {
 
/**
* Returns whether the BPEL figure can hold the Figure
* @param a_Figure the figure to be held
* @return the possibility of holding the Figure
*/
public boolean acceptsHolding(Figure a_Figure);
 
/**
* Tries to add a figure to the current scope and returns true if it was possible
* @param a_Figure the figure to be inserted
* @return true if the figure was added, false otherwise
*/
public boolean addToScope(Figure a_Figure);
 
/**
* Returns whether this figure can be removed, in case it is a BPELFigure, it will be removed in the
* internal BPEL-representation, graphical removal should still be done separately
* @param a_Figure the figure to be removed
* @return the possibility to remove this figure
*/
public boolean removeFromScope(Figure a_Figure);
 
/**
* Returns the drawing containing all its children
* @return the drawing containing all its children
*/
public BPELDrawing getBPELDrawing();
 
/**
* The name on the actual picture
* @return The name on the actual picture
*/
public String getFigureName();
 
/**
* The name on the actual picture
* @param a_FigureName The name on the actual picture
*/
public void setFigureName(String a_FigureName);
 
/**
* Every BPELFigure has a parent BPEL Figure, with this method you can get it
* This name is used for frame titles
* * @return the parent of the figure
*/
public BPELFigureHolder getHolderParent();
 
/**
* returns the figure's complete name. This is a name in which
* the ancestors names are included.
* @return the complete name of the figure
*/
public String getHierarchyName();
 
/**
* returns the local part of the figure's complete name
* @return the local part of the figure's complete name
*/
public String getHierarchyLocalName();
 
/**
* Every BPEL figure has a parent BPEL figure, with this method you can set it
* This name is used for frame titles
* @param a_HolderParent the parent of the figure
*/
public void setHolderParent(BPELFigureHolder a_HolderParent);
 
/**
* Every BPELFigureHolder has an optional TabbedDialog. This is normally used
* for a property screen.
* @return
*/
public TabbedDialog getPanel();
 
/**
* This should return the tools that can be used. Add the values in BPELTools that you need
* @return the sum of all the tools that can be used
* @see org.emaxx.bpeldesigner.bpel.contrib.BPELTools
*/
public int getBPELToolSelection();
 
public String getRootName();
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELHierarchyUpCommand.java
New file
0,0 → 1,83
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
 
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedStandardDrawing;
import org.emaxx.bpeldesigner.bpel.util.adv.AdvancedCommand;
 
/**
* Command to go one level up in BPEL hierarchy in the view
*/
public class BPELHierarchyUpCommand extends AdvancedCommand {
 
/**
* @param a_Name the name of the command
*/
public BPELHierarchyUpCommand(String a_Name) {
super(a_Name);
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
BPELFigureHolder l_Owner = null;
if (m_Drawing != null) {
l_Owner = ((BPELDrawing) m_Drawing).getOwner();
}
 
if (l_Owner != null) {
BPELFigureHolder l_BPELFigureHolder = ((BPELFigureHolder) l_Owner).getHolderParent();
if (l_BPELFigureHolder != null) {
BPELChangeScopeCommand l_Command = new BPELChangeScopeCommand("HierarchyUpCommand",
l_BPELFigureHolder);
l_Command.execute();
}
}
}
 
public boolean isExecutable() {
return getView().selectionCount() > 0;
}
 
public boolean canUndo() {
return false;
}
 
public boolean canRedo() {
return false;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
}
 
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELNewScopeCommand.java
New file
0,0 → 1,83
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.BPELDesigner;
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedStandardDrawing;
import org.emaxx.bpeldesigner.bpel.util.adv.AdvancedCommand;
 
/**
* Insert a figure or a Vector of figures and Undo and Redo this action
*/
public class BPELNewScopeCommand extends AdvancedCommand {
 
public BPELFigureHolder m_OldScopeFigure;
public BPELFigureHolder m_NewScopeFigure;
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param a_NewScopeFigure the figure which scope we want to see
*/
public BPELNewScopeCommand(String a_Name, BPELFigureHolder a_NewScopeFigure) {
super(a_Name);
m_NewScopeFigure = a_NewScopeFigure;
}
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param a_NewScopeFigure the figure which scope we want to see
*/
public BPELNewScopeCommand(String a_Name, BPELFigureHolder a_OldScopeFigure,
BPELFigureHolder a_NewScopeFigure) {
super(a_Name);
m_NewScopeFigure = a_NewScopeFigure;
m_OldScopeFigure = a_OldScopeFigure;
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
if (m_Drawing instanceof BPELDrawing) {
BPELDrawing l_Drawing = m_NewScopeFigure.getBPELDrawing();
((BPELDesigner) m_DrawApp).newScope(m_NewScopeFigure.getHierarchyName(), l_Drawing,
m_NewScopeFigure);
UndoableEdit edit = new BPELNewScopeCommand(this.getPresentationName(),
m_NewScopeFigure);
UndoManage.getUndoableEditSupport().postEdit(edit);
}
}
 
public boolean isExecutable() {
return m_NewScopeFigure != null;
}
 
public boolean canUndo() {
return false;
}
 
public boolean canRedo() {
return false;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELSelectionTool.java
New file
0,0 → 1,63
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import java.awt.event.MouseEvent;
 
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedSelectionTool;
 
import CH.ifa.draw.framework.DrawingView;
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.framework.Tool;
 
public class BPELSelectionTool extends AdvancedSelectionTool {
 
/**
* Create an instance of this SelectionTool for the given view
*
* @param view DrawingView for which the SelectionTool operates
*/
public BPELSelectionTool(DrawingView view) {
super(view);
}
 
/**
* Hook method which can be overriden by subclasses to provide
* specialised behaviour in the event of a mouse double click.
*/
protected void handleMouseDoubleClick(MouseEvent e, int x, int y) {
BPELFigureHolder l_BPELFigureHolder = null;
Figure pressedFigure = drawing().findFigureInside(x, y);
if (pressedFigure instanceof BPELFigureHolder) {
l_BPELFigureHolder = (BPELFigureHolder) pressedFigure;
BPELDialogCommand l_Command = new BPELDialogCommand("Properties", pressedFigure);
l_Command.execute();
view().clearSelection();
}
}
 
/**
* Factory method to create a AdvancedDrag tracker. It is used to drag a figure.
*/
protected Tool createDragTracker(DrawingView a_View, Figure a_Figure) {
return new BPELDragTracker(a_View, a_Figure);
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedChangeAttributeCommand.java
New file
0,0 → 1,117
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import java.util.Vector;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.util.adv.AdvancedCommand;
 
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.framework.FigureEnumeration;
 
/**
* Command to change a named figure attribute and to Undo or Redo this action.
*/
public class AdvancedChangeAttributeCommand extends AdvancedCommand {
 
private String m_Attribute;
private Object m_Value;
private Vector m_OldAttributes;
 
/**
* Constructs a change attribute command.
* @param a_Name the command name
* @param a_AttributeName the name of the attribute to be changed
* @param a_Value the new attribute value
*/
public AdvancedChangeAttributeCommand(String a_Name, String a_AttributeName, Object a_Value) {
super(a_Name);
m_Attribute = a_AttributeName;
m_Value = a_Value;
}
 
/**
* @param a_Name the command name
* @param a_AttributeName the name of the attribute to be changed
* @param a_Value the new attribute value
* @param a_Drawing the drawing that this command should be executed on
* @param a_OldAttributes the attributes to be saved for Undo/Redo
*/
private AdvancedChangeAttributeCommand(String a_Name, String a_AttributeName, Object a_Value,
AdvancedStandardDrawing a_Drawing, Vector a_OldAttributes) {
super(a_Name, a_Drawing);
m_Attribute = a_AttributeName;
m_Value = a_Value;
m_OldAttributes = a_OldAttributes;
setSelectionZOrdered();
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
FigureEnumeration k = getView().selectionElements();
Vector tempvector = new Vector();
Vector tempvector2 = new Vector();
while (k.hasMoreElements()) {
Figure f = k.nextFigure();
tempvector.add(f.getAllAttributes(m_Attribute));
tempvector2.add(f);
f.setAttribute(m_Attribute, m_Value);
}
UndoableEdit edit = new AdvancedChangeAttributeCommand(this.getPresentationName(),
m_Attribute, m_Value, (AdvancedStandardDrawing) m_DrawApp.drawing(), tempvector);
UndoManage.getUndoableEditSupport().postEdit(edit);
m_Drawing.checkDamage();
}
 
public boolean isExecutable() {
return getView().selectionCount() > 0;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
for (int i = 0; i < getSelectionZOrdered().size(); i++) {
Vector tempvector = (Vector) m_OldAttributes.get(i);
((Figure) getSelectionZOrdered().get(i)).setAllAttributes(m_Attribute, tempvector);
}
m_Drawing.checkDamage();
m_HasBeenDone = false;
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
for (int i = 0; i < getSelectionZOrdered().size(); i++) {
((Figure) getSelectionZOrdered().get(i)).setAttribute(m_Attribute, m_Value);
}
m_Drawing.checkDamage();
m_HasBeenDone = true;
}
 
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedCopyCommand.java
New file
0,0 → 1,104
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import java.util.Vector;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
 
import CH.ifa.draw.framework.FigureSelection;
import CH.ifa.draw.util.Clipboard;
 
/**
* Copy the selection to the clipboard and Undo and Redo this action
* @see Clipboard
*/
public class AdvancedCopyCommand extends AdvancedFigureTransferCommand {
 
public Vector m_NewClipBoard;
public Vector m_OldClipBoard;
 
/**
* @param a_Name the command name
*/
 
public AdvancedCopyCommand(String a_Name) {
super(a_Name);
}
 
/**
* @param name the command name
* @param a_Drawing the drawing that this command should be executed on
* @param a_FiguresOld the previous clipboard contents
* @param a_FiguresNew the new clipboard contents
*/
public AdvancedCopyCommand(String name, AdvancedStandardDrawing a_Drawing, Vector a_FiguresOld,
Vector a_FiguresNew) {
super(name, a_Drawing);
m_OldClipBoard = a_FiguresOld;
m_NewClipBoard = a_FiguresNew;
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
FigureSelection temp1 = (FigureSelection) Clipboard.getClipboard().getContents();
Vector tempvector = null;
if (temp1 != null) {
tempvector = (Vector) temp1.getData(FigureSelection.TYPE);
}
this.setSelectionZOrdered();
FigureSelection temp2 = new FigureSelection(this.getSelectionZOrdered());
UndoableEdit edit = new AdvancedCopyCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing(), tempvector,
(Vector) temp2.getData(FigureSelection.TYPE));
copySelection();
UndoManage.getUndoableEditSupport().postEdit(edit);
}
 
public boolean isExecutable() {
return this.getView().selectionCount() > 0;
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
copySelection(new FigureSelection(m_NewClipBoard));
m_HasBeenDone = true;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
if (m_OldClipBoard != null) {
copySelection(new FigureSelection(m_OldClipBoard));
}
m_HasBeenDone = false;
 
}
 
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedDuplicateCommand.java
New file
0,0 → 1,95
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import java.util.Vector;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
 
import CH.ifa.draw.framework.Drawing;
import CH.ifa.draw.framework.FigureSelection;
 
/**
* Duplicate the selection and Undo and Redo this action
*/
public class AdvancedDuplicateCommand extends AdvancedFigureTransferCommand {
 
public Vector m_DuplicateSelection = new Vector();
 
/**
* @param a_Name the name of the command
*/
public AdvancedDuplicateCommand(String a_Name) {
super(a_Name);
}
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
*/
public AdvancedDuplicateCommand(String a_Name, AdvancedStandardDrawing a_Drawing) {
super(a_Name, a_Drawing);
setSelectionZOrdered();
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
FigureSelection selection = getView().getFigureSelection();
Drawing draw = m_Drawing;
Vector figures = (Vector) selection.getData(FigureSelection.TYPE);
UndoableEdit edit = new AdvancedDuplicateCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing());
getView().clearSelection();
insertFigures(figures, 10, 10);
m_Drawing.checkDamage();
UndoManage.getUndoableEditSupport().postEdit(edit);
}
 
public boolean isExecutable() {
return getView().selectionCount() > 0;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
m_Drawing.removeAll(getSelectionZOrdered());
getView().clearSelection();
m_Drawing.checkDamage();
 
m_HasBeenDone = false;
 
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
getView().clearSelection();
insertFigures(getSelectionZOrdered(), 10, 10);
m_Drawing.checkDamage();
m_HasBeenDone = true;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedPasteCommand.java
New file
0,0 → 1,122
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import java.awt.Point;
import java.awt.Rectangle;
import java.util.Enumeration;
import java.util.Vector;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
 
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.framework.FigureSelection;
import CH.ifa.draw.util.Clipboard;
 
/**
* Insert the clipboard into the drawing and Undo and Redo this action.
* @see Clipboard
*/
public class AdvancedPasteCommand extends AdvancedFigureTransferCommand {
 
public Point m_Insertpoint;
public Vector m_Figures;
 
/**
* @param a_Name the name of the command
*/
public AdvancedPasteCommand(String a_Name) {
super(a_Name);
}
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param a_LastClick the point that was clicked last (point where figure will be inserted)
*/
public AdvancedPasteCommand(String a_Name, AdvancedStandardDrawing a_Drawing,
Point a_LastClick, Vector a_Figures) {
super(a_Name, a_Drawing);
setSelectionZOrdered();
m_Insertpoint = a_LastClick;
m_Figures = a_Figures;
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
Point lastClick = getView().lastClick();
FigureSelection selection = (FigureSelection) Clipboard.getClipboard().getContents();
Vector tempvector = null;
if (selection != null) {
tempvector = (Vector) selection.getData(FigureSelection.TYPE);
UndoableEdit edit = new AdvancedPasteCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing(), lastClick, tempvector);
 
if (tempvector.size() == 0)
return;
 
Rectangle r = bounds(tempvector.elements());
getView().clearSelection();
insertFigures(tempvector, lastClick.x - r.x, lastClick.y - r.y);
m_Drawing.checkDamage();
UndoManage.getUndoableEditSupport().postEdit(edit);
}
 
}
 
public Rectangle bounds(Enumeration k) {
Rectangle r = ((Figure) k.nextElement()).displayBox();
while (k.hasMoreElements())
r.add(((Figure) k.nextElement()).displayBox());
return r;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
deleteSelection(m_Figures);
m_Drawing.checkDamage();
m_HasBeenDone = false;
 
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
Vector tempvector = m_Figures;
if (tempvector != null) {
if (tempvector.size() == 0)
return;
 
Rectangle r = bounds(tempvector.elements());
insertFigures(tempvector, m_Insertpoint.x - r.x, m_Insertpoint.y - r.y);
m_Drawing.checkDamage();
}
m_HasBeenDone = true;
}
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedBringToFrontCommand.java
New file
0,0 → 1,112
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import java.util.Vector;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.util.adv.AdvancedCommand;
 
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.framework.FigureEnumeration;
import CH.ifa.draw.standard.FigureEnumerator;
 
/**
* Brings the selected figures in the front of
* the other figures and Undo and Redo this action
*
* @see AdvancedSendToBackCommand
*/
public class AdvancedBringToFrontCommand extends AdvancedCommand {
 
private Vector m_IndexIntegers;
 
/**
* @param a_Name the name of the command
*/
public AdvancedBringToFrontCommand(String a_Name) {
super(a_Name);
}
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param a_Indexes the original positions of the figures
*/
private AdvancedBringToFrontCommand(String a_Name, AdvancedStandardDrawing a_Drawing,
Vector a_Indexes) {
super(a_Name, a_Drawing);
m_IndexIntegers = a_Indexes;
setSelectionZOrdered();
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
FigureEnumeration k = new FigureEnumerator(getView().selectionZOrdered());
Vector figurevector = new Vector();
Vector indexvector = new Vector();
UndoableEdit edit = new AdvancedBringToFrontCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing(), indexvector);
Figure tempFigure;
while (k.hasMoreElements()) {
tempFigure = k.nextFigure();
indexvector.add(new Integer((m_Drawing).getFigureIndex(tempFigure)));
figurevector.add(tempFigure);
m_Drawing.bringToFront(tempFigure);
}
m_Drawing.checkDamage();
UndoManage.getUndoableEditSupport().postEdit(edit);
}
 
public boolean isExecutable() {
return getView().selectionCount() > 0;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
for (int i = getSelectionZOrdered().size() - 1; i >= 0; i--) {
m_Drawing.bringToPosition((Figure) getSelectionZOrdered().get(i),
((Integer) m_IndexIntegers.get(i)).intValue());
}
m_Drawing.checkDamage();
m_HasBeenDone = false;
 
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
for (int i = 0; i < getSelectionZOrdered().size(); i++) {
(m_Drawing).bringToFront((Figure) getSelectionZOrdered().get(i));
}
m_Drawing.checkDamage();
m_HasBeenDone = true;
}
 
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedSendToBackCommand.java
New file
0,0 → 1,115
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import java.util.Vector;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.util.adv.AdvancedCommand;
 
import CH.ifa.draw.framework.Drawing;
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.framework.FigureEnumeration;
import CH.ifa.draw.standard.FigureEnumerator;
 
/**
* Sends the selected figures to the back of
* the other figures and Undo and Redo this action
*
* @see AdvancedBringToFrontCommand
*/
public class AdvancedSendToBackCommand extends AdvancedCommand {
 
Vector m_IndexIntegers;
 
/**
* @param a_Name the name of the command
*/
public AdvancedSendToBackCommand(String a_Name) {
super(a_Name);
}
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param a_Indexes the original positions of the figures
*/
public AdvancedSendToBackCommand(String a_Name, AdvancedStandardDrawing a_Drawing,
Vector a_Indexes) {
super(a_Name, a_Drawing);
m_IndexIntegers = a_Indexes;
setSelectionZOrdered();
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
FigureEnumeration k = new FigureEnumerator(getView().selectionZOrdered());
Vector figurevector = new Vector();
Vector indexvector = new Vector();
Figure tempFigure;
Drawing draw = m_Drawing;
UndoableEdit edit = new AdvancedSendToBackCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing(), indexvector);
while (k.hasMoreElements()) {
tempFigure = k.nextFigure();
indexvector.add(new Integer(((AdvancedStandardDrawing) draw).getFigureIndex(tempFigure)));
figurevector.add(tempFigure);
draw.sendToBack(tempFigure);
}
m_Drawing.checkDamage();
UndoManage.getUndoableEditSupport().postEdit(edit);
}
 
public boolean isExecutable() {
return getView().selectionCount() > 0;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
for (int i = getSelectionZOrdered().size() - 1; i >= 0; i--) {
((AdvancedStandardDrawing) m_Drawing).bringToPosition(
(Figure) getSelectionZOrdered().get(i),
((Integer) m_IndexIntegers.get(i)).intValue());
}
m_Drawing.checkDamage();
m_HasBeenDone = false;
 
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
for (int i = 0; i < getSelectionZOrdered().size(); i++) {
((AdvancedStandardDrawing) m_Drawing).sendToBack((Figure) getSelectionZOrdered().get(i));
}
m_Drawing.checkDamage();
m_HasBeenDone = true;
}
 
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedStandardDrawing.java
New file
0,0 → 1,158
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import java.awt.Dimension;
import java.awt.Rectangle;
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.bpel.figures.adv.DashedLineConnection;
import org.emaxx.bpeldesigner.bpel.framework.adv.PopupAble;
 
import CH.ifa.draw.figures.LineConnection;
import CH.ifa.draw.framework.Drawing;
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.framework.FigureEnumeration;
import CH.ifa.draw.standard.FigureEnumerator;
import CH.ifa.draw.standard.StandardDrawing;
import CH.ifa.draw.standard.StandardDrawingView;
 
/**
* Adds some functionality to StandardDrawing, like changing window size when figures don't fit in,
* (re)connection of LineConnections and DashedLineConnections, support for storing and restoring the
* depth position of figures
*
* @see Drawing
*/
 
public class AdvancedStandardDrawing extends StandardDrawing {
 
/**
* Constructs the Drawing.
*/
public AdvancedStandardDrawing() {
super();
}
 
/**
* Adds a figure to the list of figures. Initializes the
* the figure's container. Also connects the figure again if it is a LineConnection
*/
public Figure add(Figure figure) {
if (!fFigures.contains(figure)) {
fFigures.addElement(figure);
figure.addToContainer(this);
}
if (figure instanceof LineConnection) {
if (((LineConnection) figure).start() != null
&& ((LineConnection) figure).end() != null) {
((LineConnection) figure).connectStart(((LineConnection) figure).start());
((LineConnection) figure).connectEnd(((LineConnection) figure).end());
}
}
if (figure instanceof DashedLineConnection) {
if (((DashedLineConnection) figure).start() != null
&& ((DashedLineConnection) figure).end() != null) {
((DashedLineConnection) figure).connectStart(((DashedLineConnection) figure).start());
((DashedLineConnection) figure).connectEnd(((DashedLineConnection) figure).end());
}
}
if (figure instanceof PopupAble) {
((PopupAble) figure).addPopup();
}
return figure;
}
 
/**
* Checks the 'damage' on all it's DrawingViews
*/
public synchronized void checkDamage() {
Enumeration each = this.drawingChangeListeners();
while (each.hasMoreElements()) {
Object l = each.nextElement();
if (l instanceof StandardDrawingView) {
checkMinimumSize((StandardDrawingView) l);
((StandardDrawingView) l).repairDamage();
}
}
}
 
/**
* Checks the size of drawing and enlarges the view if the pictures don't fit in
* @param a_View the DrawingView
*/
public void checkMinimumSize(StandardDrawingView a_View) {
FigureEnumeration k = new FigureEnumerator(new Vector());
if (a_View.drawing() != null) {
k = a_View.drawing().figures();
} else {
k = new FigureEnumerator(new Vector());
}
Dimension d = new Dimension(0, 0);
while (k.hasMoreElements()) {
Rectangle r = k.nextFigure().displayBox();
d.width = Math.max(d.width, r.x + r.width);
d.height = Math.max(d.height, r.y + r.height);
}
if (a_View.getMinimumSize().height < d.height + 100) {
a_View.getMinimumSize().height = d.height + 300;
a_View.setSize(a_View.getMinimumSize());
}
if (a_View.getMinimumSize().width < d.width + 100) {
a_View.getMinimumSize().width = d.width + 300;
a_View.setSize(a_View.getMinimumSize());
}
}
 
/**
* Adds a vector of figures.
* @see #add
*/
public void addAll(Vector newFigures) {
Enumeration k = newFigures.elements();
while (k.hasMoreElements())
add((Figure) k.nextElement());
}
 
/**
* @param figure The figure from which you want the position of the drawing order
* @return the position of the drawing order
*/
public synchronized int getFigureIndex(Figure figure) {
return fFigures.indexOf(figure);
}
 
/**
* This function brings a figure to a certain position in the drawing
* order from back to front
* @param figure the figure that needs to be brought to
* @param index the position in the order from back to front
*/
public synchronized void bringToPosition(Figure figure, int index) {
if (fFigures.contains(figure)) {
fFigures.removeElement(figure);
fFigures.add(index, figure);
figure.changed();
}
}
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedCommandButtonListener.java
New file
0,0 → 1,58
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import org.emaxx.bpeldesigner.bpel.util.adv.AdvancedCommand;
 
import CH.ifa.draw.util.PaletteButton;
import CH.ifa.draw.util.PaletteListener;
 
/**
* This class listens to a AdvancedCommandButton and executes the AdvancedCommand when pressed
*/
public class AdvancedCommandButtonListener implements PaletteListener {
 
private AdvancedCommand m_AdvancedCommand;
 
/**
* Create an AdvancedCommandButtonListener with an AdvancedCommand
* @param a_AdvancedCommand The command to be executed when the button is pressed
*/
public AdvancedCommandButtonListener(AdvancedCommand a_AdvancedCommand) {
m_AdvancedCommand = a_AdvancedCommand;
}
 
/**
* The user selected a palette entry. The selected button is
* passed as an argument.
*/
public void paletteUserSelected(PaletteButton button) {
m_AdvancedCommand.execute();
}
 
/**
* The user moved the mouse over the palette entry.
*/
public void paletteUserOver(PaletteButton button, boolean inside) {
 
}
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedHierarchyUpCommand.java
New file
0,0 → 1,84
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
 
import org.emaxx.bpeldesigner.bpel.standard.BPELChangeScopeCommand;
import org.emaxx.bpeldesigner.bpel.standard.BPELDrawing;
import org.emaxx.bpeldesigner.bpel.standard.BPELFigureHolder;
 
/**
* Command to go one level up in BPEL hierarchy in the view
*/
public class AdvancedHierarchyUpCommand extends AdvancedFigureTransferCommand {
 
/**
* @param a_Name the name of the command
*/
public AdvancedHierarchyUpCommand(String a_Name) {
super(a_Name);
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
BPELFigureHolder l_Owner = null;
if (m_Drawing != null) {
l_Owner = ((BPELDrawing) m_Drawing).getOwner();
}
 
if (l_Owner != null) {
BPELFigureHolder l_BPELFigureHolder = ((BPELFigureHolder) l_Owner).getHolderParent();
if (l_BPELFigureHolder != null) {
BPELChangeScopeCommand l_Command = new BPELChangeScopeCommand("HierarchyUpCommand",
l_BPELFigureHolder);
l_Command.execute();
}
}
}
 
public boolean isExecutable() {
return getView().selectionCount() > 0;
}
 
public boolean canUndo() {
return false;
}
 
public boolean canRedo() {
return false;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
}
 
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedSelectionTool.java
New file
0,0 → 1,193
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import java.awt.Component;
import java.awt.Point;
import java.awt.event.MouseEvent;
 
import javax.swing.JPopupMenu;
 
import org.emaxx.bpeldesigner.bpel.framework.BPELView;
 
import CH.ifa.draw.contrib.PopupMenuFigureSelection;
import CH.ifa.draw.framework.DrawingView;
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.framework.Tool;
import CH.ifa.draw.standard.SelectionTool;
 
/**
* This tool is an enhancement of the SelectionTool,
* it has support for Undo/Redo the drag movement.
* @see SelectionTool
*/
public class AdvancedSelectionTool extends SelectionTool {
 
public AdvancedSelectionTool(DrawingView a_View) {
super(a_View);
}
 
/**
* Factory method to create a AdvancedDrag tracker. It is used to drag a figure.
*/
protected Tool createDragTracker(DrawingView a_View, Figure a_Figure) {
return new AdvancedDragTracker(a_View, a_Figure);
}
 
/**
* This method displays a popup menu, if there is one registered with the
* Figure (the Figure's attributes are queried for Figure.POPUP_MENU which
* is used to indicate an association of a popup menu with the Figure).
*
* @param figure Figure for which a popup menu should be displayed
* @param x x coordinate where the popup menu should be displayed
* @param y y coordinate where the popup menu should be displayed
* @param component Component which invoked the popup menu
*/
protected void showPopupMenu(Figure figure, int x, int y, Component comp) {
Object attribute = figure.getAttribute(Figure.POPUP_MENU);
if ((attribute != null) && (attribute instanceof JPopupMenu)) {
JPopupMenu popup = (JPopupMenu) attribute;
if (popup instanceof PopupMenuFigureSelection) {
((PopupMenuFigureSelection) popup).setSelectedFigure(figure);
}
if (comp instanceof BPELView) {
popup.setLocation(((BPELView) comp).lastClick());
}
// calculate offsets for internal MDI frames
Point newLocation = new Point(x, y);
adjustOffsets(comp.getParent(), newLocation);
newLocation.translate(comp.getLocation().x, comp.getLocation().y);
popup.setLocation(newLocation);
popup.setInvoker(comp);
popup.setVisible(true);
 
}
}
 
/**
* Internal MDI frames have offsets where a popup menu should be
* shown (in JDK 1.2).
* This method sums up iteratively all x and y offsets of all
* parent compontents until the top parent component is reached.
*/
private void adjustOffsets(Component comp, Point offsetPoint) {
if (comp != null) {
Point compLocation = comp.getLocation();
offsetPoint.translate(compLocation.x, compLocation.y);
adjustOffsets(comp.getParent(), offsetPoint);
}
}
 
/**
* Hook method which can be overriden by subclasses to provide
* specialised behaviour in the event of a popup trigger.
*/
protected void handlePopupMenu(MouseEvent e, int x, int y) {
Figure figure = drawing().findFigureInside(e.getX(), e.getY());
if (figure != null) {
Object attribute = figure.getAttribute(Figure.POPUP_MENU);
showPopupMenu(figure, e.getX(), e.getY(), e.getComponent());
}
}
 
/**
* MouseListener method for mouseDown events. If the popup trigger has been
* activated, then the appropriate hook method is called.
*
* @param e MouseEvent which should be interpreted
* @param x x coordinate of the MouseEvent
* @param y y coordinate of the MouseEvent
*/
public void mouseDown(MouseEvent e, int x, int y) {
// isPopupTrigger() at mouseDown() is only notified at UNIX systems
if (e.isPopupTrigger()) {
handlePopupMenu(e, x, y);
} else {
super.mouseDown(e, x, y);
handleMouseDown(e, x, y);
}
}
 
/**
* MouseListener method for mouseDrag events. Usually, mouse drags are
* ignored for popup menus or double clicks.
*
* @param e MouseEvent which should be interpreted
* @param x x coordinate of the MouseEvent
* @param y y coordinate of the MouseEvent
*/
public void mouseDrag(MouseEvent e, int x, int y) {
if (!e.isPopupTrigger()) {
super.mouseDrag(e, x, y);
}
}
 
/**
* MouseListener method for mouseUp events. Depending on the kind of event
* the appropriate hook method is called (popupMenuUp for popup trigger,
* doubleMouseClick for a double click, and mouseUp() and mouseClick() for
* normal mouse clicks).
*
* @param e MouseEvent which should be interpreted
* @param x x coordinate of the MouseEvent
* @param y y coordinate of the MouseEvent
*/
public void mouseUp(MouseEvent e, int x, int y) {
if (e.isPopupTrigger()) {
handlePopupMenu(e, x, y);
} else if (e.getClickCount() == 2) {
handleMouseDoubleClick(e, x, y);
} else {
super.mouseUp(e, x, y);
handleMouseUp(e, x, y);
handleMouseClick(e, x, y);
}
}
 
/**
* Hook method which can be overriden by subclasses to provide
* specialised behaviour in the event of a mouse down.
*/
protected void handleMouseDown(MouseEvent e, int x, int y) {
}
 
/**
* Hook method which can be overriden by subclasses to provide
* specialised behaviour in the event of a mouse up.
*/
protected void handleMouseUp(MouseEvent e, int x, int y) {
}
 
/**
* Hook method which can be overriden by subclasses to provide
* specialised behaviour in the event of a mouse click.
*/
protected void handleMouseClick(MouseEvent e, int x, int y) {
}
 
/**
* Hook method which can be overriden by subclasses to provide
* specialised behaviour in the event of a mouse double click.
*/
protected void handleMouseDoubleClick(MouseEvent e, int x, int y) {
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedFigureTransferCommand.java
New file
0,0 → 1,161
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import java.util.Vector;
 
import org.emaxx.bpeldesigner.bpel.figures.adv.DashedLineConnection;
import org.emaxx.bpeldesigner.bpel.util.adv.AdvancedCommand;
 
import CH.ifa.draw.figures.LineConnection;
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.framework.FigureEnumeration;
import CH.ifa.draw.framework.FigureSelection;
import CH.ifa.draw.standard.AbstractFigure;
import CH.ifa.draw.standard.FigureEnumerator;
import CH.ifa.draw.util.Clipboard;
 
/**
* Common base clase for commands that transfer figures
* between a drawing and the clipboard. Has supportmethods for Undo/Redo commands.
*/
public abstract class AdvancedFigureTransferCommand extends AdvancedCommand {
 
/**
* Constructs a drawing command.
* @param a_Name the command name
* @param a_Drawing the drawing that this command should be executed on
*/
public AdvancedFigureTransferCommand(String a_Name, AdvancedStandardDrawing a_Drawing) {
super(a_Name, a_Drawing);
}
 
/**
* @param a_Name the command name
*/
public AdvancedFigureTransferCommand(String a_Name) {
super(a_Name);
}
 
/**
* Deletes the current selection from the drawing.
*/
public void deleteSelection() {
m_Drawing.removeAll(getView().selection());
getView().clearSelection();
}
 
/**
* Deletes the selection from the drawing.
* @param a_Selection the selection of Figures to be deleted
*/
public void deleteSelection(Vector a_Selection) {
m_Drawing.removeAll(a_Selection);
getView().clearSelection();
}
 
/**
* Copies the current selection to the clipboard.
*/
public void copySelection() {
FigureSelection selection = getView().getFigureSelection();
Clipboard.getClipboard().setContents(selection);
}
 
/**
* Copies the current selection to the clipboard.
* @param a_Selection the selection of Figures to be copied to the clipboard
*/
public void copySelection(FigureSelection a_Selection) {
Clipboard.getClipboard().setContents(a_Selection);
}
 
/**
* Inserts a vector of figures and translates them by the
* given offset.
*/
public void insertFigures(Vector a_Figures, int dx, int dy) {
FigureEnumeration e = new FigureEnumerator(a_Figures);
while (e.hasMoreElements()) {
Figure figure = e.nextFigure();
figure.moveBy(dx, dy);
figure = m_Drawing.add(figure);
}
}
 
/**
* Saves lines that are deleted together with one of the objects to which they are connected
* @param a_FigureVector the (parent)Figures that are deleted
*/
public void saveLinesOfFigures(Vector a_FigureVector) {
if (a_FigureVector != null) {
for (int i = 0; i < a_FigureVector.size(); i++) {
Object temp = a_FigureVector.get(i);
if (temp instanceof AbstractFigure) {
((AbstractFigure) temp).saveLines();
}
}
}
return;
}
 
/**
* Restores lines that were deleted together with one of the objects to which they are connected
* @param a_FigureVector the (parent)Figures that were deleted
*/
public void reinsertLines(Vector a_FigureVector) {
for (int i = 0; i < a_FigureVector.size(); i++) {
Object temp = a_FigureVector.get(i);
if (temp instanceof AbstractFigure) {
Vector templines = ((AbstractFigure) temp).getLines();
if (!templines.isEmpty()) {
insertLineFigures(templines, 0, 0);
}
}
}
return;
}
 
/**
* Helps restoring deleted lines
* @param a_Figures The lines to be inserted again
* @param dx the x position
* @param dy the y position
*/
private void insertLineFigures(Vector a_Figures, int dx, int dy) {
FigureEnumeration e = new FigureEnumerator(a_Figures);
while (e.hasMoreElements()) {
Figure figure = e.nextFigure();
figure.moveBy(dx, dy);
if (figure instanceof LineConnection) {
((LineConnection) figure).connectStart(((LineConnection) figure).start());
((LineConnection) figure).connectEnd(((LineConnection) figure).end());
}
if (figure instanceof DashedLineConnection) {
((DashedLineConnection) figure).connectStart(((DashedLineConnection) figure).start());
((DashedLineConnection) figure).connectEnd(((DashedLineConnection) figure).end());
}
figure = m_Drawing.add(figure);
}
}
 
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedToggleGridCommand.java
New file
0,0 → 1,124
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import java.awt.Point;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.util.adv.AdvancedCommand;
 
import CH.ifa.draw.framework.PointConstrainer;
import CH.ifa.draw.standard.GridConstrainer;
 
/**
* A command to toggle the snap to grid behavior and Undo and Redo this action.
*/
public class AdvancedToggleGridCommand extends AdvancedCommand {
 
private Point m_Grid;
private Point m_OldGrid;
 
/**
* @param a_Name the command name
* @param a_Grid the grid size. A grid size of 1,1 turns grid snapping off.
*/
public AdvancedToggleGridCommand(String a_Name, Point a_Grid) {
super(a_Name);
if (a_Grid == null) {
m_Grid = null;
} else {
m_Grid = new Point(a_Grid.x, a_Grid.y);
}
}
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param a_Grid the new grid size
* @param a_OldGrid the old grid size
*/
private AdvancedToggleGridCommand(String a_Name, AdvancedStandardDrawing a_Drawing,
Point a_Grid, Point a_OldGrid) {
super(a_Name, a_Drawing);
if (a_Grid == null) {
m_Grid = null;
} else {
m_Grid = new Point(a_Grid.x, a_Grid.y);
}
if (a_OldGrid == null) {
m_OldGrid = null;
} else {
m_OldGrid = new Point(a_OldGrid.x, a_OldGrid.y);
}
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
PointConstrainer grid = getView().getConstrainer();
Point l_OldGrid = null;
if (grid != null) {
l_OldGrid = new Point(grid.getStepX(), grid.getStepY());
}
if (m_Grid == null) {
getView().setConstrainer(null);
} else {
getView().setConstrainer(new GridConstrainer(m_Grid.x, m_Grid.y));
}
 
UndoableEdit edit = new AdvancedToggleGridCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing(), m_Grid, l_OldGrid);
UndoManage.getUndoableEditSupport().postEdit(edit);
}
 
public boolean isExecutable() {
return getView() != null;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
if (m_OldGrid == null) {
getView().setConstrainer(null);
} else {
getView().setConstrainer(new GridConstrainer(m_OldGrid.x, m_OldGrid.y));
}
m_HasBeenDone = false;
 
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
if (m_Grid == null) {
getView().setConstrainer(null);
} else {
getView().setConstrainer(new GridConstrainer(m_Grid.x, m_Grid.y));
}
m_HasBeenDone = true;
}
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedRedoCommand.java
New file
0,0 → 1,71
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoManager;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.util.adv.AdvancedCommand;
 
/**
* Redo the command in the Undomanager
* @see UndoManage
*/
public class AdvancedRedoCommand extends AdvancedCommand {
 
UndoManager m_UndoManager;
 
/**
* @param a_Name the name of the command
*/
public AdvancedRedoCommand(String a_Name) {
super(a_Name);
m_UndoManager = UndoManage.getUndoManager();
}
 
public void execute() {
if (m_UndoManager.canRedo()) {
m_UndoManager.redo();
UndoManage.refreshUndoRedo();
}
}
 
public void undo() throws CannotUndoException {
}
 
public void redo() throws CannotRedoException {
}
 
public boolean canUndo() {
return false;
}
 
public boolean canRedo() {
return false;
}
 
public boolean isExecutable() {
return m_UndoManager.canRedo();
}
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedDragTracker.java
New file
0,0 → 1,83
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import java.awt.Point;
import java.awt.event.MouseEvent;
 
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
 
import CH.ifa.draw.framework.DrawingView;
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.standard.DragTracker;
import CH.ifa.draw.standard.SelectionTool;
 
/**
* DragTracker implements the dragging of the clicked
* figure. It posts an UndoableEdit to the UndoManager
* which keeps the original position when the dragging
* started and the position when the mousebutton was
* released again.
*
* @see SelectionTool
*/
public class AdvancedDragTracker extends DragTracker {
 
public Point m_OldPoint;
public boolean m_Dragged = false;
 
public AdvancedDragTracker(DrawingView view, Figure anchor) {
super(view, anchor);
}
 
public void mouseDown(MouseEvent e, int x, int y) {
super.mouseDown(e, x, y);
m_OldPoint = new Point(x, y);
m_Dragged = false;
}
 
public void mouseDrag(MouseEvent e, int x, int y) {
super.mouseDrag(e, x, y);
if ((Math.abs(x - fAnchorX) > 4) || (Math.abs(y - fAnchorY) > 4)) {
m_Dragged = true;
}
}
 
public void mouseUp(MouseEvent e, int x, int y) {
super.mouseUp(e, x, y);
Point l_NewPoint = new Point(x, y);
if (!l_NewPoint.equals(m_OldPoint) && m_Dragged) {
AdvancedMoveCommand l_Command = createMoveCommand(l_NewPoint);
UndoableEdit edit = l_Command;
l_Command.execute();
UndoManage.getUndoableEditSupport().postEdit(edit);
}
m_Dragged = false;
}
 
public AdvancedMoveCommand createMoveCommand(Point a_NewPoint) {
return new AdvancedMoveCommand("Move", (AdvancedStandardDrawing) editor().drawing(),
m_OldPoint, a_NewPoint);
}
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedCutCommand.java
New file
0,0 → 1,120
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import java.util.Vector;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
 
import CH.ifa.draw.framework.FigureSelection;
import CH.ifa.draw.standard.FigureEnumerator;
import CH.ifa.draw.util.Clipboard;
 
/**
* Delete the selection and move the selected figures to
* the clipboard and Undo and Redo this action
* @see Clipboard
*/
public class AdvancedCutCommand extends AdvancedFigureTransferCommand {
 
public Vector m_OldClipBoard;
public Vector m_NewClipBoard;
 
/**
* @param a_Name the name of the command
*/
public AdvancedCutCommand(String a_Name) {
super(a_Name);
}
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param figuresOld the old clipboard
* @param figuresNew the new clipboard
*/
public AdvancedCutCommand(String a_Name, AdvancedStandardDrawing a_Drawing, Vector figuresOld,
Vector figuresNew) {
super(a_Name, a_Drawing);
m_OldClipBoard = figuresOld;
m_NewClipBoard = figuresNew;
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
FigureSelection temp1 = (FigureSelection) Clipboard.getClipboard().getContents();
Vector tempvector = null;
if (temp1 != null) {
tempvector = (Vector) temp1.getData(FigureSelection.TYPE);
}
FigureEnumerator temp2 = (FigureEnumerator) getView().selectionElements();
Vector tempvector2 = new Vector();
while (temp2.hasMoreElements()) {
tempvector2.add(temp2.nextElement());
}
UndoableEdit edit = new AdvancedCutCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing(), tempvector, tempvector2);
copySelection();
saveLinesOfFigures(tempvector2);
deleteSelection();
m_Drawing.checkDamage();
UndoManage.getUndoableEditSupport().postEdit(edit);
}
 
public boolean isExecutable() {
return getView().selectionCount() > 0 && m_DrawApp.drawing() != null;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
if (m_NewClipBoard != null) {
if (m_NewClipBoard.size() == 0)
return;
 
getView().clearSelection();
insertFigures(m_NewClipBoard, 0, 0);
reinsertLines(m_NewClipBoard);
m_Drawing.checkDamage();
}
if (m_OldClipBoard != null) {
copySelection(new FigureSelection(m_OldClipBoard));
}
m_HasBeenDone = false;
 
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
copySelection(new FigureSelection(m_NewClipBoard));
deleteSelection(m_NewClipBoard);
m_Drawing.checkDamage();
m_HasBeenDone = true;
}
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedDeleteCommand.java
New file
0,0 → 1,100
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import java.util.Vector;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
 
import CH.ifa.draw.framework.FigureSelection;
 
/**
* Delete the selection and Undo and Redo this action
*/
public class AdvancedDeleteCommand extends AdvancedFigureTransferCommand {
 
/**
* @param a_Name the name of the command
*/
public AdvancedDeleteCommand(String a_Name) {
super(a_Name);
}
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
*/
public AdvancedDeleteCommand(String name, AdvancedStandardDrawing a_Drawing) {
super(name, a_Drawing);
setSelectionZOrdered();
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
FigureSelection selection = getView().getFigureSelection();
Vector tempvector = getView().selectionZOrdered();
saveLinesOfFigures(tempvector);
UndoableEdit edit = new AdvancedDeleteCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing());
deleteSelection();
m_Drawing.checkDamage();
UndoManage.getUndoableEditSupport().postEdit(edit);
}
 
public boolean isExecutable() {
return getView().selectionCount() > 0;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
if (getSelectionZOrdered() != null) {
if (getSelectionZOrdered().size() == 0)
return;
getView().clearSelection();
insertFigures(getSelectionZOrdered(), 0, 0);
reinsertLines(getSelectionZOrdered());
 
m_Drawing.checkDamage();
}
m_HasBeenDone = false;
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
deleteSelection(getSelectionZOrdered());
m_Drawing.checkDamage();
m_HasBeenDone = true;
}
 
public boolean canRedo() {
return (super.canRedo() && (m_Drawing != null));
}
 
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedInsertCommand.java
New file
0,0 → 1,107
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import java.util.Vector;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
 
import CH.ifa.draw.framework.Figure;
 
/**
* Insert a figure or a Vector of figures and Undo and Redo this action
*/
public class AdvancedInsertCommand extends AdvancedFigureTransferCommand {
 
public Vector m_Figures;
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param a_Figure the figure that needs to be inserted
*/
public AdvancedInsertCommand(String a_Name, AdvancedStandardDrawing a_Drawing, Figure a_Figure) {
super(a_Name, a_Drawing);
m_Figures = new Vector();
m_Figures.add(a_Figure);
}
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param a_Figures the figures that need to be inserted
*/
public AdvancedInsertCommand(String a_Name, AdvancedStandardDrawing a_Drawing, Vector a_Figures) {
super(a_Name, a_Drawing);
m_Figures = a_Figures;
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
if (m_Figures != null) {
UndoableEdit edit = new AdvancedInsertCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing(), m_Figures);
if (m_Figures.size() == 0)
return;
getView().clearSelection();
insertFigures(m_Figures, 0, 0);
m_Drawing.checkDamage();
UndoManage.getUndoableEditSupport().postEdit(edit);
}
}
 
public boolean isExecutable() {
return getView().selectionCount() > 0;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
deleteSelection(m_Figures);
m_Drawing.checkDamage();
m_HasBeenDone = false;
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
if (m_Figures != null) {
if (m_Figures.size() == 0)
return;
getView().clearSelection();
insertFigures(m_Figures, 0, 0);
m_Drawing.checkDamage();
}
m_HasBeenDone = true;
}
 
public boolean canRedo() {
return (super.canRedo() && (m_Drawing != null));
}
 
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedUndoCommand.java
New file
0,0 → 1,69
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import javax.swing.undo.UndoManager;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.util.adv.AdvancedCommand;
 
import CH.ifa.draw.framework.Drawing;
 
/**
* Undo the command in the Undomanager
* @see UndoManage
*/
public class AdvancedUndoCommand extends AdvancedCommand {
 
UndoManager m_UndoManager;
 
/**
* @param a_Name the name of the command
*/
public AdvancedUndoCommand(String a_Name) {
super(a_Name);
m_UndoManager = UndoManage.getUndoManager();
}
 
public void execute() {
if (m_UndoManager.canUndo()) {
m_UndoManager.undo();
UndoManage.refreshUndoRedo();
Drawing l_Drawing = m_DrawApp.drawing();
if (l_Drawing instanceof AdvancedStandardDrawing) {
((AdvancedStandardDrawing) l_Drawing).checkDamage();
}
}
}
 
public boolean canUndo() {
return false;
}
 
public boolean canRedo() {
return false;
}
 
public boolean isExecutable() {
return m_UndoManager.canUndo();
}
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/adv/AdvancedMoveCommand.java
New file
0,0 → 1,116
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard.adv;
 
import java.awt.Point;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.util.adv.AdvancedCommand;
 
import CH.ifa.draw.framework.FigureEnumeration;
import CH.ifa.draw.standard.FigureEnumerator;
 
/**
* Moves the selected figures and Undo and Redo this action
*
*/
public class AdvancedMoveCommand extends AdvancedCommand {
 
public Point m_OldPoint;
public Point m_NewPoint;
 
/**
* @param a_Name the name of the command
* @param a_OldPoint old Position
* @param a_NewPoint new Position
*/
public AdvancedMoveCommand(String a_Name, Point a_OldPoint, Point a_NewPoint) {
super(a_Name);
m_OldPoint = a_OldPoint;
m_NewPoint = a_NewPoint;
}
 
/**
* This constructor can be used if the first execute wont be used but Undo/Redo functionality is needed
* Movement is calculated by moving the selection
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param a_OldPoint old Position
* @param a_NewPoint new Position
*/
public AdvancedMoveCommand(String a_Name, AdvancedStandardDrawing a_Drawing, Point a_OldPoint,
Point a_NewPoint) {
super(a_Name, a_Drawing);
setSelectionZOrdered();
m_OldPoint = a_OldPoint;
m_NewPoint = a_NewPoint;
}
 
public void execute() {
if (m_OldPoint != null && m_NewPoint != null) {
setSelectionZOrdered();
UndoableEdit edit = new AdvancedMoveCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing(), m_OldPoint, m_NewPoint);
FigureEnumeration l_Figures = new FigureEnumerator(getSelectionZOrdered());
while (l_Figures.hasMoreElements()) {
l_Figures.nextFigure().moveBy(m_NewPoint.x - m_OldPoint.x,
m_NewPoint.y - m_OldPoint.y);
}
m_Drawing.checkDamage();
UndoManage.getUndoableEditSupport().postEdit(edit);
}
}
 
public boolean isExecutable() {
return getView().selectionCount() > 0;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
FigureEnumeration l_Figures = new FigureEnumerator(getSelectionZOrdered());
while (l_Figures.hasMoreElements()) {
l_Figures.nextFigure().moveBy(m_OldPoint.x - m_NewPoint.x, m_OldPoint.y - m_NewPoint.y);
}
m_Drawing.checkDamage();
m_HasBeenDone = false;
 
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
FigureEnumeration l_Figures = new FigureEnumerator(getSelectionZOrdered());
while (l_Figures.hasMoreElements()) {
l_Figures.nextFigure().moveBy(m_NewPoint.x - m_OldPoint.x, m_NewPoint.y - m_OldPoint.y);
}
m_Drawing.checkDamage();
m_HasBeenDone = true;
}
 
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELDragTracker.java
New file
0,0 → 1,53
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import java.awt.Point;
 
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedDragTracker;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedMoveCommand;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedStandardDrawing;
 
import CH.ifa.draw.framework.DrawingView;
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.standard.SelectionTool;
 
/**
* DragTracker implements the dragging of the clicked
* figure. It posts an UndoableEdit to the UndoManager
* which keeps the original position when the dragging
* started and the position when the mousebutton was
* released again.
*
* @see SelectionTool
*/
public class BPELDragTracker extends AdvancedDragTracker {
 
public BPELDragTracker(DrawingView view, Figure anchor) {
super(view, anchor);
}
 
public AdvancedMoveCommand createMoveCommand(Point a_NewPoint) {
return new BPELMoveCommand("Move", (AdvancedStandardDrawing) editor().drawing(),
m_OldPoint, a_NewPoint);
}
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELCutCommand.java
New file
0,0 → 1,173
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import java.awt.Point;
import java.util.Enumeration;
import java.util.Vector;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.ActivityGroup;
import org.emaxx.bpeldesigner.bpel.figures.BPELSequenceFigure;
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedCutCommand;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedStandardDrawing;
 
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.util.Clipboard;
 
/**
* Delete the selection and move the selected figures to
* the clipboard and Undo and Redo this action
* @see Clipboard
*/
public class BPELCutCommand extends AdvancedCutCommand {
 
public Vector m_CutSelection;
 
/**
* @param a_Name the name of the command
*/
public BPELCutCommand(String a_Name) {
super(a_Name);
}
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param figuresOld the old clipboard
* @param figuresNew the new clipboard
*/
public BPELCutCommand(String a_Name, AdvancedStandardDrawing a_Drawing, Vector a_OldClipboard,
Vector a_NewClipboard, Vector a_CutSelection) {
super(a_Name, a_Drawing, a_OldClipboard, a_NewClipboard);
m_CutSelection = a_CutSelection;
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
setSelectionZOrdered();
Vector l_VectorOld = (Vector) Clipboard.getClipboard().getContents();
getView().clearSelection();
saveLinesOfFigures(getSelectionZOrdered());
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
Vector l_Figures = new Vector();
Enumeration l_Enum = getSelectionZOrdered().elements();
Vector l_Vector = new Vector();
while (l_Enum.hasMoreElements()) {
Figure l_Figure = (Figure) l_Enum.nextElement();
if (((BPELDrawing) m_Drawing).getOwner().removeFromScope(l_Figure)) {
if (l_Figure instanceof BPELFigureHolder) {
BPELFigureHolder l_HolderParent;
if (((BPELFigureHolder) l_Figure).getHolderParent() instanceof BPELSequenceFigure) {
l_HolderParent = ((BPELFigureHolder) l_Figure).getHolderParent();
if (l_Figure instanceof ActivityGroup) {
ActivityGroup l_ActivityGroup = (ActivityGroup) l_Figure;
int l_Position = ((BPELSequenceFigure) l_HolderParent).getSequence().getActivityGroupPosition(
l_ActivityGroup);
}
}
 
}
m_Drawing.remove(l_Figure);
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(
new Point(0, 0), new Point(0, 0));
}
l_Figures.add(l_Figure);
l_Vector.add(l_Figure.clone());
}
}
if (l_Figures.size() > 0) {
UndoableEdit edit = new BPELCutCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing(), l_VectorOld, l_Vector,
l_Figures);
UndoManage.getUndoableEditSupport().postEdit(edit);
Clipboard.getClipboard().setContents(l_Vector);
}
}
}
m_Drawing.checkDamage();
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
if (m_CutSelection != null) {
if (m_CutSelection.size() == 0)
return;
getView().clearSelection();
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
Enumeration l_Enum = m_CutSelection.elements();
Vector l_Vector = new Vector();
while (l_Enum.hasMoreElements()) {
Figure l_Figure = (Figure) l_Enum.nextElement();
boolean l_Possible = ((BPELDrawing) m_Drawing).getOwner().addToScope(
l_Figure);
if (l_Possible) {
m_Drawing.add(l_Figure);
l_Vector.add(l_Figure);
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(
new Point(0, 0), new Point(0, 0));
}
}
}
reinsertLines(l_Vector);
}
}
m_Drawing.checkDamage();
}
Clipboard.getClipboard().setContents(m_OldClipBoard);
m_HasBeenDone = false;
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
Clipboard.getClipboard().setContents(m_NewClipBoard);
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
Enumeration l_Enum = m_CutSelection.elements();
while (l_Enum.hasMoreElements()) {
Figure l_Figure = (Figure) l_Enum.nextElement();
if (((BPELDrawing) m_Drawing).getOwner().removeFromScope(l_Figure)) {
m_Drawing.remove(l_Figure);
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(
new Point(0, 0), new Point(0, 0));
}
}
}
}
m_Drawing.checkDamage();
}
m_HasBeenDone = true;
}
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELDrawing.java
New file
0,0 → 1,138
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import org.emaxx.bpeldesigner.bpel.BPELDocument;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedStandardDrawing;
 
import CH.ifa.draw.framework.Drawing;
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.framework.FigureEnumeration;
 
/**
* The BPEL implementation of the Drawing interface.
* A BPELDrawing holds a reference to the top node element, the BPELDocument
* It holds also its owner, a BPELFigureHolder
* @see Drawing
*/
 
public class BPELDrawing extends AdvancedStandardDrawing {
 
private BPELDocument m_Root = null;
private BPELFigureHolder m_Owner = null;
 
/**
* Constructs the BPELDrawing.
*/
public BPELDrawing() {
super();
}
 
/**
* Due to problems with serializing Popups, Popups need to be added manually. This method
* adds Popups to an element and all its children.
*/
public void addPopupToChildren() {
FigureEnumeration l_Enum = figures();
while (l_Enum.hasMoreElements()) {
Figure l_Figure = l_Enum.nextFigure();
if (l_Figure instanceof BPELFigureHolder) {
((BPELFigureHolder) l_Figure).addPopup();
if (((BPELFigureHolder) l_Figure).getBPELDrawing() != null) {
((BPELFigureHolder) l_Figure).getBPELDrawing().addPopupToChildren();
}
}
}
}
 
/**
* Due to problems with serializing Listeners, Listeners need to be added manually. This method
* adds Popups to an element and all its children.
*/
public void addListenersToChildren() {
FigureEnumeration l_Enum = figures();
while (l_Enum.hasMoreElements()) {
Figure l_Figure = l_Enum.nextFigure();
l_Figure.addToContainer(this);
if (l_Figure instanceof BPELFigureHolder) {
if (((BPELFigureHolder) l_Figure).getBPELDrawing() != null) {
((BPELFigureHolder) l_Figure).getBPELDrawing().addListenersToChildren();
}
}
}
}
 
/**
* This method adds a figure to the Drawing and sets the HolderParent attribute of the figure
* @param the figure to be added
*/
public Figure add(Figure figure) {
if (figure instanceof BPELFigureHolder) {
BPELFigureHolder l_BPELFigure = (BPELFigureHolder) figure;
l_BPELFigure.setHolderParent(this.getOwner());
}
Figure l_Figure = super.add(figure);
return figure;
}
 
/**
* @return the top node element which is a BPELDocument
*/
public BPELDocument getRootDocument() {
return m_Root;
}
 
/**
* Set the top node element which is a BPELDocument
* @param a_Root The top node BPELDocument
*/
public void setRootDocument(BPELDocument a_Root) {
m_Root = a_Root;
}
 
/**
* Constructs a BPELDrawing
* @param a_Owner The owner of this drawing
* @param a_Root The top node element (BPELDocument)
*/
public BPELDrawing(BPELFigureHolder a_Owner, BPELDocument a_Root) {
super();
m_Root = a_Root;
m_Owner = a_Owner;
}
 
/**
* returns the owner of this Drawing
* @return the owner of this Drawing
*/
public synchronized BPELFigureHolder getOwner() {
return m_Owner;
}
 
/**
* sets the owner of this Drawing
* @param a_Owner the owner of this drawing
*/
public synchronized void setOwner(BPELFigureHolder a_Owner) {
m_Owner = a_Owner;
return;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELViewDepthCommand.java
New file
0,0 → 1,139
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import java.awt.Point;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.figures.BPELFigure;
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedStandardDrawing;
import org.emaxx.bpeldesigner.bpel.util.adv.AdvancedCommand;
 
/**
* Change the Viewing Depth of a figure and Undo and Redo this action
*/
public class BPELViewDepthCommand extends AdvancedCommand {
 
private int m_NewDepth;
private int m_OldDepth;
private BPELFigure m_Figure;
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param a_NewDepth the viewing depth of the figure, -1 is infinite, 1 is only the figure itself
* @param a_OldDepth the viewing depth of the figure, -1 is infinite, 1 is only the figure itself
* @param a_Figure the figure involved
*/
public BPELViewDepthCommand(String a_Name, AdvancedStandardDrawing a_Drawing, int a_NewDepth,
int a_OldDepth, BPELFigure a_Figure) {
super(a_Name, a_Drawing);
setSelectionZOrdered();
m_Figure = a_Figure;
m_NewDepth = a_NewDepth;
m_OldDepth = a_OldDepth;
}
 
/**
* @param a_Name the name of the command
* @param a_NewDepth the viewing depth of the figure, -1 is infinite, 1 is only the figure itself
* @param a_Figure the figure involved
*/
public BPELViewDepthCommand(String a_Name, int a_NewDepth, BPELFigure a_Figure) {
super(a_Name);
m_Figure = a_Figure;
m_NewDepth = a_NewDepth;
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
if (m_NewDepth >= -1 && m_NewDepth != 0) {
this.setSelectionZOrdered();
getView().clearSelection();
UndoableEdit edit = new BPELViewDepthCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing(), m_NewDepth, m_Figure.getLevels(),
m_Figure);
m_Figure.setLevels(m_NewDepth);
m_Figure.setCurrentLevels(m_NewDepth);
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(new Point(0, 0),
new Point(0, 0));
}
}
UndoManage.getUndoableEditSupport().postEdit(edit);
m_Drawing.checkDamage();
}
}
 
public boolean isExecutable() {
return getView().selectionCount() > 0;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
if (m_OldDepth >= -1 && m_OldDepth != 0) {
this.setSelectionZOrdered();
getView().clearSelection();
m_Figure.setLevels(m_OldDepth);
m_Figure.setCurrentLevels(m_OldDepth);
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(new Point(0, 0),
new Point(0, 0));
}
}
m_Drawing.checkDamage();
}
m_HasBeenDone = false;
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
if (m_NewDepth >= -1 && m_NewDepth != 0) {
this.setSelectionZOrdered();
getView().clearSelection();
m_Figure.setLevels(m_NewDepth);
m_Figure.setCurrentLevels(m_NewDepth);
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(new Point(0, 0),
new Point(0, 0));
}
}
m_Drawing.checkDamage();
}
m_HasBeenDone = true;
}
 
public boolean canRedo() {
return (super.canRedo() && (m_Drawing != null));
}
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELDialogCommand.java
New file
0,0 → 1,96
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import java.awt.BorderLayout;
 
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
 
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedStandardDrawing;
import org.emaxx.bpeldesigner.bpel.util.adv.AdvancedCommand;
import org.emaxx.bpeldesigner.input.TabbedDialog;
 
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.util.Clipboard;
 
/**
* open the Dialog for a BPEL figure
* @see Clipboard
*/
public class BPELDialogCommand extends AdvancedCommand {
 
public Figure m_Figure;
 
/**
* @param a_Name the command name
* @param a_Figure the figure which needs to show the dialog
*/
public BPELDialogCommand(String a_Name, Figure a_Figure) {
super(a_Name);
m_Figure = a_Figure;
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
if (m_Figure instanceof BPELFigureHolder) {
TabbedDialog l_TabbedDialog = ((BPELFigureHolder) m_Figure).getPanel();
if (l_TabbedDialog != null) {
l_TabbedDialog.initialize();
JDialog l_JDialog = new JDialog((JFrame) null,
((BPELFigureHolder) m_Figure).getHierarchyName(), true);
l_JDialog.setResizable(false);
l_JDialog.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
l_JDialog.getContentPane().add(l_TabbedDialog, BorderLayout.CENTER);
l_JDialog.pack();
l_JDialog.setVisible(true);
}
}
}
 
public boolean isExecutable() {
return getView().selectionCount() > 0;
}
 
public boolean canUndo() {
return false;
}
 
public boolean canRedo() {
return false;
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
}
 
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELDeleteCommand.java
New file
0,0 → 1,161
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import java.awt.Point;
import java.util.Enumeration;
import java.util.Vector;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.ActivityGroup;
import org.emaxx.bpeldesigner.bpel.figures.BPELSequenceFigure;
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedDeleteCommand;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedStandardDrawing;
 
import CH.ifa.draw.framework.Figure;
 
/**
* Delete the selection and Undo and Redo this action
*/
public class BPELDeleteCommand extends AdvancedDeleteCommand {
 
public Vector m_Figures;
 
/**
* @param a_Name the name of the command
*/
public BPELDeleteCommand(String a_Name) {
super(a_Name);
}
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
*/
public BPELDeleteCommand(String name, AdvancedStandardDrawing a_Drawing, Vector a_Figures) {
super(name, a_Drawing);
m_Figures = a_Figures;
}
 
public void execute() {
 
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
setSelectionZOrdered();
getView().clearSelection();
saveLinesOfFigures(getSelectionZOrdered());
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
Vector l_Figures = new Vector();
Enumeration l_Enum = getSelectionZOrdered().elements();
while (l_Enum.hasMoreElements()) {
Figure l_Figure = (Figure) l_Enum.nextElement();
if (((BPELDrawing) m_Drawing).getOwner().removeFromScope(l_Figure)) {
if (l_Figure instanceof BPELFigureHolder) {
BPELFigureHolder l_HolderParent;
if (((BPELFigureHolder) l_Figure).getHolderParent() instanceof BPELSequenceFigure) {
l_HolderParent = ((BPELFigureHolder) l_Figure).getHolderParent();
if (l_Figure instanceof ActivityGroup) {
ActivityGroup l_ActivityGroup = (ActivityGroup) l_Figure;
int l_Position = ((BPELSequenceFigure) l_HolderParent).getSequence().getActivityGroupPosition(
l_ActivityGroup);
}
}
 
}
m_Drawing.remove(l_Figure);
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(
new Point(0, 0), new Point(0, 0));
}
l_Figures.add(l_Figure);
}
}
if (l_Figures.size() > 0) {
UndoableEdit edit = new BPELDeleteCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing(), l_Figures);
UndoManage.getUndoableEditSupport().postEdit(edit);
}
}
}
m_Drawing.checkDamage();
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
if (m_Figures != null) {
if (m_Figures.size() == 0)
return;
getView().clearSelection();
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
Enumeration l_Enum = m_Figures.elements();
Vector l_Vector = new Vector();
while (l_Enum.hasMoreElements()) {
Figure l_Figure = (Figure) l_Enum.nextElement();
boolean l_Possible = ((BPELDrawing) m_Drawing).getOwner().addToScope(
l_Figure);
if (l_Possible) {
m_Drawing.add(l_Figure);
l_Vector.add(l_Figure);
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(
new Point(0, 0), new Point(0, 0));
}
}
}
reinsertLines(l_Vector);
}
}
m_Drawing.checkDamage();
}
m_HasBeenDone = false;
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
Enumeration l_Enum = m_Figures.elements();
while (l_Enum.hasMoreElements()) {
Figure l_Figure = (Figure) l_Enum.nextElement();
if (((BPELDrawing) m_Drawing).getOwner().removeFromScope(l_Figure)) {
m_Drawing.remove(l_Figure);
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(
new Point(0, 0), new Point(0, 0));
}
}
}
}
m_Drawing.checkDamage();
}
m_HasBeenDone = true;
}
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELCreationTool.java
New file
0,0 → 1,84
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
 
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedStandardDrawing;
 
import CH.ifa.draw.framework.DrawingView;
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.standard.CreationTool;
 
/**
* This tool is used for 'dropping' the selected BPEL-element in the BPELTool window into the drawing
* A prototype will be cloned and inserted
*/
public class BPELCreationTool extends CreationTool {
 
/**
* Create an instance and set the prototype
* @param view The view needed for AbstractTool
* @param prototype The prototype figure that needs to be cloned when inserted into the Drawing
*/
public BPELCreationTool(DrawingView view, Figure prototype) {
super(view, prototype);
}
 
/**
* If the pressed figure is a TextHolder it can be edited otherwise
* a new text figure is created.
*/
public void mouseDown(MouseEvent e, int x, int y) {
BPELFigureHolder l_BPELFigureHolder = null;
 
Figure pressedFigure = drawing().findFigureInside(x, y);
if (pressedFigure instanceof BPELFigureHolder) {
l_BPELFigureHolder = (BPELFigureHolder) pressedFigure;
if (!l_BPELFigureHolder.acceptsHolding(null))
l_BPELFigureHolder = null;
else {
}
}
Point fAnchorPoint = new Point(x, y);
Figure fCreatedFigure = createFigure();
Rectangle l_DisplayBox = fCreatedFigure.displayBox();
int l_Height = (int) l_DisplayBox.getHeight();
int l_Width = (int) l_DisplayBox.getWidth();
Point cornerpoint = new Point(l_Width, l_Height);
cornerpoint.translate(fAnchorPoint.x, fAnchorPoint.y);
fCreatedFigure.displayBox(fAnchorPoint, cornerpoint);
BPELInsertCommand l_Command = new BPELInsertCommand("Insert Figure",
(AdvancedStandardDrawing) drawing(), fCreatedFigure);
l_Command.execute();
editor().toolDone();
}
 
public void mouseDrag(MouseEvent e, int x, int y) {
}
 
public void mouseUp(MouseEvent e, int x, int y) {
}
 
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELInsertCommand.java
New file
0,0 → 1,146
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import java.awt.Point;
import java.util.Enumeration;
import java.util.Vector;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedInsertCommand;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedStandardDrawing;
 
import CH.ifa.draw.framework.Figure;
 
/**
* Insert a figure or a Vector of figures and Undo and Redo this action
*/
public class BPELInsertCommand extends AdvancedInsertCommand {
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param a_Figure the figure that needs to be inserted
*/
public BPELInsertCommand(String a_Name, AdvancedStandardDrawing a_Drawing, Figure a_Figure) {
super(a_Name, a_Drawing, a_Figure);
}
 
/**
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param a_Figures the figures that need to be inserted
*/
public BPELInsertCommand(String a_Name, AdvancedStandardDrawing a_Drawing, Vector a_Figures) {
super(a_Name, a_Drawing, a_Figures);
}
 
public void execute() {
m_Drawing = (AdvancedStandardDrawing) m_DrawApp.drawing();
if (m_Figures != null) {
Vector l_Figures = new Vector();
if (m_Figures.size() == 0)
return;
getView().clearSelection();
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
Enumeration l_Enum = m_Figures.elements();
while (l_Enum.hasMoreElements()) {
Figure l_Figure = (Figure) l_Enum.nextElement();
boolean l_Possible = ((BPELDrawing) m_Drawing).getOwner().addToScope(
l_Figure);
if (l_Possible) {
m_Drawing.add(l_Figure);
l_Figures.add(l_Figure);
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(
new Point(0, 0), new Point(0, 0));
}
}
}
}
}
if (l_Figures.size() > 0) {
UndoableEdit edit = new BPELInsertCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing(), l_Figures);
UndoManage.getUndoableEditSupport().postEdit(edit);
}
m_Drawing.checkDamage();
 
}
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
Enumeration l_Enum = m_Figures.elements();
while (l_Enum.hasMoreElements()) {
Figure l_Figure = (Figure) l_Enum.nextElement();
if (((BPELDrawing) m_Drawing).getOwner().removeFromScope(l_Figure)) {
if (m_DrawApp.view() != null) {
m_DrawApp.view().clearSelection();
}
m_Drawing.remove(l_Figure);
}
}
}
m_Drawing.checkDamage();
}
m_HasBeenDone = false;
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
if (m_Figures != null) {
if (m_Figures.size() == 0) {
return;
}
if (m_Drawing instanceof BPELDrawing) {
if (((BPELDrawing) m_Drawing).getOwner() != null) {
Enumeration l_Enum = m_Figures.elements();
while (l_Enum.hasMoreElements()) {
Figure l_Figure = (Figure) l_Enum.nextElement();
boolean l_Possible = ((BPELDrawing) m_Drawing).getOwner().addToScope(
l_Figure);
if (l_Possible) {
m_Drawing.add(l_Figure);
if (((BPELDrawing) m_Drawing).getOwner() != null) {
((BPELDrawing) m_Drawing).getOwner().getBPELLayouter().layout(
new Point(0, 0), new Point(0, 0));
}
}
}
}
}
m_Drawing.checkDamage();
}
m_HasBeenDone = true;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/standard/BPELMoveCommand.java
New file
0,0 → 1,129
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel.standard;
 
import java.awt.Point;
 
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
 
import org.emaxx.bpeldesigner.bpel.figures.BPELActivityFigure;
import org.emaxx.bpeldesigner.bpel.figures.BPELSequenceFigure;
import org.emaxx.bpeldesigner.bpel.framework.adv.UndoManage;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedMoveCommand;
import org.emaxx.bpeldesigner.bpel.standard.adv.AdvancedStandardDrawing;
 
import CH.ifa.draw.framework.Figure;
import CH.ifa.draw.framework.FigureEnumeration;
import CH.ifa.draw.standard.FigureEnumerator;
 
/**
* Moves the selected figures and Undo and Redo this action
*
*/
public class BPELMoveCommand extends AdvancedMoveCommand {
 
/**
* @param a_Name the name of the command
* @param a_OldPoint old Position
* @param a_NewPoint new Position
*/
public BPELMoveCommand(String a_Name, Point a_OldPoint, Point a_NewPoint) {
super(a_Name, a_OldPoint, a_NewPoint);
}
 
/**
* This constructor can be used if the first execute wont be used but Undo/Redo functionality is needed
* Movement is calculated by moving the selection
* @param a_Name the name of the command
* @param a_Drawing the drawing that this command should be executed on
* @param a_OldPoint old Position
* @param a_NewPoint new Position
*/
public BPELMoveCommand(String a_Name, AdvancedStandardDrawing a_Drawing, Point a_OldPoint,
Point a_NewPoint) {
super(a_Name, a_Drawing, a_OldPoint, a_NewPoint);
}
 
public void execute() {
if (m_OldPoint != null && m_NewPoint != null) {
setSelectionZOrdered();
UndoableEdit edit = new BPELMoveCommand(this.getPresentationName(),
(AdvancedStandardDrawing) m_DrawApp.drawing(), m_OldPoint, m_NewPoint);
FigureEnumeration l_Figures = new FigureEnumerator(getSelectionZOrdered());
while (l_Figures.hasMoreElements()) {
Figure l_Figure = l_Figures.nextFigure();
if (l_Figure instanceof BPELActivityFigure) {
BPELFigureHolder l_BPELFigureHolder = ((BPELActivityFigure) l_Figure).getHolderParent();
if (l_BPELFigureHolder instanceof BPELSequenceFigure) {
l_BPELFigureHolder.getBPELLayouter().layout(new Point(0, 0),
new Point(0, 0));
}
}
 
}
m_Drawing.checkDamage();
UndoManage.getUndoableEditSupport().postEdit(edit);
}
}
 
public void undo() throws CannotUndoException {
if (!canUndo()) {
throw new CannotUndoException();
}
FigureEnumeration l_Figures = new FigureEnumerator(getSelectionZOrdered());
while (l_Figures.hasMoreElements()) {
Figure l_Figure = l_Figures.nextFigure();
l_Figure.moveBy(m_OldPoint.x - m_NewPoint.x, m_OldPoint.y - m_NewPoint.y);
if (l_Figure instanceof BPELActivityFigure) {
BPELFigureHolder l_BPELFigureHolder = ((BPELActivityFigure) l_Figure).getHolderParent();
if (l_BPELFigureHolder instanceof BPELSequenceFigure) {
l_BPELFigureHolder.getBPELLayouter().layout(new Point(0, 0), new Point(0, 0));
}
}
 
}
m_Drawing.checkDamage();
m_HasBeenDone = false;
}
 
public void redo() throws CannotUndoException {
if (!canRedo()) {
throw new CannotRedoException();
}
FigureEnumeration l_Figures = new FigureEnumerator(getSelectionZOrdered());
while (l_Figures.hasMoreElements()) {
Figure l_Figure = l_Figures.nextFigure();
l_Figure.moveBy(m_NewPoint.x - m_OldPoint.x, m_NewPoint.y - m_OldPoint.y);
if (l_Figure instanceof BPELActivityFigure) {
BPELFigureHolder l_BPELFigureHolder = ((BPELActivityFigure) l_Figure).getHolderParent();
if (l_BPELFigureHolder instanceof BPELSequenceFigure) {
l_BPELFigureHolder.getBPELLayouter().layout(new Point(0, 0), new Point(0, 0));
}
}
}
m_Drawing.checkDamage();
m_HasBeenDone = true;
}
 
}
 
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Correlation.java
New file
0,0 → 1,190
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Vector;
 
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.EditPanelHolder;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.emaxx.bpeldesigner.input.Tableable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
 
/**
* Represents the BPEL Correlation element, BPEL Correlation Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class Correlation extends ExtensibleElements implements EditPanelHolder, Tableable {
 
private NCName m_Set = new NCName();
private BPBoolean m_Initiate = new BPBoolean("no");
 
public Correlation() {
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_Correlation the instance with the data that should be updated into this instance
*/
public void update(Correlation a_Correlation) {
getSet().update(a_Correlation.getSet());
getInitiate().update(a_Correlation.getInitiate());
}
 
public static Vector getColumnNames() {
Vector l_Vector = new Vector();
l_Vector.add("Set*");
l_Vector.add("Initiate");
return l_Vector;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Tableable#getRow()
*/
public Vector getRow() {
Vector l_Vector = new Vector();
l_Vector.add(m_Set.toString());
l_Vector.add(m_Initiate.booleanValue());
return l_Vector;
}
 
public NCName getSet() {
return m_Set;
}
 
public BPBoolean getInitiate() {
return m_Initiate;
}
 
public void setSet(NCName a_Set) {
m_Set = a_Set;
return;
}
 
public void setInitiate(BPBoolean a_Initiate) {
m_Initiate = a_Initiate;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("set")) {
setSet(new NCName(l_CurrentValue));
} else if (l_CurrentName.equals("initiate")) {
setInitiate(new BPBoolean(l_CurrentValue));
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#checkEditPanel()
*/
public String checkEditPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getAddPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getAddPanel(CustomTable a_CustomTable) {
TabbedDialog l_EditPanel = new TabbedDialog("Correlation", this, this, a_CustomTable, true);
l_EditPanel.addAttribute(this.getSet(), "Set*");
l_EditPanel.addAttribute(this.getInitiate(), "Initiate");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getSelectedEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getSelectedEditPanel(CustomTable a_CustomTable) {
Correlation l_Correlation = (Correlation) this.clone();
TabbedDialog l_EditPanel = new TabbedDialog("Correlation", l_Correlation, this,
a_CustomTable, false);
l_EditPanel.addAttribute(l_Correlation.getSet(), "Set*");
l_EditPanel.addAttribute(l_Correlation.getInitiate(), "Initiate");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_CorrelationClone) {
if (a_CorrelationClone instanceof Correlation) {
Correlation l_Correlation = (Correlation) a_CorrelationClone;
m_Set = l_Correlation.getSet();
m_Initiate = l_Correlation.getInitiate();
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("correlation");
addXMLattribute(l_Element, "set", getSet().toXML());
addXMLattribute(l_Element, "initiate", getInitiate().toXML());
return l_Element;
}
 
/**
* This method should be called by subclasses, the elementname can be the subclasses name
* @param a_Document The general document in which this element is placed
* @param a_Element The XML-element of which the super-attributes and elements should be added
* @return The parameter XML-element (with added attributes)
*/
public Element writeToXML(Document a_Document, Element a_Element) {
addXMLattribute(a_Element, "set", getSet().toXML());
addXMLattribute(a_Element, "initiate", getInitiate().toXML());
return a_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Assign.java
New file
0,0 → 1,124
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Enumeration;
 
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL Assign element, BPEL Assign Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class Assign extends Activity implements ActivityGroup {
 
private Copies m_CopySequence = new Copies();
 
public Assign() {
}
 
public Assign(Copies a_CopySequence) {
m_CopySequence = a_CopySequence;
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_Activity the instance with the data that should be updated into this instance
*/
public void update(Assign a_Assign) {
super.update(a_Assign);
getCopySequence().update(a_Assign.getCopySequence());
}
 
public void addCopy(Copy a_Copy) {
m_CopySequence.addCopy(a_Copy);
}
 
public Copies getCopySequence() {
return m_CopySequence;
}
 
public void setCopySequence(Copies a_CopySequence) {
m_CopySequence = a_CopySequence;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NodeList children = a_Node.getChildNodes();
if (children != null) {
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_TempNodeName.equals("copy")) {
Copy l_Copy = new Copy();
l_Copy.handleParse(children.item(i));
addCopy(l_Copy);
}
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_AssignClone) {
if (a_AssignClone instanceof Assign) {
super.saveEditPanel(a_AssignClone);
Assign l_Assign = (Assign) a_AssignClone;
m_CopySequence = l_Assign.getCopySequence();
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
TabbedDialog l_EditPanel = super.getShowEditPanel(a_ShowPanel);
l_EditPanel.addTab(((Assign) l_EditPanel.getEditPanelHolderClone()).getCopySequence());
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("assign");
super.writeToXML(a_Document, l_Element);
Enumeration l_Enum = getCopySequence().getCopies().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element, ((Copy) l_Enum.nextElement()).writeToXML(a_Document));
}
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/SimplePartnerLinks.java
New file
0,0 → 1,137
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.io.Serializable;
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.DeepCopy;
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.Editable;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
 
/**
* SimplePartnerLinks is a class which helps to manage the multiple partnerlinks as
* specified by the BPEL Partner Element
*/
public class SimplePartnerLinks implements Editable, Cloneable, Serializable {
 
private Vector m_SimplePartnerLinks = new Vector();
 
public SimplePartnerLinks() {
super();
}
 
public void addSimplePartnerLink(SimplePartnerLink a_SimplePartnerLink) {
m_SimplePartnerLinks.add(a_SimplePartnerLink);
}
 
public Vector getSimplePartnerLinks() {
return m_SimplePartnerLinks;
}
 
public void setSimplePartnerLinks(Vector a_SimplePartnerLinks) {
m_SimplePartnerLinks = a_SimplePartnerLinks;
return;
}
 
public Object clone() {
try {
return DeepCopy.deepCopy(this);
} catch (Exception e) {
System.out.println("Caught an exception while cloning");
return null;
}
}
 
public void update(SimplePartnerLinks a_SimplePartnerLinks) {
m_SimplePartnerLinks.removeAllElements();
Enumeration l_Enum = a_SimplePartnerLinks.getSimplePartnerLinks().elements();
while (l_Enum.hasMoreElements()) {
addSimplePartnerLink((SimplePartnerLink) l_Enum.nextElement());
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getEditPanel(CustomTable a_CustomTable) {
int l_RowNr = a_CustomTable.getSelectedRow();
if (l_RowNr >= 0) {
return ((SimplePartnerLink) m_SimplePartnerLinks.get(l_RowNr)).getSelectedEditPanel(a_CustomTable);
} else {
return null;
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveEditPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveEditPanel(TabbedDialog a_TabbedDialog) {
SimplePartnerLink l_SimplePartnerLink = (SimplePartnerLink) a_TabbedDialog.getEditPanelHolderOriginal();
l_SimplePartnerLink.update((SimplePartnerLink) a_TabbedDialog.getEditPanelHolderClone());
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveAddPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveAddPanel(TabbedDialog a_TabbedDialog) {
SimplePartnerLink l_SimplePartnerLink = (SimplePartnerLink) a_TabbedDialog.getEditPanelHolderOriginal();
l_SimplePartnerLink.update((SimplePartnerLink) a_TabbedDialog.getEditPanelHolderClone());
addSimplePartnerLink(l_SimplePartnerLink);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditName()
*/
public String getEditName() {
return "SimplePartnerLinks";
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getPanelTable()
*/
public CustomTable getPanelTable() {
CustomTable l_SimplePartnerLinksTable = new CustomTable(this);
l_SimplePartnerLinksTable.addColumnNames(SimplePartnerLink.getColumnNames());
l_SimplePartnerLinksTable.setRows(m_SimplePartnerLinks);
l_SimplePartnerLinksTable.updateTable();
return l_SimplePartnerLinksTable;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getNewPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getNewPanel(CustomTable a_CustomTable) {
SimplePartnerLink l_SimplePartnerLink = new SimplePartnerLink();
return l_SimplePartnerLink.getAddPanel(a_CustomTable);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Target.java
New file
0,0 → 1,173
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Vector;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.DeepCopy;
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.EditPanelHolder;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.emaxx.bpeldesigner.input.Tableable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
 
/**
* Represents the BPEL Target element, BPEL Target Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class Target extends ExtensibleElements implements EditPanelHolder, Tableable {
 
private NCName m_LinkName = new NCName();
 
public Target() {
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_Target the instance with the data that should be updated into this instance
*/
public void update(Target a_Target) {
super.update(a_Target);
getLinkName().update((a_Target.getLinkName()));
}
 
public Target(NCName a_LinkName) {
m_LinkName = a_LinkName;
}
 
public Object clone() {
try {
return DeepCopy.deepCopy(this);
} catch (Exception e) {
System.out.println("Caught an exception while cloning");
return null;
}
}
 
public NCName getLinkName() {
return m_LinkName;
}
 
public void setLinkName(NCName a_LinkName) {
m_LinkName = a_LinkName;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("linkName")) {
setLinkName(new NCName(l_CurrentValue));
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_TargetClone) {
if (a_TargetClone instanceof Target) {
Target l_Target = (Target) a_TargetClone;
m_LinkName = l_Target.getLinkName();
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Tableable#getRow()
*/
public Vector getRow() {
Vector l_Vector = new Vector();
l_Vector.add(m_LinkName.toString());
return l_Vector;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getSelectedEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getSelectedEditPanel(CustomTable a_CustomTable) {
Target l_Target = (Target) this.clone();
TabbedDialog l_EditPanel = new TabbedDialog("Target", l_Target, this, a_CustomTable, false);
l_EditPanel.addAttribute(l_Target.getLinkName(), "LinkName*");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
public static Vector getColumnNames() {
Vector l_Vector = new Vector();
l_Vector.add("TargetName*");
return l_Vector;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#checkEditPanel()
*/
public String checkEditPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getAddPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getAddPanel(CustomTable a_CustomTable) {
TabbedDialog l_EditPanel = new TabbedDialog("Target", this, this, a_CustomTable, true);
l_EditPanel.addAttribute(this.getLinkName(), "LinkName*");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("target");
addXMLattribute(l_Element, "linkName", getLinkName().toXML());
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Terminate.java
New file
0,0 → 1,52
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
 
/**
* Represents the BPEL Terminate element, BPEL Terminate Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class Terminate extends Activity implements ActivityGroup {
 
public Terminate() {
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("terminate");
super.writeToXML(a_Document, l_Element);
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Invoke.java
New file
0,0 → 1,304
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.bpel.figures.BPELActivityOrCompensateContainerFigure;
import org.emaxx.bpeldesigner.bpel.figures.BPELCatchFigure;
import org.emaxx.bpeldesigner.bpel.figures.BPELCompensationHandlerFigure;
import org.emaxx.bpeldesigner.bpel.standard.BPELDrawing;
import org.emaxx.bpeldesigner.bpel.standard.BPELFigureHolder;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL Invoke element, BPEL Invoke Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class Invoke extends Activity implements ActivityGroup {
 
private BPELDrawing m_Drawing;
private CorrelationsWithPattern m_Correlations = new CorrelationsWithPattern();
private Vector m_Catch = new Vector();
private ActivityOrCompensateContainer m_CatchAll = new ActivityOrCompensateContainer();
private CompensationHandler m_CompensationHandler = new CompensationHandler();
 
private NCName m_PartnerLink = new NCName();
private QName m_PortType = new QName();
private NCName m_Operation = new NCName();
private NCName m_InputVariable = new NCName();
private NCName m_OutputVariable = new NCName();
 
public Invoke() {
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ExtensibleElements#getBPELDrawing(CH.ifa.draw.standard.BPELFigureHolder)
*/
public BPELDrawing getBPELDrawing(BPELFigureHolder a_BPELFigureHolder) {
if (m_Drawing == null) {
if (a_BPELFigureHolder.getHolderParent() != null) {
m_Drawing = new BPELDrawing(a_BPELFigureHolder,
a_BPELFigureHolder.getHolderParent().getBPELDrawing().getRootDocument());
} else {
m_Drawing = new BPELDrawing(a_BPELFigureHolder, null);
}
if (this.getCatchAll() != null) {
BPELActivityOrCompensateContainerFigure l_ActivityOrCompensateContainerFigure = new BPELActivityOrCompensateContainerFigure();
l_ActivityOrCompensateContainerFigure.setActivityOrCompensateContainer(this.getCatchAll());
m_Drawing.add(l_ActivityOrCompensateContainerFigure);
}
if (this.getCatch() != null) {
Enumeration l_Enum = this.getCatch().elements();
while (l_Enum.hasMoreElements()) {
BPELCatchFigure l_CatchFigure = new BPELCatchFigure();
l_CatchFigure.setCatch((Catch) l_Enum.nextElement());
m_Drawing.add(l_CatchFigure);
}
}
if (this.getCompensationHandler() != null) {
BPELCompensationHandlerFigure l_CompensationHandlerFigure = new BPELCompensationHandlerFigure();
l_CompensationHandlerFigure.setCompensationHandler(this.getCompensationHandler());
m_Drawing.add(l_CompensationHandlerFigure);
}
}
return m_Drawing;
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_Invoke the instance with the data that should be updated into this instance
*/
public void update(Invoke a_Invoke) {
super.update(a_Invoke);
getPartnerLink().update(a_Invoke.getPartnerLink());
getPortType().update(a_Invoke.getPortType());
getOperation().update(a_Invoke.getOperation());
getInputVariable().update(a_Invoke.getInputVariable());
getOutputVariable().update(a_Invoke.getOutputVariable());
getCorrelations().update(a_Invoke.getCorrelations());
}
 
public CorrelationsWithPattern getCorrelations() {
return m_Correlations;
}
 
public void setCorrelations(CorrelationsWithPattern a_Correlations) {
m_Correlations = a_Correlations;
return;
}
 
public ActivityOrCompensateContainer getCatchAll() {
return m_CatchAll;
}
 
public void setCatchAll(ActivityOrCompensateContainer a_CatchAll) {
m_CatchAll = a_CatchAll;
return;
}
 
public CompensationHandler getCompensationHandler() {
return m_CompensationHandler;
}
 
public void setCompensationHandler(CompensationHandler a_CompensationHandler) {
m_CompensationHandler = a_CompensationHandler;
return;
}
 
public void addCatch(Catch a_Catch) {
m_Catch.add(a_Catch);
}
 
public boolean removeCatch(Catch a_Catch) {
return m_Catch.remove(a_Catch);
}
 
public Vector getCatch() {
return m_Catch;
}
 
public NCName getPartnerLink() {
return m_PartnerLink;
}
 
public QName getPortType() {
return m_PortType;
}
 
public NCName getOperation() {
return m_Operation;
}
 
public NCName getInputVariable() {
return m_InputVariable;
}
 
public NCName getOutputVariable() {
return m_OutputVariable;
}
 
public void setCatch(Vector a_Catch) {
m_Catch = a_Catch;
return;
}
 
public void setPartnerLink(NCName a_PartnerLink) {
m_PartnerLink = a_PartnerLink;
return;
}
 
public void setPortType(QName a_PortType) {
m_PortType = a_PortType;
return;
}
 
public void setOperation(NCName a_Operation) {
m_Operation = a_Operation;
return;
}
 
public void setInputVariable(NCName a_InputVariable) {
m_InputVariable = a_InputVariable;
return;
}
 
public void setOutputVariable(NCName a_OutputVariable) {
m_OutputVariable = a_OutputVariable;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("partnerLink")) {
setPartnerLink(new NCName(l_CurrentValue));
} else if (l_CurrentName.equals("portType")) {
setPortType(new QName(l_CurrentValue));
} else if (l_CurrentName.equals("operation")) {
setOperation(new NCName(l_CurrentValue));
} else if (l_CurrentName.equals("inputVariable")) {
setInputVariable(new NCName(l_CurrentValue));
} else if (l_CurrentName.equals("outputVariable")) {
setOutputVariable(new NCName(l_CurrentValue));
}
}
 
NodeList children = a_Node.getChildNodes();
if (children != null) {
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_TempNodeName.equals("correlations")) {
CorrelationsWithPattern l_Correlations = new CorrelationsWithPattern();
l_Correlations.handleParse(children.item(i));
setCorrelations(l_Correlations);
}
if (l_TempNodeName.equals("catch")) {
Catch l_Catch = new Catch();
l_Catch.handleParse(children.item(i));
addCatch(l_Catch);
}
if (l_TempNodeName.equals("catchAll")) {
ActivityOrCompensateContainer l_CatchAll = new ActivityOrCompensateContainer();
l_CatchAll.handleParse(children.item(i));
setCatchAll(l_CatchAll);
}
if (l_TempNodeName.equals("compensationHandler")) {
CompensationHandler l_CompensationHandler = new CompensationHandler();
l_CompensationHandler.handleParse(children.item(i));
setCompensationHandler(l_CompensationHandler);
}
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_InvokeClone) {
if (a_InvokeClone instanceof Invoke) {
super.saveEditPanel(a_InvokeClone);
Invoke l_Invoke = (Invoke) a_InvokeClone;
m_PartnerLink = l_Invoke.getPartnerLink();
m_PortType = l_Invoke.getPortType();
m_Operation = l_Invoke.getOperation();
m_InputVariable = l_Invoke.getInputVariable();
m_OutputVariable = l_Invoke.getOutputVariable();
m_Correlations = l_Invoke.getCorrelations();
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
TabbedDialog l_EditPanel = super.getShowEditPanel(a_ShowPanel);
Invoke l_Invoke = (Invoke) l_EditPanel.getEditPanelHolderClone();
l_EditPanel.addAttribute(l_Invoke.getPartnerLink(), "PartnerLink*");
l_EditPanel.addAttribute(l_Invoke.getPortType(), "PortType*");
l_EditPanel.addAttribute(l_Invoke.getOperation(), "Operation*");
l_EditPanel.addAttribute(l_Invoke.getInputVariable(), "InputVariable");
l_EditPanel.addAttribute(l_Invoke.getOutputVariable(), "OutputVariable");
l_EditPanel.addTab(l_Invoke.getCorrelations());
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("invoke");
super.writeToXML(a_Document, l_Element);
addXMLattribute(l_Element, "partnerLink", getPartnerLink().toXML());
addXMLattribute(l_Element, "portType", getPortType().toXML());
addXMLattribute(l_Element, "operation", getOperation().toXML());
addXMLattribute(l_Element, "inputVariable", getInputVariable().toXML());
addXMLattribute(l_Element, "outputVariable", getOutputVariable().toXML());
addXMLChild(l_Element, getCorrelations().writeToXML(a_Document));
Enumeration l_Enum = getCatch().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element, ((Catch) l_Enum.nextElement()).writeToXML(a_Document));
}
addXMLChild(l_Element, getCatchAll().writeToXML(a_Document));
addXMLChild(l_Element, getCompensationHandler().writeToXML(a_Document));
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/CompensationHandler.java
New file
0,0 → 1,55
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
 
/**
* Represents the BPEL CompensationHandler element, BPEL Compensate Nodes can be converted to this class.
* This class supports certain modifying attributes. This class can be saved to a BPEL Node.
*/
public class CompensationHandler extends ActivityOrCompensateContainer {
 
public CompensationHandler() {
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("compensationHandler");
super.writeToXML(a_Document, l_Element);
if (l_Element.hasChildNodes()) {
return l_Element;
} else {
return null;
}
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Empty.java
New file
0,0 → 1,53
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
 
/**
* Represents the BPEL Empty element, BPEL Empty Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class Empty extends Activity implements ActivityGroup {
 
public Empty() {
super();
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("empty");
super.writeToXML(a_Document, l_Element);
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/DOMParserBPEL.java
New file
0,0 → 1,118
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
 
import org.apache.xerces.parsers.DOMParser;
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer;
import org.emaxx.bpeldesigner.dom.FileEntityResolver;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
 
/**
* This class can parse a BPEL-document and validate it
*/
public class DOMParserBPEL {
 
public static String m_Directory = "xsds";
 
/**
* Parses the specified file and returns the BPELDocument if no exceptions occur
* @param a_XMLFilename the filename to be parsed
* @return the BPELDocument
* @throws IOException
*/
public static BPELDocument start(String a_XMLFilename) throws IOException {
 
// Create URL String from incoming file
String url = "file:" + new File(a_XMLFilename).getAbsolutePath();
 
try {
 
// Create a DOM Parser
DOMParser parser = new DOMParser();
parser.setEntityResolver(new FileEntityResolver(m_Directory));
parser.setFeature("http://xml.org/sax/features/validation", false);
parser.setFeature("http://apache.org/xml/features/validation/schema", false);
parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking",
false);
 
// Parser the incoming file (URL)
parser.parse(url);
 
// Obtain the document
Document l_Doc = parser.getDocument();
 
// Print the document from the DOM tree and feed it an initial
// indentation of nothing
BPELDocument l_Document = new BPELDocument();
l_Document.handleParse(l_Doc);
validate(l_Doc);
return l_Document;
} catch (IOException ioe) {
 
throw new IOException("Could not restore drawing '" + a_XMLFilename
+ "': Could not read the document");
 
} catch (SAXException saxe) {
 
throw new IOException("Could not restore drawing '" + a_XMLFilename
+ "': Not a valid document");
}
}
 
/**
* Validates the Document, adds its own bpel schemalocation, throws exceptions in case of errors
* @param a_Document the document to be validated
* @return true if it came through the validation, will never return false but will throw an exception in case of problems
* @throws IOException
* @throws SAXException
*/
public static boolean validate(Document a_Document) throws IOException, SAXException {
if (a_Document.getFirstChild() instanceof Element) {
((Element) a_Document.getFirstChild()).setAttribute("xmlns:xsi",
"http://www.w3.org/2001/XMLSchema-instance");
((Element) a_Document.getFirstChild()).setAttribute(
"xsi:schemaLocation",
"http://schemas.xmlsoap.org/ws/2003/03/business-process/ http://schemas.xmlsoap.org/ws/2003/03/business-process/");
OutputFormat format = new OutputFormat(a_Document);
StringWriter stringOut = new StringWriter();
XMLSerializer serial = new XMLSerializer(stringOut, format);
serial.asDOMSerializer();
serial.serialize(a_Document.getDocumentElement());
DOMParser parser = new DOMParser();
parser.setEntityResolver(new FileEntityResolver(m_Directory));
parser.setFeature("http://xml.org/sax/features/validation", true);
parser.setFeature("http://apache.org/xml/features/validation/schema", true);
parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking",
true);
parser.parse(new InputSource(new StringReader(stringOut.toString())));
}
return true;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/ActivityContainer.java
New file
0,0 → 1,114
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import org.emaxx.bpeldesigner.bpel.figures.BPELActivityFigure;
import org.emaxx.bpeldesigner.bpel.standard.BPELDrawing;
import org.emaxx.bpeldesigner.bpel.standard.BPELFigureHolder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL ActivityContainer element, BPEL ActivityContainer Nodes can be converted to this class.
* This class supports certain modifying attributes. This class can be saved to a BPEL Node.
*/
public class ActivityContainer extends ExtensibleElements {
 
private BPELDrawing m_Drawing;
private ActivityGroup m_ActivityGroup;
 
public ActivityContainer() {
}
 
public ActivityGroup getActivityGroup() {
return m_ActivityGroup;
}
 
public void setActivityGroup(ActivityGroup a_ActivityGroup) {
m_ActivityGroup = a_ActivityGroup;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ExtensibleElements#getBPELDrawing(CH.ifa.draw.standard.BPELFigureHolder)
*/
public BPELDrawing getBPELDrawing(BPELFigureHolder a_BPELFigureHolder) {
if (m_Drawing == null) {
if (a_BPELFigureHolder.getHolderParent() != null) {
m_Drawing = new BPELDrawing(a_BPELFigureHolder,
a_BPELFigureHolder.getHolderParent().getBPELDrawing().getRootDocument());
} else {
m_Drawing = new BPELDrawing(a_BPELFigureHolder, null);
}
if (this.getActivityGroup() != null) {
BPELActivityFigure l_ActivityFigure = BPELActivityFigure.giveFigure(this.getActivityGroup());
l_ActivityFigure.setActivity((Activity) this.getActivityGroup());
m_Drawing.add(l_ActivityFigure);
}
}
return m_Drawing;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
NodeList children = a_Node.getChildNodes();
if (children != null) {
KeyClassVector l_KeyClassVector = new KeyClassVector();
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_KeyClassVector.getAContaining(l_TempNodeName) != null) {
ActivityGroup l_ActivityGroup = l_KeyClassVector.getAContaining(l_TempNodeName);
l_ActivityGroup.handleParse(children.item(i));
setActivityGroup(l_ActivityGroup);
}
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("activityContainer");
if (getActivityGroup() != null) {
addXMLChild(l_Element, getActivityGroup().writeToXML(a_Document));
}
return l_Element;
}
 
/**
* This method should be called by subclasses, the elementname can be the subclasses name
* @param a_Document The general document in which this element is placed
* @param a_Element The XML-element of which the super-attributes and elements should be added
* @return The parameter XML-element (with added attributes)
*/
public Element writeToXML(Document a_Document, Element a_Element) {
if (getActivityGroup() != null) {
addXMLChild(a_Element, getActivityGroup().writeToXML(a_Document));
}
return a_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/BPBoolean.java
New file
0,0 → 1,85
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.io.Serializable;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.DeepCopy;
 
/**
* This class represents the Boolean BPEL-type
*/
public class BPBoolean implements Cloneable, Serializable {
 
private BPString m_Boolean = new BPString("no");
 
public BPBoolean() {
}
 
public BPBoolean(String a_BooleanString) {
m_Boolean = new BPString(a_BooleanString);
}
 
public BPString getBoolean() {
return m_Boolean;
}
 
public void setBoolean(BPString a_Boolean) {
m_Boolean = a_Boolean;
}
 
public Object clone() {
try {
return DeepCopy.deepCopy(this);
} catch (Exception e) {
System.out.println("Caught an exception while cloning");
return null;
}
}
 
public void update(BPBoolean a_BPBoolean) {
m_Boolean = a_BPBoolean.getBoolean();
}
 
public String toString() {
return m_Boolean.toString();
}
 
/**
* Returns this attribute in XML-value
* @return this attribute in XML-value
*/
public String toXML() {
return m_Boolean.toXML();
}
 
/**
* Returns the booleanValue in Boolean of this class
* @return the booleanValue in Boolean of this class
*/
public Boolean booleanValue() {
if (m_Boolean.getBPString().equals("yes")) {
return Boolean.valueOf(true);
} else {
return Boolean.valueOf(false);
}
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/KeyClassVector.java
New file
0,0 → 1,114
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Enumeration;
import java.util.Vector;
 
/**
* This class is useful during the parsing of elements, it can identify and return the right type of Object
* of an ActivityGroup in this case
*/
public class KeyClassVector extends Vector {
 
private final int EMPTY = 1;
private final int INVOKE = 2;
private final int RECEIVE = 3;
private final int REPLY = 4;
private final int ASSIGN = 5;
private final int WAIT = 6;
private final int THROW = 7;
private final int TERMINATE = 8;
private final int FLOW = 9;
private final int SWITCH = 10;
private final int WHILE = 11;
private final int SEQUENCE = 12;
private final int PICK = 13;
private final int SCOPE = 14;
 
/**
* Initiates the different activity group element names and their unique number
*/
public KeyClassVector() {
super();
add(new KeyClassType("empty", EMPTY));
add(new KeyClassType("invoke", INVOKE));
add(new KeyClassType("receive", RECEIVE));
add(new KeyClassType("reply", REPLY));
add(new KeyClassType("assign", ASSIGN));
add(new KeyClassType("wait", WAIT));
add(new KeyClassType("throw", THROW));
add(new KeyClassType("terminate", TERMINATE));
add(new KeyClassType("flow", FLOW));
add(new KeyClassType("switch", SWITCH));
add(new KeyClassType("while", WHILE));
add(new KeyClassType("sequence", SEQUENCE));
add(new KeyClassType("pick", PICK));
add(new KeyClassType("scope", SCOPE));
}
 
/**
* Returns the corresponding class instance after searching with the given name
* @param a_Key the given name
* @return the corresponding class instance after searching with the given name
*/
public ActivityGroup getAContaining(String a_Key) {
Enumeration enum = elements();
while (enum.hasMoreElements()) {
Object l_Object = enum.nextElement();
if (l_Object instanceof KeyClassType) {
if (((KeyClassType) l_Object).hasKey(a_Key)) {
switch (((KeyClassType) l_Object).getClassType()) {
case EMPTY:
return new Empty();
case INVOKE:
return new Invoke();
case RECEIVE:
return new Receive();
case REPLY:
return new Reply();
case ASSIGN:
return new Assign();
case WAIT:
return new Wait();
case THROW:
return new Throw();
case TERMINATE:
return new Terminate();
case FLOW:
return new Flow();
case SWITCH:
return new Switch();
case WHILE:
return new While();
case SEQUENCE:
return new Sequence();
case PICK:
return new Pick();
case SCOPE:
return new Scope();
}
}
}
}
return null;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/EventHandlers.java
New file
0,0 → 1,156
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.bpel.figures.BPELOnAlarmFigure;
import org.emaxx.bpeldesigner.bpel.figures.BPELOnMessageFigure;
import org.emaxx.bpeldesigner.bpel.standard.BPELDrawing;
import org.emaxx.bpeldesigner.bpel.standard.BPELFigureHolder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL EventHandlers element, BPEL EventHandlers Nodes can be converted to this class.
* This class supports certain modifying attributes. This class can be saved to a BPEL Node.
*/
public class EventHandlers extends ExtensibleElements {
 
private BPELDrawing m_Drawing;
private Vector m_OnAlarms = new Vector();
private Vector m_OnMessages = new Vector();
 
public EventHandlers() {
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ExtensibleElements#getBPELDrawing(CH.ifa.draw.standard.BPELFigureHolder)
*/
public BPELDrawing getBPELDrawing(BPELFigureHolder a_BPELFigureHolder) {
if (m_Drawing == null) {
if (a_BPELFigureHolder.getHolderParent() != null) {
m_Drawing = new BPELDrawing(a_BPELFigureHolder,
a_BPELFigureHolder.getHolderParent().getBPELDrawing().getRootDocument());
} else {
m_Drawing = new BPELDrawing(a_BPELFigureHolder, null);
}
if (this.getOnAlarms() != null) {
Enumeration l_Enum = this.getOnAlarms().elements();
while (l_Enum.hasMoreElements()) {
BPELOnAlarmFigure l_OnAlarmFigure = new BPELOnAlarmFigure();
l_OnAlarmFigure.setOnAlarm((OnAlarm) l_Enum.nextElement());
m_Drawing.add(l_OnAlarmFigure);
}
}
if (this.getOnMessages() != null) {
Enumeration l_Enum = this.getOnMessages().elements();
while (l_Enum.hasMoreElements()) {
BPELOnMessageFigure l_OnMessageFigure = new BPELOnMessageFigure();
l_OnMessageFigure.setOnMessage((OnMessage) l_Enum.nextElement());
m_Drawing.add(l_OnMessageFigure);
}
}
}
return m_Drawing;
}
 
public void addOnMessage(OnMessage a_OnMessage) {
m_OnMessages.add(a_OnMessage);
return;
}
 
public boolean removeOnMessage(OnMessage a_OnMessage) {
return m_OnMessages.remove(a_OnMessage);
}
 
public Vector getOnMessages() {
return m_OnMessages;
}
 
public void setOnMessages(Vector a_OnMessages) {
m_OnMessages = a_OnMessages;
return;
}
 
public Vector getOnAlarms() {
return m_OnAlarms;
}
 
public void addOnAlarm(OnAlarm a_OnAlarm) {
m_OnAlarms.add(a_OnAlarm);
return;
}
 
public boolean removeOnAlarm(OnAlarm a_OnAlarm) {
return m_OnAlarms.remove(a_OnAlarm);
}
 
public void setOnAlarms(Vector a_OnAlarms) {
m_OnAlarms = a_OnAlarms;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
NodeList children = a_Node.getChildNodes();
if (children != null) {
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_TempNodeName.equals("onMessage")) {
OnMessage l_OnMessage = new OnMessage();
l_OnMessage.handleParse(children.item(i));
addOnMessage(l_OnMessage);
} else if (l_TempNodeName.equals("onAlarm")) {
OnAlarm l_OnAlarm = new OnAlarm();
l_OnAlarm.handleParse(children.item(i));
addOnAlarm(l_OnAlarm);
}
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("eventHandlers");
Enumeration l_Enum = getOnMessages().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element, ((OnMessage) l_Enum.nextElement()).writeToXML(a_Document));
}
l_Enum = getOnAlarms().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element, ((OnAlarm) l_Enum.nextElement()).writeToXML(a_Document));
}
if (l_Element.hasChildNodes()) {
return l_Element;
} else {
return null;
}
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/From.java
New file
0,0 → 1,277
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.EditPanelHolder;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
 
/**
* Represents the BPEL From element, BPEL From Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class From extends ExtensibleElements implements EditPanelHolder {
 
private NCName m_Variable = new NCName();
private NCName m_Part = new NCName();
private BPString m_Query = new BPString();
private QName m_Property = new QName();
private NCName m_PartnerLink = new NCName();
private Roles m_EndpointReference = new Roles();
private BPString m_Expression = new BPString();
private BPBoolean m_Opaque = new BPBoolean("no");
 
public From() {
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_From the instance with the data that should be updated into this instance
*/
public void update(From a_From) {
getVariable().update(a_From.getVariable());
getPart().update(a_From.getPart());
getQuery().update(a_From.getQuery());
getProperty().update(a_From.getProperty());
getPartnerLink().update(a_From.getPartnerLink());
getEndpointReference().update(a_From.getEndpointReference());
getExpression().update(a_From.getExpression());
getOpaque().update(a_From.getOpaque());
}
 
public NCName getVariable() {
return m_Variable;
}
 
public NCName getPart() {
return m_Part;
}
 
public BPString getQuery() {
return m_Query;
}
 
public QName getProperty() {
return m_Property;
}
 
public NCName getPartnerLink() {
return m_PartnerLink;
}
 
public Roles getEndpointReference() {
return m_EndpointReference;
}
 
public BPString getExpression() {
return m_Expression;
}
 
public BPBoolean getOpaque() {
return m_Opaque;
}
 
public void setVariable(NCName a_Variable) {
m_Variable = a_Variable;
return;
}
 
public void setPart(NCName a_Part) {
m_Part = a_Part;
return;
}
 
public void setQuery(BPString a_Query) {
m_Query = a_Query;
return;
}
 
public void setProperty(QName a_Property) {
m_Property = a_Property;
return;
}
 
public void setPartnerLink(NCName a_PartnerLink) {
m_PartnerLink = a_PartnerLink;
return;
}
 
public void setEndpointReference(Roles a_EndpointReference) {
m_EndpointReference = a_EndpointReference;
return;
}
 
public void setExpression(BPString a_Expression) {
m_Expression = a_Expression;
return;
}
 
public void setOpaque(BPBoolean a_Opaque) {
m_Opaque = a_Opaque;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("variable")) {
setVariable(new NCName(l_CurrentValue));
} else if (l_CurrentName.equals("part")) {
setPart(new NCName(l_CurrentValue));
} else if (l_CurrentName.equals("query")) {
setQuery(new BPString(l_CurrentValue));
} else if (l_CurrentName.equals("property")) {
setProperty(new QName(l_CurrentValue));
} else if (l_CurrentName.equals("partnerLink")) {
setPartnerLink(new NCName(l_CurrentValue));
} else if (l_CurrentName.equals("endpointReference")) {
setEndpointReference(new Roles(l_CurrentValue));
} else if (l_CurrentName.equals("expression")) {
setExpression(new BPString(l_CurrentValue));
} else if (l_CurrentName.equals("opaque")) {
setOpaque(new BPBoolean(l_CurrentValue));
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowPanel()
*/
public ShowPanel getShowPanel() {
From l_From = (From) this.clone();
ShowPanel l_ShowPanel = new ShowPanel("From", l_From, this);
l_ShowPanel.addAttribute(l_From.getVariable(), "Variable");
l_ShowPanel.addAttribute(l_From.getPart(), "Part");
l_ShowPanel.addAttribute(l_From.getQuery(), "Query");
l_ShowPanel.addAttribute(l_From.getProperty(), "Property");
l_ShowPanel.addAttribute(l_From.getPartnerLink(), "PartnerLink");
l_ShowPanel.addAttribute(l_From.getEndpointReference(), "EndpointReference");
l_ShowPanel.addAttribute(l_From.getExpression(), "Expression");
l_ShowPanel.addAttribute(l_From.getOpaque(), "Opaque");
return l_ShowPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#checkEditPanel()
*/
public String checkEditPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getAddPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getAddPanel(CustomTable a_CustomTable) {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getSelectedEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getSelectedEditPanel(CustomTable a_CustomTable) {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_FromClone) {
if (a_FromClone instanceof From) {
From l_From = (From) a_FromClone;
m_Variable.update(l_From.getVariable());
m_Part.update(l_From.getPart());
m_Query.update(l_From.getQuery());
m_Property.update(l_From.getProperty());
m_PartnerLink.update(l_From.getPartnerLink());
m_EndpointReference.update(l_From.getEndpointReference());
m_Expression.update(l_From.getExpression());
m_Opaque.update(l_From.getOpaque());
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
From l_From = (From) this.clone();
TabbedDialog l_EditPanel = new TabbedDialog("From", l_From, this, a_ShowPanel);
l_EditPanel.addAttribute(l_From.getVariable(), "Variable");
l_EditPanel.addAttribute(l_From.getPart(), "Part");
l_EditPanel.addAttribute(l_From.getQuery(), "Query");
l_EditPanel.addAttribute(l_From.getProperty(), "Property");
l_EditPanel.addAttribute(l_From.getPartnerLink(), "PartnerLink");
l_EditPanel.addAttribute(l_From.getEndpointReference(), "EndpointReference");
l_EditPanel.addAttribute(l_From.getExpression(), "Expression");
l_EditPanel.addAttribute(l_From.getOpaque(), "Opaque");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("from");
addXMLattribute(l_Element, "variable", getVariable().toXML());
addXMLattribute(l_Element, "part", getPart().toXML());
addXMLattribute(l_Element, "query", getQuery().toXML());
addXMLattribute(l_Element, "property", getProperty().toXML());
addXMLattribute(l_Element, "partnerLink", getPartnerLink().toXML());
addXMLattribute(l_Element, "endpointReference", getEndpointReference().toXML());
addXMLattribute(l_Element, "expression", getExpression().toXML());
addXMLattribute(l_Element, "opaque", getOpaque().toXML());
return l_Element;
}
 
/**
* This method should be called by subclasses, the elementname can be the subclasses name
* @param a_Document The general document in which this element is placed
* @param a_Element The XML-element of which the super-attributes and elements should be added
* @return The parameter XML-element (with added attributes)
*/
public Element writeToXML(Document a_Document, Element a_Element) {
addXMLattribute(a_Element, "variable", getVariable().toXML());
addXMLattribute(a_Element, "part", getPart().toXML());
addXMLattribute(a_Element, "query", getQuery().toXML());
addXMLattribute(a_Element, "property", getProperty().toXML());
addXMLattribute(a_Element, "partnerLink", getPartnerLink().toXML());
addXMLattribute(a_Element, "expression", getExpression().toXML());
addXMLattribute(a_Element, "opaque", getOpaque().toXML());
return a_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Wait.java
New file
0,0 → 1,132
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
 
/**
* Represents the BPEL Wait element, BPEL Wait Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class Wait extends Activity implements ActivityGroup {
 
private DurationExpr m_For = new DurationExpr();
private DeadlineExpr m_Until = new DeadlineExpr();
 
public Wait() {
}
 
public Wait(DurationExpr a_For, DeadlineExpr a_Until) {
m_For = a_For;
m_Until = a_Until;
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_Wait the instance with the data that should be updated into this instance
*/
public void update(Wait a_Wait) {
super.update(a_Wait);
getFor().update(a_Wait.getFor());
getUntil().update(a_Wait.getUntil());
}
 
public DurationExpr getFor() {
return m_For;
}
 
public DeadlineExpr getUntil() {
return m_Until;
}
 
public void setFor(DurationExpr a_For) {
m_For = a_For;
return;
}
 
public void setUntil(DeadlineExpr a_Until) {
m_Until = a_Until;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("for")) {
setFor(new DurationExpr(l_CurrentValue));
} else if (l_CurrentName.equals("until")) {
setUntil(new DeadlineExpr(l_CurrentValue));
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_WaitClone) {
if (a_WaitClone instanceof Wait) {
super.saveEditPanel(a_WaitClone);
Wait l_Wait = (Wait) a_WaitClone;
m_For = l_Wait.getFor();
m_Until = l_Wait.getUntil();
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
TabbedDialog l_EditPanel = super.getShowEditPanel(a_ShowPanel);
Wait l_Wait = (Wait) l_EditPanel.getEditPanelHolderClone();
l_EditPanel.addAttribute(l_Wait.getFor(), "For");
l_EditPanel.addAttribute(l_Wait.getUntil(), "Until");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("wait");
super.writeToXML(a_Document, l_Element);
addXMLattribute(l_Element, "for", getFor().toXML());
addXMLattribute(l_Element, "until", getUntil().toXML());
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Flow.java
New file
0,0 → 1,169
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.bpel.figures.BPELActivityFigure;
import org.emaxx.bpeldesigner.bpel.standard.BPELDrawing;
import org.emaxx.bpeldesigner.bpel.standard.BPELFigureHolder;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL Flow element, BPEL Flow Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class Flow extends Activity implements ActivityGroup {
 
private BPELDrawing m_Drawing;
private Links m_Links = new Links();
private Vector m_FlowActivityGroups = new Vector();
 
public Flow() {
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ExtensibleElements#getBPELDrawing(CH.ifa.draw.standard.BPELFigureHolder)
*/
public BPELDrawing getBPELDrawing(BPELFigureHolder a_BPELFigureHolder) {
if (m_Drawing == null) {
if (a_BPELFigureHolder.getHolderParent() != null) {
m_Drawing = new BPELDrawing(a_BPELFigureHolder,
a_BPELFigureHolder.getHolderParent().getBPELDrawing().getRootDocument());
} else {
m_Drawing = new BPELDrawing(a_BPELFigureHolder, null);
}
if (this.getFlowActivityGroups() != null) {
Enumeration l_Enum = this.getFlowActivityGroups().elements();
while (l_Enum.hasMoreElements()) {
ActivityGroup l_ActivityGroup = (ActivityGroup) l_Enum.nextElement();
BPELActivityFigure l_ActivityFigure = BPELActivityFigure.giveFigure(l_ActivityGroup);
l_ActivityFigure.setActivity((Activity) l_ActivityGroup);
m_Drawing.add(l_ActivityFigure);
}
}
}
return m_Drawing;
}
 
/**
* This method updates this instance with an instance of the sameclass, such that
* reference to this instance sub-elements remain intact
* @param a_Flow the instance with the data that should be updated into this instance
*/
public void update(Flow a_Flow) {
super.update(a_Flow);
getLinks().update((a_Flow.getLinks()));
}
 
public Links getLinks() {
return m_Links;
}
 
public void setLinks(Links a_Links) {
m_Links = a_Links;
}
 
public void addFlowActivityGroup(ActivityGroup a_FlowActivityGroup) {
m_FlowActivityGroups.add(a_FlowActivityGroup);
return;
}
 
public boolean removeFlowActivityGroup(ActivityGroup a_FlowActivityGroup) {
return m_FlowActivityGroups.remove(a_FlowActivityGroup);
}
 
public Vector getFlowActivityGroups() {
return m_FlowActivityGroups;
}
 
public void setFlowActivityGroups(Vector a_FlowActivityGroups) {
m_FlowActivityGroups = a_FlowActivityGroups;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NodeList children = a_Node.getChildNodes();
if (children != null) {
KeyClassVector l_KeyClassVector = new KeyClassVector();
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_TempNodeName.equals("links")) {
Links l_Links = new Links();
l_Links.handleParse(children.item(i));
setLinks(l_Links);
} else if (l_KeyClassVector.getAContaining(l_TempNodeName) != null) {
ActivityGroup l_ActivityGroup = l_KeyClassVector.getAContaining(l_TempNodeName);
l_ActivityGroup.handleParse(children.item(i));
addFlowActivityGroup(l_ActivityGroup);
}
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_FlowClone) {
super.saveEditPanel(a_FlowClone);
if (a_FlowClone instanceof Flow) {
Flow l_Flow = (Flow) a_FlowClone;
m_Links = l_Flow.getLinks();
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
TabbedDialog l_EditPanel = super.getShowEditPanel(a_ShowPanel);
l_EditPanel.addTab(((Flow) l_EditPanel.getEditPanelHolderClone()).getLinks());
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("flow");
super.writeToXML(a_Document, l_Element);
addXMLChild(l_Element, getLinks().writeToXML(a_Document));
Enumeration l_Enum = getFlowActivityGroups().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element, ((ActivityGroup) l_Enum.nextElement()).writeToXML(a_Document));
}
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/While.java
New file
0,0 → 1,162
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import org.emaxx.bpeldesigner.bpel.figures.BPELActivityFigure;
import org.emaxx.bpeldesigner.bpel.standard.BPELDrawing;
import org.emaxx.bpeldesigner.bpel.standard.BPELFigureHolder;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL While element, BPEL While Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class While extends Activity implements ActivityGroup {
 
private BPELDrawing m_Drawing;
private ActivityGroup m_ActivityGroup;
private BooleanExpr m_Condition = new BooleanExpr();
 
public While() {
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ExtensibleElements#getBPELDrawing(CH.ifa.draw.standard.BPELFigureHolder)
*/
public BPELDrawing getBPELDrawing(BPELFigureHolder a_BPELFigureHolder) {
if (m_Drawing == null) {
if (a_BPELFigureHolder.getHolderParent() != null) {
m_Drawing = new BPELDrawing(a_BPELFigureHolder,
a_BPELFigureHolder.getHolderParent().getBPELDrawing().getRootDocument());
} else {
m_Drawing = new BPELDrawing(a_BPELFigureHolder, null);
}
if (this.getActivityGroup() != null) {
BPELActivityFigure l_ActivityFigure = BPELActivityFigure.giveFigure(this.getActivityGroup());
l_ActivityFigure.setActivity((Activity) this.getActivityGroup());
m_Drawing.add(l_ActivityFigure);
}
}
return m_Drawing;
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_While the instance with the data that should be updated into this instance
*/
public void update(While a_While) {
super.update(a_While);
getCondition().update(a_While.getCondition());
}
 
public ActivityGroup getActivityGroup() {
return m_ActivityGroup;
}
 
public BooleanExpr getCondition() {
return m_Condition;
}
 
public void setActivityGroup(ActivityGroup a_ActivityGroup) {
m_ActivityGroup = a_ActivityGroup;
return;
}
 
public void setCondition(BooleanExpr a_Condition) {
m_Condition = a_Condition;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("condition")) {
setCondition(new BooleanExpr(l_CurrentValue));
}
}
NodeList children = a_Node.getChildNodes();
if (children != null) {
KeyClassVector l_KeyClassVector = new KeyClassVector();
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_KeyClassVector.getAContaining(l_TempNodeName) != null) {
ActivityGroup l_ActivityGroup = l_KeyClassVector.getAContaining(l_TempNodeName);
l_ActivityGroup.handleParse(children.item(i));
setActivityGroup(l_ActivityGroup);
}
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_WhileClone) {
if (a_WhileClone instanceof While) {
super.saveEditPanel(a_WhileClone);
While l_While = (While) a_WhileClone;
m_Condition = l_While.getCondition();
 
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
TabbedDialog l_EditPanel = super.getShowEditPanel(a_ShowPanel);
While l_While = (While) l_EditPanel.getEditPanelHolderClone();
l_EditPanel.addAttribute(l_While.getCondition(), "Condition*");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("while");
super.writeToXML(a_Document, l_Element);
addXMLattribute(l_Element, "condition", getCondition().toXML());
if (getActivityGroup() != null) {
addXMLChild(l_Element, getActivityGroup().writeToXML(a_Document));
}
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Otherwise.java
New file
0,0 → 1,45
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import org.w3c.dom.Document;
import org.w3c.dom.Element;
 
/**
* Represents the BPEL Otherwise element, BPEL Otherwise Nodes can be converted to this class.
* This class supports certain modifying attributes. This class can be saved to a BPEL Node.
*/
public class Otherwise extends ActivityContainer {
 
public Otherwise() {
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("otherwise");
if (getActivityGroup() != null) {
addXMLChild(l_Element, getActivityGroup().writeToXML(a_Document));
}
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Targets.java
New file
0,0 → 1,137
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.io.Serializable;
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.DeepCopy;
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.Editable;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
 
/**
* This class is created for displaying the Target element in a table. It is necessary
* to keep the uniformity in the property dialog part.
*/
public class Targets implements Editable, Cloneable, Serializable {
 
private Vector m_Targets = new Vector();
 
public Targets() {
super();
}
 
public void addTarget(Target a_Target) {
m_Targets.add(a_Target);
}
 
public Vector getTargets() {
return m_Targets;
}
 
public void setTargets(Vector a_Targets) {
m_Targets = a_Targets;
return;
}
 
public Object clone() {
try {
return DeepCopy.deepCopy(this);
} catch (Exception e) {
System.out.println("Caught an exception while cloning");
return null;
}
}
 
public void update(Targets a_Targets) {
m_Targets.removeAllElements();
Enumeration l_Enum = a_Targets.getTargets().elements();
while (l_Enum.hasMoreElements()) {
addTarget((Target) l_Enum.nextElement());
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getEditPanel(CustomTable a_CustomTable) {
int l_RowNr = a_CustomTable.getSelectedRow();
if (l_RowNr >= 0) {
return ((Target) m_Targets.get(l_RowNr)).getSelectedEditPanel(a_CustomTable);
} else {
return null;
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveEditPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveEditPanel(TabbedDialog a_TabbedDialog) {
Target l_Target = (Target) a_TabbedDialog.getEditPanelHolderOriginal();
l_Target.update((Target) a_TabbedDialog.getEditPanelHolderClone());
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveAddPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveAddPanel(TabbedDialog a_TabbedDialog) {
Target l_Target = (Target) a_TabbedDialog.getEditPanelHolderOriginal();
l_Target.update((Target) a_TabbedDialog.getEditPanelHolderClone());
addTarget(l_Target);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditName()
*/
public String getEditName() {
return "Targets";
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getPanelTable()
*/
public CustomTable getPanelTable() {
CustomTable l_TargetsTable = new CustomTable(this);
l_TargetsTable.addColumnNames(Target.getColumnNames());
l_TargetsTable.setRows(m_Targets);
l_TargetsTable.updateTable();
return l_TargetsTable;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getNewPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getNewPanel(CustomTable a_CustomTable) {
Target l_Target = new Target();
return l_Target.getAddPanel(a_CustomTable);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/CorrelationWithPattern.java
New file
0,0 → 1,147
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Vector;
 
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
 
/**
* Represents the BPEL CorrelationWithPattern element, BPEL CorrelationWithPattern Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class CorrelationWithPattern extends Correlation {
 
private BPString m_Pattern = new BPString();
 
public CorrelationWithPattern() {
}
 
public CorrelationWithPattern(BPString a_Pattern) {
m_Pattern = a_Pattern;
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_CorrelationWithPattern the instance with the data that should be updated into this instance
*/
public void update(CorrelationWithPattern a_CorrelationWithPattern) {
super.update(a_CorrelationWithPattern);
getPattern().update(a_CorrelationWithPattern.getPattern());
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.Correlation#getColumnNames()
*/
public static Vector getColumnNames() {
Vector l_Vector = new Vector();
l_Vector.add("Set*");
l_Vector.add("Initiate");
l_Vector.add("Pattern");
return l_Vector;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Tableable#getRow()
*/
public Vector getRow() {
Vector l_Vector = super.getRow();
l_Vector.add(m_Pattern.toString());
return l_Vector;
}
 
public BPString getPattern() {
return m_Pattern;
}
 
public void setPattern(BPString a_Pattern) {
m_Pattern = a_Pattern;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("pattern")) {
setPattern(new BPString(l_CurrentValue));
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getAddPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getAddPanel(CustomTable a_CustomTable) {
TabbedDialog l_EditPanel = super.getAddPanel(a_CustomTable);
l_EditPanel.addAttribute(this.getPattern(), "Pattern");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getSelectedEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getSelectedEditPanel(CustomTable a_CustomTable) {
TabbedDialog l_EditPanel = super.getSelectedEditPanel(a_CustomTable);
CorrelationWithPattern l_CorrelationWithPattern = (CorrelationWithPattern) l_EditPanel.getEditPanelHolderClone();
l_EditPanel.addAttribute(l_CorrelationWithPattern.getPattern(), "Pattern");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_CorrelationWithPatternClone) {
if (a_CorrelationWithPatternClone instanceof CorrelationWithPattern) {
CorrelationWithPattern l_CorrelationWithPattern = (CorrelationWithPattern) a_CorrelationWithPatternClone;
super.saveEditPanel(a_CorrelationWithPatternClone);
m_Pattern = l_CorrelationWithPattern.getPattern();
 
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("correlation");
super.writeToXML(a_Document, l_Element);
addXMLattribute(l_Element, "pattern", getPattern().toXML());
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Case.java
New file
0,0 → 1,140
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.EditPanelHolder;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
 
/**
* Represents the BPEL Case element, BPEL Case Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class Case extends ActivityContainer implements EditPanelHolder {
 
private BooleanExpr m_Condition = new BooleanExpr();
 
public Case() {
}
 
public BooleanExpr getCondition() {
return m_Condition;
}
 
public void setCondition(BooleanExpr a_Condition) {
m_Condition = a_Condition;
return;
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_Case the instance with the data that should be updated into this instance
*/
public void update(Case a_Case) {
super.update(a_Case);
getCondition().update(a_Case.getCondition());
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("condition")) {
setCondition(new BooleanExpr(l_CurrentValue));
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("case");
super.writeToXML(a_Document, l_Element);
addXMLattribute(l_Element, "condition", getCondition().toXML());
return l_Element;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#checkEditPanel()
*/
public String checkEditPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getAddPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getAddPanel(CustomTable a_CustomTable) {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getSelectedEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getSelectedEditPanel(CustomTable a_CustomTable) {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
Case l_Case = (Case) this.clone();
TabbedDialog l_EditPanel = new TabbedDialog("Case", l_Case, this, a_ShowPanel);
l_EditPanel.addAttribute(l_Case.getCondition(), "Condition*");
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_CaseClone) {
if (a_CaseClone instanceof Case) {
Case l_Case = (Case) a_CaseClone;
m_Condition = l_Case.getCondition();
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Partner.java
New file
0,0 → 1,195
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.EditPanelHolder;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.emaxx.bpeldesigner.input.Tableable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL Partner element, BPEL Partner Nodes can be converted to this class.
* This class supports certain modifying attributes and elements and contains a JPanel
* for editing values graphically. This class can be saved to a BPEL Node.
*/
public class Partner extends ExtensibleElements implements Tableable, EditPanelHolder {
 
private SimplePartnerLinks m_SimplePartnerLinks = new SimplePartnerLinks();
private NCName m_Name = new NCName();
 
public Partner() {
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_Partner the instance with the data that should be updated into this instance
*/
public void update(Partner a_Partner) {
super.update(a_Partner);
getName().update((a_Partner.getName()));
m_SimplePartnerLinks = (a_Partner.getSimplePartnerLinks());
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Tableable#getRow()
*/
public Vector getRow() {
Vector l_Vector = new Vector();
l_Vector.add(m_Name.toString());
return l_Vector;
}
 
public static Vector getColumnNames() {
Vector l_Vector = new Vector();
l_Vector.add("Name*");
return l_Vector;
}
 
public void addSimplePartnerLink(SimplePartnerLink a_SimplePartnerLink) {
m_SimplePartnerLinks.addSimplePartnerLink(a_SimplePartnerLink);
}
 
public SimplePartnerLinks getSimplePartnerLinks() {
return m_SimplePartnerLinks;
}
 
public NCName getName() {
return m_Name;
}
 
public void setSimplePartnerLinks(SimplePartnerLinks a_SimplePartnerLinks) {
m_SimplePartnerLinks = a_SimplePartnerLinks;
return;
}
 
public void setName(NCName a_Name) {
m_Name = a_Name;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NamedNodeMap attributes = a_Node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node current = attributes.item(i);
l_CurrentName = current.getNodeName();
l_CurrentValue = current.getNodeValue();
 
if (l_CurrentName.equals("name")) {
setName(new NCName(l_CurrentValue));
}
}
NodeList children = a_Node.getChildNodes();
if (children != null) {
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_TempNodeName.equals("partnerLink")) {
SimplePartnerLink l_SimplePartnerLink = new SimplePartnerLink();
l_SimplePartnerLink.handleParse(children.item(i));
addSimplePartnerLink(l_SimplePartnerLink);
}
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#checkEditPanel()
*/
public String checkEditPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getAddPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getAddPanel(CustomTable a_CustomTable) {
TabbedDialog l_EditPanel = new TabbedDialog("Partner", this, this, a_CustomTable, true);
l_EditPanel.addAttribute(this.getName(), "Name*");
l_EditPanel.addTab(m_SimplePartnerLinks);
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getSelectedEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getSelectedEditPanel(CustomTable a_CustomTable) {
Partner l_Partner = (Partner) this.clone();
TabbedDialog l_EditPanel = new TabbedDialog("Partner", l_Partner, this, a_CustomTable,
false);
l_EditPanel.addAttribute(l_Partner.getName(), "Name*");
l_EditPanel.addTab(m_SimplePartnerLinks);
return l_EditPanel;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#saveEditPanel(java.lang.Object)
*/
public void saveEditPanel(Object a_PartnerClone) {
if (a_PartnerClone instanceof Partner) {
Partner l_Partner = (Partner) a_PartnerClone;
m_Name = l_Partner.getName();
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.EditPanelHolder#getShowEditPanel(org.emaxx.bpeldesigner.input.ShowPanel)
*/
public TabbedDialog getShowEditPanel(ShowPanel a_ShowPanel) {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("partner");
addXMLattribute(l_Element, "name", getName().toXML());
Enumeration l_Enum = getSimplePartnerLinks().getSimplePartnerLinks().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element,
((SimplePartnerLink) l_Enum.nextElement()).writeToXML(a_Document));
}
return l_Element;
}
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Namespaces.java
New file
0,0 → 1,137
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.io.Serializable;
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.bpel.framework.adv.DeepCopy;
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.Editable;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
 
/**
* Namespaces is a class which helps to manage the multiple namespaces that
* the BPEL Process can contain
*/
public class Namespaces implements Editable, Cloneable, Serializable {
 
private Vector m_Namespaces = new Vector();
 
public Namespaces() {
super();
}
 
public void addNamespace(Namespace a_Namespace) {
m_Namespaces.add(a_Namespace);
}
 
public Vector getNamespaces() {
return m_Namespaces;
}
 
public void setNamespaces(Vector a_Namespaces) {
m_Namespaces = a_Namespaces;
return;
}
 
public Object clone() {
try {
return DeepCopy.deepCopy(this);
} catch (Exception e) {
System.out.println("Caught an exception while cloning");
return null;
}
}
 
public void update(Namespaces a_Namespaces) {
m_Namespaces.removeAllElements();
Enumeration l_Enum = a_Namespaces.getNamespaces().elements();
while (l_Enum.hasMoreElements()) {
addNamespace((Namespace) l_Enum.nextElement());
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getEditPanel(CustomTable a_CustomTable) {
int l_RowNr = a_CustomTable.getSelectedRow();
if (l_RowNr >= 0) {
return ((Namespace) m_Namespaces.get(l_RowNr)).getSelectedEditPanel(a_CustomTable);
} else {
return null;
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveEditPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveEditPanel(TabbedDialog a_TabbedDialog) {
Namespace l_Namespace = (Namespace) a_TabbedDialog.getEditPanelHolderOriginal();
l_Namespace.update((Namespace) a_TabbedDialog.getEditPanelHolderClone());
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveAddPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveAddPanel(TabbedDialog a_TabbedDialog) {
Namespace l_Namespace = (Namespace) a_TabbedDialog.getEditPanelHolderOriginal();
l_Namespace.update((Namespace) a_TabbedDialog.getEditPanelHolderClone());
addNamespace(l_Namespace);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditName()
*/
public String getEditName() {
return "Namespaces";
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getPanelTable()
*/
public CustomTable getPanelTable() {
CustomTable l_NamespacesTable = new CustomTable(this);
l_NamespacesTable.addColumnNames(Namespace.getColumnNames());
l_NamespacesTable.setRows(m_Namespaces);
l_NamespacesTable.updateTable();
return l_NamespacesTable;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getNewPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getNewPanel(CustomTable a_CustomTable) {
Namespace l_Namespace = new Namespace();
return l_Namespace.getAddPanel(a_CustomTable);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/KeyClassType.java
New file
0,0 → 1,58
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
/**
* This class returns the corresponding Object for a BPEL-ActivityGroup name String
*/
public class KeyClassType {
 
private String m_Key = new String();
private int m_ClassType;
 
/**
* Returns the unique int value of this type
* @return the unique int value of this type
*/
public int getClassType() {
return m_ClassType;
}
 
/**
* Constructs a KeyClassType
* @param a_Key the name of the element
* @param a_ClassType the unique class number
*/
public KeyClassType(String a_Key, int a_ClassType) {
m_Key = a_Key;
m_ClassType = a_ClassType;
}
 
/**
* Returns whether a mapping is available of the specified name
* @param a_Key the name of the element
* @return whether a mapping is available of the specified name
*/
public boolean hasKey(String a_Key) {
return a_Key.equals(m_Key);
}
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Links.java
New file
0,0 → 1,173
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*
* Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.emaxx.bpeldesigner.bpel;
 
import java.util.Enumeration;
import java.util.Vector;
 
import org.emaxx.bpeldesigner.input.CustomTable;
import org.emaxx.bpeldesigner.input.Editable;
import org.emaxx.bpeldesigner.input.ShowPanel;
import org.emaxx.bpeldesigner.input.TabbedDialog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
 
/**
* Represents the BPEL Links element, BPEL Links Nodes can be converted to this class.
* This class supports certain modifying attributes and elements. This class can be saved to a BPEL Node.
* It contains a method to get the CustomTable, ie a list of links
*/
public class Links extends ExtensibleElements implements Editable {
 
private Vector m_Links = new Vector();
 
public Links() {
}
 
/**
* This method updates this instance with an instance of the same class, such that
* reference to this instance sub-elements remain intact
* @param a_Links the instance with the data that should be updated into this instance
*/
public void update(Links a_Links) {
m_Links.removeAllElements();
Enumeration l_Enum = a_Links.getLinks().elements();
while (l_Enum.hasMoreElements()) {
addLink((Link) l_Enum.nextElement());
}
}
 
public void addLink(Link a_Link) {
m_Links.add(a_Link);
return;
}
 
public Vector getLinks() {
return m_Links;
}
 
public void setLinks(Vector a_Links) {
m_Links = a_Links;
return;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#handleParse(org.w3c.dom.Node)
*/
public void handleParse(Node a_Node) {
super.handleParse(a_Node);
String l_CurrentName;
String l_CurrentValue;
 
NodeList children = a_Node.getChildNodes();
if (children != null) {
for (int i = 0; i < children.getLength(); i++) {
String l_TempNodeName = children.item(i).getNodeName();
if (l_TempNodeName.equals("link")) {
Link l_Link = new Link();
l_Link.handleParse(children.item(i));
addLink(l_Link);
}
}
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getEditPanel(CustomTable a_CustomTable) {
int l_RowNr = a_CustomTable.getSelectedRow();
if (l_RowNr >= 0) {
return ((Link) m_Links.get(l_RowNr)).getSelectedEditPanel(a_CustomTable);
} else {
return null;
}
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveEditPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveEditPanel(TabbedDialog a_TabbedDialog) {
Link l_Link = (Link) a_TabbedDialog.getEditPanelHolderOriginal();
l_Link.update((Link) a_TabbedDialog.getEditPanelHolderClone());
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#saveAddPanel(org.emaxx.bpeldesigner.input.TabbedDialog)
*/
public void saveAddPanel(TabbedDialog a_TabbedDialog) {
Link l_Link = (Link) a_TabbedDialog.getEditPanelHolderOriginal();
l_Link.update((Link) a_TabbedDialog.getEditPanelHolderClone());
addLink(l_Link);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getEditName()
*/
public String getEditName() {
return "Links";
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getPanelTable()
*/
public CustomTable getPanelTable() {
CustomTable l_LinksTable = new CustomTable(this);
l_LinksTable.addColumnNames(Link.getColumnNames());
l_LinksTable.setRows(m_Links);
l_LinksTable.updateTable();
return l_LinksTable;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getNewPanel(org.emaxx.bpeldesigner.input.CustomTable)
*/
public TabbedDialog getNewPanel(CustomTable a_CustomTable) {
Link l_Link = new Link();
return l_Link.getAddPanel(a_CustomTable);
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.Editable#getShowPanel()
*/
public ShowPanel getShowPanel() {
return null;
}
 
/* (non-Javadoc)
* @see org.emaxx.bpeldesigner.input.xml.ParseAble#writeToXML(org.w3c.dom.Document)
*/
public Element writeToXML(Document a_Document) {
Element l_Element = a_Document.createElement("links");
Enumeration l_Enum = getLinks().elements();
while (l_Enum.hasMoreElements()) {
addXMLChild(l_Element, ((Link) l_Enum.nextElement()).writeToXML(a_Document));
}
if (l_Element.hasChildNodes()) {
return l_Element;
} else {
return null;
}
}
 
}
/trunk/mobe/src/org/emaxx/bpeldesigner/bpel/Receive.java
New file
0,0 → 1,202
/*
* Copyright (c) 2004 eMAXX
*
* This file is part of the MOBE (MidOffice BPEL Engine) designer.
*
* The MOBE designer is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* The MOBE designer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with the MOBE designer;
* if not, write to the
*