This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FTP files System Icons

 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,

How can we get the OS specific Icon for a given file in a remote ftp server ?
i know how to do that in java for local system files (i use FileSystemView class) but can we do it for remote ftp files ?

is there any open source library for getting system Icons for ftp files? or some java workaround to implement this?

thanks.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not quite sure what you're trying to do. You are downloading a file via ftp, and then you get the local icon for that using FileSystemView. What other icons are you trying to get? Are you (e.g.) trying to assign a Windows icon to a local file on a Linux system?
 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NO,

i'm displaying the local file system in a left JTable and using a Table cell Renderer to display system windows icons for local files.
in right jtable i'm displaying ftp remote files in a similar jtable.i want to write a ftp table cell renderer to affet icons to remote ftp files ;like i did for local files.

how can i do that ?

i hope this makes sense now.thanks
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you create a zero-sized file on the local disk that has the same file extension as the remote file? Then you might be able to use the exact same FileSystemView call.
 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ulf Dittmer:
Could you create a zero-sized file on the local disk that has the same file extension as the remote file? Then you might be able to use the exact same FileSystemView call.


thank you

yes i tried this solution but didn't worked for me perfectly:
1) first problem : i will have to create hundreds of theses temporary empty files on user machine ;and need to delete them when my applet is destroyed ;but sometimes the temp files are not deleted when i exit applet (don't know why).
2) it seems i'm not yet implementing the table cell renderer correctly : all ftp remote files and folders have an icon of 'folder' ; so I'm still not doing it right.
sorry i deleted the code i was using . i switch to only using 2icons (folder and file for ftp files) when i failed implementing this workaround correctly.i could have posted my old code here if i still have it.

can you please show me some sample code for a table cell renderer ,in which i take the extension of ftp file ,create temp File object on local computer ,then render the jtable using icon of temp file ?
also i need to delete theses temp files when i no longer need them.

i will appreciate your help

thanks.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you please show me some sample code for a table cell renderer ,in which i take the extension of ftp file ,create temp File object on local computer ,then render the jtable using icon of temp file ?
also i need to delete theses temp files when i no longer need them.


That would be a lot of code for someone else to write to solve your problem. Why don't you post what you have, and we'll try to figure what the problem is? (Yes, I realize you said that you inadvertently deleted it. But nobody else is going to write it for you, so you might as well start to recreate it.)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic