use of org.freeplane.features.ui.FrameController in project freeplane by freeplane.
the class MModeControllerFactory method createStandardControllers.
private void createStandardControllers() {
final Controller controller = Controller.getCurrentController();
modeController = new MModeController(controller);
final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController, UITools.useRibbonsMenu());
final IMouseListener nodeMouseMotionListener = new MNodeMotionListener();
userInputListenerFactory.setNodeMouseMotionListener(nodeMouseMotionListener);
final JPopupMenu popupmenu = new JPopupMenu();
userInputListenerFactory.setNodePopupMenu(popupmenu);
modeController.setUserInputListenerFactory(userInputListenerFactory);
controller.addModeController(modeController);
controller.selectModeForBuild(modeController);
new MMapController(modeController);
if (userInputListenerFactory.useRibbonMenu()) {
RibbonBuilder builder = userInputListenerFactory.getMenuBuilder(RibbonBuilder.class);
final RibbonMapChangeAdapter mapChangeAdapter = builder.getMapChangeAdapter();
modeController.getMapController().addNodeSelectionListener(mapChangeAdapter);
modeController.getMapController().addNodeChangeListener(mapChangeAdapter);
modeController.getMapController().addMapChangeListener(mapChangeAdapter);
controller.getMapViewManager().addMapSelectionListener(mapChangeAdapter);
}
final MFileManager fileManager = new MFileManager();
UrlManager.install(fileManager);
MMapIO.install(modeController);
controller.getMapViewManager().addMapViewChangeListener(fileManager);
IconController.install(new MIconController(modeController));
new ProgressFactory().installActions(modeController);
final MapController mapController = modeController.getMapController();
EdgeController.install(new MEdgeController(modeController));
CloudController.install(new MCloudController(modeController));
NoteController.install(new MNoteController(modeController));
userInputListenerFactory.setMapMouseListener(new MMapMouseListener());
final MTextController textController = new MTextController(modeController);
TextController.install(textController);
LinkController.install(new MLinkController());
NodeStyleController.install(new MNodeStyleController(modeController));
ClipboardController.install(new MClipboardController());
userInputListenerFactory.setNodeDragListener(new MNodeDragListener());
userInputListenerFactory.setNodeDropTargetListener(new MNodeDropListener());
LocationController.install(new MLocationController());
final MLogicalStyleController logicalStyleController = new MLogicalStyleController(modeController);
LogicalStyleController.install(logicalStyleController);
logicalStyleController.initM();
AttributeController.install(new MAttributeController(modeController));
userInputListenerFactory.setNodeKeyListener(new DefaultNodeKeyListener(new IEditHandler() {
public void edit(final KeyEvent e, final FirstAction action, final boolean editLong) {
((MTextController) MTextController.getController(modeController)).getEventQueue().activate(e);
textController.edit(action, editLong);
}
}));
userInputListenerFactory.setNodeMotionListener(new MNodeMotionListener());
modeController.addAction(new EditAttributesAction());
SpellCheckerController.install(modeController);
ExportController.install(new ExportController("/xml/ExportWithXSLT.xml"));
MapStyle.install(true);
final FreeplaneToolBar toolbar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
final FrameController frameController = (FrameController) controller.getViewController();
UIComponentVisibilityDispatcher.install(frameController, toolbar, "toolbarVisible");
if (!userInputListenerFactory.useRibbonMenu()) {
userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolbar);
}
userInputListenerFactory.addToolBar("/filter_toolbar", ViewController.BOTTOM, FilterController.getController(controller).getFilterToolbar());
userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, frameController.getStatusBar());
final JTabbedPane formattingPanel = new JTabbedPane();
Box resisableTabs = new CollapseableBoxBuilder(frameController).setPropertyNameBase("styleScrollPaneVisible").createBox(formattingPanel, Direction.RIGHT);
modeController.getUserInputListenerFactory().addToolBar("/format", ViewController.RIGHT, resisableTabs);
KeyBindingProcessor keyProcessor = new KeyBindingProcessor();
modeController.addExtension(KeyBindingProcessor.class, keyProcessor);
keyProcessor.addKeyStrokeProcessor(userInputListenerFactory.getAcceleratorManager());
final FButtonBar fButtonToolBar = new FButtonBar(frameController.getRootPaneContainer().getRootPane(), keyProcessor);
UIComponentVisibilityDispatcher.install(frameController, fButtonToolBar, "fbarVisible");
fButtonToolBar.setVisible(ResourceController.getResourceController().getBooleanProperty("fbarVisible"));
userInputListenerFactory.addToolBar("/fbuttons", ViewController.TOP, fButtonToolBar);
controller.addAction(new ToggleToolbarAction("ToggleFBarAction", "/fbuttons"));
SModeControllerFactory.install();
modeController.addAction(new SetAcceleratorOnNextClickAction());
modeController.addAction(new ShowNotesInMapAction());
// userInputListenerFactory.getMenuBuilder().setAcceleratorChangeListener(fButtonToolBar);
userInputListenerFactory.getAcceleratorManager().addAcceleratorChangeListener(fButtonToolBar);
userInputListenerFactory.addToolBar("/icon_toolbar", ViewController.LEFT, ((MIconController) IconController.getController()).getIconToolBarScrollPane());
modeController.addAction(new ToggleToolbarAction("ToggleLeftToolbarAction", "/icon_toolbar"));
new RevisionPlugin();
FoldingController.install(new FoldingController());
uiFactory = new MUIFactory();
mapController.addNodeChangeListener(uiFactory);
mapController.addNodeSelectionListener(uiFactory);
mapController.addMapChangeListener(uiFactory);
controller.getMapViewManager().addMapSelectionListener(uiFactory);
final MToolbarContributor menuContributor = new MToolbarContributor(uiFactory);
modeController.addExtension(MUIFactory.class, uiFactory);
modeController.addMenuContributor(menuContributor);
new CloneStateIconSupplier().registerStateIconProvider();
// IconController.getController(modeController).addStateIconProvider(new IStateIconProvider() {
// public UIIcon getStateIcon(NodeModel node) {
// final URI link = NodeLinks.getLink(node);
// return wrapIcon(LinkController.getLinkIcon(link, node));
// }
//
// private UIIcon wrapIcon(final Icon linkIcon) {
// UIIcon icon = null;
// if(linkIcon != null) {
// if(linkIcon instanceof UIIcon) {
// icon = (UIIcon) linkIcon;
// }
// else {
// icon = new UIIcon("ownIcon", null) {
// public Icon getIcon() {
// return linkIcon;
// }
// };
// }
// }
// return icon;
// }
// });
}
use of org.freeplane.features.ui.FrameController in project freeplane by freeplane.
the class FModeControllerFactory method createModeController.
public static FModeController createModeController() {
final Controller controller = Controller.getCurrentController();
modeController = new FModeController(controller);
final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController, false);
modeController.setUserInputListenerFactory(userInputListenerFactory);
controller.addModeController(modeController);
controller.selectModeForBuild(modeController);
new FMapController(modeController);
UrlManager.install(new UrlManager());
MapIO.install(modeController);
IconController.install(new IconController(modeController));
NodeStyleController.install(new NodeStyleController(modeController));
EdgeController.install(new EdgeController(modeController));
TextController.install(new TextController(modeController));
LinkController.install(new LinkController());
CloudController.install(new CloudController(modeController));
ClipboardController.install(new ClipboardController());
LocationController.install(new LocationController());
LogicalStyleController.install(new LogicalStyleController(modeController));
MapStyle.install(true);
NodeStyleController.getController().addShapeGetter(new Integer(0), new IPropertyHandler<String, NodeModel>() {
public String getProperty(final NodeModel node, final String currentValue) {
return "fork";
}
});
modeController.addAction(new CenterAction());
modeController.addAction(new OpenPathAction());
userInputListenerFactory.setNodePopupMenu(new JPopupMenu());
final FreeplaneToolBar toolBar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
FrameController frameController = (FrameController) controller.getViewController();
UIComponentVisibilityDispatcher.install(frameController, toolBar, "toolbarVisible");
userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolBar);
userInputListenerFactory.addToolBar("/filter_toolbar", ViewController.BOTTOM, FilterController.getCurrentFilterController().getFilterToolbar());
userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, controller.getViewController().getStatusBar());
NodeHistory.install(modeController);
return modeController;
}
use of org.freeplane.features.ui.FrameController in project freeplane by freeplane.
the class PresentationAutomation method updateFullScreenMode.
private void updateFullScreenMode() {
if (ResourceController.getResourceController().getBooleanProperty(SWITCH_TO_FULL_SCREEN_PROPERTY)) {
final FrameController viewController = (FrameController) Controller.getCurrentController().getViewController();
viewController.setFullScreen(isPresentationRunning);
}
}
use of org.freeplane.features.ui.FrameController in project freeplane by freeplane.
the class BModeControllerFactory method createModeController.
public static BModeController createModeController() {
final Controller controller = Controller.getCurrentController();
modeController = new BModeController(controller);
final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController);
modeController.setUserInputListenerFactory(userInputListenerFactory);
controller.addModeController(modeController);
controller.selectModeForBuild(modeController);
new MapController(modeController);
new IconController(modeController).install(modeController);
UrlManager.install(new UrlManager());
MapIO.install(modeController);
AttributeController.install(new AttributeController(modeController));
NodeStyleController.install(new NodeStyleController(modeController));
EdgeController.install(new EdgeController(modeController));
CloudController.install(new CloudController(modeController));
NoteController.install(new NoteController());
new TextController(modeController).install(modeController);
LinkController.install(new LinkController(modeController));
LogicalStyleController.install(new LogicalStyleController(modeController));
try {
ClipboardController.install(new ClipboardController());
} catch (final AccessControlException e) {
LogUtils.warn("can not access system clipboard, clipboard controller disabled");
}
LocationController.install(new LocationController());
SummaryNode.install();
FreeNode.install();
MapStyle.install(true);
final BToolbarContributor toolbarContributor = new BToolbarContributor();
modeController.addUiBuilder(Phase.ACTIONS, "main_toolbar_url", toolbarContributor);
controller.getMapViewManager().addMapViewChangeListener(toolbarContributor);
userInputListenerFactory.setNodePopupMenu(new JPopupMenu());
final FreeplaneToolBar toolBar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
FrameController frameController = (FrameController) controller.getViewController();
UIComponentVisibilityDispatcher.install(frameController, toolBar, "toolbarVisible");
userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolBar);
userInputListenerFactory.addToolBar("/filter_toolbar", FilterController.TOOLBAR_SIDE, FilterController.getController(controller).getFilterToolbar());
userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, controller.getViewController().getStatusBar());
FoldingController.install(new FoldingController());
new ViewerController();
EncryptionController.install(new EncryptionController(modeController));
new AutomaticLayoutController();
return modeController;
}
use of org.freeplane.features.ui.FrameController in project freeplane by freeplane.
the class FilterController method createFilterToolbar.
private JToolBar createFilterToolbar() {
final JToolBar filterToolbar = new FreeplaneToolBar("filter_toolbar", SwingConstants.HORIZONTAL);
filterToolbar.setVisible(ResourceController.getResourceController().getBooleanProperty("filter_toolbar_visible"));
Controller controller = Controller.getCurrentController();
FrameController frameController = (FrameController) controller.getViewController();
UIComponentVisibilityDispatcher.install(frameController, filterToolbar, "filter_toolbar_visible");
final JButton undoBtn = new JButton(controller.getAction("UndoFilterAction"));
final JButton redoBtn = new JButton(controller.getAction("RedoFilterAction"));
final JToggleButton showAncestorsBox = new JAutoToggleButton(controller.getAction("ShowAncestorsAction"), showAncestors);
showAncestorsBox.setSelected(showAncestors.isSelected());
final JToggleButton showDescendantsBox = new JAutoToggleButton(controller.getAction("ShowDescendantsAction"), showDescendants);
final JToggleButton applyToVisibleBox = new JAutoToggleButton(controller.getAction("ApplyToVisibleAction"), applyToVisibleNodeOnly);
final JButton btnEdit = new JButton(controller.getAction("EditFilterAction"));
activeFilterConditionComboBox = new JComboBox(getFilterConditions());
final JButton applyBtn = new JButton(controller.getAction("ReapplyFilterAction"));
final JButton filterSelectedBtn = new JButton(controller.getAction("ApplySelectedViewConditionAction"));
final JButton noFilteringBtn = new JButton(controller.getAction("ApplyNoFilteringAction"));
final JButton applyFindPreviousBtn = new JButton(controller.getAction("QuickFindAction.BACK"));
final JButton applyFindNextBtn = new JButton(controller.getAction("QuickFindAction.FORWARD"));
final JButton applyQuickFilterBtn = new JButton(controller.getAction("QuickFilterAction"));
final JButton applyQuickSelectBtn = new JButton(controller.getAction("QuickFindAllAction"));
final JToggleButton applyQuickHighlightBtn = new JAutoToggleButton(controller.getAction("QuickHighlightAction"));
filterToolbar.addSeparator();
filterToolbar.add(undoBtn);
filterToolbar.add(redoBtn);
filterToolbar.add(showAncestorsBox);
filterToolbar.add(showDescendantsBox);
filterToolbar.add(applyToVisibleBox);
filterToolbar.add(activeFilterConditionComboBox);
filterToolbar.add(applyBtn);
filterToolbar.add(filterSelectedBtn);
filterToolbar.add(noFilteringBtn);
filterToolbar.add(btnEdit);
filterToolbar.addSeparator();
filterToolbar.add(quickEditor);
filterToolbar.add(applyFindPreviousBtn);
filterToolbar.add(applyFindNextBtn);
filterToolbar.add(applyQuickSelectBtn);
filterToolbar.add(applyQuickFilterBtn);
filterToolbar.add(applyQuickHighlightBtn);
final DefaultConditionRenderer toolbarConditionRenderer = new DefaultConditionRenderer(TextUtils.getText("filter_no_filtering"), false);
activeFilterConditionComboBox.setRenderer(toolbarConditionRenderer);
return filterToolbar;
}
Aggregations