Class AbstractCompositeComponent
- All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable
,com.globalmentor.beans.PropertyConstrainable
,io.clogr.Clogged
,Component
,CompositeComponent
,Displayable
,InfoModel
,LabelModel
,Model
,PresentationModel
,DepictedObject
- Direct Known Subclasses:
AbstractMultipleCompositeComponent
,AbstractSingleCompositeComponent
AbstractListCompositeComponent.addComponent(Component)
and AbstractLayoutComponent.removeComponent(Component)
, although other actions may take
place. This version listens for the Component.VALID_PROPERTY
of each child component and updates the valid status of this component in response. This
version listens for child notifications and fires a copy of the NotificationEvent
, retaining the original event target. This version listens for
child components being added or removed and fires a copy of the ComponentEvent
, retaining the original event target.- Author:
- Garret Wilson
-
Nested Class Summary
Nested classes/interfaces inherited from class io.guise.framework.component.AbstractComponent
AbstractComponent.AbstractFlyoverFrameStrategy<S extends Component>, AbstractComponent.AbstractFlyoverStrategy<S extends Component>, AbstractComponent.DefaultFlyoverStrategy<S extends Component>
Nested classes/interfaces inherited from interface io.guise.framework.component.Component
Component.FlyoverStrategy<S extends Component>
-
Field Summary
Fields inherited from class com.globalmentor.beans.BoundPropertyObject
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
Fields inherited from interface io.guise.framework.component.Component
BOOKMARK_ENABLED_PROPERTY, CONSTRAINTS_PROPERTY, DRAG_ENABLED_PROPERTY, DROP_ENABLED_PROPERTY, FLYOVER_ENABLED_PROPERTY, FLYOVER_STRATEGY_PROPERTY, INPUT_STRATEGY_PROPERTY, NAME_PROPERTY, NOTIFICATION_PROPERTY, ORIENTATION_PROPERTY, THEME_APPLIED_PROPERTY, VALID_PROPERTY
Fields inherited from interface io.guise.framework.model.Displayable
DISPLAYED_PROPERTY
Fields inherited from interface io.guise.framework.model.InfoModel
DESCRIPTION_CONTENT_TYPE_PROPERTY, DESCRIPTION_PROPERTY, INFO_CONTENT_TYPE_PROPERTY, INFO_PROPERTY
Fields inherited from interface io.guise.framework.model.LabelModel
GLYPH_URI_PROPERTY, LABEL_CONTENT_TYPE_PROPERTY, LABEL_PROPERTY
Fields inherited from interface io.guise.framework.model.ui.PresentationModel
BACKGROUND_COLOR_PROPERTY, BORDER_LINE_FAR_COLOR_PROPERTY, BORDER_LINE_FAR_EXTENT_PROPERTY, BORDER_LINE_FAR_STYLE_PROPERTY, BORDER_LINE_NEAR_COLOR_PROPERTY, BORDER_LINE_NEAR_EXTENT_PROPERTY, BORDER_LINE_NEAR_STYLE_PROPERTY, BORDER_PAGE_FAR_COLOR_PROPERTY, BORDER_PAGE_FAR_EXTENT_PROPERTY, BORDER_PAGE_FAR_STYLE_PROPERTY, BORDER_PAGE_NEAR_COLOR_PROPERTY, BORDER_PAGE_NEAR_EXTENT_PROPERTY, BORDER_PAGE_NEAR_STYLE_PROPERTY, CORNER_LINE_FAR_PAGE_FAR_ARC_SIZE_PROPERTY, CORNER_LINE_FAR_PAGE_NEAR_ARC_SIZE_PROPERTY, CORNER_LINE_NEAR_PAGE_FAR_ARC_SIZE_PROPERTY, CORNER_LINE_NEAR_PAGE_NEAR_ARC_SIZE_PROPERTY, CURSOR_PROPERTY, FONT_FAMILIES_PROPERTY, FONT_SIZE_PROPERTY, FONT_STYLE_PROPERTY, FONT_WEIGHT_BOLD, FONT_WEIGHT_NORMAL, FONT_WEIGHT_PROPERTY, LABEL_FONT_FAMILIES_PROPERTY, LABEL_FONT_SIZE_PROPERTY, LABEL_FONT_STYLE_PROPERTY, LABEL_FONT_WEIGHT_PROPERTY, LABEL_TEXT_COLOR_PROPERTY, LINE_EXTENT_PROPERTY, MARGIN_LINE_FAR_EXTENT_PROPERTY, MARGIN_LINE_NEAR_EXTENT_PROPERTY, MARGIN_PAGE_FAR_EXTENT_PROPERTY, MARGIN_PAGE_NEAR_EXTENT_PROPERTY, OPACITY_PROPERTY, PADDING_LINE_FAR_EXTENT_PROPERTY, PADDING_LINE_NEAR_EXTENT_PROPERTY, PADDING_PAGE_FAR_EXTENT_PROPERTY, PADDING_PAGE_NEAR_EXTENT_PROPERTY, PAGE_EXTENT_PROPERTY, ROUNDED_CORNER_ARC_SIZE, STYLE_ID_PROPERTY, TEXT_COLOR_PROPERTY, TOOLTIP_ENABLED_PROPERTY, VISIBLE_PROPERTY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCompositeComponentListener
(CompositeComponentListener compositeComponentListener) Adds a composite component listener.protected void
childComponentValidPropertyChanged
(Component childComponent, boolean oldValid, boolean newValid) Called when theComponent.VALID_PROPERTY
of a child component changes.protected boolean
Checks the state of child components for validity.protected boolean
Checks the state of the component for validity.void
dispatchInputEvent
(InputEvent inputEvent) Dispatches an input event to this component and all child components, if any.protected void
dispatchInputEvent
(InputEvent inputEvent, Component target) Dispatches an input event to the specified target child hierarchy.protected void
fireChildComponentAdded
(Component childComponent) Fires a component added event to all registered composite component listeners.protected void
fireChildComponentAdded
(ComponentEvent childComponentEvent) Fires a given component added event to all registered composite component listeners.protected void
fireChildComponentRemoved
(Component childComponent) Fires a component removed event to all registered composite component listeners.protected void
fireChildComponentRemoved
(ComponentEvent childComponentEvent) Fires a given component removed event to all registered composite component listeners.protected void
initializeChildComponent
(Component childComponent) Initializes a component to be added as a child component of this composite component.void
loadPreferences
(boolean includeDescendants) Loads the preferences for this component and optionally any descendant components.void
removeCompositeComponentListener
(CompositeComponentListener compositeComponentListener) Removes a composite component listener.void
Resets this object's theme.void
savePreferences
(boolean includeDescendants) Saves the preferences for this component and optionally any descendant components.protected void
uninitializeChildComponent
(Component childComponent) Uninitializes a comopnent to be removed as a child comopnent of this composite component.void
Updates this object's theme.boolean
validate()
Validates the user input of this component and all child components.protected boolean
Validates the user input of child components.Methods inherited from class io.guise.framework.component.AbstractComponent
addCommandListener, addExportStrategy, addImportStrategy, addKeyListener, addMouseListener, addNotificationListener, addPreferenceProperty, applyTheme, applyTheme, depict, equals, exportTransfer, fireInputEvent, fireNotified, fireNotified, getAncestor, getCommandListeners, getComponentByID, getComponentByName, getComponentOrientation, getConstraints, getDepictID, getDepictor, getDescription, getDescriptionContentType, getDirtyComponents, getDirtyComponents, getEventListenerManager, getFlyoverStrategy, getGlyphURI, getInfo, getInfoContentType, getInfoModel, getInputStrategy, getKeyListeners, getLabel, getLabelContentType, getMouseListeners, getName, getNotification, getNotifications, getNotifications, getOrientation, getParent, getPreferenceProperties, getRootComponent, getTheme, hasAncestor, hasCommandListeners, hashCode, hasKeyListeners, hasMouseListeners, importTransfer, initialize, isDragEnabled, isDropEnabled, isFlyoverEnabled, isPreferenceProperty, isThemeApplied, isValid, notify, processEvent, removeCommandListener, removeExportStrategy, removeImportStrategy, removeKeyListener, removeMouseListener, removeNotificationListener, removePreferenceProperty, setConstraints, setDepicted, setDescription, setDescriptionContentType, setDragEnabled, setDropEnabled, setFlyoverEnabled, setFlyoverStrategy, setGlyphURI, setInfo, setInfoContentType, setInputStrategy, setLabel, setLabelContentType, setName, setNotification, setOrientation, setParent, setThemeApplied, setValid, toString, update, updateValid
Methods inherited from class io.guise.framework.model.ui.AbstractPresentationModel
BorderLineFarColor, BorderLineFarExtent, BorderLineFarStyle, BorderLineNearColor, BorderLineNearExtent, BorderLineNearStyle, BorderPageFarColor, BorderPageFarExtent, BorderPageFarStyle, BorderPageNearColor, BorderPageNearExtent, BorderPageNearStyle, getBackgroundColor, getBorderColor, getBorderExtent, getBorderStyle, getCornerArcSize, getCornerLineFarPageFarArcSize, getCornerLineFarPageNearArcSize, getCornerLineNearPageFarArcSize, getCornerLineNearPageNearArcSize, getCursor, getExtent, getFontFamilies, getFontSize, getFontStyle, getFontWeight, getLabelFontFamilies, getLabelFontSize, getLabelFontStyle, getLabelFontWeight, getLabelTextColor, getLineExtent, getMarginExtent, getMarginLineFarExtent, getMarginLineNearExtent, getMarginPageFarExtent, getMarginPageNearExtent, getOpacity, getPaddingExtent, getPaddingLineFarExtent, getPaddingLineNearExtent, getPaddingPageFarExtent, getPaddingPageNearExtent, getPageExtent, getStyleID, getTextColor, isDisplayed, isTooltipEnabled, isVisible, setBackgroundColor, setBorderColor, setBorderColor, setBorderExtent, setBorderExtent, setBorderLineFarColor, setBorderLineFarExtent, setBorderLineFarStyle, setBorderLineNearColor, setBorderLineNearExtent, setBorderLineNearStyle, setBorderPageFarColor, setBorderPageFarExtent, setBorderPageFarStyle, setBorderPageNearColor, setBorderPageNearExtent, setBorderPageNearStyle, setBorderStyle, setBorderStyle, setCornerArcSize, setCornerArcSize, setCornerLineFarPageFarArcSize, setCornerLineFarPageNearArcSize, setCornerLineNearPageFarArcSize, setCornerLineNearPageNearArcSize, setCursor, setDisplayed, setExtent, setFontFamilies, setFontSize, setFontStyle, setFontWeight, setLabelFontFamilies, setLabelFontSize, setLabelFontStyle, setLabelFontWeight, setLabelTextColor, setLineExtent, setMarginExtent, setMarginExtent, setMarginLineFarExtent, setMarginLineNearExtent, setMarginPageFarExtent, setMarginPageNearExtent, setOpacity, setPaddingExtent, setPaddingExtent, setPaddingLineFarExtent, setPaddingLineNearExtent, setPaddingPageFarExtent, setPaddingPageNearExtent, setPageExtent, setStyleID, setTextColor, setTooltipEnabled, setVisible
Methods inherited from class io.guise.framework.event.GuiseBoundPropertyObject
getSession
Methods inherited from class com.globalmentor.beans.BoundPropertyObject
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.clogr.Clogged
getLogger
Methods inherited from interface io.guise.framework.component.Component
addCommandListener, addExportStrategy, addImportStrategy, addKeyListener, addMouseListener, addNotificationListener, addPreferenceProperty, applyTheme, applyTheme, exportTransfer, fireInputEvent, getAncestor, getComponentOrientation, getConstraints, getDepictor, getFlyoverStrategy, getInputStrategy, getName, getNotification, getOrientation, getParent, getPreferenceProperties, getTheme, hasCommandListeners, hasKeyListeners, hasMouseListeners, importTransfer, initialize, isDragEnabled, isDropEnabled, isFlyoverEnabled, isPreferenceProperty, isThemeApplied, isValid, notify, removeCommandListener, removeExportStrategy, removeImportStrategy, removeKeyListener, removeMouseListener, removeNotificationListener, removePreferenceProperty, setConstraints, setDragEnabled, setDropEnabled, setFlyoverEnabled, setFlyoverStrategy, setInputStrategy, setName, setNotification, setOrientation, setParent, setThemeApplied
Methods inherited from interface io.guise.framework.component.CompositeComponent
getChildComponents, hasChildComponents
Methods inherited from interface io.guise.framework.platform.DepictedObject
depict, getDepictID, getSession, processEvent
Methods inherited from interface io.guise.framework.model.InfoModel
getDescription, getDescriptionContentType, getInfo, getInfoContentType, setDescription, setDescriptionContentType, setInfo, setInfoContentType
Methods inherited from interface io.guise.framework.model.LabelModel
getGlyphURI, getLabel, getLabelContentType, setGlyphURI, setLabel, setLabelContentType
Methods inherited from interface io.guise.framework.model.ui.PresentationModel
BorderLineFarColor, BorderLineFarExtent, BorderLineFarStyle, BorderLineNearColor, BorderLineNearExtent, BorderLineNearStyle, BorderPageFarColor, BorderPageFarExtent, BorderPageFarStyle, BorderPageNearColor, BorderPageNearExtent, BorderPageNearStyle, getBackgroundColor, getBorderColor, getBorderExtent, getBorderStyle, getCornerArcSize, getCornerLineFarPageFarArcSize, getCornerLineFarPageNearArcSize, getCornerLineNearPageFarArcSize, getCornerLineNearPageNearArcSize, getCursor, getExtent, getFontFamilies, getFontSize, getFontStyle, getFontWeight, getLabelFontFamilies, getLabelFontSize, getLabelFontStyle, getLabelFontWeight, getLabelTextColor, getLineExtent, getMarginExtent, getMarginLineFarExtent, getMarginLineNearExtent, getMarginPageFarExtent, getMarginPageNearExtent, getOpacity, getPaddingExtent, getPaddingLineFarExtent, getPaddingLineNearExtent, getPaddingPageFarExtent, getPaddingPageNearExtent, getPageExtent, getSession, getStyleID, getTextColor, isDisplayed, isTooltipEnabled, isVisible, setBackgroundColor, setBorderColor, setBorderColor, setBorderExtent, setBorderExtent, setBorderLineFarColor, setBorderLineFarExtent, setBorderLineFarStyle, setBorderLineNearColor, setBorderLineNearExtent, setBorderLineNearStyle, setBorderPageFarColor, setBorderPageFarExtent, setBorderPageFarStyle, setBorderPageNearColor, setBorderPageNearExtent, setBorderPageNearStyle, setBorderStyle, setBorderStyle, setCornerArcSize, setCornerArcSize, setCornerLineFarPageFarArcSize, setCornerLineFarPageNearArcSize, setCornerLineNearPageFarArcSize, setCornerLineNearPageNearArcSize, setCursor, setDisplayed, setExtent, setFontFamilies, setFontSize, setFontStyle, setFontWeight, setLabelFontFamilies, setLabelFontSize, setLabelFontStyle, setLabelFontWeight, setLabelTextColor, setLineExtent, setMarginExtent, setMarginExtent, setMarginLineFarExtent, setMarginLineNearExtent, setMarginPageFarExtent, setMarginPageNearExtent, setOpacity, setPaddingExtent, setPaddingExtent, setPaddingLineFarExtent, setPaddingLineNearExtent, setPaddingPageFarExtent, setPaddingPageNearExtent, setPageExtent, setStyleID, setTextColor, setTooltipEnabled, setVisible
Methods inherited from interface com.globalmentor.beans.PropertyBindable
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
Methods inherited from interface com.globalmentor.beans.PropertyConstrainable
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, hasVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
Constructor Details
-
AbstractCompositeComponent
Info model constructor.- Parameters:
infoModel
- The component info model.- Throws:
NullPointerException
- if the given info model isnull
.
-
-
Method Details
-
initializeChildComponent
Initializes a component to be added as a child component of this composite component. This method should be called for every child component added to this composite component. This version installs a listener for the component's valid status. This version installs a listener to refire copies of notification events. This version installs a listener to refire copies of composite component events. This version loads the preferences of the child component, but not its descendants.- Parameters:
childComponent
- The component to add to this component.- See Also:
-
uninitializeChildComponent
Uninitializes a comopnent to be removed as a child comopnent of this composite component. This method should be called for every child component removed from this composite component. This version uninstalls a listener for the component's valid status. This version uninstalls a listener to refire copies of notification events. This version uninstalls a listener to refire copies of composite component events. This version saves any preferences of the child component and any descendants.- Parameters:
childComponent
- The component to remove from this component.- See Also:
-
childComponentValidPropertyChanged
protected void childComponentValidPropertyChanged(Component childComponent, boolean oldValid, boolean newValid) Called when theComponent.VALID_PROPERTY
of a child component changes. Every child version should call this version. This version updates the composite component's valid state by callingAbstractComponent.updateValid()
.- Parameters:
childComponent
- The child component the valid property of which changed.oldValid
- The old valid property.newValid
- The new valid property.
-
determineValid
protected boolean determineValid()Checks the state of the component for validity. This version returnstrue
.This version calls
determineChildrenValid()
.- Overrides:
determineValid
in classAbstractComponent
- Returns:
true
if the component and all children passes all validity tests, elsefalse
.
-
determineChildrenValid
protected boolean determineChildrenValid()Checks the state of child components for validity. This version checks all child components for validity using the currentComponent.isValid()
; child component are not asked to update their valid state. Children that are not visible and/or not displayed are not taken into account.- Returns:
true
if the relevant children pass all validity tests.
-
validate
public boolean validate()Validates the user input of this component and all child components. The component will be updated with error information.This version clears all notifications. This version calls
AbstractComponent.updateValid()
.This version first calls
validateChildren()
so that all children will be validated before checks are performed on this component.- Specified by:
validate
in interfaceComponent
- Overrides:
validate
in classAbstractComponent
- Returns:
- The current state of
Component.isValid()
as a convenience.
-
validateChildren
protected boolean validateChildren()Validates the user input of child components. Children that are not visible and/or not displayed are not taken into account.- Returns:
true
if all child validations returntrue
.
-
resetTheme
public void resetTheme()Resets this object's theme. This method sets tofalse
the state of whether a theme has been applied to this object. This method is called for any child components resetting its own theme. No new theme is actually loaded. There is normally no need to override this method or to call this method directly by applications.This version recursively calls the
resetTheme()
method of all child components before resetting the theme of this component.- Specified by:
resetTheme
in interfaceComponent
- Overrides:
resetTheme
in classAbstractComponent
- See Also:
-
updateTheme
Updates this object's theme. This method checks whether a theme has been applied to this object. If a theme has not been applied to this object this method callsComponent.applyTheme()
. This method is called for any child components before applying the theme to the component itself, to assure that child theme updates have already occurred before theme updates occur for this component. There is normally no need to override this method or to call this method directly by applications.This version recursively calls the
updateTheme()
method of all child components before updating the theme of this component.- Specified by:
updateTheme
in interfaceComponent
- Overrides:
updateTheme
in classAbstractComponent
- Throws:
IOException
- if there was an error loading or applying a theme.- See Also:
-
loadPreferences
Loads the preferences for this component and optionally any descendant components. Any preferences returned fromComponent.getPreferenceProperties()
will be loaded automatically.This version loads the preferences of child components if descendants should be included.
- Specified by:
loadPreferences
in interfaceComponent
- Overrides:
loadPreferences
in classAbstractComponent
- Parameters:
includeDescendants
-true
if preferences of any descendant components should also be loaded, elsefalse
.- Throws:
IOException
- if there is an error loading preferences.
-
savePreferences
Saves the preferences for this component and optionally any descendant components. Any preferences returned fromComponent.getPreferenceProperties()
will be saved automatically.This version loads the preferences of child components if descendants should be included.
- Specified by:
savePreferences
in interfaceComponent
- Overrides:
savePreferences
in classAbstractComponent
- Parameters:
includeDescendants
-true
if preferences of any descendant components should also be saved, elsefalse
.- Throws:
IOException
- if there is an error saving preferences.
-
dispatchInputEvent
Description copied from class:AbstractComponent
Dispatches an input event to this component and all child components, if any. If this is aFocusedInputEvent
, the event will be directed towards the branch in which lies the focused component of anyInputFocusGroupComponent
ancestor of this component (or this component, if it is a focus group). If this is instead aTargetedEvent
, the event will be directed towards the branch in which lies the target component of the event. Otherwise, the event will be dispatched to all child components. Only after the event has been dispatched to any children will the event be fired to any event listeners and then passed to the installed input strategy, if any. Once the event is consumed, no further processing takes place.This version fires all events that are not consumed.
- Specified by:
dispatchInputEvent
in interfaceComponent
- Overrides:
dispatchInputEvent
in classAbstractComponent
- Parameters:
inputEvent
- The input event to dispatch.- See Also:
-
dispatchInputEvent
Dispatches an input event to the specified target child hierarchy. If the given target is not a descendant of this component, or if the target is this component, no action occurs.- Parameters:
inputEvent
- The input event to dispatch.target
- The target indicating the child hierarchy to which this event should be directed.- Throws:
NullPointerException
- if the given event and/or target isnull
.- See Also:
-
addCompositeComponentListener
Description copied from interface:CompositeComponent
Adds a composite component listener. An event will be fired for each descendant component added or removed, with the event target indicating the parent composite component of the change.- Specified by:
addCompositeComponentListener
in interfaceCompositeComponent
- Parameters:
compositeComponentListener
- The composite component listener to add.
-
removeCompositeComponentListener
Description copied from interface:CompositeComponent
Removes a composite component listener. An event will be fired for each descendant component added or removed, with the event target indicating the parent composite component of the change.- Specified by:
removeCompositeComponentListener
in interfaceCompositeComponent
- Parameters:
compositeComponentListener
- The composite component listener to remove.
-
fireChildComponentAdded
Fires a component added event to all registered composite component listeners. This method delegates tofireChildComponentAdded(ComponentEvent)
.- Parameters:
childComponent
- The child component added.- See Also:
-
fireChildComponentAdded
Fires a given component added event to all registered composite component listeners.- Parameters:
childComponentEvent
- The child component event to fire.
-
fireChildComponentRemoved
Fires a component removed event to all registered composite component listeners. This method delegates tofireChildComponentRemoved(ComponentEvent)
.- Parameters:
childComponent
- The child component removed.- See Also:
-
fireChildComponentRemoved
Fires a given component removed event to all registered composite component listeners.- Parameters:
childComponentEvent
- The child component event to fire.- See Also:
-