Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.crosswire.common.swing.desktop
Class ViewManager

    java.lang.Object
      org.crosswire.common.swing.desktop.ViewManager

All Implemented Interfaces:
  EventListener, TitleChangedListener, ViewEventListener, Viewable

    public class ViewManager

extends Object
implements Viewable, TitleChangedListener, ViewEventListener

A ViewManager is an abstraction of a desktop that displays views as tabs or sub-windows. All the views are of the same type.

Distribution Licence: JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA The copyright to this program is held by it's authors.

Version:
  $Id: ViewManager.java,v 1.2 2004/09/21 17:45:47 dmsmith Exp $
Author:
  Joe Walker [joe at eireneh dot com], Mark Goodwin [mark at thorubio dot org], DM Smith [dmsmith555 at yahoo dot com]
See Also:
  `Licence`

Field Summary
`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`
`static String` | `OPEN`
`private JPanel` | `panel`
`static String` | `SAVE`
`static String` | `SAVE_ALL`
`static String` | `SAVE_AS`
`static String` | `TAB_MODE`
`private JRadioButtonMenuItem` | `tdiView`
`static String` | `WINDOW_MODE`

Constructor Summary
`ViewManager(ViewGenerator generator)` Construct a ViewManager.

Method Summary
`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.
`protected 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.
`ViewLayout` | `getViewLayout()` What is the current layout?
`private LayoutType` | `getViewLayoutType()` What is the current layout type?
`Collection` | `getViews()` Get a snapshot of the views as a collection.
`Iterator` | `iterator()` Get an iterator of a snapshot of views.
`void` | `moveTo(ViewLayout 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.
`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 ViewLayout 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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TAB_MODE

    public static final String TAB_MODE

See Also:
  Constant Field Values

### WINDOW_MODE

    public static final String WINDOW_MODE

See Also:
  Constant Field Values

### NEW_TAB

    public static final String NEW_TAB

See Also:
  Constant Field Values

### CLOSE_VIEW

    public static final String CLOSE_VIEW

See Also:
  Constant Field Values

### CLEAR_VIEW

    public static final String CLEAR_VIEW

See Also:
  Constant Field Values

### CLOSE_ALL_VIEWS

    public static final String CLOSE_ALL_VIEWS

See Also:
  Constant Field Values

### CLOSE_OTHER_VIEWS

    public static final String CLOSE_OTHER_VIEWS

See Also:
  Constant Field Values

### OPEN

    public static final String OPEN

See Also:
  Constant Field Values

### SAVE

    public static final String SAVE

See Also:
  Constant Field Values

### SAVE_AS

    public static final String SAVE_AS

See Also:
  Constant Field Values

### SAVE_ALL

    public static final String SAVE_ALL

See Also:
  Constant Field Values

### initial

    private static LayoutType initial

  The initial layout state

### generator

    private ViewGenerator generator

### panel

    private JPanel panel

### current

    private LayoutType current

  The current way the views are laid out

### contextActions

    private ActionFactory contextActions

### tdiView

    private JRadioButtonMenuItem tdiView

### mdiView

    private JRadioButtonMenuItem mdiView

### gbc

    private GridBagConstraints gbc

  A shared, reusable constraint that makes its contents grow to fill the area.

Constructor Detail

### ViewManager

    public ViewManager(ViewGenerator generator)

  Construct a ViewManager.

Method Detail

### getDesktop

    public JPanel getDesktop()

  Returns:
    the desktop

### getMdiView

    public JRadioButtonMenuItem getMdiView()

  Returns:
    Returns the mdiView.

### getTdiView

    public JRadioButtonMenuItem getTdiView()

  Returns:
    Returns the tdiView.

### addView

    public void addView(Component component)

  Description copied from interface: `Viewable`
  Add a view to the set.

  Specified by:
    `addView` in interface `Viewable`

### closeAll

    public void closeAll()

  Description copied from interface: `Viewable`
  Close all the views. Note the policy is enforced that one view is kept. This will keep the last one added.

  Specified by:
    `closeAll` in interface `Viewable`

### closeOthers

    public void closeOthers(Component component)

  Description copied from interface: `Viewable`
  Close all the views but the one provided.

  Specified by:
    `closeOthers` in interface `Viewable`
  Parameters:
    `component` - the view that is to remain open.

### getView

    public Component getView(int i)

  Description copied from interface: `Viewable`
  Get the view by position. Note that adding and removing views changes the indexes of the views. Do not use this for iteration as it is not thread safe.

  Specified by:
    `getView` in interface `Viewable`
  Parameters:
    `i` - the index of the view
  Returns:
    the requested view.

### getViews

    public Collection getViews()

  Description copied from interface: `Viewable`
  Get a snapshot of the views as a collection.

  Specified by:
    `getViews` in interface `Viewable`
  Returns:
    the views

### moveTo

    public void moveTo(ViewLayout other)

  Description copied from interface: `Viewable`
  Copies all the views from the one layout to the other

  Specified by:
    `moveTo` in interface `Viewable`
  Parameters:
    `other` - the other layout

### updateTitle

    public void updateTitle(Component component)

  Description copied from interface: `Viewable`
  Update the title of the view. If the component does not implement Titleable, then a generated title will be used.

  Specified by:
    `updateTitle` in interface `Viewable`
  Parameters:
    `component` - the component whose title is to be used

### addView

    public Component addView()

  Adds a view to the list in this Desktop.

### removeView

    public void removeView(Component view)

  Description copied from interface: `Viewable`
  Remove a view from the set.

  Specified by:
    `removeView` in interface `Viewable`

### clear

    public void clear(Component view)

  Reset a view so that it can be reused. If the Component does not implement Clearable, then nothing is done.

  Parameters:
    `view` - the view to be cleared

### iterator

    public Iterator iterator()

  Description copied from interface: `Viewable`
  Get an iterator of a snapshot of views.

  Specified by:
    `iterator` in interface `Viewable`
  Returns:
    an iterator over the views.

### visit

    public void visit(ViewVisitor visitor)

  Description copied from interface: `Viewable`
  Visit every view in the order that they were added.

  Specified by:
    `visit` in interface `Viewable`
  Parameters:
    `visitor` - The visitor for the view

### getViewCount

    public int getViewCount()

  Description copied from interface: `Viewable`
  The number of views held by this layout.

  Specified by:
    `getViewCount` in interface `Viewable`
  Returns:
    the number of views held by this layout

### getSelected

    public Component getSelected()

  Description copied from interface: `Viewable`
  Returns the top view. If no view is the top, it returns the first one added.

  Specified by:
    `getSelected` in interface `Viewable`

### select

    public void select(Component component)

  Description copied from interface: `Viewable`
  Find the view and select it.

  Specified by:
    `select` in interface `Viewable`

### getInitialViewLayoutType

    private static final LayoutType getInitialViewLayoutType()

  Get the initial layout type. This is to be used by "config"

### getViewLayoutType

    private final LayoutType getViewLayoutType()

  What is the current layout type?

### setViewLayoutType

    private final void setViewLayoutType(LayoutType newLayoutType)

  Set the current layout type

### getViewLayout

    public final ViewLayout getViewLayout()

  What is the current layout?

### setLayoutType

    public void setLayoutType(LayoutType next)

  Setup the current view

### getInitialLayoutType

    public static int getInitialLayoutType()

  What is the initial layout state?

### viewRemoved

    public void viewRemoved(ViewEvent event)

  Specified by:
    `viewRemoved` in interface `ViewEventListener`

### setInitialLayoutType

    public static void setInitialLayoutType(int initialLayout)

  What should the initial layout state be?

### titleChanged

    public void titleChanged(TitleChangedEvent ev)

  Description copied from interface: `TitleChangedListener`
  A Select pane is telling us that it has changed, and we might want to update the BibleViewPane and the ViewLayout to reflect any potentially new titles

  Specified by:
    `titleChanged` in interface `TitleChangedListener`

### addViewEventListener

    public void addViewEventListener(ViewEventListener listener)

  Description copied from interface: `Viewable`
  Adds a view event listener for notification of any changes to the view.

  Specified by:
    `addViewEventListener` in interface `Viewable`
  Parameters:
    `listener` - the listener

### removeViewEventListener

    public void removeViewEventListener(ViewEventListener listener)

  Description copied from interface: `Viewable`
  Removes a view event listener.

  Specified by:
    `removeViewEventListener` in interface `Viewable`
  Parameters:
    `listener` - the listener

### getContextAction

    public Action getContextAction(String key)

  Get a particular action by internal name

  Parameters:
    `key` - the internal name for the action
  Returns:
    the action requested or null if it does not exist

### getConstraint

    protected Object getConstraint()

### doTabMode

    public void doTabMode()

  View the Tabbed Document Interface (TDI) interface.

### doWindowMode

    public void doWindowMode()

  View the Multiple Document/Window Interface (MDI) interface.

### doNewTab

    public void doNewTab()

  For creating a new window.

### doCloseView

    public void doCloseView()

  Close the current passage window.

### doClearView

    public void doClearView()

  Close the current passage window.

### doCloseAllViews

    public void doCloseAllViews()

  Close all the passage windows.

### doCloseOtherViews

    public void doCloseOtherViews()

  Close all other passage windows.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ? 2003-2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD