OBEROn SDK

com.oberon.client
Class Application

java.lang.Object
  extended by com.oberon.client.Application
Direct Known Subclasses:
BasicApplication, OberonClient, OOQL

public abstract class Application
extends java.lang.Object

Basic class for Desktop (SWT) Applications. Includes connection and utility functions.

Version:
5.0

Field Summary
 org.eclipse.swt.graphics.Image appIcon
          The Application icon
 java.lang.String application_MainMenu
          The Application main menu
 Configuration conf
          Configuration object
static java.lang.String CONF_FILE_SECTION
          "FILE"
static java.lang.String CONF_VIEW_SECTION
          "VIEW"
 java.util.Hashtable<java.lang.String,org.eclipse.swt.widgets.Shell> dialogs
          The Application dialog registry
 java.lang.String dictionary_common_section
          Dictionary section for Common labels
 java.lang.String dictionary_default_language
          The default dictionary language
 java.lang.String dictionary_menu_section
          Dictionary section for Menu labels
 java.lang.String dictionary_section
          Dictionary section for Application labels
 org.eclipse.swt.widgets.Display display
          Application SWT display
static com.oberon.ooql.connection.DriverManager driverManager
          Database JDBC driver manager
 Framework framework
          OBEROn user framework
static org.eclipse.swt.graphics.Font globalfont
          The Application default font
static java.lang.String ID
          "ID"
static boolean isRWT
          RWT Application flag
 java.util.Locale locale
          Default Locale
 java.lang.String name
          The Application title
 java.lang.String name_revision_separator
          Default name-revision separator
 java.lang.String number_separator_symbols
          Use the fixed decimal separator
static int ON_TOP
          "ON TOP options for dialog windows"
 java.lang.String search_all_label
          Label "All" for search selection item
 boolean selectApplication
          Select Application from a list
 javax.servlet.http.HttpSession session
          The Application session
 org.eclipse.swt.widgets.Shell shell
          Application SWT shell
 boolean show_object_class
          Show the Object class in the result lists
 boolean show_object_namerev
          Show the Object name / revision in the result lists
static java.lang.String sToken
          Default separator token
 java.lang.String subname
          The Application subtitle
 java.lang.String uploadDir
           
static java.lang.String URL_JAVAAPI
          Java API documentation web link
static java.lang.String URL_OBERON
          OBEROn Web Site
static java.lang.String URL_OOQL
          OOQL syntax documentation web link
 boolean use_search_patterns
          Use the search patterns for text fields
 
Constructor Summary
Application()
           
 
Method Summary
static void addDialog(java.lang.String sName, org.eclipse.swt.widgets.Shell dialog)
          Add a dialog popup to the dialog-window registry
static void addDownloadFile(java.lang.String sFileName)
          Add a file name to the download list
 void closeConnections()
          Close all OBEROn connections
static int computeHeight(int height)
          Scale the element height based on the application window height
static int computeWidth(int width)
          Scale the element width based on the application window width
static org.eclipse.swt.graphics.Image convertImage(byte[] baImage, int scx, int scy)
          Convert and resize a byte[] image
 org.eclipse.swt.widgets.Menu createMenu(java.lang.String menuName)
          Generate the application main Menu
static byte[] createProgressBarImage(float value, int width, int height, javax.servlet.http.HttpSession httpSession)
          Create an image representing a progress bar [need the SWT jar installed]
static void errorMessage(org.eclipse.swt.widgets.Shell shell, java.lang.Exception exception, java.lang.String sTitle)
          Display an Error Message for a thread Exception
static Application getApp()
           
static java.lang.String getClassNameRevision(ObjectObj object, javax.servlet.http.HttpSession session)
          Compose the object Class-Name-Revision string
 java.util.Vector<int[]> getCommandCoords()
          Get the command text coordinates for each OOQL command for the last performOOQLCommands execution
static java.lang.String getCommonTranslation(java.lang.String key)
          Translate a keyword searching in the Application Common dictionary-Section
 OBConnection getConnection()
          Get OBEROn connection
 java.lang.String getConnectionProperty(java.lang.String property)
          Get a configuration property value from the "CONNECTION" section
static java.lang.Object getData(org.eclipse.swt.widgets.Widget widget, java.lang.String tag)
          Get a custom property value from SWT widget
static org.eclipse.swt.widgets.Shell getDialog(java.lang.String sName)
          Retrieve a dialog popup from the dialog-window registry
static java.util.Vector<java.lang.String> getDownloadFiles()
          Return the file download list
static Framework getFramework(javax.servlet.http.HttpSession session)
          Retrieve the current framework from the HttpSession
static org.eclipse.swt.graphics.Image getIcon(java.lang.String iconName)
          Retrieve an image/icon from the OBEROn JAR package
static java.lang.String getIconFileName(org.eclipse.swt.widgets.Shell shell, java.lang.String sTitle, int style)
          Open a File Selection Dialog for Image files
 org.eclipse.swt.graphics.Image getImage(int iAdminId, int scx, int scy)
          Retrieve the administrative object icon using the internal ID and resize it
 org.eclipse.swt.graphics.Image getImage(java.lang.String sAdminType, java.lang.String sAdminName, int scx, int scy)
          Retrieve the administrative object icon from the OBEROn DB and resize it
static java.lang.String getLinkData(Link link, javax.servlet.http.HttpSession session)
          Compose the link identification string as "Linktype From(Class/Name/Revision) -> To(Class/Name/Revision)" use the name_revision_separator between the object name and the revision
static java.lang.String getMenuTranslation(java.lang.String key)
          Translate a keyword searching in the Application Menu dictionary-Section
static java.lang.String getNameRevision(java.lang.String sName, java.lang.String sRevision)
          Compose the Name-Revision string separated by name_revision_separator
 org.eclipse.swt.graphics.Image getObjImage(java.lang.String sObjectID, int scx, int scy)
          Retrieve a object instance icon and resize it
 java.lang.String getProperty(java.lang.String section, java.lang.String property)
          Get a configuration property value
static java.lang.String getTranslation(java.lang.String key)
          Translate a keyword searching in the Application dictionary-Section
static java.lang.String getTranslation(java.lang.String section, java.lang.String key)
          Translate a keyword searching in a specific dictionary-Section
static java.lang.String getTranslation(java.lang.String language, java.lang.String section, java.lang.String key)
          Translate a keyword to a specific language, searching in a specific dictionary-Section
static org.eclipse.swt.widgets.Widget getWindow(org.eclipse.swt.widgets.Control view)
           
static int getWindowHeight()
          Get the application window height
static int getWindowWidth()
          Get the application window width
abstract  boolean handleRequest(ApplicationRequest request)
          Handle an Application request
 boolean isConnected()
          Check if the Application is connected to the Database or to RMI/HTTP server
 boolean isDBConnection()
          Check if the Connection is established directly to the DB
static org.eclipse.swt.graphics.Font loadMonospacedFont(org.eclipse.swt.widgets.Display display)
          Load the Segoe standard Font from the JAR package
abstract  void log(java.lang.String message)
          Show a message in the application Log panel or in the status bar
 void openConnections()
          Open the OBEROn Database/RMI/HTTP connections and perform the Login (open the Framework if user account is specified)
 boolean openFramework(java.lang.String sUserName, java.lang.String sPassword)
          Login into OBEROn
 java.lang.String parseOOQLCommands(java.lang.String sOOQLCommands)
          Parse the OOQL command text
 java.util.Vector<java.lang.String> performOOQLCommands(java.lang.String sOOQLCommands)
          Perform one or more OBEROn OOQL commands with current application Framework
 void performSearch(org.eclipse.swt.widgets.Table results, java.util.Vector<?> vExclude, java.lang.String sTypeName, java.lang.String sFilter, boolean append)
          Perform a selection of administrative objects
 void performSearch(org.eclipse.swt.widgets.Table results, java.util.Vector<?> vExclude, java.lang.String sApplication, java.lang.String sTypeName, java.lang.String sFilter, boolean append)
          Perform a selection of administrative objects
 void releaseConnection(OBConnection conn)
          Release an OBEROn connection
 void setApp(Application application)
           
static void setData(org.eclipse.swt.widgets.Widget widget, java.lang.String tag, java.lang.Object value)
          Set a custom property to SWT widget
abstract  void setFramework()
          Open the Framework dialog to login into OBEROn
static void setFramework(javax.servlet.http.HttpSession session, Framework framework)
          Save the current framework into the HttpSession
 void setNoVerbose()
          Turn off the verbose option
static void setWindowHeight(int heigth)
          Set the application window height
static void setWindowWidth(int width)
          Set the application window width
static void showMessage(org.eclipse.swt.widgets.Shell shell, java.lang.String sMessage, java.lang.String sTitle, int style)
          Display a Message
static org.eclipse.swt.widgets.Shell showSplash(java.lang.String sLogo)
          Shows the OBEROn logo and info on start-up
abstract  java.lang.String translateOberonLanguageToISO639Language(java.lang.String language)
          Convert the language code from the Application format to standard ISO code
static org.eclipse.swt.widgets.Shell windowOpen(org.eclipse.swt.widgets.Composite parent, ApplicationRequest request, java.lang.String windowName, java.lang.String style)
          Open new PopUp window (dialog)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sToken

public static final java.lang.String sToken
Default separator token

See Also:
Constant Field Values

URL_OBERON

public static final java.lang.String URL_OBERON
OBEROn Web Site

See Also:
Constant Field Values

URL_OOQL

public static final java.lang.String URL_OOQL
OOQL syntax documentation web link

See Also:
Constant Field Values

URL_JAVAAPI

public static final java.lang.String URL_JAVAAPI
Java API documentation web link

See Also:
Constant Field Values

display

public org.eclipse.swt.widgets.Display display
Application SWT display


shell

public org.eclipse.swt.widgets.Shell shell
Application SWT shell


name

public java.lang.String name
The Application title


subname

public java.lang.String subname
The Application subtitle


isRWT

public static boolean isRWT
RWT Application flag


appIcon

public org.eclipse.swt.graphics.Image appIcon
The Application icon


globalfont

public static org.eclipse.swt.graphics.Font globalfont
The Application default font


dialogs

public final java.util.Hashtable<java.lang.String,org.eclipse.swt.widgets.Shell> dialogs
The Application dialog registry


session

public javax.servlet.http.HttpSession session
The Application session


framework

public Framework framework
OBEROn user framework


locale

public java.util.Locale locale
Default Locale


selectApplication

public boolean selectApplication
Select Application from a list


driverManager

public static com.oberon.ooql.connection.DriverManager driverManager
Database JDBC driver manager


conf

public Configuration conf
Configuration object


application_MainMenu

public java.lang.String application_MainMenu
The Application main menu


dictionary_menu_section

public java.lang.String dictionary_menu_section
Dictionary section for Menu labels


dictionary_common_section

public java.lang.String dictionary_common_section
Dictionary section for Common labels


dictionary_section

public java.lang.String dictionary_section
Dictionary section for Application labels


dictionary_default_language

public java.lang.String dictionary_default_language
The default dictionary language


show_object_class

public boolean show_object_class
Show the Object class in the result lists


show_object_namerev

public boolean show_object_namerev
Show the Object name / revision in the result lists


use_search_patterns

public boolean use_search_patterns
Use the search patterns for text fields


number_separator_symbols

public java.lang.String number_separator_symbols
Use the fixed decimal separator


name_revision_separator

public java.lang.String name_revision_separator
Default name-revision separator


search_all_label

public java.lang.String search_all_label
Label "All" for search selection item


ID

public static final java.lang.String ID
"ID"

See Also:
Constant Field Values

CONF_FILE_SECTION

public static final java.lang.String CONF_FILE_SECTION
"FILE"

See Also:
Constant Field Values

CONF_VIEW_SECTION

public static final java.lang.String CONF_VIEW_SECTION
"VIEW"

See Also:
Constant Field Values

ON_TOP

public static int ON_TOP
"ON TOP options for dialog windows"


uploadDir

public java.lang.String uploadDir
Constructor Detail

Application

public Application()
Method Detail

setApp

public void setApp(Application application)

getApp

public static Application getApp()

getProperty

public java.lang.String getProperty(java.lang.String section,
                                    java.lang.String property)
Get a configuration property value

Parameters:
section - configuration file section
property - property name

getConnectionProperty

public java.lang.String getConnectionProperty(java.lang.String property)
Get a configuration property value from the "CONNECTION" section

Parameters:
property - property name

openConnections

public void openConnections()
Open the OBEROn Database/RMI/HTTP connections and perform the Login (open the Framework if user account is specified)

See Also:
ConnectionManager.openConnections(Application)

closeConnections

public void closeConnections()
Close all OBEROn connections

Since:
4.1

getConnection

public OBConnection getConnection()
Get OBEROn connection

See Also:
ConnectionManager.getConnection(Framework)

releaseConnection

public void releaseConnection(OBConnection conn)
Release an OBEROn connection

Parameters:
conn - The OBEROn connection
See Also:
ConnectionManager.releaseConnection(OBConnection,Framework)

isConnected

public boolean isConnected()
Check if the Application is connected to the Database or to RMI/HTTP server

See Also:
ConnectionManager.isConnected()

isDBConnection

public boolean isDBConnection()
Check if the Connection is established directly to the DB

See Also:
ConnectionManager.isDBConnection()

getFramework

public static Framework getFramework(javax.servlet.http.HttpSession session)
Retrieve the current framework from the HttpSession


setFramework

public static void setFramework(javax.servlet.http.HttpSession session,
                                Framework framework)
Save the current framework into the HttpSession


openFramework

public boolean openFramework(java.lang.String sUserName,
                             java.lang.String sPassword)
                      throws java.lang.Exception
Login into OBEROn

Parameters:
sUserName - the user name
sPassword - the user password
Throws:
java.lang.Exception

performOOQLCommands

public java.util.Vector<java.lang.String> performOOQLCommands(java.lang.String sOOQLCommands)
                                                       throws OberonException,
                                                              com.oberon.ooql.parser.ParserLogException,
                                                              com.oberon.ooql.parser.ParserCreationException
Perform one or more OBEROn OOQL commands with current application Framework

Parameters:
sOOQLCommands - command text
Returns:
a Vector of String(s) where each element represents the result for the corresponding command
Throws:
OberonException
com.oberon.ooql.parser.ParserLogException
com.oberon.ooql.parser.ParserCreationException

parseOOQLCommands

public java.lang.String parseOOQLCommands(java.lang.String sOOQLCommands)
                                   throws OberonException,
                                          com.oberon.ooql.parser.ParserLogException,
                                          com.oberon.ooql.parser.ParserCreationException
Parse the OOQL command text

Parameters:
sOOQLCommands - command text
Returns:
a report representing the OOQL language parsed tree
Throws:
OberonException
com.oberon.ooql.parser.ParserLogException
com.oberon.ooql.parser.ParserCreationException

getCommandCoords

public java.util.Vector<int[]> getCommandCoords()
Get the command text coordinates for each OOQL command for the last performOOQLCommands execution

Returns:
Vector of int[4]{startLine,startColumn,endLine,endColumn}

setNoVerbose

public void setNoVerbose()
Turn off the verbose option


performSearch

public void performSearch(org.eclipse.swt.widgets.Table results,
                          java.util.Vector<?> vExclude,
                          java.lang.String sTypeName,
                          java.lang.String sFilter,
                          boolean append)
Perform a selection of administrative objects

Parameters:
results - SWT table to show the search result
vExclude - Vector of object names excluded from the result
sTypeName - object type
sFilter - filter pattern
append - if true append the found objects to the table; otherwise replace the current content

performSearch

public void performSearch(org.eclipse.swt.widgets.Table results,
                          java.util.Vector<?> vExclude,
                          java.lang.String sApplication,
                          java.lang.String sTypeName,
                          java.lang.String sFilter,
                          boolean append)
Perform a selection of administrative objects

Parameters:
results - SWT table to show the search result
vExclude - Vector of object names excluded from the result
sApplication - application name
sTypeName - object type
sFilter - filter pattern
append - if true append the found objects to the table; otherwise replace the current content

getIcon

public static org.eclipse.swt.graphics.Image getIcon(java.lang.String iconName)
Retrieve an image/icon from the OBEROn JAR package

Parameters:
iconName - the icon/image file name

convertImage

public static org.eclipse.swt.graphics.Image convertImage(byte[] baImage,
                                                          int scx,
                                                          int scy)
Convert and resize a byte[] image

Parameters:
baImage - byte array image
scx - resize width (if 0 is ignored)
scy - resize height (if 0 is ignored)
Returns:
SWT Image

getImage

public org.eclipse.swt.graphics.Image getImage(java.lang.String sAdminType,
                                               java.lang.String sAdminName,
                                               int scx,
                                               int scy)
Retrieve the administrative object icon from the OBEROn DB and resize it

Parameters:
sAdminType - administrative object type
sAdminName - administrative object name
scx - resize width (if 0 is ignored)
scy - resize height (if 0 is ignored)

getImage

public org.eclipse.swt.graphics.Image getImage(int iAdminId,
                                               int scx,
                                               int scy)
Retrieve the administrative object icon using the internal ID and resize it

Parameters:
iAdminId - the internal ID
scx - resize width (if 0 is ignored)
scy - resize height (if 0 is ignored)

getObjImage

public org.eclipse.swt.graphics.Image getObjImage(java.lang.String sObjectID,
                                                  int scx,
                                                  int scy)
Retrieve a object instance icon and resize it

Parameters:
sObjectID - the Object id
scx - resize width (if 0 is ignored)
scy - resize height (if 0 is ignored)

createProgressBarImage

public static byte[] createProgressBarImage(float value,
                                            int width,
                                            int height,
                                            javax.servlet.http.HttpSession httpSession)
                                     throws java.lang.Exception
Create an image representing a progress bar [need the SWT jar installed]

Parameters:
value - the percentage of completion
width - the image width
height - the image height
Returns:
the progress bar image
Throws:
java.lang.Exception
Since:
2.2.02

computeWidth

public static int computeWidth(int width)
Scale the element width based on the application window width


computeHeight

public static int computeHeight(int height)
Scale the element height based on the application window height


setWindowWidth

public static void setWindowWidth(int width)
Set the application window width


setWindowHeight

public static void setWindowHeight(int heigth)
Set the application window height


getWindowWidth

public static int getWindowWidth()
Get the application window width


getWindowHeight

public static int getWindowHeight()
Get the application window height


loadMonospacedFont

public static org.eclipse.swt.graphics.Font loadMonospacedFont(org.eclipse.swt.widgets.Display display)
Load the Segoe standard Font from the JAR package


showSplash

public static org.eclipse.swt.widgets.Shell showSplash(java.lang.String sLogo)
Shows the OBEROn logo and info on start-up


errorMessage

public static void errorMessage(org.eclipse.swt.widgets.Shell shell,
                                java.lang.Exception exception,
                                java.lang.String sTitle)
Display an Error Message for a thread Exception

Parameters:
exception - the thread Exception
sTitle - the message box title

showMessage

public static void showMessage(org.eclipse.swt.widgets.Shell shell,
                               java.lang.String sMessage,
                               java.lang.String sTitle,
                               int style)
Display a Message

Parameters:
sMessage - the showed message
sTitle - the message box title
style - the message type ( see SWT MessageBox styles )

getIconFileName

public static java.lang.String getIconFileName(org.eclipse.swt.widgets.Shell shell,
                                               java.lang.String sTitle,
                                               int style)
Open a File Selection Dialog for Image files

Parameters:
sTitle - the dialog title
style - the dialog style (see SWT FileDialog styles)

addDialog

public static void addDialog(java.lang.String sName,
                             org.eclipse.swt.widgets.Shell dialog)
Add a dialog popup to the dialog-window registry

Parameters:
sName - the dialog window name
dialog - the dialog

getDialog

public static org.eclipse.swt.widgets.Shell getDialog(java.lang.String sName)
Retrieve a dialog popup from the dialog-window registry

Parameters:
sName - the dialog window name

getClassNameRevision

public static java.lang.String getClassNameRevision(ObjectObj object,
                                                    javax.servlet.http.HttpSession session)
                                             throws java.lang.Exception
Compose the object Class-Name-Revision string

Throws:
java.lang.Exception

getNameRevision

public static java.lang.String getNameRevision(java.lang.String sName,
                                               java.lang.String sRevision)
Compose the Name-Revision string separated by name_revision_separator


getLinkData

public static java.lang.String getLinkData(Link link,
                                           javax.servlet.http.HttpSession session)
                                    throws java.lang.Exception
Compose the link identification string as "Linktype From(Class/Name/Revision) -> To(Class/Name/Revision)" use the name_revision_separator between the object name and the revision

Throws:
java.lang.Exception

getCommonTranslation

public static java.lang.String getCommonTranslation(java.lang.String key)
Translate a keyword searching in the Application Common dictionary-Section


getMenuTranslation

public static java.lang.String getMenuTranslation(java.lang.String key)
Translate a keyword searching in the Application Menu dictionary-Section


getTranslation

public static java.lang.String getTranslation(java.lang.String key)
Translate a keyword searching in the Application dictionary-Section


getTranslation

public static java.lang.String getTranslation(java.lang.String section,
                                              java.lang.String key)
Translate a keyword searching in a specific dictionary-Section


getTranslation

public static java.lang.String getTranslation(java.lang.String language,
                                              java.lang.String section,
                                              java.lang.String key)
Translate a keyword to a specific language, searching in a specific dictionary-Section


createMenu

public org.eclipse.swt.widgets.Menu createMenu(java.lang.String menuName)
Generate the application main Menu

Parameters:
menuName - the name of Menu

setData

public static void setData(org.eclipse.swt.widgets.Widget widget,
                           java.lang.String tag,
                           java.lang.Object value)
Set a custom property to SWT widget

Parameters:
widget - the SWT widget
tag - the property name
value - the property value

getData

public static java.lang.Object getData(org.eclipse.swt.widgets.Widget widget,
                                       java.lang.String tag)
Get a custom property value from SWT widget

Parameters:
widget - the SWT widget
tag - the property name

addDownloadFile

public static void addDownloadFile(java.lang.String sFileName)
Add a file name to the download list

Since:
4.2.2

getDownloadFiles

public static java.util.Vector<java.lang.String> getDownloadFiles()
Return the file download list

Since:
4.2.2

windowOpen

public static org.eclipse.swt.widgets.Shell windowOpen(org.eclipse.swt.widgets.Composite parent,
                                                       ApplicationRequest request,
                                                       java.lang.String windowName,
                                                       java.lang.String style)
Open new PopUp window (dialog)

Parameters:
parent - the parent shell
request - Application request with target url
windowName - the dialog window name
style - the HTML window style (width,height,resizable,scrollable...)
Returns:
the dialog Shell

getWindow

public static org.eclipse.swt.widgets.Widget getWindow(org.eclipse.swt.widgets.Control view)

log

public abstract void log(java.lang.String message)
Show a message in the application Log panel or in the status bar


setFramework

public abstract void setFramework()
Open the Framework dialog to login into OBEROn


handleRequest

public abstract boolean handleRequest(ApplicationRequest request)
Handle an Application request

Returns:
true when the request page is recognized as valid page

translateOberonLanguageToISO639Language

public abstract java.lang.String translateOberonLanguageToISO639Language(java.lang.String language)
Convert the language code from the Application format to standard ISO code


OBEROn SDK

Copyright © 2008-2014 Mirko Solazzi. All Rights Reserved.