Custom Widgets
(Difference between revisions)
Cschoenfeld (Talk | contribs) (initial document) |
Cschoenfeld (Talk | contribs) m (added todo) |
||
Line 37: | Line 37: | ||
</xsd:annotation> | </xsd:annotation> | ||
</xsd:schema> | </xsd:schema> | ||
+ | |||
== Custom Data Types == | == Custom Data Types == | ||
+ | This secion is still to be written. |
Revision as of 14:02, 23 November 2006
Custom Widgets
When creating XML content the input methods available with the existing widget types might not suffice for the desired content.
By subclassing A_CmsWidget you can easily create your own widget types. In order to make use of it it can be referenced from XSD files by its FQCN or by a alias name for the class in opencms-vfs.xml.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE opencms SYSTEM "http://www.opencms.org/dtd/6.0/opencms-vfs.dtd"> <opencms> <vfs> ... <xmlcontent> ... <widgets> ... <widget class="com.acme.widgets.AcmeEmployeeSelectionWidget" alias="AcmeEmployeeSelectionWidget" /> </widgets> ... </xmlcontent> </vfs> </opencms>
You need to restart OpenCms to activate the change. If such an alias has been defined, the widget can be used as shown in the next listing.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd" /> ... ... your complexType definitions which include an element Employee ... <xsd:annotation> <xsd:appinfo> <layouts> <layout element="Employee" widget="AcmeEmployeeSelectionWidget" /> </layouts> </xsd:appinfo> </xsd:annotation> </xsd:schema>
Custom Data Types
This secion is still to be written.