Permalink
Browse files

No commit message

  • Loading branch information...
1 parent 013c082 commit 4b164729340aa353fd5b13afcef8f59c49eb914c @graubs committed Mar 19, 2012
Binary file not shown.
@@ -34,9 +34,14 @@ MOV=avi.png
WMV=avi.png
RMVB=avi.png
+#Markup types
+HTM=htm.png
+HTML=htm.png
+
#Compress types
ZIP=zip.png
RAR=zip.png
7Z=zip.png
-#Other types
+#Other types
+APK=apk.png
View
277 debug.log

Large diffs are not rendered by default.

Oops, something went wrong.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -4,6 +4,7 @@
*/
package br.com.gss.box4lin.components;
+import br.com.gss.box4lin.config.BoxConfigLoader;
import br.com.gss.box4lin.constants.ApplicationConstants;
import br.com.gss.box4lin.constants.FileListFields;
import br.com.gss.box4lin.controllers.BoxObjectController;
@@ -19,7 +20,7 @@
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
-import java.io.FileNotFoundException;
+import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.Stack;
@@ -55,10 +56,10 @@ public FileListView() {
previousNodes = new Stack<>();
autoResizeColumns();
}
-
- public void autoResizeColumns(){
- for(FileListFields f : FileListFields.values()){
- if(f.getId() == FileListFields.FILE_ID.getId()){ //Hide the ID Column
+
+ public void autoResizeColumns() {
+ for (FileListFields f : FileListFields.values()) {
+ if (f.getId() == FileListFields.FILE_ID.getId()) { //Hide the ID Column
getColumn(getColumnName(f.getId())).setMaxWidth(f.getMaximumSize());
}
getColumn(getColumnName(f.getId())).setPreferredWidth(f.getMaximumSize());
@@ -119,25 +120,31 @@ private ImageIcon getImageIcon(String fileName) {
ImageIcon icon = null;
String iconName = getMimeTypeImageName(fileName);
- //icon = new ImageIcon(getMimeTypeImageName(fileName));
- //System.out.println(icon.getImage());
- if(null == iconName || iconName.length() <= 0){
+
+ if (null == iconName || iconName.length() <= 0) {
icon = new ImageIcon(ApplicationConstants.DEFAULT_FOLDER_FILE);
- }else{
- icon = new ImageIcon(ApplicationConstants.DEFAULT_ICON_FILE);
+ } else {
+ File image = new File(ApplicationConstants.IMAGE_DEFAULT_PATH + iconName);
+
+ if (image.isFile()) { //Check if the image file exists
+ icon = new ImageIcon(ApplicationConstants.IMAGE_DEFAULT_PATH + iconName);
+ } else {
+ icon = new ImageIcon(ApplicationConstants.DEFAULT_ICON_FILE);
+ }
}
-
+
return icon;
}
private String getMimeTypeImageName(String fileName) {
String imageName = "";
- if(fileName.lastIndexOf(".") != -1){
- imageName = fileName.substring(
- fileName.lastIndexOf(".") + 1).toUpperCase()
- + ApplicationConstants.IMAGE_DEFAULT_EXTENSION;
+
+ if (fileName.lastIndexOf(".") != -1) {
+ imageName = BoxConfigLoader.getInstance().
+ getMimeTypeFileName(
+ fileName.substring(fileName.lastIndexOf(".") + 1).toUpperCase());
}
-
+
return imageName;
}
@@ -0,0 +1,49 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package br.com.gss.box4lin.config;
+
+import br.com.gss.box4lin.constants.ApplicationConstants;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ * @author glauber
+ */
+public class BoxConfigLoader {
+
+ private static BoxConfigLoader instance;
+ Properties mimeProperties;
+
+ private BoxConfigLoader() {
+ mimeProperties = new Properties();
+ try {
+ mimeProperties.load(new FileInputStream(ApplicationConstants.MIME_TYPE_CONFIG_FILE));
+ } catch (FileNotFoundException ex) {
+ Logger.getLogger(BoxConfigLoader.class.getName()).log(Level.SEVERE, null, ex);
+ } catch (IOException ex) {
+ Logger.getLogger(BoxConfigLoader.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+ public static BoxConfigLoader getInstance() {
+ if (instance == null) {
+ instance = new BoxConfigLoader();
+ }
+ return instance;
+ }
+
+ public String getMimeTypeFileName(String key) {
+ String fileName = mimeProperties.getProperty(key);
+ if(fileName == null || fileName.length() == 0){
+ fileName = ApplicationConstants.DEFAULT_ICON_FILE;
+ }
+ return fileName;
+ }
+}
@@ -38,6 +38,10 @@
public static final String DEFAULT_FOLDER_FILE = IMAGE_DEFAULT_PATH + "folder" + IMAGE_DEFAULT_EXTENSION;
+ public static final String CONFIG_DEFAULT_PATH = "config/";
+
+ public static final String MIME_TYPE_CONFIG_FILE = CONFIG_DEFAULT_PATH + "mimetypes.properties";
+
//Status Constants
public static final String STATUS_S_DELETE_NODE = "s_delete_node";

0 comments on commit 4b16472

Please sign in to comment.