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.

DummyFrameManager.java 6.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * Copyright (c) 2006-2007 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.ui.framemanager;
  23. import java.awt.Color;
  24. import javax.swing.JComponent;
  25. import com.dmdirc.Channel;
  26. import com.dmdirc.FrameContainer;
  27. import com.dmdirc.Query;
  28. import com.dmdirc.Raw;
  29. import com.dmdirc.Server;
  30. import com.dmdirc.ui.MainFrame;
  31. /**
  32. * A dummy frame manager. Does nothing.
  33. * @author chris
  34. */
  35. public final class DummyFrameManager implements FrameManager {
  36. /** Creates a new instance of DummyFrameManager. */
  37. public DummyFrameManager() {
  38. //Do nothing.
  39. }
  40. /**
  41. * Sets the parent component of this frame manager. The frame manager
  42. * should render itself within the parent.
  43. * @param parent The parent control
  44. */
  45. public void setParent(final JComponent parent) {
  46. parent.setBackground(Color.RED);
  47. }
  48. /**
  49. * Adds a new server instance to this frame manager.
  50. * @param server The server to be added
  51. */
  52. public void addServer(final Server server) {
  53. MainFrame.getMainFrame().getStatusBar()
  54. .setMessage("DummyFrameManager: addServer: " + server);
  55. }
  56. /**
  57. * Removes a server instance from this frame manager.
  58. * @param server The server to be removed
  59. */
  60. public void delServer(final Server server) {
  61. MainFrame.getMainFrame().getStatusBar()
  62. .setMessage("DummyFrameManager: delServer: " + server);
  63. }
  64. /**
  65. * Adds a new channel instance to this frame manager.
  66. * @param server The server to which the channel belongs
  67. * @param channel The channel to be added
  68. */
  69. public void addChannel(final Server server, final Channel channel) {
  70. MainFrame.getMainFrame().getStatusBar()
  71. .setMessage("DummyFrameManager: addChannel: " + channel + "@" + server);
  72. }
  73. /**
  74. * Removes a channel instance from this frame manager.
  75. * @param server The server to which the channel belongs
  76. * @param channel The channel to be removed
  77. */
  78. public void delChannel(final Server server, final Channel channel) {
  79. MainFrame.getMainFrame().getStatusBar()
  80. .setMessage("DummyFrameManager: delChannel: " + channel + "@" + server);
  81. }
  82. /**
  83. * Adds a new query instance to this frame manager.
  84. * @param server The server to which the query belongs
  85. * @param query The query to be added
  86. */
  87. public void addQuery(final Server server, final Query query) {
  88. MainFrame.getMainFrame().getStatusBar()
  89. .setMessage("DummyFrameManager: addQuery: " + query + "@" + server);
  90. }
  91. /**
  92. * Removes a query instance from this frame manager.
  93. * @param server The server to which the query belongs
  94. * @param query The query to be removed
  95. */
  96. public void delQuery(final Server server, final Query query) {
  97. MainFrame.getMainFrame().getStatusBar()
  98. .setMessage("DummyFrameManager: delQuery: " + query + "@" + server);
  99. }
  100. /**
  101. * Adds a new raw instance to this frame manager.
  102. * @param server The server to which the raw frame belongs
  103. * @param raw The raw instance to be added
  104. */
  105. public void addRaw(final Server server, final Raw raw) {
  106. MainFrame.getMainFrame().getStatusBar()
  107. .setMessage("DummyFrameManager: addRaw: " + raw + "@" + server);
  108. }
  109. /**
  110. * Removes a raw instance from this frame manager.
  111. * @param server The server to which the raw frame belongs
  112. * @param raw The raw instance to be removed
  113. */
  114. public void delRaw(final Server server, final Raw raw) {
  115. MainFrame.getMainFrame().getStatusBar()
  116. .setMessage("DummyFrameManager: delRaw: " + raw + "@" + server);
  117. }
  118. /**
  119. * Indicates whether this frame manager can be positioned vertically
  120. * (i.e., at the side of the screen).
  121. * @return True iff the frame manager can be positioned vertically
  122. */
  123. public boolean canPositionVertically() {
  124. return true;
  125. }
  126. /**
  127. * Indicates whether this frame manager can be positioned horizontally
  128. * (i.e., at the top or bottom of the screen).
  129. * @return True iff the frame manager can be positioned horizontally
  130. */
  131. public boolean canPositionHorizontally() {
  132. return true;
  133. }
  134. /**
  135. * Shows an event notification to the user by colouring the corresponding
  136. * element to the source a specific colour.
  137. * @param source The object requesting notification
  138. * @param colour The colour that should be used to indicate the notification
  139. */
  140. public void showNotification(final FrameContainer source, final Color colour) {
  141. MainFrame.getMainFrame().getStatusBar()
  142. .setMessage("DummyFrameManager: Notifcation for " + source);
  143. }
  144. /**
  145. * Removes the notification status of the specified object.
  146. * @param source The object whose notification should be cleared
  147. */
  148. public void clearNotification(final FrameContainer source) {
  149. MainFrame.getMainFrame().getStatusBar()
  150. .setMessage("DummyFrameManager: Clear notification for " + source);
  151. }
  152. /**
  153. * Indicates that there is a new active frame.
  154. * @param source The object that now has focus
  155. */
  156. public void setSelected(final FrameContainer source) {
  157. MainFrame.getMainFrame().getStatusBar()
  158. .setMessage("DummyFrameManager: Now focused: " + source);
  159. }
  160. }