Package org.apache.pivot.wtk.skin.terra
Class TerraFileBrowserSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.ContainerSkin
-
- org.apache.pivot.wtk.skin.FileBrowserSkin
-
- org.apache.pivot.wtk.skin.terra.TerraFileBrowserSkin
-
- All Implemented Interfaces:
ComponentKeyListener
,ComponentListener
,ComponentMouseButtonListener
,ComponentMouseListener
,ComponentMouseWheelListener
,ComponentStateListener
,ComponentTooltipListener
,ConstrainedVisual
,ContainerListener
,ContainerMouseListener
,FileBrowser.Skin
,FileBrowserListener
,Skin
,Visual
public class TerraFileBrowserSkin extends FileBrowserSkin
Terra file browser skin.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.pivot.wtk.skin.ContainerSkin
ContainerSkin.IndexFocusTraversalPolicy
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentKeyListener
ComponentKeyListener.Adapter, ComponentKeyListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentListener
ComponentListener.Adapter, ComponentListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseButtonListener
ComponentMouseButtonListener.Adapter, ComponentMouseButtonListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseListener
ComponentMouseListener.Adapter, ComponentMouseListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseWheelListener
ComponentMouseWheelListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentStateListener
ComponentStateListener.Adapter, ComponentStateListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentTooltipListener
ComponentTooltipListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerListener
ContainerListener.Adapter, ContainerListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerMouseListener
ContainerMouseListener.Adapter, ContainerMouseListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.FileBrowserListener
FileBrowserListener.Adapter, FileBrowserListener.Listeners
-
-
Field Summary
Fields Modifier and Type Field Description static java.io.File
HOME_DIRECTORY
-
Constructor Summary
Constructors Constructor Description TerraFileBrowserSkin()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disabledFileFilterChanged(FileBrowser fileBrowser, Filter<java.io.File> previousDisabledFileFilter)
Called when a file browser's file filter has changed.java.io.File
getFileAt(int x, int y)
Get the file selection at the given X/Y coordinates.static TerraFileBrowserSkin.FileComparator
getFileComparator(java.lang.String columnName, SortDirection sortDirection)
int
getPreferredHeight(int width)
Returns the visual's preferred height given the provided width constraint.Dimensions
getPreferredSize()
Returns the visual's unconstrained preferred size.int
getPreferredWidth(int height)
Returns the visual's preferred width given the provided height constraint.void
install(Component component)
Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.boolean
isHideDisabledFiles()
boolean
isKeyboardFolderTraversalEnabled()
boolean
isShowHiddenFiles()
boolean
keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
ENTER
Change into the selected directory ifkeyboardFolderTraversalEnabled
is true.
DELETE
orBACKSPACE
Change into the parent of the current directory.
F5
Refresh the file list.boolean
keyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
CommandModifier +F
Transfers focus to the search TextInput.void
layout()
If the component on which the skin is installed is a container, lays out the container's children.void
multiSelectChanged(FileBrowser fileBrowser)
Called when a file browser's multi-select flag has changed.void
rootDirectoryChanged(FileBrowser fileBrowser, java.io.File previousRootDirectory)
Called when a file browser's root directory has changed.void
selectedFileAdded(FileBrowser fileBrowser, java.io.File file)
Called when a file has been added to a file browser's selection.void
selectedFileRemoved(FileBrowser fileBrowser, java.io.File file)
Called when a file has been removed from a file browser's selection.void
selectedFilesChanged(FileBrowser fileBrowser, Sequence<java.io.File> previousSelectedFiles)
Called when a file browser's selection state has been reset.void
setHideDisabledFiles(boolean hideDisabledFiles)
void
setKeyboardFolderTraversalEnabled(boolean keyboardFolderTraversalEnabled)
void
setShowHiddenFiles(boolean showHiddenFiles)
Set to determine if hidden files should be shown.-
Methods inherited from class org.apache.pivot.wtk.skin.ContainerSkin
componentInserted, componentMoved, componentsRemoved, focusTraversalPolicyChanged, getBackgroundColor, getBackgroundPaint, isFocusable, isOpaque, mouseDown, mouseMove, mouseUp, mouseWheel, paint, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundPaint, setBackgroundPaint, setBackgroundPaint
-
Methods inherited from class org.apache.pivot.wtk.skin.ComponentSkin
colorFromObject, colorFromObject, colorFromObject, colorFromObject, currentTheme, cursorChanged, decodeFont, defaultBackgroundColor, defaultForegroundColor, dragSourceChanged, dropTargetChanged, enabledChanged, focusedChanged, fontFromObject, getBaseline, getBaseline, getColor, getComponent, getFocusRectangleStroke, getHeight, getSize, getTextInputMethodListener, getThemeFont, getWidth, heightLimitsChanged, invalidateComponent, keyTyped, locationChanged, menuHandlerChanged, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, nameChanged, parentChanged, preferredSizeChanged, repaintComponent, repaintComponent, repaintComponent, repaintComponent, repaintComponent, setDefaultStyles, setSize, sizeChanged, themeHasThickFocusRectangle, themeHasTransitionEnabled, themeIsDark, themeIsFlat, tooltipDelayChanged, tooltipTextChanged, tooltipTriggered, visibleChanged, widthLimitsChanged
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pivot.wtk.ConstrainedVisual
getBaseline, setSize, setSize
-
Methods inherited from interface org.apache.pivot.wtk.Skin
getComponent, isFocusable, isOpaque
-
-
-
-
Method Detail
-
getFileComparator
public static TerraFileBrowserSkin.FileComparator getFileComparator(java.lang.String columnName, SortDirection sortDirection)
- Parameters:
columnName
- The column name to sort on.sortDirection
- Ascending or Descending sort order.- Returns:
- A new file comparator for the given column and direction.
-
install
public void install(Component component)
Description copied from class:ComponentSkin
Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.- Specified by:
install
in interfaceSkin
- Overrides:
install
in classFileBrowserSkin
- Parameters:
component
- The component to which the skin is being attached.
-
getPreferredWidth
public int getPreferredWidth(int height)
Description copied from interface:ConstrainedVisual
Returns the visual's preferred width given the provided height constraint.- Specified by:
getPreferredWidth
in interfaceConstrainedVisual
- Overrides:
getPreferredWidth
in classContainerSkin
- Parameters:
height
- The height by which to constrain the preferred width, or-1
for no constraint.- Returns:
- The preferred width given the height constraint.
-
getPreferredHeight
public int getPreferredHeight(int width)
Description copied from interface:ConstrainedVisual
Returns the visual's preferred height given the provided width constraint.- Specified by:
getPreferredHeight
in interfaceConstrainedVisual
- Overrides:
getPreferredHeight
in classContainerSkin
- Parameters:
width
- The width by which to constrain the preferred height, or-1
for no constraint.- Returns:
- The preferred height given the width constraint.
-
getPreferredSize
public Dimensions getPreferredSize()
Description copied from interface:ConstrainedVisual
Returns the visual's unconstrained preferred size.- Specified by:
getPreferredSize
in interfaceConstrainedVisual
- Overrides:
getPreferredSize
in classComponentSkin
- Returns:
- The preferred size (width and height) of this component.
Depending on the component this can be a static value or derived (as for a container) from its subcomponents, etc.
The default implementation simply calls
ConstrainedVisual.getPreferredWidth(int)
andConstrainedVisual.getPreferredHeight(int)
.
-
layout
public void layout()
Description copied from interface:Skin
If the component on which the skin is installed is a container, lays out the container's children.
-
getFileAt
public java.io.File getFileAt(int x, int y)
Description copied from interface:FileBrowser.Skin
Get the file selection at the given X/Y coordinates.- Parameters:
x
- The mouse X-position.y
- The mouse Y-position.- Returns:
- The file displayed at the given coordinates.
-
isKeyboardFolderTraversalEnabled
public boolean isKeyboardFolderTraversalEnabled()
-
setKeyboardFolderTraversalEnabled
public void setKeyboardFolderTraversalEnabled(boolean keyboardFolderTraversalEnabled)
-
isHideDisabledFiles
public boolean isHideDisabledFiles()
-
setHideDisabledFiles
public void setHideDisabledFiles(boolean hideDisabledFiles)
-
isShowHiddenFiles
public boolean isShowHiddenFiles()
- Returns:
- Whether hidden files will be shown in the browser.
-
setShowHiddenFiles
public void setShowHiddenFiles(boolean showHiddenFiles)
Set to determine if hidden files should be shown.- Parameters:
showHiddenFiles
- Whether to show hidden files.
-
keyPressed
public boolean keyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
ENTER
Change into the selected directory ifkeyboardFolderTraversalEnabled
is true.
DELETE
orBACKSPACE
Change into the parent of the current directory.
F5
Refresh the file list.- Specified by:
keyPressed
in interfaceComponentKeyListener
- Overrides:
keyPressed
in classComponentSkin
- Parameters:
component
- Component that has the focus.keyCode
- The key code for the key that was pressed.keyLocation
- Location value for the key (left or right for shift keys, etc.).- Returns:
true
to consume the event;false
to allow it to propagate.
-
keyReleased
public boolean keyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
CommandModifier +F
Transfers focus to the search TextInput.- Specified by:
keyReleased
in interfaceComponentKeyListener
- Overrides:
keyReleased
in classComponentSkin
- Parameters:
component
- Component that has the focus, that is receiving this key event.keyCode
- Code for the key that was released.keyLocation
- Location of the key.- Returns:
true
to consume the event;false
to allow it to propagate.- See Also:
Platform.getCommandModifier()
-
rootDirectoryChanged
public void rootDirectoryChanged(FileBrowser fileBrowser, java.io.File previousRootDirectory)
Description copied from interface:FileBrowserListener
Called when a file browser's root directory has changed.- Parameters:
fileBrowser
- The file browser that has changed.previousRootDirectory
- The previous root directory of the browser.
-
selectedFileAdded
public void selectedFileAdded(FileBrowser fileBrowser, java.io.File file)
Description copied from interface:FileBrowserListener
Called when a file has been added to a file browser's selection.- Parameters:
fileBrowser
- The file browser that has changed.file
- The newly selected file.
-
selectedFileRemoved
public void selectedFileRemoved(FileBrowser fileBrowser, java.io.File file)
Description copied from interface:FileBrowserListener
Called when a file has been removed from a file browser's selection.- Parameters:
fileBrowser
- The file browser that has changed.file
- The file that was just unselected.
-
selectedFilesChanged
public void selectedFilesChanged(FileBrowser fileBrowser, Sequence<java.io.File> previousSelectedFiles)
Description copied from interface:FileBrowserListener
Called when a file browser's selection state has been reset.- Parameters:
fileBrowser
- The file browser that has changed.previousSelectedFiles
- The complete sequence of files that used to be selected.
-
multiSelectChanged
public void multiSelectChanged(FileBrowser fileBrowser)
Description copied from interface:FileBrowserListener
Called when a file browser's multi-select flag has changed.- Parameters:
fileBrowser
- The file browser that has changed.
-
disabledFileFilterChanged
public void disabledFileFilterChanged(FileBrowser fileBrowser, Filter<java.io.File> previousDisabledFileFilter)
Description copied from interface:FileBrowserListener
Called when a file browser's file filter has changed.- Parameters:
fileBrowser
- The file browser that has changed.previousDisabledFileFilter
- The previous disabled file filter.
-
-