public static DashVariant getBorderDash(final NodeModel node) { final NodeBorderModel extension = node.getExtension(NodeBorderModel.class); return extension == null ? null : extension.getBorderDash(); }
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 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 DashVariant getBorderDash(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 DashVariant borderDash = borderModel.getBorderDash(); if (borderDash == null) { continue; } return borderDash; } return DashVariant.DEFAULT; }
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); } }
public void setBorderDash(final NodeModel node, final DashVariant borderDash) { final DashVariant oldBorderDash = NodeBorderModel.getBorderDash(node); final IActor actor = new IActor() { @Override public void act() { NodeBorderModel.setBorderDash(node, borderDash); final MapController mapController = getModeController().getMapController(); mapController.nodeChanged(node); } @Override public String getDescription() { return "setBorderDash"; } @Override public void undo() { NodeBorderModel.setBorderDash(node, oldBorderDash); final MapController mapController = getModeController().getMapController(); mapController.nodeChanged(node); } }; getModeController().execute(actor, node.getMap()); }
@Override void setStyleOnExternalChange(NodeModel node) { final NodeBorderModel nodeBorderModel = NodeBorderModel.getModel(node); final NodeStyleController styleController = NodeStyleController.getController(); final DashVariant dash = nodeBorderModel != null ? nodeBorderModel.getBorderDash() : null; final DashVariant viewDash = styleController.getBorderDash(node); mSetBorderDash.setValue(dash != null); mBorderDash.setValue(viewDash.name()); enableOrDisableBorderDashControls(); } }