/**
 * FormatCommandAlignTop.java
 *
 * Created on 9 mei 2005, 21:36
 */
package it.businesslogic.ireport.gui.command;

import it.businesslogic.ireport.OperationType;
import it.businesslogic.ireport.ReportElement;

import java.awt.Point;


public class FormatCommandAlignBottom
        extends FormatCommand {
    FormatCommandAlignBottom() {
        operationType = OperationType.ALIGN_TOP;
    }
    
    int bottom;
    
    // Preparation is called before the while loop
    
    
    /**
     * DOCUMENT ME!
     */
    void preparation() {
        bottom = ((ReportElement)this.getSelectedElements().firstElement()).getPosition().y +
                ((ReportElement)this.getSelectedElements().firstElement()).height;
        
    }
    
    /**
     * DOCUMENT ME!
     */
    void modify() {
        re.setPosition(new Point(re.getPosition().x, bottom - re.height));
    }
    
    /**
     * DOCUMENT ME!
     *
     * @param bottom DOCUMENT ME!
     */
    void setBottom(int bottom) {
        this.bottom = bottom;
    }
    
    /**
     * DOCUMENT ME!
     *
     * @return DOCUMENT ME!
     */
    int getBottom() {
        
        return bottom;
    }
}
