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.FileHOME_DIRECTORY
-
Constructor Summary
Constructors Constructor Description TerraFileBrowserSkin()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisabledFileFilterChanged(FileBrowser fileBrowser, Filter<java.io.File> previousDisabledFileFilter)Called when a file browser's file filter has changed.java.io.FilegetFileAt(int x, int y)Get the file selection at the given X/Y coordinates.static TerraFileBrowserSkin.FileComparatorgetFileComparator(java.lang.String columnName, SortDirection sortDirection)intgetPreferredHeight(int width)Returns the visual's preferred height given the provided width constraint.DimensionsgetPreferredSize()Returns the visual's unconstrained preferred size.intgetPreferredWidth(int height)Returns the visual's preferred width given the provided height constraint.voidinstall(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.booleanisHideDisabledFiles()booleanisKeyboardFolderTraversalEnabled()booleanisShowHiddenFiles()booleankeyPressed(Component component, int keyCode, Keyboard.KeyLocation keyLocation)ENTERChange into the selected directory ifkeyboardFolderTraversalEnabledis true.
DELETEorBACKSPACEChange into the parent of the current directory.
F5Refresh the file list.booleankeyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation)CommandModifier +FTransfers focus to the search TextInput.voidlayout()If the component on which the skin is installed is a container, lays out the container's children.voidmultiSelectChanged(FileBrowser fileBrowser)Called when a file browser's multi-select flag has changed.voidrootDirectoryChanged(FileBrowser fileBrowser, java.io.File previousRootDirectory)Called when a file browser's root directory has changed.voidselectedFileAdded(FileBrowser fileBrowser, java.io.File file)Called when a file has been added to a file browser's selection.voidselectedFileRemoved(FileBrowser fileBrowser, java.io.File file)Called when a file has been removed from a file browser's selection.voidselectedFilesChanged(FileBrowser fileBrowser, Sequence<java.io.File> previousSelectedFiles)Called when a file browser's selection state has been reset.voidsetHideDisabledFiles(boolean hideDisabledFiles)voidsetKeyboardFolderTraversalEnabled(boolean keyboardFolderTraversalEnabled)voidsetShowHiddenFiles(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:ComponentSkinMust 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:
installin interfaceSkin- Overrides:
installin classFileBrowserSkin- Parameters:
component- The component to which the skin is being attached.
-
getPreferredWidth
public int getPreferredWidth(int height)
Description copied from interface:ConstrainedVisualReturns the visual's preferred width given the provided height constraint.- Specified by:
getPreferredWidthin interfaceConstrainedVisual- Overrides:
getPreferredWidthin classContainerSkin- Parameters:
height- The height by which to constrain the preferred width, or-1for no constraint.- Returns:
- The preferred width given the height constraint.
-
getPreferredHeight
public int getPreferredHeight(int width)
Description copied from interface:ConstrainedVisualReturns the visual's preferred height given the provided width constraint.- Specified by:
getPreferredHeightin interfaceConstrainedVisual- Overrides:
getPreferredHeightin classContainerSkin- Parameters:
width- The width by which to constrain the preferred height, or-1for no constraint.- Returns:
- The preferred height given the width constraint.
-
getPreferredSize
public Dimensions getPreferredSize()
Description copied from interface:ConstrainedVisualReturns the visual's unconstrained preferred size.- Specified by:
getPreferredSizein interfaceConstrainedVisual- Overrides:
getPreferredSizein 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:SkinIf 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.SkinGet 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)
ENTERChange into the selected directory ifkeyboardFolderTraversalEnabledis true.
DELETEorBACKSPACEChange into the parent of the current directory.
F5Refresh the file list.- Specified by:
keyPressedin interfaceComponentKeyListener- Overrides:
keyPressedin 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:
trueto consume the event;falseto allow it to propagate.
-
keyReleased
public boolean keyReleased(Component component, int keyCode, Keyboard.KeyLocation keyLocation)
CommandModifier +FTransfers focus to the search TextInput.- Specified by:
keyReleasedin interfaceComponentKeyListener- Overrides:
keyReleasedin 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:
trueto consume the event;falseto allow it to propagate.- See Also:
Platform.getCommandModifier()
-
rootDirectoryChanged
public void rootDirectoryChanged(FileBrowser fileBrowser, java.io.File previousRootDirectory)
Description copied from interface:FileBrowserListenerCalled 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:FileBrowserListenerCalled 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:FileBrowserListenerCalled 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:FileBrowserListenerCalled 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:FileBrowserListenerCalled 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:FileBrowserListenerCalled when a file browser's file filter has changed.- Parameters:
fileBrowser- The file browser that has changed.previousDisabledFileFilter- The previous disabled file filter.
-
-