Package com.bc.ceres.swing.binding
Interface Binding
public interface Binding
A 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
Modifier and TypeMethodDescriptionvoid
addComponent
(JComponent component) Adds a secondary Swing component to this binding, e.g.void
Adjusts the Swing components in reaction to a bound property change event in the associatedPropertyContainer
.void
Clears the current problem.Gets all components participating in this binding: the one returned by the associatedComponentAdapter
plus the ones added to this binding using theaddComponent(javax.swing.JComponent)
method.Gets the current problem.boolean
Tests if this binding is currently adjusting the bound GUI components.void
removeComponent
(JComponent component) Removes a secondary Swing component from this binding.reportProblem
(BindingException cause) Reports a problem.void
setPropertyValue
(Object value) Sets the value of the bound property.
-
Method Details
-
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
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
Reports a problem. The method sets the current problem and will cause thecontext
to 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
boolean isAdjustingComponents()Tests if this binding is currently adjusting the bound GUI components.- Returns:
true
if so.- See Also:
-
getComponents
JComponent[] getComponents()Gets all components participating in this binding: the one returned by the associatedComponentAdapter
plus the ones added to this binding using theaddComponent(javax.swing.JComponent)
method.- Returns:
- All components participating in this binding.
-
addComponent
Adds a secondary Swing component to this binding, e.g. aJLabel
.- Parameters:
component
- The secondary component.- See Also:
-
removeComponent
Removes a secondary Swing component from this binding.- Parameters:
component
- The secondary component.- See Also:
-