use of org.cytoscape.application.swing.CyAction in project cytoscape-impl by cytoscape.
the class CytoscapeMenus method createViewFrameToolBar.
public JToolBar createViewFrameToolBar() {
JToolBar viewToolBar = null;
final int total = toolBar.getComponentCount();
boolean addSeparator = false;
int buttonsAfterSeparator = 0;
for (int i = 0; i < total; i++) {
final Component c = toolBar.getComponent(i);
if (c instanceof JButton && ((JButton) c).getAction() instanceof CyAction) {
final JButton btn = ((JButton) c);
final CyAction action = (CyAction) btn.getAction();
if (viewFrameActions.contains(action)) {
if (viewToolBar == null) {
viewToolBar = new JToolBar();
viewToolBar.setBorder(toolBar.getBorder());
}
if (addSeparator) {
viewToolBar.addSeparator();
addSeparator = false;
buttonsAfterSeparator = 0;
}
final JButton newBtn = CytoscapeToolBar.createToolBarButton(action);
viewToolBar.add(newBtn);
buttonsAfterSeparator++;
}
} else if (c instanceof JSeparator && buttonsAfterSeparator > 0) {
addSeparator = true;
}
}
if (viewToolBar != null && viewToolBar.getComponentCount() > 0 && viewToolBar.getComponentAtIndex(viewToolBar.getComponentCount() - 1) instanceof JSeparator)
viewToolBar.remove(viewToolBar.getComponentCount() - 1);
return viewToolBar;
}
use of org.cytoscape.application.swing.CyAction in project cytoscape-impl by cytoscape.
the class CytoscapeMenuPopulator method addFactory.
private void addFactory(TaskFactory factory, Map<String, String> props) {
CyAction action;
if (props.containsKey(ServiceProperties.ENABLE_FOR))
action = new TaskFactoryTunableAction(factory, props, serviceRegistrar);
else
action = new TaskFactoryTunableAction(serviceRegistrar, factory, props);
addAction(action, factory, props);
}
use of org.cytoscape.application.swing.CyAction in project cytoscape-impl by cytoscape.
the class NetworkMediator method addFactory.
// // Private Methods // //
@SuppressWarnings({ "unchecked", "rawtypes" })
private void addFactory(final TaskFactory factory, final Map props) {
final CyAction action;
if (props.containsKey(ServiceProperties.ENABLE_FOR))
action = new TaskFactoryTunableAction(factory, props, serviceRegistrar);
else
action = new TaskFactoryTunableAction(serviceRegistrar, factory, props);
popupActionMap.put(factory, action);
}
use of org.cytoscape.application.swing.CyAction in project cytoscape-impl by cytoscape.
the class NVLTFActionSupport method registerAction.
public void registerAction(NetworkViewLocationTaskFactory nvltf, Map<String, String> props) {
// If the user requests this action to be in the menu bar, create and register a CyAction for it
if (props.containsKey(ServiceProperties.IN_MENU_BAR) && Boolean.valueOf(props.get(ServiceProperties.IN_MENU_BAR)) == Boolean.TRUE) {
CyAction action = new NVLTFAction(nvltf, props);
registrar.registerService(action, CyAction.class, new Properties());
}
}
Aggregations