to.etc.domui.component.input
Class SimpleBinder

java.lang.Object
  extended by to.etc.domui.component.input.SimpleBinder
All Implemented Interfaces:
IModelBinding, IBinder

public class SimpleBinder
extends java.lang.Object
implements IBinder

EXPERIMENTAL - DO NOT USE. This is a simple binder implementation for base IInputNode implementing controls. It handles all binding chores.

Author:
Frits Jalvingh Created on Oct 13, 2009

Constructor Summary
SimpleBinder(IInputNode<?> control)
           
 
Method Summary
 boolean isBound()
          Returns T if this contains an actual binding.
 void moveControlToModel()
          Move the control value to wherever it's needed.
 void moveModelToControl()
           
 void setControlsEnabled(boolean on)
           
<T> void
to(java.lang.Class<T> theClass, IReadOnlyModel<T> model, java.lang.String property)
          Bind to a property of the object returned by this model.
 void to(IBindingListener<?> listener)
          Bind the control to a listener.
<T> void
to(IReadOnlyModel<T> model, PropertyMetaModel<?> pmm)
          Bind to a property on some model whose metadata is passed.
 void to(java.lang.Object instance, PropertyMetaModel<?> pmm)
          Bind to a propertyMetaModel and the given instance.
 void to(java.lang.Object instance, java.lang.String property)
          Bind to a property of the instance specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleBinder

public SimpleBinder(IInputNode<?> control)
Method Detail

isBound

public boolean isBound()
Returns T if this contains an actual binding. We are bound if property is set OR a listener is set.

Specified by:
isBound in interface IBinder
Returns:
See Also:
IBinder.isBound()

to

public <T> void to(@Nonnull
                   java.lang.Class<T> theClass,
                   @Nonnull
                   IReadOnlyModel<T> model,
                   @Nonnull
                   java.lang.String property)
Bind to a property of the object returned by this model.

Specified by:
to in interface IBinder
See Also:
IBinder.to(java.lang.Class, to.etc.domui.util.IReadOnlyModel, java.lang.String)

to

public <T> void to(@Nonnull
                   IReadOnlyModel<T> model,
                   @Nonnull
                   PropertyMetaModel<?> pmm)
Bind to a property on some model whose metadata is passed.

Specified by:
to in interface IBinder
Type Parameters:
T -
Parameters:
model -
pmm -

to

public void to(@Nonnull
               IBindingListener<?> listener)
Description copied from interface: IBinder
Bind the control to a listener.

Specified by:
to in interface IBinder
See Also:
IBinder.to(to.etc.domui.component.input.IBindingListener)

to

public void to(@Nonnull
               java.lang.Object instance,
               @Nonnull
               java.lang.String property)
Bind to a property of the instance specified.

Specified by:
to in interface IBinder
See Also:
IBinder.to(java.lang.Object, java.lang.String)

to

public void to(@Nonnull
               java.lang.Object instance,
               @Nonnull
               PropertyMetaModel<?> pmm)
Bind to a propertyMetaModel and the given instance.

Specified by:
to in interface IBinder
Parameters:
instance -
pmm -

moveControlToModel

public void moveControlToModel()
                        throws java.lang.Exception
Move the control value to wherever it's needed. If this is a listener binding it calls the listener, else it moves the value either to the model's value or the instance's value.

Specified by:
moveControlToModel in interface IModelBinding
Throws:
java.lang.Exception
See Also:
IModelBinding.moveControlToModel()

moveModelToControl

public void moveModelToControl()
                        throws java.lang.Exception
Specified by:
moveModelToControl in interface IModelBinding
Throws:
java.lang.Exception

setControlsEnabled

public void setControlsEnabled(boolean on)
Specified by:
setControlsEnabled in interface IModelBinding