Package eu.bandm.tools.graficUtils
Class TextDialog
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
eu.bandm.tools.graficUtils.TextDialog
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
,RootPaneContainer
,WindowConstants
- Direct Known Subclasses:
DownloadDialog
Central class for incremental dialog with the user, with protocolling.
Text output is done in html, and input by clicking links.
The whole dialog history stays readable.
The instances are sub-classes which override the <a href='...'</a> ".
All text belonging to the same interaction step must be added to the window
in one single call to
react()
method and
check the value of answer
for the local url which has been clicked.
All transformation operate on the text form of the data.
Therefore every link must begin verbatim with "appendText(String)
and thus be already well-formed
HTML.
Shortcuts by single numeric digit keypresses can be enabled, but are supported
only for the first ten links (="DIGITS
.length()
.
DOCME alles über "graying out" scheint NICHTG MEHR AKTUELL !?!? TEST !?!?!
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialog
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.Type
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
The url clicked by the user.static final Dimension
Default size of the swing pop-up window.static final String
protected final JEditorPane
evidentprotected boolean
Whether the next call to appendText is the first in this step.protected final boolean
protected final Icon
protected KeyListener
static final String
For use by subclasses.protected HyperlinkListener
The answer of the user is executed by clicking one of the offered links.static final String
HTML tag to replace the "a"- tag to signal the non-selection of a link.(package private) final Pattern
(package private) final Pattern
(package private) final Pattern
protected int
Counter of the input-output cycles.Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
Fields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPE
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
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
TextDialog
(@Opt JFrame context, @Opt String windowtitle, boolean isModal, boolean hasShortcuts, PlafIcon.type t, @Opt Dimension size) Only constructor, all others are just default argument wrappers.protected
TextDialog
(JFrame context, String windowtitle, boolean isModal) protected
TextDialog
(JFrame context, String windowtitle, boolean isModal, boolean hasShortcuts) protected
TextDialog
(JFrame context, String windowtitle, boolean isModal, boolean hasShortcuts, PlafIcon.type t) protected
TextDialog
(JFrame context, String windowtitle, boolean isModal, PlafIcon.type t) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
appendText
(String text) Wraps the text into one "[p]" element, for later graying outprotected void
appendTextLine
(String text) Appends only short (additional) text without any interactive formatting.protected void
finished()
protected void
react()
Callback function, must be overridden by the user.void
protected void
Replaces link appearances and marks older dialog fragments by graying out.static String
For use by subclasses.static String
For use by subclasses.Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBack
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, 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, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, 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, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
lf
For use by subclasses.- See Also:
-
defaultSize
Default size of the swing pop-up window. -
nonSelectedLink
HTML tag to replace the "a"- tag to signal the non-selection of a link.- See Also:
-
stepNum
protected int stepNumCounter of the input-output cycles. Numbers will be printed as small exponents before the output text. -
firstPara
protected boolean firstParaWhether the next call to appendText is the first in this step. -
answer
The url clicked by the user. Must be read and processed by the payload code. -
epane
evident -
icon
-
hasShortcuts
protected final boolean hasShortcuts -
shortcutlist
-
linklistener
The answer of the user is executed by clicking one of the offered links. Consequences: The old text is grayed out, the selected link is emphasized; all others are de-emphasized; the variableanswer
is set and the call-backreact()
is called. There the caller performs the next step of the dialog by adding further HTML text (again with links for reaction) by callingappendText(String)
. All these steps are numbered visibly. We use the url value of the HTML source text, i.e. not parsed or verified, which is retrieved byHyperlinkEvent.getDescription()
. -
DIGITS
- See Also:
-
keylistener
-
PATTERN_close_a
-
PATTERN_open_a
-
PATTERN_close_body
-
-
Constructor Details
-
TextDialog
-
TextDialog
-
TextDialog
-
TextDialog
protected TextDialog(JFrame context, String windowtitle, boolean isModal, boolean hasShortcuts, PlafIcon.type t) -
TextDialog
protected TextDialog(@Opt @Opt JFrame context, @Opt @Opt String windowtitle, boolean isModal, boolean hasShortcuts, PlafIcon.type t, @Opt @Opt Dimension size) Only constructor, all others are just default argument wrappers. ARRRGH! Onlypublic JDialog(Window owner, String title) Creates a modeless dialog with the specified title and owner Window. ... Parameters: ... title - the String to display in the dialog's title bar or null if the dialog has no title
is THE ONLY PLACE where there is anything said about "title==null". We ASSUME that title is OPT String.
-
-
Method Details
-
wrapTT
For use by subclasses. Wrap into green bold teletype, for input/output examples. etc. -
wrapError
For use by subclasses. Wratp into red color for error messages. -
transformLinks
protected void transformLinks()Replaces link appearances and marks older dialog fragments by graying out. Is normally called immediately after a decisive click. Links are transformed as follows: (read square brackets for angle brackets) :[a href='xxx']yyy[/a] --> [b]yyy[/b] iff xxx==answer --> [i]yyy[/i] otherwise (variant : [strike]yyy[/strike]; is not xhtml strict but better to read!)
[html] [html] [body] [body] [p style="color:gray"] [p style="color:gray"] VERY old text VERY old text [/p] [/p] [hr/] [hr/] [p] [p style="color:gray"] LAST text LAST text [/p] [/p] [hr/] ((NEW text < ----- later )) [/body] [/body] [/html] [/html]
The easier idea of own big "div" cannot be used because of bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6618068setText("[div style='xxx']") ---> getText() == "[div]" setText("[p style='xxx']") ---> getText() == "[p]"
-
appendText
Wraps the text into one "[p]" element, for later graying out -
appendTextLine
Appends only short (additional) text without any interactive formatting. -
runDialog
public void runDialog() -
react
protected void react()Callback function, must be overridden by the user. It must execute the appropriate reactions, guided by the value ofanswer
, which is (the raw source text of) the url selected by the user. -
finished
protected void finished()
-