use of org.freeplane.view.swing.map.ViewLayoutTypeAction in project freeplane by freeplane.
the class SModeControllerFactory method createController.
Controller createController(final JDialog dialog) {
Controller currentController = Controller.getCurrentController();
final Controller controller = new Controller(ResourceController.getResourceController());
Controller.setCurrentController(controller);
final MapViewController mapViewController = new MMapViewController(controller);
final DialogController viewController = new DialogController(controller, mapViewController, dialog);
controller.setViewController(viewController);
controller.addExtension(HighlightController.class, new HighlightController());
controller.addAction(currentController.getAction("AboutAction"));
FilterController.install();
TextController.install();
controller.addAction(new ViewLayoutTypeAction(MapViewLayout.OUTLINE));
controller.addAction(new ShowSelectionAsRectangleAction());
modeController = new SModeController(controller);
controller.selectModeForBuild(modeController);
modeController.addAction(new NewUserStyleAction());
modeController.addAction(new DeleteUserStyleAction());
modeController.addAction(new NewLevelStyleAction());
modeController.addAction(new DeleteLevelStyleAction());
modeController.addAction(new SetAcceleratorOnNextClickAction());
final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController);
userInputListenerFactory.setNodeMouseMotionListener(new DefaultNodeMouseMotionListener());
userInputListenerFactory.setNodeMouseWheelListener(new MNodeMouseWheelListener(userInputListenerFactory.getMapMouseWheelListener()));
modeController.setUserInputListenerFactory(userInputListenerFactory);
controller.addExtension(ModelessAttributeController.class, new ModelessAttributeController());
new MMapController(modeController);
ModelessAttributeController.installConditions();
new MTextController(modeController).install(modeController);
SpellCheckerController.install(modeController);
new MIconController(modeController).install(modeController);
NodeStyleController.install(new MNodeStyleController(modeController));
LocationController.install(new MLocationController());
EdgeController.install(new MEdgeController(modeController));
CloudController.install(new MCloudController(modeController));
NoteController.install(new MNoteController(modeController));
LinkController.install(new MLinkController(modeController));
MFileManager.install(new MFileManager());
MMapIO.install(modeController);
final MLogicalStyleController logicalStyleController = new MLogicalStyleController(modeController);
logicalStyleController.initS();
LogicalStyleController.install(logicalStyleController);
AttributeController.install(new MAttributeController(modeController));
FormatController.install(new FormatController());
IconController.installConditionControllers();
final ScannerController scannerController = new ScannerController();
ScannerController.install(scannerController);
scannerController.addParsersForStandardFormats();
modeController.addAction(new EditAttributesAction());
userInputListenerFactory.setMapMouseListener(new MMapMouseListener());
final JPopupMenu popupmenu = new JPopupMenu();
userInputListenerFactory.setNodePopupMenu(popupmenu);
final FreeplaneToolBar toolBar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
UIComponentVisibilityDispatcher.install(viewController, toolBar, "toolbarVisible");
userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolBar);
userInputListenerFactory.addToolBar("/icon_toolbar", ViewController.LEFT, ((MIconController) IconController.getController()).getIconToolBarScrollPane());
userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, controller.getViewController().getStatusBar());
modeController.addAction(new ToggleToolbarAction("ToggleLeftToolbarAction", "/icon_toolbar"));
MapStyle.install(false);
controller.addModeController(modeController);
controller.selectModeForBuild(modeController);
if (extentionInstaller != null)
extentionInstaller.installExtensions(controller);
final SModeController modeController = this.modeController;
final StyleEditorPanel styleEditorPanel = new StyleEditorPanel(modeController, null, false);
modeController.addAction(new ShowFormatPanelAction());
final MapController mapController = modeController.getMapController();
mapController.addNodeSelectionListener(new INodeSelectionListener() {
@Override
public void onSelect(final NodeModel node) {
final IMapSelection selection = controller.getSelection();
if (selection == null) {
return;
}
if (selection.size() == 1 && node.depth() >= 2) {
return;
}
final NodeModel nextSelection;
if (node.depth() < 2) {
if (node.depth() == 1 && node.hasChildren()) {
nextSelection = node.getChildAt(0);
} else {
nextSelection = (node.getMap().getRootNode().getChildAt(0).getChildAt(0));
}
} else {
nextSelection = node;
}
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
selection.selectAsTheOnlyOneSelected(nextSelection);
}
});
}
@Override
public void onDeselect(final NodeModel node) {
}
});
mapController.addNodeChangeListener(new INodeChangeListener() {
@Override
public void nodeChanged(NodeChangeEvent event) {
final NodeModel node = event.getNode();
if (node.getUserObject().equals(MapStyleModel.DEFAULT_STYLE)) {
mapController.fireMapChanged(new MapChangeEvent(this, node.getMap(), MapStyle.MAP_STYLES, null, null));
}
}
});
final JScrollPane styleScrollPane = new JScrollPane(styleEditorPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
UITools.setScrollbarIncrement(styleScrollPane);
// styleEditorPanel.setPreferredSize(new Dimension(200, 200));
userInputListenerFactory.addToolBar("/format", ViewController.RIGHT, styleScrollPane);
UIComponentVisibilityDispatcher.install(viewController, styleScrollPane, "styleScrollPaneVisible");
modeController.addExtension(MUIFactory.class, new MUIFactory());
final Set<String> emptySet = Collections.emptySet();
modeController.updateMenus("/xml/stylemodemenu.xml", emptySet);
this.modeController = null;
return controller;
}
use of org.freeplane.view.swing.map.ViewLayoutTypeAction in project freeplane by freeplane.
the class FreeplaneGUIStarter method createController.
@SuppressWarnings("serial")
public Controller createController() {
try {
Controller controller = new Controller(applicationResourceController);
Controller.setCurrentController(controller);
Compat.macAppChanges();
controller.addAction(new QuitAction());
applicationResourceController.init();
LogUtils.createLogger();
FreeplaneGUIStarter.showSysInfo();
final String lookandfeel = System.getProperty("lookandfeel", applicationResourceController.getProperty("lookandfeel"));
final boolean supportHidpi = Boolean.valueOf(System.getProperty("lookandfeel.scaleuifonts", applicationResourceController.getProperty("lookandfeel.scaleuifonts")));
FrameController.setLookAndFeel(lookandfeel, supportHidpi);
final JFrame frame;
frame = new JFrame("Freeplane");
frame.setContentPane(new JPanel() {
@Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
return super.processKeyBinding(ks, e, condition, pressed) || MenuKeyProcessor.INSTANCE.processKeyBinding(ks, e, condition, pressed);
}
});
frame.setName(UITools.MAIN_FREEPLANE_FRAME);
final MMapViewController mapViewController = new MMapViewController(controller);
viewController = new ApplicationViewController(controller, mapViewController, frame);
splash = new FreeplaneSplashModern(frame);
if (!System.getProperty("org.freeplane.nosplash", "false").equals("true")) {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
splash.setVisible(true);
}
});
}
mapViewController.addMapViewChangeListener(applicationResourceController.getLastOpenedList());
controller.addExtension(HighlightController.class, new HighlightController());
FilterController.install();
PrintController.install();
FormatController.install(new FormatController());
final ScannerController scannerController = new ScannerController();
ScannerController.install(scannerController);
scannerController.addParsersForStandardFormats();
ModelessAttributeController.install();
TextController.install();
TimeController.install();
LinkController.install();
IconController.installConditionControllers();
HelpController.install();
controller.addAction(new NextNodeAction(Direction.FORWARD));
controller.addAction(new NextNodeAction(Direction.BACK));
controller.addAction(new NextNodeAction(Direction.FORWARD_N_FOLD));
controller.addAction(new NextNodeAction(Direction.BACK_N_FOLD));
controller.addAction(NextPresentationItemAction.createFoldingAction());
controller.addAction(NextPresentationItemAction.createNotFoldingAction());
controller.addAction(new ShowSelectionAsRectangleAction());
controller.addAction(new ViewLayoutTypeAction(MapViewLayout.OUTLINE));
FilterController.getCurrentFilterController().getConditionFactory().addConditionController(70, new LogicalStyleFilterController());
MapController.install();
NodeHistory.install(controller);
final FreeplaneSurveyProperties freeplaneSurveyProperties = new FreeplaneSurveyProperties();
if (freeplaneSurveyProperties.mayAskUserToFillSurveys()) {
controller.addApplicationLifecycleListener(new SurveyStarter(freeplaneSurveyProperties, new SurveyRunner(freeplaneSurveyProperties), Math.random()));
}
return controller;
} catch (final Exception e) {
LogUtils.severe(e);
throw new RuntimeException(e);
}
}
use of org.freeplane.view.swing.map.ViewLayoutTypeAction in project freeplane by freeplane.
the class FreeplaneApplet method init.
@SuppressWarnings("serial")
@Override
public void init() {
configureFrame();
new Thread(new Runnable() {
@Override
public void run() {
try {
appletLock.lock();
AppletResourceController appletResourceController = new AppletResourceController(FreeplaneApplet.this);
new ParserDelegator() {
{
setDefaultDTD();
}
};
controller = new Controller(appletResourceController);
updateLookAndFeel(appletResourceController);
Controller.setCurrentController(controller);
final Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
MapViewController mapViewController = new MapViewController(controller);
appletViewController = new AppletViewController(FreeplaneApplet.this, controller, mapViewController);
controller.addAction(new ViewLayoutTypeAction(MapViewLayout.OUTLINE));
controller.addExtension(HighlightController.class, new HighlightController());
FilterController.install();
PrintController.install();
HelpController.install();
NodeHistory.install(controller);
FormatController.install(new FormatController());
ModelessAttributeController.install();
TextController.install();
MapController.install();
TimeController.install();
LinkController.install();
IconController.installConditionControllers();
FilterController.getCurrentFilterController().getConditionFactory().addConditionController(70, new LogicalStyleFilterController());
final BModeController browseController = BModeControllerFactory.createModeController();
final Set<String> emptySet = Collections.emptySet();
FilterController.getController(controller).loadDefaultConditions();
controller.addAction(new ShowSelectionAsRectangleAction());
controller.addAction(new NextNodeAction(Direction.FORWARD));
controller.addAction(new NextNodeAction(Direction.BACK));
controller.addAction(new NextNodeAction(Direction.FORWARD_N_FOLD));
controller.addAction(new NextNodeAction(Direction.BACK_N_FOLD));
controller.addAction(NextPresentationItemAction.createFoldingAction());
controller.addAction(NextPresentationItemAction.createNotFoldingAction());
browseController.updateMenus("/xml/appletmenu.xml", emptySet);
appletResourceController.getAcceleratorManager().loadAcceleratorPresets();
controller.selectMode(browseController);
setPropertyByParameter(appletResourceController, "browsemode_initial_map");
isLaunchedByJavaWebStart = isParameterTrue("launched_by_java_web_start");
if (isLaunchedByJavaWebStart) {
if (instanceInitialized)
throw new RuntimeException("singleAppletInstance allowed");
else
instanceInitialized = true;
} else
addGlassPane();
controller.getViewController().setMenubarVisible(false);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
appletViewController.init(controller);
}
});
} catch (RuntimeException e) {
e.printStackTrace();
throw e;
} finally {
appletLock.unlock();
}
}
}, "Freeplane applet initialization").start();
}
Aggregations