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 21:00:59 UTC

svn commit: r1756228 - in /pivot/branches/2.0.x: ./ tests/src/org/apache/pivot/tests/FileBrowserWithCharsetTest.java wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java

Author: rwhitcomb
Date: Fri Aug 12 21:00:59 2016
New Revision: 1756228

URL: http://svn.apache.org/viewvc?rev=1756228&view=rev
Log:
PIVOT-986:  When viewing hidden files in one of the browsers, dim
the icon and the file name so it is clear that the file/directory
is hidden.

Put a "Show hidden files" checkbox into the FileBrowserWithCharsetTest
program so we can test this functionality in the regular file
browser as well as the VFS Browser tested earlier.

Merging FileBrowser parts of r1735282 from trunk to branches/2.0.x.

Modified:
    pivot/branches/2.0.x/   (props changed)
    pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/FileBrowserWithCharsetTest.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 21:00:59 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,1735181,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,1735282,1740570,1747445,1750549

Modified: pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/FileBrowserWithCharsetTest.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/FileBrowserWithCharsetTest.java?rev=1756228&r1=1756227&r2=1756228&view=diff
==============================================================================
--- pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/FileBrowserWithCharsetTest.java (original)
+++ pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/FileBrowserWithCharsetTest.java Fri Aug 12 21:00:59 2016
@@ -27,6 +27,7 @@ import org.apache.pivot.wtk.Application;
 import org.apache.pivot.wtk.BoxPane;
 import org.apache.pivot.wtk.Button;
 import org.apache.pivot.wtk.ButtonPressListener;
+import org.apache.pivot.wtk.Checkbox;
 import org.apache.pivot.wtk.DesktopApplicationContext;
 import org.apache.pivot.wtk.Display;
 import org.apache.pivot.wtk.FileBrowserSheet;
@@ -82,12 +83,15 @@ public class FileBrowserWithCharsetTest
     public void startup(Display display, Map<String, String> properties) throws Exception
     {
         BoxPane windowContent = new BoxPane();
+        final Checkbox showHiddenCheckbox = new Checkbox("Show hidden files");
+        windowContent.add(showHiddenCheckbox);
         PushButton button = new PushButton("Open Sheet");
         button.getButtonPressListeners().add(new ButtonPressListener() {
             @Override
             public void buttonPressed(Button buttonArgument) {
                 final Window window = Window.getActiveWindow();
                 final FileBrowserSheet fileBrowserSheet = new FileBrowserWithCharsetTest(FileBrowserSheet.Mode.OPEN);
+                fileBrowserSheet.getStyles().put("showHiddenFiles", showHiddenCheckbox.isSelected());
 
                 fileBrowserSheet.open(window, new SheetCloseListener() {
                     @Override

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=1756228&r1=1756227&r2=1756228&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 21:00:59 2016
@@ -161,10 +161,11 @@ public class TerraFileBrowserSkin extend
         public void render(Object data, Button button, boolean highlight) {
             if (data != null) {
                 File file = (File)data;
+                boolean hidden = file.getName().length() != 0 && file.isHidden();
 
                 // Update the image view
                 imageView.setImage(getIcon(file));
-                imageView.getStyles().put("opacity", button.isEnabled() ? 1.0f : 0.5f);
+                imageView.getStyles().put("opacity", button.isEnabled() && !hidden ? 1.0f : 0.5f);
 
                 // Update the label
                 String text = file.getName();
@@ -173,6 +174,15 @@ public class TerraFileBrowserSkin extend
                 }
 
                 label.setText(text);
+
+                Object color = null;
+                if (button.isEnabled() && !hidden) {
+                    color = button.getStyles().get("color");
+                } else {
+                    color = button.getStyles().get("disabledColor");
+                }
+
+                label.getStyles().put("color", color);
             }
         }
 
@@ -200,10 +210,30 @@ public class TerraFileBrowserSkin extend
         @Override
         public void render(Object item, int index, ListView listView, boolean selected,
             boolean checked, boolean highlighted, boolean disabled) {
+            boolean hidden = false;
+
             label.getStyles().put("font", listView.getStyles().get("font"));
 
+            if (item != null) {
+                File file = (File) item;
+                hidden = file.getName().length() != 0 && file.isHidden();
+
+                // Update the image view
+                imageView.setImage(getIcon(file));
+                imageView.getStyles().put("opacity",
+                    (listView.isEnabled() && !disabled && !hidden) ? 1.0f : 0.5f);
+
+                // Update the label
+                String text = file.getName();
+                if (text.length() == 0) {
+                    text = System.getProperty("file.separator");
+                }
+
+                label.setText(text);
+            }
+
             Object color = null;
-            if (listView.isEnabled() && !disabled) {
+            if (listView.isEnabled() && !disabled && !hidden) {
                 if (selected) {
                     if (listView.isFocused()) {
                         color = listView.getStyles().get("selectionColor");
@@ -218,23 +248,6 @@ public class TerraFileBrowserSkin extend
             }
 
             label.getStyles().put("color", color);
-
-            if (item != null) {
-                File file = (File)item;
-
-                // Update the image view
-                imageView.setImage(getIcon(file));
-                imageView.getStyles().put("opacity",
-                    (listView.isEnabled() && !disabled) ? 1.0f : 0.5f);
-
-                // Update the label
-                String text = file.getName();
-                if (text.length() == 0) {
-                    text = System.getProperty("file.separator");
-                }
-
-                label.setText(text);
-            }
         }
 
         @Override
@@ -267,8 +280,11 @@ public class TerraFileBrowserSkin extend
         public void render(Object row, int rowIndex, int columnIndex,
             TableView tableView, String columnName,
             boolean selected, boolean highlighted, boolean disabled) {
+            boolean hidden = false;
+
             if (row != null) {
                 File file = (File)row;
+                hidden = file.getName().length() != 0 && file.isHidden();
 
                 String text = null;
                 Image icon = null;
@@ -294,13 +310,15 @@ public class TerraFileBrowserSkin extend
 
                 label.setText(text);
                 imageView.setImage(icon);
+                imageView.getStyles().put("opacity",
+                    (tableView.isEnabled() && !disabled && !hidden) ? 1.0f : 0.5f);
             }
 
             Font font = (Font)tableView.getStyles().get("font");
             label.getStyles().put("font", font);
 
             Color color;
-            if (tableView.isEnabled() && !disabled) {
+            if (tableView.isEnabled() && !disabled && !hidden) {
                 if (selected) {
                     if (tableView.isFocused()) {
                         color = (Color)tableView.getStyles().get("selectionColor");