List of usage examples for javax.swing ListSelectionModel SINGLE_SELECTION
int SINGLE_SELECTION
To view the source code for javax.swing ListSelectionModel SINGLE_SELECTION.
Click Source Link
From source file:net.sourceforge.msscodefactory.cfinternet.v2_0.CFInternetSwing.CFInternetSwingMimeTypeFinderJPanel.java
public CFInternetSwingMimeTypeFinderJPanel(ICFInternetSwingSchema argSchema) { super();//from ww w . ja v a2 s . c om final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } swingSchema = argSchema; dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader(new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); add(dataScrollPane); loadData(true); doLayout(); swingIsInitializing = false; }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingISOCountryFinderJPanel.java
public CFAsteriskSwingISOCountryFinderJPanel(ICFAsteriskSwingSchema argSchema) { super();//from w w w . j ava 2 s .c om final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } swingSchema = argSchema; dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader(new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); add(dataScrollPane); loadData(true); doLayout(); swingIsInitializing = false; }
From source file:org.fhcrc.cpl.viewer.quant.gui.ProteinQuantSummaryFrame.java
License:asdf
/** * Initialize the GUI components//from w ww . j ava2 s . c o m */ protected void initGUI() { //Global stuff setSize(fullWidth, fullHeight); eventPropertiesTable = new QuantEvent.QuantEventPropertiesTable(); eventPropertiesTable.setVisible(true); JScrollPane eventPropsScrollPane = new JScrollPane(); eventPropsScrollPane.setViewportView(eventPropertiesTable); eventPropsScrollPane.setSize(propertiesWidth, propertiesHeight); eventPropertiesDialog = new JDialog(this, "Event Properties"); eventPropertiesDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); eventPropertiesDialog.setSize(propertiesWidth, propertiesHeight); eventPropertiesDialog.setContentPane(eventPropsScrollPane); ListenerHelper helper = new ListenerHelper(this); setTitle("Protein Summary"); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.PAGE_START; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.insets = new Insets(5, 5, 5, 5); gbc.weighty = 1; gbc.weightx = 1; try { (getOwner()).setIconImage(ImageIO.read(WorkbenchFrame.class.getResourceAsStream("icon.gif"))); } catch (Exception e) { } try { Localizer.renderSwixml("org/fhcrc/cpl/viewer/quant/gui/ProteinQuantSummaryFrame.xml", this); assert null != contentPanel; setContentPane(contentPanel); } catch (Exception x) { ApplicationContext.errorMessage("error creating dialog", x); throw new RuntimeException(x); } buttonSelectAllVisible.setEnabled(false); helper.addListener(buttonSelectAllVisible, "buttonSelectAllVisible_actionPerformed"); buttonDeselectAll.setEnabled(false); helper.addListener(buttonDeselectAll, "buttonDeselectAll_actionPerformed"); buildTurkHITsButton.setEnabled(false); helper.addListener(buildTurkHITsButton, "buttonBuildTurkHITs_actionPerformed"); loadSelectedEventsButton.setEnabled(false); helper.addListener(loadSelectedEventsButton, "buttonLoadSelected_actionPerformed"); autoAssessSelectedEventsButton.setEnabled(false); helper.addListener(autoAssessSelectedEventsButton, "buttonAutoAssess_actionPerformed"); showPropertiesButton.setEnabled(false); helper.addListener(showPropertiesButton, "buttonShowProperties_actionPerformed"); showProteinRatiosButton.setEnabled(false); helper.addListener(showProteinRatiosButton, "buttonShowProteinRatios_actionPerformed"); //summary panel summaryPanel.setBorder(BorderFactory.createLineBorder(Color.gray)); summaryPanel.setPreferredSize(new Dimension(fullWidth, summaryPanelHeight)); summaryPanel.setMinimumSize(new Dimension(200, summaryPanelHeight)); gbc.fill = GridBagConstraints.NONE; gbc.gridwidth = 1; summaryPanel.add(buttonSelectAllVisible, gbc); summaryPanel.add(buttonDeselectAll, gbc); gbc.gridwidth = GridBagConstraints.RELATIVE; summaryPanel.add(showPropertiesButton, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; summaryPanel.add(showProteinRatiosButton, gbc); gbc.gridwidth = 1; summaryPanel.add(loadSelectedEventsButton, gbc); gbc.gridwidth = GridBagConstraints.RELATIVE; summaryPanel.add(autoAssessSelectedEventsButton, gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; summaryPanel.add(buildTurkHITsButton, gbc); gbc.fill = GridBagConstraints.BOTH; eventsScrollPane = new JScrollPane(); eventsScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); eventsScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); eventsPanel = new JPanel(); eventsPanel.setLayout(new GridBagLayout()); eventsTable = new QuantEventsSummaryTable(); eventsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); eventsTable.getSelectionModel().addListSelectionListener(new EventsTableListSelectionHandler()); eventsScrollPane.setViewportView(eventsTable); eventsScrollPane.setMinimumSize(new Dimension(400, 400)); gbc.insets = new Insets(0, 0, 0, 0); mainPanel.add(eventsScrollPane, gbc); logRatioHistogramPanel = new PanelWithLogRatioHistAndFields(); logRatioHistogramPanel.setBorder(BorderFactory.createTitledBorder("Log Ratios")); logRatioHistogramPanel.setPreferredSize(new Dimension(width - 10, 300)); gbc.fill = GridBagConstraints.BOTH; gbc.weighty = 100; gbc.gridwidth = GridBagConstraints.REMAINDER; add(logRatioHistogramPanel, gbc); //status message messageLabel = new JLabel(); messageLabel.setBackground(Color.WHITE); messageLabel.setFont(Font.decode("verdana plain 12")); messageLabel.setText(" "); statusPanel = new JPanel(); gbc.weighty = 1; statusPanel.setPreferredSize(new Dimension(width - 10, 50)); statusPanel.add(messageLabel, gbc); add(statusPanel, gbc); //per-protein event summary table; disembodied //todo: move this into its own class? it's getting kind of complicated proteinRatiosTable = new JTable(); proteinRatiosTable.setVisible(true); ListSelectionModel proteinTableSelectionModel = proteinRatiosTable.getSelectionModel(); proteinTableSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); proteinTableSelectionModel.addListSelectionListener(new ProteinTableListSelectionHandler()); JScrollPane proteinRatiosScrollPane = new JScrollPane(); proteinRatiosScrollPane.setViewportView(proteinRatiosTable); proteinRatiosScrollPane.setPreferredSize(new Dimension(proteinDialogWidth, proteinDialogHeight - PROTEINTABLE_HISTPANEL_HEIGHT - PROTEINTABLE_SCATTERPLOTPANEL_HEIGHT - 70)); proteinRatiosDialog = new JDialog(this, "Protein Ratios"); proteinRatiosDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); proteinRatiosDialog.setSize(proteinDialogWidth, proteinDialogHeight); JPanel proteinRatiosContentPanel = new JPanel(); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.BOTH; proteinRatiosContentPanel.add(proteinRatiosScrollPane, gbc); proteinRatiosDialog.setContentPane(proteinRatiosContentPanel); perProteinLogRatioHistogramPanel = new PanelWithLogRatioHistAndFields(); perProteinLogRatioHistogramPanel.addRangeUpdateListener(new ProteinTableLogRatioHistogramListener()); perProteinLogRatioHistogramPanel.setBorder(BorderFactory.createTitledBorder("Log Ratios")); perProteinLogRatioHistogramPanel .setPreferredSize(new Dimension(proteinDialogWidth - 10, PROTEINTABLE_HISTPANEL_HEIGHT)); gbc.fill = GridBagConstraints.BOTH; gbc.gridwidth = GridBagConstraints.REMAINDER; proteinRatiosDialog.add(perProteinLogRatioHistogramPanel, gbc); perProteinPeptideLogRatioPanel = new JPanel(); perProteinPeptideLogRatioPanel.setBorder(BorderFactory.createTitledBorder("By Peptide")); perProteinPeptideLogRatioPanel .setPreferredSize(new Dimension(proteinDialogWidth - 10, PROTEINTABLE_SCATTERPLOTPANEL_HEIGHT)); proteinRatiosDialog.add(perProteinPeptideLogRatioPanel, gbc); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingSysClusterPickerJPanel.java
public CFAsteriskSwingSysClusterPickerJPanel(ICFAsteriskSwingSchema argSchema, ICFSecuritySysClusterObj argFocus, ICFSecurityClusterObj argContainer, Collection<ICFSecuritySysClusterObj> argDataCollection, ICFAsteriskSwingSysClusterChosen whenChosen) { super();/*w w w .ja va 2 s . c o m*/ final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; swingContainer = argContainer; setSwingDataCollection(argDataCollection); dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader(new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); actionCancel = new ActionCancel(); buttonCancel = new JButton(actionCancel); actionChooseNone = new ActionChooseNone(); buttonChooseNone = new JButton(actionChooseNone); actionChooseSelected = new ActionChooseSelectedSysCluster(); buttonChooseSelected = new JButton(actionChooseSelected); // Do initial layout setSize(1024, 480); add(buttonChooseNone); add(buttonChooseSelected); add(buttonCancel); add(dataScrollPane); dataScrollPane.setBounds(0, 35, 1024, 455); doLayout(); setSwingFocusAsSysCluster(argFocus); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingMimeTypeFinderJPanel.java
public CFAsteriskSwingMimeTypeFinderJPanel(ICFAsteriskSwingSchema argSchema) { super();//from w w w . j ava 2s . c o m final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } swingSchema = argSchema; dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader(new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); add(dataScrollPane); loadData(true); doLayout(); swingIsInitializing = false; }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingClusterFinderJPanel.java
public CFAsteriskSwingClusterFinderJPanel(ICFAsteriskSwingSchema argSchema) { super();//from w w w . j a v a2 s. c o m final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } swingSchema = argSchema; dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader(new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); add(dataScrollPane); loadData(true); doLayout(); swingIsInitializing = false; }
From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_4.CFFreeSwitchSwing.CFFreeSwitchSwingClusterFinderJPanel.java
public CFFreeSwitchSwingClusterFinderJPanel(ICFFreeSwitchSwingSchema argSchema) { super();//from w w w .jav a 2s. co m final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } swingSchema = argSchema; dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader(new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); add(dataScrollPane); loadData(true); doLayout(); swingIsInitializing = false; }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingHostNodeFinderJPanel.java
public CFAsteriskSwingHostNodeFinderJPanel(ICFAsteriskSwingSchema argSchema) { super();/*from w w w .ja v a 2 s . c om*/ final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } swingSchema = argSchema; dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader(new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); add(dataScrollPane); loadData(true); doLayout(); swingIsInitializing = false; }
From source file:com.mirth.connect.client.ui.panels.connectors.PollingSettingsPanel.java
private void initComponents() { scheduleTypeLabel = new JLabel("Schedule Type:"); scheduleTypeComboBox = new MirthComboBox(); // @formatter:off scheduleTypeComboBox/*w ww . j a v a2 s . co m*/ .setToolTipText("<html>This connector polls to determine when new messages have arrived.<br>" + "Select \"Interval\" to poll each n units of time.<br>" + "Select \"Time\" to poll once a day at the specified time.<br>" + "Select \"Cron\" to poll at the specified cron expression(s).</html>"); // @formatter:on scheduleTypeComboBox.addItem(PollingType.INTERVAL.getDisplayName()); scheduleTypeComboBox.addItem(PollingType.TIME.getDisplayName()); scheduleTypeComboBox.addItem(PollingType.CRON.getDisplayName()); scheduleTypeActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent event) { scheduleTypeActionPerformed(); updateNextFireTime(); } }; nextPollLabel = new JLabel("Next poll at: "); yesStartPollRadioButton = new MirthRadioButton("Yes"); yesStartPollRadioButton.setToolTipText( "<html>Select Yes to immediately poll once on start.<br/>All subsequent polling will follow the specified schedule.</html>"); yesStartPollRadioButton.setBackground(UIConstants.BACKGROUND_COLOR); yesStartPollRadioButton.setFocusable(false); noStartPollRadioButton = new MirthRadioButton("No"); noStartPollRadioButton.setToolTipText( "<html>Select Yes to immediately poll once on start.<br/>All subsequent polling will follow the specified schedule.</html>"); noStartPollRadioButton.setBackground(UIConstants.BACKGROUND_COLOR); noStartPollRadioButton.setSelected(true); noStartPollRadioButton.setFocusable(false); pollOnStartButtonGroup = new ButtonGroup(); pollOnStartButtonGroup.add(yesStartPollRadioButton); pollOnStartButtonGroup.add(noStartPollRadioButton); pollingTimePicker = new MirthTimePicker(); pollingTimePicker.setToolTipText("The time of day to poll."); pollingTimePicker.setVisible(false); JSpinner.DefaultEditor editor = (JSpinner.DefaultEditor) pollingTimePicker.getEditor(); JTextField textField = editor.getTextField(); textField.getDocument().addDocumentListener(new DocumentListener() { public void insertUpdate(DocumentEvent event) { updateNextFireTime(); } public void removeUpdate(DocumentEvent e) { } public void changedUpdate(DocumentEvent e) { } }); pollingFrequencySettingsPanel = new JPanel(); pollingFrequencySettingsPanel.setBackground(UIConstants.BACKGROUND_COLOR); pollingFrequencySettingsPanel.setVisible(true); pollingFrequencyField = new MirthTextField(); pollingFrequencyField.setToolTipText( "<html>The specified repeating time interval.<br/>Units must be less than 24 hours of time<br/>when converted to milliseconds.</html>"); pollingFrequencyField.setSize(new Dimension(200, 20)); pollingFrequencyField.setDocument(new MirthFieldConstraints(0, false, false, true)); pollingFrequencyField.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { updateNextFireTime(); } @Override public void removeUpdate(DocumentEvent e) { updateNextFireTime(); } @Override public void changedUpdate(DocumentEvent e) { } }); pollingFrequencyTypeComboBox = new MirthComboBox(); pollingFrequencyTypeComboBox.setToolTipText("The interval's unit of time."); pollingFrequencyTypeComboBox.addItem(POLLING_FREQUENCY_MILLISECONDS); pollingFrequencyTypeComboBox.addItem(POLLING_FREQUENCY_SECONDS); pollingFrequencyTypeComboBox.addItem(POLLING_FREQUENCY_MINUTES); pollingFrequencyTypeComboBox.addItem(POLLING_FREQUENCY_HOURS); pollingFrequencyTypeComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateNextFireTime(); } }); pollingCronSettingsPanel = new JPanel(); pollingCronSettingsPanel.setBackground(UIConstants.BACKGROUND_COLOR); pollingCronSettingsPanel.setVisible(false); cronJobsTable = new MirthTable(); Object[][] tableData = new Object[0][1]; cronJobsTable.setModel(new RefreshTableModel(tableData, new String[] { "Expression", "Description" })); cronJobsTable.setOpaque(true); cronJobsTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); cronJobsTable.getTableHeader().setReorderingAllowed(false); cronJobsTable.setSortable(false); cronJobsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); cronJobsTable.getColumnModel().getColumn(0).setResizable(false); cronJobsTable.getColumnModel().getColumn(0).setCellEditor(new CronTableCellEditor(true)); cronJobsTable.getColumnModel().getColumn(1).setResizable(false); cronJobsTable.getColumnModel().getColumn(1).setCellEditor(new CronTableCellEditor(true)); if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) { Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR); cronJobsTable.setHighlighters(highlighter); } HighlightPredicate errorHighlighterPredicate = new HighlightPredicate() { public boolean isHighlighted(Component renderer, ComponentAdapter adapter) { if (adapter.column == cronJobsTable.getColumnViewIndex("Expression")) { String cronExpression = (String) cronJobsTable.getValueAt(adapter.row, adapter.column); if (invalidExpressions.contains(cronExpression)) { return true; } } return false; } }; errorHighlighter = new ColorHighlighter(errorHighlighterPredicate, Color.PINK, Color.BLACK, Color.PINK, Color.BLACK); //@formatter:off String tooltip = "<html><head><style>td {text-align:center;}</style></head>" + "Cron expressions must be in Quartz format with at least 6 fields.<br/>" + "<br/>Format:" + "<table>" + "<tr><td>Field</td><td>Required</td><td>Values</td><td>Special Characters</td></tr>" + "<tr><td>Seconds</td><td>YES</td><td>0-59</td><td>, - * /</td></tr>" + "<tr><td>Minutes</td><td>YES</td><td>0-59</td><td>, - * /</td></tr>" + "<tr><td>Hours</td><td>YES</td><td>0-23</td><td>, - * /</td></tr>" + "<tr><td>Day of Month</td><td>YES</td><td>1-31</td><td>, - * ? / L W</td></tr>" + "<tr><td>Month</td><td>YES</td><td>1-12 or JAN-DEC</td><td>, - * /</td></tr>" + "<tr><td>Day of Week</td><td>YES</td><td>1-7 or SUN-SAT</td><td>, - * ? / L #</td></tr>" + "<tr><td>Year</td><td>NO</td><td>empty, 1970-2099</td><td>, - * /</td></tr>" + "</table>" + "<br/>Special Characters:" + "<br/>   <b>*</b> : all values" + "<br/>   <b>?</b> : no specific value" + "<br/>   <b>-</b> : used to specify ranges" + "<br/>   <b>,</b> : used to specify list of values" + "<br/>   <b>/</b> : used to specify increments" + "<br/>   <b>L</b> : used to specify the last of" + "<br/>   <b>W</b> : used to specify the nearest weekday" + "<br/>   <b>#</b> : used to specify the nth day of the month" + "<br/><br/>Example: 0 */5 8-17 * * ? means to fire every 5 minutes starting at 8am<br/>and ending at 5pm everyday" + "<br/><br/><b>Note:</b> Support for specifying both a day-of-week and day-of-month<br/>is not yet supported. A ? must be used in one of these fields.</html>"; //@formatter:on cronJobsTable.setToolTipText(tooltip); cronJobsTable.getTableHeader().setToolTipText(tooltip); cronScrollPane = new JScrollPane(); cronScrollPane.getViewport().add(cronJobsTable); addJobButton = new JButton("Add"); addJobButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { ((DefaultTableModel) cronJobsTable.getModel()).addRow(new Vector<String>()); int rowSelectionNumber = cronJobsTable.getRowCount() - 1; cronJobsTable.setRowSelectionInterval(rowSelectionNumber, rowSelectionNumber); PlatformUI.MIRTH_FRAME.setSaveEnabled(true); Boolean enabled = deleteJobButton.isEnabled(); if (!enabled) { deleteJobButton.setEnabled(true); } updateNextFireTime(); } }); deleteJobButton = new JButton("Delete"); deleteJobButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { int rowSelectionNumber = cronJobsTable.getSelectedRow(); if (rowSelectionNumber > -1) { DefaultTableModel model = (DefaultTableModel) cronJobsTable.getModel(); model.removeRow(rowSelectionNumber); rowSelectionNumber--; if (rowSelectionNumber > -1) { cronJobsTable.setRowSelectionInterval(rowSelectionNumber, rowSelectionNumber); } else if (cronJobsTable.getRowCount() > 0) { cronJobsTable.setRowSelectionInterval(0, 0); } if (cronJobsTable.getRowCount() == 0) { deleteJobButton.setEnabled(false); } } updateNextFireTime(); PlatformUI.MIRTH_FRAME.setSaveEnabled(true); } }); deleteJobButton.setEnabled(false); advancedSettingsButton = new JButton(new ImageIcon(Frame.class.getResource("images/wrench.png"))); advancedSettingsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { lastSelectedPollingType = StringUtils.isBlank(lastSelectedPollingType) ? "Interval" : lastSelectedPollingType; new AdvancedPollingSettingsDialog(lastSelectedPollingType, cachedAdvancedConnectorProperties, channelContext); updateNextFireTime(); } }); timeSettingsLabel = new JLabel("Interval:"); timeSettingsLabel.setBackground(UIConstants.BACKGROUND_COLOR); scheduleSettingsPanel = new JPanel(); scheduleSettingsPanel.setBackground(UIConstants.BACKGROUND_COLOR); if (!channelContext) { // @formatter:off scheduleTypeComboBox.setToolTipText("<html>Select the pruning schedule type.<br>" + "Select \"Interval\" to prune each n units of time.<br>" + "Select \"Time\" to prune once a day at the specified time.<br>" + "Select \"Cron\" to prune at the specified cron expression(s).</html>"); // @formatter:on pollingFrequencyField.setToolTipText( "<html>The specified repeating time interval.<br/>Units must be between 1 and 24 hours of time<br/>when converted to milliseconds.</html>"); } }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingISOCountryCurrencyPickerJPanel.java
public CFAsteriskSwingISOCountryCurrencyPickerJPanel(ICFAsteriskSwingSchema argSchema, ICFSecurityISOCountryCurrencyObj argFocus, ICFSecurityISOCountryObj argContainer, Collection<ICFSecurityISOCountryCurrencyObj> argDataCollection, ICFAsteriskSwingISOCountryCurrencyChosen whenChosen) { super();//from w w w.j a v a 2 s . c o m final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 5, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; swingContainer = argContainer; setSwingDataCollection(argDataCollection); dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel()); dataTable.addMouseListener(getDataListMouseAdapter()); dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); dataTable.setUpdateSelectionOnSort(true); dataTable.setRowHeight(25); getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener()); dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); dataScrollPane.setColumnHeader(new JViewport() { @Override public Dimension getPreferredSize() { Dimension sz = super.getPreferredSize(); sz.height = 25; return (sz); } }); dataTable.setFillsViewportHeight(true); actionCancel = new ActionCancel(); buttonCancel = new JButton(actionCancel); actionChooseNone = new ActionChooseNone(); buttonChooseNone = new JButton(actionChooseNone); actionChooseSelected = new ActionChooseSelectedISOCountryCurrency(); buttonChooseSelected = new JButton(actionChooseSelected); // Do initial layout setSize(1024, 480); add(buttonChooseNone); add(buttonChooseSelected); add(buttonCancel); add(dataScrollPane); dataScrollPane.setBounds(0, 35, 1024, 455); doLayout(); setSwingFocusAsISOCountryCurrency(argFocus); }