Valid XHTML 1.0 Transitional

DictionaryForMIDs SW Design

Architecture

DictionaryForMIDs uses a 3-layer Architecture Model:

hmi_java_me

hmi_java_se

 

"HMI (Human Machine Interface) layer": This layer contains the user interface, i.e. menus, display components etc.

There is a separate implementation of the user interface for Java ME and Java SE.

translation

 

"Business Service Layer": Provides the translation functionality.

dataaccess

 

"Data Access Layer": Provides the services to access the dictionary data.

 

Interface to the translation layer

The interface from the HMI layer to the translation layer is provided by the class TranslationExecution / method executeTranslation:

public synchronized static void executeTranslation(TranslationParameters translationParametersObj)

TranslationParameters is a class that holds all parameters for the translation:

public TranslationParameters(String  	toBeTranslatedWordTextInput,
			 boolean[]	inputLanguages,
			 boolean[]	outputLanguages,
			 boolean 		executeInBackground,
			 int           	maxHits,
			 int 		durationForCancelSearch)

Parameter

Description

toBeTranslatedWordTextInput

word/expression that shall be translated

inputLanguages

Array with one boolean entry per language. For each language a 'true' indicates to search for this language.
 

For example, dictionary with 2 languages:

inputLanguages[0] = true

inputLanguages[1] = false

-> the toBeTranslatedWordTextInput will be searched in the first language only (language1 in DictionaryForMIDs.properties).

ouputLanguages

As for inputLanguages: array with one boolean per language. True indicates to include the translation for this language.
 

Example with 2 languages:

outputLanguages[0] = false

outputLanguages[1] = true

-> the translation will be taken from the second language (language2 in DictionaryForMIDs.properties).

executeInBackground

True, if the the translation shall be done in the background.

If this parameter is true, then executeTranslation will then return immediately and TranslationExecutionCallback.newTranslationResult  (see below) will be called as soon as the translation is complete.

If this parameter is false then executeTranslation will return after TranslationExecutionCallback.newTranslationResult has been called.

maxHits

Maximum number of hits for the translation. If this maximum number is reached, then the search will end.

durationForCancelSearch

Maximum duration for the search. If the search takes more time, then the search will end.


The result of the translation is provided via a callback interface:

public interface TranslationExecutionCallback {
	void deletePreviousTranslationResult();
	void newTranslationResult(TranslationResult resultOfTranslation);
}

deletePreviousTranslationResult is called by executeTranslation when the previous translation result should be deleted from the user interface. The new result is passed to the user interface with the method newTranslationResult. For a description of the class TranslationResult, see the file TranslationResult.java.

Before calling executeTranslation, the HMI needs to call Translation.setTranslationExecutionCallback with an object that provides the TranslationExecutionCallback interface:

public static void setTranslationExecutionCallback(TranslationExecutionCallback translationResultHMIObjParam)

 

Classes depending on Java ME/Java SE environment

All classes in the HMI layer are implemented separately for Java ME and Java SE. Apart from the classes in the HMI layer, there are a few more classes that are specifically adapted for Java ME/Java SE:

This class does store the settings from the DictionarySettingForm in a nonvolatile storage. The Midlet implementation stores the settings in the Record Management Store (RMS) of the device.

[todo: this list is not yet complete]


If you have any questions, just contact us - we will help !



Diverse topics

Icons

Icons are stored in the JAR file in the following directories:

Directory Content
icons/Application Contains the application icon DictionaryForMIDs.png. This icon is provided only with one size.
icons/UIDisplayTextItems/small/12px
                                          16px
                                          20px
                                          24px
                                          32px

icons/UIDisplayTextItems/big/  20px
                                         32px
                                         48px
Contains the icons for the UIDisplayTextItems as defined in DictionaryForMIDs.languages (respectively in the file UIDisplayTextItems.java which is generated by the tool LanguageUIGeneration).

The following UIDisplayTextItems can have an icon:
- ChoiceGroup (subgroup 'small')
- Alert (subgroup 'big')
For these UIDisplayTextItems a PNG-file with the same ID as the UIDisplayTextItem is put in these directories.

There is a subgroup 'small' and a subgroup 'big'. Within the subgroups there are directories for the different pixel sizes. For example in the directory small/16px there are the icons with a resolution of 16x16 pixels.

Note that the icon for a UIDisplayTextItem must be provided in each pixel size for the subgroup. Example: in each of the 5 directories small/12px, small/16px ... small/32px there must be the file SettingsColouredItems.png.

At runtime DictionaryForMIDs queries the device to determine the pixel size that fits best and then loads the icons from the corresponding directory.


Icon designer wanted !! We need to have icons for the following ChoiceGroup items in the Settings dialogue. Currently only the language flags in the Settings dialogue are implemented. If you have any questions concerning the creation of the icons please contact us - we will be glad to help !
Search options:

UIDisplayTextItems.SettingsIncrementalSearchEnabled
UIDisplayTextItems.SettingsFindMatchWordOnly UIDisplayTextItems.SettingsEndWildcardAnySeriesOfCharacter
UIDisplayTextItems.SettingsBeginNoSearchSubExpressionCharacter

Display options:
UIDisplayTextItems.SettingsShowTranslationList UIDisplayTextItems.SettingsColouredItems UIDisplayTextItems.SettingsShowStatistics UIDisplayTextItems.SettingsUseBitmapFont

Font size
:
UIDisplayTextItems.SettingsFontDeviceDefault UIDisplayTextItems.SettingsFontSmall
UIDisplayTextItems.SettingsFontMedium
UIDisplayTextItems.SettingsFontLarge
UIDisplayTextItems.SettingsFontBitmapFont

Performance:
UIDisplayTextItems.SettingsBypassCharsetDecoding

We need to have the icons in the following pixel sizes: 12x12, 16x16, 20x20, 24x24, 32x32.

Besides: with MIDP 3.0 also the menu commands can have an icon - so finally we will need to have icons for the menu commands also.



Display text items for different languages / LanguageUIGeneration tool

All display texts (such as labels, menu entries, etc.) are translated to different languages. In the source code, for display texts , always elements of the class UIDisplayTextItem are used. You need the LanguageUIGeneration tool when you add any display text (UIDisplayTextItem). For a description of the use of UIDisplayTextItem and the LanguageUIGeneration tool, see here.

 

Source Code

You can download the current source code either from CVS, or, if you are not familiar with CVS, just download the source as a ZIP file.

Downloading the Source Code from CVS

The sources for the DictionaryForMIDs tools and applications are maintained in the SourceForge CVS. Read the description how to access the DictionaryForMIDs CVS repository.
 

Downloading the Source Code as ZIP file

The source code of the DictionaryForMIDs Java ME application is part of the following ZIP file: DictionaryForMIDs_3.1.1_source.zip (352 kB)
Note however, that the source code of this ZIP file is a little older than what you will find in the CVS.

The source code for the other DictionaryForMIDs tools and applications (for example DictionaryGeneration) is directly included in the ZIP file of that tool/application.
 

Building the tools and applications

Development Environments

You can use the development environment of your preference to compile, run and test the DictionaryForMIDs tools and applications. For example Eclipse, NetBeans or any other Java development environment.

For compiling the DictionaryForMIDs Java ME application, most people install Sun's Wireless Toolkit (WTK).


Dependencies between the CVS projects

The following dependencies exist between the CVS projects:


Building the tools and applications with build.xml

The CVS project 'Build' provides the file build.xml. This file build.xml is used to compile and create the jar files of all tools and applications.

Here is how to use the build.xml file:

Important note: the source files are UTF-8 encoded. In Sun's WTK, you must set in the file ktools.properties (found somewhere under wtklib) the following property:
javac.encoding=UTF-8
 

Building the tools and applications directly from development environments (Sun's WTK, Eclipse, etc.)

You can build the jar files also directly with development tools such as WTK or Eclipse, without using the build.xml file. Also in this case, be sure to set the UTF-8 encoding for WTK (see note above).
 

Test versions

Please check our forum for announcement of test versions !