use of org.zkoss.bind.Binder in project collect by openforis.
the class NodeDefinitionVM method validateForm.
protected void validateForm(@ContextParam(ContextType.BINDER) Binder binder) {
Component view = binder.getView();
IdSpace currentIdSpace = view.getSpaceOwner();
Component formComponent = Path.getComponent(currentIdSpace, FORM_CONTAINER_ID);
Binder formComponentBinder = (Binder) formComponent.getAttribute("binder");
formComponentBinder.postCommand("applyChanges", null);
}
use of org.zkoss.bind.Binder in project collect by openforis.
the class BaseValidator method getVM.
@SuppressWarnings("unchecked")
protected <T extends BaseVM> T getVM(ValidationContext ctx) {
BindContext bindContext = ctx.getBindContext();
Binder binder = bindContext.getBinder();
Object vmObject = binder.getViewModel();
if (vmObject == null) {
throw new IllegalStateException("Unable to find view model instance");
}
return (T) vmObject;
}
use of org.zkoss.bind.Binder in project collect by openforis.
the class ComponentUtil method getAncestorViewModel.
@SuppressWarnings("unchecked")
public static <T> T getAncestorViewModel(Component component, Class<T> viewModelClass) {
Component currentParent = component.getParent();
while (currentParent != null) {
Binder binder = getBinder(currentParent);
if (binder != null) {
Object vm = binder.getViewModel();
if (vm != null && viewModelClass.isAssignableFrom(vm.getClass())) {
return (T) vm;
}
}
currentParent = currentParent.getParent();
}
return null;
}
use of org.zkoss.bind.Binder in project collect by openforis.
the class ComponentUtil method getViewModel.
@SuppressWarnings("unchecked")
public static <T> T getViewModel(Component component) {
Binder binder = getBinder(component);
Object viewModel = binder.getViewModel();
return (T) viewModel;
}
use of org.zkoss.bind.Binder in project collect by openforis.
the class SchemaVM method applyChangesToForm.
protected void applyChangesToForm(IdSpace idSpace) {
Binder binder = getNodeFormBinder(idSpace);
binder.postCommand(APPLY_CHANGES_COMMAND, null);
}
Aggregations