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.9KB

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