001: /*
002: * Copyright (C) 2006 Rob Manning
003: * manningr@users.sourceforge.net
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: */
019: package net.sourceforge.squirrel_sql.client;
020:
021: import javax.swing.Action;
022: import javax.swing.JComponent;
023: import javax.swing.JMenu;
024:
025: import net.sourceforge.squirrel_sql.client.action.ActionCollection;
026: import net.sourceforge.squirrel_sql.client.gui.WindowManager;
027: import net.sourceforge.squirrel_sql.client.gui.db.DataCache;
028: import net.sourceforge.squirrel_sql.client.gui.mainframe.MainFrame;
029: import net.sourceforge.squirrel_sql.client.plugin.IPlugin;
030: import net.sourceforge.squirrel_sql.client.plugin.PluginManager;
031: import net.sourceforge.squirrel_sql.client.preferences.PreferenceType;
032: import net.sourceforge.squirrel_sql.client.preferences.SquirrelPreferences;
033: import net.sourceforge.squirrel_sql.client.resources.SquirrelResources;
034: import net.sourceforge.squirrel_sql.client.session.ISQLEntryPanelFactory;
035: import net.sourceforge.squirrel_sql.client.session.MockSQLEntryPanelFactory;
036: import net.sourceforge.squirrel_sql.client.session.MockSessionManager;
037: import net.sourceforge.squirrel_sql.client.session.SessionManager;
038: import net.sourceforge.squirrel_sql.client.session.mainpanel.SQLHistory;
039: import net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager;
040: import net.sourceforge.squirrel_sql.fw.util.IMessageHandler;
041: import net.sourceforge.squirrel_sql.fw.util.MockMessageHandler;
042: import net.sourceforge.squirrel_sql.fw.util.TaskThreadPool;
043:
044: public class MockApplication implements IApplication {
045:
046: TaskThreadPool threadPool = null;
047: PluginManager pluginManager = null;
048: ActionCollection actions = null;
049: SquirrelResources resource = null;
050: SquirrelPreferences prefs = null;
051: SQLHistory history = null;
052: MockSQLEntryPanelFactory sqlEntryPanelFactory = null;
053: IMessageHandler messageHandler = null;
054: MockSessionManager sessionHandler = null;
055: FontInfoStore fontInfoStore = null;
056:
057: public MockApplication() {
058: resource = new SquirrelResources(
059: "net.sourceforge.squirrel_sql.client.resources.squirrel");
060: prefs = SquirrelPreferences.load();
061: threadPool = new TaskThreadPool();
062: pluginManager = new PluginManager(this );
063: actions = new ActionCollection(this );
064: history = new SQLHistory();
065: sqlEntryPanelFactory = new MockSQLEntryPanelFactory();
066: messageHandler = new MockMessageHandler();
067: sessionHandler = new MockSessionManager(this );
068: fontInfoStore = new FontInfoStore();
069: }
070:
071: public MockSessionManager getMockSessionManager() {
072: return sessionHandler;
073: }
074:
075: public IPlugin getDummyAppPlugin() {
076: // TODO Auto-generated method stub
077: System.err
078: .println("MockApplication.getDummyAppPlugin: stub not yet implemented");
079: return null;
080: }
081:
082: public PluginManager getPluginManager() {
083: return pluginManager;
084: }
085:
086: public WindowManager getWindowManager() {
087: // TODO Auto-generated method stub
088: System.err
089: .println("MockApplication.getWindowManager: stub not yet implemented");
090: return null;
091: }
092:
093: public ActionCollection getActionCollection() {
094: return actions;
095: }
096:
097: public SQLDriverManager getSQLDriverManager() {
098: // TODO Auto-generated method stub
099: System.err
100: .println("MockApplication.getSQLDriverManager: stub not yet implemented");
101: return null;
102: }
103:
104: public DataCache getDataCache() {
105: // TODO Auto-generated method stub
106: System.err
107: .println("MockApplication.getDataCache: stub not yet implemented");
108: return null;
109: }
110:
111: public SquirrelPreferences getSquirrelPreferences() {
112: return prefs;
113: }
114:
115: public SquirrelResources getResources() {
116: return resource;
117: }
118:
119: public IMessageHandler getMessageHandler() {
120: return messageHandler;
121: }
122:
123: public SessionManager getSessionManager() {
124: return sessionHandler;
125: }
126:
127: public void showErrorDialog(String msg) {
128: // TODO Auto-generated method stub
129: System.err
130: .println("MockApplication.showErrorDialog(String): stub not yet implemented");
131: }
132:
133: public void showErrorDialog(Throwable th) {
134: // TODO Auto-generated method stub
135: System.err
136: .println("MockApplication.showErrorDialog(Throwable): stub not yet implemented");
137: }
138:
139: public void showErrorDialog(String msg, Throwable th) {
140: // TODO Auto-generated method stub
141: System.err
142: .println("MockApplication.showErrorDialog(String, Throwable): stub not yet implemented");
143: }
144:
145: public MainFrame getMainFrame() {
146: // TODO Auto-generated method stub
147: System.err
148: .println("MockApplication.getMainFrame: stub not yet implemented");
149: return null;
150: }
151:
152: public TaskThreadPool getThreadPool() {
153: return threadPool;
154: }
155:
156: public FontInfoStore getFontInfoStore() {
157: return fontInfoStore;
158: }
159:
160: public ISQLEntryPanelFactory getSQLEntryPanelFactory() {
161: return sqlEntryPanelFactory;
162: }
163:
164: public SQLHistory getSQLHistory() {
165: return history;
166: }
167:
168: public void setSQLEntryPanelFactory(ISQLEntryPanelFactory factory) {
169: // TODO Auto-generated method stub
170: System.err
171: .println("MockApplication.setSQLEntryPanelFactory: stub not yet implemented");
172: }
173:
174: public void addToMenu(int menuId, JMenu menu) {
175: // TODO Auto-generated method stub
176: System.err
177: .println("MockApplication.addToMenu(int, JMenu): stub not yet implemented");
178: }
179:
180: public void addToMenu(int menuId, Action action) {
181: // TODO Auto-generated method stub
182: System.err
183: .println("MockApplication.addToMenu(int, Action): stub not yet implemented");
184: }
185:
186: public void addToStatusBar(JComponent comp) {
187: // TODO Auto-generated method stub
188: System.err
189: .println("MockApplication.addToStatusBar: stub not yet implemented");
190: }
191:
192: public void removeFromStatusBar(JComponent comp) {
193: // TODO Auto-generated method stub
194: System.err
195: .println("MockApplication.removeFromStatusBar: stub not yet implemented");
196: }
197:
198: public void startup() {
199: // TODO Auto-generated method stub
200: System.err
201: .println("MockApplication.startup: stub not yet implemented");
202: }
203:
204: public boolean shutdown() {
205: // TODO Auto-generated method stub
206: System.err
207: .println("MockApplication.shutdown: stub not yet implemented");
208: return false;
209: }
210:
211: public void openURL(String url) {
212: // TODO Auto-generated method stub
213: System.err
214: .println("MockApplication.openURL: stub not yet implemented");
215: }
216:
217: /**
218: * @see net.sourceforge.squirrel_sql.client.IApplication#saveApplicationState()
219: */
220: public void saveApplicationState() {
221: // TODO Auto-generated method stub
222:
223: }
224:
225: /**
226: * @see net.sourceforge.squirrel_sql.client.IApplication#savePreferences(net.sourceforge.squirrel_sql.client.preferences.PreferenceType)
227: */
228: public void savePreferences(PreferenceType preferenceType) {
229: // TODO Auto-generated method stub
230:
231: }
232:
233: }
|