java left logo
java middle logo
java right logo
 

Home arrow Other API Tips
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 4093
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
How does NetBeans recognize files E-mail
User Rating: / 0
PoorBest 

A lot of applications show some UI that displays folders of files; also a lot of NetBeans UI is created by showing virtual files in the configuration filesystem.

The basic mechanism is this: Some folder is shown in the UI; files of known types have their own icons, menu items and behavior.

The way NetBeans detects files is this: The "files" being shown are FileObjects - wrappers around java.io.File, or in the case of configuration files, typically wrappers around data stored in some other way, such as inside XML files in modules. What you're actually seeing is Nodes, which are the things that provide actions, localized names, etc. to files or other things.

In between Nodes and FileObjects are DataObjects. A DataObject is like a FileObject?, except that it knows what kind of file is being shown, and there are usually different types of DataObject? (provided by different modules which implement support for file types - for example, the Image module makes it possible to recognize and open .gif and .png files) for files with different extensions, XML files with different DTDs, etc.

Modules that recognize different file types install DataLoaders - factories for file-type-specific DataObjects.

So what really happens is that, when a folder is expanded, they system asks each known DataLoader, "Do you know what this is?" The first one that says "Yes" gets to create the DataObject for the file (in reality the recognition process is a little more optimized than it sounds here, but it adds up to this description).

In order to actually display something for the each file, the system calls DataObject.getNodeDelegate() for each DataObject, and the Nodes are what you actually see in the UI.

Source: NetBeans FAQ


 Related Tips

 
< Prev   Next >

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.