Non Visual Objects
These are components that you may need to interact with but do not make sense as parts of the GUI. You can interact with the back-end processes of the e-mail, alpha paging, server and database objects and link them to front-end events and components. To work with the methods of these non-visual components, use the Interaction Manager. In the Interaction Manager, all the methods and parameters will be exposed.
E Mail, Alpha Paging
This is the same functionality offered by the data component of the same name. The difference is that this non-visual version allows you to call the server-side processes directly. You can use these processes under your own front-end design instead of the one built by the data component.
Server Command
JDesignerPro allows you to create application partitioning by calling commands that are executed on the server based on events on the client or on the server. A Server Command can also call another application, such as a stored procedure or an executable, and return the result to the client.
The method is: execCommand(String,String,String,String)
The four String parameters are:
The string to execute the actual Server command (this can be any valid command for the platform that JaggServer is on.)
The message to display while the command is running
The message to display if the command is successful
The message to display if the command fails
Use the getCommandResult() method to return the results of the Server operation.
Executing Stored Procedures and Ad Hoc SQLs
Database
This object gives you easy access to SQL commands that can be run against the database. Set an action event for another component as a database command based on your own logic. The commands are accessible in the Interaction Manager. Take a look as the SampleQuery example to see how this Object is used.
With JDesignerPro you have the ability to execute SQLs and stored procedures on the database residing on the server. To do so, use the Non-Visual Database component. Add one to your project by dropping it on the Main panel. Nothing will appear on the form but the methods of the Database component will now be available in the Interaction Manager.
After dragging a Database component to your project you can use the Interaction Manager to execute the setDSN(), setCSTR() and execSQL() methods to run your SQL. The results will come back in the vector that you pass to execSQL. The code for execSQL should first initialize the Vector.
The complete code that you need to create either in a new method or by putting entries in the Interaction Manager will look something like the following if done over the Tutorial database:
Database1.setDSN("JDP Tutorial");
Database1.setCSTR("DSN=JDP Tutorial;UID=;PWD=;");
Vector results = new Vector;
int recCount = Database1.execSQL("my_stored_procedure",results)
To execute a SQL that does not call a stored procedure, you might do something like the following.
int recCount = Database1.execSQL("SELECT stor_id, stor_name FROM
dbo_stores",results);
if (recCount > 0) {
String[] StoreId = new String[recCount];
String[] StoreName = new String[recCount];
StringTokenizer stok;
for (int ix=0; ix<recCount; ix++) {
String row = (String)results.elementAt(ix);
if ((row != null) && (row.trim().compareTo("") != 0)) {
stok = new StringTokenizer(row);
StoreId[ix] = stok.nextToken(sep).trim();
StoreName[ix] = stok.nextToken(sep).trim();
}
}
}
Resolving Single Quotes in SQLs
If your database tables have character fields where the data contains embedded single quotes, passing a query with a string containing an embedded single quote causes a syntax error at the ODBC level. There any quoting convention to allow single quotes in literal strings.
JDesignerPro examines strings before passing them to ODBC and re-quotes them appropriately if necessary. If you look at the generated SQL for an INSERT or an UPDATE, JDesignerPro does the following with any String field to replace single quotes with two single quotes. This resolves the problem:
user.u.replace(comments.getText(),"'","''")
Mask Edit
The Mask Edit object gives you the ability to add mask editing to any of your own field objects.
Formatter
The Formatter is a powerful component that lets you create HTML, MS-Excel and text documents from your screens. The Formatter is usually invoked as a button that you name "Print" or "HTML", "Excel", etc. When this component is invoked, the client application will send the data on the screen to the server with the required format type. The Enterprise Management Server (with JAGGServer) will create an HTML, Excel or text file and return it to the client. The client's browser, Excel app or text editor will automatically open and load the file. From here the user may print, save or e-mail the form to someone else. The purpose of using HTML or Excel is to get around the Java security problem of disallowing access to local peripherals, like printers, from Java apps loaded through a browser. See the Examples tab and folder for a finished screen with printing via the Formatter invoked.
The Formatter can create an HTML, MS-Excel or text file from Forms, Grids, Text Areas, Labels and Reports. Tree structures, Charts and other advanced objects cannot be sent to a file output.