Class Hovlet
- Direct Known Subclasses:
Controller
,Session
,Team
,Unit
public abstract class Hovlet
extends java.lang.Object
Hovlets can be interlaced into each other. Each hovlet has a super-hovlet parent and a list of sub-hovlets hovlets, that can be added by the method add(...). The connectability upward and downward is to be defined in its constructor. A hovlet without super-hovlet is called root-hovlet.
The resulting hovlet trees are displayed in so-called browsers that show certain hovlets on request. The method show() opens a new browser for the full hovlet tree (unless this has already happened) which displays the initially calling hovlet. (The looks of the browser can be defined by the root-hovlet using the method browse(...).) Otherwise the hovlet is simply shown in the corresponding browser.

A Hovlet has the following properties:
A hovlet must be able to connect to the Hoverball Simulator. For this, it has the methods connect(...) and disconnect() at its disposal, but the connecting itself is not yet implemented.-
Field Summary
Fields Modifier and Type Field Description static java.awt.Color
background
Default background color for all new hovletsstatic int
BANNER
Height of the hovlet banner (in pixels)static java.awt.Color
foreground
Default foreground color for all new hovletsHovlet[]
hovlets
Sub-hovletsjavax.swing.JPanel
icon
Icon panel of the hovletjavax.swing.JPanel
main
Main panel of the hovletjavax.swing.JMenuBar
menubar
Menu bar of the hovletHovlet
parent
Super-hovlet (null
, if root)java.lang.String
title
Title of the hovlet -
Constructor Summary
-
Method Summary
Modifier and Type Method Description boolean
add(Hovlet hovlet)
Adds a hovlet to this hovlet.void
browse(javax.swing.JInternalFrame browser)
Alters the looks of the browser if the hovlet is the root-hovlet.void
close()
Closes the hovlet.boolean
connect(java.lang.String address)
Connects the hovlet to the specified address.protected boolean
connecting(java.lang.String address)
Void for the implementation of connecting.void
disconnect()
Disconnects the hovlet.protected void
disconnecting()
Void for the implementation of disconnecting.void
locate(int x, int y)
Demands the browser position.void
locate(java.awt.Point location)
Demands the browser position.void
show()
Shows the hovlet.void
status(java.lang.String status)
Displays a text in the status line of the browser.java.lang.String
title(java.lang.String separator)
Returns the title of the hovlet with its path.
-
Field Details
-
background
public static java.awt.Color backgroundDefault background color for all new hovlets -
foreground
public static java.awt.Color foregroundDefault foreground color for all new hovlets -
BANNER
public static final int BANNERHeight of the hovlet banner (in pixels)- See Also:
- Constant Field Values
-
parent
Super-hovlet (null
, if root) -
hovlets
Sub-hovlets -
title
public final java.lang.String titleTitle of the hovlet -
menubar
public final javax.swing.JMenuBar menubarMenu bar of the hovlet -
icon
public final javax.swing.JPanel iconIcon panel of the hovlet -
main
public final javax.swing.JPanel mainMain panel of the hovlet
-
-
Constructor Details
-
Hovlet
public Hovlet(java.lang.String title)Creates an empty hovlet.- Parameters:
title
- title of the hovlet
-
Hovlet
public Hovlet(java.lang.String title, boolean upward, boolean downward)Creates an empty hovlet with the indicated connectabilities.- Parameters:
title
- title of the hovletupward
- connectable upward?downward
- connectable downward?
-
-
Method Details
-
close
public void close()Closes the hovlet. -
title
public java.lang.String title(java.lang.String separator)Returns the title of the hovlet with its path.- Parameters:
separator
- separating character string for the path- Returns:
- title with path
-
add
Adds a hovlet to this hovlet.If the connection of the hovlets is not valid, or if one of them is already connected or displayed, connection cannot succeed.
- Parameters:
hovlet
- hovlet- Returns:
true
, if connection succeededfalse
, if connection failed
-
show
public void show()Shows the hovlet.If this is the first call of show() by all hovlets within the hovlet tree, a new browser is opened showing the hovlet. Otherwise the hovlet is simply shown.
-
status
public void status(java.lang.String status)Displays a text in the status line of the browser.The argument
null
displays the default status of the browser.- Parameters:
status
- status
-
locate
public void locate(int x, int y)Demands the browser position.If the hovlet is a root-hovlet, the browser will be positioned on opening at the indicated place.
- Parameters:
x
- x-coordinate of the required browser positiony
- y-coordinate of the required browser position
-
locate
public void locate(java.awt.Point location)Demands the browser position.If the hovlet is a root-hovlet, the browser will be positioned on opening at the indicated place.
- Parameters:
location
- required browser position
-
browse
public void browse(javax.swing.JInternalFrame browser)Alters the looks of the browser if the hovlet is the root-hovlet.If a hovlet tree has to be shown in a browser, it is the root-hovlet that determines its looks by modifying the frame of the browser. The browser itself is not yet visible.
This method is empty and can be overwritten.
- Parameters:
browser
- frame of the browser
-
connect
public boolean connect(java.lang.String address)Connects the hovlet to the specified address.- Parameters:
address
- network address- Returns:
true
, if connection succeeded
-
disconnect
public void disconnect()Disconnects the hovlet. -
connecting
protected boolean connecting(java.lang.String address)Void for the implementation of connecting.The method should return
true
if the connection succeeded.The present content of this method successively connects all sub-hovlets to the indicated address and returns
true
if at least one connection succeeded. If required, you can access this code by super.connecting(...)- Parameters:
address
- network address- Returns:
true
, if connection succeeded
-
disconnecting
protected void disconnecting()Void for the implementation of disconnecting.The present content of this method disconnects sucessively all sub-hovlets. If required, you can access this code by super.connecting(...)
-