use of com.qwest.mbeng.MbengNode in project mdw-designer by CenturyLinkCloud.
the class SwingFormGenerator method getValue.
private String getValue(MbengNode node) {
String value = null;
String dataassoc = node.getAttribute(FormConstants.FORMATTR_DATA);
MbengNode vnode = dataassoc == null ? null : dataxml.getNode(dataassoc);
if (vnode != null)
value = vnode.getValue();
else
value = null;
if (value == null || value.length() == 0) {
String av = node.getAttribute(FormConstants.FORMATTR_AUTOVALUE);
if (av != null && av.length() > 0) {
// String rulename = node.getAttribute(FormConstants.FORMATTR_ID) + "_DEFAULT";
// try {
// value = this.evaluateExpression(rulename, av, dataxml);
// } catch (MbengException e) {
// // return null if data element is not there
// // rule syntax error should be detected at design time?
// value = null;
// }
// this makes it the same as JSF version
value = av;
try {
dataxml.setValue(dataassoc, value, FormDataDocument.KIND_FIELD);
} catch (MbengException e) {
}
}
}
return value;
}
use of com.qwest.mbeng.MbengNode in project mdw-designer by CenturyLinkCloud.
the class SwingFormGenerator method saveGeoInfo.
public void saveGeoInfo(Component component) {
MbengNode node;
if (component instanceof JLabel) {
node = labelmap.get(component);
this.saving_lr(node, component.getBounds());
if (node.getName().equals(FormConstants.WIDGET_TEXTAREA)) {
String isStatic = node.getAttribute(FormConstants.FORMATTR_IS_STATIC);
if (isStatic != null && isStatic.equalsIgnoreCase("true")) {
this.saving_vr(node, component.getBounds());
Component textarea_pane = nodewidget.get(getDomNode(node));
textarea_pane.setBounds(component.getBounds());
}
}
} else {
node = widgetmap.get(component);
this.saving_vr(node, component.getBounds());
}
}
use of com.qwest.mbeng.MbengNode in project mdw-designer by CenturyLinkCloud.
the class JTablePlus method performSorting.
private void performSorting(ActionEvent e) {
int columnIndex = e.getID();
boolean descending = columnIndex < 0;
if (columnIndex < 0)
columnIndex = -columnIndex - 1;
else
columnIndex = columnIndex - 1;
if (!model.isColumnSortable(columnIndex)) {
e.setSource(null);
return;
}
String sorton = getColumnName(columnIndex);
if (sorton == null)
return;
if (descending)
sorton = "-" + sorton;
MbengNode metanode = datadoc.getNode(datapath + "_META");
try {
if (metanode != null)
datadoc.setValue(metanode, "sort_on", sorton);
} catch (MbengException e1) {
}
String action = paginator + "?action=paging&table=" + datapath + "&meta=" + datapath + "_META&topage=S&sorton=" + sorton;
call_engine(action);
}
use of com.qwest.mbeng.MbengNode in project mdw-designer by CenturyLinkCloud.
the class JTablePlus method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
if (actionListener == null)
return;
if (cmd.equals(JTablePlus.ACTION_FIRST)) {
String action = paginator + "?action=paging&table=" + datapath + "&meta=" + datapath + "_META&topage=F";
call_engine(action);
} else if (cmd.equals(JTablePlus.ACTION_PREV)) {
String action = paginator + "?action=paging&table=" + datapath + "&meta=" + datapath + "_META&topage=P";
call_engine(action);
} else if (cmd.equals(JTablePlus.ACTION_NEXT)) {
String action = paginator + "?action=paging&table=" + datapath + "&meta=" + datapath + "_META&topage=N";
call_engine(action);
} else if (cmd.equals(JTablePlus.ACTION_LAST)) {
String action = paginator + "?action=paging&table=" + datapath + "&meta=" + datapath + "_META&topage=L";
call_engine(action);
} else if (cmd.equals(JTablePlus.ACTION_GOTO)) {
try {
int row = Integer.parseInt(goto_row.getText());
MbengNode metanode = datadoc.getNode(datapath + "_META");
String v = datadoc.getValue(metanode, "total_rows");
int total_rows = v == null ? model.getRowCount() : Integer.parseInt(v);
if (row >= 1 && row <= total_rows) {
datadoc.setValue(metanode, "start_row", Integer.toString(row));
String action = paginator + "?action=paging&table=" + datapath + "&meta=" + datapath + "_META&topage=S";
call_engine(action);
}
} catch (Exception ex) {
ex.printStackTrace();
}
} else if (cmd.equals(TableSorter.ACTION_TABLE_SORTING)) {
performSorting(e);
}
}
use of com.qwest.mbeng.MbengNode in project mdw-designer by CenturyLinkCloud.
the class JTablePlus method setData.
public void setData(FormDataDocument dataxml, String datapath) {
this.datadoc = dataxml;
this.datapath = datapath;
MbengNode datanode = dataxml.getNode(datapath);
MbengNode metanode = dataxml.getNode(datapath + "_META");
model.setData(datanode);
if (metanode != null) {
String sorton = datadoc.getValue(metanode, "sort_on");
if (sorton != null) {
boolean descending = sorton.startsWith("-");
if (descending)
sorton = sorton.substring(1);
setSortingStatus(sorton, descending);
}
String selected_str = datadoc.getValue(metanode, "selected");
if (!StringHelper.isEmpty(selected_str)) {
String[] rows_str = selected_str.split(",");
int firstRow = Integer.parseInt(rows_str[0]);
try {
if (model.getRowCount() > firstRow) {
table.setRowSelectionInterval(firstRow, firstRow);
datadoc.setValue(metanode, "selected", rows_str[0]);
} else
datadoc.setValue(metanode, "selected", null);
} catch (MbengException e) {
}
}
if (rowrange != null) {
int nrows = model.getRowCount();
if (nrows == 0) {
rowrange.setText("No rows");
button_first.setEnabled(false);
button_prev.setEnabled(false);
button_next.setEnabled(false);
button_last.setEnabled(false);
button_goto.setEnabled(false);
} else {
String v = datadoc.getValue(metanode, "start_row");
int start_row = v == null ? 1 : Integer.parseInt(v);
v = datadoc.getValue(metanode, "total_rows");
int total_rows = v == null ? nrows : Integer.parseInt(v);
rowrange.setText("" + start_row + " - " + (start_row + nrows - 1) + " of " + total_rows);
button_first.setEnabled(start_row > 1);
button_prev.setEnabled(start_row > 1);
button_next.setEnabled(start_row + nrows - 1 < total_rows);
button_last.setEnabled(start_row + nrows - 1 < total_rows);
button_goto.setEnabled(nrows < total_rows);
}
}
}
// for some reason w/o the following, layout was not done and screen shows blank until resized
super.doLayout();
for (int k = this.getComponentCount(); k > 0; k--) {
Component comp = this.getComponent(k - 1);
if (comp instanceof Container)
((Container) comp).doLayout();
}
}
Aggregations