use of org.adempiere.webui.component.ListModelTable in project adempiere by adempiere.
the class WCreateFromShipmentUI method checkProductUsingUPC.
/**
* Checks the UPC value and checks if the UPC matches any of the products in the
* list.
*/
private void checkProductUsingUPC() {
String upc = upcField.getDisplay();
//DefaultTableModel model = (DefaultTableModel) dialog.getMiniTable().getModel();
ListModelTable model = (ListModelTable) v_CreateFromPanel.getWListbox().getModel();
// Lookup UPC
List<MProduct> products = MProduct.getByUPC(Env.getCtx(), upc, null);
for (MProduct product : products) {
int row = findProductRow(product.get_ID());
if (row >= 0) {
BigDecimal qty = (BigDecimal) model.getValueAt(row, 1);
model.setValueAt(qty, row, 1);
model.setValueAt(Boolean.TRUE, row, 0);
model.updateComponent(row, row);
}
}
upcField.setValue("");
upcField.setHasFocus(true);
}
use of org.adempiere.webui.component.ListModelTable in project adempiere by adempiere.
the class WCreateFromShipmentUI method loadTableOIS.
/**
* Load Order/Invoice/Shipment data into Table
* @param data data
*/
protected void loadTableOIS(Vector<?> data) {
v_CreateFromPanel.getWListbox().clear();
// Remove previous listeners
v_CreateFromPanel.getWListbox().getModel().removeTableModelListener(v_CreateFromPanel);
// Set Model
ListModelTable model = new ListModelTable(data);
model.addTableModelListener(v_CreateFromPanel);
v_CreateFromPanel.getWListbox().setData(model, getOISColumnNames());
//
configureMiniTable(v_CreateFromPanel.getWListbox());
}
use of org.adempiere.webui.component.ListModelTable in project adempiere by adempiere.
the class WTreeBOM method loadTableBOM.
private void loadTableBOM() {
// Header Info
Vector<String> columnNames = new Vector<String>();
// 0
columnNames.add(Msg.translate(getCtx(), "Select"));
// 1
columnNames.add(Msg.translate(getCtx(), "IsActive"));
// 2
columnNames.add(Msg.translate(getCtx(), "Line"));
// 3
columnNames.add(Msg.translate(getCtx(), "ValidFrom"));
// 4
columnNames.add(Msg.translate(getCtx(), "ValidTo"));
// 5
columnNames.add(Msg.translate(getCtx(), "M_Product_ID"));
// 6
columnNames.add(Msg.translate(getCtx(), "C_UOM_ID"));
// 7
columnNames.add(Msg.translate(getCtx(), "IsQtyPercentage"));
// 8
columnNames.add(Msg.translate(getCtx(), "QtyBatch"));
// 9
columnNames.add(Msg.translate(getCtx(), "QtyBOM"));
// 10
columnNames.add(Msg.translate(getCtx(), "IsCritical"));
// 11
columnNames.add(Msg.translate(getCtx(), "LeadTimeOffset"));
// 12
columnNames.add(Msg.translate(getCtx(), "Assay"));
// 13
columnNames.add(Msg.translate(getCtx(), "Scrap"));
// 14
columnNames.add(Msg.translate(getCtx(), "IssueMethod"));
// 15
columnNames.add(Msg.translate(getCtx(), "BackflushGroup"));
// 16
columnNames.add(Msg.translate(getCtx(), "Forecast"));
tableBOM.clear();
// Remove previous listeners
tableBOM.getModel().removeTableModelListener(this);
// Set Model
ListModelTable model = new ListModelTable(dataBOM);
model.addTableModelListener(this);
tableBOM.setData(model, columnNames);
// 0 Select
tableBOM.setColumnClass(0, Boolean.class, false);
// 1 IsActive
tableBOM.setColumnClass(1, Boolean.class, false);
// 2 Line
tableBOM.setColumnClass(2, Integer.class, false);
// 3 ValidFrom
tableBOM.setColumnClass(3, Timestamp.class, false);
// 4 ValidTo
tableBOM.setColumnClass(4, Timestamp.class, false);
// 5 M_Product_ID
tableBOM.setColumnClass(5, KeyNamePair.class, false);
// 6 C_UOM_ID
tableBOM.setColumnClass(6, KeyNamePair.class, false);
// 7 QtyPorcentage
tableBOM.setColumnClass(7, Boolean.class, false);
// 8 BatchPercent
tableBOM.setColumnClass(8, BigDecimal.class, false);
// 9 QtyBOM
tableBOM.setColumnClass(9, BigDecimal.class, false);
// 10 IsCritical
tableBOM.setColumnClass(10, Boolean.class, false);
// 11 LTOffSet
tableBOM.setColumnClass(11, BigDecimal.class, false);
// 12 Assay
tableBOM.setColumnClass(12, BigDecimal.class, false);
// 13 Scrap
tableBOM.setColumnClass(13, Integer.class, false);
// 14 IssueMethod
tableBOM.setColumnClass(14, String.class, false);
// 15 BackflushGroup
tableBOM.setColumnClass(15, String.class, false);
// 16 Forecast
tableBOM.setColumnClass(16, BigDecimal.class, false);
tableBOM.autoSize();
}
use of org.adempiere.webui.component.ListModelTable in project adempiere by adempiere.
the class WExpressReceiptScanBarUI method dynamicInitialise.
/**
* Initialises the dynamic components of the form.
* <li>Gets defaults for primary AcctSchema
* <li>Creates Table with Accounts
*/
private void dynamicInitialise() {
ListModelTable model = new ListModelTable();
productTable.setData(model, getColumnNames());
setColumnClass(productTable);
return;
}
use of org.adempiere.webui.component.ListModelTable in project adempiere by adempiere.
the class WAcctViewer method actionQuery.
// sortAddItem
/**
* Query
*/
private void actionQuery() {
// Parameter Info
StringBuffer para = new StringBuffer();
// Reset Selection Data
m_data.C_AcctSchema_ID = 0;
m_data.AD_Org_ID = 0;
// Save Selection Choices
Listitem listitem = selAcctSchema.getSelectedItem();
KeyNamePair kp = null;
if (listitem != null)
kp = (KeyNamePair) listitem.getValue();
if (kp != null)
m_data.C_AcctSchema_ID = kp.getKey();
para.append("C_AcctSchema_ID=").append(m_data.C_AcctSchema_ID);
listitem = selPostingType.getSelectedItem();
ValueNamePair vp = null;
if (listitem != null)
vp = (ValueNamePair) listitem.getValue();
else
return;
m_data.PostingType = vp.getValue();
para.append(", PostingType=").append(m_data.PostingType);
// Document
m_data.documentQuery = selDocument.isChecked();
para.append(", DocumentQuery=").append(m_data.documentQuery);
if (selDocument.isChecked()) {
if (m_data.AD_Table_ID == 0 || m_data.Record_ID == 0)
return;
para.append(", AD_Table_ID=").append(m_data.AD_Table_ID).append(", Record_ID=").append(m_data.Record_ID);
} else {
m_data.DateFrom = selDateFrom.getValue() != null ? new Timestamp(selDateFrom.getValue().getTime()) : null;
para.append(", DateFrom=").append(m_data.DateFrom);
m_data.DateTo = selDateTo.getValue() != null ? new Timestamp(selDateTo.getValue().getTime()) : null;
para.append(", DateTo=").append(m_data.DateTo);
listitem = selOrg.getSelectedItem();
if (listitem != null)
kp = (KeyNamePair) listitem.getValue();
else
kp = null;
if (kp != null)
m_data.AD_Org_ID = kp.getKey();
para.append(", AD_Org_ID=").append(m_data.AD_Org_ID);
//
Iterator<String> it = m_data.whereInfo.values().iterator();
while (it.hasNext()) para.append(", ").append(it.next());
}
// Save Display Choices
m_data.displayQty = displayQty.isChecked();
para.append(" - Display Qty=").append(m_data.displayQty);
m_data.displaySourceAmt = displaySourceAmt.isChecked();
para.append(", Source=").append(m_data.displaySourceAmt);
m_data.displayDocumentInfo = displayDocumentInfo.isChecked();
para.append(", Doc=").append(m_data.displayDocumentInfo);
listitem = sortBy1.getSelectedItem();
vp = null;
if (listitem != null) {
vp = (ValueNamePair) listitem.getValue();
if (vp.getName() != null && vp.getName().trim().length() > 0) {
//vp.getName();
m_data.sortBy1 = vp.getValue();
m_data.group1 = group1.isChecked();
para.append(" - Sorting: ").append(m_data.sortBy1).append("/").append(m_data.group1);
}
}
listitem = sortBy2.getSelectedItem();
vp = null;
if (listitem != null) {
vp = (ValueNamePair) listitem.getValue();
if (vp.getName() != null && vp.getName().trim().length() > 0) {
//vp.getName();
m_data.sortBy2 = vp.getValue();
m_data.group2 = group2.isChecked();
para.append(", ").append(m_data.sortBy2).append("/").append(m_data.group2);
}
}
listitem = sortBy3.getSelectedItem();
vp = null;
if (listitem != null) {
vp = (ValueNamePair) listitem.getValue();
if (vp.getName() != null && vp.getName().trim().length() > 0) {
//vp.getName();
m_data.sortBy3 = vp.getValue();
m_data.group3 = group3.isChecked();
para.append(", ").append(m_data.sortBy3).append("/").append(m_data.group3);
}
}
listitem = sortBy4.getSelectedItem();
vp = null;
if (listitem != null) {
vp = (ValueNamePair) listitem.getValue();
if (vp.getName() != null && vp.getName().trim().length() > 0) {
//vp.getName();
m_data.sortBy4 = vp.getValue();
m_data.group4 = group4.isChecked();
para.append(", ").append(m_data.sortBy4).append("/").append(m_data.group4);
}
}
bQuery.setEnabled(false);
statusLine.setValue(" " + Msg.getMsg(Env.getCtx(), "Processing"));
log.config(para.toString());
// Switch to Result pane
tabbedPane.setSelectedIndex(1);
// Set TableModel with Query
RModel rmodel = m_data.query();
m_queryData = rmodel.getRows();
List<ArrayList<Object>> list = null;
paging.setPageSize(PAGE_SIZE);
if (m_queryData.size() > PAGE_SIZE) {
list = m_queryData.subList(0, PAGE_SIZE);
paging.setTotalSize(m_queryData.size());
pagingPanel.setVisible(true);
} else {
list = m_queryData;
paging.setTotalSize(m_queryData.size());
pagingPanel.setVisible(false);
}
paging.setActivePage(0);
ListModelTable listmodeltable = new ListModelTable(list);
if (table.getListhead() == null) {
Listhead listhead = new Listhead();
listhead.setSizable(true);
for (int i = 0; i < rmodel.getColumnCount(); i++) {
// Replace user columns with the user selected names
String displayColumnName = rmodel.getColumnName(i);
;
String columnName;
RColumn col = rmodel.getColumn(i);
columnName = col.getColumnName();
MAcctSchema as = MAcctSchema.get(Env.getCtx(), m_data.C_AcctSchema_ID);
if (columnName.equals("User1_ID")) {
MAcctSchemaElement ase = as.getAcctSchemaElement(MAcctSchemaElement.ELEMENTTYPE_UserList1);
if (ase != null)
displayColumnName = Msg.translate(Env.getCtx(), ase.getName());
} else if (columnName.equals("User2_ID")) {
MAcctSchemaElement ase = as.getAcctSchemaElement(MAcctSchemaElement.ELEMENTTYPE_UserList2);
if (ase != null)
displayColumnName = Msg.translate(Env.getCtx(), ase.getName());
} else if (columnName.equals("User3_ID")) {
MAcctSchemaElement ase = as.getAcctSchemaElement(MAcctSchemaElement.ELEMENTTYPE_UserList3);
if (ase != null)
displayColumnName = Msg.translate(Env.getCtx(), ase.getName());
} else if (columnName.equals("User4_ID")) {
MAcctSchemaElement ase = as.getAcctSchemaElement(MAcctSchemaElement.ELEMENTTYPE_UserList4);
if (ase != null)
displayColumnName = Msg.translate(Env.getCtx(), ase.getName());
}
Listheader listheader = new Listheader(displayColumnName);
listheader.setTooltiptext(rmodel.getColumnName(i));
listhead.appendChild(listheader);
}
table.appendChild(listhead);
} else // Elaine 2008/07/28
{
Listhead listhead = table.getListhead();
// remove existing column header
listhead.getChildren().clear();
// add in new column header
for (int i = 0; i < rmodel.getColumnCount(); i++) {
Listheader listheader = new Listheader(rmodel.getColumnName(i));
listhead.appendChild(listheader);
}
}
//
table.getItems().clear();
table.setItemRenderer(new WListItemRenderer());
table.setModel(listmodeltable);
resultPanel.invalidate();
bQuery.setEnabled(true);
statusLine.setValue(" " + Msg.getMsg(Env.getCtx(), "ViewerOptions"));
}
Aggregations