List of usage examples for javax.swing SwingWorker SwingWorker
public SwingWorker()
From source file:com.mirth.connect.client.ui.Frame.java
private void doReprocess(final MessageFilter filter, final Integer selectedMetaDataId, final boolean showWarning) { final String workingId = startWorking("Retrieving Channels..."); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { public Void doInBackground() { if (channelPanel.getCachedChannelStatuses() == null || channelPanel.getCachedChannelStatuses().values().size() == 0) { channelPanel.retrieveChannels(); }/*from w w w . j av a 2s .c o m*/ return null; } public void done() { stopWorking(workingId); Map<Integer, String> destinationConnectors = new LinkedHashMap<Integer, String>(); destinationConnectors .putAll(dashboardPanel.getDestinationConnectorNames(messageBrowser.getChannelId())); new ReprocessMessagesDialog(messageBrowser.getChannelId(), filter, destinationConnectors, selectedMetaDataId, showWarning); } }; worker.execute(); }
From source file:com.mirth.connect.client.ui.Frame.java
public void reprocessMessage(final String channelId, final MessageFilter filter, final boolean replace, final Collection<Integer> reprocessMetaDataIds) { final String workingId = startWorking("Reprocessing messages..."); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { public Void doInBackground() { try { mirthClient.reprocessMessages(channelId, filter, replace, reprocessMetaDataIds); } catch (ClientException e) { alertThrowable(PlatformUI.MIRTH_FRAME, e); }/* w ww . j a va 2 s.c o m*/ return null; } public void done() { messageBrowser.updateFilterButtonFont(Font.BOLD); stopWorking(workingId); } }; worker.execute(); }
From source file:com.mirth.connect.client.ui.Frame.java
public void viewImage() { final String workingId = startWorking("Opening attachment..."); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { public Void doInBackground() { messageBrowser.viewAttachment(); stopWorking(workingId);/*from www. j a va2s. c om*/ return null; } public void done() { stopWorking(workingId); } }; worker.execute(); }
From source file:com.mirth.connect.client.ui.Frame.java
public void processMessage(final String channelId, final RawMessage rawMessage) { final String workingId = startWorking("Processing message..."); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { public Void doInBackground() { try { mirthClient.processMessage(channelId, rawMessage); } catch (ClientException e) { alertThrowable(PlatformUI.MIRTH_FRAME, e); }//from w w w . j a v a 2 s. c om return null; } public void done() { if (currentContentPage == messageBrowser) { messageBrowser.updateFilterButtonFont(Font.BOLD); } stopWorking(workingId); } }; worker.execute(); }
From source file:com.mirth.connect.client.ui.Frame.java
public void doRemoveAllEvents() { int option = JOptionPane.showConfirmDialog(this, "All events will be removed. Would you also like them to be\n" + "exported to a file on the server?"); if (option == JOptionPane.CANCEL_OPTION || option == JOptionPane.CLOSED_OPTION) { return;/*www . ja va2 s.c o m*/ } final boolean export = (option == JOptionPane.YES_OPTION); final String workingId = startWorking("Clearing events..."); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { private String exportPath = null; public Void doInBackground() { try { if (export) { exportPath = mirthClient.exportAndRemoveAllEvents(); } else { mirthClient.removeAllEvents(); } } catch (ClientException e) { alertThrowable(PlatformUI.MIRTH_FRAME, e); } return null; } public void done() { eventBrowser.runSearch(); if (exportPath != null) { alertInformation(PlatformUI.MIRTH_FRAME, "Events have been exported to the following server path:\n" + exportPath); } stopWorking(workingId); } }; worker.execute(); }
From source file:com.mirth.connect.client.ui.Frame.java
public void doExportAllEvents() { if (alertOption(this, "Are you sure you would like to export all events? An export\n" + "file will be placed in the exports directory on the server.")) { final String workingId = startWorking("Exporting events..."); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { private String exportPath = null; public Void doInBackground() { try { exportPath = mirthClient.exportAllEvents(); } catch (ClientException e) { alertThrowable(PlatformUI.MIRTH_FRAME, e); }//from w ww . j a v a2s . c o m return null; } public void done() { if (exportPath != null) { alertInformation(PlatformUI.MIRTH_FRAME, "Events have been exported to the following server path:\n" + exportPath); } stopWorking(workingId); } }; worker.execute(); } }
From source file:com.mirth.connect.client.ui.Frame.java
public void doSaveAlerts() { if (changesHaveBeenMade()) { try {/*from w w w.ja va2 s . co m*/ ServerSettings serverSettings = mirthClient.getServerSettings(); if (StringUtils.isBlank(serverSettings.getSmtpHost()) || StringUtils.isBlank(serverSettings.getSmtpPort())) { alertWarning(PlatformUI.MIRTH_FRAME, "The SMTP server on the settings page is not specified or is incomplete. An SMTP server is required to send email alerts."); } } catch (ClientException e) { alertThrowable(PlatformUI.MIRTH_FRAME, e, false); } final String workingId = startWorking("Saving alerts..."); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { public Void doInBackground() { if (alertEditPanel.saveAlert()) { setSaveEnabled(false); } return null; } public void done() { stopWorking(workingId); } }; worker.execute(); } }
From source file:com.mirth.connect.client.ui.Frame.java
public void doDeleteAlert() { if (!alertOption(this, "Are you sure you want to delete the selected alert(s)?")) { return;/*w w w.jav a 2 s . c o m*/ } final String workingId = startWorking("Deleting alert..."); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { public Void doInBackground() { List<String> selectedAlertIds = alertPanel.getSelectedAlertIds(); for (String alertId : selectedAlertIds) { try { mirthClient.removeAlert(alertId); } catch (ClientException e) { alertThrowable(PlatformUI.MIRTH_FRAME, e); return null; } } alertPanel.updateAlertDetails(new HashSet<String>(selectedAlertIds)); return null; } public void done() { doRefreshAlerts(true); stopWorking(workingId); } }; worker.execute(); }
From source file:com.mirth.connect.client.ui.Frame.java
public void doEnableAlert() { final String workingId = startWorking("Enabling alert..."); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { public Void doInBackground() { List<String> selectedAlertIds = alertPanel.getSelectedAlertIds(); for (String alertId : selectedAlertIds) { try { mirthClient.enableAlert(alertId); } catch (ClientException e) { alertThrowable(PlatformUI.MIRTH_FRAME, e); return null; }/*from w w w. j a v a 2 s .c o m*/ } return null; } public void done() { doRefreshAlerts(true); stopWorking(workingId); } }; worker.execute(); }
From source file:com.mirth.connect.client.ui.Frame.java
public void doDisableAlert() { final String workingId = startWorking("Enabling alert..."); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { public Void doInBackground() { List<String> selectedAlertIds = alertPanel.getSelectedAlertIds(); for (String alertId : selectedAlertIds) { try { mirthClient.disableAlert(alertId); } catch (ClientException e) { alertThrowable(PlatformUI.MIRTH_FRAME, e); return null; }//from w w w.j a v a 2 s. c o m } return null; } public void done() { doRefreshAlerts(true); stopWorking(workingId); } }; worker.execute(); }