Package com.mockturtlesolutions.snifflib.graphics

Examples of com.mockturtlesolutions.snifflib.graphics.AbstractIconEntity


                    in.close();
                    Vector newChildren = WB.getChildren();
                    wbpanel.removeAll(); //Removes all current children.
                    wbpanel.setRepository(null); //Go into persistence mode.
                    //Copy over all children.
                    AbstractIconEntity recalledobj = null;
                    for (int i=0;i<newChildren.size();i++)
                    {
                      recalledobj = (AbstractIconEntity)newChildren.get(i);
                     
                      MouseMotionListener[] l = recalledobj.getMouseMotionListeners();
                      for (int k=0;k<l.length;k++)
                      {
                        recalledobj.removeMouseMotionListener(l[k]);
                      }
                      //System.out.println("wbpanel.getRepository()"+wbpanel.getRepository());
                      System.out.println("Importing into workbench "+recalledobj.getClass());
                     
                      //Won't be working until we can get the buffer to show properly...
                      ((GraphicalBufferSolution)recalledobj).getBufferSolution().show();
                      wbpanel.importNew(recalledobj);
                    }
View Full Code Here


  */
  public Vector getSelected()
  {
    Vector selected = new Vector();
   
    AbstractIconEntity child = null;
   
    for (int i=0;i<this.children.size();i++)
    {
      child = (AbstractIconEntity)this.children.get(i);
      if (child.isSelected())
      {
        selected.add(child);
      }
    }
   
View Full Code Here

  */
  public Vector getSelected(Class cs)
  {
    Vector selected = new Vector();
   
    AbstractIconEntity child = null;
   
    for (int i=0;i<this.children.size();i++)
    {
      child = (AbstractIconEntity)this.children.get(i);
      if (child.isSelected())
      {
        if (child.getClass().isAssignableFrom(cs))
        {
          selected.add(child);
        }
      }
    }
View Full Code Here

  }
 
  public void deleteSelected()
  {
    Vector selected = this.getSelected();
    AbstractIconEntity child = null;
    for (int i=0;i<selected.size();i++)
    {
      child = (AbstractIconEntity)selected.get(i);
      this.children.remove(child);
      this.remove(child);
View Full Code Here

        double clickX = e.getX();
        double clickY = e.getY();
        double xc,yc;
       
        //GraphicalBufferSolution child;
        AbstractIconEntity child;
        for (int i=0;i<children.size();i++)
        {
          child = (AbstractIconEntity)children.get(i);
          if (!e.isControlDown())
          {
            if (child.isSelected())
            {
              child.setSelected(false);
              child.setBorder(null)

            }
          }
        } 
       
        child=(AbstractIconEntity)e.getComponent();
        child.setSelected(true);
        child.setBorder(BorderFactory.createEtchedBorder())
        xc = child.getX();
        yc = child.getY();
        child.setOffsetX(clickX);
        child.setOffsetY(clickY);
       
       
        //System.out.println(clickX+":"+xc);
        //System.out.println(clickY+":"+yc);
       
       
        // GraphicalBufferSolution child=null;
//
//         //Deselect all children.
//         for (int i=0;i<children.size();i++)
//         {
//           child = (GraphicalBufferSolution)children.get(i);
//           child.setSelected(false);
//         }
//         //Now see if any one should be selected.
//         for (int i=0;i<children.size();i++)
//         {
//           child = (GraphicalBufferSolution)children.get(i);
//           if (child.isInside(clickX,clickY))
//           {
//             System.out.println("Is inside");
//             child.setSelected(true);
//             xc = child.getX();
//             yc = child.getY();
//
//             child.setOffsetX(clickX-xc);
//             child.setOffsetY(clickY-yc);
//             break;
//           }
//           else
//           {
//             System.out.println("Not inside");
//           }
//
//         }
      }
     
      if (e.getButton() == MouseEvent.BUTTON3)
      {
        //System.out.println("Button 3 pressed");
        double xc,yc;
       
        double clickX = e.getX();
        double clickY = e.getY();
       
        AbstractIconEntity child=null;
        child = (AbstractIconEntity)e.getComponent();
        if (child == null)
        {
          System.out.println("Child is null");
        }
       
        //System.out.println("Got to here 1"+child.getX()+":"+e.getX()+child.getY()+":"+e.getY());
        child.viewTaskList(child.getX()+e.getX(),child.getY()+e.getY());
        //System.out.println("Got to here");
      }
     
    }
View Full Code Here

  {
 
    public void mouseDragged(MouseEvent e)
    {
      //System.out.println("x = " + e.getX() + ", y = " + e.getY()+ "\n");
      AbstractIconEntity c = (AbstractIconEntity)e.getComponent();
      //int currentX = e.getX();
            //int currentY = e.getY();
     
     
      //int currentX = c.getX()+e.getX()-(int)c.getOffsetX();
      //int currentY = c.getY()+e.getY()-(int)c.getOffsetY();
      int currentX = c.getX() + (e.getX()-(int)c.getOffsetX());
      int currentY = c.getY() + (e.getY()-(int)c.getOffsetY());
     
      if (currentX < 0)
      {
        currentX = 0;
      }
     
      if (currentY < 0)
      {
        currentY = 0;
      }
     
      if (currentX > getWidth()-c.getWidth())
      {
        currentX = getWidth()-c.getWidth();
      }
     
      if (currentY > getHeight()-c.getHeight())
      {
        currentY = getHeight()-c.getHeight();
      }
     
      //int X = c.getX()+currentX-(int)c.getOffsetX();
      //int Y = c.getY()+currentY-(int)c.getOffsetY();
     
     
     
      //int X = (int)(e.getX()-c.getOffsetX());
      //int Y = (int)(e.getY()-c.getOffsetY());
     
      //int X = (int)(e.getX());
      //int Y = (int)(e.getY());
     
      c.setLocation(currentX,currentY);
     
    }
View Full Code Here

TOP

Related Classes of com.mockturtlesolutions.snifflib.graphics.AbstractIconEntity

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.