Custom Widgets

From OpenCms Wiki
Revision as of 15:21, 23 November 2006 by Bart.vandendriessche (Talk | contribs)
Jump to: navigation, search

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 Fully Qualified Class Name (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 section is still to be written.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox