HOWTO - Sashipa development

 ValueFormat: column formats.

You wish to specify a format for a column. For example, the column is a telephone, a year, an email, a url etc...

Using a predefined format (defined in the language file)

Default formats are defined at the end of the language file. You can find your language file here: <melbalab-home>/src_xml/resources/SashipaXXX.xml. A default format exists for each column type (text and clob, integer, float, money, boolean, date, time, dateTime). These default format are used for columns that haven't any specified format.

Many additional formats are defined too. You can find them in the element predefinedValueFormatSet at the end of the language file. Now we can see how to use them.

We specify the format in schemaColumn elements:

  <schemaColumn name='tblContact_Cell' type='text'
                maxCharacters='20' notNull='no'>
    <physicalName>Cell</physicalName>
    <singularName>Cellular</singularName>
    <singularName>Cell</singularName>
    <guiConfigSchemaColumn letterCount='20' sort='asc' />
    <valueFormatRef valueFormat='text_telephone' />
  </schemaColumn≶

Remarks:

Be carefull: don't modify your language file ! It can be modified at each new version of MelbaLab. If you want to change content, do a copy of the language file and work on the copy. Then use an editor that can work in UTF8.

How to create your own format.

You can define a new format for a schemaColumn:

  <schemaColumn name='tblContact_Cell' type='text'
                maxCharacters='20' notNull='no'>
    <physicalName>Cell</physicalName>
    <singularName>Cellular</singularName>
    <shortName>Cell</shortName>
    <guiConfigSchemaColumn letterCount='20' sort='asc' />
    <textFormat name='text_telephone'>
      <displayTextFormatTelephone actionWhenInvalid='displayWithoutFormat'>
        <telephoneFormat>XX.XX.XXX.XXX</telephoneFormat>
        <validLetters>,()+0123456789</validLetters>
        <ignoredCharacter>.</ignoredCharacter>
        <ignoredCharacter> </ignoredCharacter>
      </displayTextFormatTelephone>
      <exportTextFormatTelephone actionWhenInvalid='exportWithoutFormat'>
        <telephoneFormat>XXXXXXXXXX</telephoneFormat>
        <validLetters>,()+0123456789</validLetters>
        <ignoredCharacter>.</ignoredCharacter>
        <ignoredCharacter> </ignoredCharacter>
      </exportTextFormatTelephone>
      <saveTextFormatTelephone actionWhenInvalid='error'>
        <validLetters>,()+0123456789</validLetters>
        <ignoredCharacter>.</ignoredCharacter>
        <ignoredCharacter> </ignoredCharacter>
      </saveTextFormatTelephone>
    </textFormat>
  </schemaColumn≶

Remarks:

Using a predefined format (hardcoded in the engine).

Last but not the least, you can use a format hardcoded in the engine. Two hardcoded formats are available: predefinedFormat_textUrl and predefinedFormat_textEmail. Here is an example:

  <schemaColumn name='tblContact_Email1' type='text'
                maxCharacters='100' notNull='no'>
    <physicalName>Email1</physicalName>
    <singularName>Email 1</singularName>
    <guiConfigSchemaColumn letterCount='20' sort='asc' />
    <valueFormatRef valueFormat='predefinedFormat_textEmail' />
  </schemaColumn>

These formats have effects on textFields. It's possible to open a browser or an electronic mail software from the generated application. For using this function in the generated application : press the CTRL key and click on the textField, or call the textField popup menu.

But Java programs haven't information about the default browser or electronic mail. So it has to be defined in default parameters. Two parameters are added:

  <defaultParameterSet>

    ...

    <defaultParameter applyOn='externalCommandList' type='browser'>
      <externalCommand>
        <commandName>Mozilla (Linux)</commandName>
        <commandBegin>mozilla </commandBegin>
        <commandEnd />
      </externalCommand>
      <externalCommand>
        <commandName>Mozilla (Windows)</commandName>
        <commandBegin>"C:\Program Files\mozilla.org\Mozilla\mozilla" </commandBegin>
        <commandEnd />
      </externalCommand>
      <externalCommand>
        <commandName>Internet Explorer</commandName>
        <commandBegin>"C:\Program Files\Internet Explorer\IEXPLORE.EXE" </commandBegin>
        <commandEnd />
      </externalCommand>
    </defaultParameter>

    <defaultParameter applyOn='externalCommandList' type='emailClient'>
      <externalCommand>
        <commandName>Mozilla Mail (Linux)</commandName>
        <commandBegin>mozilla -mail mailto:</commandBegin>
        <commandEnd />
      </externalCommand>
      <externalCommand>
        <commandName>Mozilla Mail (Windows)</commandName>
        <commandBegin>"C:\Program Files\mozilla.org\Mozilla\mozilla" -mail mailto:</commandBegin>
        <commandEnd />
      </externalCommand>
      <externalCommand>
        <commandName>Outlook Express</commandName>
        <commandBegin>"C:\Program Files\Outlook Express\msimn.exe" /mailurl:mailto:</commandBegin>
        <commandEnd />
      </externalCommand>
    </defaultParameter>
  </defaultParameterSet>

Remarks:

© Copyright 2003 Sashipa-Melba Team. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License as much as this note clearly appears.