Basic ALE File Structure

The ALE file is a simple input file that defines the location and size of each component within a container (dialog). It does not instantiate any components, nor does it address component event handling.

An ALE file is an ASCII text file that is interpreted when your application is run. If you want to compile your ALE file into your application, an additional compilation step will be needed, but you don't have to do anything special to the original ALE file.

An ALE file can define multiple dialogs. Each section of an ALE file defines a single container, and you can have multiple sections.

An ALE file should have two basic elements:

Let's have a look at an ALE file, simple.ale, that defines a dialog with a single button.


section main
{
   button1(p, p, w / 2, h / 2, CC)
}


Note: Remember, the ALE file contains nothing other than the size and positioning of the components. The components are actually defined and instantiated in your Java code.

The section groups the components defined within it. Any components defined between the opening and closing braces are included in the section.

The component breaks down like this:


     name(width, height, X point, Y point, alignment)

where:

This file generates this dialog:

This is simplest dialog you can create.

ALE provides two methods you can use to position components quickly and easily:

An ALE file, GridAWT.ale, that contains a grid looks similar to:

section main
{
   // 3 x 3 grid, xMin/yMin is (0, 0) xMax/yMax is (w, h)
   // it will cover the entire parent container

   grid(3, 3, 0, 0, w, h)
   {
      // Note that the purpose of "grid" is to determine
      // x and y locations for the components.
      // For this reason we put "0, 0" in for
      // the location fields for each of the components.

      button1(p, p, 0, 0, CC)
      button2(p, p, 0, 0, CC)
      button3(p, p, 0, 0, CC)
      button4(p, p, 0, 0, CC)
      button5(p, p, 0, 0, CC)
      button6(p, p, 0, 0, CC)
      button7(p, p, 0, 0, CC)
      button8(p, p, 0, 0, CC)
      button9(p, p, 0, 0, CC)
   }
}

The grid syntax is:


   grid(rows, columns, xmin, ymin, xmax, ymax)
So our grid breakdown is:

The component syntax is the same as the previous component syntax, except that the X,Y point, used for positioning the component at a particular point, is ignored. The alignment attribute is still used.

This ALE file generates this dialog:

An ALE file that contains a flow looks similar to:


   flow(HORIZONTAL, 5, w - 5, 5)
   {
      button1 ((w - 10) / 3, h / 2,     0, 0, CT)
      button2 (button1.w,    button1.h, 0, 0, CT)
      button3 (button1.w,    button1.h, 0, 0, CT)
   }

The flow syntax is:


   flow(direction, start point, end point, opposing direction centerline)
So our flow breakdown is:

This file generates this dialog: