use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class MapController method createActions.
/**
* @param modeController
*/
private void createActions() {
final ModeController modeController = Controller.getCurrentModeController();
modeController.addAction(new ToggleFoldedAction());
modeController.addAction(new ToggleChildrenFoldedAction());
modeController.addAction(new ShowNextChildAction());
modeController.addAction(new GotoNodeAction());
}
use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class FoldingController method handleMouseWheelEvent.
public boolean handleMouseWheelEvent(final MouseWheelEvent e) {
if ((e.getModifiers() & InputEvent.ALT_MASK) != 0) {
Controller controller = Controller.getCurrentController();
final NodeModel rootNode = controller.getMap().getRootNode();
if (e.getWheelRotation() > 0) {
unfoldOneStage(rootNode);
} else {
final ModeController modeController = controller.getModeController();
modeController.getMapController().select(controller.getMap().getRootNode());
foldOneStage(rootNode);
}
return true;
}
return false;
}
use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class NodeStyleController method install.
public static void install(final NodeStyleController styleController) {
final ModeController modeController = Controller.getCurrentModeController();
modeController.addExtension(NodeStyleController.class, styleController);
}
use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class LoadAcceleratorPresetsAction method install.
public static final void install() {
final File[] dirs = { LoadAcceleratorPresetsAction.getAcceleratorsUserDirectory(), LoadAcceleratorPresetsAction.getAcceleratorsSysDirectory() };
final Controller controller = Controller.getCurrentController();
ModeController modecontroller = controller.getModeController(MModeController.MODENAME);
final MenuBuilder menuBuilder = modecontroller.getUserInputListenerFactory().getMenuBuilder(MenuBuilder.class);
// TODO RIBBONS: impl. eventually
for (final File dir : dirs) {
final File[] fileList = dir.listFiles();
if (fileList == null) {
continue;
}
for (final File prop : fileList) {
final String fileName = prop.getName();
if (prop.isDirectory()) {
continue;
}
if (!fileName.endsWith(".properties")) {
continue;
}
try {
final int propNameLength = fileName.lastIndexOf('.');
final String propName = fileName.substring(0, propNameLength);
final String key = "LoadAcceleratorPresetsAction." + propName;
if (controller.getAction(key) == null) {
final String title = TextUtils.getText(key + ".text", propName);
final LoadAcceleratorPresetsAction loadAcceleratorPresetsAction = new LoadAcceleratorPresetsAction(prop.toURL(), key, title);
controller.addAction(loadAcceleratorPresetsAction);
menuBuilder.addAction("main_menu_new_load_accelerator_presets", key, loadAcceleratorPresetsAction, MenuBuilder.AS_CHILD);
}
} catch (final Exception e) {
UITools.errorMessage(TextUtils.format("accelerators_loading_error", prop.getPath()));
}
}
}
}
use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class LogicalStyleController method createBuilder.
private void createBuilder() {
ModeController modeController = Controller.getCurrentModeController();
final MapController mapController = modeController.getMapController();
final ReadManager readManager = mapController.getReadManager();
readManager.addAttributeHandler(NodeBuilder.XML_NODE, "STYLE_REF", new IAttributeHandler() {
public void setAttribute(final Object node, final String value) {
final LogicalStyleModel extension = LogicalStyleModel.createExtension((NodeModel) node);
extension.setStyle(StyleFactory.create(value));
}
});
readManager.addAttributeHandler(NodeBuilder.XML_NODE, "LOCALIZED_STYLE_REF", new IAttributeHandler() {
public void setAttribute(final Object node, final String value) {
final LogicalStyleModel extension = LogicalStyleModel.createExtension((NodeModel) node);
extension.setStyle(StyleFactory.create(NamedObject.format(value)));
}
});
final WriteManager writeManager = mapController.getWriteManager();
writeManager.addAttributeWriter(NodeBuilder.XML_NODE, new IAttributeWriter() {
public void writeAttributes(final ITreeWriter writer, final Object node, final String tag) {
if (!NodeWriter.shouldWriteSharedContent(writer))
return;
final LogicalStyleModel extension = LogicalStyleModel.getExtension((NodeModel) node);
if (extension == null) {
return;
}
final IStyle style = extension.getStyle();
if (style == null) {
return;
}
final String value = StyleNamedObject.toKeyString(style);
if (style instanceof StyleNamedObject) {
writer.addAttribute("LOCALIZED_STYLE_REF", value);
} else {
writer.addAttribute("STYLE_REF", value);
}
}
});
}
Aggregations