public class ViewManager extends Object implements Viewable, TitleChangedListener, ViewEventListener
The GNU General Public License for details.
Modifier and Type | Field and Description |
---|---|
static String |
CLEAR_VIEW |
static String |
CLOSE_ALL_VIEWS |
static String |
CLOSE_OTHER_VIEWS |
static String |
CLOSE_VIEW |
private ActionFactory |
contextActions |
private LayoutType |
current
The current way the views are laid out
|
private GridBagConstraints |
gbc
A shared, reusable constraint that makes its contents grow to fill the
area.
|
private ViewGenerator |
generator |
private static LayoutType |
initial
The initial layout state
|
private JRadioButtonMenuItem |
mdiView |
static String |
NEW_TAB |
private JPanel |
panel |
static String |
TAB_MODE |
private JRadioButtonMenuItem |
tdiView |
static String |
WINDOW_MODE |
Constructor and Description |
---|
ViewManager(ViewGenerator generator)
Construct a ViewManager.
|
Modifier and Type | Method and Description |
---|---|
Component |
addView()
Adds a view to the list in this Desktop.
|
void |
addView(Component component)
Add a view to the set.
|
void |
addViewEventListener(ViewEventListener listener)
Adds a view event listener for notification of any changes to the view.
|
void |
clear(Component view)
Reset a view so that it can be reused.
|
void |
closeAll()
Close all the views.
|
void |
closeOthers(Component component)
Close all the views but the one provided.
|
void |
doClearView()
Close the current passage window.
|
void |
doCloseAllViews()
Close all the passage windows.
|
void |
doCloseOtherViews()
Close all other passage windows.
|
void |
doCloseView()
Close the current passage window.
|
void |
doNewTab()
For creating a new window.
|
void |
doTabMode()
View the Tabbed Document Interface (TDI) interface.
|
void |
doWindowMode()
View the Multiple Document/Window Interface (MDI) interface.
|
(package private) Object |
getConstraint() |
Action |
getContextAction(String key)
Get a particular action by internal name
|
JPanel |
getDesktop() |
static int |
getInitialLayoutType()
What is the initial layout state?
|
private static LayoutType |
getInitialViewLayoutType()
Get the initial layout type.
|
JRadioButtonMenuItem |
getMdiView() |
Component |
getSelected()
Returns the top view.
|
JRadioButtonMenuItem |
getTdiView() |
Component |
getView(int i)
Get the view by position.
|
int |
getViewCount()
The number of views held by this layout.
|
AbstractViewLayout |
getViewLayout()
What is the current layout?
|
private LayoutType |
getViewLayoutType()
What is the current layout type?
|
Collection<Component> |
getViews()
Get a snapshot of the views as a collection.
|
Iterator<Component> |
iterator() |
void |
moveTo(AbstractViewLayout other)
Copies all the views from the one layout to the other
|
void |
removeView(Component view)
Remove a view from the set.
|
void |
removeViewEventListener(ViewEventListener listener)
Removes a view event listener.
|
void |
select(Component component)
Find the view and select it.
|
void |
setActionFactory(ActionFactory actions)
Before first use, the ViewGenerator must supply an action factory.
|
static void |
setInitialLayoutType(int initialLayout)
What should the initial layout state be?
|
void |
setLayoutType(LayoutType next)
Setup the current view
|
private void |
setViewLayoutType(LayoutType newLayoutType)
Set the current layout type
|
void |
titleChanged(TitleChangedEvent ev)
A Select pane is telling us that it has changed, and we might want to
update the BibleViewPane and the AbstractViewLayout to reflect any
potentially new titles
|
void |
updateTitle(Component component)
Update the title of the view.
|
void |
viewRemoved(ViewEvent event) |
void |
visit(ViewVisitor visitor)
Visit every view in the order that they were added.
|
public static final String TAB_MODE
public static final String WINDOW_MODE
public static final String NEW_TAB
public static final String CLEAR_VIEW
public static final String CLOSE_VIEW
public static final String CLOSE_ALL_VIEWS
public static final String CLOSE_OTHER_VIEWS
private static LayoutType initial
private ViewGenerator generator
private JPanel panel
private LayoutType current
private ActionFactory contextActions
private JRadioButtonMenuItem tdiView
private JRadioButtonMenuItem mdiView
private GridBagConstraints gbc
public ViewManager(ViewGenerator generator)
generator
- a ViewGenerator that this ViewManager manages.public void setActionFactory(ActionFactory actions)
actions
- the class for which i18n properties are definedpublic JPanel getDesktop()
public JRadioButtonMenuItem getMdiView()
public JRadioButtonMenuItem getTdiView()
public final void addView(Component component)
Viewable
public final Component addView()
public void closeAll()
Viewable
public void closeOthers(Component component)
Viewable
closeOthers
in interface Viewable
component
- the view that is to remain open.public Component getView(int i)
Viewable
public Collection<Component> getViews()
Viewable
public void moveTo(AbstractViewLayout other)
Viewable
public void updateTitle(Component component)
Viewable
updateTitle
in interface Viewable
component
- the component whose title is to be usedpublic void removeView(Component view)
Viewable
removeView
in interface Viewable
public void clear(Component view)
view
- the view to be clearedpublic void visit(ViewVisitor visitor)
Viewable
public int getViewCount()
Viewable
getViewCount
in interface Viewable
public Component getSelected()
Viewable
getSelected
in interface Viewable
public void select(Component component)
Viewable
private static LayoutType getInitialViewLayoutType()
private LayoutType getViewLayoutType()
private void setViewLayoutType(LayoutType newLayoutType)
public final AbstractViewLayout getViewLayout()
public void setLayoutType(LayoutType next)
public static int getInitialLayoutType()
public void viewRemoved(ViewEvent event)
viewRemoved
in interface ViewEventListener
public static void setInitialLayoutType(int initialLayout)
public void titleChanged(TitleChangedEvent ev)
TitleChangedListener
titleChanged
in interface TitleChangedListener
public final void addViewEventListener(ViewEventListener listener)
Viewable
addViewEventListener
in interface Viewable
listener
- the listenerpublic void removeViewEventListener(ViewEventListener listener)
Viewable
removeViewEventListener
in interface Viewable
listener
- the listenerpublic Action getContextAction(String key)
key
- the internal name for the actionfinal Object getConstraint()
public void doTabMode()
public void doWindowMode()
public void doNewTab()
public void doCloseView()
public void doClearView()
public void doCloseAllViews()
public void doCloseOtherViews()