如何在 xsp-config 上创建组属性? [英] How to create group property on xsp-config?
问题描述
我正在学习如何在 XPAGES 上创建 UI 控件(http:///www-10.lotus.com/ldd/ddwiki.nsf/dx/Master_Table_of_Contents_for_XPages_Extensibility_APIs_Developer_Guide)
I am learning how to create UI Control on XPAGES (http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Master_Table_of_Contents_for_XPages_Extensibility_APIs_Developer_Guide)
我创建了自己的控件,并使用属性标记在 xsp-config 中设置了单个属性.但是,当我尝试使用 property-type 标记设置组属性时,不会显示该组属性.
And I have created my own control and I have set single property in xsp-config using property tag. But when I try to set group property using property-type tag, that group property is not shown.
这里是我的 xsp-config
Here my 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 的结果可以显示:数据源"属性但不显示事件"组属性.
Result of this xsp-config can display : "Data Source" property but "Event" group property is not shown.
我是否想在 xsp-config 上配置一些东西?
Do I miss something to configure on xsp-config ?
推荐答案
所以,听起来您想要为可选择的属性值提供一个组合框.要做到这一点,请在属性中遵循以下模式:
So, it sounds like you want to provide a combo-box for selectable property values. To do this follow this pattern in the property:
<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
You can find the total xsp-config/faces-config reference here: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/XPages_configuration_file_format
啊,好的.所以看完你的评论我想我明白了.您希望能够将项目添加到列表之类的内容中.因此,您必须创建一个复杂类型来支持这一点.
Ah, ok. So after reading your comment I think I understand. You want to be able to add items to something like a list. So, you'll have to create a complex type to support this.
<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):
And then in your component property (NOTE: The property-add-method tag, this will be a method in your component that in this case will add CustomComplexType objects to a 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>
这篇关于如何在 xsp-config 上创建组属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!