View Javadoc
1   /******************************************************************************
2    * ChainManForm.java - A bean to wrap ChainMan in a form friendly package
3    * 
4    * PicMan - The BuckoSoft Picture Manager in Java
5    * Copyright(c) 2006 - Dick Balaska
6    * 
7    */
8   package com.buckosoft.PicMan.web;
9   
10  import java.util.List;
11  
12  import com.buckosoft.BSAccount.web.BSAccountUserWebSession;
13  import com.buckosoft.PicMan.domain.Chain;
14  import com.buckosoft.PicMan.domain.DataStrings;
15  
16  /** A bean to wrap ChainMan in a form friendly package
17   * @author Dick Balaska
18   * @since 2006/01/24
19   * @see <a href="http://cvs.buckosoft.com/Projects/PicMan/PicMan/src/com/buckosoft/PicMan/web/ChainManForm.java">ChainManForm.java</a>
20   */
21  public class ChainManForm implements DataStrings {
22  
23  	private List<Chain>					chains;
24  	private	BSAccountUserWebSession	userWebSession;
25  	private	boolean					flipFlop = false;
26  	private	String					chainToDelete;
27  	private	String					newChainName;
28  	private	Chain					activeChain = null;
29  	private	String					setSizeWebTable;
30  
31  	private	String					contactEngineName;
32  	private	List<String>			engines;
33  	
34  	public	BSAccountUserWebSession	getUserWebSession() { return(userWebSession); }
35  	public	void		setUserWebSession(BSAccountUserWebSession us) { userWebSession = us; }
36  
37  	public	List<Chain>		getChains() { return(chains); }
38  	public	void		setChains(List<Chain> chains) { this.chains = chains; }
39  
40  	public	int			getChainCount() { return(this.chains.size()); }
41  
42  	public	boolean		getFlipFlop() { flipFlop = !flipFlop; return(flipFlop); }
43  	
44  	public	String		getNewChainName() { return(newChainName); }
45  	public	void		setNewChainName(String s) { newChainName = s; }
46  	public	String		getChainToDelete() { return(chainToDelete); }
47  	public	void		setChainToDelete(String s) { chainToDelete = s; }
48  
49  	public Chain getActiveChain() {
50  		return activeChain;
51  	}
52  	public void setActiveChain(Chain activeChain) {
53  		this.activeChain = activeChain;
54  	}
55  	/**
56  	 * @return Returns the setSizeWebTable.
57  	 */
58  	public String getSetSizeWebTable() {
59  		return setSizeWebTable;
60  	}
61  	/**
62  	 * @param setSizeWebTable The setSizeWebTable to set.
63  	 */
64  	public void setSetSizeWebTable(String setSizeWebTable) {
65  		this.setSizeWebTable = setSizeWebTable;
66  	}
67  
68  	public class Selector {
69  		Selector(int i, String s) { index = i; name = s; }
70  		private int		index;
71  		private	String	name;
72  		/**
73  		 * @return Returns the index.
74  		 */
75  		public int getIndex() {
76  			return index;
77  		}
78  		/**
79  		 * @return Returns the name of this Selector.
80  		 */
81  		public String getName() {
82  			return name;
83  		}
84  		
85  	}
86  	private	Selector[] picSelectors = {
87  		new Selector(PICSELECTOR_MIX, "Mix"), 
88  		new Selector(PICSELECTOR_SORT, "Sort") 
89  	};
90  
91  	/**
92  	 * @return Returns the picSelector.
93  	 */
94  	public Selector[] getPicSelectors() {
95  		return picSelectors;
96  	}
97  	
98  	private	Integer[] rateSelectors = {
99  		9,8,7,6,5,4,3,2,1
100 	};
101 
102 	/** Get an array of Integers that are the possible rates.
103 	 * @return Returns the rateSelectors.
104 	 */
105 	public Integer[] getRateSelectors() {
106 		return rateSelectors;
107 	}
108 
109 	/** Get the name of the engine to build this chain.  If there is no engine, pick a reasonable default.
110 	 * @return the contactEngineName or 
111 	 */
112 	public String getContactEngineName() {
113 		if ((contactEngineName == null || contactEngineName.isEmpty() )
114 				&& (engines != null && !engines.isEmpty())) {
115 			return(engines.get(0));
116 		}
117 		return contactEngineName;
118 	}
119 	/** Set the name of the engine to use to build the chain. 
120 	 * @param contactEngineName the contactEngineName to set
121 	 */
122 	public void setContactEngineName(String contactEngineName) {
123 		this.contactEngineName = contactEngineName;
124 	}
125 	/**
126 	 * @return the engines
127 	 */
128 	public List<String> getEngines() {
129 		return engines;
130 	}
131 	/**
132 	 * @param engines the engines to set
133 	 */
134 	public void setEngines(List<String> engines) {
135 		this.engines = engines;
136 	}
137 	
138 }