Search in sources :

Example 11 with DefaultListModel

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;
}
Also used : DefaultListModel(javax.swing.DefaultListModel) Operation(si.ijs.acs.objectexplorer.engine.Operation)

Example 12 with DefaultListModel

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());
}
Also used : DefaultListModel(javax.swing.DefaultListModel) KeyNamePair(org.compiere.util.KeyNamePair) MTree(org.compiere.model.MTree)

Example 13 with DefaultListModel

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);
    }
}
Also used : DefaultListModel(javax.swing.DefaultListModel) Point(java.awt.Point) JList(javax.swing.JList)

Example 14 with DefaultListModel

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);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Choice(java.awt.Choice) FlowLayout(java.awt.FlowLayout) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) Label(java.awt.Label) DefaultListModel(javax.swing.DefaultListModel) Point(java.awt.Point) Panel(java.awt.Panel) JPanel(javax.swing.JPanel) Button(java.awt.Button) TextField(java.awt.TextField) Component(java.awt.Component) JList(javax.swing.JList)

Example 15 with DefaultListModel

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();
}
Also used : DefaultConditionalAction(jmri.implementation.DefaultConditionalAction) ArrayList(java.util.ArrayList) SensorGroupConditional(jmri.implementation.SensorGroupConditional) DefaultListModel(javax.swing.DefaultListModel) Conditional(jmri.Conditional) SensorGroupConditional(jmri.implementation.SensorGroupConditional) ConditionalVariable(jmri.ConditionalVariable) Logix(jmri.Logix) ConditionalAction(jmri.ConditionalAction) DefaultConditionalAction(jmri.implementation.DefaultConditionalAction)

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