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.

Window.java 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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.interfaces;
  23. import com.dmdirc.FrameContainer;
  24. import com.dmdirc.util.StringTranscoder;
  25. import com.dmdirc.config.ConfigManager;
  26. import java.beans.PropertyVetoException;
  27. import javax.swing.Icon;
  28. /**
  29. * The Window interface specifies common methods that should be implemented
  30. * by all windows. It is assumed that all windows have a main text area.
  31. */
  32. public interface Window {
  33. /**
  34. * Formats the arguments using the Formatter, then adds the result to the
  35. * main text area.
  36. *
  37. * @param messageType The type of this message
  38. * @param args The arguments for the message
  39. */
  40. void addLine(String messageType, Object... args);
  41. /**
  42. * Formats the arguments using the Formatter, then adds the result to the
  43. * main text area.
  44. *
  45. * @param messageType The type of this message
  46. * @param args The arguments for the message
  47. */
  48. void addLine(StringBuffer messageType, Object... args);
  49. /**
  50. * Adds the specified raw line to the window, without using a formatter.
  51. *
  52. * @param line The line to be added
  53. * @param timestamp Whether or not to display the timestamp for this line
  54. */
  55. void addLine(final String line, final boolean timestamp);
  56. /**
  57. * Clears the main text area of the command window.
  58. */
  59. void clear();
  60. /**
  61. * Retrieves the config manager for this command window.
  62. *
  63. * @return This window's config manager
  64. */
  65. ConfigManager getConfigManager();
  66. /**
  67. * Retrieves the container that owns this command window.
  68. *
  69. * @return The container that owns this command window.
  70. */
  71. FrameContainer getContainer();
  72. /**
  73. * Determines if the current window is visible.
  74. *
  75. * @return boolean visibility
  76. */
  77. boolean isVisible();
  78. /**
  79. * Sets the visibility of this window.
  80. *
  81. * @param isVisible Whether the window should be visible or not
  82. */
  83. void setVisible(boolean isVisible);
  84. /**
  85. * Retrives the current title of this window.
  86. *
  87. * @return This window's title
  88. */
  89. String getTitle();
  90. /**
  91. * Determines if this frame is currently maximised.
  92. *
  93. * @return true if the frame is maximised, false otherwise
  94. */
  95. boolean isMaximum();
  96. /**
  97. * Sets the maximised state of this window.
  98. *
  99. * @param b true if the frame should be maximised, false otherwise
  100. * @throws PropertyVetoException if the change is vetoed
  101. */
  102. void setMaximum(boolean b) throws PropertyVetoException;
  103. /**
  104. * Sets the title of this window.
  105. *
  106. * @param title The new title to be used.
  107. */
  108. void setTitle(String title);
  109. /**
  110. * Opens this window.
  111. */
  112. void open();
  113. /**
  114. * Sets the icon used by this window, if the GUI supports icons.
  115. *
  116. * @param icon The icon to be used
  117. */
  118. void setFrameIcon(Icon icon);
  119. /**
  120. * Returns the transcoder that is being used by the UI.
  121. *
  122. * @return This window's transcoder
  123. */
  124. StringTranscoder getTranscoder();
  125. }