use of org.cytoscape.work.swing.DialogTaskManager in project cytoscape-impl by cytoscape.
the class CreateNetworkViewsAction method actionPerformed.
@Override
public void actionPerformed(final ActionEvent e) {
final List<CyNetwork> networks = serviceRegistrar.getService(CyApplicationManager.class).getSelectedNetworks();
if (!networks.isEmpty()) {
final CreateNetworkViewTaskFactory factory = serviceRegistrar.getService(CreateNetworkViewTaskFactory.class);
final DialogTaskManager taskManager = serviceRegistrar.getService(DialogTaskManager.class);
taskManager.execute(factory.createTaskIterator(networks));
}
}
use of org.cytoscape.work.swing.DialogTaskManager in project cytoscape-impl by cytoscape.
the class DestroyNetworksAction method actionPerformed.
@Override
public void actionPerformed(final ActionEvent e) {
final Set<CyNetwork> subNetworks = getSelectedSubNetworks();
if (!subNetworks.isEmpty()) {
final DestroyNetworkTaskFactory factory = serviceRegistrar.getService(DestroyNetworkTaskFactory.class);
final DialogTaskManager taskManager = serviceRegistrar.getService(DialogTaskManager.class);
taskManager.execute(factory.createTaskIterator(subNetworks));
}
}
use of org.cytoscape.work.swing.DialogTaskManager in project cytoscape-impl by cytoscape.
the class NetworkViewMainPanel method createNetworkViewGrid.
private NetworkViewGrid createNetworkViewGrid() {
final NetworkViewGrid nvg = new NetworkViewGrid(gridViewToggleModel, viewComparator, serviceRegistrar);
nvg.getDetachSelectedViewsButton().addActionListener(evt -> {
final List<ThumbnailPanel> selectedItems = networkViewGrid.getSelectedItems();
if (selectedItems != null) {
// Get the current view first
final CyNetworkView currentView = getCurrentNetworkView();
// Detach the views
for (ThumbnailPanel tp : selectedItems) {
if (getNetworkViewCard(tp.getNetworkView()) != null)
detachNetworkView(tp.getNetworkView());
}
// Set the original current view by bringing its frame to front, if it is detached
final NetworkViewFrame frame = getNetworkViewFrame(currentView);
if (frame != null)
frame.toFront();
}
});
nvg.getReattachAllViewsButton().addActionListener(evt -> {
final Collection<NetworkViewFrame> allFrames = new ArrayList<>(viewFrames.values());
for (NetworkViewFrame f : allFrames) reattachNetworkView(f.getNetworkView());
});
nvg.getDestroySelectedViewsButton().addActionListener(evt -> {
final List<CyNetworkView> selectedViews = getSelectedNetworkViews();
if (selectedViews != null && !selectedViews.isEmpty()) {
final DialogTaskManager taskMgr = serviceRegistrar.getService(DialogTaskManager.class);
final DestroyNetworkViewTaskFactory taskFactory = serviceRegistrar.getService(DestroyNetworkViewTaskFactory.class);
taskMgr.execute(taskFactory.createTaskIterator(selectedViews));
}
});
return nvg;
}
use of org.cytoscape.work.swing.DialogTaskManager in project cytoscape-impl by cytoscape.
the class NetworkSearchMediator method runSearch.
private void runSearch() {
NetworkSearchTaskFactory tf = networkSearchBar.getSelectedProvider();
if (tf != null && tf.isReady()) {
DialogTaskManager taskManager = serviceRegistrar.getService(DialogTaskManager.class);
TaskObserver taskObserver = tf.getTaskObserver();
if (taskObserver != null)
taskManager.execute(tf.createTaskIterator(), taskObserver);
else
taskManager.execute(tf.createTaskIterator());
}
}
use of org.cytoscape.work.swing.DialogTaskManager in project cytoscape-impl by cytoscape.
the class TableBrowserToolBar method removeTable.
private void removeTable() {
final CyTable table = browserTableModel.getDataTable();
if (table.getMutability() == CyTable.Mutability.MUTABLE) {
String title = "Please confirm this action";
String msg = "Are you sure you want to delete this table?";
int confirmValue = JOptionPane.showConfirmDialog(this, msg, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
// if user selects yes delete the table
if (confirmValue == JOptionPane.OK_OPTION) {
final DialogTaskManager taskMgr = serviceRegistrar.getService(DialogTaskManager.class);
final DeleteTableTaskFactory deleteTableTaskFactory = serviceRegistrar.getService(DeleteTableTaskFactory.class);
taskMgr.execute(deleteTableTaskFactory.createTaskIterator(table));
}
} else if (table.getMutability() == CyTable.Mutability.PERMANENTLY_IMMUTABLE) {
String title = "Error";
String msg = "Can not delete this table, it is PERMANENTLY_IMMUTABLE";
JOptionPane.showMessageDialog(this, msg, title, JOptionPane.ERROR_MESSAGE);
} else if (table.getMutability() == CyTable.Mutability.IMMUTABLE_DUE_TO_VIRT_COLUMN_REFERENCES) {
String title = "Error";
String msg = "Can not delete this table, it is IMMUTABLE_DUE_TO_VIRT_COLUMN_REFERENCES";
JOptionPane.showMessageDialog(this, msg, title, JOptionPane.ERROR_MESSAGE);
}
}
Aggregations