Home
Categories
Dictionary
Download
Project Details
Changes Log
What Links Here
How To
Syntax
FAQ
License

Help content StyleSheet configuration


    1  Overview
       1.1  Limitations
    2  Runtime usage
       2.1  Example
    3  Notes
    4  See also

It is possible to specify several StyleSheet themes in the Help content file. This will allow to customize the StlyeSheet of the help, the theme, or even to specify more than one theme and switch dynamically from one theme to another.

Overview

The Help content configuration allows to specify:
  • The StyleSheet, if you want to replace the default StyleSheet used in the wiki[1]
    Note that it will exactly have the same result as if you specify the css property
    in the command-line or the configuration file
  • The default theme, if you want to replace the default theme used in the wiki[2]
    Note that it will exactly have the same result as if you specify the styleSheetTheme property
    in the command-line or the configuration file
  • Several named themes which willl allow you to switch the theme at runtime

  • It is not mandatory to define any chapter content if you define theme. You can define only the StyleSheets without specifying any Chapter
  • You always have access to the default theme


For example:
  <helpContent>
     <styleSheets>
        <styleSheetTheme id="black" url="themeBlack.css"/>
     </styleSheets>
  </helpContent>

Limitations

Using themes is only possible when you use the Help system in JavaFX or in Swing but using the JavaFX rendering of the Web content.

Runtime usage

The theme used at start will always be the default theme. You can change the theme at runtime at any time by using one of the following methods:
If the theme you try to switch to does not exist, the method will return false and you will switch to the default theme instead.

Example

  <helpContent>
     <styleSheets defaultStyleSheetTheme="myDefaultTheme.css">
        <styleSheetTheme id="black" url="themeBlack.css"/>
     </styleSheets>
  </helpContent>
In this example:
  • The myDefaultTheme.css is the default theme which replaces the default theme provided by the tool
  • The themeBlack.css is a theme associated with the black id
It is possible to switch from the new custom default theme to the theme associated with the black id at runtime.

For example in Swing:
      // get the zip file as an URL
      URL url = ...

      try {
        // create the Help factory
        JavaHelpFactory factory = new JavaHelpFactory(url);
        factory.create();
      
        // create the viewer component
        SwingHelpContentViewer viewer = new SwingHelpContentViewer();
        factory.install(viewer);
      
        JComponent pane = viewer.getHelpComponent();    
        viewer.setStyleSheetTheme("black");
      } catch (IOException | SAXException ex) {
        ex.printStackTrace();
      }

Notes

  1. ^ Note that it will exactly have the same result as if you specify the css property
  2. ^ Note that it will exactly have the same result as if you specify the styleSheetTheme property

See also


Categories: javahelp

docJGenerator Copyright (c) 2016-2023 Herve Girod. All rights reserved.