Java 木兰原木中的工厂警告
我调用这个Java 木兰原木中的工厂警告,java,magnolia,Java,Magnolia,我调用这个ImportCommandAction,它被定义为公共类ImportCommandAction扩展了AbstractVersionAction,作为页面上的一个操作。自定义导入操作有其自己的VersionName类,并重写getBeanItemClass()。每次调用这个类时,我都会在日志中得到一个条目 WARN magnolia.ui.form.field.factory.AbstractFieldFactory:BeanItem 没有id versionName的任何属性,返回默认
ImportCommandAction
,它被定义为公共类ImportCommandAction扩展了AbstractVersionAction
,作为页面上的一个操作。自定义导入操作有其自己的VersionName类,并重写getBeanItemClass()。每次调用这个类时,我都会在日志中得到一个条目
WARN 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;
}
}
}
这意味着注入fieldFactory的项找不到具有Definition#名称的属性。在您的例子中,Defion#name是versionName,为了不使fieldFactory全部失败,它会返回到默认值。我将调试导致这种行为的字段,并从那里继续调查 希望有帮助
干杯嗨,安娜,我没听清楚这个问题。你能详细解释一下吗?嗨,Ducaz035。我调用这个ImportCommandAction,它被定义为
公共类ImportCommandAction扩展了AbstractVersionAction
,作为页面上的一个操作。自定义导入操作有自己的VersionName类,并覆盖getBeanItemClass()
。每次调用这个类时,我都会在日志中看到一个条目WARN magnolia.ui.form.field.factory.AbstractFieldFactory:BeanItem没有id versionName的任何属性,返回默认属性,我不理解这个警告以及ui.form.field.factory.AbstractFieldFactory引用的id。谢谢@Ducaz035。它出现在第行final String label=dialogDefinition.getLabel()在private void buildView(FormDialogDefinition dialogDefinition)
中,code>正在生成警告magnolia.ui.form.field.factory.AbstractFieldFactory:BeanItem没有id versionName的任何属性,返回默认属性。
我如何找到BeanItem有哪些属性以及如何将此属性添加到其中?