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());
}
}
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);
}
}
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;
}
}
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();
}
}
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;
}
}
}
Aggregations