use of org.freeplane.features.nodelocation.LocationController 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);
modeController.setUserInputListenerFactory(userInputListenerFactory);
controller.addModeController(modeController);
controller.selectModeForBuild(modeController);
new FMapController(modeController);
UrlManager.install(new UrlManager());
MapIO.install(modeController);
new IconController(modeController).install(modeController);
NodeStyleController.install(new NodeStyleController(modeController));
EdgeController.install(new EdgeController(modeController));
new TextController(modeController).install(modeController);
LinkController.install(new LinkController(modeController));
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<ShapeConfigurationModel, NodeModel>() {
public ShapeConfigurationModel getProperty(final NodeModel node, final ShapeConfigurationModel currentValue) {
return ShapeConfigurationModel.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", FilterController.TOOLBAR_SIDE, FilterController.getCurrentFilterController().getFilterToolbar());
userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, controller.getViewController().getStatusBar());
NodeHistory.install(modeController);
return modeController;
}
use of org.freeplane.features.nodelocation.LocationController 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.nodelocation.LocationController in project freeplane by freeplane.
the class MNodeMotionListener method mouseClicked.
@Override
public void mouseClicked(final MouseEvent e) {
boolean shoudResetPosition = e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2 && doubleClickTimer.getDelay() > 0;
if (shoudResetPosition) {
final MainView mainView = (MainView) e.getComponent();
if (mainView.getMouseArea().equals(MouseArea.MOTION)) {
final Controller controller = Controller.getCurrentController();
MLocationController locationController = (MLocationController) LocationController.getController(controller.getModeController());
if (e.getModifiersEx() == 0) {
final NodeView nodeV = getNodeView(e);
final NodeModel node = nodeV.getModel();
locationController.moveNodePosition(node, LocationModel.DEFAULT_HGAP, LocationModel.DEFAULT_SHIFT_Y);
return;
}
if (Compat.isCtrlEvent(e)) {
final NodeView nodeV = getNodeView(e);
NodeModel childDistanceContainer = nodeV.getParentView().getChildDistanceContainer().getModel();
locationController.setMinimalDistanceBetweenChildren(childDistanceContainer, LocationModel.DEFAULT_VGAP);
return;
}
} else {
if (Compat.isPlainEvent(e) && !isInFoldingRegion(e)) {
final MTextController textController = MTextController.getController();
textController.getEventQueue().activate(e);
textController.edit(FirstAction.EDIT_CURRENT, false);
}
}
}
super.mouseClicked(e);
}
use of org.freeplane.features.nodelocation.LocationController in project freeplane by freeplane.
the class MNodeMotionListener method mouseReleased.
@Override
public void mouseReleased(final MouseEvent e) {
final MainView v = (MainView) e.getSource();
if (!v.contains(e.getX(), e.getY())) {
v.setMouseArea(MouseArea.OUT);
}
if (!isDragActive()) {
super.mouseReleased(e);
return;
}
final NodeView nodeV = getNodeView(e);
final NodeModel node = nodeV.getModel();
final ModeController modeController = nodeV.getMap().getModeController();
final Controller controller = modeController.getController();
MLocationController locationController = (MLocationController) LocationController.getController(controller.getModeController());
final NodeView parentView = nodeV.getParentView();
final NodeView childDistanceContainerView = parentView.getChildDistanceContainer();
NodeModel childDistanceContainer = childDistanceContainerView.getModel();
final Quantity<LengthUnits> parentVGap = locationController.getMinimalDistanceBetweenChildren(childDistanceContainer);
Quantity<LengthUnits> hgap = LocationModel.getModel(node).getHGap();
final Quantity<LengthUnits> shiftY = LocationModel.getModel(node).getShiftY();
adjustNodeIndices(nodeV);
resetPositions(node);
final Quantity<LengthUnits> hGap = hgap;
locationController.moveNodePosition(node, hGap, shiftY);
locationController.setMinimalDistanceBetweenChildren(childDistanceContainer, parentVGap);
stopDrag();
}
Aggregations