To create a new markup based on DefaultMarkup, the class de.knowwe.kdom.defaultMarkup.DefaultMarkupType needs to be extended. The following code snipplet shows a Hello-World extension of DefaultMarkup.
1| public class HelloWorldMarkup extends DefaultMarkupType { 2| 3| private static final DefaultMarkup MARKUP; 4| 5| static { 6| MARKUP = new DefaultMarkup("HelloWorld"); 7| } 8| 9| public HelloWorldMarkup() { 10| super(MARKUP); 11| } 12| }
A private instance of a DefaultMarkup is required (line 3). The initialization of the DefaultMarkup object in the static block (line 6) is required in that way to allow the plugin-framework to create a markup instance on start-up. In line 6 also the name (and markup keyword) is specified as parameter for the DefaultMarkup object, "HelloWolrd" in this example.
public class HelloWorldMarkup extends DefaultMarkupType { public static final String IMAGE_KEY = "image"; private static final DefaultMarkup MARKUP; static { MARKUP = new DefaultMarkup("HelloWorld"); MARKUP.addAnnotation(Image_KEY, false); } public HelloWorldMarkup() { super(MARKUP); } }