Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


oracle.javatools.editor.plugins
Class AbstractClickPlugin

java.lang.Object
  extended by oracle.javatools.editor.plugins.AbstractClickPlugin

All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.beans.PropertyChangeListener, java.util.EventListener, javax.swing.event.CaretListener, EditorPlugin
Direct Known Subclasses:
AbstractBrowseClickPlugin

public abstract class AbstractClickPlugin
extends java.lang.Object
implements EditorPlugin, java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, javax.swing.event.CaretListener

The AbstractClickPlugin is an abstract starting point for an EditorPlugin implementation which provides support for performing some action when the user clicks over certain text in an editor, usually with a modifier key held down. It also supports displaying some hint text in the status bar, when the user hovers (moves the mouse) over that text with modifier key held down, and underlines it for additional feedback.


Field Summary
protected static int ACTION_NONE
          The constant for no action, or unknown action.
protected static int ALL_MODIFIER_MASK
          Mask for all modifier keys.
protected static int DEFAULT_DELAY_TIME
          The default delay time for updates (in ms).

 

Constructor Summary
AbstractClickPlugin()
           

 

Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Invoked when an action occurs.
 void caretUpdate(javax.swing.event.CaretEvent e)
           
 void deinstall(BasicEditorPane editor)
          Called when the plugin is being removed from the BasicEditorPane (for example when the editor is closed.) This is used to notify plugins that they should unregister any listeners that were attached.
protected abstract  int getActionTypeFor(java.awt.event.MouseEvent event)
          Fetch the subclass-specific action type that corresponds to the given event (which may be a mouse moved, or mouse clicked event).
protected  BasicDocument getDocument()
          Fetch the BasicDocument instance that is being edited
protected  BasicEditorPane getEditorPane()
          Fetch the BasicEditorPane associated with this plugin, or null if this plugin is not currently installed.
protected abstract  HighlightStyle getHighlightStyleFor(int actionType)
          Fetch the HighlightStyle which should be used for highlighting the a given region for the specified action type.
protected abstract  java.lang.String getHintTextFor(int actionType)
          Fetch the hint text that should be displayed in the editor status bar for the given action type.
protected abstract  NumberRange getRegionFor(int offset, int actionType)
          Fetch the NumberRange instance for the underlinable region that includes the given offset.
protected  TextBuffer getTextBuffer()
          Private utility routine to fetch the text buffer of the document being edited.
protected  int getUpdateDelayTime()
          Fetch the delay time in which underlines should be updated.
protected abstract  void handleClickAction(java.awt.Point clickPoint, int actionType)
          Perform the subclass-specific click action at the given click point, and action type.
protected  boolean hasModifierEx(java.awt.event.MouseEvent event, int modifierEx)
          Check whether a given modifier is down for the mouse event, such as InputEvent.CTRL_DOWN_MASK.
 void install(BasicEditorPane editor)
          Called when this plugin is being installed into the BasicEditorPane.
protected  boolean isActionTrigger(java.awt.event.MouseEvent event)
          Fetch whether the given event represents an action trigger.
 void mouseClicked(java.awt.event.MouseEvent event)
          Invoked when the mouse button has been clicked (pressed and released) on a component.
 void mouseDragged(java.awt.event.MouseEvent event)
           
 void mouseEntered(java.awt.event.MouseEvent event)
           
 void mouseExited(java.awt.event.MouseEvent event)
          Invoked when the mouse exits a component.
 void mouseMoved(java.awt.event.MouseEvent event)
          Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.
 void mousePressed(java.awt.event.MouseEvent event)
           
 void mouseReleased(java.awt.event.MouseEvent event)
           
 void propertyChange(java.beans.PropertyChangeEvent event)
          This method gets called when a bound property is changed.
protected  void updateHighlight(java.awt.Point point, int actionType)
          Update the underline and feedback text that is displayed.
protected  void updateHint(int actionType)
          Update the current hint text that is displayed in the editor.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

ACTION_NONE

protected static final int ACTION_NONE
The constant for no action, or unknown action. The mouse event will be ignored for such cases.
See Also:
Constant Field Values

DEFAULT_DELAY_TIME

protected static final int DEFAULT_DELAY_TIME
The default delay time for updates (in ms).
See Also:
Constant Field Values

ALL_MODIFIER_MASK

protected static final int ALL_MODIFIER_MASK
Mask for all modifier keys.
See Also:
Constant Field Values

Constructor Detail

AbstractClickPlugin

public AbstractClickPlugin()

Method Detail

install

public void install(BasicEditorPane editor)
Called when this plugin is being installed into the BasicEditorPane.
Specified by:
install in interface EditorPlugin
Parameters:
editor - the editor pane

deinstall

public void deinstall(BasicEditorPane editor)
Called when the plugin is being removed from the BasicEditorPane (for example when the editor is closed.) This is used to notify plugins that they should unregister any listeners that were attached.
Specified by:
deinstall in interface EditorPlugin
Parameters:
editor - the editor pane

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
This method gets called when a bound property is changed.
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
event - A PropertyChangeEvent object describing the event source and the property that has changed.

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent event)
Invoked when the mouse button has been clicked (pressed and released) on a component.
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent event)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent event)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent event)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent event)
Invoked when the mouse exits a component.
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent event)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent event)
Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

caretUpdate

public void caretUpdate(javax.swing.event.CaretEvent e)
Specified by:
caretUpdate in interface javax.swing.event.CaretListener

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Invoked when an action occurs.
Specified by:
actionPerformed in interface java.awt.event.ActionListener

getActionTypeFor

protected abstract int getActionTypeFor(java.awt.event.MouseEvent event)
Fetch the subclass-specific action type that corresponds to the given event (which may be a mouse moved, or mouse clicked event). It is expected that subclasses would check the modifier of the event, and return an associated action type for that modifier. If there is no associated type for the given modifier, ACTION_NONE should be returned.
Parameters:
event - the mouse event that occurred
Returns:
the action type for the given modifiers of the event, or ACTION_NONE if the event should be ignored

handleClickAction

protected abstract void handleClickAction(java.awt.Point clickPoint,
                                          int actionType)
Perform the subclass-specific click action at the given click point, and action type. The action type was returned by getActionTypeFor() for the mouse click event.
Parameters:
clickPoint - the click point where the mouse click event occurred
actionType - the action type the modifiers on the event mapped to

getHighlightStyleFor

protected abstract HighlightStyle getHighlightStyleFor(int actionType)
Fetch the HighlightStyle which should be used for highlighting the a given region for the specified action type.
Parameters:
actionType - the action type the modifiers map to
Returns:
the highlhight style that should be used

getHintTextFor

protected abstract java.lang.String getHintTextFor(int actionType)
Fetch the hint text that should be displayed in the editor status bar for the given action type.
Parameters:
actionType - the action type the modifiers map to
Returns:
the hint text (if any) that should be displayed

getRegionFor

protected abstract NumberRange getRegionFor(int offset,
                                            int actionType)
Fetch the NumberRange instance for the underlinable region that includes the given offset.
Parameters:
offset - the offset the mouse hovered over
actionType - the action type based on the modifiers of the event
Returns:
the NumberRange for any underlinable region, or null for none

getUpdateDelayTime

protected int getUpdateDelayTime()
Fetch the delay time in which underlines should be updated. The delay is intentional to avoid causing any problems with UI responsiveness. The default behavior should be sufficient for most clients.
Returns:
the delay time for updates (in ms)

isActionTrigger

protected boolean isActionTrigger(java.awt.event.MouseEvent event)
Fetch whether the given event represents an action trigger. This just checks whether the action type for the given event is defined.
Parameters:
event - the mouse event that occurred
Returns:
true if the event should trigger a subclass action

hasModifierEx

protected boolean hasModifierEx(java.awt.event.MouseEvent event,
                                int modifierEx)
Check whether a given modifier is down for the mouse event, such as InputEvent.CTRL_DOWN_MASK.
Parameters:
event - the mouse event that occurred
modifierEx - the modifier (JDK 1.4) to check for
Returns:
true if the modifier is set in the event

getTextBuffer

protected TextBuffer getTextBuffer()
Private utility routine to fetch the text buffer of the document being edited.
Returns:
the text buffer

getEditorPane

protected BasicEditorPane getEditorPane()
Fetch the BasicEditorPane associated with this plugin, or null if this plugin is not currently installed.
Returns:
the associated editor pane (if any)

getDocument

protected BasicDocument getDocument()
Fetch the BasicDocument instance that is being edited
Returns:
the document being edited

updateHighlight

protected void updateHighlight(java.awt.Point point,
                               int actionType)
Update the underline and feedback text that is displayed. This provides a visible hint to the user that clicking on the given text with the appropriate modifier will perform some action.
Parameters:
point - the point to underline
actionType - the subclass-specific action type

updateHint

protected void updateHint(int actionType)
Update the current hint text that is displayed in the editor.
Parameters:
actionType - the subclass-specific action type

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.3.0)

E17493-04


Copyright © 1997, 2012, Oracle. All rights reserved.