01: /*
02: * $Id: JGraphpadPDFPlugin.java,v 1.1.1.1 2005/08/04 11:21:58 gaudenz Exp $
03: * Copyright (c) 2001-2005, Gaudenz Alder
04: *
05: * All rights reserved.
06: *
07: * See LICENSE file for license details. If you are unable to locate
08: * this file please contact info (at) jgraph (dot) com.
09: */
10: package com.jgraph.pdfplugin;
11:
12: import java.io.IOException;
13:
14: import javax.xml.parsers.ParserConfigurationException;
15:
16: import org.w3c.dom.Node;
17: import org.xml.sax.SAXException;
18:
19: import com.jgraph.JGraphEditor;
20: import com.jgraph.JGraphpad;
21: import com.jgraph.editor.JGraphEditorKit;
22: import com.jgraph.editor.JGraphEditorPlugin;
23: import com.jgraph.editor.JGraphEditorResources;
24: import com.jgraph.editor.JGraphEditorSettings;
25:
26: /**
27: * Plugin for using IText in JGraphpad Pro. Adds an savePDF action.
28: */
29: public class JGraphpadPDFPlugin implements JGraphEditorPlugin {
30:
31: /**
32: * Defines the path to the UI configuration to be merged into the existing
33: * UI configuration.
34: */
35: public static String PATH_UICONFIG = "/com/jgraph/pdfplugin/resources/ui.xml";
36:
37: /**
38: * Adds resource bundles.
39: */
40: static {
41: JGraphEditorResources
42: .addBundles(new String[] { "com.jgraph.pdfplugin.resources.strings" });
43: }
44:
45: /**
46: * Initializes the plugin by registering all action bundles and merging the
47: * UI configuration into the main configuration.
48: *
49: * @param editor
50: * The enclosing editor for the plugin.
51: * @param configuration
52: * The object to configure the plugin with.
53: */
54: public void initialize(JGraphEditor editor, Node configuration)
55: throws ParserConfigurationException, SAXException,
56: IOException {
57: JGraphEditorKit kit = editor.getKit();
58: kit.addBundle(new JGraphpadPDFAction.AllActions(editor));
59: editor.getSettings().add(
60: JGraphpad.NAME_UICONFIG,
61: JGraphEditorSettings.parse(JGraphEditorResources
62: .getInputStream(PATH_UICONFIG)));
63: }
64:
65: }
|