我正在学习如何在XPAGES上创建UI控件(http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Master_Table_of_Contents_for_XPages_Extensibility_APIs_Developer_Guide)
我创建了自己的控件,并使用属性标记在xsp-config中设置了单个属性。但是当我尝试使用property-type标签设置组属性时,不会显示该组属性。
这是我的xsp-config
<faces-config>
<faces-config-extension>
<namespace-uri>http://fortedynamic.org/xsp/control</namespace-uri>
<default-prefix>forte</default-prefix>
</faces-config-extension>
<component>
<description>Forte Input Text</description>
<display-name>Input Text</display-name>
<component-type>com.forte.InputText</component-type>
<component-class>com.forte.component.InputText</component-class>
<component-extension>
<component-family>com.forte.InputText</component-family>
<renderer-type>com.forte.InputText</renderer-type>
<tag-name>inputText</tag-name>
<designer-extension>
<in-palette>true</in-palette>
<category>Forte Library</category>
</designer-extension>
</component-extension>
<property>
<description>Data Source</description>
<display-name>Data Source</display-name>
<property-name>value</property-name>
<property-class>string</property-class>
<property-extension>
<designer-extension>
<category>forte</category>
</designer-extension>
</property-extension>
</property>
<property-type>
<property-name>event</property-name>
<display-name>Event</display-name>
<property-extension>
<container-class>java.util.Collection</container-class>
<collection-property>true</collection-property>
<designer-extension>
<category>forte</category>
</designer-extension>
</property-extension>
<property>
<property-name>refreshId</property-name>
<property-class>string</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.designer.domino.xsp.idpicker</editor>
</designer-extension>
</property-extension>
</property>
<property>
<property-name>clientEvent</property-name>
<property-class>string</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.designer.domino.client.script.editor</editor>
</designer-extension>
</property-extension>
</property>
<property>
<property-name>serverEvent</property-name>
<property-class>com.ibm.xsp.actions.ExecuteScriptAction</property-class>
</property>
<property>
<property-name>onStart</property-name>
<property-class>string</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.designer.domino.client.script.editor</editor>
</designer-extension>
</property-extension>
</property>
<property>
<property-name>onError</property-name>
<property-class>string</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.designer.domino.client.script.editor</editor>
</designer-extension>
</property-extension>
</property>
<property>
<property-name>onComplete</property-name>
<property-class>string</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.designer.domino.client.script.editor</editor>
</designer-extension>
</property-extension>
</property>
<property>
<property-name>immediate</property-name>
<property-class>boolean</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.std.BooleanCheckBox</editor>
</designer-extension>
</property-extension>
</property>
</property-type>
</component>
</faces-config>
注意:
此xsp-config的结果可以显示:“Data Source”属性,但不显示“Event”组属性。
我是否会错过在xsp-config上配置的内容?
答案 0 :(得分:0)
我不确定是否使用了属性扩展,但是当我在自定义控件中手动创建一组属性时,请在自定义控件下的Package Explorer中查看xsp-config文件,它看起来像这些课是错的。
您是否想要一个用户输入java.util.Collection实例的单个属性?如果是这样,试试这个:
<property>
<property-name>event</property-name>
<display-name>Event</display-name>
<property-extension>
<property-item-class>java.util.Collection</property-item-class>
<collection-property>true</collection-property>
<designer-extension>
<category>forte</category>
</designer-extension>
</property-extension>
</property>
如果您想要一个具有多个实例的属性,请尝试:
<property>
<property-name>event</property-name>
<display-name>Event</display-name>
<property-class>java.util.Collection</property-class>
<property-extension>
<property-item-class>YOUR INDIVIDUAL PROPERTY TYPE</property-item-class>
<collection-property>true</collection-property>
<designer-extension>
<category>forte</category>
</designer-extension>
</property-extension>
</property>
您可以允许用户使用SSJS编辑器输入<editor>com.ibm.workplace.designer.ide.xfaces.internal.editors.MethodBindingEditor</editor>
到<designer-extension>
答案 1 :(得分:0)
因此,听起来您想为可选属性值提供一个组合框。为此,请在属性中遵循以下模式:
<property id="scrollDirection">
<description>The direction to scroll. Use "v" for vertical or "h" for horizontal. Defaults to "v"</description>
<display-name>Scroll Direction</display-name>
<property-name>scrollDirection</property-name>
<property-class>java.lang.String</property-class>
<property-extension>
<designer-extension>
<editor>com.ibm.workplace.designer.property.editors.comboParameterEditor</editor>
<editor-parameter>
v|Vertical
h|Horizontal
</editor-parameter>
</designer-extension>
</property-extension>
</property>
创建实际组:
<group id="Some meaningful name">
<description>A description of the group</description>
<group-type>some.name.space.name</group-type>
<property>
<description>A normal property definition</description>
....
</property>
</group>
您可以在此处找到总xsp-config / faces-config参考: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/XPages_configuration_file_format
编辑:啊,好的。所以在看完你的评论后我想我明白了。您希望能够将项目添加到列表中。因此,您必须创建一个复杂类型来支持此功能。
<complex-type id="CustomProperty">
<description>Custom Complex Type property</description>
<display-name>Custom Complex Type Property</display-name>
<complex-id>com.acme.xsp.CustomProperty</complex-id>
<complex-class>com.acme.xsp.components.CustomComplexType</complex-class>
<property>
<description>Name of the property to pass to the custom control</description>
<display-name>Property Name</display-name>
<property-name>name</property-name>
<property-class>java.lang.String</property-class>
</property>
<complex-extension>
<tag-name>customComplexType</tag-name>
</complex-extension>
</complex-type>
然后在你的组件属性中(注意:property-add-method标签,这将是组件中的一个方法,在这种情况下将CustomComplexType对象添加到java.util.List):
<property id="customProperties">
<description>A list of complex types</description>
<display-name>Custom Properties</display-name>
<property-name>customProperties</property-name>
<property-class>java.util.List</property-class>
<property-extension>
<designer-extension>
<category>basics</category>
</designer-extension>
<allow-run-time-binding>true</allow-run-time-binding>
<collection-property>true</collection-property>
<property-item-class>com.acme.xsp.components.CustomComplexType</property-item-class>
<property-add-method>addCustomProperty</property-add-method>
</property-extension>
</property>