Search in sources :

Example 26 with DefaultListModel

use of javax.swing.DefaultListModel in project cogtool by cogtool.

the class JListBinding method get.

public void get(IValidatable bean) {
    try {
        DefaultListModel model = (DefaultListModel) _list.getModel();
        final int size = model.getSize();
        List list = new ArrayList(size);
        for (int i = 0; i < size; i++) {
            list.add(model.get(i));
        }
        PropertyUtils.setProperty(bean, _property, list);
    } catch (Exception e) {
        throw new BindingException(e);
    }
}
Also used : ArrayList(java.util.ArrayList) DefaultListModel(javax.swing.DefaultListModel) List(java.util.List) JList(javax.swing.JList) ArrayList(java.util.ArrayList)

Example 27 with DefaultListModel

use of javax.swing.DefaultListModel in project gephi by gephi.

the class PartitionPanel method refresh.

private void refresh(Partition partition, Set<Object> currentParts) {
    final DefaultListModel model = new DefaultListModel();
    int i = 0;
    for (Object p : partition.getSortedValues()) {
        PartWrapper pw = new PartWrapper(p, partition.percentage(p), partition.getColor(p));
        pw.setEnabled(currentParts.contains(p));
        model.add(i++, pw);
    }
    list.setModel(model);
}
Also used : DefaultListModel(javax.swing.DefaultListModel)

Example 28 with DefaultListModel

use of javax.swing.DefaultListModel in project binnavi by google.

the class PluginListBox method createPluginListModel.

/**
   * Creates the list model of the plugin list.
   *
   * @param registry The plugin registry from where the plugin information comes.
   * @param configFile Provides information about which plugins to load and which plugins to skip.
   * @param <T> The interface which is used by plugins to interface with
   *        com.google.security.zynamics.binnavi.
   * @return The list model created from the given arguments.
   */
private static <T> DefaultListModel<PluginItem<T>> createPluginListModel(final IPluginRegistry<com.google.security.zynamics.binnavi.api2.plugins.IPlugin<T>> registry, final ConfigManager configFile) {
    final DefaultListModel<PluginItem<T>> model = new DefaultListModel<PluginItem<T>>();
    final ArrayList<com.google.security.zynamics.binnavi.api2.plugins.IPlugin<T>> added = new ArrayList<com.google.security.zynamics.binnavi.api2.plugins.IPlugin<T>>();
    // which plugins to load in which order.
    for (final PluginConfigItem plugin : configFile.getGeneralSettings().getPlugins()) {
        final long guid = plugin.getGUID();
        addPluginIfLoaded(registry, model, guid, added);
        addPluginIfUnloaded(registry, model, guid, added);
    }
    // Make sure to add the plugins that are not yet mentioned in the XML file
    addUnmentionedPlugins(registry, model, added);
    return model;
}
Also used : ArrayList(java.util.ArrayList) DefaultListModel(javax.swing.DefaultListModel) PluginConfigItem(com.google.security.zynamics.binnavi.config.PluginConfigItem)

Example 29 with DefaultListModel

use of javax.swing.DefaultListModel in project OpenAM by OpenRock.

the class CheckBoxJPanel method addTest.

public void addTest(CheckBoxListEntry entry) {
    ListModel model = checkBoxjList.getModel();
    if (model instanceof DefaultListModel) {
        ((DefaultListModel) model).addElement(entry);
    } else {
        DefaultListModel newModel = new DefaultListModel();
        newModel.addElement(entry);
        checkBoxjList.setModel(newModel);
    }
}
Also used : DefaultListModel(javax.swing.DefaultListModel) ListModel(javax.swing.ListModel) DefaultListModel(javax.swing.DefaultListModel)

Example 30 with DefaultListModel

use of javax.swing.DefaultListModel in project ACS by ACS-Community.

the class ListsHandlerBean method updateLists.

/**
 * Insert the method's description here.
 * Creation date: (9/29/98 12:29:42 PM)
 */
private void updateLists() {
    this.isSearching = false;
    if (cacheAttributes != null) {
        DefaultListModel sampleModel = new DefaultListModel();
        for (int i = 0; i < cacheAttributes.length; i++) sampleModel.addElement(cacheAttributes[i]);
        panel.setAttributesModel(sampleModel);
    }
    if (cacheOperations != null) {
        DefaultListModel sampleModel1 = new DefaultListModel();
        for (int i = 0; i < cacheOperations.length; i++) {
            if ((!cacheOperations[i].isSpecial()) || (this.showSpecial))
                sampleModel1.addElement(cacheOperations[i]);
        }
        panel.setOperationsModel(sampleModel1);
    }
}
Also used : DefaultListModel(javax.swing.DefaultListModel)

Aggregations

DefaultListModel (javax.swing.DefaultListModel)41 JList (javax.swing.JList)21 ArrayList (java.util.ArrayList)16 JScrollPane (javax.swing.JScrollPane)13 List (java.util.List)8 JButton (javax.swing.JButton)8 ActionEvent (java.awt.event.ActionEvent)5 ActionListener (java.awt.event.ActionListener)5 JPanel (javax.swing.JPanel)5 Conditional (jmri.Conditional)5 Dimension (java.awt.Dimension)4 GridBagConstraints (java.awt.GridBagConstraints)4 GridBagLayout (java.awt.GridBagLayout)4 Insets (java.awt.Insets)4 Logix (jmri.Logix)4 Component (java.awt.Component)3 JLabel (javax.swing.JLabel)3 SensorGroupConditional (jmri.implementation.SensorGroupConditional)3 FormBuilder (com.jgoodies.forms.builder.FormBuilder)2 FormLayout (com.jgoodies.forms.layout.FormLayout)2