use of com.qwest.mbeng.MbengNode in project mdw-designer by CenturyLinkCloud.
the class BindingsSection method findBindingsNode.
private MbengNode findBindingsNode(Activity activity) {
String attrXml = activity.getActivityImpl().getAttrDescriptionXml();
FormatXml formatter = new FormatXml();
MbengDocumentClass mbengDocument = new MbengDocumentClass();
try {
formatter.load(mbengDocument, attrXml);
for (MbengNode currentNode = mbengDocument.getRootNode().getFirstChild(); currentNode != null; currentNode = currentNode.getNextSibling()) {
if (MappingEditor.TYPE_MAPPING.equals(currentNode.getName()) && PropertyEditor.SECTION_BINDINGS.equals(currentNode.getAttribute("SECTION")))
return currentNode;
}
} catch (MbengException ex) {
PluginMessages.uiError(getShell(), ex, "Parse Attr XML");
}
return null;
}
use of com.qwest.mbeng.MbengNode in project mdw-designer by CenturyLinkCloud.
the class BindingsSection method setSelection.
@Override
public void setSelection(WorkflowElement selection) {
activity = (Activity) selection;
mappingEditor.setElement(activity);
MbengNode bindingsNode = findBindingsNode(activity);
mappingEditor.setValueAttr(bindingsNode.getAttribute("NAME"));
mappingEditor.initValue();
mappingEditor.setEditable(!activity.isReadOnly() && !mappingEditor.getProcessVariables().isEmpty());
}
use of com.qwest.mbeng.MbengNode in project mdw-designer by CenturyLinkCloud.
the class FormDesignCanvas method deleteNode.
public void deleteNode(MbengNode node) throws Exception {
MbengNode parent = node.getParent();
parent.removeChild(node);
selected_node = null;
at_anchor = -1;
generator.deleteNode(parent, node);
repaint();
}
use of com.qwest.mbeng.MbengNode in project mdw-designer by CenturyLinkCloud.
the class FormDesignCanvas method objectAt.
private MbengNode objectAt(MbengNode node, int x, int y) {
MbengNode found = null;
Component widget = generator.getWidget(node);
if (widget == null)
return null;
Rectangle r = widget.getBounds();
if (!widget.isVisible())
return null;
if (widget == this) {
r.x = 0;
r.y = 0;
}
if (x < r.x || x > r.x + r.width || y < r.y || y > r.y + r.height)
return null;
for (MbengNode child = node.getFirstChild(); child != null; child = child.getNextSibling()) {
found = objectAt(child, x - r.x, y - r.y);
if (found != null)
return found;
}
return node;
}
use of com.qwest.mbeng.MbengNode in project mdw-designer by CenturyLinkCloud.
the class FormDesignCanvas method addNode.
public void addNode(String node_type, int x, int y) throws Exception {
MbengNode node = desc_doc.newNode(node_type, "", " ", ' ');
node.setAttribute(FormConstants.FORMATTR_LABEL, "New " + node_type);
MbengNode parent;
// if (menuEditor.isVisible()) {
// System.out.println("In menu editor up");
// Rectangle rect = menuEditor.getBounds();
// if (x<rect.x || x>rect.x+rect.width || y<rect.y || y>rect.y+rect.height) {
// throw new Exception("You must drop into menu dialog when it is up");
// }
// parent = menuEditor.getMenuNode();
// }
// else
{
parent = objectAt(desc_doc.getRootNode(), x, y);
while (!isContainer(parent)) parent = parent.getParent();
}
if (!checkChildCompatible(parent.getName(), node_type)) {
throw new Exception(node_type + " cannot be in a " + parent.getName());
}
parent.appendChild(node);
selected_node = node;
// System.out.println("add this to " + parent.getAttribute("NAME") + " " + x + " " + y);
Container container = (Container) generator.getWidget(parent);
Container p = container;
while (p != this) {
x -= p.getX();
y -= p.getY();
p = p.getParent();
}
// System.out.println("Translated xy " + x + " " +y);
generator.create_component(node, x - 60, x, y, container);
at_anchor = -1;
requestFocus();
repaint();
}
Aggregations