Package lupos.gui.operatorgraph

Examples of lupos.gui.operatorgraph.GraphBox


  @Override
  public synchronized void arrange(final Arrange arrange) {
    final GraphWrapper prefixGW = new GraphWrapperPrefix(this.prefix);

    if(this.boxes.containsKey(prefixGW)) {
      final GraphBox oldBox = this.boxes.remove(prefixGW);
      this.remove(oldBox.getElement());
    }

    super.arrange(arrange);

    if(this.prefix == null || !this.prefix.isActive() || (this.rootList.size() == 1 && this.rootList.get(0) instanceof GraphWrapperPrefixNonEditable)) {
      return;
    }

    final GraphBox prefixBox = this.graphBoxCreator.createGraphBox(this, prefixGW);
    prefixBox.setX(2* (int) Math.ceil(this.PADDING));
    prefixBox.setY(this.getMaxY() + (int) Math.ceil(this.SPACING_Y));
    prefixBox.arrange(arrange);

    this.boxes.put(prefixGW, prefixBox);

    this.updateSize();
  }
View Full Code Here


    }

    this.queryGraph.removeFromRootList(this.secondOp);

    // get the GraphBox of the GraphWrapper of the first operator...
    GraphBox firstBox = this.queryGraph.getBoxes().get(this.firstOp);

    // draw all annotations of the first Operator...
    firstBox.setLineAnnotations(this.firstOp.drawAnnotations(this.queryGraph));

    this.queryGraph.revalidate();
    this.visualEditor.repaint();
  }
View Full Code Here

      this.handleAddOperator(newOp);

      final GraphWrapper gw = this.createGraphWrapper(newOp);

      // create the GraphBox at the right position...
      final GraphBox box = this.graphBoxCreator.createGraphBox(this, gw);
      box.setY(y);
      box.updateX(x, y, new HashSet<GraphBox>());
      box.arrange(Arrange.values()[0]);
      box.getElement().revalidate();

      this.boxes.put(gw, box);
      this.rootList.add(gw);
//      this.createOperator(newOp);
View Full Code Here

    if(newClassSuperName.startsWith("RetrieveData")) {
      this.rootList.add(gw);
    }

    // create the GraphBox at the right position...
    final GraphBox box = this.graphBoxCreator.createGraphBox(this, gw);
    box.setX(x);
    box.setY(y);
    box.arrange(Arrange.values()[0]);
    box.getElement().revalidate();

    this.boxes.put(gw, box);
    this.rootList.add(gw);

    this.revalidate();
View Full Code Here

      // add dummy operator to be able to draw the arrow to the current
      // mouse position...
      this.dummyOperator = this.queryGraph.createDummyOperator();
      this.dummyGW = this.queryGraph.createGraphWrapper(this.dummyOperator);
      final GraphBox dummyBox = this.visualEditor.getVisualGraphs().get(0).graphBoxCreator.createGraphBox(this.queryGraph,this.dummyGW);

      this.queryGraph.getBoxes().put(this.dummyGW, dummyBox);

      this.firstOp.addSucceedingElement(new GraphWrapperIDTuple(this.dummyGW, 0));
View Full Code Here

    }

    this.queryGraph.removeFromRootList(this.secondOp);

    // get the GraphBox of the GraphWrapper of the first operator...
    final GraphBox firstBox = this.queryGraph.getBoxes().get(this.firstOp);

    // draw all annotations of the first Operator...
    firstBox.setLineAnnotations(this.firstOp.drawAnnotations(this.queryGraph));

    this.firstOp.getGUIComponent().repaint();

    this.queryGraph.revalidate();
    this.queryGraph.repaint();
View Full Code Here

   
      term.setSucceedingOperator(this.secondOp);
      if (this.secondOp.getElement() instanceof AbstractTermOperator)
      term.setAbstractTermOperator( (AbstractTermOperator) this.secondOp.getElement());
      // get the GraphBox of the GraphWrapper of the first operator...
      final GraphBox firstBox = this.queryGraph.getBoxes().get(this.firstOp);
      // draw all annotations of the first Operator...
      firstBox.setLineAnnotations(this.firstOp.drawAnnotations(this.queryGraph));

      this.firstOp.getGUIComponent().repaint();

      this.queryGraph.revalidate();
      this.queryGraph.repaint();
View Full Code Here

  }
 
 
 
  private void drawTermOperator(final Graphics2D g, final Term term, final GraphWrapper childGW, AbstractTermOperator ato){
    final GraphBox childBox = this.parent.getBoxes().get(childGW);



    final Point startPoint = new Point((this.x + term.getConnectionButton().getX() + term.getConnectionButton().getWidth()),
        (this.y + term.getConnectionButton().getY() + (term.getConnectionButton().getHeight()/2)));;

        final Point endPoint = GraphBox.determineEdgePoint(childBox.getX(),
            childBox.getY(), childBox.width, childBox.height, this.x,
            this.y, this.width);

        g.setColor(GraphBox.lineColors[0]);

        drawTermConnection(g, startPoint.x, startPoint.y, endPoint.x, endPoint.y, true,ato);
View Full Code Here

  }
 

  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;
    }
View Full Code Here

        opIDt.setId(1);
      else if(opIDt.getId() == 1)
        opIDt.setId(0);
    }

    final GraphBox box = parent.getBoxes().get(new GraphWrapperOperator(this));
    box.setLineAnnotations(this.drawAnnotations(parent));

    parent.arrange(Arrange.values()[0]);
  }
View Full Code Here

TOP

Related Classes of lupos.gui.operatorgraph.GraphBox

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.