use of javax.swing.DefaultListModel in project ACS by ACS-Community.
the class RemoteResponseWindow method remoteResponseWindow_Initialize.
/**
* Comment
*/
public void remoteResponseWindow_Initialize() {
getReportArea().getPopup().add(getJCheckBoxMenuItem1());
getJTextField1().setText(Integer.toString(maxLines));
if (rr != null && rr.getInvocation().isControllable()) {
DefaultListModel model = new DefaultListModel();
Operation[] ops = rr.getInvocation().getOperations();
for (int i = 0; i < ops.length; i++) {
model.addElement(ops[i]);
}
getoperationsList().setModel(model);
getoperationsList().revalidate();
}
// allow window to be closed, since it is not controllable
if (rr != null && !rr.getInvocation().isControllable()) {
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
}
return;
}
use of javax.swing.DefaultListModel in project adempiere by adempiere.
the class VTreeMaintenance method action_loadTree.
// actionPerformed
/**
* Action: Fill Tree with all nodes
*/
private void action_loadTree() {
KeyNamePair tree = (KeyNamePair) treeField.getSelectedItem();
log.info("Tree=" + tree);
if (tree.getKey() <= 0) {
centerList.setModel(new DefaultListModel());
return;
}
// Tree
m_tree = new MTree(Env.getCtx(), tree.getKey(), null);
cbAllNodes.setSelected(m_tree.isAllNodes());
bAddAll.setEnabled(!m_tree.isAllNodes());
bAdd.setEnabled(!m_tree.isAllNodes());
bDelete.setEnabled(!m_tree.isAllNodes());
bDeleteAll.setEnabled(!m_tree.isAllNodes());
//
// List
DefaultListModel model = new DefaultListModel();
ArrayList<ListItem> items = getTreeItemData();
for (ListItem item : items) model.addElement(item);
// List
log.config("#" + model.getSize());
centerList.setModel(model);
// Tree
centerTree.initTree(m_tree.getAD_Tree_ID());
}
use of javax.swing.DefaultListModel in project adempiere by adempiere.
the class VSortTab method migrateValueAcrossLists.
/**
* @param event
*/
void migrateValueAcrossLists(AWTEvent event) {
Object source = event.getSource();
Object[] selObjects = (source == bAdd || source == noList) ? noList.getSelectedValues() : yesList.getSelectedValues();
for (int i = 0; i < selObjects.length; i++) {
ListItem selObject = (ListItem) selObjects[i];
if (selObject == null || !selObject.isUpdateable())
continue;
DefaultListModel lmFrom = (source == bAdd || source == noList) ? noModel : yesModel;
DefaultListModel lmTo = (lmFrom == yesModel) ? noModel : yesModel;
lmFrom.removeElement(selObject);
lmTo.addElement(selObject);
JList list = (source == bAdd || source == noList) ? yesList : noList;
list.setSelectedValue(selObject, true);
// Enable explicit Save
setIsChanged(true);
}
}
use of javax.swing.DefaultListModel in project GDSC-SMLM by aherbert.
the class SpotAnalysis method createFrame.
@SuppressWarnings({ "rawtypes", "unchecked" })
private void createFrame() {
Panel mainPanel = new Panel();
add(mainPanel);
inputChoice = new Choice();
mainPanel.add(createChoicePanel(inputChoice, ""));
widthTextField = new TextField();
mainPanel.add(createTextPanel(widthTextField, "PSF width", "1.2"));
blurTextField = new TextField();
mainPanel.add(createTextPanel(blurTextField, "Blur (relative to width)", "1"));
gainTextField = new TextField();
mainPanel.add(createTextPanel(gainTextField, "Gain", "37.7"));
exposureTextField = new TextField();
mainPanel.add(createTextPanel(exposureTextField, "ms/Frame", "20"));
smoothingTextField = new TextField();
mainPanel.add(createTextPanel(smoothingTextField, "Smoothing", "0.25"));
profileButton = new Button("Profile");
profileButton.addActionListener(this);
addButton = new Button("Add");
addButton.addActionListener(this);
deleteButton = new Button("Remove");
deleteButton.addActionListener(this);
saveButton = new Button("Save");
saveButton.addActionListener(this);
saveTracesButton = new Button("Save Traces");
saveTracesButton.addActionListener(this);
currentLabel = new Label();
mainPanel.add(createLabelPanel(currentLabel, "", ""));
rawFittedLabel = new Label();
mainPanel.add(createLabelPanel(rawFittedLabel, "", ""));
blurFittedLabel = new Label();
mainPanel.add(createLabelPanel(blurFittedLabel, "", ""));
JPanel buttonPanel = new JPanel();
FlowLayout l = new FlowLayout();
l.setVgap(0);
buttonPanel.setLayout(l);
buttonPanel.add(profileButton, BorderLayout.CENTER);
buttonPanel.add(addButton, BorderLayout.CENTER);
buttonPanel.add(deleteButton, BorderLayout.CENTER);
buttonPanel.add(saveButton, BorderLayout.CENTER);
buttonPanel.add(saveTracesButton, BorderLayout.CENTER);
mainPanel.add(buttonPanel);
listModel = new DefaultListModel();
onFramesList = new JList(listModel);
onFramesList.setVisibleRowCount(15);
onFramesList.addListSelectionListener(this);
//mainPanel.add(onFramesList);
JScrollPane scrollPane = new JScrollPane(onFramesList);
scrollPane.getVerticalScrollBarPolicy();
mainPanel.add(scrollPane);
GridBagLayout mainGrid = new GridBagLayout();
int y = 0;
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.WEST;
c.gridwidth = 1;
c.insets = new Insets(2, 2, 2, 2);
for (Component comp : mainPanel.getComponents()) {
c.gridy = y++;
mainGrid.setConstraints(comp, c);
}
mainPanel.setLayout(mainGrid);
}
use of javax.swing.DefaultListModel in project JMRI by JMRI.
the class SensorGroupFrame method addPressed.
void addPressed() {
deleteGroup(false);
String group = _nameField.getText();
if (group == null || group.length() == 0) {
javax.swing.JOptionPane.showMessageDialog(this, "Please enter a name for this group.", "Error", javax.swing.JOptionPane.ERROR_MESSAGE);
return;
}
Logix logix = getSystemLogix();
logix.deActivateLogix();
String cSystemName = ConditionalSystemPrefix + group.toUpperCase();
String cUserName = ConditionalUserPrefix + group;
// add new Conditional
ArrayList<ConditionalVariable> variableList = new ArrayList<ConditionalVariable>();
ArrayList<ConditionalAction> actionList = new ArrayList<ConditionalAction>();
int count = 0;
for (int i = 0; i < _sensorModel.getRowCount(); i++) {
if ((Boolean) _sensorModel.getValueAt(i, BeanTableModel.INCLUDE_COLUMN)) {
String sensor = (String) _sensorModel.getValueAt(i, BeanTableModel.SNAME_COLUMN);
variableList.add(new ConditionalVariable(false, Conditional.OPERATOR_OR, Conditional.TYPE_SENSOR_ACTIVE, sensor, true));
actionList.add(new DefaultConditionalAction(Conditional.ACTION_OPTION_ON_CHANGE_TO_TRUE, Conditional.ACTION_SET_SENSOR, sensor, Sensor.INACTIVE, ""));
count++;
}
}
if (count < 2) {
javax.swing.JOptionPane.showMessageDialog(this, "A Sensor Group needs to have at least 2 sensors to be useful.", "Error", javax.swing.JOptionPane.ERROR_MESSAGE);
}
Conditional c = new SensorGroupConditional(cSystemName, cUserName);
// InstanceManager.getDefault(jmri.ConditionalManager.class).register(c);
c.setStateVariables(variableList);
c.setLogicType(Conditional.ALL_OR, "");
c.setAction(actionList);
// Update the Logix Conditional names list
logix.addConditional(cSystemName, 0);
// Update the Logix Conditional hash map
logix.addConditional(cSystemName, c);
logix.setEnabled(true);
logix.activateLogix();
((DefaultListModel<String>) _sensorGroupList.getModel()).addElement(cUserName.substring(ConditionalUserPrefix.length()));
clear();
}
Aggregations