SimpleEditorDemoApplication
The SimpleEditorDemoApplication user interface consists of the following:
- File Menu
- Open MathML...
- Save MathML...
- Quit
- Help Menu
- About MathFlow SDK Structure Editor
- MathML source panel
- Preview image panel
- Edit Equation ... button
The code discussed in this topic can be found in SimpleEditorDemoApplication.java
The constructor sets the application title, font preferences and calls initUI() to create the application's UI elements. It also changes the cursor to a wait cursor. For more information on setting the font preferences, see Java Rendering Engine.
The createEditor method creates two objects, which are then passed into the constructor of the SampleSimpleEditorDialog:
- Creates a SimpleConfigurationInfo object to indicate which features are turned on or off in the editor. You can also set the type of end-user help system in this object. See the sample code and End-User Help Options for choosing and setting your help system.
- Sets the key string, which is either the path to a FlexNet license file or a license key string assigned by Design Science. See the sample code and MathFlow SDK Licences for help setting the license string and more information about the license types.
The method showEditor checks to see if createEditor()has been successful and displays the Style Editor as a dialog.
The updateSrcAndImage method retrieves the MathML from the editor using the editor's getMathML method, and displays it in the MathML source panel. The method also retrieves an image of the equation, using the editor's getEquationImage method, as well as its size using the editor's getPreferredWidthAt and getPreferredHeightAt methods. The image is then displayed in the Image preview panel.
The notifyEditorShown method is used by the editorDialog to notify the host application when the editor has been shown. The host application then resets the cursor back to its default state.
The host application can also display a customized SampleSimpleEditorAboutBox.
|