changeset 1:71ff0735df5a

Fixed bug: open dialog window not opening. Removed useless FileSystemTreeCellRenderer class.
author Fiore Martin <fiore@eecs.qmul.ac.uk>
date Tue, 10 Jan 2012 11:39:43 +0000
parents 9418ab7b7f3f
children 4b2f975e35fa
files java/src/uk/ac/qmul/eecs/ccmi/gui/FileService.java java/src/uk/ac/qmul/eecs/ccmi/gui/filechooser/FileSystemTree.java java/src/uk/ac/qmul/eecs/ccmi/gui/filechooser/FileSystemTreeCellRenderer.java
diffstat 3 files changed, 5 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/java/src/uk/ac/qmul/eecs/ccmi/gui/FileService.java	Fri Dec 16 17:35:51 2011 +0000
+++ b/java/src/uk/ac/qmul/eecs/ccmi/gui/FileService.java	Tue Jan 10 11:39:43 2012 +0000
@@ -92,7 +92,7 @@
          if (defaultFile == null)             
             fileChooser.setSelectedFile(null);
          else
-            fileChooser.setSelectedFile(new File(defaultFile));       
+            fileChooser.setSelectedFile(new File(defaultFile));   
          int response = fileChooser.showOpenDialog(frame);         
          if (response == JFileChooser.APPROVE_OPTION)
             return new OpenImpl(fileChooser.getSelectedFile());
--- a/java/src/uk/ac/qmul/eecs/ccmi/gui/filechooser/FileSystemTree.java	Fri Dec 16 17:35:51 2011 +0000
+++ b/java/src/uk/ac/qmul/eecs/ccmi/gui/filechooser/FileSystemTree.java	Tue Jan 10 11:39:43 2012 +0000
@@ -81,7 +81,10 @@
 	public void setSelectionPath(File file){
 		if(file == null)
 			return;
-
+		
+		/* we need the absolute path as the tree has to be expanded from the root to file *
+		 * and we need all the directory names                                            */ 
+		file = file.getAbsoluteFile();
 		/* make a file path: a list of file's each one representing a directory of file's path */
 		LinkedList<File> filePath = new LinkedList<File>();
 		filePath.add(file);
--- a/java/src/uk/ac/qmul/eecs/ccmi/gui/filechooser/FileSystemTreeCellRenderer.java	Fri Dec 16 17:35:51 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*  
- CCmI Editor - A Collaborative Cross-Modal Diagram Editing Tool
-  
- Copyright (C) 2011  Queen Mary University of London (http://ccmi.eecs.qmul.ac.uk/)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/  
-
-package uk.ac.qmul.eecs.ccmi.gui.filechooser;
-
-import java.awt.Component;
-
-import javax.swing.JTree;
-import javax.swing.tree.DefaultTreeCellRenderer;
-
-/*
- * The cell renderer used in the FileSystemTree class. It differs from the default renderer in 
- * that it renders leaf nodes as non-leaf nodes they represent an empty directory 
- * rather than a file.    
- *
- */
-@SuppressWarnings("serial")
-class FileSystemTreeCellRenderer extends DefaultTreeCellRenderer {
-	@Override
-	public Component getTreeCellRendererComponent(JTree tree,
-            Object value,
-            boolean selected,
-            boolean expanded,
-            boolean leaf,
-            int row,
-            boolean hasFocus){
-		return super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
-	}
-}