Package org.apache.groovy.swing.binding
Class ClosureSourceBinding
java.lang.Object
org.apache.groovy.swing.binding.ClosureSourceBinding
- All Implemented Interfaces:
SourceBinding
Uses a closure invocation to compute a source value for a binding.
- Since:
- Groovy 1.1
-
Constructor Summary
ConstructorsConstructorDescriptionClosureSourceBinding(Closure closure) Creates a source binding that invokes the closure with no arguments.ClosureSourceBinding(Closure closure, Object[] arguments) Creates a source binding that invokes the closure with the supplied arguments. -
Method Summary
Modifier and TypeMethodDescriptionReturns the closure used to compute source values.Invokes the configured closure with the current argument list.voidsetClosure(Closure closure) Replaces the closure used to compute source values.voidsetClosureArgument(Object argument) Replaces the closure arguments with a single argument.voidsetClosureArguments(Object[] arguments) Replaces the full argument list passed to the closure.
-
Constructor Details
-
ClosureSourceBinding
Creates a source binding that invokes the closure with no arguments.- Parameters:
closure- the closure used to compute source values
-
ClosureSourceBinding
Creates a source binding that invokes the closure with the supplied arguments.- Parameters:
closure- the closure used to compute source valuesarguments- the closure arguments to supply
-
-
Method Details
-
getClosure
Returns the closure used to compute source values.- Returns:
- the source closure
-
setClosure
Replaces the closure used to compute source values.- Parameters:
closure- the new source closure
-
getSourceValue
Invokes the configured closure with the current argument list.- Specified by:
getSourceValuein interfaceSourceBinding- Returns:
- the computed source value
-
setClosureArguments
Replaces the full argument list passed to the closure.- Parameters:
arguments- the closure arguments to use
-
setClosureArgument
Replaces the closure arguments with a single argument.- Parameters:
argument- the single closure argument to use
-