DESY ACOP Beans Home

com.cosylab.gui.property.editors
Class ClassEditor

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.JTextField
                      extended by com.cosylab.gui.property.editors.ClassEditor
All Implemented Interfaces:
PropertyEditor, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable, javax.swing.SwingConstants

public class ClassEditor
extends javax.swing.JTextField
implements PropertyEditor

A component used for specifyind Class objects. User can enter the name of the class and upon pressing enter or on loosing focus the Class instance is obtained and propertyChange events are fired. If the class name is invalid, the text in the textField is colored red.

Version:
$id$
Author:
Miha Kadunc
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JTextField
javax.swing.JTextField.AccessibleJTextField
 
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.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String APPLY_MODE_PROPERTY
           
static int APPLY_NEVER
           
static int APPLY_ON_CHANGE
           
static int APPLY_ON_ENTER
           
static int APPLY_ON_FOCUS_LOST
           
 
Fields inherited from class javax.swing.JTextField
notifyAction
 
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 com.cosylab.gui.property.editors.PropertyEditor
PROPERTY_VALUE_NAME
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ClassEditor()
           
ClassEditor(java.lang.Class superClass)
           
 
Method Summary
 boolean getAllowAbstract()
          Gets the allowAbstract.
 int getApplyMode()
           
 java.lang.String getDescription()
          Returns the description for this editor.
 PropertyEditor getEditor()
           
 java.awt.Color getErrorColor()
          Gets the errorColor.
 java.lang.Object getPropertyValue()
          Returns the value contained in this editor.
 java.lang.Class getSuperClass()
          Gets the superClass.
 java.lang.Class getUserClass()
          Gets the UserClass.
 void setAllowAbstract(boolean allowInterface)
          Sets the AllowInterface.
 void setApplyMode(int mode)
           
 void setDescription(java.lang.String description)
           
 void setErrorColor(java.awt.Color errorColor)
          Sets the errorColor.
 void setMargin(java.awt.Insets margin)
          Bugfix for bug 4243496 (versions 1.1.7 - 1.4)
 boolean setPropertyValue(java.lang.Object value)
          PropertyEditor should set the value specified and display it accordingly.
 void setSuperClass(java.lang.Class superClass)
          Sets the superClass.
 void setText(java.lang.String t)
           
 
Methods inherited from class javax.swing.JTextField
actionPropertyChanged, addActionListener, configurePropertiesFromAction, createActionPropertyChangeListener, createDefaultModel, fireActionPerformed, getAccessibleContext, getAction, getActionListeners, getActions, getColumns, getColumnWidth, getHorizontalAlignment, getHorizontalVisibility, getPreferredSize, getScrollOffset, getUIClassID, isValidateRoot, paramString, postActionEvent, removeActionListener, scrollRectToVisible, setAction, setActionCommand, setColumns, setDocument, setFont, setHorizontalAlignment, setScrollOffset
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, replaceSelection, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, 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, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, 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, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processMouseWheelEvent, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.cosylab.gui.property.editors.PropertyEditor
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

APPLY_MODE_PROPERTY

public static final java.lang.String APPLY_MODE_PROPERTY
See Also:
Constant Field Values

APPLY_ON_CHANGE

public static final int APPLY_ON_CHANGE
See Also:
Constant Field Values

APPLY_ON_FOCUS_LOST

public static final int APPLY_ON_FOCUS_LOST
See Also:
Constant Field Values

APPLY_ON_ENTER

public static final int APPLY_ON_ENTER
See Also:
Constant Field Values

APPLY_NEVER

public static final int APPLY_NEVER
See Also:
Constant Field Values
Constructor Detail

ClassEditor

public ClassEditor()

ClassEditor

public ClassEditor(java.lang.Class superClass)
Method Detail

getAllowAbstract

public boolean getAllowAbstract()
Gets the allowAbstract.

Returns:
Returns a boolean

setAllowAbstract

public void setAllowAbstract(boolean allowInterface)
Sets the AllowInterface.

Parameters:
AllowInterface - The AllowInterface to set

getSuperClass

public java.lang.Class getSuperClass()
Gets the superClass.

Returns:
Returns a java.lang.Class

setSuperClass

public void setSuperClass(java.lang.Class superClass)
Sets the superClass.

Parameters:
superClass - The superClass to set

getUserClass

public java.lang.Class getUserClass()
Gets the UserClass.

Returns:
Returns a java.lang.Class

getErrorColor

public java.awt.Color getErrorColor()
Gets the errorColor.

Returns:
Returns a java.awt.Color

setErrorColor

public void setErrorColor(java.awt.Color errorColor)
Sets the errorColor.

Parameters:
errorColor - The errorColor to set

setText

public void setText(java.lang.String t)
Overrides:
setText in class javax.swing.text.JTextComponent
See Also:
JTextComponent#setText(String)

getPropertyValue

public java.lang.Object getPropertyValue()
Description copied from interface: PropertyEditor
Returns the value contained in this editor. To provide generic approach, value must be contained within Object, primitive types should be wrapped within appropriate classes (int - Integer). Return value of null should be used only to indicate, the value contained within this editor is invalid.

Specified by:
getPropertyValue in interface PropertyEditor
Returns:
Object
See Also:
ValueEditor#getValue()

setPropertyValue

public boolean setPropertyValue(java.lang.Object value)
Description copied from interface: PropertyEditor
PropertyEditor should set the value specified and display it accordingly. Return value show whether the value could be set. Return value should be true only, it the editor was able to set and display value. If the value parameter does not match the editors expected type, is null or has invalid value, return value should be false.

Specified by:
setPropertyValue in interface PropertyEditor
Parameters:
value - Value to set
Returns:
boolean Indicates whether set was successful.
See Also:
ValueEditor#setValue(Object)

setMargin

public void setMargin(java.awt.Insets margin)
Bugfix for bug 4243496 (versions 1.1.7 - 1.4)

Overrides:
setMargin in class javax.swing.text.JTextComponent
See Also:
JComponent#setMargin(Insets)

getDescription

public java.lang.String getDescription()
Description copied from interface: PropertyEditor
Returns the description for this editor. This description will be used to describe the component in the GUI. Its actual implementation depends on the implementing class.

If editor is unable to display the description, it must return null. This will allow for automatic creation of description and properly wrap the methods. If editor can display description but its value has not yet been defined, this method should return empty string.

Specified by:
getDescription in interface PropertyEditor
Returns:
String
See Also:
PropertyEditor.getDescription()

getEditor

public PropertyEditor getEditor()
See Also:
com.cosylab.gui.property.editors.PropertyEditor#getEditor()

setDescription

public void setDescription(java.lang.String description)
Specified by:
setDescription in interface PropertyEditor
See Also:
PropertyEditor.setDescription(String)

setApplyMode

public void setApplyMode(int mode)

getApplyMode

public int getApplyMode()


Copyright © 2010. All Rights Reserved.