|
org.netbeans.modules.editor.lib/1 1.14.0 3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.event.MouseAdapter
org.netbeans.editor.ext.ToolTipSupport
public class ToolTipSupport
Support for editor tooltips. Once the user stops moving the mouse
for the INITIAL_DELAY
milliseconds the enterTimer fires
and the updateToolTip()
method is called which searches
for the action named ExtKit.buildToolTipAction
and if found
it executes it. The tooltips can be displayed by either calling
setToolTipText(java.lang.String)
or setToolTip(javax.swing.JComponent)
.
However only one of the above ways should be used
not a combination of both because in such case
the text could be propagated in the previously set
custom tooltip component.
Field Summary | |
---|---|
static int |
DISMISS_DELAY
Delay after which the tooltip will be hidden automatically in milliseconds. |
static int |
INITIAL_DELAY
Initial delay before the tooltip is shown in milliseconds. |
static String |
PROP_DISMISS_DELAY
Property for the dismiss delay change |
static String |
PROP_ENABLED
Property for the enabled flag change |
static String |
PROP_INITIAL_DELAY
Property for the initial delay change |
static String |
PROP_STATUS
Property for the visibility status change. |
static String |
PROP_TOOL_TIP
Property for the tooltip component change |
static String |
PROP_TOOL_TIP_TEXT
Property for the tooltip text change |
static int |
STATUS_COMPONENT_VISIBLE
Status indicating that the tooltip is visible because setToolTip(javax.swing.JComponent)
was called. |
static int |
STATUS_HIDDEN
Status indicating that the tooltip is not showing on the screen. |
static int |
STATUS_TEXT_VISIBLE
Status indicating that the tooltip is visible because setToolTipText(java.lang.String)
was called. |
static int |
STATUS_VISIBILITY_ENABLED
Status indicating that the tooltip is not showing on the screen but once either the setToolTipText(java.lang.String)
or setToolTip(javax.swing.JComponent) gets called
the tooltip will become visible. |
Constructor Summary | |
---|---|
ToolTipSupport(ExtEditorUI extEditorUI)
Construct new support for tooltips. |
Method Summary | |
---|---|
void |
actionPerformed(ActionEvent evt)
|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add the listener for the property changes. |
protected void |
componentToolTipTextChanged(PropertyChangeEvent evt)
Called automatically when the JComponent.TOOL_TIP_TEXT_KEY
property of the corresponding editor component
gets changed.By default it calls setToolTipText(java.lang.String)
with the new tooltip text of the component. |
protected JComponent |
createDefaultToolTip()
Create the default tooltip component. |
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
Fire the change of the given property. |
void |
focusGained(FocusEvent e)
|
void |
focusLost(FocusEvent e)
|
int |
getDismissDelay()
|
String |
getIdentifierUnderCursor()
Helper method to get the identifier under the mouse cursor. |
int |
getInitialDelay()
|
MouseEvent |
getLastMouseEvent()
|
int |
getStatus()
|
JComponent |
getToolTip()
|
String |
getToolTipText()
|
boolean |
isEnabled()
|
boolean |
isToolTipVisible()
|
void |
mouseClicked(MouseEvent evt)
|
void |
mouseDragged(MouseEvent evt)
|
void |
mouseEntered(MouseEvent evt)
|
void |
mouseExited(MouseEvent evt)
|
void |
mouseMoved(MouseEvent evt)
|
void |
mousePressed(MouseEvent evt)
|
void |
mouseReleased(MouseEvent evt)
|
void |
propertyChange(PropertyChangeEvent evt)
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
|
void |
setDismissDelay(int delay)
Set the delay between displaying of the tooltip and its automatic hiding in milliseconds. |
void |
setEnabled(boolean enabled)
Set whether the tooltip support is enabled. |
void |
setInitialDelay(int delay)
Set the delay between stopping mouse movement and displaying of the tooltip in milliseconds. |
void |
settingsChange(SettingsChangeEvent evt)
|
void |
setToolTip(JComponent toolTip)
Set the tooltip component. |
void |
setToolTip(JComponent toolTip,
PopupManager.HorizontalBounds horizontalBounds,
PopupManager.Placement placement)
|
void |
setToolTip(JComponent toolTip,
PopupManager.HorizontalBounds horizontalBounds,
PopupManager.Placement placement,
int horizontalAdjustment,
int verticalAdjustment)
|
void |
setToolTipText(String text)
Set the tooltip text to make the tooltip to be shown on the screen. |
protected void |
setToolTipVisible(boolean visible)
Set the visibility of the tooltip. |
protected void |
updateToolTip()
Update the tooltip by running corresponding action ExtKit.buildToolTipAction . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PROP_TOOL_TIP
public static final String PROP_TOOL_TIP_TEXT
public static final String PROP_STATUS
public static final String PROP_ENABLED
public static final String PROP_INITIAL_DELAY
public static final String PROP_DISMISS_DELAY
public static final int INITIAL_DELAY
public static final int DISMISS_DELAY
public static final int STATUS_HIDDEN
public static final int STATUS_VISIBILITY_ENABLED
setToolTipText(java.lang.String)
or setToolTip(javax.swing.JComponent)
gets called
the tooltip will become visible.
public static final int STATUS_TEXT_VISIBLE
setToolTipText(java.lang.String)
was called.
public static final int STATUS_COMPONENT_VISIBLE
setToolTip(javax.swing.JComponent)
was called.
Constructor Detail |
---|
public ToolTipSupport(ExtEditorUI extEditorUI)
Method Detail |
---|
public final JComponent getToolTip()
public void setToolTip(JComponent toolTip)
toolTip
- component that either contains the tooltip
or that will display a text tooltip.public void setToolTip(JComponent toolTip, PopupManager.HorizontalBounds horizontalBounds, PopupManager.Placement placement)
public void setToolTip(JComponent toolTip, PopupManager.HorizontalBounds horizontalBounds, PopupManager.Placement placement, int horizontalAdjustment, int verticalAdjustment)
protected JComponent createDefaultToolTip()
public void settingsChange(SettingsChangeEvent evt)
settingsChange
in interface SettingsChangeListener
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
protected void updateToolTip()
ExtKit.buildToolTipAction
. This method gets
called once the enterTimer fires and it can be overriden
by children.
protected void setToolTipVisible(boolean visible)
visible
- whether tooltip should become visible or not.
If true the status is changed
to #STATUS_VISIBILITY_ENABLED}
and @link #updateToolTip()
is called.public boolean isToolTipVisible()
getStatus()
gives the exact visibility state.public final int getStatus()
STATUS_HIDDEN
or STATUS_VISIBILITY_ENABLED
or STATUS_TEXT_VISIBLE
or STATUS_COMPONENT_VISIBLE
.public String getToolTipText()
public void setToolTipText(String text)
text
- tooltip text to be displayed.public String getIdentifierUnderCursor()
public boolean isEnabled()
public void setEnabled(boolean enabled)
enabled
- whether the tooltip will be enabled or not.public int getInitialDelay()
public void setInitialDelay(int delay)
public int getDismissDelay()
public void setDismissDelay(int delay)
public void actionPerformed(ActionEvent evt)
actionPerformed
in interface ActionListener
public void mouseClicked(MouseEvent evt)
mouseClicked
in interface MouseListener
mouseClicked
in class MouseAdapter
public void mousePressed(MouseEvent evt)
mousePressed
in interface MouseListener
mousePressed
in class MouseAdapter
public void mouseReleased(MouseEvent evt)
mouseReleased
in interface MouseListener
mouseReleased
in class MouseAdapter
public void mouseEntered(MouseEvent evt)
mouseEntered
in interface MouseListener
mouseEntered
in class MouseAdapter
public void mouseExited(MouseEvent evt)
mouseExited
in interface MouseListener
mouseExited
in class MouseAdapter
public void mouseDragged(MouseEvent evt)
mouseDragged
in interface MouseMotionListener
public void mouseMoved(MouseEvent evt)
mouseMoved
in interface MouseMotionListener
public final MouseEvent getLastMouseEvent()
protected void componentToolTipTextChanged(PropertyChangeEvent evt)
JComponent.TOOL_TIP_TEXT_KEY
property of the corresponding editor component
gets changed.setToolTipText(java.lang.String)
with the new tooltip text of the component.
public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- listener to be added.public void removePropertyChangeListener(PropertyChangeListener listener)
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
propertyName
- name of the fired propertyoldValue
- old value of the propertynewValue
- new value of the property.public void focusGained(FocusEvent e)
focusGained
in interface FocusListener
public void focusLost(FocusEvent e)
focusLost
in interface FocusListener
|
org.netbeans.modules.editor.lib/1 1.14.0 3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |