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 39 import java.awt.Point ; 40 import java.awt.Rectangle ; 41 import java.util.Enumeration ; 42 import java.util.Iterator ; 43 import java.util.Vector ; 44 45 49 public class FormatCommandJoinRight extends FormatCommand { 50 int actual_x; 51 52 { 53 operationType = OperationType.JOIN_RIGHT; 54 } 55 56 public void executeDeeper() { 57 Vector used_bands = new Vector (); 59 60 for (Iterator h = this.getSelectedElements().iterator(); h.hasNext(); ) { 61 ReportElement bandRe = (ReportElement) h.next(); 62 63 if (!used_bands.contains(bandRe.getBand())) { 64 used_bands.add( bandRe.getBand()); 65 } else { 66 continue; 67 } 68 69 70 Band b = bandRe.getBand(); 72 73 Vector myElements = new Vector (); 74 Enumeration enum2 = this.getSelectedElements().elements(); 75 76 while (enum2.hasMoreElements()) { 77 ReportElement re = (ReportElement)enum2.nextElement(); 78 if (re.getBand() == b) { 79 if (myElements.size() == 0) { 81 myElements.add(re); 82 } else { 83 boolean inserted=false; 84 for (int i=0; i<myElements.size(); ++i) { 85 ReportElement re2 = (ReportElement)myElements.elementAt(i); 86 if (re.getPosition().x > re2.getPosition().x) { 87 myElements.insertElementAt(re, i); 88 inserted = true; 89 break; 90 } 91 } 92 if (!inserted){ 93 myElements.addElement(re); 94 } 95 96 } 97 } 98 } 99 100 ReportElement re = (ReportElement) myElements.elementAt(0); 102 actual_x = re.getPosition().x + re.getWidth(); 103 104 processElements( myElements.elements() ); 106 } 107 } 108 109 public void modify() { 110 111 re.setPosition( new Point (actual_x - re.getWidth(), re.getPosition().y) ); 112 actual_x -= re.getWidth(); 113 } 114 115 } 116 | Popular Tags |