Search in sources :

Example 6 with MbengNode

use of com.qwest.mbeng.MbengNode in project mdw-designer by CenturyLinkCloud.

the class FormPanel method focusLost.

public void focusLost(FocusEvent e) {
    Component src = e.getComponent();
    if (src instanceof JTextField) {
        JTextField textfield = (JTextField) src;
        MbengNode node = canvas.getGenerator().getNode(src);
        if (node != null)
            setDataValue(node, textfield.getText());
    }
}
Also used : MbengNode(com.qwest.mbeng.MbengNode) Component(java.awt.Component) JTextField(javax.swing.JTextField)

Example 7 with MbengNode

use of com.qwest.mbeng.MbengNode in project mdw-designer by CenturyLinkCloud.

the class FormPanel method actionPerformed.

public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    Component src = (Component) e.getSource();
    if (cmd.equals(FormConstants.ACTION_MENU)) {
        MenuButton button = (MenuButton) src;
        JPopupMenu menu = button.getMenu();
        menu.show(src, src.getWidth() - 10, src.getHeight() - 10);
    } else if (cmd.equals(SwingFormGenerator.ACTION_TABBING)) {
        JTabbedPane tabbedPane = (JTabbedPane) src;
        MbengNode node = canvas.getGenerator().getNode(tabbedPane);
        String id = node.getAttribute(FormConstants.FORMATTR_ID);
        String datapath = node.getAttribute(FormConstants.FORMATTR_DATA);
        if (datapath == null || datapath.length() == 0)
            datapath = "__mdwtabindex__" + id;
        String paginator = node.getAttribute(FormConstants.FORMATTR_ACTION);
        if (paginator == null)
            paginator = "com.centurylink.mdw.listener.formaction.TabChanger";
        int index = e.getID();
        String action = paginator + "?action=tabbing&tabs=" + id + "&tab=" + index + "&data=" + datapath;
        performGenericAction(action);
    } else if (cmd.equals(JTablePlus.ACTION_ENGINE_CALL)) {
        String action = ((JTablePlus) src).getEngineCallAction();
        performGenericAction(action);
    } else {
        MbengNode node = canvas.getGenerator().getNode(src);
        performJavaScriptAction(e, src, cmd, node);
    }
}
Also used : JTabbedPane(javax.swing.JTabbedPane) MbengNode(com.qwest.mbeng.MbengNode) MenuButton(com.centurylink.mdw.designer.utils.SwingFormGenerator.MenuButton) JTablePlus(com.centurylink.mdw.designer.utils.JTablePlus) Component(java.awt.Component) JPopupMenu(javax.swing.JPopupMenu)

Example 8 with MbengNode

use of com.qwest.mbeng.MbengNode in project mdw-designer by CenturyLinkCloud.

the class TestDataFilter method evaluateExpression.

private String evaluateExpression(String exp, MbengDocument refdata) {
    try {
        if (exp.startsWith("/")) {
            // assuming XPath expression
            XmlPath xpathobj = new XmlPath(exp);
            MbengNode node = xpathobj.findNode(refdata);
            return node == null ? null : node.getValue();
        } else {
            MbengRuleSet ruleset = new MyRuleSet("filter_exp", MbengRuleSet.RULESET_EXPR);
            ruleset.parse(exp);
            MbengRuntime runtime = new MbengRuntime(ruleset, new StreamLogger(System.out));
            runtime.bind("$", refdata);
            return runtime.evaluate();
        }
    } catch (MbengException e) {
        log.println("Exception in evaluating expression in test data filter " + exp + ": " + e.getMessage());
        return null;
    }
}
Also used : XmlPath(com.qwest.mbeng.XmlPath) MbengRuntime(com.qwest.mbeng.MbengRuntime) MbengRuleSet(com.qwest.mbeng.MbengRuleSet) MbengException(com.qwest.mbeng.MbengException) StreamLogger(com.qwest.mbeng.StreamLogger) MbengNode(com.qwest.mbeng.MbengNode)

Example 9 with MbengNode

use of com.qwest.mbeng.MbengNode in project mdw-designer by CenturyLinkCloud.

the class SwingFormGenerator method setListSelection.

private void setListSelection(MbengNode node, SelectOption[] options) throws Exception {
    String dataassoc = node.getAttribute(FormConstants.FORMATTR_DATA);
    MbengNode valuesNode = dataassoc == null ? null : dataxml.getNode(dataassoc);
    if (valuesNode == null)
        return;
    MbengNode one = valuesNode.getFirstChild();
    while (one != null) {
        String value = one.getName();
        for (int i = 0; i < options.length; i++) {
            if (options[i].value.equals(value)) {
                options[i].selected = true;
                break;
            }
        }
        one = one.getNextSibling();
    }
}
Also used : MbengNode(com.qwest.mbeng.MbengNode)

Example 10 with MbengNode

use of com.qwest.mbeng.MbengNode in project mdw-designer by CenturyLinkCloud.

the class SwingFormGenerator method create_children.

private void create_children(MbengNode node, Container container) throws Exception {
    int vx_default = 120;
    int max_pw = 0, max_ph = 5;
    for (MbengNode child = node.getFirstChild(); child != null; child = child.getNextSibling()) {
        Rectangle r = create_component(child, lx_default, vx_default, max_ph, container);
        if (r != null) {
            if (r.x + r.width + 5 > max_pw)
                max_pw = r.x + r.width + 5;
            if (r.y + r.height + 5 > max_ph)
                max_ph = r.y + r.height + 5;
        }
    }
}
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