|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.common.swing.desktop.AbstractViewLayout
public abstract class AbstractViewLayout
Abstract manager of how we layout views.
The GNU General Public License for details.
Field Summary | |
---|---|
private static int |
base
A shared counter for creating unknown titles. |
private EventListenerList |
listenerList
The listeners for handling ViewEvent Listeners |
private static int |
MAX_TITLE_LEN
The maximum length of a title before it is abbreviated |
private JPanel |
panel
The panel into which all components are placed. |
private List<Component> |
views
The list of views. |
Constructor Summary | |
---|---|
protected |
AbstractViewLayout()
This constructor is protected because it only needs to be seen by the sub classes |
Method Summary | |
---|---|
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 |
closeAll()
Close all the views. |
void |
closeOthers(Component component)
Close all the views but the one provided. |
void |
fireViewRemoved(ViewEvent e)
Notify the listeners that the view has been removed. |
protected void |
forceRemoveView(Component component)
Unconditionally remove a view from the set. |
private String |
generateTitle()
Generates a generic title |
protected Object |
getConstraint()
A constraint that allows the panel to be filled up, stretching horizontally and vertically. |
protected JPanel |
getPanel()
All parts are put into a panel. |
abstract Component |
getSelected()
Returns the top view. |
protected String |
getTitle(Component component)
Get the title from the component, truncating it if necessary. |
Component |
getView(int i)
Get the view by position. |
int |
getViewCount()
The number of views held by this layout. |
Collection<Component> |
getViews()
Get a snapshot of the views as a collection. |
Iterator<Component> |
iterator()
Get an iterator of a snapshot of views. |
void |
moveTo(AbstractViewLayout other)
Copies all the views from the one layout to the other |
void |
removeView(Component component)
Remove a view from the set. |
void |
removeViewEventListener(ViewEventListener listener)
Removes a view event listener. |
abstract void |
select(Component component)
Find the view and select it. |
abstract void |
updateTitle(Component component)
Update the title of the view. |
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 |
---|
private List<Component> views
private EventListenerList listenerList
private static final int MAX_TITLE_LEN
private static int base
private JPanel panel
Constructor Detail |
---|
protected AbstractViewLayout()
Method Detail |
---|
public void addView(Component component)
addView
in interface Viewable
public void removeView(Component component)
removeView
in interface Viewable
protected void forceRemoveView(Component component)
public Collection<Component> getViews()
getViews
in interface Viewable
public Iterator<Component> iterator()
iterator
in interface Iterable<Component>
public void moveTo(AbstractViewLayout other)
moveTo
in interface Viewable
other
- the other layoutpublic void closeAll()
closeAll
in interface Viewable
public void closeOthers(Component component)
closeOthers
in interface Viewable
component
- the view that is to remain open.public void visit(ViewVisitor visitor)
visit
in interface Viewable
visitor
- The visitor for the viewpublic abstract void updateTitle(Component component)
updateTitle
in interface Viewable
component
- the component whose title is to be usedpublic abstract Component getSelected()
getSelected
in interface Viewable
public abstract void select(Component component)
select
in interface Viewable
component
- public int getViewCount()
getViewCount
in interface Viewable
public Component getView(int i)
getView
in interface Viewable
i
- the index of the view
protected String getTitle(Component component)
component
- from whom the title is gotten
private String generateTitle()
protected JPanel getPanel()
protected Object getConstraint()
public void addViewEventListener(ViewEventListener listener)
addViewEventListener
in interface Viewable
listener
- the listenerpublic void removeViewEventListener(ViewEventListener listener)
removeViewEventListener
in interface Viewable
listener
- the listenerpublic void fireViewRemoved(ViewEvent e)
e
- the eventEventListenerList
|
Copyright ยจ 2003-2015 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |