Gridarta Editor
net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel Class Reference

A Component that always displays another component and optionally a number of tabs around it. More...

+ Inheritance diagram for net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel:
+ Collaboration diagram for net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel:

Public Member Functions

void addTab (@NotNull final Tab tab)
 Adds a tab. More...
 
Tab getActiveTab (@NotNull final Location location, final boolean alternativeLocation)
 Returns the active Tab on a given Location of the main view. More...
 
void moveTab (@NotNull final Tab tab, @NotNull final Location location)
 Moves the tab to the given location. More...
 
void setTabSplitMode (@NotNull final Tab tab, final boolean splitMode)
 Toggles split mode for the given tab. More...
 
 TabbedPanel (@NotNull final Component centerComponent)
 Creates a new instance. More...
 

Private Member Functions

void close (@NotNull final Tab tab)
 Closes a Tab. More...
 
void closeInt (final Tab tab)
 Closes a Tab but does not update the tab's open status. More...
 
void fillContextMenu (@NotNull final Tab tab, final boolean initialize)
 Fills in context popup menu entries for a tab in a given location. More...
 
void open (@NotNull final Tab tab)
 Opens a Tab. More...
 
void tabAdded (@NotNull final Tab tab, @NotNull final DoubleButtonList buttonList, final boolean open)
 Called whenever a Tab has been added to a ButtonList. More...
 
void tabRemoved (@NotNull final DoubleButtonList buttonList)
 Called whenever a Tab has been added from a ButtonList. More...
 

Private Attributes

final BorderPanel borderPanel
 The BorderPanel. More...
 
final ButtonLists buttonLists = new ButtonLists(buttonListsListener)
 The list of buttons for each Location. More...
 
final ButtonListsListener buttonListsListener
 The ButtonListsListener attached to buttonLists. More...
 
final Map< Component, TabopenTabs = new IdentityHashMap<>()
 The Tabs currently shown in borderPanel. More...
 

Static Private Attributes

static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
 The ActionBuilder. More...
 
static final Preferences PREFERENCES = Preferences.userNodeForPackage(MainControl.class)
 The Preferences. More...
 
static final long serialVersionUID = 1L
 The serial version UID. More...
 
static final String TAB_PREFIX = "MainWindow.tab"
 The key used to store the preferred height of a tab. More...
 

Detailed Description

A Component that always displays another component and optionally a number of tabs around it.

Each tab has an associated component which is shown while the tab is active.

Author
Andreas Kirschbaum

Definition at line 47 of file TabbedPanel.java.

Constructor & Destructor Documentation

◆ TabbedPanel()

net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.TabbedPanel ( @NotNull final Component  centerComponent)

Member Function Documentation

◆ addTab()

void net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.addTab ( @NotNull final Tab  tab)

◆ close()

void net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.close ( @NotNull final Tab  tab)
private

Closes a Tab.

Parameters
tabthe tab

Definition at line 264 of file TabbedPanel.java.

References net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.closeInt().

+ Here is the call graph for this function:

◆ closeInt()

void net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.closeInt ( final Tab  tab)
private

◆ fillContextMenu()

void net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.fillContextMenu ( @NotNull final Tab  tab,
final boolean  initialize 
)
private

Fills in context popup menu entries for a tab in a given location.

Parameters
tabthe tab
initializewhether this is the initial call

Definition at line 230 of file TabbedPanel.java.

References net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.ACTION_BUILDER, and net.sf.gridarta.gui.utils.MenuUtils.removeAll().

Referenced by net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.addTab(), and net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.moveTab().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActiveTab()

Tab net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.getActiveTab ( @NotNull final Location  location,
final boolean  alternativeLocation 
)

Returns the active Tab on a given Location of the main view.

Parameters
locationthe location
alternativeLocationwhether the alternative location should be checked
Returns
the tab or
null
if no active tab exists

Definition at line 154 of file TabbedPanel.java.

References net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.buttonLists, and net.sf.gridarta.gui.utils.tabbedpanel.ButtonLists.getActiveTab().

Referenced by net.sf.gridarta.gui.misc.MainView.getActiveTab().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveTab()

◆ open()

void net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.open ( @NotNull final Tab  tab)
private

◆ setTabSplitMode()

void net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.setTabSplitMode ( @NotNull final Tab  tab,
final boolean  splitMode 
)

Toggles split mode for the given tab.

Parameters
tabthe tab
splitModewhether to enable split mode

Definition at line 183 of file TabbedPanel.java.

References net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.buttonLists, net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.open(), net.sf.gridarta.gui.utils.tabbedpanel.DoubleButtonList.selectButton(), and net.sf.gridarta.gui.utils.tabbedpanel.ButtonLists.toggleTabSplitMode().

Referenced by net.sf.gridarta.gui.utils.tabbedpanel.MoveToActions.setTabSplitMode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tabAdded()

void net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.tabAdded ( @NotNull final Tab  tab,
@NotNull final DoubleButtonList  buttonList,
final boolean  open 
)
private

Called whenever a Tab has been added to a ButtonList.

Shows the button list component if the first tab has been added.

Parameters
tabthe tab
buttonListthe button list
openwhether the tab is open

Definition at line 202 of file TabbedPanel.java.

References net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.open().

Referenced by net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.addTab(), and net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.moveTab().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tabRemoved()

void net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.tabRemoved ( @NotNull final DoubleButtonList  buttonList)
private

Called whenever a Tab has been added from a ButtonList.

Hides the button list component if the last tab has been removed.

Parameters
buttonListthe button list

Definition at line 218 of file TabbedPanel.java.

Referenced by net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.moveTab().

+ Here is the caller graph for this function:

Member Data Documentation

◆ ACTION_BUILDER

final ActionBuilder net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
staticprivate

◆ borderPanel

final BorderPanel net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.borderPanel
private

◆ buttonLists

◆ buttonListsListener

final ButtonListsListener net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.buttonListsListener
private
Initial value:
= (prevTab, tab) -> {
if (prevTab != null) {
close(prevTab);
}
if (tab != null) {
open(tab);
}
}

The ButtonListsListener attached to buttonLists.

Definition at line 89 of file TabbedPanel.java.

◆ openTabs

final Map<Component, Tab> net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.openTabs = new IdentityHashMap<>()
private

◆ PREFERENCES

final Preferences net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.PREFERENCES = Preferences.userNodeForPackage(MainControl.class)
staticprivate

◆ serialVersionUID

final long net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.serialVersionUID = 1L
staticprivate

The serial version UID.

Definition at line 58 of file TabbedPanel.java.

◆ TAB_PREFIX

final String net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.TAB_PREFIX = "MainWindow.tab"
staticprivate

The key used to store the preferred height of a tab.

Definition at line 53 of file TabbedPanel.java.

Referenced by net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.TabbedPanel().


The documentation for this class was generated from the following file:
net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.open
void open(@NotNull final Tab tab)
Opens a Tab.
Definition: TabbedPanel.java:254
net.sf.gridarta.gui.utils.tabbedpanel.TabbedPanel.close
void close(@NotNull final Tab tab)
Closes a Tab.
Definition: TabbedPanel.java:264