use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class MNodeMotionListener method mouseDragged.
@Override
public void mouseDragged(final MouseEvent e) {
if (!isDragActive())
return;
if ((e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) == (InputEvent.BUTTON1_DOWN_MASK)) {
final MainView mainView = (MainView) e.getSource();
final NodeView nodeV = getNodeView(e);
final MapView mapView = nodeV.getMap();
final Point point = e.getPoint();
findGridPoint(point);
UITools.convertPointToAncestor(nodeV, point, JScrollPane.class);
ModeController c = Controller.getCurrentController().getModeController();
final Point dragNextPoint = point;
if (!Compat.isCtrlEvent(e)) {
final NodeModel node = nodeV.getModel();
final LocationModel locationModel = LocationModel.createLocationModel(node);
final int hGapChange = getHGapChange(dragNextPoint, node);
if (hGapChange != 0) {
locationModel.setHGap(originalHGap + hGapChange);
}
final int shiftYChange = getNodeShiftYChange(dragNextPoint, node);
if (shiftYChange != 0) {
locationModel.setShiftY(originalShiftY + shiftYChange);
}
if (hGapChange != 0 || shiftYChange != 0)
c.getMapController().nodeRefresh(node);
else
return;
} else {
final NodeModel parentNode = nodeV.getVisibleParentView().getModel();
final int vGapChange = getVGapChange(dragNextPoint, parentNode);
if (vGapChange != 0) {
LocationModel.createLocationModel(parentNode).setVGap(Math.max(0, originalParentVGap - vGapChange));
final MapController mapController = c.getMapController();
mapController.nodeRefresh(parentNode);
mapController.nodeRefresh(nodeV.getModel());
} else
return;
}
EventQueue.invokeLater(new Runnable() {
public void run() {
final Rectangle r = mainView.getBounds();
UITools.convertRectangleToAncestor(mainView.getParent(), r, mapView);
final boolean isEventPointVisible = mapView.getVisibleRect().contains(r);
if (!isEventPointVisible) {
mapView.scrollRectToVisible(r);
}
}
});
}
}
use of org.freeplane.features.mode.ModeController 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.mode.ModeController in project freeplane by freeplane.
the class WorkspaceController method shutdown.
public void shutdown() {
for (String modeName : Controller.getCurrentController().getModes()) {
ModeController modeController = Controller.getCurrentController().getModeController(modeName);
AWorkspaceModeExtension modeExt = modeController.getExtension(AWorkspaceModeExtension.class);
if (modeExt == null) {
continue;
}
modeExt.shutdown();
}
}
use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class Activator method start.
public void start(final BundleContext context) throws Exception {
registerClasspathUrlHandler(context);
context.registerService(IControllerExtensionProvider.class.getName(), new IControllerExtensionProvider() {
public void installExtension(Controller controller) {
WorkspaceController.install(controller);
UserAccountController.install(controller);
LogUtils.info("Workspace controller installed.");
startControllerExtensions(context, controller);
}
}, null);
final Hashtable<String, String[]> props = new Hashtable<String, String[]>();
// WORKSPACE - todo(low): list all modes from freeplane controller
props.put("mode", new String[] { MModeController.MODENAME });
context.registerService(IModeControllerExtensionProvider.class.getName(), new IModeControllerExtensionProvider() {
public void installExtension(ModeController modeController) {
addToQuitChain();
WorkspaceController.getController().installMode(modeController);
startPluginServices(context, modeController);
WorkspaceController.getController().startModeExtension(modeController);
}
}, props);
}
use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class MNoteController method startupController.
public void startupController() {
final ModeController modeController = Controller.getCurrentModeController();
if (shouldUseSplitPane()) {
showNotesPanel(false);
}
modeController.getMapController().addNodeSelectionListener(noteManager);
noteManager.mNoteDocumentListener = new NoteDocumentListener();
}
Aggregations