Linkable descPoint = out; int r = (int)(LARGE_RECT*view.getScale()); int dx = tailLenOfR*r;  String label = null; validateFont(view); if (font!=null) { g.setFont(font); Linkable target = null;  { target = EPICSLinkOut.getStartPoint(descPoint);  if (target instanceof Descriptable) label = ((Descriptable)target).getDescription(); }  if (label!=null) {  dx = -(fontMetrics.stringWidth(label)+2*r); g.drawString(label, x1+dx, y1+dy); } }   descPoint = in; r = (int)(LARGE_RECT*view.getScale()); dx = tailLenOfR*r;  if (font!=null) { g.setFont(font); Linkable target = null;   { target = EPICSLinkOut.getEndPoint(descPoint);  if (target instanceof Descriptable) label = ((Descriptable)target).getDescription(); }  if (label!=null) {  dx = -(fontMetrics.stringWidth(label)+2*r); g.drawString(label, x2+dx, y2+dy); } }
public static void drawKneeLine(Graphics g, OutLink out, InLink in, boolean firstHorizontal) {	ViewState view = ViewState.getInstance();	double scale = view.getScale();	int x1 = (int)(scale*out.getOutX())-view.getRx();	int y1 = (int)(scale*out.getOutY())-view.getRy();	int x2 = (int)(scale*in.getInX())-view.getRx();	int y2 = (int)(scale*in.getInY())-view.getRy();	// inivsible mode	if (out.getMode() == OutLink.INVISIBLE_MODE)	{		int s = (int)(scale*Constants.INVISIBLE_CROSS_SIZE);			if (firstHorizontal) {			g.drawLine(x1-s, y1, x1+s, y1);			g.drawLine(x1, y1-s, x1, y1+s);			g.drawLine(x2, y2-s, x2, y2+s);			g.drawLine(x2-s, y2, x2+s, y2);		}		else {			g.drawLine(x1, y1-s, x1, y1+s);			g.drawLine(x1-s, y1, x1+s, y1);			g.drawLine(x2-s, y2, x2+s, y2);			g.drawLine(x2, y2-s, x2, y2+s);		}		return;	}	// only test here	else if (out.getMode() == OutLink.EXTERNAL_INPUT_MODE)	{		// horizontal				int s = (int)(scale*Constants.LINK_STUB_SIZE/2.0);				if (x2<x1) s = -s;				g.drawLine(x1, y1-s, x1, y1+s);		g.drawLine(x1, y1-s, x1+s, y1-s);		g.drawLine(x1, y1+s, x1+s, y1+s);		g.drawLine(x1+s, y1-s, x1+2*s, y1);		g.drawLine(x1+s, y1+s, x1+2*s, y1);		return;	}	else if (out.getMode() == OutLink.EXTERNAL_OUTPUT_MODE)	{		// horizontal				int s = (int)(scale*Constants.LINK_STUB_SIZE/2.0);				if (x2<x1) s = -s;				g.drawLine(x1, y1-s, x1, y1+s);		g.drawLine(x1, y1-s, x1+2*s, y1-s);		g.drawLine(x1, y1+s, x1+2*s, y1+s);		g.drawLine(x1+2*s, y1-s, x1+s, y1);		g.drawLine(x1+2*s, y1+s, x1+s, y1);		return;	}/*	else if (out.getMode() == ?)	{		// horizontal				int s = (int)(scale*Constants.LINK_STUB_SIZE/2.0);				if (x2<x1) s = -s;				g.drawLine(x1, y1-s, x1, y1+s);		g.drawLine(x1, y1-s, x1+2*s, y1-s);		g.drawLine(x1, y1+s, x1+2*s, y1+s);		g.drawLine(x1+s, y1-s, x1+s, y1);		g.drawLine(x1+s, y1+s, x1+s, y1);		return;	}*/		if (firstHorizontal) {		g.drawLine(x1, y1, x2, y1);		g.drawLine(x2, y1, x2, y2);	}	else {		g.drawLine(x1, y1, x1, y2);		g.drawLine(x1, y2, x2, y2);	}}