1 32 33 package it.businesslogic.ireport.gui.command; 34 35 import it.businesslogic.ireport.OperationType; 36 import it.businesslogic.ireport.crosstab.CrosstabCell; 37 import java.awt.Point ; 38 39 40 43 public class FormatCommandCenterInBand extends FormatCommand{ 44 45 { 46 operationType = OperationType.CENTER_IN_BAND; 47 } 48 49 int centerx; 50 int centery; 51 52 53 void preparation() { 54 int insideWidth = jrf.getReport().getWidth() - jrf.getReport().getRightMargin() - jrf.getReport().getLeftMargin() ; 56 centerx = jrf.getReport().getLeftMargin() + 10+ insideWidth/2; 57 } 58 59 void modify() { 60 61 if (re.getBand() == null) { 63 CrosstabCell cell = re.getCell(); 64 if (cell == null) return; 65 centerx = cell.getLeft() + 10 + (cell.getWidth()/2); 66 centery = cell.getTop() + 10 + (cell.getHeight()/2); 67 68 re.setPosition(new Point (centerx-(re.getWidth()/2), centery-(re.getHeight()/2))); 69 re.updateRelativePosition(); 70 } 71 else 72 { 73 int centery = jrf.getReport().getBandYLocation(re.getBand()) + 10 + re.getBand().getHeight()/2 ; 74 re.setPosition(new Point (centerx-(re.getWidth()/2), centery-(re.getHeight()/2))); 75 } 76 } 77 78 } 79 | Popular Tags |