001package com.hfg.graphics; 002 003import com.hfg.exception.ProgrammingException; 004import com.hfg.util.Orientation; 005 006//------------------------------------------------------------------------------ 007/** 008 * Page setup definition. 009 * 010 * @author J. Alex Taylor, hairyfatguy.com 011 */ 012//------------------------------------------------------------------------------ 013// com.hfg XML/HTML Coding Library 014// 015// This library is free software; you can redistribute it and/or 016// modify it under the terms of the GNU Lesser General Public 017// License as published by the Free Software Foundation; either 018// version 2.1 of the License, or (at your option) any later version. 019// 020// This library is distributed in the hope that it will be useful, 021// but WITHOUT ANY WARRANTY; without even the implied warranty of 022// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 023// Lesser General Public License for more details. 024// 025// You should have received a copy of the GNU Lesser General Public 026// License along with this library; if not, write to the Free Software 027// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 028// 029// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 030// jataylor@hairyfatguy.com 031//------------------------------------------------------------------------------ 032 033public class PageSetup implements Cloneable 034{ 035 private PaperSize mPaperSize = sDefaultPaperSize; 036 private Orientation mOrientation = sDefaultOrientation; 037 private PageMargins mMargins = new PageMargins(); 038 039 private static PaperSize sDefaultPaperSize = PaperSize.US_LETTER; 040 private static Orientation sDefaultOrientation = Orientation.VERTICAL; 041 042 //########################################################################## 043 // CONSTRUCTORS 044 //########################################################################## 045 046 //-------------------------------------------------------------------------- 047 public PageSetup() 048 { 049 } 050 051 //########################################################################## 052 // PUBLIC METHODS 053 //########################################################################## 054 055 //--------------------------------------------------------------------------- 056 @Override 057 public PageSetup clone() 058 { 059 PageSetup cloneObj; 060 try 061 { 062 cloneObj = (PageSetup) super.clone(); 063 } 064 catch (CloneNotSupportedException e) 065 { 066 throw new ProgrammingException(e); 067 } 068 069 cloneObj.mMargins = mMargins.clone(); 070 071 return cloneObj; 072 } 073 074 //--------------------------------------------------------------------------- 075 public PageSetup setPaperSize(PaperSize inValue) 076 { 077 mPaperSize = inValue; 078 return this; 079 } 080 081 //--------------------------------------------------------------------------- 082 public PaperSize getPaperSize() 083 { 084 return mPaperSize; 085 } 086 087 088 //--------------------------------------------------------------------------- 089 public PageSetup setOrientation(Orientation inValue) 090 { 091 mOrientation = inValue; 092 return this; 093 } 094 095 //--------------------------------------------------------------------------- 096 public Orientation getOrientation() 097 { 098 return mOrientation; 099 } 100 101 102 //--------------------------------------------------------------------------- 103 public PageSetup setMargins(PageMargins inValue) 104 { 105 mMargins = inValue; 106 return this; 107 } 108 109 //--------------------------------------------------------------------------- 110 public PageMargins getMargins() 111 { 112 return mMargins; 113 } 114}