use of org.freeplane.features.DashVariant in project freeplane by freeplane.
the class EdgeController method getStyleDash.
private DashVariant getStyleDash(final MapModel map, final Collection<IStyle> collection) {
final MapStyleModel model = MapStyleModel.getExtension(map);
for (IStyle styleKey : collection) {
final NodeModel styleNode = model.getStyleNode(styleKey);
if (styleNode == null) {
continue;
}
final EdgeModel styleModel = EdgeModel.getModel(styleNode);
if (styleModel == null) {
continue;
}
final DashVariant dash = styleModel.getDash();
if (dash == null) {
continue;
}
return dash;
}
return null;
}
use of org.freeplane.features.DashVariant in project freeplane by freeplane.
the class LinkController method getStandardDashVariant.
public DashVariant getStandardDashVariant() {
final String standard = ResourceController.getResourceController().getProperty(RESOURCES_DASH_VARIANT);
final DashVariant variant = DashVariant.valueOf(standard);
return variant;
}
use of org.freeplane.features.DashVariant in project freeplane by freeplane.
the class MNodeStyleController method setBorderDash.
public void setBorderDash(final NodeModel node, final DashVariant borderDash) {
final DashVariant oldBorderDash = NodeBorderModel.getBorderDash(node);
final IActor actor = new IActor() {
public void act() {
NodeBorderModel.setBorderDash(node, borderDash);
final MapController mapController = getModeController().getMapController();
mapController.nodeChanged(node);
}
public String getDescription() {
return "setBorderDash";
}
public void undo() {
NodeBorderModel.setBorderDash(node, oldBorderDash);
final MapController mapController = getModeController().getMapController();
mapController.nodeChanged(node);
}
};
getModeController().execute(actor, node.getMap());
}
use of org.freeplane.features.DashVariant in project freeplane by freeplane.
the class MEdgeController method setDash.
public void setDash(final NodeModel node, final DashVariant dash) {
final ModeController modeController = Controller.getCurrentModeController();
final DashVariant oldDash = EdgeModel.createEdgeModel(node).getDash();
if (dash == oldDash) {
return;
}
final IActor actor = new IActor() {
public void act() {
EdgeModel.createEdgeModel(node).setDash(dash);
modeController.getMapController().nodeChanged(node);
edgeWidthRefresh(node);
}
private void edgeWidthRefresh(final NodeModel node) {
for (final NodeModel child : modeController.getMapController().childrenUnfolded(node)) {
if (child.getViewers().isEmpty())
continue;
final EdgeModel edge = EdgeModel.getModel(child);
if (edge == null || edge.getWidth() == EdgeModel.WIDTH_PARENT) {
modeController.getMapController().nodeRefresh(child);
edgeWidthRefresh(child);
}
}
}
public String getDescription() {
return "setDash";
}
public void undo() {
EdgeModel.createEdgeModel(node).setDash(oldDash);
modeController.getMapController().nodeChanged(node);
edgeWidthRefresh(node);
}
};
modeController.execute(actor, node.getMap());
}
use of org.freeplane.features.DashVariant in project freeplane by freeplane.
the class NodeStyleBuilder method writeAttributes.
private void writeAttributes(final ITreeWriter writer, final NodeModel node, final NodeBorderModel border, final boolean forceFormatting) {
final Boolean borderWidthMatchesEdgeWidth = forceFormatting ? nsc.getBorderWidthMatchesEdgeWidth(node) : border.getBorderWidthMatchesEdgeWidth();
if (borderWidthMatchesEdgeWidth != null) {
writer.addAttribute("BORDER_WIDTH_LIKE_EDGE", borderWidthMatchesEdgeWidth.toString());
}
final Quantity<LengthUnits> borderWidth = forceFormatting ? nsc.getBorderWidth(node) : border.getBorderWidth();
if (borderWidth != null) {
writer.addAttribute("BORDER_WIDTH", borderWidth.toString());
}
final Boolean borderColorMatchesEdgeColor = forceFormatting ? nsc.getBorderColorMatchesEdgeColor(node) : border.getBorderColorMatchesEdgeColor();
if (borderColorMatchesEdgeColor != null) {
writer.addAttribute("BORDER_COLOR_LIKE_EDGE", borderColorMatchesEdgeColor.toString());
}
final Color borderColor = forceFormatting ? nsc.getBorderColor(node) : border.getBorderColor();
if (borderColor != null) {
ColorUtils.addColorAttributes(writer, "BORDER_COLOR", "BORDER_COLOR_ALPHA", borderColor);
}
final Boolean borderDashMatchesEdgeDash = forceFormatting ? nsc.getBorderDashMatchesEdgeDash(node) : border.getBorderDashMatchesEdgeDash();
if (borderDashMatchesEdgeDash != null) {
writer.addAttribute("BORDER_DASH_LIKE_EDGE", borderDashMatchesEdgeDash.toString());
}
DashVariant borderDash = forceFormatting ? nsc.getBorderDash(node) : border.getBorderDash();
if (borderDash != null) {
writer.addAttribute("BORDER_DASH", borderDash.name());
}
}
Aggregations