From 7a41edba5a134f0434a7010953bc66f87da95787 Mon Sep 17 00:00:00 2001 From: Aleksey Kozyaikin Date: Fri, 31 May 2013 12:06:05 +0000 Subject: [PATCH] =?UTF-8?q?PickerField=20NPE=20=D0=B5=D1=81=D0=BB=D0=B8=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D1=83=D0=BA=D0=B0=D0=B7=D0=B0=D0=BD=20datasourc?= =?UTF-8?q?e=20=20#PL-2188=20Fixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cuba/gui/components/PickerField.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/modules/gui/src/com/haulmont/cuba/gui/components/PickerField.java b/modules/gui/src/com/haulmont/cuba/gui/components/PickerField.java index 5f29ded448..468e7aa746 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/components/PickerField.java +++ b/modules/gui/src/com/haulmont/cuba/gui/components/PickerField.java @@ -29,29 +29,34 @@ import java.util.Map; /** * PickerField component generic interface.
* - * @see LookupPickerField - * * @author abramov * @version $Id$ + * @see LookupPickerField */ public interface PickerField extends Field, Component.ActionsHolder { String NAME = "pickerField"; CaptionMode getCaptionMode(); + void setCaptionMode(CaptionMode captionMode); String getCaptionProperty(); + void setCaptionProperty(String captionProperty); MetaClass getMetaClass(); + void setMetaClass(MetaClass metaClass); LookupAction addLookupAction(); + ClearAction addClearAction(); + OpenAction addOpenAction(); void addFieldListener(FieldListener listener); + void setFieldEditable(boolean editable); public interface FieldListener { @@ -97,7 +102,7 @@ public interface PickerField extends Field, Component.ActionsHolder { public abstract Action createAction(PickerField pickerField); } - public static abstract class StandardAction extends AbstractAction implements ShortcutAction{ + public static abstract class StandardAction extends AbstractAction implements ShortcutAction { protected PickerField pickerField; @@ -337,11 +342,12 @@ public interface PickerField extends Field, Component.ActionsHolder { if (optionsDatasource != null && optionsDatasource.containsItem(item.getId())) { optionsDatasource.updateItem(item); } - - boolean modified = lookupPickerField.getDatasource().isModified(); - lookupPickerField.setValue(null); - lookupPickerField.setValue(item); - ((DatasourceImplementation) lookupPickerField.getDatasource()).setModified(modified); + if (lookupPickerField.getDatasource() != null) { + boolean modified = lookupPickerField.getDatasource().isModified(); + lookupPickerField.setValue(null); + lookupPickerField.setValue(item); + ((DatasourceImplementation) lookupPickerField.getDatasource()).setModified(modified); + } } @Override