close

Filter

loading table of contents...

Site Manager Developer Manual / Version 2310

Table Of Contents

4.5 Program Own PropertyEditors

Property editors are used to edit properties in the document view of the Site Manager. There are a lot of property editors provided by CoreMedia (see Section 5.1.1, “Property Editors”) but sometimes it might be useful to extend the editors due to own needs.

Interface to implement

All property editors implement the interface PropertyEditor or one of its subinterfaces (see Javadoc). Nevertheless, you will normally subclass one of the existing property editors instead of implementing PropertyEditor or its subinterfaces. If you want to support search and replace within the property, then the property editor must implement the additional interface SearchableTextComponent and its method isSearchable() must return true. Search and replace affects the search and replace dialogs and the Global-Search-and-Replace-Workflow. The file cap-examples.jar contains a simple example for a property editor with search and replace functionality: BasicStringEditor.

Classes to subclass

The most common way to write own property editors is to subclass one of the existing editors. See Section 5.1.1, “Property Editors” for a list of supplied property editors.

Integrate your Property Editor into the Site Manager using editor.xml

You can integrate your property editor into the Site Manager using the attribute editorClass of the Property element as shown in Example 4.6, “How to integrate a property editor”.

<Documents>
   ...
   <Document type="SomeType">
      <Property name="Locale"
        editorClass="com.customer.example.editor.LocaleEditor"/>
   </Document>
   ...
</Documents>

Example 4.6. How to integrate a property editor


Example

The following example shows a property editor which extends the ComboBoxStringEditor. The property editor adds all available locales to the combo box from which the user can select one.

package com.customer.example.editor;
import java.util.Locale;
import hox.corem.editor.toolkit.property.ComboBoxStringEditor;
public class LocaleEditor extends ComboBoxStringEditor {
  
  public LocaleEditor() {
    super.setFixedChoice(true);
    Locale[] l = Locale.getAvailableLocales();
    for (int i = 0; i<l.length; i++)
      { addHistoryItem(l[i].toString()); }
  } // LocaleEditor()
  
  public void setFixedChoice(boolean b) { /* ignore! */ }

}

Example 4.7. Example of a property editor


Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.