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.

WindowModel.java 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * Copyright (c) 2006-2015 DMDirc Developers
  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.interfaces;
  23. import com.dmdirc.interfaces.config.AggregateConfigProvider;
  24. import com.dmdirc.ui.messages.BackBuffer;
  25. import com.dmdirc.ui.messages.UnreadStatusManager;
  26. import java.util.Optional;
  27. import java.util.Set;
  28. /**
  29. * Models the state of a window.
  30. */
  31. public interface WindowModel {
  32. /**
  33. * Gets a unique ID that identifies this window.
  34. *
  35. * @return This window's unique ID.
  36. */
  37. String getId();
  38. /**
  39. * Sets the ID for this window. This may only be called once; attempting to overwrite a
  40. * previous ID will throw an exception.
  41. *
  42. * @param id The new ID for this window.
  43. */
  44. void setId(String id);
  45. String getIcon();
  46. String getName();
  47. String getTitle();
  48. AggregateConfigProvider getConfigManager();
  49. EventBus getEventBus();
  50. /**
  51. * Changes the name of this container.
  52. *
  53. * @param name The new name for this frame.
  54. */
  55. void setName(String name);
  56. /**
  57. * Changes the title of this container.
  58. *
  59. * @param title The new title for this frame.
  60. */
  61. void setTitle(String title);
  62. /**
  63. * Returns the collection of UI component identifiers that this frame container requires for its
  64. * display.
  65. *
  66. * @since 0.6.6
  67. * @return Collection of UI component identifiers
  68. */
  69. Set<String> getComponents();
  70. /**
  71. * Adds a new component to this container.
  72. *
  73. * @since 0.6.6
  74. * @param component The component to be added
  75. */
  76. void addComponent(String component);
  77. /**
  78. * Removes a component from this container.
  79. *
  80. * @since 0.6.6
  81. * @param component The component to be removed
  82. */
  83. void removeComponent(String component);
  84. /**
  85. * Closes this container (and its associated frame).
  86. */
  87. void close();
  88. /**
  89. * Returns the connection that this container is associated with.
  90. *
  91. * @return the associated connection.
  92. */
  93. Optional<Connection> getConnection();
  94. /**
  95. * Sets the icon to be used by this window.
  96. *
  97. * @param icon The new icon to be used
  98. */
  99. void setIcon(String icon);
  100. /**
  101. * Gets the back buffer for this container.
  102. *
  103. * @return This container's back buffer.
  104. */
  105. BackBuffer getBackBuffer();
  106. /**
  107. * Returns the model used to define input parameters for this window.
  108. *
  109. * @return If this window accepts input, the input model to use, otherwise an empty optional.
  110. */
  111. Optional<InputModel> getInputModel();
  112. /**
  113. * Returns the manager tracking this window's unread messages.
  114. *
  115. * @return The unread status manager for this window.
  116. */
  117. UnreadStatusManager getUnreadStatusManager();
  118. }