public static Boolean getBorderColorMatchesEdgeColor(final NodeModel node) { final NodeBorderModel extension = node.getExtension(NodeBorderModel.class); return extension == null ? null : extension.getBorderColorMatchesEdgeColor(); }
private Boolean getBorderColorMatchesEdgeColor(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 NodeBorderModel borderModel = NodeBorderModel.getModel(styleNode); if (borderModel == null) { continue; } final Boolean borderColorMatchesEdgeColor = borderModel.getBorderColorMatchesEdgeColor(); if (borderColorMatchesEdgeColor == null) { continue; } return borderColorMatchesEdgeColor; } return true; }
public void setBorderColorMatchesEdgeColor(final NodeModel node, final Boolean borderColorMatchesEdgeColor) { final Boolean oldBorderColorMatchesEdgeColor = NodeBorderModel.getBorderColorMatchesEdgeColor(node); final IActor actor = new IActor() { @Override public void act() { NodeBorderModel.setBorderColorMatchesEdgeColor(node, borderColorMatchesEdgeColor); final MapController mapController = getModeController().getMapController(); mapController.nodeChanged(node); } @Override public String getDescription() { return "setBorderColorMatchesEdgeColor"; } @Override public void undo() { NodeBorderModel.setBorderColorMatchesEdgeColor(node, oldBorderColorMatchesEdgeColor); final MapController mapController = getModeController().getMapController(); mapController.nodeChanged(node); } }; getModeController().execute(actor, node.getMap()); }
@Override void setStyleOnExternalChange(NodeModel node) { final NodeStyleController styleController = NodeStyleController.getController(); final NodeBorderModel nodeBorderModel = NodeBorderModel.getModel(node); final Boolean match = nodeBorderModel != null ? nodeBorderModel.getBorderColorMatchesEdgeColor() : null; final Boolean viewMatch = styleController.getBorderColorMatchesEdgeColor(node); mSetBorderColorMatchesEdgeColor.setValue(match != null); mBorderColorMatchesEdgeColor.setValue(viewMatch); } }
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()); } }
private void copyBorderModel(final NodeModel source, final NodeModel target) { final NodeBorderModel from = NodeBorderModel.getModel(source); if (from != null) { setBorderWidthMatchesEdgeWidth(target, from.getBorderWidthMatchesEdgeWidth()); setBorderWidth(target, from.getBorderWidth()); setBorderDashMatchesEdgeDash(target, from.getBorderDashMatchesEdgeDash()); setBorderDash(target, from.getBorderDash()); setBorderColorMatchesEdgeColor(target, from.getBorderColorMatchesEdgeColor()); setBorderColor(target, from.getBorderColor()); } }
private void removeBorderData(Object key, NodeModel from, NodeModel which) { final NodeBorderModel whichData = which.getExtension(NodeBorderModel.class); if (whichData == null) { return; } final NodeBorderModel fromData = from.getExtension(NodeBorderModel.class); if (fromData == null) { return; } if (null != whichData.getBorderWidthMatchesEdgeWidth()) { fromData.setBorderWidthMatchesEdgeWidth(null); } if (null != whichData.getBorderWidth()) { fromData.setBorderWidth(null); } if (null != whichData.getBorderDashMatchesEdgeDash()) { fromData.setBorderDashMatchesEdgeDash(null); } if (null != whichData.getBorderDash()) { fromData.setBorderDash(null); } if (null != whichData.getBorderColorMatchesEdgeColor()) { fromData.setBorderColorMatchesEdgeColor(null); } if (null != whichData.getBorderColor()) { fromData.setBorderColor(null); } }