Class AbstractComponent
- java.lang.Object
-
- com.globalmentor.beans.BoundPropertyObject
-
- io.guise.framework.event.GuiseBoundPropertyObject
-
- io.guise.framework.model.ui.AbstractPresentationModel
-
- io.guise.framework.component.AbstractComponent
-
- All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable
,com.globalmentor.beans.PropertyConstrainable
,Component
,Displayable
,InfoModel
,LabelModel
,Model
,PresentationModel
,DepictedObject
- Direct Known Subclasses:
AbstractCompositeComponent
,AbstractControl
,AbstractImageComponent
,AbstractLabel
,Flash
,LikeButton
,Message
public abstract class AbstractComponent extends AbstractPresentationModel implements Component
An abstract implementation of a component.A component should never fire a property event directly. It should rather create a postponed event and queue that event with the session. This implementation automatically handles postponed property change events when
BoundPropertyObject.firePropertyChange(String, Object, Object)
or a related method is called.Property changes to a component's constraints are repeated with the component as the source and the constraints as the target.
- Author:
- Garret Wilson
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractComponent.AbstractFlyoverFrameStrategy<S extends Component>
An abstract flyover strategy that uses flyover frames.static class
AbstractComponent.AbstractFlyoverStrategy<S extends Component>
An abstract implementation of a strategy for showing and hiding flyovers in response to mouse events.static class
AbstractComponent.DefaultFlyoverStrategy<S extends Component>
The default strategy for showing and hiding flyovers in response to mouse events.-
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 Constructor Description AbstractComponent()
Default constructor.AbstractComponent(InfoModel infoModel)
Info model constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCommandListener(CommandListener commandListener)
Adds a command listener.void
addExportStrategy(ExportStrategy<?> exportStrategy)
Adds an export strategy to the component.void
addImportStrategy(ImportStrategy<?> importStrategy)
Adds an import strategy to the component.void
addKeyListener(KeyboardListener keyListener)
Adds a key listener.void
addMouseListener(MouseListener mouseListener)
Adds a mouse listener.void
addNotificationListener(NotificationListener notificationListener)
Adds a notification listener.void
addPreferenceProperty(java.lang.String propertyName)
Adds a property to be saved and loaded as a preference.void
applyTheme()
Applies the theme to this object.void
applyTheme(Theme theme)
Applies a theme and its parents to this object.void
depict()
Updates the depiction of the object.protected boolean
determineValid()
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.boolean
equals(java.lang.Object object)
Transferable<?>
exportTransfer()
Exports data from the component.void
fireInputEvent(InputEvent inputEvent)
Fire the given even to all registered listeners, if any.protected void
fireNotified(NotificationEvent notificationEvent)
Fires an event to all registered notification listeners with the new notification information.protected void
fireNotified(Notification notification)
Fires an event to all registered notification listeners with the new notification information.<A extends CompositeComponent>
AgetAncestor(java.lang.Class<A> ancestorClass)
Retrieves the first ancestor of the given type.protected java.lang.Iterable<CommandListener>
getCommandListeners()
static Component
getComponentByID(Component component, long id)
Retrieves a component with the given ID.static Component
getComponentByName(Component component, java.lang.String name)
Retrieves a component with the given name.Orientation
getComponentOrientation()
Determines the internationalization orientation of the component's contents.Constraints
getConstraints()
long
getDepictID()
Depictor<? extends Component>
getDepictor()
java.lang.String
getDescription()
com.globalmentor.net.ContentType
getDescriptionContentType()
static java.util.List<Component>
getDirtyComponents(Component component)
Retrieves all components that have views needing updated.static java.util.List<Component>
getDirtyComponents(Component component, java.util.List<Component> dirtyComponents)
Retrieves all components that have views needing updated.protected com.globalmentor.event.EventListenerManager
getEventListenerManager()
Component.FlyoverStrategy<?>
getFlyoverStrategy()
java.net.URI
getGlyphURI()
java.lang.String
getInfo()
com.globalmentor.net.ContentType
getInfoContentType()
protected InfoModel
getInfoModel()
InputStrategy
getInputStrategy()
protected java.lang.Iterable<KeyboardListener>
getKeyListeners()
java.lang.String
getLabel()
com.globalmentor.net.ContentType
getLabelContentType()
protected java.lang.Iterable<MouseListener>
getMouseListeners()
java.lang.String
getName()
Notification
getNotification()
static java.util.List<Notification>
getNotifications(Component component)
Retrieves the the notifications of all components in a hierarchy.protected static java.util.List<Notification>
getNotifications(Component component, java.util.List<Notification> notifications)
Retrieves the the notifications of all components in a hierarchy.Orientation
getOrientation()
Returns this component's requested orientation.CompositeComponent
getParent()
java.lang.Iterable<java.lang.String>
getPreferenceProperties()
Returns all properties stored as preferences.static Component
getRootComponent(Component component)
Determines the root parent of the given component.Theme
getTheme()
Returns the theme to apply to this component.static boolean
hasAncestor(Component component, CompositeComponent ancestor)
Determines whether a component has a given component as its ancestor, not including the component itself.boolean
hasCommandListeners()
int
hashCode()
boolean
hasKeyListeners()
boolean
hasMouseListeners()
boolean
importTransfer(Transferable<?> transferable)
Imports data to the component.void
initialize()
Initializes the component after construction.boolean
isDragEnabled()
boolean
isDropEnabled()
boolean
isFlyoverEnabled()
boolean
isPreferenceProperty(java.lang.String propertyName)
Determines whether the given property is saved and loaded as a preference.boolean
isThemeApplied()
boolean
isValid()
void
loadPreferences(boolean includeDescendants)
Loads the preferences for this component and optionally any descendant components.void
notify(Notification notification)
Notifies the user of the given notification information.void
processEvent(PlatformEvent event)
Processes an event from the platform.void
removeCommandListener(CommandListener commandListener)
Removes a command listener.void
removeExportStrategy(ExportStrategy<?> exportStrategy)
Removes an export strategy from the component.void
removeImportStrategy(ImportStrategy<?> importStrategy)
Removes an import strategy from the component.void
removeKeyListener(KeyboardListener keyListener)
Removes a key listener.void
removeMouseListener(MouseListener mouseListener)
Removes a mouse listener.void
removeNotificationListener(NotificationListener notificationListener)
Removes a notification listener.void
removePreferenceProperty(java.lang.String propertyName)
Removes a property from being saved and loaded as preferences.void
resetTheme()
Resets this object's theme.void
savePreferences(boolean includeDescendants)
Saves the preferences for this component and optionally any descendant components.void
setConstraints(Constraints newConstraints)
Sets the layout constraints of this component.static void
setDepicted(Component component, boolean newUpdated)
Changes the updated status of the views of an entire component descendant hierarchy.void
setDescription(java.lang.String newDescription)
Sets the description text, such as might appear in a flyover.void
setDescriptionContentType(com.globalmentor.net.ContentType newDescriptionContentType)
Sets the content type of the description text.void
setDragEnabled(boolean newDragEnabled)
Sets whether the component has dragging enabled.void
setDropEnabled(boolean newDropEnabled)
Sets whether the component has dropping enabled.void
setFlyoverEnabled(boolean newFlyoverEnabled)
Sets whether flyovers are enabled for this component.void
setFlyoverStrategy(Component.FlyoverStrategy<?> newFlyoverStrategy)
Sets the strategy for controlling flyovers.void
setGlyphURI(java.net.URI newLabelIcon)
Sets the URI of the icon.void
setInfo(java.lang.String newInfo)
Sets the advisory information text, such as might appear in a tooltip.void
setInfoContentType(com.globalmentor.net.ContentType newInfoContentType)
Sets the content type of the advisory information text.void
setInputStrategy(InputStrategy newInputStrategy)
Sets the strategy for processing input.void
setLabel(java.lang.String newLabelText)
Sets the text of the label.void
setLabelContentType(com.globalmentor.net.ContentType newLabelTextContentType)
Sets the content type of the label text.void
setName(java.lang.String newName)
Sets the name of the component.void
setNotification(Notification newNotification)
Sets the component notification.void
setOrientation(Orientation newOrientation)
Sets the orientation.void
setParent(CompositeComponent newParent)
Sets the parent of this component.void
setThemeApplied(boolean newThemeApplied)
Sets whether a theme has been applied to this component.protected void
setValid(boolean newValid)
Sets whether the state of the component and all child components represents valid user input This is a bound property of typeBoolean
.java.lang.String
toString()
protected void
update()
Updates the condition of the component based upon the state.void
updateTheme()
Updates this object's theme.protected void
updateValid()
Rechecks user input validity of this component and all child components, and updates the valid state.boolean
validate()
Validates the user input of this component and all child components.-
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.guise.framework.platform.DepictedObject
getSession
-
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
-
-
-
-
Constructor Detail
-
AbstractComponent
public AbstractComponent()
Default constructor.- Throws:
java.lang.IllegalStateException
- if no controller is registered for this component type.java.lang.IllegalStateException
- if no view is registered for this component type.
-
AbstractComponent
public AbstractComponent(InfoModel infoModel)
Info model constructor.- Parameters:
infoModel
- The component info model.- Throws:
java.lang.NullPointerException
- if the given info model isnull
.java.lang.IllegalStateException
- if no depictor is registered for this component type.
-
-
Method Detail
-
getEventListenerManager
protected com.globalmentor.event.EventListenerManager getEventListenerManager()
- Returns:
- The object managing event listeners.
-
addPreferenceProperty
public void addPreferenceProperty(java.lang.String propertyName)
Description copied from interface:Component
Adds a property to be saved and loaded as a preference.- Specified by:
addPreferenceProperty
in interfaceComponent
- Parameters:
propertyName
- The property to store as a preference.- See Also:
Component.loadPreferences(boolean)
,Component.savePreferences(boolean)
-
isPreferenceProperty
public boolean isPreferenceProperty(java.lang.String propertyName)
Description copied from interface:Component
Determines whether the given property is saved and loaded as a preference.- Specified by:
isPreferenceProperty
in interfaceComponent
- Parameters:
propertyName
- The property to determine if it is stored as a preference.- Returns:
true
if the given property is saved and loaded as a preference.- See Also:
Component.loadPreferences(boolean)
,Component.savePreferences(boolean)
-
getPreferenceProperties
public java.lang.Iterable<java.lang.String> getPreferenceProperties()
Description copied from interface:Component
Returns all properties stored as preferences.- Specified by:
getPreferenceProperties
in interfaceComponent
- Returns:
- An iterable of all properties saved and loaded as preferences.
- See Also:
Component.loadPreferences(boolean)
,Component.savePreferences(boolean)
-
removePreferenceProperty
public void removePreferenceProperty(java.lang.String propertyName)
Description copied from interface:Component
Removes a property from being saved and loaded as preferences.- Specified by:
removePreferenceProperty
in interfaceComponent
- Parameters:
propertyName
- The property that should no longer be stored as a preference.- See Also:
Component.loadPreferences(boolean)
,Component.savePreferences(boolean)
-
getInfoModel
protected InfoModel getInfoModel()
- Returns:
- The info model decorated by this component.
-
getName
public java.lang.String getName()
-
setName
public void setName(java.lang.String newName)
Description copied from interface:Component
Sets the name of the component. This is a bound property.- Specified by:
setName
in interfaceComponent
- Parameters:
newName
- The new name of the component, ornull
if the component should have no name.- See Also:
Component.NAME_PROPERTY
-
getGlyphURI
public java.net.URI getGlyphURI()
- Specified by:
getGlyphURI
in interfaceLabelModel
- Returns:
- The glyph URI, which may be a resource URI, or
null
if there is no glyph URI.
-
setGlyphURI
public void setGlyphURI(java.net.URI newLabelIcon)
Description copied from interface:LabelModel
Sets the URI of the icon. This is a bound property.- Specified by:
setGlyphURI
in interfaceLabelModel
- Parameters:
newLabelIcon
- The new URI of the icon, which may be a resource URI.- See Also:
LabelModel.GLYPH_URI_PROPERTY
-
getLabel
public java.lang.String getLabel()
- Specified by:
getLabel
in interfaceLabelModel
- Returns:
- The label text, which may include a resource reference, or
null
if there is no label text.
-
setLabel
public void setLabel(java.lang.String newLabelText)
Description copied from interface:LabelModel
Sets the text of the label. This is a bound property.- Specified by:
setLabel
in interfaceLabelModel
- Parameters:
newLabelText
- The new text of the label, which may include a resource reference.- See Also:
LabelModel.LABEL_PROPERTY
-
getLabelContentType
public com.globalmentor.net.ContentType getLabelContentType()
- Specified by:
getLabelContentType
in interfaceLabelModel
- Returns:
- The content type of the label text.
-
setLabelContentType
public void setLabelContentType(com.globalmentor.net.ContentType newLabelTextContentType)
Description copied from interface:LabelModel
Sets the content type of the label text. This is a bound property.- Specified by:
setLabelContentType
in interfaceLabelModel
- Parameters:
newLabelTextContentType
- The new label text content type.- See Also:
LabelModel.LABEL_CONTENT_TYPE_PROPERTY
-
getDescription
public java.lang.String getDescription()
- Specified by:
getDescription
in interfaceInfoModel
- Returns:
- The description text, such as might appear in a flyover, or
null
if there is no description.
-
setDescription
public void setDescription(java.lang.String newDescription)
Description copied from interface:InfoModel
Sets the description text, such as might appear in a flyover. This is a bound property.- Specified by:
setDescription
in interfaceInfoModel
- Parameters:
newDescription
- The new text of the description, such as might appear in a flyover.- See Also:
InfoModel.DESCRIPTION_PROPERTY
-
getDescriptionContentType
public com.globalmentor.net.ContentType getDescriptionContentType()
- Specified by:
getDescriptionContentType
in interfaceInfoModel
- Returns:
- The content type of the description text.
-
setDescriptionContentType
public void setDescriptionContentType(com.globalmentor.net.ContentType newDescriptionContentType)
Description copied from interface:InfoModel
Sets the content type of the description text. This is a bound property.- Specified by:
setDescriptionContentType
in interfaceInfoModel
- Parameters:
newDescriptionContentType
- The new description text content type.- See Also:
InfoModel.DESCRIPTION_CONTENT_TYPE_PROPERTY
-
getInfo
public java.lang.String getInfo()
-
setInfo
public void setInfo(java.lang.String newInfo)
Description copied from interface:InfoModel
Sets the advisory information text, such as might appear in a tooltip. This is a bound property.- Specified by:
setInfo
in interfaceInfoModel
- Parameters:
newInfo
- The new text of the advisory information, such as might appear in a tooltip.- See Also:
InfoModel.INFO_PROPERTY
-
getInfoContentType
public com.globalmentor.net.ContentType getInfoContentType()
- Specified by:
getInfoContentType
in interfaceInfoModel
- Returns:
- The content type of the advisory information text.
-
setInfoContentType
public void setInfoContentType(com.globalmentor.net.ContentType newInfoContentType)
Description copied from interface:InfoModel
Sets the content type of the advisory information text. This is a bound property.- Specified by:
setInfoContentType
in interfaceInfoModel
- Parameters:
newInfoContentType
- The new advisory information text content type.- See Also:
InfoModel.INFO_CONTENT_TYPE_PROPERTY
-
getConstraints
public Constraints getConstraints()
- Specified by:
getConstraints
in interfaceComponent
- Returns:
- The layout constraints describing individual component layout information, or
null
if no constraints have been specified for this component.
-
setConstraints
public void setConstraints(Constraints newConstraints)
Sets the layout constraints of this component. This is a bound property.- Specified by:
setConstraints
in interfaceComponent
- Parameters:
newConstraints
- The layout constraints describing individual component layout information, ornull
if no constraints have been specified for this component.- See Also:
Component.CONSTRAINTS_PROPERTY
-
getInputStrategy
public InputStrategy getInputStrategy()
- Specified by:
getInputStrategy
in interfaceComponent
- Returns:
- The strategy for processing input, or
null
if this component has no input strategy.
-
setInputStrategy
public void setInputStrategy(InputStrategy newInputStrategy)
Description copied from interface:Component
Sets the strategy for processing input. This is a bound property.- Specified by:
setInputStrategy
in interfaceComponent
- Parameters:
newInputStrategy
- The new strategy for processing input, ornull
if this component is to have no input strategy.- See Also:
Component.INPUT_STRATEGY_PROPERTY
-
getNotification
public Notification getNotification()
- Specified by:
getNotification
in interfaceComponent
- Returns:
- The notification associated with the component, or
null
if no notification is associated with this component.
-
setNotification
public void setNotification(Notification newNotification)
Description copied from interface:Component
Sets the component notification. This is a bound property. The notification is also fired as aNotificationEvent
on this component if a new notification is given. Parents are expected to refire the notification event up the hierarchy.- Specified by:
setNotification
in interfaceComponent
- Parameters:
newNotification
- The notification for the component, ornull
if no notification is associated with this component.- See Also:
Component.NOTIFICATION_PROPERTY
-
isValid
public boolean isValid()
This implementation initializes the valid property if needed.
-
setValid
protected void setValid(boolean newValid)
Sets whether the state of the component and all child components represents valid user input This is a bound property of typeBoolean
. This implementation initializes the valid property if needed.- Parameters:
newValid
-true
if user input of this component and all child components should be considered valid- See Also:
Component.VALID_PROPERTY
-
updateValid
protected void updateValid()
Rechecks user input validity of this component and all child components, and updates the valid state. This implementation only updates the valid property if the property is already initialized or there is at least one listener to theComponent.VALID_PROPERTY
.- See Also:
setValid(boolean)
-
determineValid
protected boolean determineValid()
Checks the state of the component for validity. This version returnstrue
.- Returns:
true
if the component and all children passes all validity tests, elsefalse
.
-
getDepictor
public Depictor<? extends Component> getDepictor()
- Specified by:
getDepictor
in interfaceComponent
- Specified by:
getDepictor
in interfaceDepictedObject
- Returns:
- The depictor for this component.
-
processEvent
public void processEvent(PlatformEvent event)
Description copied from interface:DepictedObject
Processes an event from the platform. This method delegates to the currently installed depictor.- Specified by:
processEvent
in interfaceDepictedObject
- Parameters:
event
- The event to be processed.- See Also:
DepictedObject.getDepictor()
,Depictor.processEvent(PlatformEvent)
-
depict
public void depict() throws java.io.IOException
Description copied from interface:DepictedObject
Updates the depiction of the object. The depiction will be marked as updated. This method delegates to the currently installed depictor.- Specified by:
depict
in interfaceDepictedObject
- Throws:
java.io.IOException
- if there is an error updating the depiction.- See Also:
DepictedObject.getDepictor()
,Depictor.depict()
-
getDepictID
public long getDepictID()
- Specified by:
getDepictID
in interfaceDepictedObject
- Returns:
- The object depiction identifier.
-
getOrientation
public Orientation getOrientation()
Description copied from interface:Component
Returns this component's requested orientation. To resolve the orientation up the hierarchy,Component.getComponentOrientation()
should be used.- Specified by:
getOrientation
in interfaceComponent
- Returns:
- The internationalization orientation of the component's contents, or
null
if the default orientation should be used. - See Also:
Component.getComponentOrientation()
-
getComponentOrientation
public Orientation getComponentOrientation()
Description copied from interface:Component
Determines the internationalization orientation of the component's contents. This method returns the local orientation value, if there is one. If there is no orientation specified for this component, the request is deferred to this component's parent. If there is no parent component, a default orientation is retrieved from the current session.- Specified by:
getComponentOrientation
in interfaceComponent
- Returns:
- The internationalization orientation of the component's contents.
- See Also:
Component.getOrientation()
,GuiseSession.getOrientation()
-
setOrientation
public void setOrientation(Orientation newOrientation)
Description copied from interface:Component
Sets the orientation. This is a bound property- Specified by:
setOrientation
in interfaceComponent
- Parameters:
newOrientation
- The new internationalization orientation of the component's contents, ornull
if default orientation should be determined based upon the session's locale.- See Also:
Component.ORIENTATION_PROPERTY
-
getParent
public CompositeComponent getParent()
-
getAncestor
public <A extends CompositeComponent> A getAncestor(java.lang.Class<A> ancestorClass)
Description copied from interface:Component
Retrieves the first ancestor of the given type.- Specified by:
getAncestor
in interfaceComponent
- Type Parameters:
A
- The type of ancestor component requested.- Parameters:
ancestorClass
- The class of ancestor component requested.- Returns:
- The first ancestor component of the given type, or
null
if this component has no such ancestor.
-
setParent
public void setParent(CompositeComponent newParent)
Description copied from interface:Component
Sets the parent of this component. This method is managed by containers, and normally should not be called by applications. A component cannot be given a parent if it already has a parent. A component's parent cannot be removed if that parent is a container and this component is still a child of that container. A container's parent cannot be set to a container unless that container already recognizes this component as one of its children. If a component is given the same parent it already has, no action occurs.- Specified by:
setParent
in interfaceComponent
- Parameters:
newParent
- The new parent for this component, ornull
if this component is being removed from a parent.- See Also:
Container.add(Component)
,Container.remove(Object)
-
isDragEnabled
public boolean isDragEnabled()
- Specified by:
isDragEnabled
in interfaceComponent
- Returns:
- Whether the component has dragging enabled.
-
setDragEnabled
public void setDragEnabled(boolean newDragEnabled)
Description copied from interface:Component
Sets whether the component has dragging enabled. This is a bound property of typeBoolean
.- Specified by:
setDragEnabled
in interfaceComponent
- Parameters:
newDragEnabled
-true
if the component should allow dragging, elsefalse
.- See Also:
Component.DRAG_ENABLED_PROPERTY
-
isDropEnabled
public boolean isDropEnabled()
- Specified by:
isDropEnabled
in interfaceComponent
- Returns:
- Whether the component has dropping enabled.
-
setDropEnabled
public void setDropEnabled(boolean newDropEnabled)
Description copied from interface:Component
Sets whether the component has dropping enabled. This is a bound property of typeBoolean
.- Specified by:
setDropEnabled
in interfaceComponent
- Parameters:
newDropEnabled
-true
if the component should allow dropping, elsefalse
.- See Also:
Component.DROP_ENABLED_PROPERTY
-
isFlyoverEnabled
public boolean isFlyoverEnabled()
- Specified by:
isFlyoverEnabled
in interfaceComponent
- Returns:
- Whether flyovers are enabled for this component.
-
setFlyoverEnabled
public void setFlyoverEnabled(boolean newFlyoverEnabled)
Sets whether flyovers are enabled for this component. Flyovers contain information from the component model's "description" property. This is a bound property of typeBoolean
.This implementation adds or removes a default flyover strategy if one is not already installed. This is a bound property of type
Boolean
.- Specified by:
setFlyoverEnabled
in interfaceComponent
- Parameters:
newFlyoverEnabled
-true
if the component should display flyovers, elsefalse
.- See Also:
InfoModel.getDescription()
,Component.FLYOVER_ENABLED_PROPERTY
-
getFlyoverStrategy
public Component.FlyoverStrategy<?> getFlyoverStrategy()
- Specified by:
getFlyoverStrategy
in interfaceComponent
- Returns:
- The installed flyover strategy, or
null
if there is no flyover strategy installed.
-
setFlyoverStrategy
public void setFlyoverStrategy(Component.FlyoverStrategy<?> newFlyoverStrategy)
Description copied from interface:Component
Sets the strategy for controlling flyovers. The flyover strategy will be registered as a mouse listener for this component. This is a bound property.- Specified by:
setFlyoverStrategy
in interfaceComponent
- Parameters:
newFlyoverStrategy
- The new flyover strategy, ornull
if there is no flyover strategy installed.- See Also:
Component.FLYOVER_STRATEGY_PROPERTY
-
isThemeApplied
public boolean isThemeApplied()
- Specified by:
isThemeApplied
in interfaceComponent
- Returns:
- Whether a theme has been applied to this component.
-
setThemeApplied
public void setThemeApplied(boolean newThemeApplied)
Description copied from interface:Component
Sets whether a theme has been applied to this component. This is a bound property of typeBoolean
.- Specified by:
setThemeApplied
in interfaceComponent
- Parameters:
newThemeApplied
-true
if a theme has been applied to this component, elsefalse
.- See Also:
Component.THEME_APPLIED_PROPERTY
-
addExportStrategy
public void addExportStrategy(ExportStrategy<?> exportStrategy)
Description copied from interface:Component
Adds an export strategy to the component. The export strategy will take precedence over any compatible export strategy previously added.- Specified by:
addExportStrategy
in interfaceComponent
- Parameters:
exportStrategy
- The export strategy to add.
-
removeExportStrategy
public void removeExportStrategy(ExportStrategy<?> exportStrategy)
Description copied from interface:Component
Removes an export strategy from the component.- Specified by:
removeExportStrategy
in interfaceComponent
- Parameters:
exportStrategy
- The export strategy to remove.
-
exportTransfer
public Transferable<?> exportTransfer()
Description copied from interface:Component
Exports data from the component. Each export strategy, from last to first added, will be asked to export data, until one is successful.- Specified by:
exportTransfer
in interfaceComponent
- Specified by:
exportTransfer
in interfaceDepictedObject
- Returns:
- The object to be transferred, or
null
if no data can be transferred.
-
addImportStrategy
public void addImportStrategy(ImportStrategy<?> importStrategy)
Description copied from interface:Component
Adds an import strategy to the component. The import strategy will take precedence over any compatible import strategy previously added.- Specified by:
addImportStrategy
in interfaceComponent
- Parameters:
importStrategy
- The import strategy to add.
-
removeImportStrategy
public void removeImportStrategy(ImportStrategy<?> importStrategy)
Description copied from interface:Component
Removes an import strategy from the component.- Specified by:
removeImportStrategy
in interfaceComponent
- Parameters:
importStrategy
- The import strategy to remove.
-
importTransfer
public boolean importTransfer(Transferable<?> transferable)
Description copied from interface:Component
Imports data to the component. Each import strategy, from last to first added, will be asked to import data, until one is successful.- Specified by:
importTransfer
in interfaceComponent
- Parameters:
transferable
- The object to be transferred.- Returns:
true
if the given object was be imported.
-
initialize
public void initialize()
Description copied from interface:Component
Initializes the component after construction. This method can only be called once during the life of a component. Subclasses should call this version.- Specified by:
initialize
in interfaceComponent
-
update
protected void update()
Updates the condition of the component based upon the state. This method is a convenience method for complex components that would like to perform wholesale updates any prototypes, enabled/disabled status, proxied actions, etc. This version does nothing.
-
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
updateValid()
.- Specified by:
validate
in interfaceComponent
- Returns:
- The current state of
Component.isValid()
as a convenience.
-
dispatchInputEvent
public void dispatchInputEvent(InputEvent inputEvent)
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
- Parameters:
inputEvent
- The input event to dispatch.- See Also:
TargetedEvent
,FocusedInputEvent
,InputEvent.isConsumed()
,Component.fireInputEvent(InputEvent)
,Component.getInputStrategy()
,InputStrategy.input(Input)
-
fireInputEvent
public void fireInputEvent(InputEvent inputEvent)
Description copied from interface:Component
Fire the given even to all registered listeners, if any. If the event is consumed further processing should cease.- Specified by:
fireInputEvent
in interfaceComponent
- Parameters:
inputEvent
- The input event to fire.- See Also:
InputEvent.isConsumed()
-
getTheme
public Theme getTheme() throws java.io.IOException
Returns the theme to apply to this component. If there is no theme to this component, the parent theme will be returned.This version delegates to the parent version, if there is a parent component; otherwise, the session theme is returned.
-
resetTheme
public void resetTheme()
Description copied from interface:Component
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.- Specified by:
resetTheme
in interfaceComponent
- See Also:
Component.setThemeApplied(boolean)
-
updateTheme
public void updateTheme() throws java.io.IOException
Description copied from interface:Component
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.- Specified by:
updateTheme
in interfaceComponent
- Throws:
java.io.IOException
- if there was an error loading or applying a theme.- See Also:
Component.isThemeApplied()
,Component.applyTheme()
-
applyTheme
public void applyTheme() throws java.io.IOException
Description copied from interface:Component
Applies the theme to this object. Themes are only applied of the application is themed. This method may be overridden to effectively override theme settings by ensuring the state of important properties after the theme has been set. If the theme is successfully applied, this method updates the theme applied status.- Specified by:
applyTheme
in interfaceComponent
- Throws:
java.io.IOException
- if there was an error loading or applying a theme.- See Also:
GuiseApplication.isThemed()
,Component.getTheme()
,Component.applyTheme(Theme)
,Component.setThemeApplied(boolean)
-
applyTheme
public void applyTheme(Theme theme)
Description copied from interface:Component
Applies a theme and its parents to this object. The theme's rules will be applied to this object and any related objects. Theme application occurs unconditionally, regardless of whether themes have been applied to this component before. There is normally no need to call this method directly by applications.- Specified by:
applyTheme
in interfaceComponent
- Parameters:
theme
- The theme to apply to the object.
-
loadPreferences
public void loadPreferences(boolean includeDescendants) throws java.io.IOException
Description copied from interface:Component
Loads the preferences for this component and optionally any descendant components. Any preferences returned fromComponent.getPreferenceProperties()
will be loaded automatically.- Specified by:
loadPreferences
in interfaceComponent
- Parameters:
includeDescendants
-true
if preferences of any descendant components should also be loaded, elsefalse
.- Throws:
java.io.IOException
- if there is an error loading preferences.
-
savePreferences
public void savePreferences(boolean includeDescendants) throws java.io.IOException
Description copied from interface:Component
Saves the preferences for this component and optionally any descendant components. Any preferences returned fromComponent.getPreferenceProperties()
will be saved automatically.- Specified by:
savePreferences
in interfaceComponent
- Parameters:
includeDescendants
-true
if preferences of any descendant components should also be saved, elsefalse
.- Throws:
java.io.IOException
- if there is an error saving preferences.
-
addCommandListener
public void addCommandListener(CommandListener commandListener)
Description copied from interface:Component
Adds a command listener.- Specified by:
addCommandListener
in interfaceComponent
- Parameters:
commandListener
- The command listener to add.
-
removeCommandListener
public void removeCommandListener(CommandListener commandListener)
Description copied from interface:Component
Removes a command listener.- Specified by:
removeCommandListener
in interfaceComponent
- Parameters:
commandListener
- The command listener to remove.
-
hasCommandListeners
public boolean hasCommandListeners()
- Specified by:
hasCommandListeners
in interfaceComponent
- Returns:
true
if there is one or more command listeners registered.
-
getCommandListeners
protected java.lang.Iterable<CommandListener> getCommandListeners()
- Returns:
- all registered command listeners.
-
addKeyListener
public void addKeyListener(KeyboardListener keyListener)
Description copied from interface:Component
Adds a key listener.- Specified by:
addKeyListener
in interfaceComponent
- Parameters:
keyListener
- The key listener to add.
-
removeKeyListener
public void removeKeyListener(KeyboardListener keyListener)
Description copied from interface:Component
Removes a key listener.- Specified by:
removeKeyListener
in interfaceComponent
- Parameters:
keyListener
- The key listener to remove.
-
hasKeyListeners
public boolean hasKeyListeners()
- Specified by:
hasKeyListeners
in interfaceComponent
- Returns:
true
if there is one or more key listeners registered.
-
getKeyListeners
protected java.lang.Iterable<KeyboardListener> getKeyListeners()
- Returns:
- all registered key listeners.
-
addMouseListener
public void addMouseListener(MouseListener mouseListener)
Description copied from interface:Component
Adds a mouse listener.- Specified by:
addMouseListener
in interfaceComponent
- Parameters:
mouseListener
- The mouse listener to add.
-
removeMouseListener
public void removeMouseListener(MouseListener mouseListener)
Description copied from interface:Component
Removes a mouse listener.- Specified by:
removeMouseListener
in interfaceComponent
- Parameters:
mouseListener
- The mouse listener to remove.
-
hasMouseListeners
public boolean hasMouseListeners()
- Specified by:
hasMouseListeners
in interfaceComponent
- Returns:
true
if there is one or more mouse listeners registered.
-
getMouseListeners
protected java.lang.Iterable<MouseListener> getMouseListeners()
- Returns:
- all registered mouse listeners.
-
getRootComponent
public static Component getRootComponent(Component component)
Determines the root parent of the given component.- Parameters:
component
- The component for which the root should be found.- Returns:
- The root component (the component or ancestor which has no parent).
-
hasAncestor
public static boolean hasAncestor(Component component, CompositeComponent ancestor)
Determines whether a component has a given component as its ancestor, not including the component itself.- Parameters:
component
- The component for which the potential ancestor should be checked.ancestor
- The component to check as an ancestor.- Returns:
true
if the given ancestor component is its parent or one of its parent's parents.- Throws:
java.lang.NullPointerException
- if the given component and/or ancestor isnull
.
-
getComponentByID
public static Component getComponentByID(Component component, long id)
Retrieves a component with the given ID. This method checks the given component and all descendant components.- Parameters:
component
- The component that should be checked, along with its descendants, for the given ID.id
- The ID of the component.- Returns:
- The component with the given ID, or
null
if this component and all descendant components do not have the given ID.
-
getComponentByName
public static Component getComponentByName(Component component, java.lang.String name)
Retrieves a component with the given name. This method checks the given component and all descendant components.- Parameters:
component
- The component that should be checked, along with its descendants, for the given name.name
- The name of the component.- Returns:
- The first component with the given name, or
null
if this component and all descendant components do not have the given name.
-
getDirtyComponents
public static java.util.List<Component> getDirtyComponents(Component component)
Retrieves all components that have views needing updated. This method checks the given component and all descendant components. If a given component is dirty, its child views will not be checked.- Parameters:
component
- The component that should be checked, along with its descendants, for out-of-date views.- Returns:
- The components with views needing to be updated.
-
getDirtyComponents
public static java.util.List<Component> getDirtyComponents(Component component, java.util.List<Component> dirtyComponents)
Retrieves all components that have views needing updated. This method checks the given component and all descendant components. If a given component is dirty, its child views will not be checked.- Parameters:
component
- The component that should be checked, along with its descendants, for out-of-date views.dirtyComponents
- The list that will be updated with more dirty components if any are found.- Returns:
- The components with views needing to be updated.
-
setDepicted
public static void setDepicted(Component component, boolean newUpdated)
Changes the updated status of the views of an entire component descendant hierarchy.- Parameters:
component
- The component from which, along with its descendants, notifications should be retrieved.newUpdated
- Whether the views of this component and all child components are up to date.
-
getNotifications
public static java.util.List<Notification> getNotifications(Component component)
Retrieves the the notifications of all components in a hierarchy. This method checks the given component and all descendant components. Children that are not visible and/or not displayed are not taken into account.- Parameters:
component
- The component from which, along with its descendants, notifications should be retrieved.- Returns:
- The notifications of all components in the hierarchy.
-
getNotifications
protected static java.util.List<Notification> getNotifications(Component component, java.util.List<Notification> notifications)
Retrieves the the notifications of all components in a hierarchy. This method checks the given component and all descendant components. Children that are not visible and/or not displayed are not taken into account.- Parameters:
component
- The component from which, along with its descendants, notifications should be retrieved.notifications
- The list that will be updated with more dirty components if any are found.- Returns:
- The notifications of all components in the hierarchy.
-
addNotificationListener
public void addNotificationListener(NotificationListener notificationListener)
Description copied from interface:Component
Adds a notification listener.- Specified by:
addNotificationListener
in interfaceComponent
- Parameters:
notificationListener
- The notification listener to add.
-
removeNotificationListener
public void removeNotificationListener(NotificationListener notificationListener)
Description copied from interface:Component
Removes a notification listener.- Specified by:
removeNotificationListener
in interfaceComponent
- Parameters:
notificationListener
- The notification listener to remove.
-
fireNotified
protected void fireNotified(Notification notification)
Fires an event to all registered notification listeners with the new notification information. Parents are expected to refire the notification event up the hierarchy.- Parameters:
notification
- The notification to send to the notification listeners.- Throws:
java.lang.NullPointerException
- if the given notification isnull
.- See Also:
NotificationListener
,NotificationEvent
-
fireNotified
protected void fireNotified(NotificationEvent notificationEvent)
Fires an event to all registered notification listeners with the new notification information. Parents are expected to refire copies of the notification event up the hierarchy, keeping the original target.- Parameters:
notificationEvent
- The notification event to send to the notification listeners.- Throws:
java.lang.NullPointerException
- if the given notification event isnull
.- See Also:
NotificationListener
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object object)
This implementation returns whether the object is a component with the same ID.
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
notify
public void notify(Notification notification)
Description copied from interface:Component
Notifies the user of the given notification information. The notification is stored in this component usingComponent.setNotification(Notification)
, which fires appropriate notification events. This method callsGuiseSession.notify(Notification...)
.
-
-