This is a tool to convert your SAF-based projects into Non-SAF-based projects (ie, pure-ish Swing).
The wiki uses Markdown syntax.
I wanted to share a few notes of my own personal experiences getting nosaf to work. This probably isn't the most 'ideal' form of documentation, but it's a start. Please correct, refine and improve as desired.
<target name="all" depends="init">
<!-- Replace these folders with a source copy of your project and a
destination where they will be created. -->
<convert src="${user.home}/**Systems/ConvertSAF/SampleSAF/src/main/java**"
dest="${user.home}/**Systems/ConvertSAF/SampleNoSAF/src/main/java**" />
</target>
/home/gurce/Downloads/mb-nosaf/mb-nosaf/src/main/java/net/megabyte/nosaf/MBAction.java:[80,46] error: variable-arity methods are not supported in -source 1.3
(use -source 5 or higher to enable variable-arity methods)
/home/gurce/Downloads/mb-nosaf/mb-nosaf/src/main/java/net/megabyte/nosaf/MBAction.java:[242,5] error: annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
/home/gurce/Downloads/mb-nosaf/mb-nosaf/src/main/java/net/megabyte/nosaf/Utils.java:[136,9] error: annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)
/home/gurce/Downloads/mb-nosaf/mb-nosaf/src/main/java/net/megabyte/nosaf/XalanExt.java:[21,32] error: generics are not supported in -source 1.3
<project ....>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
If you try build your app at this point, you might notice errors relating to a missing/unknown MSGS variable.
public class Test {
protected static final ResourceBundle MSGS = ResourceBundle.getBundle(MBAction.classBundleBaseName(Test.class));
...
As an example of case B), I added the method into my "Common.java" file (where I put a lot of my common methods):
Public Common {
...
public static String classBundleBaseName(Class cls) {
String className = cls.getName();
StringBuilder sb = new StringBuilder();
int i = className.lastIndexOf('.');
if (i > 0) {
sb.append(className.substring(0, i));
sb.append(".resources."); //NOI18N
sb.append(cls.getSimpleName());
} else {
sb.append("resources."); //NOI18N
sb.append(cls.getSimpleName());
}
return sb.toString();
}
...
}
Then I could re-write the line earlier as follows:
public class Test {
protected static final ResourceBundle MSGS = ResourceBundle.getBundle(Common.classBundleBaseName(Test.class));
...
You should then be able to successfully run the app non-SAF-ified app successfully within newer versions of NetBeans.
Still, I did notice that some of the text-strings within the mattise editor looked a bit funny/odd, with lots of angled brackets. Despite things looking a bit weird in the matisse editor, all these text-strings looked fine when the app was run, so I suppose I'm content with that for now...
Ok, that about wraps up all the notes I jotted down on this occasion. Feel free to add more details with your own findings and usage-cases. Gurce (22/02/2016).