@Override public void setLineWidth(int w) { LinesBorder lb = (LinesBorder) getBorder(); lb.setWidth(w); getDurationArrow().setLineWidth(w); super.setLineWidth(w); }
protected void setDashBorder() { if (this.getBorder() instanceof LinesBorder) { LinesBorder lb = (LinesBorder) this.getBorder(); lb.setStyle(Graphics.LINE_DASH); if (vertical) lb.setSides(PositionConstants.TOP | PositionConstants.BOTTOM); else lb.setSides(PositionConstants.LEFT | PositionConstants.RIGHT); } }
private Border createBorder0() { LinesBorder result = new LinesBorder() { @Override public void paint(IFigure figure, Graphics graphics, Insets insets) { tempRect.setBounds(getPaintRectangle(figure, insets)); int one = MapModeUtil.getMapMode(figure).DPtoLP(1); int widthInDP = getWidth() / one; int halfWidthInLP = MapModeUtil.getMapMode(figure).DPtoLP(widthInDP / 2); graphics.setLineWidth(getWidth()); graphics.setLineStyle(getStyle()); // adapt tempRect so that borders do not overflow the initial bounds tempRect.x += halfWidthInLP; tempRect.width -= getWidth(); tempRect.y += halfWidthInLP; tempRect.height -= getWidth(); if ((getPositions() & PositionConstants.TOP) > 0) { // graphics.drawLine(tempRect.getTopLeft(), tempRect.getTopRight()); graphics.drawLine( new Point(tempRect.getTopLeft().x(), tempRect.getTopLeft().y() + 1), new Point(tempRect.getTopRight().x(), tempRect.getTopRight().y() + 1)); } if ((getPositions() & PositionConstants.LEFT) > 0) { // graphics.drawLine(tempRect.getTopLeft(), tempRect.getBottomLeft()); graphics.drawLine( new Point(tempRect.getTopLeft().x() + 1, tempRect.getTopLeft().y()), new Point(tempRect.getBottomLeft().x() + 1, tempRect.getBottomLeft().y())); } if ((getPositions() & PositionConstants.BOTTOM) > 0) { graphics.drawLine(tempRect.getBottomLeft(), tempRect.getBottomRight()); } if ((getPositions() & PositionConstants.RIGHT) > 0) { graphics.drawLine(tempRect.getTopRight(), tempRect.getBottomRight()); } } }; result.setSides(PositionConstants.TOP | PositionConstants.BOTTOM); return result; }