Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jcontrol.ui.wombat
Interface IFrame

All Superinterfaces:
  IContainer

All Known Implementing Classes:
  Frame

    public interface IFrame

extends IContainer

An application must have (or self be) a `Frame` instance. A frame represents the very top level element of the application's component tree. Here, all drawing action is managed. The frame is also responsible for the control of user input such as touch or keyboard actions. The frame consists of two main parts: The outline and the content.

- The outline is a `Component` (may even a `Container`) that represents the static part of an application. This can be a menu, a logo, a background image, an analog clock somewhere in a corner or whatever. The outline is optional and should normally not be replaced at run-time.
- The content is a `Container` that represents the dynamic part of an application. Adding components to the frame means to add components to the frame's content. The content can even be replaced completely by the application using the `setContent` method.

Note: It is not recommended to access components using multiple threads at the same time. This may cause synchronization problems resulting in unexpected behaviour.

(C) DOMOLOGIC Home Automation GmbH 2005 - 2007

Method Summary
`void` | `clearFocus(IContainer container)` Clears the focus tree under the specified container.
`Container` | `getContent()` Returns the current content or `null` if there is none.
`Component` | `getOutline()` Returns the current outline or `null` if there is none.
`boolean` | `requestFocus(Component component)` Tries to transfer the keyboard focus to the given component.
`void` | `setContent(Container container)` Sets/replaces the frame's content.
`void` | `setOutline(Component component)` Sets a static element on the frame.
`boolean` | `transferFocus(IContainer c, int direction)` Transfers the focus in the given container to the next `IFocusable` element.

Methods inherited from interface jcontrol.ui.wombat.IContainer
`add, remove, removeAll, setDirty`

Method Detail

### setContent

    void setContent(Container container)

  Sets/replaces the frame's content. Setting this value to `null` will destroy the current content. All handles within the current content will be reset to pave the way for the garbage collector. In this case, the frame's content will be `null` until this method is called again with a new container instance as argument or until the `add(Component)` method is called. In this case a new default content will be created internally.
  As the content is the application's root container, this method can easily be used to implement a multi-page application by creating a number of containers, one for each page. Calling this method with any container instance will erase the whole display content and replace it with the new one. A good idea to reduce memory consumption is to set the old content to `null` before creating a new one. Thus, the garbage collector can release all memory resources that have been used by the old content before the new container is created that maybe needs this memory.

  Example:

       public class FirstPage extends Container {
              public FirstPage() {
                      super(2);
                      // create some components here
                      add(new Button("OK", ...);
                      add(new Button("Cancel", ...);
              }
       }

       public class SecondPage extends Container {
              public SecondPage() {
                      super(2);
                      // create some other components here
                      add(new Button("Abort", ...);
                      add(new Button("Retry", ...);
              }
       }

       // important part of the main Application
       public class PageDemo extends Frame {

              public PageDemo() {
                      // set first page as content
                      setContent(new FirstPage());
                      // make the frame visible
                      setVisible(true);
                      ...
                      // some code
                      ...
                      // delete current content
                      setContent(null);
                      // now, it's time for the garbage collector to work

                      // switch to second page
                      setContent(new SecondPage());
              }
       }

  Parameters:
    `container` - a container instance or `null`.

### getContent

    Container getContent()

  Returns the current content or `null` if there is none.

  Returns:
    the current content or `null` if there is none.

### setOutline

    void setOutline(Component component)

  Sets a static element on the frame. The static element of a frame can be e.g. a clock or a logo or whatever. It will not disappear when the content changes.

  Parameters:
    `component` - a component to use as static element on the frame.

### getOutline

    Component getOutline()

  Returns the current outline or `null` if there is none.

  Returns:
    the current outline or `null` if there is none.

### requestFocus

    boolean requestFocus(Component component)

  Tries to transfer the keyboard focus to the given component. This method is for internal use and should not be called by the application. This method may be empty in some frame implementations.

  Parameters:
    `component` - the component to transfer the focus to
  Returns:
    true if this method was successful
  See Also:
    `IFocusable.requestFocus()`

### clearFocus

    void clearFocus(IContainer container)

  Clears the focus tree under the specified container. This method is for internal use and should not be called by the application.

  Parameters:
    `container` - a container

### transferFocus

    boolean transferFocus(IContainer c,
                          int direction)

  Transfers the focus in the given container to the next `IFocusable` element. This method is for internal use and should not be called by the application. This method may be empty in some frame implementations.

  Parameters:
    `c` - the container
    `direction` - IFocusable.TRANSFER_FOCUS_FORWARD or IFocusable.TRANSFER__FOCUS_BACKWARD

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD