|
Orbital library | |||||||||
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.JPanel orbital.moon.awt.DefaultCustomizer
public class DefaultCustomizer
Provides a fully-automatic generic JavaBean customizer. This customizer is displaying fields according to the introspection of the target class revealing all bean properties. Thereby, it provides average complexity customizers for all beans, automatically, without a need for programming by hand.
For PropertyEditor
s that support a custom editor, this customizer supports an extra
method in the PropertyEditor
implementation. If it exists, the method of the signature
boolean isInlineCustomEditor()is used to tell whether a custom editor wants to be inlined. If this method returns
false
,
any custom editors are displayed in an exterior dialog upon user request. If it returns true
,
custom editors will be displayed inline.
If this method does not exist, the size of the custom editor is used to determine a sufficient
behaviour instead.
CustomizerViewController
,
CustomizerViewController.customizerFor(Class)
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected java.lang.Class |
beanClass
for which class this customizer is intended. |
protected java.beans.PropertyDescriptor[] |
beanProperties
list of bean properties. |
protected java.awt.Component[] |
propertyEditorComponents
list of visual editor components for bean properties. |
protected java.beans.PropertyEditor[] |
propertyEditors
list of property editors for bean properties. |
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 | |
---|---|
protected |
DefaultCustomizer()
Create a default customizer that is not yet initialized to a bean class. |
|
DefaultCustomizer(java.lang.Class beanClass)
Create a default customizer initialized to customize a bean class. |
Method Summary | |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
|
protected java.awt.Component |
createPropertyEditorComponent(java.beans.PropertyDescriptor property,
java.beans.PropertyEditor peditor)
Create a component to use as an editor for the property specified. |
protected static boolean |
customizerForProperty(java.beans.PropertyDescriptor property)
Checks whether we find a customizer for the type of the property specified. |
protected java.beans.PropertyDescriptor[] |
getAllPropertyDescriptors(java.beans.BeanInfo info)
Get all PropertyDescriptors from the BeanInfo including its additonal BeanInfos. |
java.lang.Class |
getBeanClass()
get the class of the bean this customizer is responsible for. |
protected java.beans.BeanInfo |
getBeanInfo(java.lang.Class cls)
Get the BeanInfo of a class. |
protected java.lang.Object |
getObject()
Get the object currently customized. |
protected static java.beans.PropertyEditor |
getPropertyEditor(java.beans.PropertyDescriptor property)
Get a property editor for the property specified. |
int |
getTruncation()
|
void |
init(java.lang.Class beanClass)
Initializes default customizer view according to the BeanInfo of the given object. |
protected void |
registerPropertyChangeUpdater(java.beans.PropertyDescriptor property,
java.beans.PropertyEditor peditor,
java.awt.Component propertyEditorComponent)
Register to property change events of the property editor. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
|
void |
setEditable(boolean editable)
write-through editable to all content property editor components. |
void |
setEnabled(boolean enabled)
write-through to enable or disable all content property editor components. |
void |
setObject(java.lang.Object bean)
Set the object to be customized now. |
void |
setSpacing(boolean value)
Whether or not to put spacing (additional insets) between property fields. |
void |
setTruncation(int truncateAfter)
|
protected void |
update(java.lang.Object bean)
Update all values displayed for the given bean. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
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, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, 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, 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, addInputMethodListener, 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, getInputMethodRequests, 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, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, 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 |
---|
protected java.lang.Class beanClass
protected java.beans.PropertyDescriptor[] beanProperties
protected java.beans.PropertyEditor[] propertyEditors
protected java.awt.Component[] propertyEditorComponents
Constructor Detail |
---|
public DefaultCustomizer(java.lang.Class beanClass) throws java.beans.IntrospectionException
java.beans.IntrospectionException
CustomizerViewController.customizerFor(Class)
,
init(Class)
protected DefaultCustomizer() throws java.beans.IntrospectionException
In order to use a default customizer created this way, you need to call
init(Class)
explicitly, first.
java.beans.IntrospectionException
CustomizerViewController.customizerFor(Class)
,
init(Class)
Method Detail |
---|
public java.lang.Class getBeanClass()
public int getTruncation()
public void setTruncation(int truncateAfter)
public void setSpacing(boolean value)
value
- true
to enable, false
to disablepublic void setEnabled(boolean enabled)
setEnabled
in class javax.swing.JComponent
public void setEditable(boolean editable)
setEnabled(boolean)
called.
public void init(java.lang.Class beanClass) throws java.beans.IntrospectionException
beanClass
- for which class of objects this customizer is intended.
java.beans.IntrospectionException
protected java.awt.Component createPropertyEditorComponent(java.beans.PropertyDescriptor property, java.beans.PropertyEditor peditor) throws java.beans.IntrospectionException
If a special system-default display component is used, a listener to that component updating the property editor will have been set as well. It is set to a listener that forwards the display component-specific event to a generic property change event of the PropertyEditor.
java.beans.IntrospectionException
PropertyEditor.isPaintable()
,
PropertyEditor.supportsCustomEditor()
,
PropertyEditor.getTags()
,
DefaultCustomizer.PropertyEditingChange
,
Factory Methodprotected void registerPropertyChangeUpdater(java.beans.PropertyDescriptor property, java.beans.PropertyEditor peditor, java.awt.Component propertyEditorComponent)
Register a property updater updating the bean's property specified in the property descriptor with the values of the given property editor on changes.
This central method can be overwritten to implement
property
- descriptor of the property to update.
Usage of property is both, get and set.peditor
- the property editor to set and get the values from.
Its getValue() method is considered for the value to set for the bean's property.
Usage of peditor is read-only.propertyEditorComponent
- visual editor component for property.protected static boolean customizerForProperty(java.beans.PropertyDescriptor property)
BeanDescriptor.getCustomizerClass()
protected static java.beans.PropertyEditor getPropertyEditor(java.beans.PropertyDescriptor property) throws java.beans.IntrospectionException
java.beans.IntrospectionException
PropertyDescriptor.getPropertyEditorClass()
,
PropertyEditorManager.findEditor(Class)
protected java.lang.Object getObject()
setObject(Object)
.setObject(Object)
public void setObject(java.lang.Object bean)
setObject
in interface java.beans.Customizer
bean
- the bean object to be customized.
Requires bean to be the kind of type specified in the constructor.
null
will clear all values displayed.protected void update(java.lang.Object bean) throws java.beans.IntrospectionException
java.beans.IntrospectionException
protected java.beans.BeanInfo getBeanInfo(java.lang.Class cls) throws java.beans.IntrospectionException
java.beans.IntrospectionException
Introspector.getBeanInfo(Class, int)
protected java.beans.PropertyDescriptor[] getAllPropertyDescriptors(java.beans.BeanInfo info)
BeanInfo.getAdditionalBeanInfo()
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener
in interface java.beans.Customizer
addPropertyChangeListener
in class java.awt.Container
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener
in interface java.beans.Customizer
removePropertyChangeListener
in class java.awt.Component
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |