use of org.freeplane.features.icon.MindIcon in project freeplane by freeplane.
the class MindMapHTMLWriter method writeIcons.
private void writeIcons(final NodeModel model) throws IOException {
final Collection<MindIcon> icons = IconController.getController().getIcons(model);
for (MindIcon icon : icons) {
final String iconFileName = icon.getFileName();
fileout.write("<img src=\"" + iconFileName + "\" alt=\"" + icon.getTranslationValueLabel() + "\">");
}
}
use of org.freeplane.features.icon.MindIcon in project freeplane by freeplane.
the class MTextController method joinNodes.
public void joinNodes(final List<NodeModel> selectedNodes) {
if (selectedNodes.isEmpty())
return;
final NodeModel selectedNode = selectedNodes.get(0);
final NodeModel parentNode = selectedNode.getParentNode();
for (final NodeModel node : selectedNodes) {
if (node.getParentNode() != parentNode) {
UITools.errorMessage(TextUtils.getText("cannot_add_parent_diff_parents"));
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);
if (node != selectedNode) {
final MMapController mapController = (MMapController) Controller.getCurrentModeController().getMapController();
for (final NodeModel child : node.getChildren().toArray(new NodeModel[] {})) {
mapController.moveNode(child, 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.MindIcon in project freeplane by freeplane.
the class IconStoreFactory method setIconGroups.
private static void setIconGroups(final IconStore iconStore) {
final String[] groupNames = RESOURCE_CONTROLLER.getProperty(GROUP_NAMES_KEY).split(SEPARATOR);
for (final String groupName : groupNames) {
final String description = TextUtils.getText(String.format(GROUP_DESC_KEY, groupName));
List<MindIcon> icons;
UIIcon groupIcon = null;
if ("user".equals(groupName)) {
icons = IconStoreFactory.getUserIcons();
groupIcon = MindIconFactory.create("user_icon");
} else {
final String groupIconName = RESOURCE_CONTROLLER.getProperty(String.format(GROUP_ICON_KEY, groupName));
final Map<String, MindIcon> iconMap = IconStoreFactory.getIcons(groupName);
groupIcon = iconMap.get(groupIconName);
icons = new ArrayList<MindIcon>(iconMap.values());
}
if (groupIcon == null) {
groupIcon = icons.size() > 0 ? icons.get(0) : IconNotFound.instance();
}
iconStore.addGroup(new IconGroup(groupName, groupIcon, description, icons));
}
}
use of org.freeplane.features.icon.MindIcon in project freeplane by freeplane.
the class IconsProxy method getIcons.
public List<String> getIcons() {
final List<MindIcon> icons = getDelegate().getIcons();
final int size = icons.size();
if (size == 0) {
return Collections.emptyList();
}
final ArrayList<String> list = new ArrayList<String>(size);
for (final MindIcon icon : icons) {
list.add(icon.getName());
}
return Collections.unmodifiableList(list);
}
Aggregations