View Javadoc
1   /******************************************************************************
2    * Contact.java - Define the pics that made up one contact sheet
3    * 
4    * PicMan - The BuckoSoft Picture Manager in Java
5    * Copyright(c) 2005 - Dick Balaska
6    * 
7    */
8   package com.buckosoft.PicMan.domain;
9   
10  import java.util.ArrayList;
11  import java.util.Date;
12  
13  import org.apache.commons.logging.Log;
14  import org.apache.commons.logging.LogFactory;
15  
16  /** Define the pics that made up one contact sheet
17   * @author Dick Balaska
18   * @since 2005/08/06
19   * @see <a href="http://cvs.buckosoft.com/Projects/PicMan/PicMan/src/main/java/com/buckosoft/PicMan/domain/Contact.java">Contact.java</a>
20   */
21  public class Contact {
22  
23  	private static final boolean DEBUG = false;
24  	protected final Log logger = LogFactory.getLog(getClass());
25  
26  	private	int			cid;
27  	private	String		name;
28  	private	ArrayList<ArrayList<String>>	picsArray	= new ArrayList<ArrayList<String>>(100);
29  	private	Date		startTime	= new Date();
30  	private	Date		endTime		= startTime;
31  	
32  	public	Contact() {
33  		picsArray = new ArrayList<ArrayList<String>>(20);
34  	}
35  
36  	/** Fetch the chain id for this contact
37  	 * @return Returns the cid.
38  	 */
39  	public int getCid() {
40  		return cid;
41  	}
42  
43  	/** Set the chain id for this contact
44  	 * @param cid The cid to set.
45  	 */
46  	public void setCid(int cid) {
47  		this.cid = cid;
48  	}
49  
50  	public String getName() {
51  		return name;
52  	}
53  	public void setName(String name) {
54  		this.name = name;
55  	}
56  	public Date getStartTime() {
57  		return startTime;
58  	}
59  	public void setStartTime(Date theTime) {
60  		this.startTime = theTime;
61  	}
62  	public Date getEndTime() {
63  		return endTime;
64  	}
65  	public void setEndTime(Date theTime) {
66  		this.endTime = theTime;
67  	}
68  
69  	public ArrayList<ArrayList<String>> getPics() {
70  		return picsArray;
71  	}
72  
73  	public	int		getRowCount() {
74  		return(picsArray.size());
75  	}
76  	public	void	setPic(String name, int row, int col) {
77  		while (picsArray.size() <= row)
78  			picsArray.add(picsArray.size(), new ArrayList<String>(30));
79  		if (DEBUG)
80  			logger.info("pics cap = " + picsArray.size());
81  		ArrayList<String> colArray;
82  		colArray = picsArray.get(row);
83  		while(colArray.size() <= col)
84  			colArray.add(colArray.size(), null);
85  		colArray.set(col, name);
86  	}
87  	
88  	public	String	getPic(int row, int col) {
89  		try {
90  			return(picsArray.get(row)).get(col);
91  		} catch (Exception e) {
92  			return(null);
93  		}
94  	}
95  }