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

Quick Search    Search Deep

jcurses.widgets
Class Window  view Window download Window.java

java.lang.Object
  extended byjcurses.widgets.Window
Direct Known Subclasses:
Dialog

public class Window
extends java.lang.Object

This class is a jcurses implementation of an text based window. An window under jcurses is, differnt from other GUI libraries, not a widget, this contains a panel ( a the called root panel ), that contains all widgets. A window can, but doesn't must, have a border and a title. All windows under jcurses are managed in a stack, the topmost visible window window on the stack gets all input chars for handling, this is so called focus window. If an window are created, it gets automatically to the top of the stack and leaves the until an other window is created or explicitly brought to the top.


Field Summary
private static jcurses.system.CharColor __defaultBorderColors
           
private static jcurses.system.InputChar __defaultClosingChar
          Folgende Methoden bestimmen das zeichen das benutzt wird, um das Fenster zu schließen
private static jcurses.system.InputChar __defaultFocusChangeChar
           
private static jcurses.system.CharColor __defaultTitleColors
          Normaler title
private static jcurses.system.InputChar __downChar
           
private static jcurses.system.InputChar __leftChar
           
private static jcurses.system.InputChar __rightChar
           
private static jcurses.system.CharColor __shadowColors
           
private static jcurses.system.InputChar __upChar
           
private  boolean _border
           
private  jcurses.system.CharColor _borderColors
           
(package private)  boolean _closed
           
private  jcurses.system.InputChar _closingChar
           
private  int _currentIndex
           
private  java.util.Vector _focusableChilds
           
private  jcurses.system.InputChar _focusChangeChar
           
private  boolean _hasShadow
           
private  jcurses.event.WindowListenerManager _listenerManager
           
private  jcurses.util.Rectangle _rect
           
private  Panel _root
           
private  java.util.Vector _shortCutsList
           
private  java.util.Hashtable _shortCutsTable
           
private  java.lang.String _title
           
private  jcurses.system.CharColor _titleColors
           
private  boolean _visible
           
 
Constructor Summary
Window(int width, int height, boolean border, java.lang.String title)
          The constructor.
Window(int x, int y, int width, int height, boolean border, java.lang.String title)
          The constructor
 
Method Summary
protected  void activate()
          The method is called, if the window gets focus.
 void addListener(jcurses.event.WindowListener listener)
          The method adds a listener to the window
private  void changeFocus()
           
private  void changeFocus(int direction)
           
(package private)  void changeFocus(Widget widget)
           
 void close()
          The method closed the window, that is removes it from window stack an evantually from screen, if it was visible.
protected  void closed()
          The method is called, if the window is closed.
private  void configureRootPanel()
           
private  void cutIfNeeded()
           
protected  void deactivate()
          The method is called, if the window loses focus.
private  void drawThingsIfNeeded()
           
 jcurses.system.CharColor getBorderColors()
           
 jcurses.system.InputChar getClosingChar()
          The method returns the character to close window.
private  Widget getCurrentWidget()
           
 jcurses.system.CharColor getDefaultBorderColors()
           
private  jcurses.system.InputChar getDefaultClosingChar()
           
private  jcurses.system.InputChar getDefaultFocusChangeChar()
           
 jcurses.system.CharColor getDefaultTitleColors()
           
 jcurses.system.InputChar getFocusChangeChar()
          The method returns the charater used to navigate (change the focus) between widgets within the window.
private  Widget getNextWidget(int direction)
           
protected  jcurses.util.Rectangle getRectangle()
           
 Panel getRootPanel()
           
private  jcurses.system.CharColor getShadowColors()
           
 jcurses.system.CharColor getTitleColors()
           
private  Widget getWidgetByShortCut(jcurses.system.InputChar inp)
           
protected  void handleInput(jcurses.system.InputChar inp)
          The method is called by the libray to handle an input character, if the window has the focus.
private  boolean handleInputByCurrentChild(jcurses.system.InputChar inp)
           
(package private)  boolean hasShadow()
           
 void hide()
          The method hides the window
 boolean isClosed()
           
private  boolean isShortCut(jcurses.system.InputChar inp)
          Behandlung der Eingabe.
 boolean isVisible()
          The method returns the window's visibility status
private  void loadFocusableChilds()
           
private  void loadShortcuts()
           
 void moveToTheTop()
          The method moves the window to the top of the stack
protected  void onChar(jcurses.system.InputChar inp)
          The method is called by handleInput, if no widget has handled the input.
 void pack()
          The method computes new window's layout.
protected  void paint()
          The method paint's the window
private  void paintTitle()
           
 void removeListener(jcurses.event.WindowListener listener)
          The method remove a listener from the window
protected  void repaint()
          Currently the method makes the same as repaint, in next versions the method will repaint only the part of the window, that was hided.
protected  void resize(int width, int height)
           
 void setBorderColors(jcurses.system.CharColor colors)
           
 void setClosingChar(jcurses.system.InputChar character)
          The method defines a new window's closing character.
 void setFocusChangeChar(jcurses.system.InputChar character)
          The method defined the charater used to navigate (change the focus) between widgets within the window.
 void setRootPanel(Panel root)
          Sets the root panel of the window.
 void setShadow(boolean value)
          The method defines, whether the window is to paint with a shadow
 void setTitleColors(jcurses.system.CharColor colors)
           
 void setVisible(boolean value)
          The method changes the window's visibility status
 void show()
          The method shows the window
 boolean tryToClose()
          The method tries to close the window, after the user has typed 'escape' or an other closing character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_root

private Panel _root

_focusableChilds

private java.util.Vector _focusableChilds

_currentIndex

private int _currentIndex

_visible

private boolean _visible

_rect

private jcurses.util.Rectangle _rect

_border

private boolean _border

_title

private java.lang.String _title

_hasShadow

private boolean _hasShadow

_shortCutsList

private java.util.Vector _shortCutsList

_shortCutsTable

private java.util.Hashtable _shortCutsTable

_closed

boolean _closed

__defaultClosingChar

private static jcurses.system.InputChar __defaultClosingChar
Folgende Methoden bestimmen das zeichen das benutzt wird, um das Fenster zu schließen


_closingChar

private jcurses.system.InputChar _closingChar

__defaultFocusChangeChar

private static jcurses.system.InputChar __defaultFocusChangeChar

_focusChangeChar

private jcurses.system.InputChar _focusChangeChar

__upChar

private static jcurses.system.InputChar __upChar

__downChar

private static jcurses.system.InputChar __downChar

__leftChar

private static jcurses.system.InputChar __leftChar

__rightChar

private static jcurses.system.InputChar __rightChar

__defaultBorderColors

private static jcurses.system.CharColor __defaultBorderColors

_borderColors

private jcurses.system.CharColor _borderColors

__defaultTitleColors

private static jcurses.system.CharColor __defaultTitleColors
Normaler title


_titleColors

private jcurses.system.CharColor _titleColors

__shadowColors

private static jcurses.system.CharColor __shadowColors

_listenerManager

private jcurses.event.WindowListenerManager _listenerManager
Constructor Detail

Window

public Window(int x,
              int y,
              int width,
              int height,
              boolean border,
              java.lang.String title)
The constructor


Window

public Window(int width,
              int height,
              boolean border,
              java.lang.String title)
The constructor. A window created with this constructor is centered on the screen.

Method Detail

configureRootPanel

private void configureRootPanel()

show

public void show()
The method shows the window


hide

public void hide()
The method hides the window


setVisible

public void setVisible(boolean value)
The method changes the window's visibility status


isVisible

public boolean isVisible()
The method returns the window's visibility status


paint

protected void paint()
The method paint's the window


repaint

protected void repaint()
Currently the method makes the same as repaint, in next versions the method will repaint only the part of the window, that was hided.


getRectangle

protected jcurses.util.Rectangle getRectangle()

close

public void close()
The method closed the window, that is removes it from window stack an evantually from screen, if it was visible.


moveToTheTop

public void moveToTheTop()
The method moves the window to the top of the stack


getDefaultClosingChar

private jcurses.system.InputChar getDefaultClosingChar()

getClosingChar

public jcurses.system.InputChar getClosingChar()
The method returns the character to close window. As default is escape characted defined


setClosingChar

public void setClosingChar(jcurses.system.InputChar character)
The method defines a new window's closing character. Default is escape.


getDefaultFocusChangeChar

private jcurses.system.InputChar getDefaultFocusChangeChar()

getFocusChangeChar

public jcurses.system.InputChar getFocusChangeChar()
The method returns the charater used to navigate (change the focus) between widgets within the window. Default is 'tab'


setFocusChangeChar

public void setFocusChangeChar(jcurses.system.InputChar character)
The method defined the charater used to navigate (change the focus) between widgets within the window. Default is 'tab'


isShortCut

private boolean isShortCut(jcurses.system.InputChar inp)
Behandlung der Eingabe. Vier mögliche Fälle: 1. Fenster schliessen. 2. Zum nächsten Widget springen. 3. Shortcut bearbeiten. 3. Eingabe vom aktuell Fokus habenden Kind bearbeiten lassen.


getWidgetByShortCut

private Widget getWidgetByShortCut(jcurses.system.InputChar inp)

tryToClose

public boolean tryToClose()
The method tries to close the window, after the user has typed 'escape' or an other closing character. The procedure is as following: If the window has listeners, than an event is sent to the listeners. The window can be closed bei listeners. Did'nt listeners close the window, in leaves open. Has the window no listeners, than the method closes it.


isClosed

public boolean isClosed()

handleInput

protected void handleInput(jcurses.system.InputChar inp)
The method is called by the libray to handle an input character, if the window has the focus.


onChar

protected void onChar(jcurses.system.InputChar inp)
The method is called by handleInput, if no widget has handled the input. Derived classes can override the method to define additional shortcuts.


changeFocus

private void changeFocus()

changeFocus

private void changeFocus(int direction)

getNextWidget

private Widget getNextWidget(int direction)

changeFocus

void changeFocus(Widget widget)

getCurrentWidget

private Widget getCurrentWidget()

handleInputByCurrentChild

private boolean handleInputByCurrentChild(jcurses.system.InputChar inp)

loadShortcuts

private void loadShortcuts()

loadFocusableChilds

private void loadFocusableChilds()

pack

public void pack()
The method computes new window's layout. The method must already be called, if anything on the window building is changed, for example, an widget is removed or isn't more focusable ( because not visible or other ).


cutIfNeeded

private void cutIfNeeded()

getRootPanel

public Panel getRootPanel()

setRootPanel

public void setRootPanel(Panel root)
Sets the root panel of the window. This is the top most widget container in the window's widget hierarchy. It occupies the entire window out of the border (if exists ).


drawThingsIfNeeded

private void drawThingsIfNeeded()

paintTitle

private void paintTitle()

getDefaultBorderColors

public jcurses.system.CharColor getDefaultBorderColors()

getBorderColors

public jcurses.system.CharColor getBorderColors()

setBorderColors

public void setBorderColors(jcurses.system.CharColor colors)

getDefaultTitleColors

public jcurses.system.CharColor getDefaultTitleColors()

getTitleColors

public jcurses.system.CharColor getTitleColors()

setTitleColors

public void setTitleColors(jcurses.system.CharColor colors)

setShadow

public void setShadow(boolean value)
The method defines, whether the window is to paint with a shadow


hasShadow

boolean hasShadow()

getShadowColors

private jcurses.system.CharColor getShadowColors()

addListener

public void addListener(jcurses.event.WindowListener listener)
The method adds a listener to the window


removeListener

public void removeListener(jcurses.event.WindowListener listener)
The method remove a listener from the window


activate

protected void activate()
The method is called, if the window gets focus.


deactivate

protected void deactivate()
The method is called, if the window loses focus.


closed

protected void closed()
The method is called, if the window is closed.


resize

protected void resize(int width,
                      int height)