1 /*
2 * Manager.java
3 *
4 * Created on January 28, 2003, 8:49 AM
5 */
6
7 package com.mlw.fps.view.manager;
8
9 import java.io.File;
10
11 import com.mlw.fps.model.business.bean.SystemProperties;
12 import com.mlw.fps.model.business.vo.SupportedGame;
13 import com.mlw.fps.model.manager.ConsoleManager;
14 import com.mlw.fps.model.manager.FilterManager;
15 import com.mlw.fps.model.manager.ManagerFactory;
16
17 /***
18 * @todo The managers need to come from a factory!
19 * @author Matthew Wilson
20 */
21 public class ViewManager implements java.io.Serializable
22 {
23 private static String[] styles = null;
24
25 private ConsoleManager consoleManager;
26 private FilterManager filterManager;
27
28 private String style = SystemProperties.getProperty("css","default");
29
30 /*** Creates a new instance of Manager
31 */
32 public ViewManager()
33 {
34 }
35
36 public SupportedGame getSupportedGame()
37 {
38 return SystemProperties.getSupportedGame();
39 }
40
41 public ConsoleManager getConsoleManager()
42 {
43 if( consoleManager==null )
44 {
45 consoleManager = (ConsoleManager)ManagerFactory.getNewInstance(ConsoleManager.class.getName());
46 }
47 return consoleManager;
48 }
49
50 public FilterManager getFilterManager()
51 {
52 if( filterManager==null )
53 {
54 filterManager = (FilterManager)ManagerFactory.getNewInstance(FilterManager.class.getName());
55 /*
56 SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy");
57
58 try
59 {
60 filterManager.getSystemFilters().addFilter("startDate", df.parse(df.format(new Date())) );
61 }
62 catch(Exception e)
63 {
64 e.printStackTrace();
65 //TODO: should be a system setting...
66 }
67 */
68 }
69 return filterManager;
70 }
71
72 /*** Getter for property style.
73 * @return Value of property style.
74 */
75 public String getStyle()
76 {
77 return this.style;
78 }
79
80 /*** Setter for property style.
81 * @param style New value of property style.
82 */
83 public void setStyle(String style)
84 {
85 this.style = style;
86 }
87
88
89 /*** Reads the css dir and returns all valid styles.
90 * @return String[] of all valid styles. */
91 public String[] getSupportedStyles()
92 {
93 if( styles == null )
94 {
95 try
96 {
97 String home = SystemProperties.getProperty("homeDirectory");
98 File styleDir = new File( home + File.separator + "css" );
99 String[] files = styleDir.list();
100 for( int i=0; i<files.length; i++)
101 {
102 files[i] = files[i].substring(0, files[i].lastIndexOf('.') );
103 }
104 styles = files;
105 }
106 catch(Exception e)
107 {
108 e.printStackTrace();
109 return new String[]{"default"};
110 }
111 }
112
113 return styles;
114
115 }
116 }
This page was automatically generated by Maven