|
Nekit v 0.9 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--javax.swing.text.JTextComponent
|
+--javax.swing.JEditorPane
|
+--javax.swing.JTextPane
|
+--com.nekhem.nekit.NekitPane
This class handles the Text Pane for what concerns user interaction. The real text manipulation is done by NekitDocument Some events are managed by other classes using the abstraction of CaretContext: a Context is a region of text that follows different rules (at present there's only ListContext, for bullet lists) Every time the caret is moved, NekitPane cycles through all context to see if one is Active. So certain events (newline, ...) are dispatched to that context. This architecture is only a draft and needs optimization, but should become very flexible
NekitDocument,
Serialized Form| Nested Class Summary |
| Nested classes inherited from class javax.swing.JEditorPane |
javax.swing.JEditorPane.AccessibleJEditorPane, javax.swing.JEditorPane.AccessibleJEditorPaneHTML, javax.swing.JEditorPane.JEditorPaneAccessibleHypertextSupport |
| Nested classes inherited from class javax.swing.text.JTextComponent |
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
javax.swing.text.AttributeSet |
baseAttributes
The attributes of clear text |
static boolean |
dontsetpos
|
static boolean |
setpos
for passing boolean parameters |
| Fields inherited from class javax.swing.text.JTextComponent |
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, 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 | |
NekitPane(NekitPaneOwner owner)
Constructor |
|
| Method Summary | |
void |
addContext(java.lang.String name,
CaretContext c)
Add a CaretContext, this is a sort of "AddListener", because the CaretContext will be notified of some relevant events |
void |
caretUpdate(javax.swing.event.CaretEvent e)
|
java.lang.String |
cleanText(java.lang.String txt)
Filter the HTML as necessary |
void |
clearFormat()
Set the selected region to normal text |
boolean |
currChar(java.lang.String ch)
Check if the character at the caret equals the parameter |
void |
feedHtml(java.lang.String htmlText)
Wrapper of setText, just to add some filtering at necessity |
java.lang.String |
getCleanText()
|
void |
initText(java.lang.String initText)
Set the initial text |
void |
keyPressed(java.awt.event.KeyEvent e)
|
void |
keyReleased(java.awt.event.KeyEvent e)
|
void |
keyTyped(java.awt.event.KeyEvent e)
|
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent ev)
|
void |
newUserAction(java.lang.String type,
java.awt.Point p)
For the workaround "endline": the caret went on the start of the next line when the mouse clicked beyond the end (very annoying!) |
void |
paragraphizeSelection()
Transform the selected region in a separate paragraph |
boolean |
prevChar(java.lang.String ch)
Check if the character behind the caret equals the parameter |
void |
refreshOnUpdate()
FIXME: redundant copy of SimpleRefresh |
static java.lang.String |
removeGarbage(java.lang.String html)
the idea is to edit a HTML fragment, so the tags [BODY] and [HTML] are eliminated |
void |
replaceSelection(java.lang.String content)
Ovverride the JTextPane method |
void |
resetAttributes()
Set default attributes to normal text |
void |
safeSetCaretPosition(int pos)
Set the caret position only between the legal limits (doesn't throw exceptions) |
void |
setNekitDocument(NekitDocument d)
setter |
void |
setNekitEditorKit(javax.swing.text.html.HTMLEditorKit ek)
setter |
void |
setText(java.lang.String html)
Override of JTextPane setText |
void |
simpleRefresh()
Convenience method for refreshing and displaying changes |
void |
simpleRefresh(boolean setpos)
idem, with the option not to set the caret position |
| Methods inherited from class javax.swing.JTextPane |
addStyle, createDefaultEditorKit, getCharacterAttributes, getInputAttributes, getLogicalStyle, getParagraphAttributes, getStyle, getStyledDocument, getStyledEditorKit, getUIClassID, insertComponent, insertIcon, paramString, removeStyle, 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, getStream, getText, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, scrollToReference, setContentType, setEditorKitForContentType, setPage, setPage |
| Methods inherited from class javax.swing.text.JTextComponent |
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static boolean setpos
public static boolean dontsetpos
public javax.swing.text.AttributeSet baseAttributes
| Constructor Detail |
public NekitPane(NekitPaneOwner owner)
owner - callback object| Method Detail |
public void addContext(java.lang.String name,
CaretContext c)
name - A identification namec - the contextpublic void setNekitEditorKit(javax.swing.text.html.HTMLEditorKit ek)
ek - -public void setNekitDocument(NekitDocument d)
d - -public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent ev)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListener
public void newUserAction(java.lang.String type,
java.awt.Point p)
type - type of action (mouse of keyboard)p - the pointpublic void caretUpdate(javax.swing.event.CaretEvent e)
caretUpdate in interface javax.swing.event.CaretListenerpublic void safeSetCaretPosition(int pos)
pos - position requestedpublic boolean prevChar(java.lang.String ch)
ch - the character to compare
public boolean currChar(java.lang.String ch)
ch - the character to compare
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent e)
keyReleased in interface java.awt.event.KeyListenerpublic void keyTyped(java.awt.event.KeyEvent e)
keyTyped in interface java.awt.event.KeyListenerpublic void feedHtml(java.lang.String htmlText)
htmlText - public void setText(java.lang.String html)
setText in class javax.swing.JEditorPanehtml - public void simpleRefresh()
public void simpleRefresh(boolean setpos)
setpos - false=don't set the caret positionpublic void refreshOnUpdate()
public java.lang.String cleanText(java.lang.String txt)
txt - original HTML
public java.lang.String getCleanText()
public static java.lang.String removeGarbage(java.lang.String html)
html - original HTML
public void initText(java.lang.String initText)
initText - the HTML textpublic void resetAttributes()
public void paragraphizeSelection()
public void replaceSelection(java.lang.String content)
replaceSelection in class javax.swing.JTextPanecontent - JTextPanepublic void clearFormat()
|
Nekit v 0.9 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||