Examples of GatedComponent


Examples of simtools.diagram.gate.GatedComponent

        g2.setStroke(new BasicStroke(0));

       
        // draw tracked component gates
        for(int i=0;i<_currentTrackedComponent.size(); i++){
            GatedComponent gc = ((GatedComponent) _currentTrackedComponent.get(i));
            List gates = gc.getGates();  
            for(int j=0; j < gates.size(); j++){
                ((Gate)gates.get(j)).drawGate(g2);
            }
        }
       
View Full Code Here

Examples of simtools.diagram.gate.GatedComponent

        _currentTrackedComponent.clear();

        if (currentElementCreator!=null && !_elementHasBeenCreated){
            // track gates and components at current mouse position
            Point p = new Point(_moveX, _moveY);
            GatedComponent gc = getGateComponentAt(p);
            if (gc != null){
                _currentTrackedComponent.add(gc);
            }
            Gate gate  =  getGateAt(p);
            if (gate != null){
                _currentTrackedGates.add(new TrackedGate(null, true, gate));
            }
           
        } else if (_elementContainer.getSelection().getShapeCount()== 1){
            //  track gates and components for selected gated components or connections
            ElementSelection ss =  _elementContainer.getSelection().getSelection(0);


            // look up for gate at selected end
            if (_translatingPoint &&  ss instanceof ConnectionPathSelection && ((ConnectionPathSelection)ss).isOneEndSelected()){

                ConnectionPathSelection cps = ((ConnectionPathSelection)ss);
                Connection connection = cps.getConnection();

                boolean isFirstEndSelected = ((ConnectionPathSelection)ss).isFirstEndSelected();

                Point p = isFirstEndSelected? connection.getPath().getNode(0) : connection.getPath().getNode(connection.getPath().getNodeNumber()-1);

                // Component
                GatedComponent gc = getGateComponentAt(p);
                if (gc != null){
                    _currentTrackedComponent.add(gc);
                }
               
                // Gate
                Gate gate  =  getGateAt(p);
                if (gate != null){
                    _currentTrackedGates.add(new TrackedGate(connection, isFirstEndSelected, gate));
                }

            }  else if (_translatingShapes){
                Shape s = ss.element;

                // For each  connection ends, look up for a gate
                if (ss instanceof ConnectionPathSelection){
                    Connection connection = ((ConnectionPathSelection)ss).getConnection();
                    Path connectionPath = connection.getPath();

                    Point firstEnd = connectionPath.getNode(0); // first end
                   
                    GatedComponent gc = getGateComponentAt(firstEnd);
                    if (gc != null){
                        _currentTrackedComponent.add(gc);
                    }
                   
                    Gate gate  =  getGateAt(firstEnd);
                    if (gate != null){
                        _currentTrackedGates.add(new TrackedGate(connection, true, gate));
                    }

                    Point lastEnd = connectionPath.getNode(connectionPath.getNodeNumber()-1); // first end
                   
                    gc = getGateComponentAt(lastEnd);
                    if (gc != null){
                        _currentTrackedComponent.add(gc);
                    }
                   
                    gate  =  getGateAt(lastEnd);
                    if (gate != null){
                        _currentTrackedGates.add(new TrackedGate(connection, false, gate));
                    }


                    // For each gates, look up for a connection ends
                } else if (s instanceof GatedComponent){   
                    GatedComponent gc = ((GatedComponent)s);
                    List gates = gc.getGates();

                    for(int i =0;i<gates.size();i++){
                        Gate gate = (Gate)gates.get(i);
                        Point gateAnchor = gate.getAnchor();
View Full Code Here

Examples of simtools.diagram.gate.GatedComponent

     * @param p
     * @return the gate found on current diagram at given position, or null if not gate found.
     */
    private Gate getGateAt(Point p){
        Gate res = null;
        GatedComponent gc = getGateComponentAt(p);
        if (gc != null){
            res = gc.getGateAt(p.x, p.y);
        }
        return res;
    }
View Full Code Here

Examples of simtools.diagram.gate.GatedComponent

        }
        return res;
    }
   
    private GatedComponent getGateComponentAt(Point p){
        GatedComponent res = null;
        Shape shape = _elementContainer.getSelection().getShapeAt(p.x, p.y);
        if (shape != null && shape instanceof GatedComponent){
            res = ((GatedComponent)shape);
        }
        return res;
View Full Code Here

Examples of simtools.diagram.gate.GatedComponent

            as.processShapeRemoving();
           
            ce.addEdit(new DeleteEdit((getElementContainer()), as));

            if (ss.element instanceof GatedComponent){
                GatedComponent gc = (GatedComponent)ss.element;

                List gates = gc.getGates();
                for(int k=0; k< gates.size(); k++){
                    Gate gate =  ((Gate)gates.get(k));
                    List connections = gate.getConnections();

                    for(int j=0; j< connections.size(); j++){
                        Connection connection = (Connection)connections.get(j);   
                        if (connection.isConnected(gate)){
                            ce.addEdit(new GateDisconnectEdit(connection, gate, connection.getFirstEndGate()!=null && connection.getFirstEndGate().equals(gate)));
                            connection.disconnect(gate);
                        }
                    }
                }
            }


            if (ss.element instanceof Connection){
                Connection gc = (Connection)ss.element;
                if (gc.getFirstEndGate() != null){
                    ce.addEdit(new GateDisconnectEdit(gc, gc.getFirstEndGate(), true));
                    gc.disconnect(gc.getFirstEndGate());
                }
                if (gc.getLastEndGate() != null){
                    ce.addEdit(new GateDisconnectEdit(gc, gc.getLastEndGate(), false));
                    gc.disconnect(gc.getLastEndGate());
                }
            }
            deleteShape(ss.element);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.