use of org.freeplane.features.link.ConnectorModel.Shape in project freeplane by freeplane.
the class LinkController method getStandardConnectorShape.
public Shape getStandardConnectorShape() {
final String standardShape = ResourceController.getResourceController().getProperty(RESOURCES_CONNECTOR_SHAPE);
final Shape shape = Shape.valueOf(standardShape);
return shape;
}
use of org.freeplane.features.link.ConnectorModel.Shape in project freeplane by freeplane.
the class MMapMouseListener method mousePressed.
public void mousePressed(final MouseEvent e) {
super.mousePressed(e);
if (e.isPopupTrigger())
return;
final MapView mapView = (MapView) e.getComponent();
final Object object = mapView.detectCollision(new Point(originX, originY));
if (object instanceof ConnectorModel) {
final ConnectorModel arrowLinkModel = (ConnectorModel) object;
final Shape shape = arrowLinkModel.getShape();
if (Shape.EDGE_LIKE.equals(shape) || Shape.LINE.equals(shape) && !arrowLinkModel.isSelfLink()) {
return;
}
draggedLink = arrowLinkModel;
draggedLinkOldStartPoint = draggedLink.getStartInclination();
draggedLinkOldEndPoint = draggedLink.getEndInclination();
draggedLink.setShowControlPoints(true);
mapView.repaintVisible();
}
}
use of org.freeplane.features.link.ConnectorModel.Shape in project freeplane by freeplane.
the class MLinkController method setShape.
public void setShape(final ConnectorModel connector, final Shape shape) {
final Shape oldShape = connector.getShape();
if (oldShape.equals(shape)) {
return;
}
final IActor actor = new IActor() {
public void act() {
connector.setShape(shape);
final NodeModel node = connector.getSource();
fireNodeConnectorChange(node, connector);
}
public String getDescription() {
return "setConnectorShape";
}
public void undo() {
connector.setShape(oldShape);
final NodeModel node = connector.getSource();
fireNodeConnectorChange(node, connector);
}
};
Controller.getCurrentModeController().execute(actor, connector.getSource().getMap());
}
use of org.freeplane.features.link.ConnectorModel.Shape in project freeplane by freeplane.
the class LinkBuilder method save.
public void save(final ITreeWriter writer, final ConnectorModel model) throws IOException {
final NodeModel target = model.getTarget();
if (target == null) {
return;
}
final XMLElement arrowLink = new XMLElement();
arrowLink.setName("arrowlink");
final Shape shape = model.getShape();
arrowLink.setAttribute("SHAPE", shape.toString());
final Color color = model.getColor();
arrowLink.setAttribute("COLOR", ColorUtils.colorToString(color));
final int width = model.getWidth();
arrowLink.setAttribute("WIDTH", Integer.toString(width));
final int alpha = model.getAlpha();
arrowLink.setAttribute("TRANSPARENCY", Integer.toString(alpha));
final int[] dash = model.getDash();
if (dash != null) {
StringBuilder sb = null;
for (int i : dash) {
if (sb == null) {
sb = new StringBuilder(dash.length * 4);
} else {
sb.append(' ');
}
sb.append(i);
}
if (sb != null) {
arrowLink.setAttribute("DASH", sb.toString());
}
}
final int fontSize = model.getLabelFontSize();
arrowLink.setAttribute("FONT_SIZE", Integer.toString(fontSize));
final String fontFamily = model.getLabelFontFamily();
arrowLink.setAttribute("FONT_FAMILY", fontFamily);
final String destinationLabel = target.createID();
if (destinationLabel != null) {
arrowLink.setAttribute("DESTINATION", destinationLabel);
}
final String sourceLabel = model.getSourceLabel();
if (sourceLabel != null) {
arrowLink.setAttribute("SOURCE_LABEL", sourceLabel);
}
final String targetLabel = model.getTargetLabel();
if (targetLabel != null) {
arrowLink.setAttribute("TARGET_LABEL", targetLabel);
}
final String middleLabel = model.getMiddleLabel();
if (middleLabel != null) {
arrowLink.setAttribute("MIDDLE_LABEL", middleLabel);
}
final Point startInclination = model.getStartInclination();
if (startInclination != null) {
arrowLink.setAttribute("STARTINCLINATION", TreeXmlWriter.PointToXml(startInclination));
}
final Point endInclination = model.getEndInclination();
if (endInclination != null) {
arrowLink.setAttribute("ENDINCLINATION", TreeXmlWriter.PointToXml(endInclination));
}
final String startArrow = model.getStartArrow().toString();
if (startArrow != null) {
arrowLink.setAttribute("STARTARROW", startArrow);
}
final String endArrow = model.getEndArrow().toString();
if (endArrow != null) {
arrowLink.setAttribute("ENDARROW", endArrow);
}
writer.addElement(model, arrowLink);
}
Aggregations