com.dessci.mathflow.sdk.editor
Class SimpleEditorFrame

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by com.dessci.mathflow.sdk.editor.SimpleEditorFrame
All Implemented Interfaces:
com.dessci.mathflow.sdk.license.LicenseConstants, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class SimpleEditorFrame
extends javax.swing.JFrame
implements com.dessci.mathflow.sdk.license.LicenseConstants

This class is intended to be used for building a basic editor that has the tools necessary for an user. If you need to show a modal version of the editor, choose SimpleEditorDialog. Otherwise you can use this class.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static int CANCELED
          This value is set in callbackInfo when the user has pressed the "Cancel" button.
static int COMPLETED
          This value is set in callbackInfo when the user has pressed the "OK" button or closed the window.
static int NO_LICENSE
          This value is set in callbackInfo when there is no valid license.
 
Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.dessci.mathflow.sdk.license.LicenseConstants
debugMode, DESSCI_KEY, DOCUMENT_COMPOSER, DOCUMENT_COMPOSER_FOR_JAVA, DSI_LICENSE_DAEMON, EQUATION_COMPOSER, EQUATION_COMPOSER_FOR_JAVA, EVAL_LICENSE_FOR_APPLETS, FLEXLM_LIB_NAME, FLEXLM_LIC, LICENSE_EXPIRED, LICENSE_FILE_NAME, LICENSE_FOLDER_NAME, LICENSE_ID, LICENSE_INVALID, LICENSE_NOT_AVAILABLE, LICENSE_OK, SIMPLE_EDITOR, STRUCTURE_EDITOR, STYLE_EDITOR
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SimpleEditorFrame(java.lang.Object host, java.lang.String licenseString, int licenseType)
          Creates a new, initially invisible frame with the specified license source.
SimpleEditorFrame(java.lang.Object host, java.lang.String licenseString, int licenseType, OptionsInfo options)
          Creates a new, initially invisible frame with the specified license source and the specified OptionsInfo object.
SimpleEditorFrame(java.lang.Object host, java.lang.String licenseString, int licenseType, SimpleConfigurationInfo configInfo)
          Creates a new, initially invisible frame with the specified license source and the specified SimpleConfigurationInfo object.
SimpleEditorFrame(java.lang.Object host, java.lang.String licenseString, int licenseType, SimpleConfigurationInfo configInfo, OptionsInfo options)
          Creates a new, initially invisible frame with the specified license source, the specified SimpleConfigurationInfo object and the specified OptionsInfo object.
 
Method Summary
 int getCallbackInfo()
          Returns the callback that has occured.
 java.awt.Image getEquationImage(int pointsize, int dpi, java.lang.String foreground, java.lang.String background, java.lang.String halignment, java.lang.String valignment, int border, int breakwidth, int width, int height)
          Generates and returns an image of the current equation with the specified properties.
 java.awt.Image getEquationImage(int pointsize, java.lang.String bgcolor)
          Generates and returns an image of the current equation with the specified point size and background color.
 java.lang.String getFormattedMathML(int markupType, int formatLevel, int namespaceAttr, java.lang.String namespacePrefix, int characterType)
           
 int getPreferredAscentAt(int pointSize)
          Returns the preferred ascent above the baseline of the current equation in pixels at the specified point size.
 int getPreferredHeightAt(int pointSize)
          Returns the preferred height of the current equation in pixels at the specified point size.
 int getPreferredWidthAt(int pointSize)
          Returns the preferred width of the current equation in pixels at the specified point size.
 int getScreenFontSize()
          Returns the equation font size at the current screen resolution.
 void setDefaultEquationFont(java.awt.Font f)
          Sets the default font used to render the alphanumeric characters.
 void setDefaultEquationStyle(java.lang.String fontname, int size, java.lang.String fgcolor, java.lang.String bgcolor)
          Sets implicit 'fontfamily', 'fontsize', 'color' and 'background' attributes on the root element, with the specified values
 void setDefaultStatus(java.lang.String msg)
          Sets the default message to display in the status line.
 void setMathML(java.lang.String mathml)
          Sets the MathML for the current equation.
 void setToolbarMarkup(java.lang.String toolbarMarkup)
          Sets the toolbar configuration markup for the current editor.
 void setVisible(boolean b)
          Shows or hides this Window depending on the value of parameter b.
 
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

CANCELED

public static final int CANCELED
This value is set in callbackInfo when the user has pressed the "Cancel" button.

See Also:
Constant Field Values

COMPLETED

public static final int COMPLETED
This value is set in callbackInfo when the user has pressed the "OK" button or closed the window.

See Also:
Constant Field Values

NO_LICENSE

public static final int NO_LICENSE
This value is set in callbackInfo when there is no valid license.

See Also:
Constant Field Values
Constructor Detail

SimpleEditorFrame

public SimpleEditorFrame(java.lang.Object host,
                         java.lang.String licenseString,
                         int licenseType)
                  throws com.dessci.mathflow.sdk.license.LicenseException
Creates a new, initially invisible frame with the specified license source.

Parameters:
host - the host application or applet which launches this editor
licenseString - is either a file location or a key string, depending on the licenseType.
        If this is a FlexLM license, then licenseString is the location of the FlexLM license file.
   If this is a Design Science license, then licenseString is the MathFlow SDK product key string.
 
licenseType - the type of license. Valid values are:
        LicenseConstants.FLEXLM_LIC 
        LicenseConstants.DESSCI_KEY
 
Throws:
com.dessci.mathflow.sdk.license.LicenseException

SimpleEditorFrame

public SimpleEditorFrame(java.lang.Object host,
                         java.lang.String licenseString,
                         int licenseType,
                         OptionsInfo options)
                  throws com.dessci.mathflow.sdk.license.LicenseException
Creates a new, initially invisible frame with the specified license source and the specified OptionsInfo object.

Parameters:
host - the host application or applet which launches this editor
licenseString - is either a file location or a key string, depending on the licenseType.
        If this is a FlexLM license, then licenseString is the location of the FlexLM license file.
   If this is a Design Science license, then licenseString is the MathFlow SDK product key string.
 
licenseType - the type of license. Valid values are:
        LicenseConstants.FLEXLM_LIC 
        LicenseConstants.DESSCI_KEY
 
options - the OptionsInfo object
Throws:
com.dessci.mathflow.sdk.license.LicenseException

SimpleEditorFrame

public SimpleEditorFrame(java.lang.Object host,
                         java.lang.String licenseString,
                         int licenseType,
                         SimpleConfigurationInfo configInfo)
                  throws com.dessci.mathflow.sdk.license.LicenseException
Creates a new, initially invisible frame with the specified license source and the specified SimpleConfigurationInfo object.

Parameters:
host - the host application or applet which launches this editor
licenseString - is either a file location or a key string, depending on the licenseType.
        If this is a FlexLM license, then licenseString is the location of the FlexLM license file.
   If this is a Design Science license, then licenseString is the MathFlow SDK product key string.
 
licenseType - the type of license. Valid values are:
        LicenseConstants.FLEXLM_LIC 
        LicenseConstants.DESSCI_KEY
 
configInfo - the SimpleConfigurationInfo object
Throws:
com.dessci.mathflow.sdk.license.LicenseException

SimpleEditorFrame

public SimpleEditorFrame(java.lang.Object host,
                         java.lang.String licenseString,
                         int licenseType,
                         SimpleConfigurationInfo configInfo,
                         OptionsInfo options)
                  throws com.dessci.mathflow.sdk.license.LicenseException
Creates a new, initially invisible frame with the specified license source, the specified SimpleConfigurationInfo object and the specified OptionsInfo object.

Parameters:
host - the host application or applet which launches this editor
licenseString - is either a file location or a key string, depending on the licenseType.
        If this is a FlexLM license, then licenseString is the location of the FlexLM license file.
   If this is a Design Science license, then licenseString is the MathFlow SDK product key string.
 
licenseType - the type of license. Valid values are:
        LicenseConstants.FLEXLM_LIC 
        LicenseConstants.DESSCI_KEY
 
configInfo - the SimpleConfigurationInfo object
options - the OptionsInfo object
Throws:
com.dessci.mathflow.sdk.license.LicenseException
Method Detail

getCallbackInfo

public int getCallbackInfo()
Returns the callback that has occured. Refer to callbackInfo.

Returns:
the callback that has occured

getEquationImage

public java.awt.Image getEquationImage(int pointsize,
                                       int dpi,
                                       java.lang.String foreground,
                                       java.lang.String background,
                                       java.lang.String halignment,
                                       java.lang.String valignment,
                                       int border,
                                       int breakwidth,
                                       int width,
                                       int height)
Generates and returns an image of the current equation with the specified properties.

Parameters:
pointsize - base font point size for equation
dpi - resolution of the resulting image, or current screen resolution if 0
foreground - foreground color for image specified either as a color keyword, or hex rgb value
background - background color for image specified either as a color keyword, or hex rgb value
halignment - horizontal alignment specified by keyword left | center | middle | right
valignment - vertical alignment specified by keyword top | baseline | center | middle
border - padding in pixels to be added around the equation. Padding is subtracted from the renderable area if height and width are specified.
breakwidth - width at which to linewrap equation. Ignores width and padding, on the right margin. Set to 0 to disable linewrapping. Linewrapping forces top, left alignment.
width - width of image to generate. Ignored unless both width and height are non-zero.
height - height of image to generate. Ignored unless both width and height are non-zero.
Returns:
an image of the current equation with the given properties

getEquationImage

public java.awt.Image getEquationImage(int pointsize,
                                       java.lang.String bgcolor)
Generates and returns an image of the current equation with the specified point size and background color.

Parameters:
pointsize - base font point size for equation
bgcolor - background color for image specified either as a color keyword, or hex rgb value
Returns:
the equation image with the given point size and background color

getFormattedMathML

public java.lang.String getFormattedMathML(int markupType,
                                           int formatLevel,
                                           int namespaceAttr,
                                           java.lang.String namespacePrefix,
                                           int characterType)
See Also:
EquationUtilities.getFormattedMathML(Equation, int, int, boolean, String, int, boolean)

getPreferredAscentAt

public int getPreferredAscentAt(int pointSize)
Returns the preferred ascent above the baseline of the current equation in pixels at the specified point size.

Parameters:
pointSize - base point size of equation
Returns:
ascent of the current equation in pixels

getPreferredHeightAt

public int getPreferredHeightAt(int pointSize)
Returns the preferred height of the current equation in pixels at the specified point size.

Parameters:
pointSize - base point size of equation
Returns:
height of the current equation in pixels

getPreferredWidthAt

public int getPreferredWidthAt(int pointSize)
Returns the preferred width of the current equation in pixels at the specified point size.

Parameters:
pointSize - base point size of equation
Returns:
width of the current equation in pixels

getScreenFontSize

public int getScreenFontSize()
Returns the equation font size at the current screen resolution.

Returns:
the equation font size at the current screen resolution

setDefaultEquationFont

public void setDefaultEquationFont(java.awt.Font f)
Sets the default font used to render the alphanumeric characters.

Parameters:
f - the default font to render the alphanumeric characters

setDefaultEquationStyle

public void setDefaultEquationStyle(java.lang.String fontname,
                                    int size,
                                    java.lang.String fgcolor,
                                    java.lang.String bgcolor)
Sets implicit 'fontfamily', 'fontsize', 'color' and 'background' attributes on the root element, with the specified values

Parameters:
fontname - font family name
size - font size
fgcolor - foreground color
bgcolor - background color

setDefaultStatus

public void setDefaultStatus(java.lang.String msg)
Sets the default message to display in the status line.

Parameters:
msg - the default message to display in the status line

setMathML

public void setMathML(java.lang.String mathml)
Sets the MathML for the current equation.

Parameters:
mathml - a MathML string

setToolbarMarkup

public void setToolbarMarkup(java.lang.String toolbarMarkup)
Sets the toolbar configuration markup for the current editor. If there is any error in the markup, it will default back to the previous toolbar. See the MathFlow SDK Programmer's Guide for the description of the toolbar configuration language.

Parameters:
toolbarMarkup - the toolbar configuration markup

setVisible

public void setVisible(boolean b)
Shows or hides this Window depending on the value of parameter b. Be sure to call super.setVisible(b) at the end if you override this method.

Overrides:
setVisible in class java.awt.Window
See Also:
Window.setVisible(boolean)

Copyright (c) 2015 Design Science
All rights reserved