use of org.cytoscape.work.swing.SimpleGUITunableHandlerFactory in project cytoscape-impl by cytoscape.
the class CyActivator method start.
@Override
public void start(BundleContext bc) {
final CyServiceRegistrar serviceRegistrar = getService(bc, CyServiceRegistrar.class);
{
UndoSupportImpl undoSupport = new UndoSupportImpl();
Properties props = new Properties();
registerService(bc, undoSupport, UndoSupport.class, props);
registerService(bc, undoSupport, SwingUndoSupport.class, props);
}
JDialogTunableMutator jDialogTunableMutator = new JDialogTunableMutator();
JPanelTunableMutator jPanelTunableMutator = new JPanelTunableMutator();
final TaskStatusBar taskStatusBar = new TaskStatusBar(serviceRegistrar);
final TaskHistory taskHistory = new TaskHistory();
taskStatusBar.addPropertyChangeListener(TaskStatusBar.TASK_HISTORY_CLICK, new PropertyChangeListener() {
TaskHistoryWindow window = null;
// don't need to wrap this method in a SwingUtilities.invokeLater -- it will only be called on the EDT anyway
@Override
public void propertyChange(PropertyChangeEvent e) {
if (window == null)
window = new TaskHistoryWindow(taskHistory);
window.open();
}
});
{
Properties props = new Properties();
props.setProperty("type", "TaskStatus");
registerService(bc, taskStatusBar, StatusBarPanelFactory.class, props);
}
registerService(bc, new CyUserLogAppender(taskStatusBar, taskHistory), PaxAppender.class, ezProps("org.ops4j.pax.logging.appender.name", "CyUserLog"));
JDialogTaskManager jDialogTaskManager = new JDialogTaskManager(jDialogTunableMutator, taskStatusBar, taskHistory, serviceRegistrar);
PanelTaskManager jPanelTaskManager = new JPanelTaskManager(jPanelTunableMutator, jDialogTaskManager);
SupportedFileTypesManager supportedFileTypesManager = new SupportedFileTypesManager();
SimpleGUITunableHandlerFactory<BooleanHandler> booleanHandlerFactory = new SimpleGUITunableHandlerFactory<>(BooleanHandler.class, Boolean.class, boolean.class);
SimpleGUITunableHandlerFactory<IntegerHandler> integerHandlerFactory = new SimpleGUITunableHandlerFactory<>(IntegerHandler.class, Integer.class, int.class);
SimpleGUITunableHandlerFactory<FloatHandler> floatHandlerFactory = new SimpleGUITunableHandlerFactory<>(FloatHandler.class, Float.class, float.class);
SimpleGUITunableHandlerFactory<DoubleHandler> doubleHandlerFactory = new SimpleGUITunableHandlerFactory<>(DoubleHandler.class, Double.class, double.class);
SimpleGUITunableHandlerFactory<LongHandler> longHandlerFactory = new SimpleGUITunableHandlerFactory<>(LongHandler.class, Long.class, long.class);
SimpleGUITunableHandlerFactory<StringHandler> stringHandlerFactory = new SimpleGUITunableHandlerFactory<>(StringHandler.class, String.class);
SimpleGUITunableHandlerFactory<BoundedHandler> boundedIntegerHandlerFactory = new SimpleGUITunableHandlerFactory<>(BoundedHandler.class, BoundedInteger.class);
SimpleGUITunableHandlerFactory<BoundedHandler> boundedFloatHandlerFactory = new SimpleGUITunableHandlerFactory<>(BoundedHandler.class, BoundedFloat.class);
SimpleGUITunableHandlerFactory<BoundedHandler> boundedDoubleHandlerFactory = new SimpleGUITunableHandlerFactory<>(BoundedHandler.class, BoundedDouble.class);
SimpleGUITunableHandlerFactory<BoundedHandler> boundedLongHandlerFactory = new SimpleGUITunableHandlerFactory<>(BoundedHandler.class, BoundedLong.class);
SimpleGUITunableHandlerFactory<ListSingleHandler> listSingleSelectionHandlerFactory = new SimpleGUITunableHandlerFactory<>(ListSingleHandler.class, ListSingleSelection.class);
SimpleGUITunableHandlerFactory<ListMultipleHandler> listMultipleSelectionHandlerFactory = new SimpleGUITunableHandlerFactory<>(ListMultipleHandler.class, ListMultipleSelection.class);
SimpleGUITunableHandlerFactory<UserActionHandler> userActionHandlerFactory = new SimpleGUITunableHandlerFactory<>(UserActionHandler.class, UserAction.class);
URLHandlerFactory urlHandlerFactory = new URLHandlerFactory(serviceRegistrar);
registerService(bc, urlHandlerFactory, GUITunableHandlerFactory.class);
FileHandlerFactory fileHandlerFactory = new FileHandlerFactory(supportedFileTypesManager, serviceRegistrar);
registerService(bc, fileHandlerFactory, GUITunableHandlerFactory.class);
registerService(bc, jDialogTaskManager, DialogTaskManager.class);
registerService(bc, jDialogTaskManager, TaskManager.class);
registerService(bc, jPanelTaskManager, PanelTaskManager.class);
registerService(bc, integerHandlerFactory, GUITunableHandlerFactory.class);
registerService(bc, floatHandlerFactory, GUITunableHandlerFactory.class);
registerService(bc, doubleHandlerFactory, GUITunableHandlerFactory.class);
registerService(bc, longHandlerFactory, GUITunableHandlerFactory.class);
registerService(bc, booleanHandlerFactory, GUITunableHandlerFactory.class);
registerService(bc, stringHandlerFactory, GUITunableHandlerFactory.class);
registerService(bc, boundedIntegerHandlerFactory, GUITunableHandlerFactory.class);
registerService(bc, boundedFloatHandlerFactory, GUITunableHandlerFactory.class);
registerService(bc, boundedDoubleHandlerFactory, GUITunableHandlerFactory.class);
registerService(bc, boundedLongHandlerFactory, GUITunableHandlerFactory.class);
registerService(bc, listSingleSelectionHandlerFactory, GUITunableHandlerFactory.class);
registerService(bc, listMultipleSelectionHandlerFactory, GUITunableHandlerFactory.class);
registerService(bc, userActionHandlerFactory, GUITunableHandlerFactory.class);
registerServiceListener(bc, supportedFileTypesManager::addInputStreamTaskFactory, supportedFileTypesManager::removeInputStreamTaskFactory, InputStreamTaskFactory.class);
registerServiceListener(bc, supportedFileTypesManager::addCyWriterTaskFactory, supportedFileTypesManager::removeCyWriterTaskFactory, CyWriterFactory.class);
registerServiceListener(bc, jDialogTaskManager::addTunableRecorder, jDialogTaskManager::removeTunableRecorder, TunableRecorder.class);
registerServiceListener(bc, jPanelTunableMutator::addTunableHandlerFactory, jPanelTunableMutator::removeTunableHandlerFactory, GUITunableHandlerFactory.class);
registerServiceListener(bc, jDialogTunableMutator::addTunableHandlerFactory, jDialogTunableMutator::removeTunableHandlerFactory, GUITunableHandlerFactory.class);
}
use of org.cytoscape.work.swing.SimpleGUITunableHandlerFactory in project cytoscape-impl by cytoscape.
the class CyActivator method start.
@Override
public void start(final BundleContext bc) throws Exception {
final CyServiceRegistrar serviceRegistrar = getService(bc, CyServiceRegistrar.class);
invokeOnEDTAndWait(() -> {
setLookAndFeel(bc);
}, logger);
// ////////////
ConfigDirPropertyWriter configDirPropertyWriter = new ConfigDirPropertyWriter(serviceRegistrar);
registerService(bc, configDirPropertyWriter, CyShutdownListener.class);
CyHelpBrokerImpl cyHelpBroker = new CyHelpBrokerImpl();
registerService(bc, cyHelpBroker, CyHelpBroker.class);
registerServiceListener(bc, configDirPropertyWriter::addCyProperty, configDirPropertyWriter::removeCyProperty, CyProperty.class);
SimpleGUITunableHandlerFactory<CyPropertyConfirmationHandler> cyPropConfirmHandlerFactory = new SimpleGUITunableHandlerFactory<>(CyPropertyConfirmationHandler.class, CyPropertyConfirmation.class);
registerService(bc, cyPropConfirmHandlerFactory, GUITunableHandlerFactory.class);
invokeOnEDTAndWait(() -> {
initComponents(bc, serviceRegistrar);
});
registerService(bc, undoAction, CyAction.class);
registerService(bc, redoAction, CyAction.class);
registerService(bc, printAction, CyAction.class);
registerService(bc, preferenceAction, CyAction.class);
// registerService(bc, cy3preferenceAction, CyAction.class);
registerService(bc, bookmarkAction, CyAction.class);
registerService(bc, settingsAction, CyAction.class);
registerService(bc, settingsAction, SetCurrentNetworkViewListener.class);
registerService(bc, cytoPanelWestAction, CyAction.class);
registerService(bc, cytoPanelSouthAction, CyAction.class);
registerService(bc, cytoPanelEastAction, CyAction.class);
registerService(bc, cytoPanelSouthWestAction, CyAction.class);
registerService(bc, cytoPanelCommandAction, CyAction.class);
registerService(bc, starterPanelAction, CyAction.class);
registerService(bc, detachedViewToolBarAction, CyAction.class);
registerService(bc, closeWindowAction, CyAction.class);
registerService(bc, cyDesktopManager, CyNetworkViewDesktopMgr.class);
registerService(bc, bookmarkDialogFactory, SessionLoadedListener.class);
{
Properties props = new Properties();
props.setProperty(PREFERRED_MENU, "Help");
props.setProperty(TITLE, "User Manual");
props.setProperty(MENU_GRAVITY, "1.0");
props.setProperty(TOOLTIP, "Show User Manual");
registerService(bc, helpUserManualTaskFactory, TaskFactory.class, props);
}
{
Properties props = new Properties();
props.setProperty(PREFERRED_MENU, "Help");
props.setProperty(MENU_GRAVITY, "7.0");
props.setProperty(TITLE, "Contact Help Desk...");
registerService(bc, helpContactHelpDeskTaskFactory, TaskFactory.class, props);
}
{
Properties props = new Properties();
props.setProperty(PREFERRED_MENU, "Help");
props.setProperty(TITLE, "Report a Bug...");
props.setProperty(MENU_GRAVITY, "8.0");
registerService(bc, helpReportABugTaskFactory, TaskFactory.class, props);
}
{
Properties props = new Properties();
props.setProperty(ServiceProperties.ENABLE_FOR, ENABLE_FOR_NETWORK_AND_VIEW);
props.setProperty(ACCELERATOR, "cmd g");
props.setProperty(PREFERRED_MENU, "View.Arrange Network Windows[8]");
props.setProperty(TITLE, "Grid");
props.setProperty(MENU_GRAVITY, "1.0");
registerService(bc, arrangeGridTaskFactory, TaskFactory.class, props);
}
{
Properties props = new Properties();
props.setProperty(ServiceProperties.ENABLE_FOR, ENABLE_FOR_NETWORK_AND_VIEW);
props.setProperty(PREFERRED_MENU, "View.Arrange Network Windows[8]");
props.setProperty(TITLE, "Cascade");
props.setProperty(MENU_GRAVITY, "2.0");
registerService(bc, arrangeCascadeTaskFactory, TaskFactory.class, props);
}
{
Properties props = new Properties();
props.setProperty(ServiceProperties.ENABLE_FOR, ENABLE_FOR_NETWORK_AND_VIEW);
props.setProperty(PREFERRED_MENU, "View.Arrange Network Windows[8]");
props.setProperty(TITLE, "Vertical Stack");
props.setProperty(MENU_GRAVITY, "3.0");
registerService(bc, arrangeHorizontalTaskFactory, TaskFactory.class, props);
}
{
Properties props = new Properties();
props.setProperty(ServiceProperties.ENABLE_FOR, ENABLE_FOR_NETWORK_AND_VIEW);
props.setProperty(PREFERRED_MENU, "View.Arrange Network Windows[8]");
props.setProperty(TITLE, "Side by Side");
props.setProperty(MENU_GRAVITY, "4.0");
registerService(bc, arrangeVerticalTaskFactory, TaskFactory.class, props);
}
{
Properties props = new Properties();
props.setProperty(IN_NETWORK_PANEL_CONTEXT_MENU, "true");
registerAllServices(bc, createNetworkViewsAction, props);
}
{
Properties props = new Properties();
props.setProperty(IN_NETWORK_PANEL_CONTEXT_MENU, "true");
registerAllServices(bc, destroyNetworkViewsAction, props);
}
{
Properties props = new Properties();
props.setProperty(IN_NETWORK_PANEL_CONTEXT_MENU, "true");
registerAllServices(bc, destroyNetworksAction, props);
}
{
Properties props = new Properties();
props.setProperty(IN_NETWORK_PANEL_CONTEXT_MENU, "true");
registerAllServices(bc, exportNetworkAction, props);
}
{
Properties props = new Properties();
props.setProperty(IN_NETWORK_PANEL_CONTEXT_MENU, "true");
registerAllServices(bc, exportImageAction, props);
}
{
TaskFactory pauseCommand = new PauseCommandTaskFactory(cytoscapeDesktop);
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "command");
props.setProperty(COMMAND_DESCRIPTION, "Display a message and pause until the user continues.");
props.setProperty(COMMAND, "pause");
props.setProperty(COMMAND_LONG_DESCRIPTION, "The **pause** command displays a dialog with the text provided in the *message* argument " + "and waits for the user to click **OK**");
props.setProperty(COMMAND_SUPPORTS_JSON, "true");
props.setProperty(COMMAND_EXAMPLE_JSON, "{}");
registerService(bc, pauseCommand, TaskFactory.class, props);
}
registerAllServices(bc, cytoscapeDesktop);
registerAllServices(bc, netMainPanel);
registerAllServices(bc, commandToolPanel);
registerAllServices(bc, netMediator);
registerAllServices(bc, netViewMediator);
registerService(bc, undoMonitor, SetCurrentNetworkViewListener.class);
registerService(bc, undoMonitor, NetworkDestroyedListener.class);
registerService(bc, undoMonitor, NetworkViewDestroyedListener.class);
registerAllServices(bc, rowViewTracker);
registerAllServices(bc, selecteEdgeViewUpdater);
registerAllServices(bc, selecteNodeViewUpdater);
registerAllServices(bc, rowsSetViewUpdater);
registerAllServices(bc, sessionHandler);
registerAllServices(bc, toolBarEnableUpdater);
registerAllServices(bc, recentSessionManager);
registerAllServices(bc, netSelectionMediator);
registerAllServices(bc, netSearchMediator);
registerServiceListener(bc, cytoscapeDesktop::addAction, cytoscapeDesktop::removeAction, CyAction.class);
registerServiceListener(bc, preferenceAction::addCyProperty, preferenceAction::removeCyProperty, CyProperty.class);
// registerServiceListener(bc, cy3preferenceAction::addCyProperty, cy3preferenceAction::removeCyProperty, CyProperty.class);
registerServiceListener(bc, cytoscapeDesktop::addCytoPanelComponent, cytoscapeDesktop::removeCytoPanelComponent, CytoPanelComponent.class);
registerServiceListener(bc, cytoscapeDesktop::addToolBarComponent, cytoscapeDesktop::removeToolBarComponent, ToolBarComponent.class);
registerServiceListener(bc, cytoscapeMenuPopulator::addTaskFactory, cytoscapeMenuPopulator::removeTaskFactory, TaskFactory.class);
registerServiceListener(bc, cytoscapeMenuPopulator::addNetworkTaskFactory, cytoscapeMenuPopulator::removeNetworkTaskFactory, NetworkTaskFactory.class);
registerServiceListener(bc, cytoscapeMenuPopulator::addNetworkViewTaskFactory, cytoscapeMenuPopulator::removeNetworkViewTaskFactory, NetworkViewTaskFactory.class);
registerServiceListener(bc, cytoscapeMenuPopulator::addNetworkCollectionTaskFactory, cytoscapeMenuPopulator::removeNetworkCollectionTaskFactory, NetworkCollectionTaskFactory.class);
registerServiceListener(bc, cytoscapeMenuPopulator::addNetworkViewCollectionTaskFactory, cytoscapeMenuPopulator::removeNetworkViewCollectionTaskFactory, NetworkViewCollectionTaskFactory.class);
registerServiceListener(bc, cytoscapeMenuPopulator::addTableTaskFactory, cytoscapeMenuPopulator::removeTableTaskFactory, TableTaskFactory.class);
registerServiceListener(bc, layoutSettingsManager::addLayout, layoutSettingsManager::removeLayout, CyLayoutAlgorithm.class);
registerServiceListener(bc, settingsAction::addLayout, settingsAction::removeLayout, CyLayoutAlgorithm.class);
// For Network Panel context menu
registerServiceListener(bc, netMediator::addNetworkViewTaskFactory, netMediator::removeNetworkViewTaskFactory, NetworkViewTaskFactory.class, CONTEXT_MENU_FILTER);
registerServiceListener(bc, netMediator::addNetworkTaskFactory, netMediator::removeNetworkTaskFactory, NetworkTaskFactory.class, CONTEXT_MENU_FILTER);
registerServiceListener(bc, netMediator::addNetworkViewCollectionTaskFactory, netMediator::removeNetworkViewCollectionTaskFactory, NetworkViewCollectionTaskFactory.class, CONTEXT_MENU_FILTER);
registerServiceListener(bc, netMediator::addNetworkCollectionTaskFactory, netMediator::removeNetworkCollectionTaskFactory, NetworkCollectionTaskFactory.class, CONTEXT_MENU_FILTER);
registerServiceListener(bc, netMediator::addCyAction, netMediator::removeCyAction, CyAction.class, CONTEXT_MENU_FILTER);
registerServiceListener(bc, netSearchMediator::addNetworkSearchTaskFactory, netSearchMediator::removeNetworkSearchTaskFactory, NetworkSearchTaskFactory.class);
registerServiceListener(bc, layoutMenuPopulator::addLayout, layoutMenuPopulator::removeLayout, CyLayoutAlgorithm.class);
if (LookAndFeelUtil.isMac()) {
try {
new MacCyActivator().start(bc);
} catch (Exception e) {
logger.error("Cannot start MacCyActivator", e);
}
} else {
Properties props = new Properties();
props.setProperty(PREFERRED_MENU, "Help");
props.setProperty(TITLE, "About");
props.setProperty(MENU_GRAVITY, "10.0");
registerService(bc, helpAboutTaskFactory, TaskFactory.class, props);
registerService(bc, exitAction, CyAction.class);
}
// Full screen actions. This is platform dependent
FullScreenAction fullScreenAction = null;
if (LookAndFeelUtil.isMac() && MacFullScreenEnabler.supportsNativeFullScreenMode())
fullScreenAction = new FullScreenMacAction(cytoscapeDesktop);
else
fullScreenAction = new FullScreenAction(cytoscapeDesktop);
registerService(bc, fullScreenAction, CyAction.class);
}
Aggregations