19. gadget

gadget(className, param, ..., param).

This pseudo-function is similar to the component pseudo-function except that it creates flightweight gadgets instead of standard Java™ AWT Components or Swing JComponents.

className is the name of a Java class which implements the interface com.xmlmind.xmledit.styledview.GadgetFactory (see Chapter 8, Writing style sheet extensions in XMLmind XML Editor - Developer's Guide).

Example (APT - excerpt of apt-collapsible.css):

caption:before {
    content: gadget("com.xmlmind.xmledit.form.Collapser", 
                    collapsed-icon, icon(collapsed-right),
                    expanded-icon, icon(expanded-up)) " ";
}

When gadget() is used to generate replaced content for a processing-instruction, the specified class must implement interface com.xmlmind.xmledit.styledview.GadgetFactory2 (see Chapter 8, Writing style sheet extensions in XMLmind XML Editor - Developer's Guide). Example, the following rule is used to style spreadsheet formulas:

*::processing-instruction(xxe-formula) {
    content: gadget("com.xmlmind.xmleditext.spreadsheet.Formula");
    display: inline;
}