List of usage examples for javax.swing SwingWorker execute
public final void execute()
From source file:com.mirth.connect.client.ui.Frame.java
public void doSaveChannel() { final String workingId = startWorking("Saving channel..."); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { public Void doInBackground() { if (changesHaveBeenMade() || currentContentPage == channelEditPanel.transformerPane || currentContentPage == channelEditPanel.filterPane) { if (channelEditPanel.saveChanges()) { setSaveEnabled(false); }//w w w . ja va 2s. co m return null; } else { return null; } } public void done() { 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; }// www . j a va 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 ww w . ja v a 2 s .co m*/ } return null; } public void done() { doRefreshAlerts(true); stopWorking(workingId); } }; worker.execute(); }
From source file:com.mirth.connect.client.ui.Frame.java
public void doUndeployChannel() { final Set<DashboardStatus> selectedChannelStatuses = dashboardPanel.getSelectedChannelStatuses(); if (selectedChannelStatuses.size() == 0) { return;//w w w .ja v a 2s . c o m } if (!getStatusesWithDependencies(selectedChannelStatuses, ChannelTask.UNDEPLOY)) { return; } dashboardPanel.deselectRows(false); String plural = (selectedChannelStatuses.size() > 1) ? "s" : ""; final String workingId = startWorking("Undeploying channel" + plural + "..."); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { public Void doInBackground() { try { Set<String> channelIds = new LinkedHashSet<String>(); for (DashboardStatus channelStatus : selectedChannelStatuses) { channelIds.add(channelStatus.getChannelId()); } mirthClient.undeployChannels(channelIds); } catch (ClientException e) { alertThrowable(PlatformUI.MIRTH_FRAME, e); } return null; } public void done() { stopWorking(workingId); doRefreshStatuses(true); } }; worker.execute(); }
From source file:com.mirth.connect.client.ui.Frame.java
public void doEnableExtension() { final String workingId = startWorking("Enabling extension..."); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { private boolean success = true; public Void doInBackground() { try { mirthClient.setExtensionEnabled(extensionsPanel.getSelectedExtension().getName(), true); } catch (ClientException e) { success = false;//from w w w . j ava 2 s . c om alertThrowable(PlatformUI.MIRTH_FRAME, e); } return null; } public void done() { if (success) { extensionsPanel.setSelectedExtensionEnabled(true); extensionsPanel.setRestartRequired(true); } stopWorking(workingId); } }; worker.execute(); }
From source file:com.mirth.connect.client.ui.Frame.java
public void doDisableExtension() { final String workingId = startWorking("Disabling extension..."); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { private boolean success = true; public Void doInBackground() { try { mirthClient.setExtensionEnabled(extensionsPanel.getSelectedExtension().getName(), false); } catch (ClientException e) { success = false;/*w w w . j a v a 2 s . co m*/ alertThrowable(PlatformUI.MIRTH_FRAME, e); } return null; } public void done() { if (success) { extensionsPanel.setSelectedExtensionEnabled(false); extensionsPanel.setRestartRequired(true); } 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;/*from w w w.j av a 2 s .c om*/ } 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 doHalt() { final Set<DashboardStatus> selectedStatuses = dashboardPanel.getSelectedChannelStatuses(); int size = selectedStatuses.size(); if (size == 0 || !alertOption(this, "Are you sure you want to halt " + (size == 1 ? "this channel" : "these channels") + "?")) { return;//from w w w . j a v a 2s .c o m } final String workingId = startWorking("Halting channels..."); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { public Void doInBackground() { Set<String> channelIds = new HashSet<String>(); for (DashboardStatus dashboardStatus : selectedStatuses) { channelIds.add(dashboardStatus.getChannelId()); } try { if (!channelIds.isEmpty()) { mirthClient.haltChannels(channelIds); } } catch (ClientException e) { alertThrowable(PlatformUI.MIRTH_FRAME, e); } return null; } public void done() { doRefreshStatuses(true); stopWorking(workingId); } }; worker.execute(); }
From source file:com.mirth.connect.client.ui.Frame.java
public void doStop() { final Set<DashboardStatus> selectedStatuses = dashboardPanel.getSelectedChannelStatuses(); if (selectedStatuses.size() == 0) { return;/* ww w . j a v a 2 s.c o m*/ } if (!getStatusesWithDependencies(selectedStatuses, ChannelTask.STOP)) { return; } final String workingId = startWorking("Stopping channel..."); SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { public Void doInBackground() { Set<String> channelIds = new HashSet<String>(); for (DashboardStatus dashboardStatus : selectedStatuses) { channelIds.add(dashboardStatus.getChannelId()); } try { if (!channelIds.isEmpty()) { mirthClient.stopChannels(channelIds); } } catch (ClientException e) { alertThrowable(PlatformUI.MIRTH_FRAME, e); } return null; } public void done() { doRefreshStatuses(true); 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 w w .java 2s .com*/ 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(); } }