Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jcurses.widgets
Class DefaultLayoutManager  view DefaultLayoutManager download DefaultLayoutManager.java

java.lang.Object
  extended byjcurses.widgets.DefaultLayoutManager
All Implemented Interfaces:
LayoutManager, WidgetsConstants

public class DefaultLayoutManager
extends java.lang.Object
implements LayoutManager, WidgetsConstants

This is a default layout manager. The constraints state for each widget to layout a coordinates of the rectangle, within that the widget is placed and the alignment of the widget, if its preferred size is smaller as the rectangle's size-


Field Summary
private  WidgetContainer _father
           
 
Fields inherited from interface jcurses.widgets.WidgetsConstants
ALIGNMENT_BOTTOM, ALIGNMENT_CENTER, ALIGNMENT_LEFT, ALIGNMENT_RIGHT, ALIGNMENT_TOP
 
Constructor Summary
DefaultLayoutManager()
           
 
Method Summary
 void addWidget(Widget widget, int x, int y, int width, int height, int verticalConstraint, int horizontalConstraint)
          Adds a widget to the boundeb container
 void bindToContainer(WidgetContainer container)
          The method is called by framework by binding the layout manager to an container.
private  int getAlignedCoordinate(int prefG, int contG, int contC, int alignment)
           
 void layout(Widget widget, java.lang.Object constraint)
          The method layouts a widget within a container, dependet of layouting constraints.
 void removeWidget(Widget widget)
          Removes a widget from the container
 void unbindFromContainer()
          The method is called by framework by unbinding the layout manager from its container.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_father

private WidgetContainer _father
Constructor Detail

DefaultLayoutManager

public DefaultLayoutManager()
Method Detail

bindToContainer

public void bindToContainer(WidgetContainer container)
Description copied from interface: LayoutManager
The method is called by framework by binding the layout manager to an container. The implementing class must register, whether this is already bound or not, and throw an exception by a try to bind it second time. This is because the framework restricts, that a lyout manager can be bound only to one container at a time.

Specified by:
bindToContainer in interface LayoutManager

unbindFromContainer

public void unbindFromContainer()
Description copied from interface: LayoutManager
The method is called by framework by unbinding the layout manager from its container. The implementing class must register, whether this is already bound or not, and throw an exception by a try to bind it second time. This is because the framework restricts, that a lyout manager can be bound only to one container at a time.

Specified by:
unbindFromContainer in interface LayoutManager

layout

public void layout(Widget widget,
                   java.lang.Object constraint)
Description copied from interface: LayoutManager
The method layouts a widget within a container, dependet of layouting constraints.

Specified by:
layout in interface LayoutManager

getAlignedCoordinate

private int getAlignedCoordinate(int prefG,
                                 int contG,
                                 int contC,
                                 int alignment)

addWidget

public void addWidget(Widget widget,
                      int x,
                      int y,
                      int width,
                      int height,
                      int verticalConstraint,
                      int horizontalConstraint)
Adds a widget to the boundeb container


removeWidget

public void removeWidget(Widget widget)
Removes a widget from the container