You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2016/08/12 20:47:05 UTC
svn commit: r1756227 - in /pivot/branches/2.0.x: ./
wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java
wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java
Author: rwhitcomb
Date: Fri Aug 12 20:47:04 2016
New Revision: 1756227
URL: http://svn.apache.org/viewvc?rev=1756227&view=rev
Log:
PIVOT-986: Provide a property for the FileBrowser and VFSBrowser classes
to allow viewing of hidden files.
There is already a STYLE in the skins of these classes that is nicely
analogous, so make a new style in the skins called "showHiddenFiles",
provide getter and setter methods and then "do the math" inside the
skins to take out the HIDDEN_FILE_FILTER if this flag is set, while
still using it when the flag is false.
Provide a sort-of pass-through style in the SheetSkins to set the
style in the component skin (for convenience). Again this is based
on the way the "hideDisabledFiles" style works (exactly).
That's it, really. Except add a simple test program in VFSBrowserTest
(for the VFSBrowser, obviously) to prove that the code works. I need
to find a similar suitable place to test the regular FileBrowser case,
though, which will be a separate submission.
The FileBrowser parts of this change will be crossed to the 2.0.x
branch in due course.
Merging the FileBrowser parts of r1735181 to branches/2.0.x from trunk.
Modified:
pivot/branches/2.0.x/ (props changed)
pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java
pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java
Propchange: pivot/branches/2.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 12 20:47:04 2016
@@ -1 +1 @@
-/pivot/trunk:1346574,1347051,1394847,1394858,1398511,1399331,1401781,1405882,1407585,1409081,1410536,1410555,1417081,1417258,1428056,1428650,1435351,1436707,1438126,1438659,1444260,1444910,1502657,1510821,1516518,1519859,1522078,1523205,1523736,1523776,1525982,1526005,1536829,1537222,1604238,1610563,1611829,1614462,1624381,1675204,1675517,1678238,1678251,1687873-1687874,1688306,1688484,1688523,1691618,1712175,1717360,1727931,1728247,1729480,1729493,1730100,1730108,1740570,1747445,1750549
+/pivot/trunk:1346574,1347051,1394847,1394858,1398511,1399331,1401781,1405882,1407585,1409081,1410536,1410555,1417081,1417258,1428056,1428650,1435351,1436707,1438126,1438659,1444260,1444910,1502657,1510821,1516518,1519859,1522078,1523205,1523736,1523776,1525982,1526005,1536829,1537222,1604238,1610563,1611829,1614462,1624381,1675204,1675517,1678238,1678251,1687873-1687874,1688306,1688484,1688523,1691618,1712175,1717360,1727931,1728247,1729480,1729493,1730100,1730108,1735181,1740570,1747445,1750549
Modified: pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java?rev=1756227&r1=1756226&r2=1756227&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java (original)
+++ pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java Fri Aug 12 20:47:04 2016
@@ -236,6 +236,14 @@ public class TerraFileBrowserSheetSkin e
fileBrowser.getStyles().put("hideDisabledFiles", hideDisabledFiles);
}
+ public boolean isShowHiddenFiles() {
+ return (Boolean) fileBrowser.getStyles().get("showHiddenFiles");
+ }
+
+ public void setShowHiddenFiles(boolean showHiddenFiles) {
+ fileBrowser.getStyles().put("showHiddenFiles", showHiddenFiles);
+ }
+
public boolean getShowOKButtonFirst() {
Container parent = okButton.getParent();
return parent.indexOf(okButton) < parent.indexOf(cancelButton);
Modified: pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java?rev=1756227&r1=1756226&r2=1756227&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java (original)
+++ pivot/branches/2.0.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java Fri Aug 12 20:47:04 2016
@@ -602,17 +602,19 @@ public class TerraFileBrowserSkin extend
}
public static class FullFileFilter implements FileFilter {
+ private FileFilter hiddenFileFilter;
private Filter<File> includeFileFilter;
private Filter<File> excludeFileFilter;
- public FullFileFilter(Filter<File> includeFileFilter, Filter<File> excludeFileFilter) {
+ public FullFileFilter(boolean showHiddenFiles, Filter<File> includeFileFilter, Filter<File> excludeFileFilter) {
+ this.hiddenFileFilter = showHiddenFiles ? null : HIDDEN_FILE_FILTER;
this.includeFileFilter = includeFileFilter;
this.excludeFileFilter = excludeFileFilter;
}
@Override
public boolean accept(File file) {
- boolean include = HIDDEN_FILE_FILTER.accept(file);
+ boolean include = hiddenFileFilter == null ? true : hiddenFileFilter.accept(file);
if (include
&& includeFileFilter != null) {
include = includeFileFilter.include(file);
@@ -646,7 +648,8 @@ public class TerraFileBrowserSkin extend
throw new AbortException();
}
- File[] files = rootDirectory.listFiles(new FullFileFilter(includeFileFilter, excludeFileFilter));
+ File[] files = rootDirectory.listFiles(new FullFileFilter(showHiddenFiles,
+ includeFileFilter, excludeFileFilter));
if (abort) {
throw new AbortException();
}
@@ -674,6 +677,7 @@ public class TerraFileBrowserSkin extend
private boolean keyboardFolderTraversalEnabled = true;
private boolean hideDisabledFiles = false;
+ private boolean showHiddenFiles = false;
private boolean updatingSelection = false;
private boolean refreshRoots = true;
@@ -1028,6 +1032,22 @@ public class TerraFileBrowserSkin extend
refreshFileList();
}
+ /**
+ * @return Whether hidden files will be shown in the browser.
+ */
+ public boolean isShowHiddenFiles() {
+ return showHiddenFiles;
+ }
+
+ /**
+ * Set to determine if hidden files should be shown.
+ * @param showHiddenFiles Whether to show hidden files.
+ */
+ public void setShowHiddenFiles(boolean showHiddenFiles) {
+ this.showHiddenFiles = showHiddenFiles;
+ refreshFileList();
+ }
+
/**
* {@link KeyCode#ENTER ENTER} Change into the selected directory if
* {@link #keyboardFolderTraversalEnabled} is true.<br>