use of org.freeplane.features.edge.EdgeController.Rules in project freeplane by freeplane.
the class NodeView method setBounds.
@Override
public void setBounds(int x, int y, int width, int height) {
Rules rule = edgeColor.getRule();
if (EdgeController.Rules.BY_PARENT != rule)
edgeColor.resetCache();
super.setBounds(x, y, width, height);
}
use of org.freeplane.features.edge.EdgeController.Rules in project freeplane by freeplane.
the class NodeView method getEdgeColor.
public Color getEdgeColor() {
if (edgeColor.hasValue())
return edgeColor.getValue();
Rules rule = edgeColor.getRule();
if (rule == EdgeController.Rules.BY_COLUMN) {
final Color color = new AutomaticEdgeStyle(this).getColor();
edgeColor.setCache(color);
return color;
}
final NodeModel parentNode = model.getParentNode();
if (rule == EdgeController.Rules.BY_BRANCH && parentNode.isRoot() || rule == EdgeController.Rules.BY_LEVEL) {
final int index;
if (rule == EdgeController.Rules.BY_BRANCH)
index = parentNode.getIndex(model) + 1;
else
index = model.getNodeLevel(false) + (model.isHiddenSummary() ? 1 : 0);
final MapModel mapModel = map.getModel();
ModeController modeController = map.getModeController();
EdgeController edgeController = modeController.getExtension(EdgeController.class);
if (edgeController.areEdgeColorsAvailable(mapModel)) {
Color color = edgeController.getEdgeColor(mapModel, index);
edgeColor.setCache(color);
return color;
}
} else if (rule == EdgeController.Rules.BY_PARENT) {
final NodeView parentView = getParentView();
if (parentView != null) {
final Color color = parentView.getEdgeColor();
return color;
}
}
return Color.GRAY;
}
Aggregations