use of org.freeplane.features.icon.IconController in project freeplane by freeplane.
the class NodeWriter method writeIconSize.
private void writeIconSize(final ITreeWriter writer, final NodeModel node) {
final boolean forceFormatting = Boolean.TRUE.equals(writer.getHint(MapWriter.WriterHint.FORCE_FORMATTING));
Quantity<LengthUnits> iconSize = null;
if (forceFormatting) {
final IconController iconController = IconController.getController();
iconSize = iconController.getIconSize(node);
} else
iconSize = node.getSharedData().getIcons().getIconSize();
if (iconSize != null) {
writer.addAttribute("ICON_SIZE", iconSize.toString());
}
}
use of org.freeplane.features.icon.IconController 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.icon.IconController in project freeplane by freeplane.
the class MTextController method joinNodes.
public void joinNodes(final List<NodeModel> selectedNodes, final String separator) {
if (selectedNodes.isEmpty())
return;
final NodeModel selectedNode = selectedNodes.get(0);
for (final NodeModel node : selectedNodes) {
if (node != selectedNode && node.subtreeContainsCloneOf(selectedNode)) {
UITools.errorMessage(TextUtils.getText("cannot_move_into_child_node"));
return;
}
}
String joinedContent = "";
final Controller controller = Controller.getCurrentController();
boolean isHtml = false;
final LinkedHashSet<MindIcon> icons = new LinkedHashSet<MindIcon>();
for (final NodeModel node : selectedNodes) {
final String nodeContent = node.getText();
icons.addAll(node.getIcons());
final boolean isHtmlNode = HtmlUtils.isHtmlNode(nodeContent);
joinedContent = addContent(joinedContent, isHtml, nodeContent, isHtmlNode, separator);
if (node != selectedNode) {
final MMapController mapController = (MMapController) Controller.getCurrentModeController().getMapController();
mapController.moveNodes(node.getChildren(), selectedNode, selectedNode.getChildCount());
mapController.deleteNode(node);
}
isHtml = isHtml || isHtmlNode;
}
controller.getSelection().selectAsTheOnlyOneSelected(selectedNode);
setNodeText(selectedNode, joinedContent);
final MIconController iconController = (MIconController) IconController.getController();
iconController.removeAllIcons(selectedNode);
for (final MindIcon icon : icons) {
iconController.addIcon(selectedNode, icon);
}
}
use of org.freeplane.features.icon.IconController in project freeplane by freeplane.
the class MindMapHTMLWriter method writeIcons.
private void writeIcons(final NodeModel model) throws IOException {
final IconController iconController = IconController.getController();
final Collection<MindIcon> icons = iconController.getIcons(model);
for (MindIcon icon : icons) {
final String iconFileName = icon.getSource();
fileout.write("<img src=\"icons/" + iconFileName + "\" alt=\"" + icon.getTranslationValueLabel() + "\"");
if (iconFileName.endsWith(".svg")) {
final Quantity<LengthUnits> iconSize = iconController.getIconSize(model);
fileout.write(" height = \"" + iconSize.toBaseUnitsRounded() + "\"");
}
fileout.write(">");
}
}
use of org.freeplane.features.icon.IconController 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;
}
Aggregations