use of org.adempiere.webui.component.SimpleListModel in project adempiere by adempiere.
the class WMatch method dynInit.
// jbInit
/**
* Dynamic Init.
* Table Layout, Visual, Listener
*/
private void dynInit() {
ColumnInfo[] layout = new ColumnInfo[] { new ColumnInfo(" ", ".", IDColumn.class, false, false, ""), // 1
new ColumnInfo(Msg.translate(Env.getCtx(), "DocumentNo"), ".", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Date"), ".", Timestamp.class), // 3
new ColumnInfo(Msg.translate(Env.getCtx(), "C_BPartner_ID"), ".", KeyNamePair.class, "."), new ColumnInfo(Msg.translate(Env.getCtx(), "Line"), ".", KeyNamePair.class, "."), // 5
new ColumnInfo(Msg.translate(Env.getCtx(), "M_Product_ID"), ".", KeyNamePair.class, "."), new ColumnInfo(Msg.translate(Env.getCtx(), "Qty"), ".", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Matched"), ".", Double.class) };
xMatchedTable.prepareTable(layout, "", "", false, "");
xMatchedToTable.prepareTable(layout, "", "", true, "");
matchFrom.setSelectedIndex(0);
// Listener
matchFrom.addActionListener(this);
matchTo.addActionListener(this);
bSearch.addActionListener(this);
xMatchedTable.addEventListener(Events.ON_SELECT, this);
xMatchedToTable.getModel().addTableModelListener(this);
bProcess.addActionListener(this);
sameBPartner.addActionListener(this);
sameProduct.addActionListener(this);
sameQty.addActionListener(this);
// Init Yvonne
String selection = (String) matchFrom.getSelectedItem().getValue();
SimpleListModel model = new SimpleListModel(cmd_matchFrom((String) matchFrom.getSelectedItem().getLabel()));
matchTo.setItemRenderer(model);
matchTo.setModel(model);
// Set Title
xMatchedBorder.setValue(selection);
// Reset Table
xMatchedTable.setRowCount(0);
// sync To
matchTo.setSelectedIndex(0);
cmd_matchTo();
statusBar.setStatusLine("");
statusBar.setStatusDB("0");
}
use of org.adempiere.webui.component.SimpleListModel in project adempiere by adempiere.
the class WMatch method onEvent.
// dispose
/**************************************************************************
* Action Listener
* @param e event
*/
public void onEvent(Event e) {
Integer product = onlyProduct.getValue() != null ? (Integer) onlyProduct.getValue() : null;
Integer vendor = onlyVendor.getValue() != null ? (Integer) onlyVendor.getValue() : null;
Timestamp from = dateFrom.getValue() != null ? (Timestamp) dateFrom.getValue() : null;
Timestamp to = dateTo.getValue() != null ? (Timestamp) dateTo.getValue() : null;
if (e.getTarget() == matchFrom) {
//cmd_matchFrom((String)matchFrom.getSelectedItem().getLabel());
String selection = (String) matchFrom.getSelectedItem().getValue();
SimpleListModel model = new SimpleListModel(cmd_matchFrom((String) matchFrom.getSelectedItem().getLabel()));
matchTo.setItemRenderer(model);
matchTo.setModel(model);
// Set Title
xMatchedBorder.setValue(selection);
// Reset Table
xMatchedTable.setRowCount(0);
// sync To
matchTo.setSelectedIndex(0);
cmd_matchTo();
} else if (e.getTarget() == matchTo)
cmd_matchTo();
else if (e.getTarget() == bSearch) {
//cmd_search();
xMatchedTable = (WListbox) cmd_search(xMatchedTable, matchFrom.getSelectedIndex(), (String) matchTo.getSelectedItem().getLabel(), product, vendor, from, to, matchMode.getSelectedIndex() == MODE_MATCHED);
xMatched.setValue(Env.ZERO);
// Status Info
statusBar.setStatusLine(matchFrom.getSelectedItem().getLabel() + "# = " + xMatchedTable.getRowCount(), xMatchedTable.getRowCount() == 0);
statusBar.setStatusDB("0");
cmd_searchTo();
} else if (e.getTarget() == bProcess) {
//cmd_process();
cmd_process(xMatchedTable, xMatchedToTable, matchMode.getSelectedIndex(), matchFrom.getSelectedIndex(), matchTo.getSelectedItem(), m_xMatched);
xMatchedTable = (WListbox) cmd_search(xMatchedTable, matchFrom.getSelectedIndex(), (String) matchTo.getSelectedItem().getLabel(), product, vendor, from, to, matchMode.getSelectedIndex() == MODE_MATCHED);
xMatched.setValue(Env.ZERO);
// Status Info
statusBar.setStatusLine(matchFrom.getSelectedItem().getLabel() + "# = " + xMatchedTable.getRowCount(), xMatchedTable.getRowCount() == 0);
statusBar.setStatusDB("0");
cmd_searchTo();
} else if (e.getTarget() == sameBPartner || e.getTarget() == sameProduct || e.getTarget() == sameQty)
cmd_searchTo();
else if (AEnv.contains(xMatchedTable, e.getTarget()))
cmd_searchTo();
}
use of org.adempiere.webui.component.SimpleListModel in project adempiere by adempiere.
the class WTreeMaintenance method action_loadTree.
// actionPerformed
/**
* Action: Fill Tree with all nodes
*/
private void action_loadTree() {
KeyNamePair tree = treeField.getSelectedItem().toKeyNamePair();
log.info("Tree=" + tree);
if (tree.getKey() <= 0) {
SimpleListModel tmp = new SimpleListModel();
centerList.setItemRenderer(tmp);
centerList.setModel(tmp);
return;
}
// Tree
m_tree = new MTree(Env.getCtx(), tree.getKey(), null);
cbAllNodes.setSelected(m_tree.isAllNodes());
bAddAll.setEnabled(!m_tree.isAllNodes());
bAdd.setEnabled(!m_tree.isAllNodes());
bDelete.setEnabled(!m_tree.isAllNodes());
bDeleteAll.setEnabled(!m_tree.isAllNodes());
//
// fully qualified
String fromClause = m_tree.getSourceTableName(false);
String columnNameX = m_tree.getSourceTableName(true);
String actionColor = m_tree.getActionColorName();
// List
SimpleListModel model = new SimpleListModel();
ArrayList<ListItem> items = getTreeItemData();
for (ListItem item : items) model.addElement(item);
log.config("#" + model.getSize());
centerList.setItemRenderer(model);
centerList.setModel(model);
// Tree
try {
centerTree.setModel(null);
} catch (Exception e) {
}
if (centerTree.getTreecols() != null)
centerTree.getTreecols().detach();
if (centerTree.getTreefoot() != null)
centerTree.getTreefoot().detach();
if (centerTree.getTreechildren() != null)
centerTree.getTreechildren().detach();
SimpleTreeModel.initADTree(centerTree, m_tree.getAD_Tree_ID(), m_WindowNo);
}
use of org.adempiere.webui.component.SimpleListModel in project adempiere by adempiere.
the class WRecordInfo method dynInit.
// jbInit
/**
* Dynamic Init
*/
private void dynInit() {
Listhead listhead = new Listhead();
listhead.setSizable(true);
// Add Columns
for (String columnName : getColumnNames()) {
Listheader listheader = new Listheader(columnName.replaceAll("[&]", ""));
listhead.appendChild(listheader);
}
// Instance Table
table.appendChild(listhead);
SimpleListModel model = new SimpleListModel(getData());
table.setItemRenderer(model);
table.setModel(model);
}
Aggregations