Newbie needs help

  7 posts   Feedicon  
Replies: 6 - Last Post: January 23, 2010 10:14
by: etf
showing 1 - 7 of 7
 
Posted: January 22, 2010 01:11 by mawcs
Hi,

I'm very new to BSAF (and never used SAF). I've used App frameworks in the past, but the resource injection used in BSAF is new to me. I'd have to say, I like it--when I can get it to work.

I am having difficulty with my project. I developed an application using SingleFrameApplication. I created an associated properties file for my application and created a main panel and menubar.

When I tried to encapsulate the creation of the menubar and the main panel in a separate public class, the resource injection would not work. I created an additional properties file for my new class and added the appropriate properties. I left the properties in the main application file so that I could go back if necessary. However, the new class file does not seem to have it's resources pulled in correctly.

Also, if I put an @Action in a file other than the main application file, the action will not execute correctly.

What's the trick to getting these features working in properly encapsulated public classes? Is there documentation somewhere that I'm missing? I've looked at all of the examples and none of them address this situation.

Please help.

 
Posted: January 22, 2010 01:23 by mawcs
I forgot to mention, within my code, I'm trying to call:

Application.getInstance().getContext().getResourceMap().injectComponents(this);

This is called after initialization of the external public component class. I'm not sure where exactly in the sequence it is supposed to be called.
 
Posted: January 22, 2010 22:35 by etf
Thanks for interest in the project.
To be more specific I need review your particular code. I just can give some guidelines at the moment. More detailed examples I will add later on.

To make a long story short, getResourceMap() method return the Application Resource Map. It contains only resources associated with application itself. If you provide resources for your class use method getResourceMap(YourPanel.class).

The same rule is true and for the actions.

Use getActionMap(YourPanel.class, this) method, where this is an instance of YourPanel class.

Please let me know whether provided information is useful for you.
 
Posted: January 22, 2010 22:47 by mawcs
Thanks for the help. I just discovered moments ago a solution to my problem. I was invoking a Dialog using the .setVisible of the dialog and not using .show() from the Application code. Once I corrected that issue, I was able to get the Actions and resource injection working correctly.

Incidentally, now that I have this issue resolved, I'll probably stick with using BSAF. I am using the latest 1.9 from the repository and will let you all know if I encounter any problems. If they're simple enough, I'd be happy to make fixes and submit the code to you.

Thanks for all the hard work on this. I'm glad you all picked up where the JSR-oriented project left off.
 
Posted: January 23, 2010 10:09 by etf
Great news!

Some resources/actions injection related topics are covered in example "examples.basicpanelexample".
https://kenai.com/svn/bsaf~main/trunk/bsaf_examples/src/main/java/examples/basicpanelexample
 
Posted: January 23, 2010 01:05 by mawcs
Hmm, Actually, that only solved part of the problem. The main panel and menu creation are still troubling me. I can't share my actual code, unfortunately. I will try to distill it into an example code to see if it helps.
 
Posted: January 23, 2010 10:14 by etf
Please have a look at the SingleFrameExample4.
https://kenai.com/svn/bsaf~main/trunk/bsaf_examples/src/main/java/examples/SingleFrameExample4.java
showing 1 - 7 of 7
Replies: 6 - Last Post: January 23, 2010 10:14
by: etf
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close