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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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.DMDircMBassador;
  24. import com.dmdirc.events.FrameIconChangedEvent;
  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. String getIcon();
  36. String getName();
  37. String getTitle();
  38. AggregateConfigProvider getConfigManager();
  39. DMDircMBassador getEventBus();
  40. /**
  41. * Changes the title of this container, and fires a {@link FrameTitleChangedEvent}.
  42. *
  43. * @param title The new title for this frame.
  44. */
  45. void setTitle(String title);
  46. /**
  47. * Returns the collection of UI component identifiers that this frame container requires for its
  48. * display.
  49. *
  50. * @since 0.6.6
  51. * @return Collection of UI component identifiers
  52. */
  53. Set<String> getComponents();
  54. /**
  55. * Adds a new component to this container.
  56. *
  57. * @since 0.6.6
  58. * @param component The component to be added
  59. */
  60. void addComponent(String component);
  61. /**
  62. * Removes a component from this container.
  63. *
  64. * @since 0.6.6
  65. * @param component The component to be removed
  66. */
  67. void removeComponent(String component);
  68. /**
  69. * Closes this container (and its associated frame).
  70. */
  71. void close();
  72. /**
  73. * Returns the connection that this container is associated with.
  74. *
  75. * @return the associated connection.
  76. */
  77. Optional<Connection> getConnection();
  78. /**
  79. * Sets the icon to be used by this frame container and fires a {@link FrameIconChangedEvent}.
  80. *
  81. * @param icon The new icon to be used
  82. */
  83. void setIcon(String icon);
  84. /**
  85. * Gets the back buffer for this container.
  86. *
  87. * @return This container's back buffer.
  88. */
  89. BackBuffer getBackBuffer();
  90. /**
  91. * Returns the model used to define input parameters for this window.
  92. *
  93. * @return If this window accepts input, the input model to use, otherwise an empty optional.
  94. */
  95. Optional<InputModel> getInputModel();
  96. UnreadStatusManager getUnreadStatusManager();
  97. }