You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DummyController.java 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. /*
  2. * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. * SOFTWARE.
  21. */
  22. package com.dmdirc.addons.ui_dummy;
  23. import com.dmdirc.Channel;
  24. import com.dmdirc.FrameContainer;
  25. import com.dmdirc.Query;
  26. import com.dmdirc.Server;
  27. import com.dmdirc.WritableFrameContainer;
  28. import com.dmdirc.config.prefs.PreferencesInterface;
  29. import com.dmdirc.plugins.Plugin;
  30. import com.dmdirc.ui.core.components.StatusBarManager;
  31. import com.dmdirc.ui.core.dialogs.sslcertificate.SSLCertificateDialogModel;
  32. import com.dmdirc.ui.interfaces.ChannelWindow;
  33. import com.dmdirc.ui.interfaces.InputWindow;
  34. import com.dmdirc.ui.interfaces.MainWindow;
  35. import com.dmdirc.ui.interfaces.QueryWindow;
  36. import com.dmdirc.ui.interfaces.ServerWindow;
  37. import com.dmdirc.ui.interfaces.StatusBar;
  38. import com.dmdirc.ui.interfaces.UIController;
  39. import com.dmdirc.ui.interfaces.UpdaterDialog;
  40. import com.dmdirc.ui.interfaces.Window;
  41. import com.dmdirc.updater.Update;
  42. import java.net.URI;
  43. import java.util.List;
  44. /**
  45. * Implements a dummy UI controller.
  46. */
  47. public final class DummyController extends Plugin implements UIController {
  48. /** Main window. */
  49. private final MainWindow mainWindow = new DummyMainWindow();
  50. /**
  51. * Creates a new instance of DummyController.
  52. */
  53. public DummyController() {
  54. StatusBarManager.getStatusBarManager().registerStatusBar(new DummyStatusBar());
  55. }
  56. /** {@inheritDoc} */
  57. @Override
  58. public MainWindow getMainWindow() {
  59. return mainWindow;
  60. }
  61. /**
  62. * {@inheritDoc}
  63. *
  64. * @deprecated Should not be used externally - use the
  65. * {@link com.dmdirc.ui.core.components.StatusBarManager} instead.
  66. */
  67. @Override
  68. @Deprecated
  69. public StatusBar getStatusBar() {
  70. return new DummyStatusBar();
  71. }
  72. /**
  73. * {@inheritDoc}
  74. *
  75. * @deprecated Controllers should listen for window events using a
  76. * {@link FrameListener} and create windows as needed.
  77. */
  78. @Override @Deprecated
  79. public ChannelWindow getChannel(final Channel channel) {
  80. return new DummyChannelWindow(channel);
  81. }
  82. /**
  83. * {@inheritDoc}
  84. *
  85. * @deprecated Controllers should listen for window events using a
  86. * {@link FrameListener} and create windows as needed.
  87. */
  88. @Override @Deprecated
  89. public ServerWindow getServer(final Server server) {
  90. return new DummyServerWindow(server);
  91. }
  92. /**
  93. * {@inheritDoc}
  94. *
  95. * @deprecated Controllers should listen for window events using a
  96. * {@link FrameListener} and create windows as needed.
  97. */
  98. @Override @Deprecated
  99. public QueryWindow getQuery(final Query query) {
  100. return new DummyQueryWindow(query);
  101. }
  102. /**
  103. * {@inheritDoc}
  104. *
  105. * @deprecated Controllers should listen for window events using a
  106. * {@link FrameListener} and create windows as needed.
  107. */
  108. @Override @Deprecated
  109. public Window getWindow(final FrameContainer<?> owner) {
  110. throw new UnsupportedOperationException("Not supported yet.");
  111. }
  112. /**
  113. * {@inheritDoc}
  114. *
  115. * @deprecated Controllers should listen for window events using a
  116. * {@link FrameListener} and create windows as needed.
  117. */
  118. @Override @Deprecated
  119. public InputWindow getInputWindow(final WritableFrameContainer<?> owner) {
  120. return new DummyInputWindow(owner, owner.getCommandParser());
  121. }
  122. /** {@inheritDoc} */
  123. @Override
  124. public UpdaterDialog getUpdaterDialog(final List<Update> updates) {
  125. throw new UnsupportedOperationException("Not supported yet.");
  126. }
  127. /** {@inheritDoc} */
  128. @Override
  129. public void showFirstRunWizard() {
  130. System.out.println("DummyController.showFirstRunWizard()");
  131. }
  132. /**
  133. * {@inheritDoc}
  134. *
  135. * @deprecated Migration wizard is no longer used or needed
  136. */
  137. @Override
  138. @Deprecated
  139. public void showMigrationWizard() {
  140. System.out.println("DummyController.showMigrationWizard()");
  141. }
  142. /** {@inheritDoc} */
  143. @Override
  144. public void showChannelSettingsDialog(final Channel channel) {
  145. throw new UnsupportedOperationException("Not supported yet.");
  146. }
  147. /** {@inheritDoc} */
  148. @Override
  149. public void showServerSettingsDialog(final Server server) {
  150. throw new UnsupportedOperationException("Not supported yet.");
  151. }
  152. /** {@inheritDoc} */
  153. @Override
  154. public void initUISettings() {
  155. // Do nothing
  156. }
  157. /**
  158. * {@inheritDoc}
  159. *
  160. * @deprecated
  161. */
  162. @Override
  163. @Deprecated
  164. public Window getActiveWindow() {
  165. return null;
  166. }
  167. /**
  168. * {@inheritDoc}
  169. *
  170. * @deprecated
  171. */
  172. @Override
  173. @Deprecated
  174. public Server getActiveServer() {
  175. throw new UnsupportedOperationException("Not supported yet.");
  176. }
  177. /** {@inheritDoc} */
  178. @Override
  179. public void showURLDialog(final URI url) {
  180. throw new UnsupportedOperationException("Not supported yet.");
  181. }
  182. /** {@inheritDoc} */
  183. @Override
  184. public void showFeedbackNag() {
  185. throw new UnsupportedOperationException("Not supported yet.");
  186. }
  187. /** {@inheritDoc} */
  188. @Override
  189. public void showMessageDialog(final String title, final String message) {
  190. System.out.println(message);
  191. }
  192. /** {@inheritDoc} */
  193. @Override
  194. public String getUserInput(final String prompt) {
  195. throw new UnsupportedOperationException("Not supported yet.");
  196. }
  197. /** {@inheritDoc} */
  198. @Override
  199. public void showSSLCertificateDialog(final SSLCertificateDialogModel model) {
  200. throw new UnsupportedOperationException("Not supported yet.");
  201. }
  202. /** {@inheritDoc} */
  203. @Override
  204. public void onLoad() {
  205. // Do nothing
  206. }
  207. /** {@inheritDoc} */
  208. @Override
  209. public void onUnload() {
  210. // Do nothing
  211. }
  212. /** {@inheritDoc} */
  213. @Override
  214. public PreferencesInterface getPluginPrefsPanel() {
  215. throw new UnsupportedOperationException("Not supported yet.");
  216. }
  217. /** {@inheritDoc} */
  218. @Override
  219. public PreferencesInterface getUpdatesPrefsPanel() {
  220. throw new UnsupportedOperationException("Not supported yet.");
  221. }
  222. /** {@inheritDoc} */
  223. @Override
  224. public PreferencesInterface getUrlHandlersPrefsPanel() {
  225. throw new UnsupportedOperationException("Not supported yet.");
  226. }
  227. /** {@inheritDoc} */
  228. @Override
  229. public PreferencesInterface getThemesPrefsPanel() {
  230. throw new UnsupportedOperationException("Not supported yet.");
  231. }
  232. /**
  233. * Returns an instance of DummyController. This method is exported for use
  234. * in other plugins.
  235. *
  236. * @return A reference to this DummyController.
  237. */
  238. public UIController getController() {
  239. return this;
  240. }
  241. }