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

## hibergui
Class Component<T>

    java.lang.Object
      hibergui.Component<T>

Type Parameters:
  `T` -

Direct Known Subclasses:
  Edit, Form

    public abstract class Component<T>

extends java.lang.Object

Common superclass of HiberGUI components. Although HiberGUI components themselves are not SWT widgets, widgets can be placed on them, and they can be placed on SWT composites as well. According to the logic of SWT, the the elements of a component must be created during the instantiation of component. This is done by the createContents method. Subclasses should override this method to place widgets or subcomponents on themselves. (In AWT or Swing widgets can be put on containers using "add" methods after the container has been instantiated.) Any activities, which should be performed before the construction of the subcomponents and widgets of the component should be done by the init method. The constructor invokes it before createContents. HiberGUI components cannot handle SWT events directly. They have own event handling based on SWT.

Author:
  Miklós Espák

Field Summary
`private java.util.List<ChangeListener>` | `changeListeners`
`private org.eclipse.swt.widgets.Control` | `crl` The SWT control containing the component.
`private java.util.List<FocusListener>` | `focusListeners`
`private java.util.List<KeyListener>` | `keyListeners`
`protected org.eclipse.swt.events.FocusListener` | `lsn_WIDGET_FOCUS` This SWT listener fires a HiberGUI focus event when an SWT focus event is fired.
`protected org.eclipse.swt.events.KeyListener` | `lsn_WIDGET_KEY` This SWT listener fires a HiberGUI key event when an SWT key event is fired.
`protected int` | `style` The style of the component.

Constructor Summary
`protected` | `Component(org.eclipse.swt.widgets.Composite cptParent, int style)` Initializes the component and creates the GUI elements on them.

Method Summary
`void` | `addChangeListener(ChangeListener lsn)`
`void` | `addControlListener(org.eclipse.swt.events.ControlListener lsn)`
`void` | `addFocusListener(FocusListener lsn)`
`void` | `addKeyListener(KeyListener lsn)`
`protected abstract org.eclipse.swt.widgets.Control` | `createContents(org.eclipse.swt.widgets.Composite cptParent)` Creates the GUI contents of the component.
`protected void` | `dispose()` Disposes the component.
`protected void` | `fireChange(ChangeEvent<? extends Component<T>,T> event)`
`private void` | `fireFocusGained(FocusEvent<?> event)`
`private void` | `fireFocusLost(FocusEvent<?> event)`
`protected void` | `fireKeyPressed(KeyEvent<?> event)`
`protected void` | `fireKeyReleased(KeyEvent<?> event)`
`org.eclipse.swt.widgets.Control` | `getControl()` Returns the SWT control of the component.
`protected void` | `init()` Initializes the component.
`void` | `removeChangeListener(ChangeListener lsn)`
`void` | `removeControlListener(org.eclipse.swt.events.ControlListener lsn)`
`void` | `removeFocusListener(FocusListener lsn)`
`void` | `removeKeyListener(KeyListener lsn)`
`abstract boolean` | `setFocus()`
`void` | `setLayoutData(java.lang.Object data)` Sets the layout data of the component.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### style

    protected final int style

  The style of the component. It is a combination of constants defined in hibergui.HiberGUI.

### crl

    private final org.eclipse.swt.widgets.Control crl

  The SWT control containing the component.

### lsn_WIDGET_FOCUS

    protected final org.eclipse.swt.events.FocusListener lsn_WIDGET_FOCUS

  This SWT listener fires a HiberGUI focus event when an SWT focus event is fired. The listener has to be added to the internal controls of HiberGUI components.

### focusListeners

    private java.util.List<FocusListener> focusListeners

### lsn_WIDGET_KEY

    protected final org.eclipse.swt.events.KeyListener lsn_WIDGET_KEY

  This SWT listener fires a HiberGUI key event when an SWT key event is fired. The listener has to be added to the internal controls of HiberGUI components.

### keyListeners

    private java.util.List<KeyListener> keyListeners

### changeListeners

    private java.util.List<ChangeListener> changeListeners

Constructor Detail

### Component

    protected Component(org.eclipse.swt.widgets.Composite cptParent,
                        int style)

  Initializes the component and creates the GUI elements on them. These are done by init and createContents.

  Parameters:
    `cptParent` - The composite which the component will be placed on. The parent of the control of the component.
    `style` - The style of the component. It is a combination of constants defined in hibergui.HiberGUI.

Method Detail

### init

    protected void init()

  Initializes the component. Initialization is done before creating the GUI contents of the component.

### dispose

    protected void dispose()

  Disposes the component.

### createContents

    protected abstract org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite cptParent)

  Creates the GUI contents of the component. Subclasses should override it.

  Parameters:
    `cptParent` - The composite which the component will be placed on. The parent of the control of the component.
  Returns:
    The control of the component containing its GUI elements.

### getControl

    public org.eclipse.swt.widgets.Control getControl()

  Returns the SWT control of the component. It is created by createContents.

  Returns:
    the control of the component

### setLayoutData

    public final void setLayoutData(java.lang.Object data)

  Sets the layout data of the component. The call is delegated to the control of the component.

  Parameters:
    `data` - the layout data

### addFocusListener

    public final void addFocusListener(FocusListener lsn)

### removeFocusListener

    public final void removeFocusListener(FocusListener lsn)

### fireFocusGained

    private void fireFocusGained(FocusEvent<?> event)

### fireFocusLost

    private void fireFocusLost(FocusEvent<?> event)

### setFocus

    public abstract boolean setFocus()

### addControlListener

    public final void addControlListener(org.eclipse.swt.events.ControlListener lsn)

### removeControlListener

    public final void removeControlListener(org.eclipse.swt.events.ControlListener lsn)

### addKeyListener

    public final void addKeyListener(KeyListener lsn)

### removeKeyListener

    public final void removeKeyListener(KeyListener lsn)

### fireKeyPressed

    protected void fireKeyPressed(KeyEvent<?> event)

### fireKeyReleased

    protected void fireKeyReleased(KeyEvent<?> event)

### addChangeListener

    public final void addChangeListener(ChangeListener lsn)

### removeChangeListener

    public final void removeChangeListener(ChangeListener lsn)

### fireChange

    protected void fireChange(ChangeEvent<? extends Component<T>,T> event)

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