Package research

Examples of research.DrawingEditor


    public void actionPerformed(ActionEvent e) {
        if (!isEnabled()) return;

        caculateAffectedArea();
        DrawingEditor drawingEditor = (DrawingEditor)getValue(ConstantDefinition.DRAWING_EDITOR);
        Vector selection = drawingEditor.getCurrentView().getSelection();

        Iterator iterator = selection.iterator();

        Rectangle r = new Rectangle();
        int limit = rect.y + rect.height / 2;
        while (iterator.hasNext()) {
            Figure figure = (Figure) iterator.next();
            if (!(figure instanceof ConnectionFigure)) {
                figure.moveBy(0, limit - figure.center().y);
            }
        }

        drawingEditor.getCurrentView().repairDamage();
    }
View Full Code Here


    public void actionPerformed(ActionEvent e) {
        if (!isEnabled()) return;

        caculateAffectedArea();

        DrawingEditor drawingEditor = (DrawingEditor)getValue(ConstantDefinition.DRAWING_EDITOR);

        Vector selection = drawingEditor.getCurrentView().getSelection();

        Iterator iterator = selection.iterator();

        Rectangle r = new Rectangle();
        int limit = rect.y + rect.height;
        while (iterator.hasNext()) {
            Figure figure = (Figure) iterator.next();
            if (!(figure instanceof ConnectionFigure)) {
                figure.moveBy(0, limit - (figure.getDisplayBox(r).y + r.height));
            }
        }

        drawingEditor.getCurrentView().repairDamage();
    }
View Full Code Here

    public void actionPerformed(ActionEvent e) {
        if (!isEnabled()) return;

        caculateAffectedArea();

        DrawingEditor drawingEditor = (DrawingEditor)getValue(ConstantDefinition.DRAWING_EDITOR);
        Iterator iterator = drawingEditor.getCurrentView().getSelection().iterator();
        int figureCount = 0;

        arrayList.clear();

        while (iterator.hasNext()) {
            Figure figure = (Figure) iterator.next();
            if (!(figure instanceof ConnectionFigure)) {
                figureCount++;

                Point center = figure.center();
                if (arrayList.isEmpty()) {
                    arrayList.add(figure);
                } else {
                    int i;
                    for (i = 0; i < arrayList.size(); i++) {
                        Figure fig = (Figure) arrayList.get(i);
                        if (center.x < fig.center().x) {
                            arrayList.add(i, figure);
                            break;
                        }
                    }

                    if (i == arrayList.size())
                        arrayList.add(figure);
                }

            }
        }

        int filled = 0;
        for (int i = 0; i < arrayList.size(); i++) {
            Figure fig = (Figure) arrayList.get(i);

            if ((i == 0) || (i == arrayList.size() - 1)) {
                filled += fig.getDisplayBox().width / 2;
            } else {
                filled += fig.getDisplayBox().width;
            }

        }

        double unit = (rect.width * 1.0 - filled) / (figureCount - 1);

        Rectangle r = ((Figure) arrayList.get(0)).getDisplayBox();
        int base = r.x + r.width;
        for (int i = 1; i < arrayList.size() - 1; i++) {
            Figure fig = (Figure) arrayList.get(i);
            fig.moveBy((int) (base + unit * i - fig.getDisplayBox(r).x), 0);
            base += r.width;
        }

        drawingEditor.getCurrentView().repairDamage();
    }
View Full Code Here

    protected transient Rectangle rect = null;

    public boolean isEnabled() {
        if (!super.isEnabled()) return false;

        DrawingEditor drawingEditor = (DrawingEditor)getValue(ConstantDefinition.DRAWING_EDITOR);

        if(drawingEditor == null) return false;

        DrawingView currentView = drawingEditor.getCurrentView();
        if (currentView == null) return false;

        Vector selection = currentView.getSelection();

        if (selection == null) return false;
View Full Code Here

        return true;
    }

    protected void caculateAffectedArea() {

        DrawingEditor drawingEditor = (DrawingEditor)getValue(ConstantDefinition.DRAWING_EDITOR);

        Vector selection = drawingEditor.getCurrentView().getSelection();

        Iterator iterator = selection.iterator();

        rect = null;
View Full Code Here

                drawing.setTitle(viewName);
            }

            view.setDrawing(drawing);

            DrawingEditor drawingEditor = (DrawingEditor) getValue(ConstantDefinition.DRAWING_EDITOR);
            drawingEditor.add(view);

            this.putValue(ConstantDefinition.VIEW_NAME, null);
            this.putValue(ConstantDefinition.DRAWING, null);

            isDoing = false;
View Full Code Here

    public void actionPerformed(ActionEvent e) {
        if (!isEnabled()) return;

        caculateAffectedArea();

        DrawingEditor drawingEditor = (DrawingEditor)getValue(ConstantDefinition.DRAWING_EDITOR);
        Vector selection = drawingEditor.getCurrentView().getSelection();

        Iterator iterator = selection.iterator();

        Rectangle r = new Rectangle();
        int limit = rect.x + rect.width / 2;
        while (iterator.hasNext()) {
            Figure figure = (Figure) iterator.next();
            if (!(figure instanceof ConnectionFigure)) {
                figure.moveBy(limit - figure.center().x, 0);
            }
        }

        drawingEditor.getCurrentView().repairDamage();
    }
View Full Code Here

    public void actionPerformed(ActionEvent e) {
        if (!isEnabled()) return;

        caculateAffectedArea();

        DrawingEditor drawingEditor = (DrawingEditor)getValue(ConstantDefinition.DRAWING_EDITOR);
        Vector selection = drawingEditor.getCurrentView().getSelection();

        Iterator iterator = selection.iterator();

        Rectangle r = new Rectangle();
        int limit = rect.y;
        while (iterator.hasNext()) {
            Figure figure = (Figure) iterator.next();
            if (!(figure instanceof ConnectionFigure)) {
                figure.moveBy(0, limit - figure.getDisplayBox(r).y);
            }
        }

        drawingEditor.getCurrentView().repairDamage();
    }
View Full Code Here

    protected transient Rectangle rect = null;

    public boolean isEnabled() {
        if (!super.isEnabled()) return false;

        DrawingEditor drawingEditor = (DrawingEditor)getValue(ConstantDefinition.DRAWING_EDITOR);
        if(drawingEditor == null) return false;

        DrawingView currentView = drawingEditor.getCurrentView();
        if (currentView == null) return false;

        Vector selection = currentView.getSelection();

        if (selection == null) return false;
View Full Code Here

        return true;
    }

    protected void caculateAffectedArea() {

        DrawingEditor drawingEditor = (DrawingEditor)getValue(ConstantDefinition.DRAWING_EDITOR);

        Vector selection = drawingEditor.getCurrentView().getSelection();

        Iterator iterator = selection.iterator();

        rect = null;
View Full Code Here

TOP

Related Classes of research.DrawingEditor

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.