How to create group property on xsp-config? - xpages

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)
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.
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>
Note :
Result of this xsp-config can display : "Data Source" property but "Event" group property is not shown.
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>
To create an actual group:
<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>
You can find the total xsp-config/faces-config reference here:
http://www-10.lotus.com/ldd/ddwiki.nsf/dx/XPages_configuration_file_format
EDIT: 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>
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>

I'm not sure about the use of property-extension, but when I manually create a group of properties in a Custom Control, then look at the xsp-config file in Package Explorer under Custom Controls, it looks like the classes are wrong.
Do you want a single property where the users enter an instance of a java.util.Collection? If so, try this:
<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>
If you want a property with multiple instances, try:
<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>
You can allow the users to enter it using the SSJS Editor by adding <editor>com.ibm.workplace.designer.ide.xfaces.internal.editors.MethodBindingEditor</editor> to <designer-extension>

Related

XSD to validate same element name with different content

I'm learning about XSDs. I wanted to know if there's a way to validate these 3 xml examples in one xsd? Let's just stick with XSD 1.0 (without asserts). I know I can technically use minOccurs=0 for all the sub elements. Is there a better solution?
<property>
<item>car</item>
<cost>500</cost>
<wheels>4</wheels>
</property>
<property>
<item>chair</item>
<cost>100</cost>
<legs>10</legs>
<edible>yes</edible>
</property>
<property>
<item>bed</item>
<bedbugs>yes</bedbugs>
<dirty>no</dirty>
</property>

How can I set application layout properties in a theme?

I understand how to set properties like style and styleClass using a theme but how do I set a property such as productLogo in my theme?
I tried
<control>
<name>ApplicationLayout</name>
<property>
<name>configuration.oneuiApplication.productLogo</name>
<value>"/LogoSmall.JPG"</value>
</property>
</control>
and
<control>
<name>ApplicationLayout</name>
<property>
<name>configuration.productLogo</name>
<value>"/LogoSmall.JPG"</value>
</property>
</control>
<control>
<name>ApplicationLayout</name>
<property>
<name>productLogo</name>
<value>"/LogoSmall.JPG"</value>
</property>
</control>
but none seemed to work.
Can this be done? If so how?
First of all you need to determine the themeID of the component. Tim Tripcony has wrote a blog about how to do this, see http://xmage.gbs.com/blog.nsf/d6plinks/TTRY-8RXAQ6
When you know the theme id you can use in your own theme

Theme not working for Button

I started playing with themes. I was able so create CSS and associated the CSS to various table elements. Works fine.
Now I am trying to do the same with a button. But it does not seem to work. If I apply the styleclass right to the button then it works.
<theme extends="oneuiv2.1">
<resource>
<content-type>text/css</content-type>
<href>app.css</href>
</resource>
<resource>
<content-type>text/css</content-type>
<href>viewpicklistCC.css</href>
</resource>
<control>
<name>Button</name>
<property>
<name>styleClass</name>
<value>MyButton</value>
</property>
</control>
<control>
<name>HtmlTable</name>
<property>
<name>styleClass</name>
<value>PNCTable</value>
</property>
</control>
<control>
<name>HtmlTd</name>
<property>
<name>styleClass</name>
<value>PNCTableCell</value>
</property>
</control>
</theme>
.MyButton {
width:179.0px;
font-family:Arial,sans-serif;
font-size:18pt;
color:rgb(255,128,0);
font-weight:bold
}
In a theme you need to use the theme id of a control in order to target it. This is not the same as the CSS style class.
You can set the theme id manually on a control (in Style - Theme, or in All properties - Style - Theme id) and then target the control by referring to this theme id.
Or you can use the default theme id for a control. The XPageswiki contains a list of default theme ids for core controls:
http://xpageswiki.com/web/youatnotes/wiki-xpages.nsf/dx/Work_with_themes#themeID+values+for+core+controls
So in your case you need to use one of the following theme ids in order to target your button:
Button: Button.Command
Button with type=submit: Button.Submit
Button with type=cancel: Button.Cancel

Set expandLevel for xe:navigator using a theme

I would like to set the expandLevel property for several extension libary navigators using a theme. I can set expandable and expandEffect but I can not get expandLevel to work. I am using the following in my theme:
<!-- Navigator -->
<control>
<name>Outline.Navigator</name>
<property type="boolean">
<name>expandable</name>
<value>true</value>
</property>
<property>
<name>expandEffect</name>
<value>wipe</value>
</property>
<property>
<name>expandLevel</name>
<value>#{0}</value>
</property>
</control>
I have also tried using <value>0</value> which also does not work.
Booleans need to be passed as EL, just like numbers. Pass the value of the expandable property as #{true}, otherwise it will try to assign a String value.

Set Custom Properties for a custom field type within a content type feature

I have created a custom field type (derived from SPFieldText) and added a custom property "MyProperty". Now what I am looking for is, I need to use this field type in my Content Type feature.
How can I specity my custom property within a Content Type definition file, just like what we do with OOB field types?
I've seen a workaround here but it only solves only the problem of XSD validation. Site column is getting installed properly but the value that I specify in the feature is not set for the column after installing the feature.
Thank in advance
Arun
This worked for me
<Field ID="{EB4A62A3-5722-4D12-9AB8-BB36461D8E5D}" Type="MyCustomFieldType" Name="Website" DisplayName="Website" StaticName="Website" Required="true">
<Customization>
<ArrayOfProperty>
<Property>
<Name>MyFirstProperty</Name>
<Value>www.stackoverflow.com</Value>
</Property>
<Property>
<Name>MySecondProperty</Name>
<Value>stackoverflow</Value>
</Property>
</ArrayOfProperty>
</Customization>
</Field>
you can access the property in the validation class like this:
string myFieldValue = ((XmlNode[])this.GetCustomProperty("MyFirstProperty"))[0].Value;
Something like this
<Field ID="{aec8cea1-d0df-49fc-baef-d356e58423f4}" Name="ClientWorkspace" DisplayName="$Resources:Nervogrid.Lauxtermann.Root,FieldWorkspaceDisplayName;" Type="ExtendedWorkspace" Group="$Resources:Nervogrid.Lauxtermann.Root,GroupLauxtermannFields;" AllowDuplicateValues="FALSE">
<Customization>
<ArrayOfProperty>
<Property>
<Name>SiteTemplates</Name>
<Value xmlns:q1="http://www.w3.org/2001/XMLSchema" p4:type="q1:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">;#12203;#</Value>
</Property>
<Property>
<Name>HideOnDisplayForm</Name>
<Value xmlns:q2="http://www.w3.org/2001/XMLSchema" p4:type="q2:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">$Resources:core,fld_no;</Value>
</Property>
<Property>
<Name>HideOnEditForm</Name>
<Value xmlns:q3="http://www.w3.org/2001/XMLSchema" p4:type="q3:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">$Resources:core,fld_yes;</Value>
</Property>
</ArrayOfProperty>
</Customization>
</Field>
Here is a thread on msdn forums that should answer your question. - http://social.msdn.microsoft.com/forums/en-US/sharepointdevelopment/thread/fb1cb936-3abb-48c2-8d19-49007688dc34/

Resources