Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.dinopolis.util.gui
Class ResourceEditorPanel  view ResourceEditorPanel download ResourceEditorPanel.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.dinopolis.util.gui.ResourceEditorPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable

public class ResourceEditorPanel
extends javax.swing.JPanel
implements java.awt.event.ActionListener, java.beans.PropertyChangeListener

A Class the provides a Property Editor for the properties of a 'Map'.

Version:
$Revision: 1.4 $

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  javax.swing.JButton apply_button_
          the apply button
static java.lang.String APPLY_COMMAND
          the apply command name
private  java.awt.Insets button_insets_
          the button insets
private static org.dinopolis.util.Resources edit_resources_
          the resources to edit
private  javax.swing.JTabbedPane editor_panel_
          the panel holding all editors
private  java.util.HashSet hide_key_set_
          a set holding all property keys that are not to be displayed
private  javax.swing.Icon info_icon_
          the info icon
static java.lang.String KEY_APPLY_BUTTON
          the key for the apply button resource
static java.lang.String KEY_BUTTONS_INSETS
          the key for the buttons insets resource
private  java.util.HashMap key_editor_map_
          a map holding all property keys and there corresponding values that are to be displayed.
static java.lang.String KEY_HIDE_RESOURCES
          the key for the keys that are to be hided
static java.lang.String KEY_INFO_BUTTON_ICON
           
static java.lang.String KEY_INFO_BUTTON_ICON_POSITION
          the key for the position of the info button
static java.lang.String KEY_PROPERTY_EDITOR_SEARCH_PATH
          the search path key to find PropertyEditors
static java.lang.String KEY_TAB_DEFAULT
          the title of the default tab
private static org.dinopolis.util.Resources my_resources_
          my private resources
private  java.lang.String position_info_button_
          position of the info button
private  java.beans.PropertyEditorManager property_editor_manager_
          the property editor manager
private  java.lang.String[] property_editor_manager_default_search_path_
          the property editor manager default search path
static java.lang.String RESOURCE_BOUNDLE_NAME
          the name of my resource file
static java.lang.String RESOURCE_DIR_NAME
          the name of my resource directory
private  java.util.Vector type_save_
          a vector containing all type save editors
private  java.lang.Thread update_thread_
          the swing worker creating the panel
 
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.Container
 
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
ResourceEditorPanel(org.dinopolis.util.Resources resources)
          Creates a new ResourceEditorPanel that is able to edit the resources given in resources.
ResourceEditorPanel(org.dinopolis.util.Resources resources, java.lang.String resource_dir)
          Creates a new ResourceEditorPanel that is able to edit the resources given in resources.
ResourceEditorPanel(org.dinopolis.util.Resources resources, java.lang.String resource_dir, boolean show_apply_button)
          Creates a new ResourceEditorPanel that is able to edit the resources given in resources.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Invoked when the Close button was pressed.
private  void addEditor(java.lang.String key, javax.swing.JPanel panel)
           
 void apply()
           
private static boolean areEqual(java.lang.Object first, java.lang.Object second)
           
protected  java.awt.Component createButtons()
           
private  javax.swing.JPanel createGroup(java.lang.String key)
           
protected  java.beans.PropertyEditor createStringEditor(java.lang.String key)
           
private  javax.swing.JPanel createTab(java.lang.String key)
           
private  java.awt.Component createTabWrapper(javax.swing.JPanel tab)
           
protected  java.beans.PropertyEditor createTypeSaveEditor(java.lang.String key)
          Creates a new PropertyEditor for the given key.
 javax.swing.JButton getApplyButton()
           
 java.awt.Insets getButtonInsets()
           
private  java.lang.String[] getChildren(java.lang.String key)
           
protected  java.awt.Component getEditingOrViewComponent(java.lang.String key, java.beans.PropertyEditor editor)
           
protected  java.beans.PropertyEditor getEditor(java.lang.String key)
          Gets a PropertyEditor for the given key.
static org.dinopolis.util.Resources getResources()
           
 java.lang.String getTitle(java.lang.String key)
           
private  boolean isResourceGroup(java.lang.String key)
           
private  boolean isToHide(java.lang.String key)
          Returns true if the resource with the given key is to be hidden, false otherwise.
 void propertyChange(java.beans.PropertyChangeEvent event)
          Fired after a Bean's property has changed.
 void registerEditor(java.lang.Class type, java.lang.Class editor)
          Register an editor class to be used to editor values of a given target class.
protected  void setAllEditors()
          Updates the whole editor and shows all components for the given Map.
 void updateEditors()
          Updates the whole editor and shows all components for the given Map.
 void updateResources()
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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
 
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, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, 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, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, 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, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, 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, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE_BOUNDLE_NAME

public static final java.lang.String RESOURCE_BOUNDLE_NAME
the name of my resource file

See Also:
Constant Field Values

RESOURCE_DIR_NAME

public static final java.lang.String RESOURCE_DIR_NAME
the name of my resource directory

See Also:
Constant Field Values

edit_resources_

private static org.dinopolis.util.Resources edit_resources_
the resources to edit


my_resources_

private static org.dinopolis.util.Resources my_resources_
my private resources


KEY_APPLY_BUTTON

public static final java.lang.String KEY_APPLY_BUTTON
the key for the apply button resource

See Also:
Constant Field Values

KEY_INFO_BUTTON_ICON_POSITION

public static final java.lang.String KEY_INFO_BUTTON_ICON_POSITION
the key for the position of the info button

See Also:
Constant Field Values

KEY_INFO_BUTTON_ICON

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

APPLY_COMMAND

public static final java.lang.String APPLY_COMMAND
the apply command name

See Also:
Constant Field Values

KEY_BUTTONS_INSETS

public static final java.lang.String KEY_BUTTONS_INSETS
the key for the buttons insets resource

See Also:
Constant Field Values

KEY_TAB_DEFAULT

public static final java.lang.String KEY_TAB_DEFAULT
the title of the default tab

See Also:
Constant Field Values

KEY_PROPERTY_EDITOR_SEARCH_PATH

public static final java.lang.String KEY_PROPERTY_EDITOR_SEARCH_PATH
the search path key to find PropertyEditors

See Also:
Constant Field Values

KEY_HIDE_RESOURCES

public static final java.lang.String KEY_HIDE_RESOURCES
the key for the keys that are to be hided

See Also:
Constant Field Values

editor_panel_

private javax.swing.JTabbedPane editor_panel_
the panel holding all editors


button_insets_

private java.awt.Insets button_insets_
the button insets


apply_button_

private javax.swing.JButton apply_button_
the apply button


position_info_button_

private java.lang.String position_info_button_
position of the info button


info_icon_

private javax.swing.Icon info_icon_
the info icon


key_editor_map_

private java.util.HashMap key_editor_map_
a map holding all property keys and there corresponding values that are to be displayed.


hide_key_set_

private java.util.HashSet hide_key_set_
a set holding all property keys that are not to be displayed


property_editor_manager_

private java.beans.PropertyEditorManager property_editor_manager_
the property editor manager


property_editor_manager_default_search_path_

private java.lang.String[] property_editor_manager_default_search_path_
the property editor manager default search path


type_save_

private java.util.Vector type_save_
a vector containing all type save editors


update_thread_

private java.lang.Thread update_thread_
the swing worker creating the panel

Constructor Detail

ResourceEditorPanel

public ResourceEditorPanel(org.dinopolis.util.Resources resources)
Creates a new ResourceEditorPanel that is able to edit the resources given in resources.


ResourceEditorPanel

public ResourceEditorPanel(org.dinopolis.util.Resources resources,
                           java.lang.String resource_dir)
                    throws java.util.MissingResourceException
Creates a new ResourceEditorPanel that is able to edit the resources given in resources. The private resource file is searched in resource_dir, relative to the users home dir.


ResourceEditorPanel

public ResourceEditorPanel(org.dinopolis.util.Resources resources,
                           java.lang.String resource_dir,
                           boolean show_apply_button)
                    throws java.util.MissingResourceException
Creates a new ResourceEditorPanel that is able to edit the resources given in resources. The private resource file is searched in resource_dir, relative to the users home dir.

Method Detail

getResources

public static org.dinopolis.util.Resources getResources()

updateResources

public void updateResources()

registerEditor

public void registerEditor(java.lang.Class type,
                           java.lang.Class editor)
Register an editor class to be used to editor values of a given target class.


getEditor

protected java.beans.PropertyEditor getEditor(java.lang.String key)
Gets a PropertyEditor for the given key.


createTypeSaveEditor

protected java.beans.PropertyEditor createTypeSaveEditor(java.lang.String key)
Creates a new PropertyEditor for the given key.


createStringEditor

protected java.beans.PropertyEditor createStringEditor(java.lang.String key)

getEditingOrViewComponent

protected java.awt.Component getEditingOrViewComponent(java.lang.String key,
                                                       java.beans.PropertyEditor editor)

getApplyButton

public javax.swing.JButton getApplyButton()

getButtonInsets

public java.awt.Insets getButtonInsets()

createButtons

protected java.awt.Component createButtons()

updateEditors

public void updateEditors()
Updates the whole editor and shows all components for the given Map. This method uses a swing worker to create all components in background.


setAllEditors

protected void setAllEditors()
Updates the whole editor and shows all components for the given Map.


addEditor

private void addEditor(java.lang.String key,
                       javax.swing.JPanel panel)

isResourceGroup

private boolean isResourceGroup(java.lang.String key)

getChildren

private java.lang.String[] getChildren(java.lang.String key)

createTab

private javax.swing.JPanel createTab(java.lang.String key)

createTabWrapper

private java.awt.Component createTabWrapper(javax.swing.JPanel tab)

createGroup

private javax.swing.JPanel createGroup(java.lang.String key)

getTitle

public java.lang.String getTitle(java.lang.String key)

isToHide

private boolean isToHide(java.lang.String key)
Returns true if the resource with the given key is to be hidden, false otherwise.


apply

public void apply()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Invoked when the Close button was pressed.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Description copied from interface: java.beans.PropertyChangeListener
Fired after a Bean's property has changed.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener

areEqual

private static boolean areEqual(java.lang.Object first,
                                java.lang.Object second)