Package javax.swing.undo

Examples of javax.swing.undo.CompoundEdit


        // Sort the indices in order to preserve the depth inside of the selection
        Arrays.sort(indices);

        Object tmp;
        int indice;
        CompoundEdit ce = new CompoundEdit();
        for(i=0; i<indices.length; i++) {
            indice=indices[i]-i;
            tmp=getElementContainer().get(indice);
            getElementContainer().remove(indice);
            getElementContainer().add(tmp);
            ce.addEdit(new DepthChangedEdit(getElementContainer(), indice, getElementContainer().size()-1));
        }
       
        ce.end();
        getElementContainer().getComponent().fireUndoableEditUpdate(new UndoableEditEvent(getElementContainer(), ce));
        getElementContainer().getComponent().repaint();
    }
View Full Code Here


        // Sort the indices in order to preserve the depth inside of the selection
        Arrays.sort(indices);
       
        Object tmp;
        int indice;
        CompoundEdit ce = new CompoundEdit();
        for(i=indices.length; i>0; i--) {
            indice=indices[i-1];
            if(indice < getElementContainer().size()-1) {
                tmp=getElementContainer().get(indice);
                getElementContainer().remove(indice);
                getElementContainer().add(indice+1, tmp);
                ce.addEdit(new DepthChangedEdit(getElementContainer(), indice, indice+1));
            }
        }
       
        ce.end();
        getElementContainer().getComponent().fireUndoableEditUpdate(new UndoableEditEvent(getElementContainer(), ce));
        getElementContainer().getComponent().repaint();
    }
View Full Code Here

        // Sort the indices in order to preserve the depth inside of the selection
        Arrays.sort(indices);
       
        Object tmp;
        int indice;
        CompoundEdit ce = new CompoundEdit();
        for(i=0; i<indices.length; i++) {
            indice=indices[i];
            if(indice > 0) {
                tmp=getElementContainer().get(indice);
                getElementContainer().remove(indice);
                getElementContainer().add(indice-1, tmp);
                ce.addEdit(new DepthChangedEdit(getElementContainer(), indice, indice-1));
            }
        }
       
        ce.end();
        getElementContainer().getComponent().fireUndoableEditUpdate(new UndoableEditEvent(getElementContainer(), ce));
        getElementContainer().getComponent().repaint();
    }
View Full Code Here

        // Sort the indices in order to preserve the depth inside of the selection
        Arrays.sort(indices);

        Object tmp;
        int indice;
        CompoundEdit ce = new CompoundEdit();
        for(i=0; i<indices.length; i++) {
            indice=indices[i];
            tmp=getElementContainer().get(indice);
            getElementContainer().remove(indice);
            getElementContainer().add(i, tmp);
            ce.addEdit(new DepthChangedEdit(getElementContainer(), indice, i));
        }

        ce.end();
        getElementContainer().getComponent().fireUndoableEditUpdate(new UndoableEditEvent(getElementContainer(), ce));
        getElementContainer().getComponent().repaint();
    }
View Full Code Here

            if(s.getBounds().y < topBound) {
                topBound = s.getBounds().y;
            }
        }

        CompoundEdit ce = new CompoundEdit();
        int dy;
        for(int i=0; i<_selectedElements.size(); i++) {
            ElementSelection ss = (ElementSelection)_selectedElements.get(i);
            dy = topBound - ss.element.getBounds().y;
            ss.translateShape(0, dy);
            if(ce!=null){
                ce.addEdit(ss.translateShapeEnd());
            }  
        }
        ce.end();

        DiagramComponent dc = getElementContainer().getComponent();
        dc.fireUndoableEditUpdate(new UndoableEditEvent(dc, ce));
        dc.repaint();
    }
View Full Code Here

            if(s.getBounds().y + s.getBounds().height > bottomBound) {
                bottomBound = s.getBounds().y + s.getBounds().height;
            }
        }

        CompoundEdit ce = new CompoundEdit();
        int dy;
        for(int i=0; i<_selectedElements.size(); i++) {
            ElementSelection ss = (ElementSelection)_selectedElements.get(i);
            dy = bottomBound - ss.element.getBounds().y - ss.element.getBounds().height;

            ss.translateShape(0, dy);
            if(ce!=null){
                ce.addEdit(ss.translateShapeEnd());
           
        }
        ce.end();

        DiagramComponent dc = getElementContainer().getComponent();
        dc.fireUndoableEditUpdate(new UndoableEditEvent(dc, ce));
        dc.repaint();
    }
View Full Code Here

            if(s.getBounds().x < leftBound) {
                leftBound = s.getBounds().x;
            }
        }

        CompoundEdit ce = new CompoundEdit();
        int dx;
        for(int i=0; i<_selectedElements.size(); i++) {
            ElementSelection ss = (ElementSelection)_selectedElements.get(i);
            dx = leftBound - ss.element.getBounds().x;

            ss.translateShape(dx,0);
           
            if(ce!=null){
                ce.addEdit(ss.translateShapeEnd());
            }  
        }
        ce.end();

        DiagramComponent dc = getElementContainer().getComponent();
        dc.fireUndoableEditUpdate(new UndoableEditEvent(dc, ce));
        dc.repaint();
    }
View Full Code Here

            if(s.getBounds().x + s.getBounds().width > rightBound) {
                rightBound = s.getBounds().x + s.getBounds().width;
            }
        }

        CompoundEdit ce = new CompoundEdit();
        int dx;
        for(int i=0; i<_selectedElements.size(); i++) {
            ElementSelection ss = (ElementSelection)_selectedElements.get(i);
            dx = rightBound - ss.element.getBounds().x - ss.element.getBounds().width;

            ss.translateShape(dx,0);
            if(ce!=null){
                ce.addEdit(ss.translateShapeEnd());
            }
        }
        ce.end();

        DiagramComponent dc = getElementContainer().getComponent();
        dc.fireUndoableEditUpdate(new UndoableEditEvent(dc, ce));
        dc.repaint();
    }
View Full Code Here

            bounds = s.getBounds();
            vCenter += bounds.y + bounds.height/2;
        }
        vCenter /= _selectedElements.size();

        CompoundEdit ce = new CompoundEdit();
        int dy;

        for(int i=0; i<_selectedElements.size(); i++) {
            ElementSelection ss = (ElementSelection)_selectedElements.get(i);
            dy = vCenter - ss.element.getBounds().y - ss.element.getBounds().height/2;
           
            ss.translateShape(0,dy);
            if(ce!=null){
                ce.addEdit(ss.translateShapeEnd());
            }
        }
        ce.end();

        DiagramComponent dc = getElementContainer().getComponent();
        dc.fireUndoableEditUpdate(new UndoableEditEvent(dc, ce));
        dc.repaint();
View Full Code Here

            bounds = s.getBounds();
            hCenter += bounds.x + bounds.width/2;
        }
        hCenter /= _selectedElements.size();

        CompoundEdit ce = new CompoundEdit();
        int dx;



        for(int i=0; i<_selectedElements.size(); i++) {
            ElementSelection ss = (ElementSelection)_selectedElements.get(i);
            dx = hCenter - ss.element.getBounds().x - ss.element.getBounds().width/2;
            ss.translateShape(dx,0);
            if(ce!=null){
                ce.addEdit(ss.translateShapeEnd());
            }
        }
        ce.end();

        DiagramComponent dc = getElementContainer().getComponent();
        dc.fireUndoableEditUpdate(new UndoableEditEvent(dc, ce));
        dc.repaint();   
    }
View Full Code Here

TOP

Related Classes of javax.swing.undo.CompoundEdit

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.