com.dragome.forms.bindings.client.binding.TransitionBindingBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dragome-form-bindings Show documentation
Show all versions of dragome-form-bindings Show documentation
Dragome SDK module: form bindings
package com.dragome.forms.bindings.client.binding;
import com.dragome.forms.bindings.client.value.ValueModel;
import com.dragome.forms.bindings.extra.user.client.Command;
/**
* Created by IntelliJ IDEA.
* User: andrew
* Date: Apr 13, 2010
* Time: 12:19:55 PM
* To change this template use File | Settings | File Templates.
*/
public class TransitionBindingBuilder
{
private BindingContainer bindingContainer;
private ValueModel model;
public TransitionBindingBuilder(BindingContainer bindingContainer, ValueModel model)
{
this.bindingContainer= bindingContainer;
this.model= model;
}
public CommandBinder to(T triggerValue)
{
return new CommandBinder(new TransitionToBinding(triggerValue, model.getValue()));
}
public CommandBinder from(T triggerValue)
{
return new CommandBinder(new TransitionFromBinding(triggerValue, model.getValue()));
}
public class CommandBinder
{
private TransitionBindingSupport binding;
public CommandBinder(TransitionBindingSupport binding)
{
this.binding= binding;
}
public void invoke(Command command)
{
binding.setCommand(command);
bindingContainer.registerDisposable(model.addValueChangeHandler(binding));
}
}
}