|
||||||||||
| 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 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(Component comp,
String constraints)
|
void |
addLayoutComponent(String name,
Component comp)
|
protected void |
fireCardChangedListenerEvent(CardChangeEvent e)
|
protected void |
fireCardChangeListenerEvent(CardChangeEvent e)
Fire an event |
Component |
getComponent(String name)
Get the name of a component |
Container |
getContainer()
|
String |
getName(Component comp)
Get the name of a component |
Component |
getVisibleComponent()
Get the currently visible component |
String |
getVisibleComponentName()
Get the name of the currently visible component |
void |
layoutContainer(Container parent)
hook in to get the container we're showing |
void |
removeCardChangedListener(CardChangedListener ccl)
|
void |
removeCardChangeListener(CardChangeListener ccl)
Remove a listener |
void |
removeLayoutComponent(Component comp)
|
void |
show(Container parent,
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 String SOURCECODE_VERSION
| Constructor Detail |
|---|
public CardLayout()
public CardLayout(int hgap,
int vgap)
hgap - vgap - | Method Detail |
|---|
public Container getContainer()
public void addLayoutComponent(String name,
Component comp)
addLayoutComponent in interface LayoutManageraddLayoutComponent in class CardLayoutname - comp -
public void addLayoutComponent(Component comp,
String constraints)
comp - constraints - public void removeLayoutComponent(Component comp)
removeLayoutComponent in interface LayoutManagerremoveLayoutComponent in class CardLayoutpublic void layoutContainer(Container parent)
layoutContainer in interface LayoutManagerlayoutContainer in class CardLayoutpublic Component getVisibleComponent()
public String getVisibleComponentName()
public String getName(Component comp)
comp -
public Component getComponent(String name)
comp -
public void show(Container parent,
String name)
show in class 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 | |||||||||