001 package jmaster.jumploader.model.api.config;
002
003 import java.util.MissingResourceException;
004
005 import jmaster.jumploader.model.api.IModel;
006 import jmaster.jumploader.model.api.config.AppletConfig;
007 import jmaster.util.property.Property;
008 import jmaster.util.property.PropertyFactory;
009 import jmaster.util.property.PropertyHelper;
010
011
012 /**
013 * AppletConfig
014 *
015 * @author timur
016 */
017
018 public class AppletConfig {
019 //---------------------------------------------------------------
020 // constants
021 //---------------------------------------------------------------
022 /**
023 * property file
024 */
025 private static final String PROPERTY = "AppletConfig.properties";
026 /**
027 * framed mode - applet gui runs in a new frame
028 */
029 public static final String MODE_FRAMED = "framed";
030 /**
031 * embedded mode - applet gui runs in a content pane
032 */
033 public static final String MODE_EMBEDDED = "embedded";
034 //---------------------------------------------------------------
035 // properties
036 //---------------------------------------------------------------
037 /**
038 * applet mode, could be EMBEDDED either FRAMED
039 */
040 private String mode = MODE_EMBEDDED;
041 /**
042 * shows whether appletInitialized event should be fired to JSObject
043 */
044 private boolean fireAppletInitialized = false;
045 /**
046 * shows whether uploaderFileAdded event should be fired to JSObject
047 */
048 private boolean fireUploaderFileAdded = false;
049 /**
050 * shows whether uploaderFileRemoved event should be fired to JSObject
051 */
052 private boolean fireUploaderFileRemoved = false;
053 /**
054 * shows whether uploaderFileMoved event should be fired to JSObject
055 */
056 private boolean fireUploaderFileMoved = false;
057 /**
058 * shows whether uploaderFileStatusChanged event should be fired to JSObject
059 */
060 private boolean fireUploaderFileStatusChanged = false;
061 /**
062 * shows whether uploaderFilePartitionUploaded event should be fired to JSObject
063 */
064 private boolean fireUploaderFilePartitionUploaded = false;
065 /**
066 * shows whether uploaderFilesReset event should be fired to JSObject
067 */
068 private boolean fireUploaderFilesReset = false;
069 /**
070 * shows whether uploaderStatusChanged event should be fired to JSObject
071 */
072 private boolean fireUploaderStatusChanged = false;
073 /**
074 * shows whether uploaderSelectionChanged event should be fired to JSObject
075 */
076 private boolean fireUploaderSelectionChanged = false;
077 /**
078 * shows whether uploadViewFileOpenDialogFilesSelected event should be fired to JSObject,
079 * js method arguments: IUploadView view, String[] paths
080 */
081 private boolean fireUploadViewFileOpenDialogFilesSelected = false;
082 /**
083 * shows whether mainViewMessageShown event should be fired to JSObject,
084 * js method arguments:
085 * - IMainView view
086 * - String severity: message severity, could be one of: INFO, WARNING, ERROR
087 * - String message: message (never null)
088 */
089 private boolean fireMainViewMessageShown = false;
090 /**
091 * properties to inject, , this must be string formatted as follows:
092 * key1=value1;key2=value2;...keyN=valueN
093 */
094 private String properties = null;
095 /**
096 * location (absolute or relative url) of zip file containing localized messages.properties file
097 */
098 private String messagesZipUrl = null;
099 //---------------------------------------------------------------
100 // constructors
101 //---------------------------------------------------------------
102 /**
103 * with model
104 */
105 public AppletConfig( IModel model ) {
106 super();
107 //
108 // inject properties, if present
109 try {
110 PropertyFactory pf = PropertyFactory.getInstance();
111 Property pr = pf.getProperty( PROPERTY );
112 PropertyHelper ph = PropertyHelper.getInstance();
113 ph.injectProperties( this, pr, null );
114 } catch( MissingResourceException ignore ) {
115 }
116 }
117 //---------------------------------------------------------------
118 // property accessors
119 //---------------------------------------------------------------
120 /**
121 * toString
122 */
123 public String toString() {
124 return "" +
125 "mode=" + mode + "\r\n" +
126 "fireAppletInitialized=" + fireAppletInitialized + "\r\n" +
127 "fireUploaderFileAdded=" + fireUploaderFileAdded + "\r\n" +
128 "fireUploaderFileRemoved=" + fireUploaderFileRemoved + "\r\n" +
129 "fireUploaderFileMoved=" + fireUploaderFileMoved + "\r\n" +
130 "fireUploaderFileStatusChanged=" + fireUploaderFileStatusChanged + "\r\n" +
131 "fireUploaderFilesReset=" + fireUploaderFilesReset + "\r\n" +
132 "fireUploaderFilePartitionUploaded=" + fireUploaderFilePartitionUploaded + "\r\n" +
133 "fireUploaderStatusChanged=" + fireUploaderStatusChanged + "\r\n" +
134 "fireUploaderSelectionChanged=" + fireUploaderSelectionChanged + "\r\n" +
135 "fireUploadViewFileOpenDialogFilesSelected=" + fireUploadViewFileOpenDialogFilesSelected + "\r\n" +
136 "fireMainViewMessageShown=" + fireMainViewMessageShown + "\r\n" +
137 "properties=" + properties + "\r\n" +
138 "messagesZipUrl=" + messagesZipUrl + "\r\n" +
139 "";
140 }
141 /**
142 * @return the fireUploaderFileAdded
143 */
144 public boolean isFireUploaderFileAdded() {
145 return fireUploaderFileAdded;
146 }
147 /**
148 * @param fireUploaderFileAdded the fireUploaderFileAdded to set
149 */
150 public void setFireUploaderFileAdded(boolean fireUploaderFileAdded) {
151 this.fireUploaderFileAdded = fireUploaderFileAdded;
152 }
153 /**
154 * @return the fireUploaderFileRemoved
155 */
156 public boolean isFireUploaderFileRemoved() {
157 return fireUploaderFileRemoved;
158 }
159 /**
160 * @param fireUploaderFileRemoved the fireUploaderFileRemoved to set
161 */
162 public void setFireUploaderFileRemoved(boolean fireUploaderFileRemoved) {
163 this.fireUploaderFileRemoved = fireUploaderFileRemoved;
164 }
165 /**
166 * @return the fireUploaderFilesReset
167 */
168 public boolean isFireUploaderFilesReset() {
169 return fireUploaderFilesReset;
170 }
171 /**
172 * @param fireUploaderFilesReset the fireUploaderFilesReset to set
173 */
174 public void setFireUploaderFilesReset(boolean fireUploaderFilesReset) {
175 this.fireUploaderFilesReset = fireUploaderFilesReset;
176 }
177 /**
178 * @return the fireUploaderFileStatusChanged
179 */
180 public boolean isFireUploaderFileStatusChanged() {
181 return fireUploaderFileStatusChanged;
182 }
183 /**
184 * @param fireUploaderFileStatusChanged the fireUploaderFileStatusChanged to set
185 */
186 public void setFireUploaderFileStatusChanged(
187 boolean fireUploaderFileStatusChanged) {
188 this.fireUploaderFileStatusChanged = fireUploaderFileStatusChanged;
189 }
190 /**
191 * @return the fireUploaderStatusChanged
192 */
193 public boolean isFireUploaderStatusChanged() {
194 return fireUploaderStatusChanged;
195 }
196 /**
197 * @param fireUploaderStatusChanged the fireUploaderStatusChanged to set
198 */
199 public void setFireUploaderStatusChanged(boolean fireUploaderStatusChanged) {
200 this.fireUploaderStatusChanged = fireUploaderStatusChanged;
201 }
202 /**
203 * @return the mode
204 */
205 public String getMode() {
206 return mode;
207 }
208 /**
209 * @param mode the mode to set
210 */
211 public void setMode(String mode) {
212 this.mode = mode;
213 }
214 /**
215 * @return the fireUploaderSelectionChanged
216 */
217 public boolean isFireUploaderSelectionChanged() {
218 return fireUploaderSelectionChanged;
219 }
220 /**
221 * @param fireUploaderSelectionChanged the fireUploaderSelectionChanged to set
222 */
223 public void setFireUploaderSelectionChanged(boolean fireUploaderSelectionChanged) {
224 this.fireUploaderSelectionChanged = fireUploaderSelectionChanged;
225 }
226 /**
227 * @return the fireAppletInitialized
228 */
229 public boolean isFireAppletInitialized() {
230 return fireAppletInitialized;
231 }
232 /**
233 * @param fireAppletInitialized the fireAppletInitialized to set
234 */
235 public void setFireAppletInitialized(boolean fireAppletInitialized) {
236 this.fireAppletInitialized = fireAppletInitialized;
237 }
238 /**
239 * @return the properties
240 */
241 public String getProperties() {
242 return properties;
243 }
244 /**
245 * @param properties the properties to set
246 */
247 public void setProperties(String properties) {
248 this.properties = properties;
249 }
250 public boolean isFireUploaderFileMoved() {
251 return fireUploaderFileMoved;
252 }
253 public void setFireUploaderFileMoved(boolean fireUploaderFileMoved) {
254 this.fireUploaderFileMoved = fireUploaderFileMoved;
255 }
256 public String getMessagesZipUrl() {
257 return messagesZipUrl;
258 }
259 public void setMessagesZipUrl(String messagesZipUrl) {
260 this.messagesZipUrl = messagesZipUrl;
261 }
262 public boolean isFireUploadViewFileOpenDialogFilesSelected() {
263 return fireUploadViewFileOpenDialogFilesSelected;
264 }
265 public void setFireUploadViewFileOpenDialogFilesSelected(
266 boolean fireUploadViewFileOpenDialogFilesSelected) {
267 this.fireUploadViewFileOpenDialogFilesSelected = fireUploadViewFileOpenDialogFilesSelected;
268 }
269 public boolean isFireMainViewMessageShown() {
270 return fireMainViewMessageShown;
271 }
272 public void setFireMainViewMessageShown(boolean fireMainViewMessageShown) {
273 this.fireMainViewMessageShown = fireMainViewMessageShown;
274 }
275 public boolean isFireUploaderFilePartitionUploaded() {
276 return fireUploaderFilePartitionUploaded;
277 }
278 public void setFireUploaderFilePartitionUploaded(
279 boolean fireUploaderFilePartitionUploaded) {
280 this.fireUploaderFilePartitionUploaded = fireUploaderFilePartitionUploaded;
281 }
282 }