Nastavení hodnot middle objektu bez validace.

closes #169
Verze_1.0
František Přibyl 10 years ago
parent ab9a5577d9
commit 7c6a43baf6

@ -2,7 +2,7 @@ package info.bukova.isspst.ui;
import java.lang.reflect.InvocationTargetException;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.PropertyUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zkoss.bind.SimpleForm;
@ -34,12 +34,32 @@ public class BindingForm<T> extends SimpleForm {
*/
public void bindTo(T object) {
for (String key : getFieldNames()) {
try {
BeanUtils.setProperty(object, key, getField(key));
} catch (IllegalAccessException e) {
// try {
// BeanUtils.setProperty(object, key, getField(key));
//
// } catch (IllegalAccessException e) {
// logger.warn("Cannot bind value", e);
// } catch (InvocationTargetException e) {
// logger.warn("Cannot bind value", e);
// }
try
{
PropertyUtils.setProperty(object, key, getField(key));
}
catch (NoSuchMethodException e)
{
logger.warn("Cannot bind value " + key + " (" + e.getMessage() + ")");
// e.printStackTrace();
}
catch (IllegalAccessException e)
{
logger.warn("Cannot bind value", e);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
catch (InvocationTargetException e)
{
logger.warn("Cannot bind value", e);
e.printStackTrace();
}
}
}

@ -194,6 +194,7 @@ public class OrderForm extends FormViewModel<Order>
@NotifyChange("dataBean")
public void doFillSuppAddress()
{
this.getDataForm().bind();
AddressEmb addr;
if (this.selectedSuppAddrItem == null)
@ -215,6 +216,7 @@ public class OrderForm extends FormViewModel<Order>
@NotifyChange("dataBean")
public void doFillDeliveryAddress()
{
this.getDataForm().bind();
AddressEmb addr;
if (this.selectedDeliveryAddrItem == null)

@ -18,7 +18,7 @@
label="${labels.Order}" />
<vlayout
sclass="addScrollbar"
form="@id('fx') @load(vm.dataBean) @save(vm.dataBean, before='save') @validator(vm.orderFormValidator)"
form="@id('fx') @init(vm.dataForm) @load(vm.dataBean) @save(vm.dataBean, before='save') @validator(vm.orderFormValidator)"
hflex="1"
vflex="1">
<hlayout

Loading…
Cancel
Save