use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.
the class IconBuilder method endElement.
@Override
public void endElement(final Object parent, final String tag, final Object userObject, final XMLElement dom) {
if (parent instanceof NodeModel && tag.equals("icon")) {
final NodeModel node = (NodeModel) parent;
final IconProperties ip = (IconProperties) userObject;
final String iconName = ip.iconName;
if (iconName != null)
node.addIcon(store.getMindIcon(iconName));
return;
}
}
use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.
the class IconController method getStyleIconSize.
private Quantity<LengthUnits> getStyleIconSize(final MapModel map, final Collection<IStyle> styleKeys) {
final MapStyleModel model = MapStyleModel.getExtension(map);
for (IStyle styleKey : styleKeys) {
final NodeModel styleNode = model.getStyleNode(styleKey);
if (styleNode == null) {
continue;
}
final Quantity<LengthUnits> iconSize = styleNode.getSharedData().getIcons().getIconSize();
if (iconSize == null) {
continue;
}
return iconSize;
}
return DEFAULT_ICON_SIZE;
}
use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.
the class FollowLinkAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final ModeController modeController = Controller.getCurrentModeController();
final MapController mapController = modeController.getMapController();
LinkController linkController = LinkController.getController();
NodeModel selNode = mapController.getSelectedNode();
linkController.loadURL(selNode, e);
}
use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.
the class LinkBuilder method registerAttributeHandlers.
private void registerAttributeHandlers(final ReadManager reader) {
reader.addAttributeHandler(NodeBuilder.XML_NODE, LINK, new IAttributeHandler() {
public void setAttribute(final Object userObject, final String value) {
final NodeModel node = (NodeModel) userObject;
linkController.loadLink(node, value);
final Collection<NodeLinkModel> links = NodeLinks.getLinks(node);
processedLinks.addAll(links);
}
});
final IAttributeHandler hyperlinkHandler = new IAttributeHandler() {
public void setAttribute(final Object userObject, final String value) {
final NodeModel node = (NodeModel) userObject;
linkController.loadLinkFormat(node, Boolean.parseBoolean(value));
}
};
reader.addAttributeHandler(NodeBuilder.XML_NODE, FORMAT_AS_HYPERLINK, hyperlinkHandler);
reader.addAttributeHandler(NodeBuilder.XML_STYLENODE, FORMAT_AS_HYPERLINK, hyperlinkHandler);
reader.addAttributeHandler("arrowlink", "EDGE_LIKE", new IAttributeHandler() {
public void setAttribute(final Object userObject, final String value) {
final ConnectorModel arrowLink = (ConnectorModel) userObject;
arrowLink.setShape(Shape.EDGE_LIKE);
}
});
reader.addAttributeHandler("arrowlink", "SHAPE", new IAttributeHandler() {
public void setAttribute(final Object userObject, final String value) {
final ConnectorModel arrowLink = (ConnectorModel) userObject;
arrowLink.setShape(Shape.valueOf(value));
}
});
reader.addAttributeHandler("arrowlink", "DASH", new IAttributeHandler() {
public void setAttribute(final Object userObject, final String value) {
final ConnectorModel arrowLink = (ConnectorModel) userObject;
final String[] split = value.split(" ");
int[] dash = new int[split.length];
int i = 0;
for (String s : split) {
dash[i++] = Integer.parseInt(s);
}
arrowLink.setDash(dash);
}
});
reader.addAttributeHandler("arrowlink", "DESTINATION", new IAttributeHandler() {
public void setAttribute(final Object userObject, final String value) {
final ConnectorModel arrowLink = (ConnectorModel) userObject;
arrowLink.setTargetID(value);
processedLinks.add(arrowLink);
}
});
reader.addAttributeHandler("arrowlink", "SOURCE_LABEL", new IAttributeHandler() {
public void setAttribute(final Object userObject, final String value) {
final ConnectorModel arrowLink = (ConnectorModel) userObject;
arrowLink.setSourceLabel(value.toString());
}
});
reader.addAttributeHandler("arrowlink", "MIDDLE_LABEL", new IAttributeHandler() {
public void setAttribute(final Object userObject, final String value) {
final ConnectorModel arrowLink = (ConnectorModel) userObject;
arrowLink.setMiddleLabel(value.toString());
}
});
reader.addAttributeHandler("arrowlink", "TARGET_LABEL", new IAttributeHandler() {
public void setAttribute(final Object userObject, final String value) {
final ConnectorModel arrowLink = (ConnectorModel) userObject;
arrowLink.setTargetLabel(value.toString());
}
});
reader.addAttributeHandler("arrowlink", "STARTINCLINATION", new IAttributeHandler() {
public void setAttribute(final Object userObject, final String value) {
final ConnectorModel arrowLink = (ConnectorModel) userObject;
arrowLink.setStartInclination(TreeXmlReader.xmlToPoint(value.toString()));
}
});
reader.addAttributeHandler("arrowlink", "ENDINCLINATION", new IAttributeHandler() {
public void setAttribute(final Object userObject, final String value) {
final ConnectorModel arrowLink = (ConnectorModel) userObject;
arrowLink.setEndInclination(TreeXmlReader.xmlToPoint(value.toString()));
}
});
reader.addAttributeHandler("arrowlink", "STARTARROW", new IAttributeHandler() {
public void setAttribute(final Object userObject, final String value) {
final ConnectorModel arrowLink = (ConnectorModel) userObject;
arrowLink.setStartArrow(ArrowType.valueOf(value.toUpperCase(Locale.ENGLISH)));
}
});
reader.addAttributeHandler("arrowlink", "ENDARROW", new IAttributeHandler() {
public void setAttribute(final Object userObject, final String value) {
final ConnectorModel arrowLink = (ConnectorModel) userObject;
arrowLink.setEndArrow(ArrowType.valueOf(value.toUpperCase(Locale.ENGLISH)));
}
});
reader.addAttributeHandler("arrowlink", "WIDTH", new IAttributeHandler() {
public void setAttribute(final Object userObject, final String value) {
final ConnectorModel arrowLink = (ConnectorModel) userObject;
arrowLink.setWidth(Integer.parseInt(value.toString()));
}
});
reader.addAttributeHandler("arrowlink", "FONT_FAMILY", new IAttributeHandler() {
public void setAttribute(final Object userObject, final String value) {
final ConnectorModel arrowLink = (ConnectorModel) userObject;
arrowLink.setLabelFontFamily(value.toString());
}
});
reader.addAttributeHandler("arrowlink", "FONT_SIZE", new IAttributeHandler() {
public void setAttribute(final Object userObject, final String value) {
final ConnectorModel arrowLink = (ConnectorModel) userObject;
arrowLink.setLabelFontSize(Integer.parseInt(value.toString()));
}
});
}
use of org.freeplane.features.map.NodeModel in project freeplane by freeplane.
the class NodeStyleBuilder method endElement.
public void endElement(final Object parent, final String tag, final Object userObject, final XMLElement dom) {
if (parent instanceof NodeModel) {
final NodeModel node = (NodeModel) parent;
if (tag.equals("font")) {
final FontProperties fp = (FontProperties) userObject;
NodeStyleModel nodeStyleModel = NodeStyleModel.getModel(node);
if (nodeStyleModel == null) {
nodeStyleModel = new NodeStyleModel();
node.addExtension(nodeStyleModel);
}
nodeStyleModel.setFontFamilyName(fp.fontName);
nodeStyleModel.setFontSize(fp.fontSize);
nodeStyleModel.setItalic(fp.isItalic);
nodeStyleModel.setBold(fp.isBold);
nodeStyleModel.setStrikedThrough(fp.isStrikedThrough);
return;
}
return;
}
}
Aggregations