Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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.WritableFrameContainer;
  24. import com.dmdirc.commandparser.parsers.CommandParser;
  25. import com.dmdirc.config.ConfigManager;
  26. import com.dmdirc.config.IdentityManager;
  27. import com.dmdirc.ui.input.InputHandler;
  28. import com.dmdirc.ui.interfaces.InputWindow;
  29. import com.dmdirc.ui.interfaces.UIController;
  30. import com.dmdirc.util.StringTranscoder;
  31. import java.nio.charset.Charset;
  32. /**
  33. * Dummy input window, used for testing.
  34. */
  35. public class DummyInputWindow implements InputWindow {
  36. /** Window title. */
  37. private String title;
  38. /** Are we visible? */
  39. private boolean visible;
  40. /** are we maximised? */
  41. private boolean maximised;
  42. /** Our container. */
  43. private final WritableFrameContainer<? extends InputWindow> container;
  44. /**
  45. * Instantiates a new DummyInputWindow.
  46. *
  47. * @param owner Parent window
  48. * @param commandParser Parent command parser
  49. */
  50. public DummyInputWindow(final WritableFrameContainer<? extends InputWindow> owner,
  51. final CommandParser commandParser) {
  52. this.container = owner;
  53. }
  54. /** {@inheritDoc} */
  55. @Override
  56. @Deprecated
  57. public CommandParser getCommandParser() {
  58. return getContainer().getCommandParser();
  59. }
  60. /** {@inheritDoc} */
  61. @Override
  62. public InputHandler getInputHandler() {
  63. return new DummyInputHandler(new DummyInputField(), null, this);
  64. }
  65. /** {@inheritDoc} */
  66. @Override
  67. @Deprecated
  68. public void setAwayIndicator(final boolean isAway) {
  69. // Do nothing
  70. }
  71. /** {@inheritDoc} */
  72. @Override
  73. @Deprecated
  74. public void addLine(final String messageType, final Object... args) {
  75. getContainer().addLine(messageType, args);
  76. }
  77. /** {@inheritDoc} */
  78. @Override
  79. @Deprecated
  80. public void addLine(final StringBuffer messageType, final Object... args) {
  81. getContainer().addLine(messageType, args);
  82. }
  83. /** {@inheritDoc} */
  84. @Override
  85. @Deprecated
  86. public void addLine(final String line, final boolean timestamp) {
  87. getContainer().addLine(line, timestamp);
  88. }
  89. /** {@inheritDoc} */
  90. @Override
  91. @Deprecated
  92. public void clear() {
  93. throw new UnsupportedOperationException("Not supported yet.");
  94. }
  95. /** {@inheritDoc} */
  96. @Override
  97. @Deprecated
  98. public ConfigManager getConfigManager() {
  99. return IdentityManager.getGlobalConfig();
  100. }
  101. /** {@inheritDoc} */
  102. @Override
  103. public WritableFrameContainer<? extends InputWindow> getContainer() {
  104. return container;
  105. }
  106. /** {@inheritDoc} */
  107. @Override
  108. @Deprecated
  109. public boolean isVisible() {
  110. return visible;
  111. }
  112. /** {@inheritDoc} */
  113. @Override
  114. @Deprecated
  115. public void setVisible(final boolean isVisible) {
  116. visible = isVisible;
  117. }
  118. /** {@inheritDoc} */
  119. @Override
  120. @Deprecated
  121. public String getTitle() {
  122. return title;
  123. }
  124. /** {@inheritDoc} */
  125. @Override
  126. @Deprecated
  127. public boolean isMaximum() {
  128. return maximised;
  129. }
  130. /** {@inheritDoc} */
  131. @Override
  132. @Deprecated
  133. public void setTitle(final String title) {
  134. this.title = title;
  135. }
  136. /** {@inheritDoc} */
  137. @Override
  138. public void open() {
  139. // Do nothing
  140. }
  141. /** {@inheritDoc} */
  142. @Override
  143. @Deprecated
  144. public StringTranscoder getTranscoder() {
  145. return new StringTranscoder(Charset.defaultCharset());
  146. }
  147. /** {@inheritDoc} */
  148. @Override
  149. public void close() {
  150. container.handleWindowClosing();
  151. }
  152. /** {@inheritDoc} */
  153. @Override
  154. @Deprecated
  155. public void restore() {
  156. // Do nothing
  157. }
  158. /** {@inheritDoc} */
  159. @Override
  160. @Deprecated
  161. public void maximise() {
  162. // Do nothing
  163. }
  164. /** {@inheritDoc} */
  165. @Override
  166. @Deprecated
  167. public void toggleMaximise() {
  168. // Do nothing
  169. }
  170. /** {@inheritDoc} */
  171. @Override
  172. @Deprecated
  173. public void minimise() {
  174. // Do nothing
  175. }
  176. /** {@inheritDoc} */
  177. @Override
  178. public void activateFrame() {
  179. // Do nothing
  180. }
  181. /** {@inheritDoc} */
  182. @Override
  183. public UIController getController() {
  184. return new DummyController();
  185. }
  186. }