Package simtools.diagram

Examples of simtools.diagram.Element


     */
    protected boolean addAllShapes(){ 
        int selectionOldCount = getShapeCount();

        for(int i = size()-1; i>=0; i--){
            Element s = (Element)elementAt(i);
            add(createShapeSelection(s));
        }
        return selectionOldCount != getShapeCount();
    }
View Full Code Here


    protected boolean addShapeAt(int ox, int oy){
        int selectionOldCount = getShapeCount();

        boolean hasBeenAdd = false;
        for(int i=size()-1; i>=0 && !hasBeenAdd; i--){
            Element s=(Element)elementAt(i);

            if(s.contains(ox,oy)){
                add(createShapeSelection(s));
                hasBeenAdd = true;
            }
        }
        return selectionOldCount != getShapeCount();
View Full Code Here

   
    /* (non-Javadoc)
     * @see simtools.diagram.DiagramSelection#cloneElement(simtools.diagram.Element)
     */
    public Element cloneElement(Element e){
        Element res;
        if (e instanceof AbstractShape){
            res = ((AbstractShape)e).cloneShape();
        } else {
            res = super.cloneElement(e);
        }
View Full Code Here

        /* (non-Javadoc)
         * @see simtools.diagram.DiagramSelection#cloneElement(simtools.diagram.Element)
         */
        public Element cloneElement(Element e){
            Element res;
            if(e instanceof TestGatedRectangle){
                res = ((TestGatedRectangle)e).cloneTestGatedRectangle();

            } else  if(e instanceof TestConnection){
                res = ((TestConnection)e).cloneTestConnection();
View Full Code Here


        // Implementation of the abstract methods
        protected void translate(int x, int y) {
            for (int i = 0; i < TestShapesContainer.this.size(); i++) {
                Element s = (Element) TestShapesContainer.this.get(i);
                s.translate(x, y);
            }
        }
View Full Code Here

        /* (non-Javadoc)
         * @see simtools.diagram.DiagramComponent#getMin(java.awt.Point)
         */
        protected void getMin(Point p) {
            for(int i=0;i< TestShapesContainer.this.size();i++){
                Element s = (Element)TestShapesContainer.this.get(i);
               
                Rectangle rect = s.getBounds();
                if (rect.x < p.x){
                    p.x = rect.x;
                }
               
                if (rect.y < p.y){
View Full Code Here

                if (o instanceof Connection){
                    selectedConnectors.add(o);

                } else {
                    Element as= null;
                    if (o instanceof TestGatedRectangle){
                        as = ((TestGatedRectangle)o).cloneTestGatedRectangle();
                   
                    } else if (o instanceof TestConnection){
                        as = ((TestConnection)o).cloneTestConnection();
                    }

                    if (o instanceof GatedComponent){
                        selectedGatedComponent.add(o);

                        // Kept the relation between the existing and the new gate
                        List oldGates = new ArrayList(((GatedComponent)o).getGates());
                        List newGates = new ArrayList(((GatedComponent)as).getGates());

                        for(int j=0;j<oldGates.size(); j++){
                            clonedGates.put(oldGates.get(j), newGates.get(j));
                        }
                    }

                    as.translate(x,y);
                    TestShapesContainer.this.add(as);
                }
            }

            // Now Copy the connectors
View Full Code Here

        protected void drawDiagramElements(Graphics2D g2, Point pMax) {

            // loop on objects to be displayed
            //--------------------------------
            for (int i = 0; i < TestShapesContainer.this.size(); i++) {
                Element r = (Element) TestShapesContainer.this.get(i);
                boolean bsel = _selection.isSelected(r);
                if (bsel) {
                    g2.setColor(Color.red);
                } else {
                    g2.setColor(Color.blue);
                }

                ElementSelection dss=_selection.getSelectedShape(r);
                if(dss!=null){
                    dss.drawBounds(g2);
                }    
               
                g2.draw(r);

                // UPdate the bottom right point
                Rectangle rect = r.getBounds();
                if (rect.x + rect.width > pMax.x){
                    pMax.x = rect.x;
                }

                if (rect.y + rect.height > pMax.y){
View Full Code Here

            for(int i=0;i<dc.size();i++){
                // connectors are not connected to connections
                // can't call getConnections() on
                // connections are connected to connectors
                // and have been copied to clipboard
                Element r= (Element)dc.get(i);


                g2.draw(r);

                // UPdate the bottom right point
                Rectangle rect = r.getBounds();
                if (rect.x + rect.width > pMax.x){
                    pMax.x = rect.x;
                }

                if (rect.y + rect.height > pMax.y){
View Full Code Here

  //
  //   ActionListener interface
  //
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == jmicreate) {
        Element element = shapeCreator.create();
       
        if (element instanceof AbstractShape){
            ((AbstractShape)element).setAnchor(0,0);
        }
      element.translate((int)actionX, (int)actionY);
      invoker.addElement(element);
      invoker.getComponent().repaint();
    }
    super.actionPerformed(e);
  }
View Full Code Here

TOP

Related Classes of simtools.diagram.Element

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.