【发布时间】:2020-01-23 16:21:07
【问题描述】:
我调用这个ImportCommandAction,它被定义为公共类ImportCommandAction <D extends ActionDefinition> extends AbstractVersionAction<D>,作为页面上的一个动作。自定义导入操作有自己的 VersionName 类并覆盖 getBeanItemClass()。每次我调用这个类时,我都会在日志中得到一个条目
警告 magnolia.ui.form.field.factory.AbstractFieldFactory: BeanItem id versionName 没有任何属性,返回默认值 属性。
我不明白这个警告以及 ui.form.field.factory.AbstractFieldFactory 所指的 id。该类打开一个对话框并列出来自内部 git 存储库的所有版本(提交)。
类代码:
public ImportCommandAction(
D definition, AppContext appContext, LocationController locationController,
UiContext uiContext, FormDialogPresenter formDialogPresenter,
AbstractJcrNodeAdapter nodeAdapter, SimpleTranslator i18n,
ContentConnector contentConnector)
{
super(definition, locationController, uiContext, formDialogPresenter, i18n);
this.nodeAdapter = nodeAdapter;
this.appContext = appContext;
this.dialogID = "ui-contentapp:code:ImportCommandAction.selectVersion";
this.contentConnector = contentConnector;
}
@Override
protected Class getBeanItemClass() {
return VersionName.class;
}
@Override
protected FormDialogDefinition buildNewComponentDialog()
throws ActionExecutionException, RepositoryException {
ConfiguredFormDefinition form = new ConfiguredFormDefinition();
ConfiguredTabDefinition tab = new ConfiguredTabDefinition();
tab.setName("versions");
SelectFieldDefinition select = new SelectFieldDefinition();
select.setName(VersionName.PROPERTY_NAME_VERSION_NAME);
select.setSortOptions(false);
tab.addField(select); //more code follows
}
@Override
protected Node getNode() throws RepositoryException {
return nodeAdapter.getJcrItem();
}
protected String getVersionName() {
return (String) getItem()
.getItemProperty(VersionName.PROPERTY_NAME_VERSION_NAME)
.getValue();
}
/**
* Simple POJO used to access user selection from dialog,
* see {@link com.vaadin.data.util.BeanItem}.
*/
protected class VersionName {
protected final static String PROPERTY_NAME_VERSION_NAME = "versionName";
private String versionName;
public String getVersionName() {
return versionName;
}
public void setVersionName(String versionName) {
this.versionName = versionName;
}
}
}
【问题讨论】:
-
嗨,安娜,我不太明白这个问题。你能详细说明一下吗?
-
嗨@Ducaz035。我调用这个 ImportCommandAction,它被定义为
public class ImportCommandAction <D extends ActionDefinition> extends AbstractVersionAction<D>作为页面上的一个操作。自定义导入操作有自己的 VersionName 类并覆盖getBeanItemClass()。每次我调用这个类时,我都会在日志中得到一个条目 WARN magnolia.ui.form.field.factory.AbstractFieldFactory: BeanItem does not have any property for id versionName, return default property 我没有了解此警告以及 ui.form.field.factory.AbstractFieldFactory 所指的 id。