Xpages 如何在xsp配置上创建组属性?

Xpages 如何在xsp配置上创建组属性?,xpages,Xpages,我正在学习如何在XPAGES上创建UI控件 我已经创建了自己的控件,并且在xsp配置中使用property标记设置了单个属性。但当我尝试使用属性类型标记设置组属性时,该组属性不会显示 这里是我的xsp配置 <faces-config> <faces-config-extension> <namespace-uri>http://fortedynamic.org/xsp/control</namespace-uri> <default

我正在学习如何在XPAGES上创建UI控件

我已经创建了自己的控件,并且在xsp配置中使用property标记设置了单个属性。但当我尝试使用属性类型标记设置组属性时,该组属性不会显示

这里是我的xsp配置

<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配置的结果可以显示:数据源属性,但不显示事件组属性


我是否错过了在xsp配置上要配置的内容?

我不确定属性扩展的使用,但当我在自定义控件中手动创建一组属性时,然后在“自定义控件”下查看Package Explorer中的xsp配置文件,看起来类是错误的

是否希望用户在其中输入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>

通过将com.ibm.workplace.designer.ide.xfaces.internal.editors.MethodBindingEditor添加到

中,您可以允许用户使用SSJS编辑器输入它。因此,听起来您希望为可选属性值提供一个组合框。要执行此操作,请在属性中遵循以下模式:

    <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配置/faces配置的总引用:

编辑:啊,好的。所以读了你的评论后,我想我明白了。您希望能够将项目添加到类似于列表的内容中。因此,您必须创建一个复杂类型来支持它

<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标记将是组件中的一个方法,在本例中,该方法将向java.util.List添加CustomComplexType对象:

    <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>

谢谢你的回复。很抱歉也许我的问题被弄糊涂了。我想创建这样的下拉列表:group+-group[0]property1 property2 property3 group[1]property1 property2 property3'注意:对不起,我不知道如何在注释中粘贴代码。感谢您的回复。抱歉把它弄糊涂了。我想创建具有子属性的属性。示例:xp:inputText具有属性1 inputText可以包含许多属性:attr[0]、attr[1]等,每个attr都具有子属性,如:loaded、minimized、name、rendered等。。如何为提供类似属性的属性设置xsp配置?感谢Keithstric的回答。。但我还是很困惑。我是否需要为复杂类和复杂id创建新的java类?在哪里可以得到这些java类的示例?你能给我提供一些样品吗。。我从中学到了很多。那篇文章提供了我想要的样本。所以问题解决了。。谢谢Keithstric的帮助很乐意帮忙。是的,您必须为复杂类型创建一个类。组件需要实现一个方法来添加它们,然后渲染器也需要考虑它们。您的类应该扩展com.ibm.xsp.complex.ValueBindingObjectImpl。