|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.CardLayout
org.tbee.swing.cardlayout.CardLayout
public class CardLayout
A extension to CardLayout that can return a component's name.
Furthermore it adds a CardChangeEvent so components can react when they are shown.
This is especially useful for implementing loading-on-demand:
- the regular "updateCard" method is reduced to a just-store-all-I-need-to-know-to-refresh
- a second "updateCardDelayed" method is added where, based on the stored data, the card is updated
- the card registers itself to the CardLayout and listens for CardChangeEvents
- is the "now visible" component in an event equal to the card, the updateCardDelayed method should be called.
- Note: at the end of the "updateCard" method, it should check if the card is already visible.
If so, "updateCardDelayed" should be called immediately (since the card is already visible, there will be no event)!
| Field Summary | |
|---|---|
static java.lang.String |
SOURCECODE_VERSION
Standard variable for determining version of a class file. |
| Constructor Summary | |
|---|---|
CardLayout()
|
|
CardLayout(int hgap,
int vgap)
|
|
| Method Summary | |
|---|---|
void |
addCardChangedListener(CardChangedListener ccl)
Add a listener |
void |
addCardChangeListener(CardChangeListener ccl)
Add a listener |
void |
addLayoutComponent(java.awt.Component comp,
java.lang.String constraints)
|
void |
addLayoutComponent(java.lang.String name,
java.awt.Component comp)
|
protected void |
fireCardChangedListenerEvent(CardChangeEvent e)
|
protected void |
fireCardChangeListenerEvent(CardChangeEvent e)
Fire an event |
java.awt.Component |
getComponent(java.lang.String name)
Get the name of a component |
java.awt.Container |
getContainer()
|
java.lang.String |
getName(java.awt.Component comp)
Get the name of a component |
java.awt.Component |
getVisibleComponent()
Get the currently visible component |
java.lang.String |
getVisibleComponentName()
Get the name of the currently visible component |
void |
layoutContainer(java.awt.Container parent)
hook in to get the container we're showing |
void |
removeCardChangedListener(CardChangedListener ccl)
|
void |
removeCardChangeListener(CardChangeListener ccl)
Remove a listener |
void |
removeLayoutComponent(java.awt.Component comp)
|
void |
show(java.awt.Container parent,
java.lang.String name)
This method is overriden to provide the hook-in for the event listeners |
| Methods inherited from class java.awt.CardLayout |
|---|
addLayoutComponent, first, getHgap, getLayoutAlignmentX, getLayoutAlignmentY, getVgap, invalidateLayout, last, maximumLayoutSize, minimumLayoutSize, next, preferredLayoutSize, previous, setHgap, setVgap, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String SOURCECODE_VERSION
| Constructor Detail |
|---|
public CardLayout()
public CardLayout(int hgap,
int vgap)
hgap - vgap - | Method Detail |
|---|
public java.awt.Container getContainer()
public void addLayoutComponent(java.lang.String name,
java.awt.Component comp)
addLayoutComponent in interface java.awt.LayoutManageraddLayoutComponent in class java.awt.CardLayoutname - comp -
public void addLayoutComponent(java.awt.Component comp,
java.lang.String constraints)
comp - constraints - public void removeLayoutComponent(java.awt.Component comp)
removeLayoutComponent in interface java.awt.LayoutManagerremoveLayoutComponent in class java.awt.CardLayoutpublic void layoutContainer(java.awt.Container parent)
layoutContainer in interface java.awt.LayoutManagerlayoutContainer in class java.awt.CardLayoutpublic java.awt.Component getVisibleComponent()
public java.lang.String getVisibleComponentName()
public java.lang.String getName(java.awt.Component comp)
comp -
public java.awt.Component getComponent(java.lang.String name)
comp -
public void show(java.awt.Container parent,
java.lang.String name)
show in class java.awt.CardLayoutpublic void addCardChangeListener(CardChangeListener ccl)
ccl - public void removeCardChangeListener(CardChangeListener ccl)
ccl - protected void fireCardChangeListenerEvent(CardChangeEvent e)
e - public void addCardChangedListener(CardChangedListener ccl)
ccl - public void removeCardChangedListener(CardChangedListener ccl)
protected void fireCardChangedListenerEvent(CardChangeEvent e)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||