use of javax.swing.DefaultComboBoxModel in project adempiere by adempiere.
the class Find method cmd_delete.
// parseValue
/**
* Delete
*/
private void cmd_delete() {
advancedTable.stopEditor(false);
DefaultTableModel model = (DefaultTableModel) advancedTable.getModel();
int row = advancedTable.getSelectedRow();
if (row >= 0) {
model.removeRow(row);
} else {
//delete the whole thing
MUserQuery uq = null;
Object o = fQueryName.getSelectedItem();
if (userQueries != null && o != null) {
String selected = o.toString();
for (int i = 0; i < userQueries.length; i++) {
if (userQueries[i].getName().equals(selected)) {
uq = userQueries[i];
break;
}
}
}
if (uq != null) {
uq.delete(true);
userQueries = MUserQuery.get(Env.getCtx(), m_AD_Tab_ID);
String[] queries = new String[userQueries.length];
for (int i = 0; i < userQueries.length; i++) queries[i] = userQueries[i].getName();
fQueryName.setModel(new DefaultComboBoxModel(queries));
fQueryName.setValue("");
int cnt = model.getRowCount();
for (int i = cnt - 1; i >= 0; i--) model.removeRow(i);
advancedTable.invalidate();
}
}
cmd_refresh();
advancedTable.requestFocusInWindow();
}
use of javax.swing.DefaultComboBoxModel in project adempiere by adempiere.
the class VMatch 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), //JAVIER
new ColumnInfo(Msg.translate(Env.getCtx(), "AD_Org_ID"), ".", KeyNamePair.class, ".") };
xMatchedTable.prepareTable(layout, "", "", false, "");
xMatchedToTable.prepareTable(layout, "", "", true, "");
// Visual
CompiereColor.setBackground(panel);
// Listener
matchFrom.addActionListener(this);
matchTo.addActionListener(this);
bSearch.addActionListener(this);
xMatchedTable.getSelectionModel().addListSelectionListener(this);
xMatchedToTable.getModel().addTableModelListener(this);
bProcess.addActionListener(this);
sameBPartner.addActionListener(this);
sameProduct.addActionListener(this);
sameQty.addActionListener(this);
// Init
matchTo.setModel(new DefaultComboBoxModel(cmd_matchFrom((String) matchFrom.getSelectedItem())));
// Set Title
xMatchedBorder.setTitle((String) matchFrom.getSelectedItem());
xMatchedScrollPane.repaint();
// Reset Table
xMatchedTable.setRowCount(0);
cmd_matchTo();
statusBar.setStatusLine("");
statusBar.setStatusDB(0);
}
use of javax.swing.DefaultComboBoxModel in project pcgen by PCGen.
the class PurchaseModeFrame method initializeCurrentPurchaseMethods.
private void initializeCurrentPurchaseMethods() {
//
// Set up the current methods combo's contents
//
Collection<PointBuyMethod> methods = SettingsHandler.getGame().getModeContext().getReferenceContext().getConstructedCDOMObjects(PointBuyMethod.class);
if (!methods.isEmpty()) {
currentPurchaseMethods.setModel(new DefaultComboBoxModel(methods.toArray()));
}
// Get into correct state
currentPurchaseMethodsActionPerformed();
}
use of javax.swing.DefaultComboBoxModel in project pcgen by PCGen.
the class NameGenPanel method loadStructureDD.
private void loadStructureDD() {
if (chkStructure.isSelected()) {
cbStructure.setModel(new DefaultComboBoxModel());
cbStructure.setEnabled(false);
} else {
Vector<DataElement> struct = new Vector<>();
for (String key : ((RuleSet) cbCatalog.getSelectedItem())) {
try {
struct.add(allVars.getDataElement(key));
} catch (Exception e) {
Logging.errorPrint(e.getMessage(), e);
}
}
DefaultComboBoxModel structModel = new DefaultComboBoxModel(struct);
cbStructure.setModel(structModel);
cbStructure.setEnabled(true);
}
}
use of javax.swing.DefaultComboBoxModel in project jmeter by apache.
the class HtmlExtractorGui method makeExtractorPanel.
private Component makeExtractorPanel() {
JPanel panel = new HorizontalPanel();
//$NON-NLS-1$
panel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("html_extractor_type")));
DefaultComboBoxModel<String> m = new DefaultComboBoxModel<>();
for (String s : HtmlExtractor.getImplementations()) {
m.addElement(s);
}
m.addElement(USE_DEFAULT_EXTRACTOR_IMPL);
extractorImplName = new JComboBox<>(m);
extractorImplName.setSelectedItem(HtmlExtractor.DEFAULT_EXTRACTOR);
// $NON-NLS-1$
JLabel label2 = new JLabel(JMeterUtils.getResString("html_extractor_type"));
label2.setLabelFor(extractorImplName);
panel.add(label2);
panel.add(extractorImplName);
return panel;
}
Aggregations