Search in sources :

Example 81 with DefaultComboBoxModel

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();
}
Also used : MUserQuery(org.compiere.model.MUserQuery) DefaultTableModel(javax.swing.table.DefaultTableModel) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel)

Example 82 with DefaultComboBoxModel

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);
}
Also used : ColumnInfo(org.compiere.minigrid.ColumnInfo) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel)

Example 83 with DefaultComboBoxModel

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();
}
Also used : PointBuyMethod(pcgen.core.PointBuyMethod) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel)

Example 84 with DefaultComboBoxModel

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);
    }
}
Also used : DataElement(pcgen.core.doomsdaybook.DataElement) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) Vector(java.util.Vector) FileNotFoundException(java.io.FileNotFoundException) DataConversionException(org.jdom2.DataConversionException)

Example 85 with DefaultComboBoxModel

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;
}
Also used : JPanel(javax.swing.JPanel) HorizontalPanel(org.apache.jmeter.gui.util.HorizontalPanel) JLabel(javax.swing.JLabel) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel)

Aggregations

DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)119 JComboBox (javax.swing.JComboBox)22 JPanel (javax.swing.JPanel)21 JLabel (javax.swing.JLabel)17 ActionEvent (java.awt.event.ActionEvent)15 ActionListener (java.awt.event.ActionListener)15 JButton (javax.swing.JButton)15 Insets (java.awt.Insets)14 GridBagConstraints (java.awt.GridBagConstraints)13 GridBagLayout (java.awt.GridBagLayout)12 Dimension (java.awt.Dimension)11 JTextField (javax.swing.JTextField)11 JCheckBox (javax.swing.JCheckBox)10 JScrollPane (javax.swing.JScrollPane)10 ArrayList (java.util.ArrayList)9 Vector (java.util.Vector)9 JList (javax.swing.JList)9 DataColumnSpec (org.knime.core.data.DataColumnSpec)9 BorderLayout (java.awt.BorderLayout)8 ItemEvent (java.awt.event.ItemEvent)8