DefaultPropertyEditor Class
- public class DefaultPropertyEditor
extends JPanel
implements FocusListener
, IPropertyEditor
, MouseListener
This component manages display and editing of a property value
in the IDE's property view.
Mouse over, selection, and focus rendering will be handled
by this class, as well as customizable formatting of the value
string.
PropertyEditors allowing keyboard input will support customizable
filtering and validation.
Related Topics
IProperty
IPropertyEditor
PropertyError
-
Hierarchy
-
Object
Component
Container
JComponent
JPanel
DefaultPropertyEditor
-
All Implemented Interfaces
-
Accessible
, EventListener
, FocusListener
, ImageObserver
, IPropertyEditor
, MenuContainer
, MouseListener
, Serializable
-
Direct Known Subclasses
-
BuilderPropertyEditor
, DropDownPropertyEditor
, JavaIdentifierPropertyEditor
, JavaTypePropertyEditor
Methods from javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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, updateUI |
Methods from java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree |
Methods from java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate |
Methods from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultPropertyEditor
protected DefaultPropertyEditor(IProperty
property,
boolean allowTextEdit,
JFormattedTextField.AbstractFormatter
formatter)
DefaultPropertyEditor
protected DefaultPropertyEditor(IProperty
property,
boolean allowTextEdit,
JFormattedTextField.AbstractFormatterFactory
formatFactory)
DefaultPropertyEditor
protected DefaultPropertyEditor(IProperty
property,
boolean allowTextEdit)
DefaultPropertyEditor
public DefaultPropertyEditor(IProperty
property,
JFormattedTextField.AbstractFormatter
formatter)
DefaultPropertyEditor
public DefaultPropertyEditor(IProperty
property,
JFormattedTextField.AbstractFormatterFactory
formatFactory)
DefaultPropertyEditor
public DefaultPropertyEditor(IProperty
property)
activate(FocusListener) Method
public void activate(FocusListener
l)
Initialize the editor display.
Adds the focus listener to all focusable components in
its display. The property view will update its selection
highlighting for this property based on the focus gain
and loss events received by this listener.
Note that if the property editor uses popup windows,
it may need to add this focus listener to any focusable components
in the popup window.
Parameters
-
l
- the focus listener
Related Topics
FocusListener
createDefaultFormatter() Method
public static DefaultFormatter
createDefaultFormatter()
Generates the default text field formatter used
in the property view.
Formatter is set to insert mode.
Returns
- DefaultFormatter
deactivate(FocusListener) Method
public void deactivate(FocusListener
l)
Removes the listener from any focusable components
that the listener was added to in addFocusListener.
Parameters
-
l
- the focus listener
Related Topics
FocusListener
focusGained(FocusEvent) Method
public void focusGained(FocusEvent
e)
Invoked when the text field gains the keyboard focus.
focusLost(FocusEvent) Method
public void focusLost(FocusEvent
e)
Invoked when the text field loses the keyboard focus.
getComponent() Method
public Component
getComponent()
Returns the component which will be placed in the property view
for display and editing of the property value.
The property view will call requestFocus on this component
when it should take focus and display in edit mode.
Returns
- Component
getProperty() Method
public IProperty
getProperty()
Returns the IProperty whose value this editor displays.
Returns
- IProperty
getTextField() Method
public JFormattedTextField
getTextField()
Returns the JFormattedTextField
used to edit the
value.
Returns
- JFormattedTextField
handleKeyPressedEvent(KeyEvent) Method
protected void handleKeyPressedEvent(KeyEvent
e)
Default key event handler for this editor.
isFocusContainer() Method
protected boolean isFocusContainer()
Returns
- Is focus currently somewhere in this editor.
mouseClicked(MouseEvent) Method
public void mouseClicked(MouseEvent
e)
Handles setting of the property value.
PropertyEditors that subclass this editor are advised to use this
method to set the property value rather than calling the property's
setValue method directly. This will make ensure that any focus changes
that may occur as result of setting the value will not cause an
unintended write of the previous value. This method will disable
writing of the property value until the value has be re-read from from the property.
Made public to support test automation.
mouseEntered(MouseEvent) Method
public void mouseEntered(MouseEvent
e)
mouseExited(MouseEvent) Method
public void mouseExited(MouseEvent
e)
mousePressed(MouseEvent) Method
public void mousePressed(MouseEvent
e)
mouseReleased(MouseEvent) Method
public void mouseReleased(MouseEvent
e)
setFocused() Method
public boolean setFocused()
Called by the property view when this property editor
should request focus to a component in its display.
Return value should reflect whether the focus request
is guaranteed to fail or is likely to succeed. If the
property editor already has focus, return true (note that
this differs from the behavior of the Component and JComponent
request focus methods which return false if the component
already has focus).
Use of Component/JComponent.requestFocus(boolean temporary)
is recommended (despite swing/awt java doc to the contrary).
It is the only focus request method that both gives a return
value, and will change active windows if necessary.
Returns
false
if the focus request is guaranteed to
fail; true
if it is likely to succeed