List of usage examples for javax.swing DefaultListModel DefaultListModel
DefaultListModel
From source file:org.ops4j.pax.idea.runner.forms.OsgiConfigEditorForm.java
public OsgiConfigEditorForm(final ConfigBean config) { String[] columnNames = { "Property", "Value" }; DefaultTableModel tableModel = new DefaultTableModel(); tableModel.setColumnIdentifiers(columnNames); m_bundleProperties.setModel(tableModel); m_bundleProperties.setShowGrid(true); m_bundleProperties.setEnabled(false); config.addBundleObserver(this); m_bundleModel = new DefaultListModel(); m_bundles.setModel(m_bundleModel);/* w ww .j a v a 2 s .c o m*/ }
From source file:org.ops4j.pax.idea.runner.forms.OsgiConfigEditorForm.java
private void updateBundlesList(ConfigBean data) { m_bundleModel = new DefaultListModel(); List<BundleRef> refList = data.getBundleRefs(); for (BundleRef bundle : refList) { m_bundleModel.addElement(bundle); }/*from www.j a va 2 s.co m*/ m_bundles.setModel(m_bundleModel); }
From source file:org.ops4j.pax.idea.runner.forms.OsgiConfigEditorForm.java
private void updatePlatformList(ConfigBean data) { String selected = data.getSelectedPlatform(); m_platformModel = new DefaultListModel(); ArrayList<String> platforms = data.getPlatforms(); int count = 0; for (String platform : platforms) { m_platformModel.addElement(platform); if (selected.equals(platform)) { m_platforms.setSelectedIndex(count); }/*from ww w . jav a 2 s . c om*/ count++; } m_platforms.setModel(m_platformModel); }
From source file:org.orbisgis.core.ui.plugins.views.geocatalog.Catalog.java
private JPanel getTagPanel() { JPanel ret = new JPanel(); ret.setBorder(BorderFactory/* w w w. ja v a 2 s .c o m*/ .createTitledBorder(I18N.getString("orbisgis.org.orbisgis.core.ui.plugins.views.geocatalog.tags"))); ret.setLayout(new BorderLayout()); lstTags = new JList(); tagListModel = new DefaultListModel(); refreshTagModel(); lstTags.setModel(tagListModel); lstTags.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { doFilter(); btnDelTag.setEnabled(lstTags.getSelectedIndex() != -1); } }); lstTags.setVisibleRowCount(FILTER_VISIBLE_ROW_COUNT - 1); JScrollPane scroll = new JScrollPane(lstTags); ret.add(scroll, BorderLayout.CENTER); JPanel pnlButtons = new JPanel(); JButton btnAdd = getTagManagementButton(OrbisGISIcon.ADD, AC_BTN_ADD_TAG); btnAdd.setBorderPainted(false); btnAdd.setContentAreaFilled(false); btnDelTag = getTagManagementButton(OrbisGISIcon.DEL, AC_BTN_DEL_TAG); btnDelTag.setEnabled(false); btnDelTag.setBorderPainted(false); btnDelTag.setContentAreaFilled(false); pnlButtons.add(btnAdd); pnlButtons.add(btnDelTag); ret.add(pnlButtons, BorderLayout.SOUTH); return ret; }
From source file:org.pentaho.reporting.engine.classic.extensions.drilldown.devtools.DrillDownProfileEditor.java
protected Component createContentPane() { drillDownProfiles = new DefaultListModel(); profileList = new JList(drillDownProfiles); profileList.setCellRenderer(new DrillDownProfileListRenderer()); final JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5)); buttonPane.add(new JButton(new NewAction())); buttonPane.add(new JButton(new EditAction())); buttonPane.add(new JButton(new RemoveAction())); buttonPane.add(Box.createHorizontalStrut(10)); buttonPane.add(new JButton(new LoadAction())); buttonPane.add(new JButton(new SaveAction())); final JPanel contentPane = new JPanel(); contentPane.setLayout(new BorderLayout()); contentPane.add(buttonPane, BorderLayout.NORTH); contentPane.add(new JScrollPane(profileList), BorderLayout.CENTER); return contentPane; }
From source file:org.pentaho.reporting.tools.configeditor.ConfigDescriptionEditor.java
/** * Creates the enumeration detail editor. * * @return the enumeration detail editor. *///from ww w .j a va 2 s . c om private JPanel createEnumerationEditor() { enumEntryEditField = new JTextField(); enumEntryListModel = new DefaultListModel(); enumEntryList = new JList(enumEntryListModel); enumEntryList.addListSelectionListener(new EnumerationListSelectionHandler()); final JPanel listPanel = new JPanel(); listPanel.setLayout(new BorderLayout()); listPanel.add(enumEntryEditField, BorderLayout.NORTH); listPanel.add(new JScrollPane(enumEntryList), BorderLayout.CENTER); final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(5, 1)); buttonPanel.add(new JButton(new AddEnumEntryAction())); buttonPanel.add(new JButton(new RemoveEnumEntryAction())); buttonPanel.add(new JButton(new UpdateEnumEntryAction())); buttonPanel.add(new JPanel()); buttonPanel.add(new JButton(new SetBooleanEnumEntryAction())); final JPanel buttonCarrier = new JPanel(); buttonCarrier.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); buttonCarrier.add(buttonPanel); final JPanel editorPanel = new JPanel(); editorPanel.setLayout(new BorderLayout()); editorPanel.add(listPanel, BorderLayout.CENTER); editorPanel.add(buttonCarrier, BorderLayout.EAST); return editorPanel; }
From source file:org.pentaho.reporting.ui.datasources.kettle.KettleDataSourceDialog.java
private void initDialog(final DesignTimeContext designTimeContext) { if (designTimeContext == null) { throw new NullPointerException(); }/*from w ww.j a v a2 s .c o m*/ this.designTimeContext = designTimeContext; stopOnErrorsCheckBox = new JCheckBox(Messages.getString("KettleDataSourceDialog.StopOnErrors")); stopOnErrorsCheckBox.setEnabled(false); stopOnErrorsCheckBox.addActionListener(new StopOnErrorSync()); editParameterAction = new EditParameterAction(); editParameterAction.setEnabled(false); queryListModel = new DefaultListModel(); queryNameList = new JList(queryListModel); queryNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); queryNameList.setVisibleRowCount(5); queryNameList.addListSelectionListener(getQueryNameListener()); previewAction = new PreviewAction(); fileTextField = new JTextField(30); fileTextField.setEnabled(false); fileTextField.getDocument().addDocumentListener(new FileSyncHandler()); stepsList = new JList(); stepsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); stepsList.addListSelectionListener(new StepsListListener()); stepsList.addListSelectionListener(previewAction); nameTextField = new JTextField(30); nameTextField.setEnabled(false); nameTextField.getDocument().addDocumentListener(new NameSyncHandler()); setTitle(getDialogTitle()); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setModal(true); super.init(); }
From source file:org.pentaho.ui.xul.swing.tags.SwingListbox.java
public SwingListbox(Element self, XulComponent parent, XulDomContainer container, String tagName) { super(tagName); model = new DefaultListModel(); listBox = new JList(model); scrollPane = new JScrollPane(listBox); listBox.setBorder(BorderFactory.createLineBorder(Color.gray)); listBox.addListSelectionListener(this); setManagedObject(scrollPane);/*from w w w . jav a 2s . co m*/ this.xulDomContainer = container; Dimension size = scrollPane.getPreferredSize(); scrollPane.setMinimumSize(size); }
From source file:org.rdv.ui.ExportDialog.java
private void initComponents(List<String> channels, List<String> fileFormats) { channelModel = new DefaultListModel(); for (int i = 0; i < channels.size(); i++) { String channelName = (String) channels.get(i); Channel channel = RBNBController.getInstance().getChannel(channelName); String mime = channel.getMetadata("mime"); if (mime.equals("application/octet-stream")) { channelModel.addElement(new ExportChannel(channelName)); }/*from w ww .ja v a 2s .c o m*/ } JPanel container = new JPanel(); setContentPane(container); InputMap inputMap = container.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); ActionMap actionMap = container.getActionMap(); container.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weighty = 0; c.gridwidth = 1; c.gridheight = 1; c.ipadx = 0; c.ipady = 0; JLabel headerLabel = new JLabel("Select the time range and data channels to export."); headerLabel.setBackground(Color.white); headerLabel.setOpaque(true); headerLabel.setBorder( BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray), BorderFactory.createEmptyBorder(10, 10, 10, 10))); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.gridx = 0; c.gridy = 0; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new java.awt.Insets(0, 0, 0, 0); container.add(headerLabel, c); JPanel timeButtonPanel = new JPanel(); timeButtonPanel.setLayout(new BorderLayout()); MouseListener hoverMouseListener = new MouseAdapter() { public void mouseEntered(MouseEvent e) { e.getComponent().setForeground(Color.red); } public void mouseExited(MouseEvent e) { e.getComponent().setForeground(Color.blue); } }; startTimeButton = new JButton(); startTimeButton.setBorder(null); startTimeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); startTimeButton.setForeground(Color.blue); startTimeButton.addMouseListener(hoverMouseListener); startTimeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { double startTime = DateTimeDialog.showDialog(ExportDialog.this, timeSlider.getStart(), timeSlider.getMinimum(), timeSlider.getEnd()); if (startTime >= 0) { timeSlider.setStart(startTime); } } }); timeButtonPanel.add(startTimeButton, BorderLayout.WEST); durationLabel = new JLabel(); durationLabel.setHorizontalAlignment(JLabel.CENTER); timeButtonPanel.add(durationLabel, BorderLayout.CENTER); endTimeButton = new JButton(); endTimeButton.setBorder(null); endTimeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); endTimeButton.setForeground(Color.blue); endTimeButton.addMouseListener(hoverMouseListener); endTimeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { double endTime = DateTimeDialog.showDialog(ExportDialog.this, timeSlider.getEnd(), timeSlider.getStart(), timeSlider.getMaximum()); if (endTime >= 0) { timeSlider.setEnd(endTime); } } }); timeButtonPanel.add(endTimeButton, BorderLayout.EAST); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.gridx = 0; c.gridy = 1; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new java.awt.Insets(10, 10, 10, 10); container.add(timeButtonPanel, c); timeSlider = new TimeSlider(); timeSlider.setValueChangeable(false); timeSlider.setValueVisible(false); timeSlider.addTimeAdjustmentListener(new TimeAdjustmentListener() { public void timeChanged(TimeEvent event) { } public void rangeChanged(TimeEvent event) { updateTimeRangeLabel(); } public void boundsChanged(TimeEvent event) { } }); updateTimeRangeLabel(); updateTimeBounds(); List<EventMarker> markers = RBNBController.getInstance().getMarkerManager().getMarkers(); for (EventMarker marker : markers) { timeSlider.addMarker(marker); } c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.gridx = 0; c.gridy = 2; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new java.awt.Insets(0, 10, 10, 10); container.add(timeSlider, c); JLabel numericHeaderLabel = new JLabel("Data Channels:"); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.gridx = 0; c.gridy = 3; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new java.awt.Insets(0, 10, 10, 10); container.add(numericHeaderLabel, c); numericChannelList = new JList(channelModel); numericChannelList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); numericChannelList.setCellRenderer(new CheckListRenderer()); numericChannelList.setVisibleRowCount(10); numericChannelList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { int index = numericChannelList.locationToIndex(e.getPoint()); ExportChannel item = (ExportChannel) numericChannelList.getModel().getElementAt(index); item.setSelected(!item.isSelected()); Rectangle rect = numericChannelList.getCellBounds(index, index); numericChannelList.repaint(rect); checkSelectedChannels(); updateTimeBounds(); } }); JScrollPane scrollPane = new JScrollPane(numericChannelList); c.fill = GridBagConstraints.BOTH; c.weightx = 0; c.weighty = 1; c.gridx = 0; c.gridy = 4; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new java.awt.Insets(0, 10, 10, 10); container.add(scrollPane, c); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.weighty = 0; c.gridx = 0; c.gridy = 5; c.gridwidth = 1; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(0, 10, 10, 5); container.add(new JLabel("Data file: "), c); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 1; c.gridy = 5; c.gridwidth = 1; c.anchor = GridBagConstraints.NORTHWEST; dataFileTextField = new JTextField(20); c.insets = new java.awt.Insets(0, 0, 10, 5); container.add(dataFileTextField, c); dataFileTextField .setText(UIUtilities.getCurrentDirectory().getAbsolutePath() + File.separator + "data.dat"); dataFileButton = new JButton("Browse"); dataFileButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { File selectedFile = new File(dataFileTextField.getText()); selectedFile = UIUtilities.getFile("OK", "Select export file", selectedFile); if (selectedFile != null) { dataFileTextField.setText(selectedFile.getAbsolutePath()); } } }); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.gridx = 2; c.gridy = 5; c.gridwidth = 1; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(0, 0, 10, 10); container.add(dataFileButton, c); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.gridx = 0; c.gridy = 6; c.gridwidth = 1; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(0, 10, 10, 5); container.add(new JLabel("File format: "), c); fileFormatComboBox = new JComboBox(fileFormats.toArray()); fileFormatComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { fileFormatUpdated(); } }); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 1; c.gridy = 6; c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new java.awt.Insets(0, 0, 10, 10); container.add(fileFormatComboBox, c); JPanel panel = new JPanel(); panel.setLayout(new FlowLayout()); Action exportAction = new AbstractAction() { /** serialization version identifier */ private static final long serialVersionUID = -5356258138620428023L; public void actionPerformed(ActionEvent e) { ok(); } }; exportAction.putValue(Action.NAME, "Export"); inputMap.put(KeyStroke.getKeyStroke("ENTER"), "export"); actionMap.put("export", exportAction); exportButton = new JButton(exportAction); panel.add(exportButton); Action cancelAction = new AbstractAction() { /** serialization version identifier */ private static final long serialVersionUID = -5868609501314154642L; public void actionPerformed(ActionEvent e) { cancel(); } }; cancelAction.putValue(Action.NAME, "Cancel"); inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), "cancel"); actionMap.put("cancel", cancelAction); cancelButton = new JButton(cancelAction); panel.add(cancelButton); c.fill = GridBagConstraints.NONE; c.weightx = 0.5; c.gridx = 0; c.gridy = 7; c.gridwidth = GridBagConstraints.REMAINDER; ; c.anchor = GridBagConstraints.LINE_END; c.insets = new java.awt.Insets(0, 0, 10, 5); container.add(panel, c); pack(); if (getWidth() < 600) { setSize(600, getHeight()); } dataFileTextField.requestFocusInWindow(); setLocationByPlatform(true); }
From source file:org.rdv.ui.ExportVideoDialog.java
private void setChannelModel() { videoChannelModel = new DefaultListModel(); for (int i = 0; i < channels.size(); i++) { String channelName = (String) channels.get(i); Channel channel = rbnb.getChannel(channelName); String mime = channel.getMetadata("mime"); if (mime.equals("image/jpeg") || mime.equals("video/jpeg")) { videoChannelModel.addElement(new ExportChannel(channelName)); }/* w w w.j av a 2 s. com*/ } }