|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
cox.jmatt.java.MathTools.demo.MTFormatterDemo
public class MTFormatterDemo
This class provides a fairly comprehensive demonstration of MathTestFormatter
and serves as a handy utility in its own right. The GUI consists
of the main (File) panel, an internal template panel, a Properties panel, and a regex data Panel. The main panel has TextFields for selecting template or
Properties files as well as a Checkbox to send the formatted template to CapCom.processMathObject()
, a Checkbox to enable regex matching and a
TextField to enter the regular expression. Since MTDemo
uses a BasicMathPrinter
this sends the result to the clipboard.
The template can be internal or external. The internal area can be loaded (if this class is built around a Dialog
or Frame
).
The Properties can be both internal and external. Enabling the '[]Properties file' Checkbox on the File panel loads Properties from the file specified.
Enabling the internal Properties Checkbox parses the Properties panel (addProperties(String, null, null)
) and adds them to the formatter. The
order in which properties are set is exactly that: external first followed by internal.
Once the template String and Properties are set the template is formatted using the zero-argument method. From there the result is printed and, if the Checkbox is enabled, processed.
To format using regular expressions enable the '[]Regex' checkbox on the file panel and enter the regular expression in that TextField. The data String(s)
to which the regex is to be applied should be entered or loaded in the Regex Data panel. The content is split on newlines and the array is then sent to the
reFormat()
method. The results are then re-assembled into a newline-separated String and printed/processed.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Panel |
---|
java.awt.Panel.AccessibleAWTPanel |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
static java.lang.String |
KEY_FILE
String constant used to add the File (main) panel. |
static java.lang.String |
KEY_PROPS
String constant used to add the internal Properties panel. |
static java.lang.String |
KEY_REGEX
String constant used to add the regular expression data panel. |
static java.lang.String |
KEY_TEMPLATE
String constant used to add the internal template panel. |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
MTFormatterDemo()
Zero-argument version, no [Load] buttons will be present. |
|
MTFormatterDemo(java.awt.Dialog pParent)
Build a demo around a Dialog to allow FileDialog s for loading. |
|
MTFormatterDemo(java.awt.Frame pParent)
Build a demo around a Frame to allow FileDialog s for loading. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent aev)
Overridden to handle button clicks, nothing else. |
void |
clearPanel(java.lang.String pWhich,
boolean pOkToClear)
Clear the internal template or Properties panels. |
java.awt.Panel |
filePanel()
Build the File panel. |
java.lang.String |
formatTemplate()
This method actually merges the template and data. |
void |
loadFile(java.lang.String pFile,
java.lang.String pWhere)
Load a file into the internal template or Properties. |
void |
processGoButton()
This method is called when the [Go!] button is clicked. |
java.awt.Panel |
propsPanel()
Build the internal Properties panel. |
java.awt.Panel |
regexPanel()
Build the regex data panel. |
java.awt.Panel |
standardGUI()
Build the standard MTFormatterDemo GUI. |
java.awt.Panel |
templatePanel()
Build the internal template panel. |
Methods inherited from class java.awt.Panel |
---|
addNotify, getAccessibleContext |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String KEY_FILE
public static final java.lang.String KEY_TEMPLATE
public static final java.lang.String KEY_PROPS
public static final java.lang.String KEY_REGEX
Constructor Detail |
---|
public MTFormatterDemo()
public MTFormatterDemo(java.awt.Frame pParent)
FileDialog
s for loading.
public MTFormatterDemo(java.awt.Dialog pParent)
Dialog
to allow FileDialog
s for loading.
Method Detail |
---|
public void actionPerformed(java.awt.event.ActionEvent aev)
actionPerformed
in interface java.awt.event.ActionListener
public final java.awt.Panel standardGUI()
public final java.awt.Panel filePanel()
public final java.awt.Panel templatePanel()
public final java.awt.Panel propsPanel()
public final java.awt.Panel regexPanel()
public final void clearPanel(java.lang.String pWhich, boolean pOkToClear)
pWhich
- KEY_TEMPLATE to clear the template panel, KEY_PROPS to clear the Properties panel, KEY_REGEX to clear the regex data.pOkToClear
- true to really clear it, false not to.public final void loadFile(java.lang.String pFile, java.lang.String pWhere)
pWhere
- KEY_TEMPLATE to load an internal template, KEY_PROPS to load the Properties panel, KEY_REGEX to load regex data.pFile
- The name of the file to load.public java.lang.String formatTemplate()
TextArea
is split on newlines and the resulting array sent to reFormat()
.
public void processGoButton()
formatTemplate()
, prints the result, and sends it to CapCom.processMathObject()
if that is enabled. For a BasicMathPrinter
this dumps the String to the clipboard.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |