public class FileTypeUnit extends javax.swing.JPanel implements ConfigurableUnit, OptionsUnit, java.awt.event.ActionListener, javax.swing.event.ListSelectionListener, javax.swing.event.DocumentListener
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected OrderedHashtable<java.lang.String,java.lang.String> |
allowedTypeIDs
Container for the allowed type ids set by the application (key: identifier, value: name).
|
protected java.lang.String |
helpID
Identifier to call the help system (optional).
|
static java.net.URL |
ICON_SMALL
Default unit icon.
|
protected boolean |
initialized
Components have been setup already?
|
protected java.util.Vector<java.awt.Component> |
matches
Remembers the components matching a search pattern for reset.
|
protected javax.swing.tree.DefaultTreeModel |
model
Model of the file type list.
|
protected java.lang.Class[] |
typesClasses
Column name.
|
protected java.lang.String[] |
typesColumns
Column name.
|
protected java.lang.Object[][] |
typesData
List of file types currently displayed by the list.
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
FileTypeUnit()
Constructor of this form.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent event)
Called whenever the one of the components was activated.
|
void |
addFileType(java.lang.String id,
java.lang.String name)
Adds an allowed file type to be managed by the chooser.
|
void |
changedUpdate(javax.swing.event.DocumentEvent event)
Called whenever the document is changed.
|
protected boolean |
checkPattern(java.lang.String pattern)
Checks the extension pattern.
|
void |
configureUnit(java.lang.String id,
Configuration config)
Restores values from persistent data stores.
|
protected void |
finalize()
Cares for proper cleanup after releasing the object.
|
int |
find(java.lang.String pattern)
Searches this unit for certain patterns specified by the user.
|
javax.swing.ImageIcon |
getBigIcon()
Provides the graphical icon of a certain size (normally 32x32 pixels).
|
java.awt.Component |
getComponent()
Provides the GUI component to be displayed.
|
int |
getFileTypeCount()
Provides the number of file types currently managed by the panel.
|
java.lang.String |
getFileTypeName(FileTypeDef typedef,
java.lang.String fallback)
Convenience method to get a file type definition name.
|
FileTypeDef[] |
getFileTypes(Configuration config,
java.lang.String id)
Convenience method to get the file type definitions supported by this unit.
|
protected int |
getRowIndex(java.lang.String id)
Determines the index/row of the given target file type.
|
javax.swing.ImageIcon |
getSmallIcon()
Provides the graphical icon of a certain size (normally 16x16 pixels).
|
static SuffixFilter |
getSuffixFilter(Configuration config,
java.lang.String id,
java.lang.String filterid,
java.lang.String description,
boolean autosuffix,
java.lang.String suffixid)
Convenience method to get a certain file filter.
|
java.lang.String |
getText()
Provides the text of the item to be displayed in the list of the
OptionsDialog . |
java.lang.String |
getTitle()
Provides the title of the item to be displayed on top of the
OptionsDialog . |
javax.swing.JTable |
getTypesTable()
Provides the types table.
|
protected void |
init()
Initializes the GUI components.
|
void |
insertUpdate(javax.swing.event.DocumentEvent event)
Called whenever the document is changed (insert).
|
boolean |
isInputValid()
Provides the info if the options of this unit are OK to be used.
|
boolean |
isModified()
Provides the info if the options of this unit have been changed.
|
void |
removeUpdate(javax.swing.event.DocumentEvent event)
Called whenever the document is changed (remove).
|
void |
resetSearch(java.lang.String pattern)
Resets this unit so that the components do not highlight any search results.
|
void |
setHelpID(java.lang.String helpid)
Sets the optional help link to call the help system.
|
void |
setSelectedFileType(java.lang.String id)
Sets the currently selected file type.
|
static void |
storeDefaultValues(java.lang.String id,
Configuration config,
boolean onthefly,
OrderedHashtable<java.lang.String,FileTypeDef> defaults)
Convenience method to populate the configuration with default values.
|
static void |
storeOverrideValues(java.lang.String id,
Configuration config,
OrderedHashtable<java.lang.String,FileTypeDef> defaults)
Convenience method to populate the configuration with override values.
|
void |
storeUnit(java.lang.String id,
Configuration config)
Stores the current configuration values persistently.
|
void |
unitAdded(OptionsDialog parent,
java.lang.String id)
Informs the unit that it was added to the dialog.
|
void |
unitBecomesHidden()
Informs the unit that it will vanish from the screen (deselected).
|
void |
unitBecomesShown()
Informs the unit that it becomes visible on the screen (selected).
|
void |
unitIsHiding()
Informs the unit that it was made invisible by the manager (deselected).
|
void |
unitIsShowing()
Informs the unit that it was made visible by the manager (selected).
|
void |
unitRegistered(ApplicationModel model,
java.lang.String id)
Informs the configurable unit that it was registered with a model.
|
void |
unitRemoved(OptionsDialog parent,
java.lang.String id)
Informs the unit that it was removed from the tabbed window.
|
void |
unitUnregistered(ApplicationModel model,
java.lang.String id)
Informs the configurable unit that it was unregistered with a model.
|
protected void |
updateComps()
Updates the option components based on the selected file type.
|
protected void |
updateOpenEditOptions()
Updates the open/edit options for the selected file type.
|
protected void |
updatePatternOptions()
Updates the pattern options for the selected file type.
|
void |
valueChanged(javax.swing.event.ListSelectionEvent event)
Called whenever the table selection changes.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
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, transferFocusDownCycle, validate, validateTree
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, 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
public static java.net.URL ICON_SMALL
protected java.lang.String[] typesColumns
protected java.lang.Class[] typesClasses
protected java.lang.Object[][] typesData
protected javax.swing.tree.DefaultTreeModel model
protected boolean initialized
protected java.util.Vector<java.awt.Component> matches
protected OrderedHashtable<java.lang.String,java.lang.String> allowedTypeIDs
protected java.lang.String helpID
protected void init()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void addFileType(java.lang.String id, java.lang.String name)
id
- The unique identifiername
- The textual representation to be displayed (required)java.lang.NullPointerException
- If a parameter is null
java.lang.IllegalArgumentException
- If a parameter is invalidpublic void configureUnit(java.lang.String id, Configuration config)
configureUnit
in interface ConfigurableUnit
id
- The unique identifier for the instanceconfig
- The configurationpublic void storeUnit(java.lang.String id, Configuration config)
storeUnit
in interface ConfigurableUnit
id
- The unique identifier for the instanceconfig
- The configurationpublic static void storeDefaultValues(java.lang.String id, Configuration config, boolean onthefly, OrderedHashtable<java.lang.String,FileTypeDef> defaults)
id
- The unique identifier for the instanceconfig
- The configurationonthefly
- Default for regex check boxdefaults
- Key: type identifier, value: file type definitionjava.lang.NullPointerException
- If a parameter is null
java.lang.IllegalArgumentException
- If a parameter is invalidpublic static void storeOverrideValues(java.lang.String id, Configuration config, OrderedHashtable<java.lang.String,FileTypeDef> defaults)
id
- The unique identifier for the instanceconfig
- The configurationdefaults
- Key: type identifier, value: file type definitionjava.lang.NullPointerException
- If a parameter is null
java.lang.IllegalArgumentException
- If a parameter is invalidpublic void unitRegistered(ApplicationModel model, java.lang.String id)
unitRegistered
in interface ConfigurableUnit
model
- The application modelid
- The unique identifier for the instancepublic void unitUnregistered(ApplicationModel model, java.lang.String id)
unitUnregistered
in interface ConfigurableUnit
model
- The application modelid
- The unique identifier for the instanceprotected void updateComps()
protected void updatePatternOptions()
protected boolean checkPattern(java.lang.String pattern)
pattern
- The pattern to be checked, text filed contents if null
protected void updateOpenEditOptions()
public void setSelectedFileType(java.lang.String id)
id
- The file type identifierjava.lang.NullPointerException
- If a parameter is null
java.lang.IllegalArgumentException
- If a parameter is invalidprotected int getRowIndex(java.lang.String id)
id
- The file type identifierpublic int getFileTypeCount()
public java.lang.String getText()
OptionsDialog
.
getText
in interface OptionsUnit
public javax.swing.ImageIcon getBigIcon()
getBigIcon
in interface OptionsUnit
public javax.swing.ImageIcon getSmallIcon()
getSmallIcon
in interface OptionsUnit
public java.lang.String getTitle()
OptionsDialog
.
getTitle
in interface OptionsUnit
public java.awt.Component getComponent()
getComponent
in interface OptionsUnit
null
indicates folder functionalitypublic int find(java.lang.String pattern)
find
in interface OptionsUnit
pattern
- The search patternpublic void resetSearch(java.lang.String pattern)
resetSearch
in interface OptionsUnit
pattern
- The search patternpublic boolean isModified()
isModified
in interface OptionsUnit
public boolean isInputValid()
isInputValid
in interface OptionsUnit
public void unitAdded(OptionsDialog parent, java.lang.String id)
unitAdded
in interface OptionsUnit
parent
- The dialogid
- The unique IDpublic void unitRemoved(OptionsDialog parent, java.lang.String id)
unitRemoved
in interface OptionsUnit
parent
- The dialogid
- The unique IDpublic void unitBecomesShown()
unitBecomesShown
in interface OptionsUnit
public void unitBecomesHidden()
unitBecomesHidden
in interface OptionsUnit
public void unitIsShowing()
unitIsShowing
in interface OptionsUnit
public void unitIsHiding()
unitIsHiding
in interface OptionsUnit
public static SuffixFilter getSuffixFilter(Configuration config, java.lang.String id, java.lang.String filterid, java.lang.String description, boolean autosuffix, java.lang.String suffixid)
config
- The application configurationid
- The unique unit identifierfilterid
- The filter identifierdescription
- The filter descriptionautosuffix
- Add the suffices automatically like [class] -> "(*.class)" ?suffixid
- Arbitrary object as unique ID for the represented file format ("png", "gif" etc.)java.lang.NullPointerException
- If a parameter is null
public javax.swing.JTable getTypesTable()
public FileTypeDef[] getFileTypes(Configuration config, java.lang.String id)
config
- The application configurationid
- The unique unit identifierjava.lang.NullPointerException
- If a parameter is null
public java.lang.String getFileTypeName(FileTypeDef typedef, java.lang.String fallback)
typedef
- The file type definitionfallback
- The default value (optional)java.lang.NullPointerException
- If a parameter is null
public void setHelpID(java.lang.String helpid)
helpid
- The help system linkpublic void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed
in interface java.awt.event.ActionListener
event
- The event objectpublic void valueChanged(javax.swing.event.ListSelectionEvent event)
valueChanged
in interface javax.swing.event.ListSelectionListener
event
- The event objectpublic void changedUpdate(javax.swing.event.DocumentEvent event)
changedUpdate
in interface javax.swing.event.DocumentListener
event
- The event objectpublic void insertUpdate(javax.swing.event.DocumentEvent event)
insertUpdate
in interface javax.swing.event.DocumentListener
event
- The event objectpublic void removeUpdate(javax.swing.event.DocumentEvent event)
removeUpdate
in interface javax.swing.event.DocumentListener
event
- The event objectCopyright © 2005-2013 Leisenfels UG (haftungsbeschränkt). All rights reserved.