|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.globalmentor.beans.BoundPropertyObject
com.guiseframework.event.GuiseBoundPropertyObject
com.guiseframework.component.layout.AbstractLayout<T>
com.guiseframework.component.layout.AbstractValueLayout<T>
T - The type of layout constraints associated with each component.public abstract class AbstractValueLayout<T extends Constraints>
A layout that manages the selection of child components, only one of which can be selected at a time.
A value layout can only be used with a Container as its owner.
The layout maintains its own value model that maintains the current selected component.
If a child component implements Activeable the child component is set as active when selected and set as inactive when the child component is unselected.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.guiseframework.component.layout.AbstractLayout |
|---|
AbstractLayout.ConstraintsPropertyChangeListener |
| Field Summary |
|---|
| Fields inherited from class com.globalmentor.beans.BoundPropertyObject |
|---|
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS |
| Fields inherited from interface com.guiseframework.model.ValueModel |
|---|
VALIDATOR_PROPERTY, VALUE_PROPERTY |
| Fields inherited from interface com.guiseframework.model.Model |
|---|
PLAIN_TEXT_CONTENT_TYPE, XHTML_CONTENT_TYPE, XHTML_FRAGMENT_CONTENT_TYPE |
| Constructor Summary | |
|---|---|
AbstractValueLayout()
Default constructor. |
|
| Method Summary | |
|---|---|
void |
addComponent(Component component)
Adds a component to the layout. |
void |
clearValue()
Clears the value by setting the value to null, which may be invalid according to any installed validators. |
Component |
getDefaultValue()
|
Container |
getOwner()
|
int |
getSelectedIndex()
|
Validator<Component> |
getValidator()
|
Component |
getValue()
|
java.lang.Class<Component> |
getValueClass()
|
protected ValueModel<Component> |
getValueModel()
|
boolean |
isValidValue()
Determines whether the value of this model is valid. |
void |
removeComponent(Component component)
Removes a component from the layout. |
void |
resetValue()
Resets the value to a default value, which may be invalid according to any installed validators. |
void |
setOwner(LayoutComponent newOwner)
Sets the container that owns this layout This method is managed by containers, and normally should not be called by applications. |
void |
setSelectedIndex(int newIndex)
Sets the index of the selected component. |
void |
setValidator(Validator<Component> newValidator)
Sets the validator. |
void |
setValue(Component newValue)
Sets the input value. |
void |
validateValue()
Validates the value of this model, throwing an exception if the model is not valid. |
| Methods inherited from class com.guiseframework.component.layout.AbstractLayout |
|---|
componentConstraintsChanged, fireConstraintsPropertyChange, getComponentConstraintsChangeListener, getConstraints, getConstraintsPropertyChangeListener |
| 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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 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 |
| Methods inherited from interface com.guiseframework.component.layout.Layout |
|---|
createDefaultConstraints, getConstraintsClass, getSession |
| Constructor Detail |
|---|
public AbstractValueLayout()
| Method Detail |
|---|
protected ValueModel<Component> getValueModel()
public int getSelectedIndex()
public void setSelectedIndex(int newIndex)
throws java.beans.PropertyVetoException
Throwable.getCause().
newIndex - The index of the selected component, or -1 if no component is selected.
java.lang.IllegalStateException - if this layout has not yet been installed into a container.
java.lang.IndexOutOfBoundsException - if the index is out of range.
java.beans.PropertyVetoException - if the component at the given index is not a valid compoment to select or the change has otherwise been vetoed.public void addComponent(Component component)
Activeable.
addComponent in interface Layout<T extends Constraints>addComponent in class AbstractLayout<T extends Constraints>component - The component to add to the layout.
java.lang.IllegalStateException - if this layout has not yet been installed into a container.public void removeComponent(Component component)
removeComponent in interface Layout<T extends Constraints>removeComponent in class AbstractLayout<T extends Constraints>component - The component to remove from the layout.public Container getOwner()
getOwner in interface Layout<T extends Constraints>getOwner in class AbstractLayout<T extends Constraints>null if this layout has not been installed into a container.public void setOwner(LayoutComponent newOwner)
setOwner in interface Layout<T extends Constraints>setOwner in class AbstractLayout<T extends Constraints>newOwner - The new container for this layout.
//TODO del @exception NullPointerException if the given container is null.
java.lang.IllegalStateException - if a different container is provided and this layout already has a container.
java.lang.ClassCastException - if the given layout component is not a Container.
java.lang.IllegalArgumentException - if a different container is provided and the given container does not already recognize this layout as its layout.public Component getDefaultValue()
getDefaultValue in interface ValueModel<Component>public Component getValue()
getValue in interface Valued<Component>getValue in interface ValueModel<Component>null if there is no input value.
public void setValue(Component newValue)
throws java.beans.PropertyVetoException
equals() method.
If a validator is installed, the value will first be validated before the current value is changed.
Validation always occurs if a validator is installed, even if the value is not changing.
If the value change is vetoed by the installed validator, the validation exception will be accessible via Throwable.getCause().
This version makes sure that the given component is contained in the container, and resets the cached selected index so that it can be recalculated.
This version updates the active status of the old and new components if the implement Activeable.
setValue in interface Valued<Component>setValue in interface ValueModel<Component>newValue - The input value of the model.
java.beans.PropertyVetoException - if the provided value is not valid or the change has otherwise been vetoed.getValidator(),
ValueModel.VALUE_PROPERTYpublic void clearValue()
null, which may be invalid according to any installed validators.
No validation occurs.
This version resets the cached selected index so that it can be recalculated.
clearValue in interface ValueModel<Component>ValueModel.VALUE_PROPERTYpublic void resetValue()
resetValue in interface ValueModel<Component>ValueModel.VALUE_PROPERTYpublic Validator<Component> getValidator()
getValidator in interface ValueModel<Component>null if no validator is installed.public void setValidator(Validator<Component> newValidator)
setValidator in interface ValueModel<Component>newValidator - The validator for this model, or null if no validator should be used.ValueModel.VALIDATOR_PROPERTYpublic boolean isValidValue()
isValidValue in interface ValueModel<Component>
public void validateValue()
throws ValidationException
validateValue in interface ValueModel<Component>ValidationException - if the value of this model is not valid.public java.lang.Class<Component> getValueClass()
getValueClass in interface ValueModel<Component>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||