}
protected synchronized JPanel drawTermLineAnnotation(int x, int y, final GraphWrapper childGW, final boolean align, AbstractTermOperator ato, final Term term) {
// get current child box...
final GraphBox childBox = this.parent.getBoxes().get(childGW);
if(childBox == null) {
this.parent.remove(this.lineAnnotations.get(childGW));
this.parent.getBoxes().remove(childGW);
this.lineAnnotations.remove(childGW);
return null;
}
// get panel for predicate to this arrow...
final JPanel annotationPanel = this.lineAnnotations.get(childGW);
if(annotationPanel == null) { // DummyOpetator...
return annotationPanel;
}
int centerX = -1;
int centerY = -1;
if(childBox.equals(this)) { // connection to itself...
centerX = this.x + (this.width / 2);
centerY = this.y + this.height + 10 + (annotationPanel.getPreferredSize().height / 2);
}
else {
// determine start point of the connection...
final Point startPoint = new Point(x,y);
// GraphBox.determineEdgePoint(this.x,
// this.y, this.width, this.height, childBox.getX(), childBox.getY(),
// childBox.width);
Dimension buttonDimension = new Dimension();
buttonDimension.setSize(30d, 24d);
final JIconButton deleteButton = new JIconButton("icons/001_02.png");
deleteButton.setPreferredSize(buttonDimension);
deleteButton.setMaximumSize(buttonDimension);
deleteButton.setMinimumSize(buttonDimension);
int distance = 0;
if (ato instanceof UnitermOperator) {
distance = 130;
// final UnitermOperator uo = (UnitermOperator) ato;
// final UnitermOperatorPanel uop = uo.getFactOperatorPanel();
// deleteButton.addActionListener(new ActionListener(){
// public void actionPerformed(ActionEvent e) {
//
// uop.removeRow(term);
// uo.getTerms().remove(term);
//
// }});
// annotationPanel.add(deleteButton);
}
if (ato instanceof FrameOperator){
distance = 50;
}
if (ato instanceof ListOperator) {
distance = 130;
// final ListOperator lo = (ListOperator) ato;
// final ListOperatorPanel lop = lo.getListOperatorPanel();
// deleteButton.addActionListener(new ActionListener(){
// public void actionPerformed(ActionEvent e) {
//
// lop.removeRow(term);
// lo.getTerms().remove(term);
//
// }});
// annotationPanel.add(deleteButton);
}
// determine end point of the connection...
final Point endPoint = new Point(x+distance,y);
// determine center of the connection...
centerX = (startPoint.x + endPoint.x) / 2;
centerY = (startPoint.y + endPoint.y) / 2;
}
// position panel for predicate so, that center of predicate panel is
// equal to center of the arrow...
int x_ = centerX - (annotationPanel.getPreferredSize().width / 2);
final int y_ = centerY - (annotationPanel.getPreferredSize().height / 2);
if(align == true && x_ < this.parent.PADDING) {
final int diff = Math.abs((int) this.parent.PADDING - x_);
childBox.updateX(childBox.getX() + diff, y_, new HashSet<GraphBox>());
this.x += diff;
x_ += diff;
}