1 32 33 package it.businesslogic.ireport.gui.command; 34 35 import it.businesslogic.ireport.OperationType; 36 import it.businesslogic.ireport.ReportElement; 37 import java.awt.Point ; 38 import java.util.Enumeration ; 39 40 46 public class FormatCommandMoveToRightMargin extends FormatCommand { 47 { 48 operationType = OperationType.MOVE_TO_RIGHT_MARGIN; 49 } 50 51 int deltaRight; 52 53 public void preparation() { 54 ReportElement re = null; 56 ReportElement rightMostRe = (ReportElement) this.getSelectedElements().firstElement(); 57 58 Enumeration enum2 = this.getSelectedElements().elements(); 59 while (enum2.hasMoreElements()) { 60 re = (ReportElement) enum2.nextElement(); 61 if ( (re.getPosition().x + re.getWidth()) > (rightMostRe.getPosition().x + rightMostRe.getWidth()) ) { 62 rightMostRe = re; 63 } 64 } 65 66 deltaRight = jrf.getReport().getRightMargin() - rightMostRe.getPosition().x; 67 68 } 69 70 public void modify() { 71 re.setPosition(new Point (re.getPosition().x + 10 + deltaRight, re.getPosition().y)); 72 } 73 74 } 75 | Popular Tags |