Search in sources :

Example 11 with MbengNode

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;
}
Also used : MbengException(com.qwest.mbeng.MbengException) MbengNode(com.qwest.mbeng.MbengNode) FormatXml(com.qwest.mbeng.FormatXml) MbengDocumentClass(com.qwest.mbeng.MbengDocumentClass)

Example 12 with MbengNode

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());
}
Also used : MbengNode(com.qwest.mbeng.MbengNode)

Example 13 with MbengNode

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();
}
Also used : MbengNode(com.qwest.mbeng.MbengNode)

Example 14 with MbengNode

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;
}
Also used : MbengNode(com.qwest.mbeng.MbengNode)

Example 15 with MbengNode

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();
}
Also used : MbengNode(com.qwest.mbeng.MbengNode)

Aggregations

MbengNode (com.qwest.mbeng.MbengNode)25 MbengException (com.qwest.mbeng.MbengException)10 JTablePlus (com.centurylink.mdw.designer.utils.JTablePlus)3 Component (java.awt.Component)3 MenuButton (com.centurylink.mdw.designer.utils.SwingFormGenerator.MenuButton)2 DomDocument (com.qwest.mbeng.DomDocument)2 FormatDom (com.qwest.mbeng.FormatDom)2 Container (java.awt.Container)2 ArrayList (java.util.ArrayList)2 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)1 CallURL (com.centurylink.mdw.common.utilities.form.CallURL)1 FormActionParser (com.centurylink.mdw.common.utilities.form.FormActionParser)1 SelectOption (com.centurylink.mdw.designer.utils.SwingFormGenerator.SelectOption)1 FormDataDocument (com.centurylink.mdw.model.FormDataDocument)1 ActivityVO (com.centurylink.mdw.model.value.activity.ActivityVO)1 AttributeVO (com.centurylink.mdw.model.value.attribute.AttributeVO)1 DocumentReference (com.centurylink.mdw.model.value.variable.DocumentReference)1 DomNode (com.qwest.mbeng.DomNode)1 FormatXml (com.qwest.mbeng.FormatXml)1 MbengDocumentClass (com.qwest.mbeng.MbengDocumentClass)1