Search in sources :

Example 6 with SimpleListModel

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");
}
Also used : SimpleListModel(org.adempiere.webui.component.SimpleListModel) ColumnInfo(org.compiere.minigrid.ColumnInfo)

Example 7 with SimpleListModel

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();
}
Also used : WListbox(org.adempiere.webui.component.WListbox) SimpleListModel(org.adempiere.webui.component.SimpleListModel) Timestamp(java.sql.Timestamp)

Example 8 with SimpleListModel

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);
}
Also used : SimpleListModel(org.adempiere.webui.component.SimpleListModel) KeyNamePair(org.compiere.util.KeyNamePair) MTree(org.compiere.model.MTree)

Example 9 with SimpleListModel

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);
}
Also used : Listheader(org.zkoss.zul.Listheader) Listhead(org.zkoss.zul.Listhead) SimpleListModel(org.adempiere.webui.component.SimpleListModel)

Aggregations

SimpleListModel (org.adempiere.webui.component.SimpleListModel)9 ResultSet (java.sql.ResultSet)2 ArrayList (java.util.ArrayList)2 Vector (java.util.Vector)2 Listhead (org.zkoss.zul.Listhead)2 Listheader (org.zkoss.zul.Listheader)2 PreparedStatement (java.sql.PreparedStatement)1 Timestamp (java.sql.Timestamp)1 Set (java.util.Set)1 ListItem (org.adempiere.webui.component.ListItem)1 Listbox (org.adempiere.webui.component.Listbox)1 SimpleTreeModel (org.adempiere.webui.component.SimpleTreeModel)1 WListbox (org.adempiere.webui.component.WListbox)1 ColumnInfo (org.compiere.minigrid.ColumnInfo)1 MTable (org.compiere.model.MTable)1 MTree (org.compiere.model.MTree)1 KeyNamePair (org.compiere.util.KeyNamePair)1 AuFocus (org.zkoss.zk.au.out.AuFocus)1 DefaultTreeNode (org.zkoss.zul.DefaultTreeNode)1 Treeitem (org.zkoss.zul.Treeitem)1