List of usage examples for javax.swing.event DocumentListener DocumentListener
DocumentListener
From source file:com.igormaznitsa.mindmap.swing.panel.MindMapPanel.java
public MindMapPanel(final MindMapPanelController controller) { super(null);/*from w ww . j a v a 2s.co m*/ this.textEditorPanel.setLayout(new BorderLayout(0, 0)); this.controller = controller; this.config = new MindMapPanelConfig(controller.provideConfigForMindMapPanel(this), false); this.textEditor.setMargin(new Insets(5, 5, 5, 5)); this.textEditor.setBorder(BorderFactory.createEtchedBorder()); this.textEditor.setTabSize(4); this.textEditor.addKeyListener(new KeyAdapter() { @Override public void keyPressed(final KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_ENTER: { e.consume(); } break; case KeyEvent.VK_TAB: { if ((e.getModifiers() & ALL_SUPPORTED_MODIFIERS) == 0) { e.consume(); final Topic edited = elementUnderEdit.getModel(); final int[] topicPosition = edited.getPositionPath(); endEdit(true); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final Topic theTopic = model.findForPositionPath(topicPosition); if (theTopic != null) { makeNewChildAndStartEdit(theTopic, null); } } }); } } break; default: break; } } @Override public void keyTyped(final KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_ENTER) { if ((e.getModifiers() & ALL_SUPPORTED_MODIFIERS) == 0) { e.consume(); endEdit(true); } else { e.consume(); textEditor.insert("\n", textEditor.getCaretPosition()); //NOI18N } } } @Override public void keyReleased(final KeyEvent e) { if (config.isKeyEvent(MindMapPanelConfig.KEY_CANCEL_EDIT, e)) { e.consume(); final Topic edited = elementUnderEdit == null ? null : elementUnderEdit.getModel(); endEdit(false); if (edited != null && edited.canBeLost()) { deleteTopics(edited); if (pathToPrevTopicBeforeEdit != null) { final int[] path = pathToPrevTopicBeforeEdit; pathToPrevTopicBeforeEdit = null; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final Topic topic = model.findForPositionPath(path); if (topic != null) { select(topic, false); } } }); } } } } }); this.textEditor.getDocument().addDocumentListener(new DocumentListener() { private void updateEditorPanelSize(final Dimension newSize) { final Dimension editorPanelMinSize = textEditorPanel.getMinimumSize(); final Dimension newDimension = new Dimension(Math.max(editorPanelMinSize.width, newSize.width), Math.max(editorPanelMinSize.height, newSize.height)); textEditorPanel.setSize(newDimension); textEditorPanel.repaint(); } @Override public void insertUpdate(DocumentEvent e) { updateEditorPanelSize(textEditor.getPreferredSize()); } @Override public void removeUpdate(DocumentEvent e) { updateEditorPanelSize(textEditor.getPreferredSize()); } @Override public void changedUpdate(DocumentEvent e) { updateEditorPanelSize(textEditor.getPreferredSize()); } }); this.textEditorPanel.add(this.textEditor, BorderLayout.CENTER); super.setOpaque(true); final KeyAdapter keyAdapter = new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { if (config.isKeyEvent(MindMapPanelConfig.KEY_ADD_CHILD_AND_START_EDIT, e)) { if (!selectedTopics.isEmpty()) { makeNewChildAndStartEdit(selectedTopics.get(0), null); } } else if (config.isKeyEvent(MindMapPanelConfig.KEY_ADD_SIBLING_AND_START_EDIT, e)) { if (!hasActiveEditor() && hasOnlyTopicSelected()) { final Topic baseTopic = selectedTopics.get(0); makeNewChildAndStartEdit(baseTopic.getParent() == null ? baseTopic : baseTopic.getParent(), baseTopic); } } else if (config.isKeyEvent(MindMapPanelConfig.KEY_FOCUS_ROOT_OR_START_EDIT, e)) { if (!hasSelectedTopics()) { select(getModel().getRoot(), false); } else if (hasOnlyTopicSelected()) { startEdit((AbstractElement) selectedTopics.get(0).getPayload()); } } } @Override public void keyReleased(final KeyEvent e) { if (config.isKeyEvent(MindMapPanelConfig.KEY_DELETE_TOPIC, e)) { e.consume(); deleteSelectedTopics(); } else if (config.isKeyEventDetected(e, MindMapPanelConfig.KEY_FOCUS_MOVE_LEFT, MindMapPanelConfig.KEY_FOCUS_MOVE_RIGHT, MindMapPanelConfig.KEY_FOCUS_MOVE_UP, MindMapPanelConfig.KEY_FOCUS_MOVE_DOWN)) { e.consume(); processMoveFocusByKey(e); } } }; this.setFocusTraversalKeysEnabled(false); final MindMapPanel theInstance = this; final MouseAdapter adapter = new MouseAdapter() { @Override public void mouseEntered(final MouseEvent e) { setCursor(Cursor.getDefaultCursor()); } @Override public void mouseMoved(final MouseEvent e) { if (!controller.isMouseMoveProcessingAllowed(theInstance)) { return; } final AbstractElement element = findTopicUnderPoint(e.getPoint()); if (element == null) { setCursor(Cursor.getDefaultCursor()); setToolTipText(null); } else { final ElementPart part = element.findPartForPoint(e.getPoint()); setCursor(part == ElementPart.ICONS || part == ElementPart.COLLAPSATOR ? Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) : Cursor.getDefaultCursor()); if (part == ElementPart.ICONS) { final Extra<?> extra = element.getIconBlock().findExtraForPoint( e.getPoint().getX() - element.getBounds().getX(), e.getPoint().getY() - element.getBounds().getY()); if (extra != null) { setToolTipText(makeHtmlTooltipForExtra(extra)); } else { setToolTipText(null); } } else { setToolTipText(null); } } } @Override public void mousePressed(final MouseEvent e) { if (!controller.isMouseClickProcessingAllowed(theInstance)) { return; } try { if (e.isPopupTrigger()) { mouseDragSelection = null; MindMap theMap = model; AbstractElement element = null; if (theMap != null) { element = findTopicUnderPoint(e.getPoint()); } processPopUp(e.getPoint(), element); e.consume(); } else { endEdit(elementUnderEdit != null); mouseDragSelection = null; } } catch (Exception ex) { LOGGER.error("Error during mousePressed()", ex); } } @Override public void mouseReleased(final MouseEvent e) { if (!controller.isMouseClickProcessingAllowed(theInstance)) { return; } try { if (draggedElement != null) { draggedElement.updatePosition(e.getPoint()); if (endDragOfElement(draggedElement, destinationElement)) { updateView(true); } } else if (mouseDragSelection != null) { final List<Topic> covered = mouseDragSelection.getAllSelectedElements(model); if (e.isShiftDown()) { for (final Topic m : covered) { select(m, false); } } else if (e.isControlDown()) { for (final Topic m : covered) { select(m, true); } } else { removeAllSelection(); for (final Topic m : covered) { select(m, false); } } } else if (e.isPopupTrigger()) { mouseDragSelection = null; MindMap theMap = model; AbstractElement element = null; if (theMap != null) { element = findTopicUnderPoint(e.getPoint()); } processPopUp(e.getPoint(), element); e.consume(); } } catch (Exception ex) { LOGGER.error("Error during mouseReleased()", ex); } finally { mouseDragSelection = null; draggedElement = null; destinationElement = null; repaint(); } } @Override public void mouseDragged(final MouseEvent e) { if (!controller.isMouseMoveProcessingAllowed(theInstance)) { return; } scrollRectToVisible(new Rectangle(e.getX(), e.getY(), 1, 1)); if (!popupMenuActive) { if (draggedElement == null && mouseDragSelection == null) { final AbstractElement elementUnderMouse = findTopicUnderPoint(e.getPoint()); if (elementUnderMouse == null) { MindMap theMap = model; if (theMap != null) { final AbstractElement element = findTopicUnderPoint(e.getPoint()); if (controller.isSelectionAllowed(theInstance) && element == null) { mouseDragSelection = new MouseSelectedArea(e.getPoint()); } } } else if (controller.isElementDragAllowed(theInstance)) { if (elementUnderMouse.isMoveable()) { selectedTopics.clear(); final Point mouseOffset = new Point( (int) Math .round(e.getPoint().getX() - elementUnderMouse.getBounds().getX()), (int) Math .round(e.getPoint().getY() - elementUnderMouse.getBounds().getY())); draggedElement = new DraggedElement(elementUnderMouse, config, mouseOffset, e.isControlDown() || e.isMetaDown() ? DraggedElement.Modifier.MAKE_JUMP : DraggedElement.Modifier.NONE); draggedElement.updatePosition(e.getPoint()); findDestinationElementForDragged(); } else { draggedElement = null; } repaint(); } } else if (mouseDragSelection != null) { if (controller.isSelectionAllowed(theInstance)) { mouseDragSelection.update(e); } else { mouseDragSelection = null; } repaint(); } else if (draggedElement != null) { if (controller.isElementDragAllowed(theInstance)) { draggedElement.updatePosition(e.getPoint()); findDestinationElementForDragged(); } else { draggedElement = null; } repaint(); } } else { mouseDragSelection = null; } } @Override public void mouseWheelMoved(final MouseWheelEvent e) { if (controller.isMouseWheelProcessingAllowed(theInstance)) { mouseDragSelection = null; draggedElement = null; final MindMapPanelConfig theConfig = config; if (!e.isConsumed() && (theConfig != null && ((e.getModifiers() & theConfig.getScaleModifiers()) == theConfig .getScaleModifiers()))) { endEdit(elementUnderEdit != null); setScale( Math.max(0.3d, Math.min(getScale() + (SCALE_STEP * -e.getWheelRotation()), 10.0d))); updateView(false); e.consume(); } else { sendToParent(e); } } } @Override public void mouseClicked(final MouseEvent e) { if (!controller.isMouseClickProcessingAllowed(theInstance)) { return; } mouseDragSelection = null; draggedElement = null; MindMap theMap = model; AbstractElement element = null; if (theMap != null) { element = findTopicUnderPoint(e.getPoint()); } if (element != null) { final ElementPart part = element.findPartForPoint(e.getPoint()); if (part == ElementPart.COLLAPSATOR) { removeAllSelection(); if (element.isCollapsed()) { ((AbstractCollapsableElement) element).setCollapse(false); if ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0) { ((AbstractCollapsableElement) element).collapseAllFirstLevelChildren(); } } else { ((AbstractCollapsableElement) element).setCollapse(true); } invalidate(); fireNotificationMindMapChanged(); repaint(); } else if (part != ElementPart.ICONS && e.getClickCount() > 1) { startEdit(element); } else if (part == ElementPart.ICONS) { final Extra<?> extra = element.getIconBlock().findExtraForPoint( e.getPoint().getX() - element.getBounds().getX(), e.getPoint().getY() - element.getBounds().getY()); if (extra != null) { fireNotificationClickOnExtra(element.getModel(), e.getClickCount(), extra); } } else { if (!e.isControlDown()) { // only removeAllSelection(); select(element.getModel(), false); } else // group if (selectedTopics.isEmpty()) { select(element.getModel(), false); } else { select(element.getModel(), true); } } } } }; addMouseWheelListener(adapter); addMouseListener(adapter); addMouseMotionListener(adapter); addKeyListener(keyAdapter); this.textEditorPanel.setVisible(false); this.add(this.textEditorPanel); }
From source file:ca.phon.app.session.editor.view.session_information.SessionInfoEditorView.java
public DatePicker createDateField() { final DatePicker retVal = new DatePicker(); final LocalDate sessionDate = getEditor().getSession().getDate(); if (sessionDate != null) retVal.setDateTime(sessionDate); retVal.getTextField().getDocument().addDocumentListener(new DocumentListener() { void dateFieldUpdate() { final LocalDate selectedDate = retVal.getDateTime(); final LocalDate newDate = LocalDate.from(selectedDate); final SessionDateEdit edit = new SessionDateEdit(getEditor(), newDate, getEditor().getSession().getDate()); edit.setSource(dateField);//from ww w.j a v a 2s . c om getEditor().getUndoSupport().postEdit(edit); } @Override public void insertUpdate(DocumentEvent e) { if (!dateField.isValueAdjusing()) dateFieldUpdate(); } @Override public void removeUpdate(DocumentEvent e) { if (!dateField.isValueAdjusing()) dateFieldUpdate(); } @Override public void changedUpdate(DocumentEvent e) { } }); return retVal; }
From source file:com.diversityarrays.kdxplore.trials.SampleGroupExportDialog.java
public SampleGroupExportDialog(Window owner, String title, Trial trial, KdxploreDatabase kdxploreDatabase, DeviceType deviceType, DeviceIdentifier devid, SampleGroup sampleGroup, Set<Integer> excludeTheseTraitIds, Map<Integer, Trait> allTraitIds, Set<Integer> excludeThesePlotIds) { super(owner, title, ModalityType.APPLICATION_MODAL); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setGlassPane(backgroundRunner.getBlockingPane()); this.allTraits = allTraitIds; this.trial = trial; this.kdxploreDatabase = kdxploreDatabase; this.sampleGroup = sampleGroup; this.excludeTheseTraitIds = excludeTheseTraitIds; this.excludeThesePlotIds = excludeThesePlotIds; String deviceName = devid == null ? "Unknown_" + deviceType.name() : devid.getDeviceName(); if (DeviceType.FOR_SCORING.equals(deviceType)) { if (!Check.isEmpty(sampleGroup.getOperatorName())) { deviceName = sampleGroup.getOperatorName(); }/* w ww . j a v a 2 s .c o m*/ } File directory = KdxplorePreferences.getInstance().getOutputDirectory(); if (directory == null) { directory = new File(System.getProperty("user.home")); } String filename = Util.getTimestampedOutputFileName(trial.getTrialName(), deviceName); File outfile = new File(directory, filename); filepathText.setText(outfile.getPath()); filepathText.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { updateButtons(); } @Override public void insertUpdate(DocumentEvent e) { updateButtons(); } @Override public void changedUpdate(DocumentEvent e) { updateButtons(); } }); updateButtons(); boolean developer = RunMode.getRunMode().isDeveloper(); oldKdsmartOption.setForeground(Color.BLUE); oldKdsmartOption.setToolTipText("For ElapsedDays value compatiblity with older versions of KDSmart"); Box exportForOptionsBox = Box.createHorizontalBox(); for (JComponent comp : exportForOptions) { if (developer || comp != oldKdsmartOption) { exportForOptionsBox.add(comp); } } Map<JRadioButton, OutputOption> optionByRb = new HashMap<>(); ActionListener rbListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { selectedOutputOption = optionByRb.get(e.getSource()); boolean enb = selectedOutputOption.exportFor != null; for (JComponent comp : exportForOptions) { if (comp == wantMediaFilesOption) { comp.setEnabled(enb && selectedOutputOption.supportsMediaFiles()); } else if (comp == kdsmartVersion3option) { comp.setEnabled(enb && selectedOutputOption.usesWorkPackage()); } else { comp.setEnabled(enb); } } } }; boolean anySamplesForIndividuals = true; try { anySamplesForIndividuals = kdxploreDatabase.getAnySamplesForIndividuals(sampleGroup); } catch (IOException e) { Shared.Log.w("SampleGroupExportDialog", "getAnySamplesForIndividuals", e); } ButtonGroup bg = new ButtonGroup(); Box radioButtons = Box.createHorizontalBox(); List<OutputOption> options = new ArrayList<>(); Collections.addAll(options, OutputOption.values()); if (!anySamplesForIndividuals) { // No relevant samples so don't bother offering the option. options.remove(OutputOption.CSV_FULL); } for (OutputOption oo : options) { if (!developer && OutputOption.JSON == oo) { continue; } JRadioButton rb = new JRadioButton(oo.displayName); if (OutputOption.KDX == oo) { kdxExportButton = rb; } if (OutputOption.ZIP == oo) { zipExportButton = rb; } rb.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { exportExclusionBox.selectAndDeactivateButtons( kdxExportButton.isSelected() || zipExportButton.isSelected()); } }); if (OutputOption.JSON == oo) { rb.setForeground(Color.BLUE); rb.setToolTipText("Developer Only"); } bg.add(rb); optionByRb.put(rb, oo); radioButtons.add(rb); rb.addActionListener(rbListener); if (bg.getButtonCount() == 1) { rb.doClick(); } } Box additionalOptionsBox = Box.createHorizontalBox(); additionalOptionsBox.add(this.wantMediaFilesOption); additionalOptionsBox.add(this.kdsmartVersion3option); dbVersionLabel.setToolTipText(TTT_DATABASE_VERSION_FOR_EXPORT); databaseVersionChoices.setToolTipText(TTT_DATABASE_VERSION_FOR_EXPORT); JPanel panel = new JPanel(); GBH gbh = new GBH(panel); int y = 0; gbh.add(0, y, 1, 1, GBH.NONE, 0, 1, GBH.EAST, "Output File:"); gbh.add(1, y, 1, 1, GBH.HORZ, 1, 1, GBH.CENTER, filepathText); gbh.add(2, y, 1, 1, GBH.NONE, 1, 1, GBH.WEST, new JButton(browseFileAction)); ++y; gbh.add(0, y, 1, 1, GBH.NONE, 0, 1, GBH.EAST, "Options:"); gbh.add(1, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, radioButtons); ++y; gbh.add(0, y, 3, 1, GBH.HORZ, 1, 1, GBH.CENTER, exportExclusionBox); ++y; gbh.add(0, y, 3, 1, GBH.HORZ, 1, 1, GBH.CENTER, additionalOptionsBox); ++y; gbh.add(0, y, 1, 1, GBH.NONE, 0, 1, GBH.EAST, dbVersionLabel); gbh.add(1, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, BoxBuilder.horizontal().add(databaseVersionChoices).get()); gbh.add(1, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, exportForOptionsBox); ++y; Box buttons = Box.createHorizontalBox(); buttons.add(Box.createHorizontalGlue()); buttons.add(new JButton(cancelAction)); buttons.add(new JButton(exportAction)); buttons.add(new JButton(exportAndCloseAction)); Container cp = getContentPane(); cp.add(panel, BorderLayout.CENTER); cp.add(buttons, BorderLayout.SOUTH); pack(); }
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 a 2 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:dmh.kuebiko.view.NoteStackFrame.java
/** * Perform additional setup to the frame. This is separate from the * initialize() method so that the GUI builder doesn't mess with it. *///www. jav a 2 s .co m private void additionalSetup() { mode = Mode.SEARCH; setFocusTraversalPolicy(new CustomFocusTraversalPolicy(searchText, notePanel)); // Search Text Field. AutoCompleteDecorator.decorate(searchText, noteMngr.getNoteTitles(), false); searchText.getInputMap().put(KeyStroke.getKeyStroke("ESCAPE"), "clear"); searchText.getDocument().addDocumentListener(new DocumentListener() { @Override public void changedUpdate(DocumentEvent e) { onSearchTextChanged(); } @Override public void insertUpdate(DocumentEvent e) { onSearchTextChanged(); } @Override public void removeUpdate(DocumentEvent e) { onSearchTextChanged(); } }); searchText.getActionMap().put("clear", new AbstractAction() { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { searchText.setText(null); } }); searchText.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { setModeToSearch(); searchText.selectAll(); } @Override public void focusLost(FocusEvent e) { noteTable.selectNote(searchText.getText()); } }); searchText.addActionListener(actionMngr.getAction(NewNoteAction.class)); // Note Table. noteTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent event) { if (event.getValueIsAdjusting()) { return; } final Note selectedNote = noteTable.getSelectedNote(); if (selectedNote == null) { setModeToSearch(); } else { setModeToEdit(); notePanel.setNote(selectedNote); searchText.setText(selectedNote.getTitle()); } } }); }
From source file:com._17od.upm.gui.MainWindow.java
private void addComponentsToPane() { // Ensure the layout manager is a BorderLayout if (!(getContentPane().getLayout() instanceof GridBagLayout)) { getContentPane().setLayout(new GridBagLayout()); }/*from w w w . j a v a 2 s.c o m*/ // Create the menubar setJMenuBar(createMenuBar()); GridBagConstraints c = new GridBagConstraints(); // The toolbar Row c.gridx = 0; c.gridy = 0; c.anchor = GridBagConstraints.FIRST_LINE_START; c.insets = new Insets(0, 0, 0, 0); c.weightx = 0; c.weighty = 0; c.gridwidth = 3; c.fill = GridBagConstraints.HORIZONTAL; Component toolbar = createToolBar(); getContentPane().add(toolbar, c); // Keep the frame background color consistent getContentPane().setBackground(toolbar.getBackground()); // The seperator Row c.gridx = 0; c.gridy = 1; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 0, 0, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 3; c.fill = GridBagConstraints.HORIZONTAL; getContentPane().add(new JSeparator(), c); // The search field row searchIcon = new JLabel(Util.loadImage("search.gif")); searchIcon.setDisabledIcon(Util.loadImage("search_d.gif")); searchIcon.setEnabled(false); c.gridx = 0; c.gridy = 2; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(5, 1, 5, 1); c.weightx = 0; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; getContentPane().add(searchIcon, c); searchField = new JTextField(15); searchField.setEnabled(false); searchField.setMinimumSize(searchField.getPreferredSize()); searchField.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { // This method never seems to be called } public void insertUpdate(DocumentEvent e) { dbActions.filter(); } public void removeUpdate(DocumentEvent e) { dbActions.filter(); } }); searchField.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { dbActions.resetSearch(); } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { // If the user hits the enter key in the search field and // there's only one item // in the listview then open that item (this code assumes // that the one item in // the listview has already been selected. this is done // automatically in the // DatabaseActions.filter() method) if (accountsListview.getModel().getSize() == 1) { viewAccountMenuItem.doClick(); } } } }); c.gridx = 1; c.gridy = 2; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(5, 1, 5, 1); c.weightx = 0; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; getContentPane().add(searchField, c); resetSearchButton = new JButton(Util.loadImage("stop.gif")); resetSearchButton.setDisabledIcon(Util.loadImage("stop_d.gif")); resetSearchButton.setEnabled(false); resetSearchButton.setToolTipText(Translator.translate(RESET_SEARCH_TXT)); resetSearchButton.setActionCommand(RESET_SEARCH_TXT); resetSearchButton.addActionListener(this); resetSearchButton.setBorder(BorderFactory.createEmptyBorder()); resetSearchButton.setFocusable(false); c.gridx = 2; c.gridy = 2; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(5, 1, 5, 1); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; getContentPane().add(resetSearchButton, c); // The accounts listview row accountsListview = new JList(); accountsListview.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); accountsListview.setSelectedIndex(0); accountsListview.setVisibleRowCount(10); accountsListview.setModel(new SortedListModel()); JScrollPane accountsScrollList = new JScrollPane(accountsListview, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); accountsListview.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { // If the listview gets focus, there is one ore more items in // the listview and there is nothing // already selected, then select the first item in the list if (accountsListview.getModel().getSize() > 0 && accountsListview.getSelectedIndex() == -1) { accountsListview.setSelectionInterval(0, 0); } } }); accountsListview.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { dbActions.setButtonState(); } }); accountsListview.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { viewAccountMenuItem.doClick(); } } }); accountsListview.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { viewAccountMenuItem.doClick(); } } }); // Create a shortcut to delete account functionality with DEL(delete) // key accountsListview.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_DELETE) { try { dbActions.reloadDatabaseBefore(new DeleteAccountAction()); } catch (InvalidPasswordException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (ProblemReadingDatabaseFile e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } } }); c.gridx = 0; c.gridy = 3; c.anchor = GridBagConstraints.CENTER; c.insets = new Insets(0, 1, 1, 1); c.weightx = 1; c.weighty = 1; c.gridwidth = 3; c.fill = GridBagConstraints.BOTH; getContentPane().add(accountsScrollList, c); // The "File Changed" panel c.gridx = 0; c.gridy = 4; c.anchor = GridBagConstraints.CENTER; c.insets = new Insets(0, 1, 0, 1); c.ipadx = 3; c.ipady = 3; c.weightx = 0; c.weighty = 0; c.gridwidth = 3; c.fill = GridBagConstraints.BOTH; databaseFileChangedPanel = new JPanel(); databaseFileChangedPanel.setLayout(new BoxLayout(databaseFileChangedPanel, BoxLayout.X_AXIS)); databaseFileChangedPanel.setBackground(new Color(249, 172, 60)); databaseFileChangedPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); JLabel fileChangedLabel = new JLabel("Database file changed"); fileChangedLabel.setAlignmentX(LEFT_ALIGNMENT); databaseFileChangedPanel.add(fileChangedLabel); databaseFileChangedPanel.add(Box.createHorizontalGlue()); JButton reloadButton = new JButton("Reload"); reloadButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { dbActions.reloadDatabaseFromDisk(); } catch (Exception ex) { dbActions.errorHandler(ex); } } }); databaseFileChangedPanel.add(reloadButton); databaseFileChangedPanel.setVisible(false); getContentPane().add(databaseFileChangedPanel, c); // Add the statusbar c.gridx = 0; c.gridy = 5; c.anchor = GridBagConstraints.CENTER; c.insets = new Insets(0, 1, 1, 1); c.weightx = 1; c.weighty = 0; c.gridwidth = 3; c.fill = GridBagConstraints.HORIZONTAL; getContentPane().add(statusBar, c); }
From source file:com.microsoft.intellij.forms.CreateWebSiteForm.java
private DocumentListener createServerUrlListener() { return new DocumentListener() { @Override// w w w .ja v a 2s. com public void insertUpdate(DocumentEvent e) { handleUpdate(); } @Override public void removeUpdate(DocumentEvent e) { handleUpdate(); } @Override public void changedUpdate(DocumentEvent e) { handleUpdate(); } private void handleUpdate() { String url = customUrl.getText().trim(); String nameInUrl = StorageRegistryUtilMethods.getAccNameFromUrl(url); storageNames.setSelectedItem(JdkSrvConfigUtilMethods.getNameToSet(url, nameInUrl, StorageRegistryUtilMethods.getStorageAccountNames(false))); } }; }
From source file:com.mirth.connect.connectors.doc.DocumentWriter.java
private void initComponents() { setBackground(UIConstants.BACKGROUND_COLOR); outputLabel = new JLabel("Output:"); ButtonGroup outputButtonGroup = new ButtonGroup(); outputFileRadioButton = new MirthRadioButton("File"); outputFileRadioButton.setBackground(getBackground()); outputFileRadioButton.setToolTipText("Write the contents to a file."); outputFileRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { updateFileEnabled(true);/*from ww w. ja va 2 s .c o m*/ } }); outputButtonGroup.add(outputFileRadioButton); outputAttachmentRadioButton = new MirthRadioButton("Attachment"); outputAttachmentRadioButton.setBackground(getBackground()); outputAttachmentRadioButton.setToolTipText( "<html>Write the contents to an attachment. The destination's response message will contain the<br>attachment Id and can be used in subsequent connectors to include the attachment.</html>"); outputAttachmentRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { updateFileEnabled(false); } }); outputButtonGroup.add(outputAttachmentRadioButton); outputBothRadioButton = new MirthRadioButton("Both"); outputBothRadioButton.setBackground(getBackground()); outputBothRadioButton.setToolTipText( "<html>Write the contents to a file and an attachment. The destination's response message will contain<br>the attachment Id and can be used in subsequent connectors to include the attachment.</html>"); outputBothRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { updateFileEnabled(true); } }); outputButtonGroup.add(outputBothRadioButton); directoryLabel = new JLabel("Directory:"); directoryField = new MirthTextField(); directoryField.setToolTipText("The directory (folder) where the generated file should be written."); testConnectionButton = new JButton("Test Write"); testConnectionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { testConnection(); } }); fileNameLabel = new JLabel("File Name:"); fileNameField = new MirthTextField(); fileNameField.setToolTipText("The file name to give to the generated file."); documentTypeLabel = new JLabel("Document Type:"); ButtonGroup documentTypeButtonGroup = new ButtonGroup(); documentTypePDFRadio = new MirthRadioButton("PDF"); documentTypePDFRadio.setBackground(getBackground()); documentTypePDFRadio.setToolTipText("The type of document to be created for each message."); documentTypePDFRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { documentTypePDFRadioActionPerformed(); } }); documentTypeButtonGroup.add(documentTypePDFRadio); documentTypeRTFRadio = new MirthRadioButton("RTF"); documentTypeRTFRadio.setBackground(getBackground()); documentTypeRTFRadio.setToolTipText("The type of document to be created for each message."); documentTypeRTFRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { documentTypeRTFRadioActionPerformed(); } }); documentTypeButtonGroup.add(documentTypeRTFRadio); encryptedLabel = new JLabel("Encrypted:"); ButtonGroup encryptedButtonGroup = new ButtonGroup(); encryptedYesRadio = new MirthRadioButton("Yes"); encryptedYesRadio.setBackground(getBackground()); encryptedYesRadio.setToolTipText( "If Document Type PDF is selected, generated documents can optionally be encrypted."); encryptedYesRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { encryptedYesActionPerformed(); } }); encryptedButtonGroup.add(encryptedYesRadio); encryptedNoRadio = new MirthRadioButton("No"); encryptedNoRadio.setBackground(getBackground()); encryptedNoRadio.setToolTipText( "If Document Type PDF is selected, generated documents can optionally be encrypted."); encryptedNoRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { encryptedNoActionPerformed(); } }); encryptedButtonGroup.add(encryptedNoRadio); passwordLabel = new JLabel("Password:"); passwordField = new MirthPasswordField(); passwordField.setToolTipText( "If Encrypted Yes is selected, enter the password to be used to later view the document here."); pageSizeLabel = new JLabel("Page Size:"); pageSizeXLabel = new JLabel(""); DocumentListener pageSizeDocumentListener = new DocumentListener() { @Override public void removeUpdate(DocumentEvent evt) { updatePageSizeComboBox(); } @Override public void insertUpdate(DocumentEvent evt) { updatePageSizeComboBox(); } @Override public void changedUpdate(DocumentEvent evt) { updatePageSizeComboBox(); } }; pageSizeWidthField = new MirthTextField(); pageSizeWidthField.getDocument().addDocumentListener(pageSizeDocumentListener); pageSizeWidthField.setToolTipText( "<html>The width of the page. The units for the width<br/>are determined by the drop-down menu to the right.<br/>When rendering PDFs, a minimum of 26mm is enforced.</html>"); pageSizeHeightField = new MirthTextField(); pageSizeHeightField.getDocument().addDocumentListener(pageSizeDocumentListener); pageSizeHeightField.setToolTipText( "<html>The height of the page. The units for the height<br/>are determined by the drop-down menu to the right.<br/>When rendering PDFs, a minimum of 26mm is enforced.</html>"); pageSizeUnitComboBox = new MirthComboBox<Unit>(); pageSizeUnitComboBox.setModel(new DefaultComboBoxModel<Unit>(Unit.values())); pageSizeUnitComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { updatePageSizeComboBox(); } }); pageSizeUnitComboBox.setToolTipText("The units to use for the page width and height."); pageSizeComboBox = new MirthComboBox<PageSize>(); pageSizeComboBox.setModel(new DefaultComboBoxModel<PageSize>( ArrayUtils.subarray(PageSize.values(), 0, PageSize.values().length - 1))); pageSizeComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { pageSizeComboBoxActionPerformed(); } }); pageSizeComboBox.setToolTipText("Select a standard page size to use, or enter a custom page size."); templateLabel = new JLabel("HTML Template:"); templateTextArea = new MirthRTextScrollPane(ContextType.DESTINATION_DISPATCHER, false, SyntaxConstants.SYNTAX_STYLE_HTML, false); templateTextArea.setBorder(BorderFactory.createEtchedBorder()); }
From source file:com.stonelion.zooviewer.ui.JZVNodePanel.java
private void initListeners() { taUpdate.getDocument().addDocumentListener(new DocumentListener() { @Override// ww w. j a va 2 s. c o m public void removeUpdate(DocumentEvent e) { enableAction(e); } @Override public void insertUpdate(DocumentEvent e) { enableAction(e); } @Override public void changedUpdate(DocumentEvent e) { enableAction(e); } private void enableAction(DocumentEvent e) { boolean enabled = e.getDocument().getLength() > 0; getUpdateAction().setEnabled(enabled); } }); }
From source file:net.sf.dvstar.transmission.TransmissionView.java
/** * Main class for visual application//ww w.j av a 2 s . co m * @param app Parent application framework */ public TransmissionView(SingleFrameApplication app) { super(app); this.singleFrameApplication = app; this.transmissionView = this; initGlobals(); initLogger(); initComponents(); initLocale(); initTimers(); ResourceMap resourceMap = getResourceMap(); idleIcon = resourceMap.getIcon("StatusBar.idleIcon"); statusAnimationLabel.setIcon(idleIcon); progressBar.setVisible(false); piecesGraph = new PiecesGraph(); plPieces.add(piecesGraph, BorderLayout.CENTER); modelTorrentsList = new TorrentsTableModel(this); TorrentsTableModel.setPreferredColumnWidths(tblTorrentList); setRefButtonsState(connectedServer); setAllButtonsState(connectedServer); tblTorrentList.setModel(modelTorrentsList); /** * Set sorter to table */ //!!tblTorrentList.setAutoCreateRowSorter(true); TorrentListRowSorter rorrentListRowSorter = new TorrentListRowSorter( (TorrentsTableModel) tblTorrentList.getModel()); tblTorrentList.setRowSorter(rorrentListRowSorter); PopupListener popupListener = new PopupListener(); tblTorrentList.addMouseListener(popupListener); tblTorrentList.getTableHeader().addMouseListener(popupListener); tblTorrentList.setRowSelectionAllowed(true); tblTorrentList.tableChanged(new TableModelEvent(modelTorrentsList)); jTabbedPane1.setIconAt(0, globalResourceMap.getIcon("tpInfo.icon0")); jTabbedPane1.setIconAt(1, globalResourceMap.getIcon("tpInfo.icon1")); jTabbedPane1.setIconAt(2, globalResourceMap.getIcon("tpInfo.icon2")); jTabbedPane1.setIconAt(3, globalResourceMap.getIcon("tpInfo.icon3")); jTabbedPane1.setIconAt(4, globalResourceMap.getIcon("tpInfo.icon4")); // connecting action tasks to status bar via TaskMonitor TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext()); taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() { @Override public void propertyChange(java.beans.PropertyChangeEvent evt) { String propertyName = evt.getPropertyName(); if ("started".equals(propertyName)) { if (!busyIconTimer.isRunning()) { statusAnimationLabel.setIcon(busyIcons[0]); busyIconIndex = 0; busyIconTimer.start(); } progressBar.setVisible(true); progressBar.setIndeterminate(true); } else if ("done".equals(propertyName)) { busyIconTimer.stop(); statusAnimationLabel.setIcon(idleIcon); progressBar.setVisible(false); progressBar.setValue(0); } else if ("message".equals(propertyName)) { String text = (String) (evt.getNewValue()); statusMessageLabel.setText((text == null) ? "" : text); messageTimer.restart(); } else if ("progress".equals(propertyName)) { int value = (Integer) (evt.getNewValue()); progressBar.setVisible(true); progressBar.setIndeterminate(false); progressBar.setValue(value); } } }); //setAdditionalButtons(); //Whenever filterText changes, invoke newFilter. tfFindItem.getDocument().addDocumentListener(new DocumentListener() { @Override public void changedUpdate(DocumentEvent e) { setTorrentListFilter(); } @Override public void insertUpdate(DocumentEvent e) { setTorrentListFilter(); } @Override public void removeUpdate(DocumentEvent e) { setTorrentListFilter(); } }); checkNavigator(); updateInfoBox(-1); btConnect.grabFocus(); }