1 32 33 package it.businesslogic.ireport.undo; 34 import it.businesslogic.ireport.gui.JReportFrame; 35 import it.businesslogic.ireport.util.PageSize; 36 import java.awt.*; 37 38 46 public class PageTransformation implements it.businesslogic.ireport.UndoOperation, ITransformation 47 { 48 JReportFrame jrf; 50 51 private int oldWidth; 53 private int oldHeight; 54 private String oldReportFormat; 55 private int oldColumnWidth; 56 57 private int newWidth; 59 private int newHeight; 60 private String newReportFormat; 61 private int newColumnWidth; 62 63 public PageTransformation() 64 { 65 } 66 67 public boolean equals(Object obj) { 68 boolean isEqual = false; 69 if (obj instanceof JReportFrame) 70 { 71 if (this.jrf != null ) { 72 isEqual = this.jrf.equals( (JReportFrame) obj ); 73 } 74 } 75 return isEqual; 76 } 77 78 79 public void undo() 82 { 83 this.jrf.getReport().setWidth( oldWidth ); 84 this.jrf.getReport().setHeight( oldHeight ); 85 this.jrf.getReport().setReportFormat(oldReportFormat ); 86 this.jrf.getReport().setColumnWidth( oldColumnWidth ); 87 } 88 89 public void redo() 90 { 91 this.jrf.getReport().setWidth( newWidth ); 92 this.jrf.getReport().setHeight( newHeight ); 93 this.jrf.getReport().setReportFormat( newReportFormat ); 94 this.jrf.getReport().setColumnWidth( newColumnWidth ); 95 } 96 97 101 public void captureCurrent(Object obj) 102 { 103 this.jrf = (JReportFrame) obj; 106 oldWidth = jrf.getReport().getWidth(); 107 oldHeight = jrf.getReport().getHeight(); 108 oldReportFormat = jrf.getReport().getReportFormat(); 109 oldColumnWidth = jrf.getReport().getColumnWidth(); 110 111 } 112 113 117 public void captureModified( Object obj) 118 { 119 JReportFrame jrf = (JReportFrame) obj; 120 newWidth = jrf.getReport().getWidth(); 121 newHeight = jrf.getReport().getHeight(); 122 newReportFormat = jrf.getReport().getReportFormat(); 123 newColumnWidth = jrf.getReport().getColumnWidth(); 124 125 } 126 127 } 128 | Popular Tags |