Date: 8/2/96, Version: Draft 1.0
Typically, the people providing resource content for applications, like images, sound clips, and etc., are not the same people writing Java programs. It is probably safe to say, these graphical designers would be less comfortable with creating a resource file by writing code, then by visually building the resources.
jresVisual provides a user interface for building and maintaining Java resource files without having to actually understand the syntax or semantics of the Java language.
resource files. (See figure below.) Resource files enable national language support by encapsulating the language dependent data in a Java class. The jresVisual Builder is intended for seamless usage by large community of users, including; the Java software engineer, the content designer and the information developer at the national language translation center.
Background
The JRes compiler, introduces the new concepts of Java resource files and Java resource classes. (See
"JRes- A Java Resource file compiler" ). These resource classes encapsulate data and provide a natural vehicle for national language support in Java. Java resource classes can also dramatically improve the performance of loading static resources.Introducing jresVisual
The IBM Java Resource File Builder, jresVisual, is a Java application to visually build jres (Jay-Res) format
To start jresVisual enter the following:
java ibm.jresv.jresVisual {myresource.jrc}Initially the programmer starts with an empty canvas. Resource file objects are added through the toolbar or context menu provided above the canvas display area.
When saving the resource file, the blue IBM Tazza mascot (tm) should appear in a rocket ship to indicate success. At this time the filename will appear in the titlebar area. The demo version has limited saving capability. (To obtain a full version of jresVisual, contact IBM.)
Consider the following example which will help guide you through the process of visually developing a resource file. An imaginary product called "the Super Editor" by "the Ajax company" has been defined to illustrate the usage of jresVisual. The Super Editor is to have a menubar, which contains the standard "File" and "Edit" menubar items. A resource file will be used to title the product (title text string), display a logo and display a menubar.
First, select the PACKAGENAME toolbar icon to create a package name. The package name will be "ajax.editor" and corresponds to the desired Java class package.
Next, the STRINGTABLE toolbar icon is selected to create a STRINGTABLE which will be used to contain the product title. The fields are filled in as shown below, then the apply button is pressed to apply the changes.
Finally, a menu is created by selecting the MENU toolbar icon. The default menu name is "root.". The "File" pane is added to the "root" pane by adding "100" to the "ID" field and "File" to the "Name" field found at the top of the Menu Properties dialog. Continue populating the menu by pressing the "Add" button for each node in the elastic node canvas. The apply button is pressed to apply the changes.
----------------------------------------------------- PACKAGENAME ajax.editor IMAGE Logo ajax.gif STRINGTABLE product Super Editor ENDSTRINGTABLE MENU root SUBMENU 100 File MENUITEM 101 Open.. MENUITEM 102 Save.. MENUITEM 103 Save as... ENDSUBMENU SUBMENU 200 Edit MENUITEM 201 Cut MENUITEM 202 Copy MENUITEM 203 Paste ENDSUBMENU ENDMENU -----------------------------------------------------
Now the visual resource file is ready for compilation by the JRes compile. Use the Jres compiler to compile.
java ibm.jres.jres editordata.jrcOnce compiled an "editordata.class" file is created and ready to be used by the Super Editor Java application.
So, to continue our example, we build a translation file (which is really just a resource file containing only DEFINE keywords). The toolbar icon "New" is selected to start the creation of a translation file. The DEFINE toolbar icon is selected which shows the properties sheet for a DEFINE table. The following fields are added to this sheet and the apply button is pressed.
The translation (resource) file is saved as "editor.pii.", producing the following results:
-------------------------------------------- DEFINE STR_PRODUCT Super Editor DEFINE STR_FILE File DEFINE STR_OPEN Open.. DEFINE STR_SAVE Save.. DEFINE STR_SAVEAS Save as.. DEFINE STR_EDIT Edit DEFINE STR_CUT Cut DEFINE STR_COPY Copy DEFINE STR_PASTE Paste --------------------------------------------
Then the "editordata.jrc" file is edited again, using the toolbar icon "Open", to load the file. The resource file is modified as seen below with symbolic names for the STRINGTABLE and MENU text. This can be done visually by right clicking on the menu object and editing it's properties via the properties dialog. The same can be done for the "Product" text string.
STRINGTABLE Product STR_PRODUCT ENDSTRINGTABLE MENU root SUBMENU 100 STR_FILE MENUITEM 101 STR_OPEN MENUITEM 102 STR_SAVE MENUITEM 103 STR_SAVEAS ENDSUBMENU SUBMENU 200 STR_EDIT MENUITEM 201 STR_CUT MENUITEM 202 STR_COPY MENUITEM 203 STR_PASTE ENDSUBMENU ENDMENU
Lastly, the toolbar icon "INCLUDE" is selected and the editor.pii file is included which reconciles the STRINGTABLE and MENU information in real-time. The "editordata.jrc" file is saved which is the following file.
PACKAGENAME ajax.editor INCLUDE editor.pii IMAGE Logo ajax.gif STRINGTABLE Product STR_PRODUCT ENDSTRINGTABLE MENU main SUBMENU 100 STR_FILE MENUITEM 101 STR_OPEN MENUITEM 102 STR_SAVE MENUITEM 103 STR_SAVEAS ENDSUBMENU SUBMENU 200 STR_EDIT MENUITEM 201 STR_CUT MENUITEM 202 STR_COPY MENUITEM 203 STR_PASTE ENDSUBMENU ENDMENUNow the visual resource file is ready for compilation by the JRes compiler again. Use the Jres compiler to compile.
java ibm.jres.jres editordata.jrcOnce compiled an "editordata.class" file is created and ready to be used by the Super Editor Java application.