Package simtools.diagram

Examples of simtools.diagram.DiagramSelection


  protected void doAction(ActionEvent e) {
    final ShapesContainer.ShapesComponent sc=JSynoptic.gui.getActiveComponent();
    if(sc==null){
      return;
    }
    DiagramSelection sel=sc.getDiagramSelection();
    final Vector v=sel.getSelectedElements();
    // look for properties initial values
    final NamedProperties initalValues=containsValidProperties(v);
    if(initalValues==null){
      return;
    }
View Full Code Here


      as=null;
      data=null;
    }
   
    boolean isValidDataSourceDrag(Point p){
      DiagramSelection ds=comp.getDiagramSelection();
      Shape s=null;
      int x=(int)((double)p.x/comp.getParameters().scale)-
      comp.getParameters().xmargin;
      int y=(int)((double)p.y/comp.getParameters().scale)-
      comp.getParameters().ymargin;
      if(ds.isEmpty()){
        s=comp.getShapeAt(x,y);
      }
      else{
        s=ds.getSelectedShapeAt(x,y);
      }
      if((s!=null) && (s instanceof DataSourceConsumer)){
        if(((DataSourceConsumer)s).canAddDataSource(data)){
          return true;
        }
View Full Code Here

          int dot = dsInfo.lastIndexOf(".");
          if (dot!=-1)
            dsInfo = dsInfo.substring(dot+1);
        }
        Point p=dtde.getLocation();
        DiagramSelection ds=comp.getDiagramSelection();
        int x=(int)((double)p.x/comp.getParameters().scale)-
            comp.getParameters().xmargin;
        int y=(int)((double)p.y/comp.getParameters().scale)-
            comp.getParameters().ymargin;
        if((ds.isEmpty() && ds.selectPoint(x,y))
            || ds.isSelected(x,y)){
          Vector vd=ds.getSelectedElements();
          boolean oneOk=false;
          for(int i=0;i<vd.size();i++){
            Object fvd=vd.get(i);
            if(fvd instanceof DataSourceConsumer){
              if(((DataSourceConsumer)fvd).addDataSource(data)){
View Full Code Here

     */
    void setSelectionEditEnabled(boolean state) {
        if (state) {
            DiagramComponent d = getActiveDiagram();
            if (d != null) {
                DiagramSelection sel = d.getDiagramSelection();
                for (int i = 0; i < lockedShapes.size(); ++i) {
                    if (sel.isSelected((Shape) lockedShapes.get(i))) {
                        state = false;
                        break;
                    }
                }
            }
View Full Code Here

            setDiagramComponentSpecificsEnabled(false);
            updateUndoActions();
    
        } else {
            DiagramComponent dc = (DiagramComponent) d;
            DiagramSelection sel = dc.getDiagramSelection();
            sel.addListener(this);
            selectionChanged(sel);
            setDiagramComponentSpecificsEnabled(true);
            setShapeToolEnabled(true);
           
            // update grid combo box
View Full Code Here

            lockPrint();
        }
        if ((actionMask & LongAction.LONG_ACTION_SHAPE) != 0) {
            boolean changesDone = false;
            DiagramComponent d = getActiveDiagram();
            DiagramSelection sel = (d == null) ? null : d.getDiagramSelection();
            if (target != null) {
                if (target instanceof Shape) {
                    lockedShapes.add(target);
                    if ((sel != null) && sel.isSelected((Shape) target)) {
                        changesDone = true;
                    }
                } else if (target instanceof Vector) {
                    for (Iterator it = ((Vector) target).iterator(); it.hasNext();) {
                        Object o = it.next();
                        if (o instanceof Shape) {
                            lockedShapes.add(o);
                            if ((sel != null) && sel.isSelected((Shape) o)) {
                                changesDone = true;
                            }
                        }
                    }
                } else if (target instanceof Object[]) {
                    for (int i = 0; i < ((Object[]) target).length; ++i) {
                        Object o = ((Object[]) target)[i];
                        if (o instanceof Shape) {
                            lockedShapes.add(o);
                            if ((sel != null) && sel.isSelected((Shape) o)) {
                                changesDone = true;
                            }
                        }
                    }
                }
View Full Code Here

            unlockPrint();
        }
        if ((actionMask & LongAction.LONG_ACTION_SHAPE) != 0) {
            boolean changesDone = false;
            DiagramComponent d = getActiveDiagram();
            DiagramSelection sel = (d == null) ? null : d.getDiagramSelection();
            if (target != null) {
                if (target instanceof Shape) {
                    lockedShapes.remove(target);
                    if ((sel != null) && sel.isSelected((Shape) target)) {
                        changesDone = true;
                    }
                } else if (target instanceof Vector) {
                    for (Iterator it = ((Vector) target).iterator(); it.hasNext();) {
                        Object o = it.next();
                        if (o instanceof Shape) {
                            lockedShapes.remove(o);
                            if ((sel != null) && sel.isSelected((Shape) o)) {
                                changesDone = true;
                            }
                        }
                    }
                } else if (target instanceof Object[]) {
                    for (int i = 0; i < ((Object[]) target).length; ++i) {
                        Object o = ((Object[]) target)[i];
                        if (o instanceof Shape) {
                            lockedShapes.remove(o);
                            if ((sel != null) && sel.isSelected((Shape) o)) {
                                changesDone = true;
                            }
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of simtools.diagram.DiagramSelection

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.