use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.
the class DetailsViewMouseListener method mouseClicked.
@Override
public void mouseClicked(MouseEvent e) {
final ModeController mc = Controller.getCurrentController().getModeController();
if (Compat.isMacOsX()) {
final JPopupMenu popupmenu = mc.getUserInputListenerFactory().getNodePopupMenu();
if (popupmenu.isShowing()) {
return;
}
}
final NodeView nodeView = nodeSelector.getRelatedNodeView(e);
if (nodeView == null)
return;
final NodeModel model = nodeView.getModel();
TextController controller = TextController.getController();
if (eventFromHideDisplayArea(e)) {
final IMapSelection selection = Controller.getCurrentController().getSelection();
selection.keepNodePosition(model, 0.0f, 0.0f);
controller.setDetailsHidden(model, !DetailTextModel.getDetailText(model).isHidden());
} else {
nodeSelector.extendSelection(e);
if (canEdit(controller) && isEditingStartEvent(e)) {
((MTextController) controller).editDetails(model, e, e.isAltDown());
} else
super.mouseClicked(e);
}
}
use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.
the class MNoteController method onWrite.
@Override
protected void onWrite(final MapModel map) {
final ModeController modeController = Controller.getCurrentModeController();
final Controller controller = modeController.getController();
final IMapSelection selection = controller.getSelection();
if (selection == null) {
return;
}
final NodeModel selected = selection.getSelected();
noteManager.saveNote(selected);
}
use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.
the class AssignStyleAction method setSelected.
@Override
public void setSelected() {
IMapSelection selection = Controller.getCurrentController().getSelection();
if (selection != null) {
NodeModel node = selection.getSelected();
final IStyle style = LogicalStyleModel.getStyle(node);
setSelected(this.style == style || this.style != null && this.style.equals(style));
} else
setSelected(false);
}
use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.
the class SetShortenerStateAction method actionPerformed.
@Override
public void actionPerformed(final ActionEvent e) {
setShortened = !isShortened();
final IMapSelection selection = Controller.getCurrentController().getSelection();
selection.keepNodePosition(selection.getSelected(), 0.0f, 0.0f);
super.actionPerformed(e);
}
use of org.freeplane.features.map.IMapSelection in project freeplane by freeplane.
the class SModeControllerFactory method createController.
Controller createController(final JDialog dialog) {
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);
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());
final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController, false);
userInputListenerFactory.setNodeMouseMotionListener(new DefaultNodeMouseMotionListener());
modeController.setUserInputListenerFactory(userInputListenerFactory);
controller.addExtension(ModelessAttributeController.class, new ModelessAttributeController());
new MMapController(modeController);
userInputListenerFactory.getMenuBuilder(RibbonBuilder.class).setEnabled(false);
TextController.install(new MTextController(modeController));
SpellCheckerController.install(modeController);
IconController.install(new MIconController(modeController));
NodeStyleController.install(new MNodeStyleController(modeController));
EdgeController.install(new MEdgeController(modeController));
CloudController.install(new MCloudController(modeController));
NoteController.install(new MNoteController(modeController));
LinkController.install(new MLinkController());
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());
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);
final SModeController modeController = this.modeController;
final StyleEditorPanel styleEditorPanel = new StyleEditorPanel(modeController, null, false);
final MapController mapController = modeController.getMapController();
mapController.addNodeSelectionListener(new INodeSelectionListener() {
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 = (NodeModel) node.getChildAt(0);
} else {
nextSelection = (NodeModel) (node.getMap().getRootNode().getChildAt(0).getChildAt(0));
}
} else {
nextSelection = node;
}
EventQueue.invokeLater(new Runnable() {
public void run() {
selection.selectAsTheOnlyOneSelected(nextSelection);
}
});
}
public void onDeselect(final NodeModel node) {
}
});
mapController.addNodeChangeListener(new INodeChangeListener() {
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);
modeController.addExtension(MUIFactory.class, new MUIFactory());
final Set<String> emptySet = Collections.emptySet();
modeController.updateMenus("/xml/stylemodemenu.xml", emptySet);
this.modeController = null;
return controller;
}
Aggregations