com.jbbres.lib.actions.tools.swing
Class JVTextPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JEditorPane
                      extended by javax.swing.JTextPane
                          extended by com.jbbres.lib.actions.tools.swing.JVTextPane
All Implemented Interfaces:
com.jbbres.lib.PropertiesOwner, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable

public class JVTextPane
extends javax.swing.JTextPane
implements com.jbbres.lib.PropertiesOwner

A text field that can also receive Variables as content.

Variables should be inputed between %. For example, if you want to use the content of a variable nammed MyVar, you need to input the text as follow: %MyVar%.

When calling the getText() method, the variable are replaced by their value (equivalent to calling myVariable.getValue().toString()). If the value is null, the variable is replaced by an empty String. If no variable with the given name exists, the text is not changed.

If you want to access to the text without replacement, call getLogicalText().

Since:
1.0.0
Version:
1.0.0
Author:
Jean-Baptiste Bres
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, javax.swing.text.JTextComponent.KeyBinding
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static java.lang.String PROPERTY_CONTENT
          The property associated to the content of the text pane.
 
Fields inherited from class javax.swing.JEditorPane
HONOR_DISPLAY_PROPERTIES, W3C_LENGTH_UNITS
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
JVTextPane()
          Constructs a new JTextPane.
JVTextPane(java.lang.String text)
          Creates a new JTextPane, with a specified text.
JVTextPane(javax.swing.text.StyledDocument doc)
          Creates a new JTextPane, with a specified document model.
JVTextPane(Workflow workflow)
          Constructs a new JTextPane.
JVTextPane(Workflow workflow, java.lang.String text)
          Creates a new JTextPane, with a specified text.
JVTextPane(Workflow workflow, javax.swing.text.StyledDocument doc)
          Creates a new JTextPane, with a specified document model.
 
Method Summary
 java.lang.String getLogicalSelectedText()
          Gets the logical selected text.
 java.lang.String getLogicalText()
          Returns the text contained in this TextComponent, coded with variable values.
 java.util.Properties getProperties()
           
 java.lang.String getSelectedText()
           
 java.lang.String getText()
           
 java.lang.String getText(int offs, int len)
           
 Workflow getWorkflow()
          Returns the workflow.
 void setProperties(java.util.Properties properties)
           
 void setWorkflow(Workflow workflow)
          Set the workflow associated to the JVariableTextField.
 
Methods inherited from class javax.swing.JTextPane
addStyle, getCharacterAttributes, getInputAttributes, getLogicalStyle, getParagraphAttributes, getStyle, getStyledDocument, getUIClassID, insertComponent, insertIcon, removeStyle, replaceSelection, setCharacterAttributes, setDocument, setEditorKit, setLogicalStyle, setParagraphAttributes, setStyledDocument
 
Methods inherited from class javax.swing.JEditorPane
addHyperlinkListener, createEditorKitForContentType, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKit, getEditorKitClassNameForContentType, getEditorKitForContentType, getHyperlinkListeners, getPage, getPreferredSize, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, scrollToReference, setContentType, setEditorKitForContentType, setPage, setPage, setText
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, read, removeCaretListener, removeKeymap, removeNotify, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_CONTENT

public static final java.lang.String PROPERTY_CONTENT
The property associated to the content of the text pane.

See Also:
Constant Field Values
Constructor Detail

JVTextPane

public JVTextPane(Workflow workflow)
Constructs a new JTextPane.

Parameters:
workflow - - the workflow associated to the object

JVTextPane

public JVTextPane(Workflow workflow,
                  java.lang.String text)
Creates a new JTextPane, with a specified text.

Parameters:
workflow - - the workflow associated to the object
text - - the initial string to display, or null

JVTextPane

public JVTextPane(Workflow workflow,
                  javax.swing.text.StyledDocument doc)
Creates a new JTextPane, with a specified document model. A new instance of javax.swing.text.StyledEditorKit is created and set.

Parameters:
workflow - - the workflow associated to the object
doc - - the document model

JVTextPane

public JVTextPane()
Constructs a new JTextPane.

Using this constructor is not recommanded. You should prefer use JVariableTextPane(Workflow) as the associated workflow required to be defined in order to work properly. If you do not know the workflow, does not forget to call the setWorkflow(Workflow) method once you will know it.


JVTextPane

public JVTextPane(java.lang.String text)
Creates a new JTextPane, with a specified text.

Using this constructor is not recommanded. You should prefer use JVariableTextPane(Workflow, String) as the associated workflow required to be defined in order to work properly. If you do not know the workflow, does not forget to call the setWorkflow(Workflow) method once you will know it.

Parameters:
text - - the initial string to display, or null

JVTextPane

public JVTextPane(javax.swing.text.StyledDocument doc)
Creates a new JTextPane, with a specified document model. A new instance of javax.swing.text.StyledEditorKit is created and set.

Using this constructor is not recommanded. You should prefer use JVariableTextPane(Workflow, StyledDocument) as the associated workflow required to be defined in order to work properly. If you do not know the workflow, does not forget to call the setWorkflow(Workflow) method once you will know it.

Parameters:
doc - - the document model
Method Detail

getText

public java.lang.String getText()
Overrides:
getText in class javax.swing.JEditorPane

getLogicalText

public java.lang.String getLogicalText()
Returns the text contained in this TextComponent, coded with variable values.

Returns:
the text contained in this TextComponent, coded with variable values.

getLogicalSelectedText

public java.lang.String getLogicalSelectedText()
Gets the logical selected text.

Returns:
the logical selected text

getSelectedText

public java.lang.String getSelectedText()
Overrides:
getSelectedText in class javax.swing.text.JTextComponent

getText

public java.lang.String getText(int offs,
                                int len)
                         throws javax.swing.text.BadLocationException
Overrides:
getText in class javax.swing.text.JTextComponent
Throws:
javax.swing.text.BadLocationException

setWorkflow

public void setWorkflow(Workflow workflow)
Set the workflow associated to the JVariableTextField. The workflow is used to iddentify and link to Variables

Parameters:
workflow - - the workflow

getWorkflow

public Workflow getWorkflow()
Returns the workflow.

Returns:
the workflow

getProperties

public java.util.Properties getProperties()
Specified by:
getProperties in interface com.jbbres.lib.PropertiesOwner

setProperties

public void setProperties(java.util.Properties properties)
Specified by:
setProperties in interface com.jbbres.lib.PropertiesOwner


To file bugs or suggest feature enhancements, visit the app.jbbres.com Bug Reporter website.

Additional documentation available online at http://app.jbbres.com/actions/developers.

Copyright � 2009-2011 app.jbbres.com. All Rights Reserved.