All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.zkoss.bind.impl.BindContextUtil Maven / Gradle / Ivy
/* BindContextUtil.java
Purpose:
Description:
History:
2011/10/19 Created by Dennis Chen
Copyright (C) 2011 Potix Corporation. All Rights Reserved.
*/
package org.zkoss.bind.impl;
import java.util.Map;
import org.zkoss.bind.BindContext;
import org.zkoss.bind.Binder;
import org.zkoss.bind.sys.Binding;
import org.zkoss.bind.sys.PropertyBinding;
import org.zkoss.bind.sys.SaveFormBinding;
import org.zkoss.bind.sys.SavePropertyBinding;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
/**
* to help handling BindContext, internal use only,
*
* @author dennis
* @since 6.0.0
*/
public class BindContextUtil {
public static BindContext newBindContext(Binder binder, Binding binding, boolean save, String command,
Component comp, Event event) {
BindContext ctx = new BindContextImpl(binder, binding, save, command, comp, event);
if (binding != null) {
setBindingArgs(binder, comp, ctx, binding);
}
return ctx;
}
public static void setCommandArgs(Binder binder, Component comp, BindContext ctx, Map args) {
ctx.setAttribute(BindContextImpl.COMMAND_ARGS, args);
}
private static void setBindingArgs(Binder binder, Component comp, BindContext ctx, Binding binding) {
ctx.setAttribute(BindContextImpl.BINDING_ARGS,
BindEvaluatorXUtil.evalArgs(binder.getEvaluatorX(), comp, binding.getArgs()));
}
public static void setConverterArgs(Binder binder, Component comp, BindContext ctx, PropertyBinding binding) {
ctx.setAttribute(BindContextImpl.CONVERTER_ARGS,
BindEvaluatorXUtil.evalArgs(binder.getEvaluatorX(), comp, binding.getConverterArgs()));
}
public static void setValidatorArgs(Binder binder, Component comp, BindContext ctx, SavePropertyBinding binding) {
ctx.setAttribute(BindContextImpl.VALIDATOR_ARGS,
BindEvaluatorXUtil.evalArgs(binder.getEvaluatorX(), comp, binding.getValidatorArgs()));
}
public static void setValidatorArgs(Binder binder, Component comp, BindContext ctx, SaveFormBinding binding) {
ctx.setAttribute(BindContextImpl.VALIDATOR_ARGS,
BindEvaluatorXUtil.evalArgs(binder.getEvaluatorX(), comp, binding.getValidatorArgs()));
}
// public static void setIgnoreTracker(BindContext ctx,boolean b) {
// if(b){
// ctx.setAttribute(BinderImpl.IGNORE_TRACKER, Boolean.TRUE);
// }else{
// ctx.setAttribute(BinderImpl.IGNORE_TRACKER, null);
// }
// }
}