com.guiseframework.component
Class AbstractFrame

java.lang.Object
  extended by com.globalmentor.beans.BoundPropertyObject
      extended by com.guiseframework.event.GuiseBoundPropertyObject
          extended by com.guiseframework.model.ui.AbstractPresentationModel
              extended by com.guiseframework.component.AbstractComponent
                  extended by com.guiseframework.component.AbstractCompositeComponent
                      extended by com.guiseframework.component.AbstractMultipleCompositeComponent
                          extended by com.guiseframework.component.AbstractArrayCompositeComponent
                              extended by com.guiseframework.component.AbstractEnumCompositeComponent<AbstractFrame.FrameComponent>
                                  extended by com.guiseframework.component.AbstractFrame
All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, Component, CompositeComponent, ContentComponent, Frame, InputFocusableComponent, InputFocusGroupComponent, ModalComponent<Frame.Mode>, Displayable, InfoModel, LabelModel, Model, PresentationModel, DepictedObject
Direct Known Subclasses:
AbstractApplicationFrame, AbstractDialogFrame, AbstractFlyoverFrame, AbstractModalFrame, DefaultFrame

public abstract class AbstractFrame
extends AbstractEnumCompositeComponent<AbstractFrame.FrameComponent>
implements Frame

Abstract implementation of a frame. This implementation notifies the user when the frame does not validate in validate().

Author:
Garret Wilson

Nested Class Summary
protected  class AbstractFrame.DefaultPrototypeProvider
          The default implementation of a prototype provider for a frame.
protected static class AbstractFrame.FrameComponent
          The enumeration of frame components.
 
Nested classes/interfaces inherited from class com.guiseframework.component.AbstractComponent
AbstractComponent.AbstractFlyoverFrameStrategy<S extends Component>, AbstractComponent.AbstractFlyoverStrategy<S extends Component>, AbstractComponent.DefaultFlyoverStrategy<S extends Component>
 
Nested classes/interfaces inherited from interface com.guiseframework.component.Frame
Frame.Mode, Frame.State
 
Field Summary
 
Fields inherited from class com.globalmentor.beans.BoundPropertyObject
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
 
Fields inherited from interface com.guiseframework.component.Frame
CLOSE_ACTION_CONTROL_PROPERTY, MENU_PROPERTY, MODAL_PROPERTY, MOVABLE_PROPERTY, OPEN_EFFECT_PROPERTY, RELATED_COMPONENT_PROPERTY, RESIZABLE_PROPERTY, STATE_PROPERTY, TITLE_BACKGROUND_COLOR_PROPERTY, TITLE_VISIBLE_PROPERTY, TOOLBAR_PROPERTY
 
Fields inherited from interface com.guiseframework.component.ContentComponent
CONTENT_PROPERTY
 
Fields inherited from interface com.guiseframework.component.ModalComponent
MODE_PROPERTY
 
Fields inherited from interface com.guiseframework.component.InputFocusGroupComponent
INPUT_FOCUS_STRATEGY_PROPERTY, INPUT_FOCUSED_COMPONENT_PROPERTY
 
Constructor Summary
AbstractFrame(Component component)
          Component constructor.
 
Method Summary
 boolean canClose()
          Determines whether the frame should be allowed to close.
 void close()
          Closes the frame.
protected  void closeImpl()
          Implementation of frame closing.
 ActionControl getCloseActionControl()
           
 ActionPrototype getCloseActionPrototype()
           
 Component getContent()
           
 InputFocusableComponent getInputFocusedComponent()
          Indicates the component within this group that has the input focus.
 InputFocusStrategy getInputFocusStrategy()
           
 Menu getMenu()
           
 Frame.Mode getMode()
           
 Effect getOpenEffect()
           
protected  FrameMenuToolPrototypeProvisionStrategy getPrototypeProvisionStrategy()
           
 Component getRelatedComponent()
           
 Frame.State getState()
           
 Color getTitleBackgroundColor()
           
 Toolbar getToolbar()
           
 boolean isModal()
           
 boolean isMovable()
           
 boolean isResizable()
           
 boolean isTitleVisible()
           
 void open()
          Opens the frame with the currently set modality.
 void open(boolean modal)
          Opens the frame, specifying modality.
 void open(com.globalmentor.beans.GenericPropertyChangeListener<Frame.Mode> modeChangeListener)
          Opens the frame as modal and installs the given property change listener to listen for the mode changing.
protected  java.util.Set<PrototypeProvision<?>> provideDefaultPrototypes()
          Provides default prototype provisions to be integrated into the menu and/or toolbar.
 void setCloseActionControl(ActionControl newCloseActionControl)
          Sets the action control for closing the frame.
 void setContent(Component newContent)
          Sets the content child component.
 void setInputFocusedComponent(InputFocusableComponent newInputFocusedComponent)
          Sets the focused component within this input focus group.
 void setInputFocusStrategy(InputFocusStrategy newInputFocusStrategy)
          Sets the input focus strategy.
 void setMenu(Menu newMenu)
          Sets the frame menu.
 void setModal(boolean newModal)
          Sets whether the frame is modal if and when it is open.
 void setMode(Frame.Mode newMode)
          Sets the mode of interaction.
 void setMovable(boolean newMovable)
          Sets whether the frame is movable.
 void setOpenEffect(Effect newOpenEffect)
          Sets the effect used for opening the frame.
 void setRelatedComponent(Component newRelatedComponent)
          Sets the related component.
 void setResizable(boolean newResizable)
          Sets whether the frame can be resized.
protected  void setState(Frame.State newState)
          Sets the state of the frame.
 void setTitleBackgroundColor(Color newTitleBackgroundColor)
          Sets the background color of the title.
 void setTitleVisible(boolean newTitleVisible)
          Sets whether the title bar is visible.
 void setToolbar(Toolbar newToolbar)
          Sets the frame toolbar.
protected  void updateDefaultPrototypeProvisions()
          Updates the default prototype provisions.
 boolean validate()
          Validates the user input of this component and all child components.
 
Methods inherited from class com.guiseframework.component.AbstractEnumCompositeComponent
getComponent, setComponent
 
Methods inherited from class com.guiseframework.component.AbstractArrayCompositeComponent
getChildComponents, getChildList, getComponent, hasChildComponents, setComponent
 
Methods inherited from class com.guiseframework.component.AbstractMultipleCompositeComponent
addComponent, removeComponent
 
Methods inherited from class com.guiseframework.component.AbstractCompositeComponent
addCompositeComponentListener, childComponentValidPropertyChanged, determineChildrenValid, determineValid, dispatchInputEvent, dispatchInputEvent, fireChildComponentAdded, fireChildComponentAdded, fireChildComponentRemoved, fireChildComponentRemoved, initializeChildComponent, loadPreferences, removeCompositeComponentListener, resetTheme, savePreferences, uninitializeChildComponent, updateTheme, validateChildren
 
Methods inherited from class com.guiseframework.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 com.guiseframework.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 com.guiseframework.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 com.guiseframework.component.CompositeComponent
addCompositeComponentListener, getChildComponents, hasChildComponents, removeCompositeComponentListener
 

Constructor Detail

AbstractFrame

public AbstractFrame(Component component)
Component constructor.

Parameters:
component - The single child component, or null if this frame should have no child component.
Method Detail

getState

public Frame.State getState()
Specified by:
getState in interface Frame
Returns:
The state of the frame.

setState

protected void setState(Frame.State newState)
Sets the state of the frame. This is a bound property.

Parameters:
newState - The new state of the frame.
Throws:
java.lang.NullPointerException - if the given state is null.
See Also:
Frame.STATE_PROPERTY

isModal

public boolean isModal()
Specified by:
isModal in interface Frame
Returns:
Whether the frame is modal if and when it is open.

setModal

public void setModal(boolean newModal)
Sets whether the frame is modal if and when it is open. This is a bound property of type Boolean.

Specified by:
setModal in interface Frame
Parameters:
newModal - true if the frame should be modal, else false.
See Also:
Frame.MODAL_PROPERTY

getMode

public Frame.Mode getMode()
Specified by:
getMode in interface ModalComponent<Frame.Mode>
Returns:
The current mode of interaction, or null if the component is in a modeless state.

setMode

public void setMode(Frame.Mode newMode)
Sets the mode of interaction. This is a bound property.

Specified by:
setMode in interface ModalComponent<Frame.Mode>
Parameters:
newMode - The new mode of component interaction.
See Also:
ModalComponent.MODE_PROPERTY

isMovable

public boolean isMovable()
Specified by:
isMovable in interface Frame
Returns:
Whether the frame is movable.

setMovable

public void setMovable(boolean newMovable)
Sets whether the frame is movable. This is a bound property of type Boolean.

Specified by:
setMovable in interface Frame
Parameters:
newMovable - true if the frame should be movable, else false.
See Also:
Frame.MOVABLE_PROPERTY

isResizable

public boolean isResizable()
Specified by:
isResizable in interface Frame
Returns:
Whether the frame can be resized.

setResizable

public void setResizable(boolean newResizable)
Sets whether the frame can be resized. This is a bound property of type Boolean.

Specified by:
setResizable in interface Frame
Parameters:
newResizable - true if the frame can be resized, else false.
See Also:
Frame.RESIZABLE_PROPERTY

getRelatedComponent

public Component getRelatedComponent()
Specified by:
getRelatedComponent in interface Frame
Returns:
The related component such as a popup source, or null if the frame is not related to another component.

setRelatedComponent

public void setRelatedComponent(Component newRelatedComponent)
Sets the related component. This is a bound property.

Specified by:
setRelatedComponent in interface Frame
Parameters:
newRelatedComponent - The new related component, or null if the frame is not related to another component.
See Also:
Frame.RELATED_COMPONENT_PROPERTY

getTitleBackgroundColor

public Color getTitleBackgroundColor()
Specified by:
getTitleBackgroundColor in interface Frame
Returns:
The background color of the title, or null if no background color is specified for the title.

setTitleBackgroundColor

public void setTitleBackgroundColor(Color newTitleBackgroundColor)
Sets the background color of the title. This is a bound property.

Specified by:
setTitleBackgroundColor in interface Frame
Parameters:
newTitleBackgroundColor - The background color of the title, or null if the default background color should be used.
See Also:
Frame.TITLE_BACKGROUND_COLOR_PROPERTY

isTitleVisible

public boolean isTitleVisible()
Specified by:
isTitleVisible in interface Frame
Returns:
Whether the title bar is visible.

setTitleVisible

public void setTitleVisible(boolean newTitleVisible)
Sets whether the title bar is visible. This is a bound property of type Boolean.

Specified by:
setTitleVisible in interface Frame
Parameters:
newTitleVisible - true if the title bar should be visible, else false.
See Also:
Frame.TITLE_VISIBLE_PROPERTY

getOpenEffect

public Effect getOpenEffect()
Specified by:
getOpenEffect in interface Frame
Returns:
The effect used for opening the frame, or null if there is no open effect.

setOpenEffect

public void setOpenEffect(Effect newOpenEffect)
Sets the effect used for opening the frame. This is a bound property.

Specified by:
setOpenEffect in interface Frame
Parameters:
newEffect - The new effect used for opening the frame, or null if there should be no open effect.
See Also:
Frame.OPEN_EFFECT_PROPERTY

getContent

public Component getContent()
Specified by:
getContent in interface ContentComponent
Returns:
The content child component, or null if this frame does not have a content child component.
See Also:
AbstractFrame.FrameComponent.CONTENT_COMPONENT

setContent

public void setContent(Component newContent)
Sets the content child component. This is a bound property.

Specified by:
setContent in interface ContentComponent
Parameters:
newContent - The content child component, or null if this frame does not have a content child component.
See Also:
AbstractFrame.FrameComponent.CONTENT_COMPONENT, ContentComponent.CONTENT_PROPERTY

getMenu

public Menu getMenu()
Specified by:
getMenu in interface Frame
Returns:
The frame menu, or null if this frame does not have a menu.
See Also:
AbstractFrame.FrameComponent.MENU_COMPONENT

setMenu

public void setMenu(Menu newMenu)
Sets the frame menu. This is a bound property.

Specified by:
setMenu in interface Frame
Parameters:
newMenu - The frame menu, or null if this frame does not have a menu.
See Also:
AbstractFrame.FrameComponent.MENU_COMPONENT, Frame.MENU_PROPERTY

getToolbar

public Toolbar getToolbar()
Specified by:
getToolbar in interface Frame
Returns:
The frame toolbar, or null if this frame does not have a toolbar.
See Also:
AbstractFrame.FrameComponent.TOOLBAR_COMPONENT

setToolbar

public void setToolbar(Toolbar newToolbar)
Sets the frame toolbar. This is a bound property.

Specified by:
setToolbar in interface Frame
Parameters:
newToolbar - The frame toolbar, or null if this frame does not have a toolbar.
See Also:
AbstractFrame.FrameComponent.TOOLBAR_COMPONENT, Frame.TOOLBAR_PROPERTY

getPrototypeProvisionStrategy

protected FrameMenuToolPrototypeProvisionStrategy getPrototypeProvisionStrategy()
Returns:
The strategy for processing prototypes provisions from child prototype providers, along with this frame's prototype provisions.

getCloseActionControl

public ActionControl getCloseActionControl()
Specified by:
getCloseActionControl in interface Frame
Returns:
The action control for closing the frame, or null if this frame does not have a close action control.
See Also:
AbstractFrame.FrameComponent.CLOSE_ACTION_CONTROL

setCloseActionControl

public void setCloseActionControl(ActionControl newCloseActionControl)
Sets the action control for closing the frame. This is a bound property.

Specified by:
setCloseActionControl in interface Frame
Parameters:
newCloseActionControl - The action control for closing the frame, or null if this frame does not have a close action control.
See Also:
AbstractFrame.FrameComponent.CLOSE_ACTION_CONTROL, Frame.CLOSE_ACTION_CONTROL_PROPERTY

getInputFocusStrategy

public InputFocusStrategy getInputFocusStrategy()
Specified by:
getInputFocusStrategy in interface InputFocusGroupComponent
Returns:
The input focus strategy for this input focus group.

setInputFocusStrategy

public void setInputFocusStrategy(InputFocusStrategy newInputFocusStrategy)
Sets the input focus strategy. This is a bound property

Specified by:
setInputFocusStrategy in interface InputFocusGroupComponent
Parameters:
newInputFocusStrategy - The input focus strategy for this group.
Throws:
java.lang.NullPointerException - if the given input focus strategy is null.
See Also:
InputFocusGroupComponent.INPUT_FOCUS_STRATEGY_PROPERTY

getInputFocusedComponent

public InputFocusableComponent getInputFocusedComponent()
Indicates the component within this group that has the input focus. The focused component may be another InputFocusGroupComponent, which in turn will have its own focused component.

Specified by:
getInputFocusedComponent in interface InputFocusGroupComponent
Returns:
The component within this group that has the input focus, or null if no component currently has the input focus.

setInputFocusedComponent

public void setInputFocusedComponent(InputFocusableComponent newInputFocusedComponent)
                              throws java.beans.PropertyVetoException
Sets the focused component within this input focus group. This is a bound property.

Specified by:
setInputFocusedComponent in interface InputFocusGroupComponent
Parameters:
newInputFocusedComponent - The component to receive the input focus.
Throws:
java.beans.PropertyVetoException - if the given component is not a focusable component within this input focus group, the component cannot receive the input focus, or the input focus change has otherwise been vetoed.
See Also:
getInputFocusStrategy(), InputFocusGroupComponent.INPUT_FOCUSED_COMPONENT_PROPERTY

getCloseActionPrototype

public ActionPrototype getCloseActionPrototype()
Specified by:
getCloseActionPrototype in interface Frame
Returns:
The action prototype for closing the frame.

open

public void open()
Opens the frame with the currently set modality. Opening the frame registers the frame with the application frame. If the frame is already open, no action occurs.

Specified by:
open in interface Frame
See Also:
getState(), Frame.STATE_PROPERTY

open

public void open(boolean modal)
Opens the frame, specifying modality. Opening the frame registers the frame with the session. If the frame is already open, no action occurs.

Specified by:
open in interface Frame
Parameters:
modal - true if the frame should be opened as a modal frame, else false.
See Also:
getState(), Frame.STATE_PROPERTY

open

public void open(com.globalmentor.beans.GenericPropertyChangeListener<Frame.Mode> modeChangeListener)
Opens the frame as modal and installs the given property change listener to listen for the mode changing. This is a convenience method that adds the ModalComponent.MODE_PROPERTY change listener using BoundPropertyObject.addPropertyChangeListener(String, PropertyChangeListener) and then calls open(boolean) with a value of true.

Specified by:
open in interface Frame
Parameters:
modeChangeListener - The mode property change listener to add.
See Also:
ModalComponent.MODE_PROPERTY

canClose

public boolean canClose()
Determines whether the frame should be allowed to close. This implementation returns true. This method is called from close().

Specified by:
canClose in interface Frame
Returns:
true if the frame should be allowed to close.

close

public final void close()
Closes the frame. Closing the frame unregisters the frame with the session. If the frame is already closed, no action occurs. This method calls canClose() and only performs closing functionality if that method returns true. This method delegates actual closing to closeImpl(), and that method should be overridden rather than this one.

Specified by:
close in interface Frame
See Also:
getState(), Frame.STATE_PROPERTY

closeImpl

protected void closeImpl()
Implementation of frame closing.


validate

public boolean validate()
Validates the user input of this component and all child components. The component will be updated with error information. The user is also notified of any error, using this component's notification, the first notification in the content component, or a default message.

Specified by:
validate in interface Component
Overrides:
validate in class AbstractCompositeComponent
Returns:
The current state of AbstractComponent.isValid() as a convenience.

updateDefaultPrototypeProvisions

protected final void updateDefaultPrototypeProvisions()
Updates the default prototype provisions.

See Also:
provideDefaultPrototypes()

provideDefaultPrototypes

protected java.util.Set<PrototypeProvision<?>> provideDefaultPrototypes()
Provides default prototype provisions to be integrated into the menu and/or toolbar. The default prototype provisions are separate from those provided by any child component prototype producers. Subclasses may override this method to add or modify the default provided prototype provisions.

Returns:
A mutable set of default prototype provisions.


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.