public abstract class FileThumb extends ButtonGuiImpl
Modifier and Type | Field and Description |
---|---|
protected java.nio.file.attribute.FileTime |
created
Cached file/folder creation timestamp.
|
private boolean |
doubleClick
Flag for a double-click event.
|
private java.lang.String |
doubleClickCommand
The action to be performed when the thumbnail is double clicked.
|
protected long |
fileSize
Cached file/folder size.
|
protected ImageWrapper<java.awt.image.BufferedImage> |
img
The icon to be displayed.
|
private boolean |
isDir
Flags the thumbnails that represents directories.
|
protected java.nio.file.attribute.FileTime |
lastModified
Cached last modified timestamp.
|
private java.nio.file.Path |
path
The path this thumbnail represents.
|
private static FileThumb |
selected
The currently selected thumbnail.
|
cc, DOT_LINE_WIDTH, gd, gf
config, widgetFocused
insets, location, LOG, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
FileThumb(WidgetId id,
ButtonConfig cfg,
java.nio.file.Path path,
java.lang.String image,
boolean isDir,
java.lang.String click2Command)
Constructor used to create component using given configuration.
|
Modifier and Type | Method and Description |
---|---|
static void |
clearSelection()
Clears the selection flag.
|
void |
draw()
Draw the thumbnail.
|
protected abstract void |
drawForeground(int width,
int height,
Theme theme)
Draws the text and icon on this thumbnail.
|
(package private) java.lang.String |
getDoubleClickCommand()
Retrieves the action to be performed when the thumbnail is double clicked.
|
protected abstract NativeDimension |
getEditorDimension()
Obtain the dimension of the editor that when renaming this thumbnail.
|
protected abstract NativePoint |
getEditorLocation()
Obtain the physical location of the editor that when renaming this thumbnail.
|
ImageWrapper<java.awt.image.BufferedImage> |
getFileIcon()
Obtain the file icon, if set.
|
java.nio.file.Path |
getPath()
Obtain the path this thumbnail represents.
|
int |
getPreferredHeight()
Query the preferred height of this thumbnail.
|
int |
getPreferredWidth()
Query the preferred width of this thumbnail.
|
static FileThumb |
getSelected()
Query the currently selected thumbnail.
|
(package private) java.lang.String |
getTooltip()
Obtain the tooltip to be displayed when hovering this thumbnail.
|
protected void |
handleBasicEvents(KeyInput event)
Process basic events - key navigation event.
|
boolean |
isDir()
Checks whether this thumbnail represents a directory.
|
(package private) boolean |
isDoubleClick()
Check whether the mouse was double-clicked on this thumbnail.
|
boolean |
isSelected()
Checks if this thumbnail is selected.
|
void |
mouseClicked(java.awt.event.MouseEvent e)
Notification of a mouse clicked event occurred for this widget.
|
static void |
select(FileThumb ft)
Sets the selected thumb.
|
(package private) void |
setFileInfo(long fileSize,
java.nio.file.attribute.FileTime created,
java.nio.file.attribute.FileTime lastModified)
Sets information of the file that this thumbnail represents.
|
static void |
startRename(LineEditor rename)
Enter the rename mode for active thumbnail.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
afterConfigUpdate, createMnemonic, focusTraversable, getImgDisabled, getImgDown, getImgUp, handleCursorKeys, hasImages, hasPrepackagedImages, height, highlighted, initialize, isAutoResize, isDefaultButton, isDroppable, isFocusable, isMnemonicSupported, isPressed, loadImage, onFocusLost, physicalBounds, processMnemonic, refresh, requestFocus, setActionCode, setImage, supportsCustomMousePointer, updateSize, updateSizeWorker, width
isMouseOver, mouseActions, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased
addListener, checkKey, config, destroy, getColon, getColumnLabelText, getCommand, getLabelInstance, getLabelText, getMnemonic, getTo, initButtonText, isForceLabel, isNoLabels, isRightAligned, postprocessConfig, processEvent, processKeyEvent, setCommand, setHidden, setLabelInstance, setMnemonic, setNoLabels, setSupportsMnemonic, setText, setTextLabel, setVisible, setWasVisible, textLabel, wasVisible
dimension, forceCursorOnFocus, getDefaultEvent, ignoreAction, manageSystemActions, minimumSize, onFocusGained, onKeyPressed, onKeyTyped, processKeyEventCommon
_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, copyState, createMouseHoverAction, deactivateDirectManipulation, debug, disable, displayPhysicalLocation, drawCaret, enable, enclosingFrame, findMouseSource, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, insets, isCurrent, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isHeader, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, mouseWheelMoved, moveToBottom, moveToTop, name, navigable, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalDimension, physicalLocation, prepParentLocation, processDirectManipulationEvent, processFocusEvent, processKeyListeners, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, reflectAncestorChange, reflectLocationChange, refresh, registerWidgetStateListener, repaint, repaint, requestFocus, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setEnabled, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, show, showPopupMenu, sync, topLevelWindow, translate, unrealize, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addFocusListener, addKeyListener, ancestor, ancestorId, bounds, clearWidget, defaultMousePtr, dimension, displayPhysicalLocation, drawCaret, enclosingFrame, enforceDefaultMousePtr, findMouseSource, forceCursorOnFocus, forceVisibility, getActualBounds, getCustomMousePointer, getEffectiveMousePointer, getId, getLegacyWidget, getLoadedMousePointer, getMenuMouse, getMouseActions, getSelectedText, getState, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, insets, isCurrent, isDirectManipulable, isDisplayed, isEnabled, isHeader, isRealized, isRepaintDisabled, isRMBEntrySupported, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, maySwitchFocus, minimumSize, moveToBottom, moveToTop, name, navigable, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalDimension, physicalLocation, processDirectManipulationEvent, processFocusEvent, processKeyListeners, raiseLegacyMouseEvents, repaint, repaint, requestFocus, requestSync, resizeTo, resolvePopupMenuId, screen, screenLocation, screenPhysicalLocation, setEnabled, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, show, topLevelWindow, unrealize, window
getColumnMnemonic, getMnemonicCharacter, getMnemonicKeyCode, getMnemonicLabel, setColumnMnemonic, updateMnemonic
protected final ImageWrapper<java.awt.image.BufferedImage> img
protected long fileSize
protected java.nio.file.attribute.FileTime created
protected java.nio.file.attribute.FileTime lastModified
private final java.lang.String doubleClickCommand
private boolean doubleClick
private final boolean isDir
private final java.nio.file.Path path
private static FileThumb selected
FileThumb(WidgetId id, ButtonConfig cfg, java.nio.file.Path path, java.lang.String image, boolean isDir, java.lang.String click2Command)
id
- The widget's ID.cfg
- The widget's configuration.path
- The path this thumbnail represents.image
- The image to be displayed on the thumbnail.isDir
- Flags the thumbnails that represents directories.click2Command
- The action to be performed when the thumbnail is double clicked.public int getPreferredWidth()
public int getPreferredHeight()
public java.nio.file.Path getPath()
public void mouseClicked(java.awt.event.MouseEvent e)
doubleClick
if double click is
detected.mouseClicked
in interface java.awt.event.MouseListener
mouseClicked
in class ButtonGuiImpl
e
- The mouse event.public void draw()
drawForeground
for drawing the text/icon on the thumbnail.draw
in interface Widget<GuiOutputManager>
draw
in class ButtonGuiImpl
protected abstract void drawForeground(int width, int height, Theme theme)
width
- The width of the widgetheight
- The height of the widget.theme
- The current theme.public boolean isSelected()
true
if this thumbnail is selected.public static void clearSelection()
public static FileThumb getSelected()
public boolean isDir()
true
if this thumbnail represents a directory.public ImageWrapper<java.awt.image.BufferedImage> getFileIcon()
public static void select(FileThumb ft)
ft
- The new FileThumb
to select. May be null
to unselect.java.lang.String getDoubleClickCommand()
Note: this resets the doubleClick
flag, so a subsequent call will return the simple
click command.
boolean isDoubleClick()
true
if the mouse was double-clicked.void setFileInfo(long fileSize, java.nio.file.attribute.FileTime created, java.nio.file.attribute.FileTime lastModified)
fileSize
- The file size.created
- Creation timestamp.lastModified
- The timestamp of last modification of the file.protected void handleBasicEvents(KeyInput event)
handleBasicEvents
in class ButtonGuiImpl
event
- Key event to process.public java.lang.String toString()
toString
in class ButtonGuiImpl
java.lang.String getTooltip()
public static void startRename(LineEditor rename)
rename
- The line editor that will be used for renaming.protected abstract NativeDimension getEditorDimension()
protected abstract NativePoint getEditorLocation()