public class ImageEditor extends javax.swing.JPanel implements Editor, ConfigurableUnit, ActionDelegate
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected SharedAction[] |
actions
Remembers the shared action components (optional).
|
protected javax.swing.JPanel |
buttonBar |
protected java.lang.String |
configID
The ID used to store this unit (optional).
|
protected boolean |
contentOK
May the content be used normally?
|
protected AbstractDataSource |
currentContent
The represented content.
|
protected SuffixFilter |
defaultFilter
The default filter (optional)
|
protected java.util.Vector<EditorListener> |
editorListeners
Container holding the external editor listeners.
|
protected SuffixFilter[] |
filters
The suffix filters.
|
protected java.awt.image.BufferedImage |
image
The image data to be printed or whatever.
|
protected java.lang.String |
imageFormat
The image format identifier like "png" used for writing.
|
protected ApplicationModel |
model
The cache used to store this unit (optional).
|
protected boolean |
modified
Has the resource been edited by the user?
|
protected boolean |
readonly
May the resource be edited?
|
protected javax.swing.JScrollPane |
scrollPaneProperties |
protected StatusBar |
statusBar |
protected StatusBar |
statusBarExternal
The optional external status bar to use.
|
protected java.lang.String[] |
supportedActions
Array with supported shared actions.
|
protected CommonsSwingWorker |
worker
Thread construct to load/save data.
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
ImageEditor()
Constructor of this form.
|
Modifier and Type | Method and Description |
---|---|
void |
addEditorListener(EditorListener listener)
Installs a new editor listener.
|
boolean |
canProcess(AbstractDataSource content)
May the given data be processed by this editor?
|
void |
configureUnit(java.lang.String id,
Configuration config)
Restores values from persistent data stores.
|
boolean |
doActionSaveAs(AbstractDataSource content,
StatusBar statusbar,
java.awt.Component parent,
SuffixFilter[] filters,
boolean allfilter,
SuffixFilter defaultfilter,
java.util.Vector<java.io.File> target)
Saves the resource with new name (template method).
|
boolean |
doActionSaveAsURL(AbstractDataSource content,
StatusBar statusbar,
java.awt.Component parent,
SuffixFilter[] filters,
boolean allfilter,
SuffixFilter defaultfilter,
java.util.Vector<org.apache.commons.vfs2.FileObject> target,
java.util.Vector<VFSConnection> connections,
VFSConnection vfsconn,
DockingManager dockingmanager,
boolean editingallowed)
Saves the resource with new name (template method).
|
protected void |
finalize()
Clean-up method to help the gc.
|
java.awt.Component |
getComponent()
Provides the component visualizing the data source contents.
|
AbstractDataSource |
getContent()
Provides the displayed content.
|
boolean |
getContentValid()
Is the content of this editor OK?
|
SuffixFilter |
getDefaultSuffixFilter()
Provides the default extension filter to be presented on save/save as operations.
|
javax.swing.Icon |
getIcon()
Provides the graphical icon used for display.
|
java.io.InputStream |
getInputStream()
Opens a binary data stream for the current image data.
|
boolean |
getModified()
Has the resource been edited by the user?
|
boolean |
getReadOnly()
May the resource be edited?
|
protected StatusBar |
getStatusBar()
Provides the status bar component (may have been externally set).
|
SuffixFilter[] |
getSuffixFilters()
Provides the extension filters to be presented on save/save as operations.
|
java.lang.String[] |
getSupportedActions()
Provides the supported shared actions for this delegate.
|
java.lang.String |
getTitle()
Provides the title used for display.
|
java.lang.String |
getToolTip()
Provides the tooltip used for display.
|
void |
processAction(SharedAction action)
Indicates that the given action was initiated and must be processed.
|
protected CommonsSwingWorker |
processSave(int mode)
Re-used method to save data source contents back to file/URL.
|
void |
refresh()
Let the editor setup its components properly.
|
void |
removeEditorListener(EditorListener listener)
Removes an editor listener.
|
void |
resetModified()
Resets the modified state.
|
CommonsSwingWorker |
saveContent()
Let the editor write pending data persistently e.g. on application exit.
|
boolean |
saveContentAs(AbstractDataSource content,
boolean dialog,
StatusBar statusbar,
SuffixFilter[] filters,
boolean allfilter,
SuffixFilter defaultfilter)
Let the editor write pending data persistently e.g. on application exit.
|
boolean |
saveContentAsURL(AbstractDataSource content,
boolean dialog,
StatusBar statusbar,
SuffixFilter[] filters,
boolean allfilter,
SuffixFilter defaultfilter,
java.util.Vector<VFSConnection> connections,
VFSConnection vfsconn,
DockingManager dockingmanager,
boolean editingallowed)
Let the editor write pending data persistently e.g. on application exit.
|
CommonsSwingWorker |
setContent(AbstractDataSource content,
boolean load)
Sets the displayed content.
|
void |
setReadOnly(boolean enable)
Resets the read-only state.
|
void |
setStatusBar(StatusBar statusbar)
Equips the component with an external status bar to be shared.
|
void |
setSuffixFilters(SuffixFilter[] filters,
SuffixFilter defaultfilter)
Sets the extension filters to be presented on save/save as operations.
|
void |
startControl(SharedAction[] actions)
Provides the info that the given shared actions must now be controlled.
|
void |
stopControl()
Provides the info that the control of the given shared actions must be stopped.
|
void |
storeUnit(java.lang.String id,
Configuration config)
Stores the current configuration values persistently.
|
void |
unitRegistered(ApplicationModel model,
java.lang.String id)
Informs the configurable unit that it was registered with a model.
|
void |
unitUnregistered(ApplicationModel model,
java.lang.String id)
Informs the configurable unit that it was unregistered with a model.
|
protected void |
updateComps()
Sets the component states.
|
void |
updateFormat()
Updates the image format.
|
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
protected AbstractDataSource currentContent
protected boolean contentOK
protected java.awt.image.BufferedImage image
protected java.lang.String imageFormat
protected StatusBar statusBarExternal
protected java.lang.String configID
protected ApplicationModel model
protected boolean modified
protected boolean readonly
protected java.lang.String[] supportedActions
protected SharedAction[] actions
protected SuffixFilter[] filters
protected SuffixFilter defaultFilter
protected java.util.Vector<EditorListener> editorListeners
protected CommonsSwingWorker worker
protected javax.swing.JScrollPane scrollPaneProperties
protected javax.swing.JPanel buttonBar
protected StatusBar statusBar
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public CommonsSwingWorker setContent(AbstractDataSource content, boolean load)
getContentValid
.
setContent
in interface Editor
content
- The data sourceload
- Load via input stream?null
java.lang.NullPointerException
- If parameter is null
java.lang.IllegalArgumentException
- If parameter is invalidpublic void updateFormat()
public boolean getContentValid()
getContentValid
in interface Editor
public AbstractDataSource getContent()
getContent
in interface Editor
null
public java.io.InputStream getInputStream()
getInputStream
in interface Editor
null
indicates errorpublic java.awt.Component getComponent()
getComponent
in interface Editor
public void setStatusBar(StatusBar statusbar)
setStatusBar
in interface Editor
statusbar
- The status barjava.lang.NullPointerException
- If a parameter is null
protected StatusBar getStatusBar()
public 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 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 instancepublic boolean getModified()
getModified
in interface Editor
public void resetModified()
resetModified
in interface Editor
public boolean getReadOnly()
getReadOnly
in interface Editor
public void setReadOnly(boolean enable)
setReadOnly
in interface Editor
enable
- Read-only?public java.lang.String getTitle()
public java.lang.String getToolTip()
getToolTip
in interface Editor
public javax.swing.Icon getIcon()
public void setSuffixFilters(SuffixFilter[] filters, SuffixFilter defaultfilter)
setSuffixFilters
in interface Editor
filters
- The suffix filtersdefaultfilter
- The default filter (optional)public SuffixFilter[] getSuffixFilters()
getSuffixFilters
in interface Editor
public SuffixFilter getDefaultSuffixFilter()
getDefaultSuffixFilter
in interface Editor
public java.lang.String[] getSupportedActions()
getSupportedActions
in interface ActionDelegate
public void startControl(SharedAction[] actions)
startControl
in interface ActionDelegate
actions
- The actions to care forpublic void processAction(SharedAction action)
processAction
in interface ActionDelegate
action
- The action to be processedpublic void stopControl()
stopControl
in interface ActionDelegate
protected CommonsSwingWorker processSave(int mode)
mode
- The mode HEXEditor.MODE_SAVE
|...null
protected void updateComps()
public void refresh()
public CommonsSwingWorker saveContent()
getContentValid
.
saveContent
in interface Editor
null
public boolean canProcess(AbstractDataSource content)
canProcess
in interface Editor
content
- The contentpublic boolean saveContentAs(AbstractDataSource content, boolean dialog, StatusBar statusbar, SuffixFilter[] filters, boolean allfilter, SuffixFilter defaultfilter)
content
- The data sourcedialog
- Show error dialog?statusbar
- The message component (optional)filters
- The suffix filters (optional)allfilter
- Add the default filter *.*?defaultfilter
- Default filter to select initially (optional)public boolean doActionSaveAs(AbstractDataSource content, StatusBar statusbar, java.awt.Component parent, SuffixFilter[] filters, boolean allfilter, SuffixFilter defaultfilter, java.util.Vector<java.io.File> target)
content
- The data sourcestatusbar
- The message component (optional)parent
- The parental component for dialogfilters
- The suffix filters (optional)allfilter
- Add the default filter *.*?defaultfilter
- Default filter to select initially (optional)target
- Data holder for target file, empty on cancelpublic boolean saveContentAsURL(AbstractDataSource content, boolean dialog, StatusBar statusbar, SuffixFilter[] filters, boolean allfilter, SuffixFilter defaultfilter, java.util.Vector<VFSConnection> connections, VFSConnection vfsconn, DockingManager dockingmanager, boolean editingallowed)
content
- The data sourcedialog
- Show error dialog?statusbar
- The message component (optional)filters
- The suffix filters (optional)allfilter
- Add the default filter *.*?defaultfilter
- Default filter to select initially (optional)connections
- The VFS connections to present with combo boxvfsconn
- The selected connection (optional)dockingmanager
- The docking manager (optional)editingallowed
- Connection management?public boolean doActionSaveAsURL(AbstractDataSource content, StatusBar statusbar, java.awt.Component parent, SuffixFilter[] filters, boolean allfilter, SuffixFilter defaultfilter, java.util.Vector<org.apache.commons.vfs2.FileObject> target, java.util.Vector<VFSConnection> connections, VFSConnection vfsconn, DockingManager dockingmanager, boolean editingallowed)
content
- The data sourcestatusbar
- The message component (optional)parent
- The parental component for dialogfilters
- The suffix filters (optional)allfilter
- Add the default filter *.*?defaultfilter
- Default filter to select initially (optional)target
- Data holder for target file, empty on cancelconnections
- The VFS connections to present with combo boxvfsconn
- The selected connection (optional)dockingmanager
- The docking manager (optional)editingallowed
- Connection management?public void addEditorListener(EditorListener listener)
addEditorListener
in interface Editor
listener
- The listenerjava.lang.NullPointerException
- If a parameter is null
public void removeEditorListener(EditorListener listener)
removeEditorListener
in interface Editor
listener
- The listenerjava.lang.NullPointerException
- If a parameter is null
Copyright © 2005-2013 Leisenfels UG (haftungsbeschränkt). All rights reserved.