use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.
the class RemoveFirstAttributeAction method setEnabled.
@Override
public void setEnabled() {
boolean enable = false;
final AttributeUtilities atrUtil = new AttributeUtilities();
final Collection<NodeModel> nodes = Controller.getCurrentModeController().getMapController().getSelectedNodes();
for (final NodeModel node : nodes) {
if (node != null && atrUtil.hasAttributes(node)) {
enable = true;
break;
}
}
setEnabled(enable);
}
use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.
the class CloneAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final MClipboardController clipboardController = (MClipboardController) ClipboardController.getController();
final NodeModel parent = Controller.getCurrentController().getSelection().getSelected();
clipboardController.addClone(clipboardController.getClipboardContents(), parent);
}
use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.
the class MindMapHTMLWriter method writeHTML.
private int writeHTML(final NodeModel model, final String parentID, int lastChildNumber, final boolean isRoot, final boolean treatAsParagraph, final int depth) throws IOException {
boolean createFolding = false;
if (writeFoldingCode) {
createFolding = mapController.isFolded(model);
if (getProperty("html_export_folding").equals("html_export_fold_all")) {
createFolding = mapController.hasChildren(model);
}
if (getProperty("html_export_folding").equals("html_export_no_folding") || basedOnHeadings || isRoot) {
createFolding = false;
}
}
final TextController textController = TextController.getController();
final Object userObject = model.getUserObject();
final String text = textController.getTransformedTextNoThrow(userObject, model, userObject);
final boolean hasHtml = text.startsWith("<html>");
final boolean heading = basedOnHeadings && !hasHtml && mapController.hasChildren(model) && depth <= 6;
if (!treatAsParagraph && !basedOnHeadings) {
fileout.write("<li>");
} else {
if (heading) {
fileout.write("<h" + depth + ">");
} else if (!hasHtml) {
fileout.write("<p>");
}
}
String localParentID = parentID;
if (createFolding) {
lastChildNumber++;
localParentID = parentID + "_" + lastChildNumber;
writeFoldingButtons(localParentID);
}
String link = NodeLinks.getLinkAsString(model);
if (link != null) {
if (link.endsWith(UrlManager.FREEPLANE_FILE_EXTENSION)) {
link += ".html";
}
fileout.write("<a href=\"" + link + "\" target=\"_blank\"><span class=l>~</span> ");
}
final String fontStyle = fontStyle(nodeStyleController.getColor(model), nodeStyleController.getFont(model));
if (!fontStyle.equals("")) {
fileout.write("<span style=\"" + fontStyle + "\">");
}
if (ResourceController.getResourceController().getBooleanProperty("export_icons_in_html")) {
writeIcons(model);
}
writeModelContent(text);
final String detailText = DetailTextModel.getDetailTextText(model);
if (detailText != null) {
writeModelContent(detailText);
}
if (fontStyle != "") {
fileout.write("</span>");
}
final String noteContent = NoteModel.getNoteText(model);
if (noteContent != null) {
writeModelContent(noteContent);
}
fileout.write(MindMapHTMLWriter.el);
if (link != null) {
fileout.write("</a>" + MindMapHTMLWriter.el);
}
if (heading) {
fileout.write("</h" + depth + ">" + MindMapHTMLWriter.el);
}
boolean treatChildrenAsParagraph = false;
for (final NodeModel child : mapController.childrenUnfolded(model)) {
if (child.toString().length() > 100) {
treatChildrenAsParagraph = true;
break;
}
}
if (getProperty("html_export_folding").equals("html_export_based_on_headings")) {
for (final NodeModel child : mapController.childrenUnfolded(model)) {
lastChildNumber = writeHTML(child, parentID, lastChildNumber, /*isRoot=*/
false, treatChildrenAsParagraph, depth + 1);
}
return lastChildNumber;
}
if (mapController.hasChildren(model)) {
if (getProperty("html_export_folding").equals("html_export_based_on_headings")) {
for (final NodeModel child : mapController.childrenUnfolded(model)) {
lastChildNumber = writeHTML(child, parentID, lastChildNumber, /*isRoot=*/
false, treatChildrenAsParagraph, depth + 1);
}
} else if (createFolding) {
fileout.write("<ul id=\"fold" + localParentID + "\" style=\"POSITION: relative; VISIBILITY: visible;\">");
if (treatChildrenAsParagraph) {
fileout.write("<li>");
}
int localLastChildNumber = 0;
for (final NodeModel child : mapController.childrenUnfolded(model)) {
localLastChildNumber = writeHTML(child, localParentID, localLastChildNumber, /* isRoot=*/
false, treatChildrenAsParagraph, depth + 1);
}
} else {
fileout.write("<ul>");
if (treatChildrenAsParagraph) {
fileout.write("<li>");
}
for (final NodeModel child : mapController.childrenUnfolded(model)) {
lastChildNumber = writeHTML(child, parentID, lastChildNumber, /* isRoot= */
false, treatChildrenAsParagraph, depth + 1);
}
}
if (treatChildrenAsParagraph) {
fileout.write("</li>");
}
fileout.write(MindMapHTMLWriter.el);
fileout.write("</ul>");
}
if (!treatAsParagraph) {
fileout.write(MindMapHTMLWriter.el + "</li>" + MindMapHTMLWriter.el);
}
return lastChildNumber;
}
use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.
the class MindMapHTMLWriter method writeHTML.
void writeHTML(final Collection<NodeModel> selectedNodes) throws IOException {
fileout.write("<html>" + MindMapHTMLWriter.el + "<head>" + MindMapHTMLWriter.el);
if (!selectedNodes.isEmpty()) {
final MapModel map = selectedNodes.iterator().next().getMap();
setDefaultsFrom(map);
writeStyle();
}
fileout.write(MindMapHTMLWriter.el + "</head>" + MindMapHTMLWriter.el + "<body>" + MindMapHTMLWriter.el);
for (NodeModel node : selectedNodes) {
writeHTML(node, "1", 0, /* isRoot */
true, true, /* depth */
1);
}
fileout.write("</body>" + MindMapHTMLWriter.el);
fileout.write("</html>" + MindMapHTMLWriter.el);
fileout.close();
resetDefaults();
}
use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.
the class MClipboardController method cut.
Transferable cut(final List<NodeModel> collection) {
Controller.getCurrentModeController().getMapController().sortNodesByDepth(collection);
final MindMapNodesSelection transferable = copy(collection, true);
for (final NodeModel node : collection) {
if (node.getParentNode() != null) {
((MMapController) Controller.getCurrentModeController().getMapController()).deleteNode(node);
}
}
setClipboardContents(transferable);
return transferable;
}
Aggregations