Package com.jidesoft.dialog
Class AbstractPage
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- com.jidesoft.dialog.AbstractPage
-
- All Implemented Interfaces:
Laziness,java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,javax.accessibility.Accessible
- Direct Known Subclasses:
AbstractDialogPage
public abstract class AbstractPage extends javax.swing.JPanel implements Laziness
AbstractPage is an abstract base class that provides functionality to defer populating a JPanel object until it is actually viewed. This is very useful when using CardLayout and tab panel views which have several pages. Delaying the construction means it will start up fast. Sometimes delay means never. If subclasses choose to override any of the following methods, it is their responsibility to ensure their overridden methods call the parent's method first. The methods are:- public void paint (Graphics)
- public void paintComponents(Graphics)
- public void paintAll (Graphics)
- public void repaint ()
- public void repaint (long)
- public void repaint (int, int, int, int)
- public void repaint (long, int, int, int, int)
- public void update (Graphics)
- Added setInvokeCondition()
- Added addPageListener(), removePageListener() etc
so that subclass can fire
PageEvent
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description protected PageEvent_pageEventOnly oneDataChangeEventis needed per model instance since the event's only (read-only) state is the source property.static intINVOKE_ON_ALLUsed by setInvokeCondition().static intINVOKE_ON_NONEUsed by setInvokeCondition().static intINVOKE_ON_PAINTUsed by setInvokeCondition().static intINVOKE_ON_REPAINTUsed by setInvokeCondition().static intINVOKE_ON_UPDATEUsed by setInvokeCondition().static intINVOKE_ON_VALIDATEUsed by setInvokeCondition().-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractPage()Creates an AbstractPage.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPageListener(PageListener l)Adds aPageListenerto the page.booleanallowClosing()Allow this document closing.voidfirePageEvent(int id)Runs eachPageListener'spageEventFiredmethod.voidfirePageEvent(java.lang.Object source, int id)Runs eachPageListener'spageEventFiredmethod.intgetInvokeCondition()Gets the invoke condition.PageListener[]getPageListeners()Returns an array of all thePageListeners added to thisPagewithaddPageListener.voidinitialize()Force the lazyInitialize() method implemented in the child class to be called.voidinvalidate()voidpaint(java.awt.Graphics g)voidpaintAll(java.awt.Graphics g)voidpaintComponents(java.awt.Graphics g)voidremovePageListener(PageListener l)Removes aPageListenerfrom the page.voidrepaint()voidrepaint(int i1, int i2, int i3, int i4)voidrepaint(long l)voidrepaint(long l, int i1, int i2, int i3, int i4)voidreset()Resets the page which will result all child components being removed and the methodinitialize()being invoked again.voidrevalidate()voidsetAllowClosing(boolean allowClosing)Sets allow closing.voidsetInvokeCondition(int invokeCondition)Sets the invoke condition.voidupdate(java.awt.Graphics g)-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.jidesoft.dialog.Laziness
lazyInitialize
-
-
-
-
Field Detail
-
INVOKE_ON_ALL
public static int INVOKE_ON_ALL
Used by setInvokeCondition(). This value means initialize will be called in all paint/repaint/update methods.
-
INVOKE_ON_NONE
public static int INVOKE_ON_NONE
Used by setInvokeCondition(). This value means initialize will not be called. You have to call it manually.
-
INVOKE_ON_PAINT
public static int INVOKE_ON_PAINT
Used by setInvokeCondition(). This value means initialize will be called with paint() is called.
-
INVOKE_ON_REPAINT
public static int INVOKE_ON_REPAINT
Used by setInvokeCondition(). This value means initialize will be called with repaint() is called.
-
INVOKE_ON_UPDATE
public static int INVOKE_ON_UPDATE
Used by setInvokeCondition(). This value means initialize will be called with update() is called.
-
INVOKE_ON_VALIDATE
public static int INVOKE_ON_VALIDATE
Used by setInvokeCondition(). This value means initialize will be called with invalidate(), revalidate() is called.
-
_pageEvent
protected transient PageEvent _pageEvent
Only oneDataChangeEventis needed per model instance since the event's only (read-only) state is the source property. The source of events generated here is always "this".
-
-
Method Detail
-
getInvokeCondition
public int getInvokeCondition()
Gets the invoke condition. Invoke condition defines how lazy the page is. By default, the lazyInitialize() will be called on any update, paint or repaint method. However you can change the invoke condition to INVOKE_ON_PAINT. If so, lazyInitialize() will be called only when paint() method is called. You can even set the invoke condition to INVOKE_ON_NONE. If so, you will be responsible to call lazyInitialize() since none of those methods methods mentioned above will call lazyInitialize().- Returns:
- the invocation condition
-
setInvokeCondition
public void setInvokeCondition(int invokeCondition)
Sets the invoke condition.- Parameters:
invokeCondition- the invoke condition.
-
invalidate
public void invalidate()
- Overrides:
invalidatein classjava.awt.Container
-
revalidate
public void revalidate()
- Overrides:
revalidatein classjavax.swing.JComponent
-
paint
public void paint(java.awt.Graphics g)
- Overrides:
paintin classjavax.swing.JComponent
-
paintAll
public void paintAll(java.awt.Graphics g)
- Overrides:
paintAllin classjava.awt.Component
-
paintComponents
public void paintComponents(java.awt.Graphics g)
- Overrides:
paintComponentsin classjava.awt.Container
-
repaint
public void repaint()
- Overrides:
repaintin classjava.awt.Component
-
repaint
public void repaint(long l)
- Overrides:
repaintin classjava.awt.Component
-
repaint
public void repaint(int i1, int i2, int i3, int i4)- Overrides:
repaintin classjava.awt.Component
-
repaint
public void repaint(long l, int i1, int i2, int i3, int i4)- Overrides:
repaintin classjavax.swing.JComponent
-
update
public void update(java.awt.Graphics g)
- Overrides:
updatein classjavax.swing.JComponent
-
initialize
public final void initialize()
Force the lazyInitialize() method implemented in the child class to be called. If this method is called more than once on a given object, all calls but the first do nothing.
-
reset
public void reset()
Resets the page which will result all child components being removed and the methodinitialize()being invoked again.- Since:
- 3.2.2
-
addPageListener
public void addPageListener(PageListener l)
Adds aPageListenerto the page.- Parameters:
l- thePageListenerto be added
-
removePageListener
public void removePageListener(PageListener l)
Removes aPageListenerfrom the page.- Parameters:
l- thePageListenerto be removed
-
getPageListeners
public PageListener[] getPageListeners()
Returns an array of all thePageListeners added to thisPagewithaddPageListener.- Returns:
- all of the
PageListeners added, or an empty array if no listeners have been added
-
firePageEvent
public void firePageEvent(int id)
Runs eachPageListener'spageEventFiredmethod.- Parameters:
id- event id.
-
firePageEvent
public void firePageEvent(java.lang.Object source, int id)Runs eachPageListener'spageEventFiredmethod.- Parameters:
source- of this eventid- event id.
-
setAllowClosing
public void setAllowClosing(boolean allowClosing)
Sets allow closing. If true, the document cannot be closed. user can change the value in documentClosing() to prevent document from being closed.- Parameters:
allowClosing- true or false.
-
allowClosing
public boolean allowClosing()
Allow this document closing. By default it return true. User can override this method to return based on condition. A typical user case is: add a DocumentComponentListener. In documentComponentClosing, make this method return to false to prevent it from being closed.- Returns:
- whether allow closing
-
-