Package com.bc.ceres.swing.binding
Interface Binding
-
public interface BindingA bi-directional binding between one or more Swing GUI components and a property in a value container.This class is not intended to be implemented by clients.
- Since:
- Ceres 0.6
- Version:
- $Revision$ $Date$
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddComponent(JComponent component)Adds a secondary Swing component to this binding, e.g.voidadjustComponents()Adjusts the Swing components in reaction to a bound property change event in the associatedPropertyContainer.voidclearProblem()Clears the current problem.ComponentAdaptergetComponentAdapter()JComponent[]getComponents()Gets all components participating in this binding: the one returned by the associatedComponentAdapterplus the ones added to this binding using theaddComponent(javax.swing.JComponent)method.BindingContextgetContext()BindingProblemgetProblem()Gets the current problem.StringgetPropertyName()ObjectgetPropertyValue()booleanisAdjustingComponents()Tests if this binding is currently adjusting the bound GUI components.voidremoveComponent(JComponent component)Removes a secondary Swing component from this binding.BindingProblemreportProblem(BindingException cause)Reports a problem.voidsetPropertyValue(Object value)Sets the value of the bound property.
-
-
-
Method Detail
-
getContext
BindingContext getContext()
- Returns:
- The binding context.
-
getComponentAdapter
ComponentAdapter getComponentAdapter()
- Returns:
- The component adapter.
-
getPropertyName
String getPropertyName()
- Returns:
- The name of the bound property.
-
getPropertyValue
Object getPropertyValue()
- Returns:
- The value of the bound property.
-
setPropertyValue
void setPropertyValue(Object value)
Sets the value of the bound property. This may trigger a property change event in the associatedPropertyContainer. Whether or not setting the value was successful can be retrieved bygetProblem().- Parameters:
value- The new value of the bound property.
-
getProblem
BindingProblem getProblem()
Gets the current problem. If the GUI is in sync with the associated property, the method will returnnull.- Returns:
- The current problem, or
null. - Since:
- Ceres 0.10
-
clearProblem
void clearProblem()
Clears the current problem.- Since:
- Ceres 0.10
-
reportProblem
BindingProblem reportProblem(BindingException cause)
Reports a problem. The method sets the current problem and will cause thecontextto fire a problem-occurred event.- Parameters:
cause- The cause.- Returns:
- The resulting problem.
- Since:
- Ceres 0.10
-
adjustComponents
void adjustComponents()
Adjusts the Swing components in reaction to a bound property change event in the associatedPropertyContainer.The method delegates to
ComponentAdapter.adjustComponents(), but only if this binding is not already adjusting its GUI components.After calling this method the UI is in-sync with the property, so that
getProblem()will returnnull.- See Also:
isAdjustingComponents()
-
isAdjustingComponents
boolean isAdjustingComponents()
Tests if this binding is currently adjusting the bound GUI components.- Returns:
trueif so.- See Also:
adjustComponents()
-
getComponents
JComponent[] getComponents()
Gets all components participating in this binding: the one returned by the associatedComponentAdapterplus the ones added to this binding using theaddComponent(javax.swing.JComponent)method.- Returns:
- All components participating in this binding.
-
addComponent
void addComponent(JComponent component)
Adds a secondary Swing component to this binding, e.g. aJLabel.- Parameters:
component- The secondary component.- See Also:
removeComponent(javax.swing.JComponent)
-
removeComponent
void removeComponent(JComponent component)
Removes a secondary Swing component from this binding.- Parameters:
component- The secondary component.- See Also:
addComponent(javax.swing.JComponent)
-
-