1 32 33 package it.businesslogic.ireport.gui.command; 34 35 import it.businesslogic.ireport.Band; 36 import it.businesslogic.ireport.OperationType; 37 import it.businesslogic.ireport.ReportElement; 38 import java.awt.Point ; 39 import java.util.Enumeration ; 40 import java.util.Iterator ; 41 import java.util.Vector ; 42 43 44 48 public class FormatCommandRemoveSpaceV extends FormatCommand { 49 int actual_y; 50 int available_height; 51 Band activeBand ; 52 ReportElement bottomElement; 53 Vector myElements = null; 54 Vector bands = null; 55 56 { 57 operationType = OperationType.EQUALS_SPACE_V; 58 } 59 60 boolean preCondition(){ 61 activeBand = (Band) ((ReportElement) this.getSelectedElements().firstElement()).getBand(); 62 int counter = 0; 63 64 for (Iterator i = this.getSelectedElements().iterator(); i.hasNext(); ) { 65 ReportElement re = (ReportElement) i.next(); 66 if (re.getBand() == activeBand) { 67 counter++; 68 } 69 } 70 return ( counter > 1 ); 71 72 } 73 74 void preparation(){ 75 available_height = 0; 76 } 77 void executeDeeper(){ 78 preparation(); 80 81 bands = getBands(); 82 83 for (Iterator h = bands.iterator(); h.hasNext(); ) { 84 Band b = (Band) h.next(); 85 Vector bandElements = getBandElements(b); 86 bandElements = sortYX( bandElements.elements()); 87 88 if (bandElements.size()>1) { 89 ReportElement re = (ReportElement) bandElements.firstElement(); 90 actual_y = re.getPosition().y + re.getHeight() + available_height; 91 92 bandElements.removeElement(re); 94 95 processElements(bandElements.elements()); 96 } 97 } 98 } 99 100 public void modify() { 101 re.setPosition(new Point (re.getPosition().x, actual_y) ); 102 actual_y += re.getHeight() + available_height; 103 } 104 105 } 106 | Popular Tags |