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);
}
}
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);
}
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;
}
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);
}
}
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);
}
}
Aggregations