}
arrowLinks.clear();
}
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);
arrowLinks.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);
arrowLinks.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()));
}
});
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()));
}
});
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()));
}
});