Package research.align

Source Code of research.align.BotAlignAction

package research.align;

import research.Figure;
import research.ConnectionFigure;
import research.DrawingEditor;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.*;
import java.util.Vector;
import java.util.Iterator;

/**
* Created by IntelliJ IDEA.
* User: saturn
* Date: 2003-10-15
* Time: 19:00:00
* To change this template use Options | File Templates.
*/
class BotAlignAction extends AlignAction {

    public BotAlignAction() {
        this.putValue(Action.NAME, "�׶˶���");
    }

    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();
    }
}
TOP

Related Classes of research.align.BotAlignAction

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.