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,ImageObserver,MenuContainer,Serializable,Accessible
- Direct Known Subclasses:
AbstractDialogPage
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PageEventOnly oneDataChangeEventis needed per model instance since the event's only (read-only) state is the source property.static intUsed by setInvokeCondition().static intUsed by setInvokeCondition().static intUsed by setInvokeCondition().static intUsed by setInvokeCondition().static intUsed by setInvokeCondition().static intUsed 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_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds aPageListenerto the page.booleanAllow this document closing.voidfirePageEvent(int id) Runs eachPageListener'spageEventFiredmethod.voidfirePageEvent(Object source, int id) Runs eachPageListener'spageEventFiredmethod.intGets the invoke condition.Returns an array of all thePageListeners added to thisPagewithaddPageListener.final voidForce the lazyInitialize() method implemented in the child class to be called.voidvoidvoidvoidvoidRemoves 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.voidvoidsetAllowClosing(boolean allowClosing) Sets allow closing.voidsetInvokeCondition(int invokeCondition) Sets the invoke condition.voidMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, unregisterKeyboardActionMethods 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, validateTreeMethods 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, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.jidesoft.dialog.Laziness
lazyInitialize
-
Field Details
-
INVOKE_ON_ALL
public static int INVOKE_ON_ALLUsed by setInvokeCondition(). This value means initialize will be called in all paint/repaint/update methods. -
INVOKE_ON_NONE
public static int INVOKE_ON_NONEUsed by setInvokeCondition(). This value means initialize will not be called. You have to call it manually. -
INVOKE_ON_PAINT
public static int INVOKE_ON_PAINTUsed by setInvokeCondition(). This value means initialize will be called with paint() is called. -
INVOKE_ON_REPAINT
public static int INVOKE_ON_REPAINTUsed by setInvokeCondition(). This value means initialize will be called with repaint() is called. -
INVOKE_ON_UPDATE
public static int INVOKE_ON_UPDATEUsed by setInvokeCondition(). This value means initialize will be called with update() is called. -
INVOKE_ON_VALIDATE
public static int INVOKE_ON_VALIDATEUsed by setInvokeCondition(). This value means initialize will be called with invalidate(), revalidate() is called. -
_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".
-
-
Constructor Details
-
AbstractPage
protected AbstractPage()Creates an AbstractPage.
-
-
Method Details
-
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 classContainer
-
revalidate
public void revalidate()- Overrides:
revalidatein classJComponent
-
paint
- Overrides:
paintin classJComponent
-
paintAll
-
paintComponents
- Overrides:
paintComponentsin classContainer
-
repaint
public void repaint() -
repaint
public void repaint(long l) -
repaint
public void repaint(int i1, int i2, int i3, int i4) -
repaint
public void repaint(long l, int i1, int i2, int i3, int i4) - Overrides:
repaintin classJComponent
-
update
- Overrides:
updatein classJComponent
-
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
Adds aPageListenerto the page.- Parameters:
l- thePageListenerto be added
-
removePageListener
Removes aPageListenerfrom the page.- Parameters:
l- thePageListenerto be removed
-
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
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
-