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

Quick Search    Search Deep

jcurses.widgets
Class Widget  view Widget download Widget.java

java.lang.Object
  extended byjcurses.widgets.Widget
Direct Known Subclasses:
Button, CheckBox, Label, List, PopUpList, TextComponent, WidgetContainer

public abstract class Widget
extends java.lang.Object

This class is superclass for all jcurses widgets. For implementing a ne widget you must derive it. An jcurses widget is already used within a window. Its task ist to help it's WidgetContainer to layout itself, giving needed informations, to paint itself and to handle input. Handling input is needed only, if the widget has is an input widget ( examples are text input widget, list widget) and has currently focus, that is is selected by user to handle input. This selectig ocurrs by typing a special key (currenty 'tab') to switch between input widgets. All widgets are ordered in a hierarchy. An widget is already has a container, if it isn't the root pane of a window.


Field Summary
private static jcurses.system.CharColor __defaultColors
           
private  jcurses.system.CharColor _colors
           
private  boolean _focus
           
(package private)  WidgetContainer _parent
           
private  jcurses.util.Rectangle _size
           
private  boolean _visible
          Methoden, die Sichtbarkeit regeln.
(package private)  Window _window
           
private  int _x
           
private  int _y
           
 
Constructor Summary
Widget()
           
 
Method Summary
protected abstract  void doPaint()
          This method paints the widget.
protected abstract  void doRepaint()
          This method repaints the widget.
protected  void focus()
          The method is called bei setFocus to tell widget, thas it has get focus.
protected  int getAbsoluteX()
           
protected  int getAbsoluteY()
           
 jcurses.system.CharColor getColors()
           
protected  jcurses.system.CharColor getDefaultColors()
           
 void getFocus()
          The method switches focus to this widget, if it is focusable at all.
protected  WidgetContainer getParent()
           
protected abstract  jcurses.util.Rectangle getPreferredSize()
          This method gives the widget container the infomation about the preferred size of this widget.
protected  jcurses.util.Rectangle getRectangle()
          Returns the rectangle on the screen, that contains this widget
protected  java.util.Vector getShortCutsList()
          This method returns a list of short cut chars, that the widget want to handle.
protected  jcurses.util.Rectangle getSize()
           
 boolean getVisible()
          The method returns true, if the visibility flag of the widget is true.
protected  Window getWindow()
           
protected  int getX()
           
protected  int getY()
           
protected  boolean handleInput(jcurses.system.InputChar inputChar)
          The method is called by framework to let the widget handle an input char.
 boolean hasFocus()
           
protected  boolean isFocusable()
          The method declares, whether the widget can handle input ( get focus ), that is, whether this is an input widget.
 boolean isVisible()
          return true, if the widget is currently visible, false otherwise.
protected  void paint()
          The method is called by the framework to paint the widget
protected  void repaint()
          The method is called by the framework to repaint the widget
 void setColors(jcurses.system.CharColor colors)
          Set colors of the widget
(package private)  void setFocus(boolean value)
          The method is called by framework if focus is switched,that is, either the widget has get or lost focus.
protected  void setParent(WidgetContainer parent)
          Sets widget's container.
protected  void setSize(jcurses.util.Rectangle size)
          Sets the size of the widget.
 void setVisible(boolean visible)
          The method manages visibility
protected  void setWindow(Window window)
          /** Sets widget's window.
protected  void setX(int x)
          Sets the x coordinate within the container.
protected  void setY(int y)
          Sets the y coordinate within the container.
protected  void unfocus()
          The method is called bei setFocus to tell widget, thas it has lost focus.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_parent

WidgetContainer _parent

_window

Window _window

_x

private int _x

_y

private int _y

_size

private jcurses.util.Rectangle _size

_focus

private boolean _focus

_visible

private boolean _visible
Methoden, die Sichtbarkeit regeln. Ein widget ist dann sichtbar wenn er UND sein Parent sichtbar sind


_colors

private jcurses.system.CharColor _colors

__defaultColors

private static jcurses.system.CharColor __defaultColors
Constructor Detail

Widget

public Widget()
Method Detail

getParent

protected WidgetContainer getParent()

setParent

protected void setParent(WidgetContainer parent)
Sets widget's container. Is called by framework, schouldn't be called writing applications


setWindow

protected void setWindow(Window window)
/** Sets widget's window. Is called by framework, schouldn't be called writing applications


getWindow

protected Window getWindow()

setX

protected void setX(int x)
Sets the x coordinate within the container. Is called by framework, schouldn't be called writing applications


getX

protected int getX()

getAbsoluteX

protected int getAbsoluteX()

setY

protected void setY(int y)
Sets the y coordinate within the container. Is called by framework, schouldn't be called writing applications


getY

protected int getY()

getAbsoluteY

protected int getAbsoluteY()

getRectangle

protected jcurses.util.Rectangle getRectangle()
Returns the rectangle on the screen, that contains this widget


getSize

protected jcurses.util.Rectangle getSize()

setSize

protected void setSize(jcurses.util.Rectangle size)
Sets the size of the widget.


getPreferredSize

protected abstract jcurses.util.Rectangle getPreferredSize()
This method gives the widget container the infomation about the preferred size of this widget. Must be implemented by derived classes.


paint

protected void paint()
The method is called by the framework to paint the widget


doPaint

protected abstract void doPaint()
This method paints the widget. Will be called by paint(), only if the widget is visible. Must be implemented be derived classes.


repaint

protected void repaint()
The method is called by the framework to repaint the widget


doRepaint

protected abstract void doRepaint()
This method repaints the widget. Will be called by paint(), only if the widget is visible. Must be implemented be derived classes.


isFocusable

protected boolean isFocusable()
The method declares, whether the widget can handle input ( get focus ), that is, whether this is an input widget.


hasFocus

public boolean hasFocus()

getFocus

public void getFocus()
The method switches focus to this widget, if it is focusable at all.


setFocus

void setFocus(boolean value)
The method is called by framework if focus is switched,that is, either the widget has get or lost focus.


focus

protected void focus()
The method is called bei setFocus to tell widget, thas it has get focus. This method schold be overrided bei derived class to react getting focus, for examlple to repaint widget gettig focus.


unfocus

protected void unfocus()
The method is called bei setFocus to tell widget, thas it has lost focus. This method schold be overrided bei derived class to react losing focus, for examlple to repaint widget losing focus.


handleInput

protected boolean handleInput(jcurses.system.InputChar inputChar)
The method is called by framework to let the widget handle an input char. Schould be overrided be derived classes, if these can handle input.


getShortCutsList

protected java.util.Vector getShortCutsList()
This method returns a list of short cut chars, that the widget want to handle. If a char from the list is typed by user, it will be handled always my this widget not bei the widget currenty having focus, except the having focus widget handles ALL chars and tells this throuth the method handleAllPrintableChars. To enable shortcuts for a new widget, you must override this method.


setVisible

public void setVisible(boolean visible)
The method manages visibility


getVisible

public boolean getVisible()
The method returns true, if the visibility flag of the widget is true. This doesn't mean that the widget ist currently visible, because the parent whole window can be unvisible, use the method isVisible to query the visisbility


isVisible

public boolean isVisible()
return true, if the widget is currently visible, false otherwise.


getDefaultColors

protected jcurses.system.CharColor getDefaultColors()

setColors

public void setColors(jcurses.system.CharColor colors)
Set colors of the widget


getColors

public jcurses.system.CharColor getColors()