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: 3899
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 do I specify the order for my menu items/toolbar buttons/files in the system filesystem E-mail
User Rating: / 0
PoorBest 

FileObjects have no partiticular order - the order in which the children of a folder are determined is undefined.

However, DataObjects can have a defined order. The way this works is, you use file attributes to specify what files should be before and after your file. Filesystem folders won't care about this information, but the DataObjects for folders do (call DataFolder.find (FileObject) to get one). It works like this:

<folder name="SomeFolder"/>
  <attr name="fileBefore/someFile" boolvalue="true"/>
  <file name="someFile"/>
  <attr name="someFile/fileAfter" boolvalue="true"/>
<folder/>

Notice where the attributes are specified: on the folder, not the file! The order of the attributes in the XML file is not important - they can be anywhere - but it is a NetBeans coding convention to specify them as shown above - before attr, file, after attr - so that someone who wants to read/debug XML layers can remain at least reasonably sane.

If you are really interested in the nitty gritty of how and why this works, see the javadoc on topological sort.

You may be wondering why is there a value of "true" for each attribute.

Bear in mind that using an ordering attribute a/b only ensures that a comes somewhere before b. It does not guarantee that b will immediately follow a. But if you know that a is normally followed immediately by c, then using both the attributes a/b and b/c will put b between them.

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.