Class McbsEditor

java.lang.Object
com.thecsdev.betterstats.api.mcbs.controller.McbsEditor

public final class McbsEditor extends Object
This Class functions as the central controller in the MVC architecture, overseeing the complete editor interface. It coordinates and manages all McbsEditorTab instances contained within the editor, effectively representing the entire graphical user interface (GUI).
  • Field Details

  • Constructor Details

    • McbsEditor

      public McbsEditor()
  • Method Details

    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getEditCount

      public final long getEditCount()
      Returns the total number of edits made via McbsEditor. This value increments each time a change occurs within this editor, such as adding/removing tabs or modifying tab content.

      This can be used to track changes and determine if this editor's state has been modified since it was last checked.

    • addEditCount

      public final void addEditCount()
      Incrementing the getEditCount() value.

      This method is automatically invoked whenever a modification occurs within this editor. It is generally not necessary to call this method manually unless you have made a direct change that was not performed through this McbsEditor interface.

      See Also:
    • getTabsReadOnly

      public final Collection<McbsEditorTab> getTabsReadOnly()
      Returns an unmodifiable Collection containing all the McbsEditorTab instances that are currently open within this editor.

      To add or remove McbsEditorTabs, please refer to "See Also".

      See Also:
    • addTab

      public final boolean addTab(@NotNull @NotNull McbsEditorTab tab, boolean setAsCurrent) throws NullPointerException
      Attempts to add the specified McbsEditorTab within this editor.
      Parameters:
      tab - The McbsEditorTab to be opened.
      setAsCurrent - If true, the newly added tab will be set as the current tab.
      Returns:
      true if the tab was successfully opened; false if the tab could not be added.
      Throws:
      NullPointerException - If the argument is null.
    • removeTab

      public final boolean removeTab(@NotNull @NotNull McbsEditorTab tab) throws NullPointerException
      Attempts to remove the specified McbsEditorTab from this editor.
      Parameters:
      tab - The McbsEditorTab to be removed.
      Returns:
      true if the tab was successfully removed; false if the tab could not be removed.
      Throws:
      NullPointerException - If the argument is null.
    • getCurrentTab

      @NotNull public final @NotNull McbsEditorTab getCurrentTab()
      Returns the current McbsEditorTab being edited by this McbsEditor.
    • setCurrentTab

      public final void setCurrentTab(@Nullable @Nullable McbsEditorTab tab)
      Sets the current McbsEditorTab being edited by this McbsEditor.
      Parameters:
      tab - The McbsEditorTab to set as the current tab. Must be contained by getTabsReadOnly().