public abstract class UI extends javax.swing.JFrame implements java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.KeyListener, StopableObject, java.awt.event.WindowListener
ActionListener
, MouseListener
, KeyListener
and WindowListener
support. The required method may need to be implemented within the subclasses.javax.swing.JFrame.AccessibleJFrame
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
Modifier and Type | Field and Description |
---|---|
private javax.swing.JPanel |
body
The main
JPanel . |
private boolean |
internalStandalone
Is this interface started from another interface or for itself?
|
private javax.swing.JFrame |
parent
The parent window, from which this interfaces was created.
|
private java.util.Random |
rand
A random number generator.
|
private int |
refreshInterval
Refresh interval in milliseconds.
|
private static long |
serialVersionUID
Some unique serial version id.
|
private java.util.Map<java.lang.String,java.lang.String> |
settingsCommon
The common settings, loaded from the general user interface configuration file.
|
private java.util.Map<java.lang.String,java.lang.String> |
settingsFrame
The frame settings, loaded from the frame dependent configuration file.
|
private javax.swing.Timer |
timer
The repaint
Timer . |
private java.lang.String |
type
The windows type.
|
private int |
windowHeight
The height of the user interface.
|
private int |
windowWidth
The width of the user interface.
|
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Modifier | Constructor and Description |
---|---|
protected |
UI(java.lang.String title)
Protected constructor of this
UI to prevent the creation of direct instances of this class. |
protected |
UI(java.lang.String title,
javax.swing.JFrame parentWindow)
Protected constructor of this
UI to prevent the creation of direct instances of this class. |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
protected void |
addBody(java.awt.Component x)
Adds an element as
Component to the body of this user interface. |
protected abstract void |
addMenu()
This method adds a menu to the user interface.
|
protected void |
autoPosition()
The method centers the user interface to the middle of the screen.
|
protected void |
build()
This method builds the interface.
|
protected void |
fixBounds(boolean refresh)
Corrects the position and size of the window by
autoPosition() if refresh is supplied as
true , otherwise only the size will be updated. |
protected javax.swing.JPanel |
getBody()
Returns the body of the the user interface as
JPanel . |
protected java.lang.String |
getCommonConfigValue(java.lang.String key)
Returns a common configuration value as
String specified by the key if existing, otherwise
null . |
private java.lang.String |
getCommonConfigValue(java.lang.String key,
boolean internalCall)
Returns a common configuration value as
String specified by the key if existing, otherwise
null . |
protected java.lang.String |
getConfigValue(java.lang.String key)
Returns the value of a configuration variable specified by key as
String if existing, otherwise
null . |
protected java.lang.Integer |
getConfigValueAsInteger(java.lang.String key)
Returns the value of a configuration variable specified by key as
Integer if existing, otherwise
null . |
protected java.lang.String |
getFrameConfigValue(java.lang.String key)
Returns a frame (local) configuration value as
String specified by the key if existing, otherwise
null . |
private java.lang.String |
getFrameConfigValue(java.lang.String key,
boolean internalCall)
Returns a frame (local) configuration value as
String specified by the key if existing, otherwise
null . |
protected java.lang.Integer |
getFrameConfigValueAsInteger(java.lang.String key)
Returns the value of a frame (local) configuration variable specified by key as
Integer if
existing, otherwise null . |
protected java.awt.GridLayout |
getGrid(int rowsIn,
int colsIn)
Returns a user interface grid.
|
java.lang.String |
getId()
Generates a random ID for this
UI . |
protected javax.swing.JFrame |
getParentWindow()
Returns the parent window if existing as
JFrame , otherwise null . |
protected javax.swing.Timer |
getTimer()
Returns the timer thread as
Timer if existing, otherwise null . |
protected int |
getWindowHeight()
Returns the height of this window as integer.
|
protected int |
getWindowWidth()
Returns the width of this window as integer.
|
protected void |
infoDialog(java.lang.String msg)
Creates an information dialog containing a specified message.
|
boolean |
isStandalone()
Determines if the interface is standing alone (has no parent window).
|
void |
keyPressed(java.awt.event.KeyEvent arg0) |
void |
keyReleased(java.awt.event.KeyEvent arg0) |
void |
keyTyped(java.awt.event.KeyEvent arg0) |
void |
killWindow()
Destroys this interface.
|
protected void |
loadConfig()
Load the configuration from the default configuration file.
|
protected void |
loadLocalConfig(java.lang.String configFile)
Loads the local configuration of the user interface from file.
|
void |
mouseClicked(java.awt.event.MouseEvent e) |
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e) |
void |
mouseReleased(java.awt.event.MouseEvent e) |
void |
refresh()
|
abstract void |
refresh(boolean refresh)
(Re-)builds the rendering of the
UI . |
protected void |
setWindowHeight(int height)
Sets/changes the height of this window to a new value.
|
protected void |
setWindowWidth(int width)
Sets/changes the width of this window to a new value.
|
abstract void |
shutDown()
Shuts the object down.
|
protected void |
stopTimer()
Stop a running refresh timer if existing.
|
void |
windowActivated(java.awt.event.WindowEvent arg0) |
void |
windowClosed(java.awt.event.WindowEvent arg0) |
void |
windowClosing(java.awt.event.WindowEvent arg0) |
void |
windowDeactivated(java.awt.event.WindowEvent arg0) |
void |
windowDeiconified(java.awt.event.WindowEvent arg0) |
void |
windowIconified(java.awt.event.WindowEvent arg0) |
void |
windowOpened(java.awt.event.WindowEvent arg0) |
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isActive
private static final long serialVersionUID
private boolean internalStandalone
private java.lang.String type
private javax.swing.JFrame parent
private java.util.Random rand
private javax.swing.JPanel body
JPanel
.private javax.swing.Timer timer
Timer
.private int windowWidth
private int windowHeight
private int refreshInterval
private java.util.Map<java.lang.String,java.lang.String> settingsCommon
private java.util.Map<java.lang.String,java.lang.String> settingsFrame
protected UI(java.lang.String title)
UI
to prevent the creation of direct instances of this class.UI(String, JFrame)
with null
.title
- The title of the user interface as String
.protected UI(java.lang.String title, javax.swing.JFrame parentWindow)
UI
to prevent the creation of direct instances of this class.title
- The title of the user interface as String
.parentWindow
- The parent window which created this user interface, if existing.protected final void build()
protected final void loadConfig()
protected void loadLocalConfig(java.lang.String configFile)
configFile
- The path to the configuration file as String
.protected final void autoPosition()
protected final void fixBounds(boolean refresh)
autoPosition()
if refresh is supplied as
true
, otherwise only the size will be updated.refresh
- If set to true
only the size will be updated, otherwise position as well.protected abstract void addMenu()
protected final java.awt.GridLayout getGrid(int rowsIn, int colsIn)
rowsIn
- Amount of rows to be displayedcolsIn
- Amount of columns to be displayedprotected final javax.swing.JPanel getBody()
JPanel
.JPanel
.protected final javax.swing.JFrame getParentWindow()
JFrame
, otherwise null
.JFrame
if existing, otherwise null
.protected final javax.swing.Timer getTimer()
Timer
if existing, otherwise null
.Timer
if existing, otherwise null
.protected final int getWindowHeight()
protected final void setWindowHeight(int height)
height
- The new height of this window as integer.protected final int getWindowWidth()
protected final void setWindowWidth(int width)
width
- The new width of this window as integer.protected final java.lang.String getConfigValue(java.lang.String key)
String
if existing, otherwise
null
.key
- The name of the configuration variable as String
.String
if existing, otherwise
null
.protected final java.lang.Integer getConfigValueAsInteger(java.lang.String key)
Integer
if existing, otherwise
null
.key
- The name of the configuration variable as String
.Integer
if existing, otherwise
null
.protected final java.lang.String getCommonConfigValue(java.lang.String key)
String
specified by the key if existing, otherwise
null
.key
- The name of the common configuration variable as String
.String
if existing, otherwise
null
.private java.lang.String getCommonConfigValue(java.lang.String key, boolean internalCall)
String
specified by the key if existing, otherwise
null
.key
- The name of the common configuration variable as String
.internalCall
- If true
and the variable couldn't be found, no error will be published.String
if existing, otherwise
null
.protected final java.lang.String getFrameConfigValue(java.lang.String key)
String
specified by the key if existing, otherwise
null
.key
- The name of the frame (local) configuration variable as String
.String
if existing,
otherwise null
.private java.lang.String getFrameConfigValue(java.lang.String key, boolean internalCall)
String
specified by the key if existing, otherwise
null
.key
- The name of the frame (local) configuration variable as String
.internalCall
- If true
and the variable couldn't be found, no error will be published.String
if existing,
otherwise null
.protected final java.lang.Integer getFrameConfigValueAsInteger(java.lang.String key)
Integer
if
existing, otherwise null
.key
- The name of the frame (local) configuration variable as String
.Integer
if existing,
otherwise null
.protected final void addBody(java.awt.Component x)
Component
to the body
of this user interface.x
- The Component
which shall be added to the body
of this interface.public final boolean isStandalone()
true
if its standing alone (has no parent window), otherwise
false
.public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- An ActionEvent
.This method needs to be specified by the sub-class, if required.
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
e
- A MouseEvent
.This method needs to be specified by the sub-class, if required.
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
e
- A MouseEvent
.This method needs to be specified by the sub-class, if required.
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
e
- A MouseEvent
.This method needs to be specified by the sub-class, if required.
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
e
- A MouseEvent
.This method needs to be specified by the sub-class, if required.
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
e
- A MouseEvent
.This method needs to be specified by the sub-class, if required.
public void keyPressed(java.awt.event.KeyEvent arg0)
keyPressed
in interface java.awt.event.KeyListener
arg0
- A KeyEvent
.This method needs to be specified by the sub-class, if required.
public void keyReleased(java.awt.event.KeyEvent arg0)
keyReleased
in interface java.awt.event.KeyListener
arg0
- A KeyEvent
.This method needs to be specified by the sub-class, if required.
public void keyTyped(java.awt.event.KeyEvent arg0)
keyTyped
in interface java.awt.event.KeyListener
arg0
- A KeyEvent
.This method needs to be specified by the sub-class, if required.
public void windowActivated(java.awt.event.WindowEvent arg0)
windowActivated
in interface java.awt.event.WindowListener
arg0
- A WindowEvent
.This method needs to be specified by the sub-class, if required.
public void windowClosed(java.awt.event.WindowEvent arg0)
windowClosed
in interface java.awt.event.WindowListener
arg0
- A WindowEvent
.This method needs to be specified by the sub-class, if required.
public final void windowClosing(java.awt.event.WindowEvent arg0)
windowClosing
in interface java.awt.event.WindowListener
arg0
- A WindowEvent
.WindowListener.windowClosing(java.awt.event.WindowEvent)
public void windowDeactivated(java.awt.event.WindowEvent arg0)
windowDeactivated
in interface java.awt.event.WindowListener
arg0
- A WindowEvent
.This method needs to be specified by the sub-class, if required.
public void windowDeiconified(java.awt.event.WindowEvent arg0)
windowDeiconified
in interface java.awt.event.WindowListener
arg0
- A WindowEvent
.This method needs to be specified by the sub-class, if required.
public void windowIconified(java.awt.event.WindowEvent arg0)
windowIconified
in interface java.awt.event.WindowListener
arg0
- A WindowEvent
.This method needs to be specified by the sub-class, if required.
public void windowOpened(java.awt.event.WindowEvent arg0)
windowOpened
in interface java.awt.event.WindowListener
arg0
- A WindowEvent
.This method needs to be specified by the sub-class, if required.
public final void killWindow()
protected final void stopTimer()
public abstract void shutDown()
StopableObject
shutDown
in interface StopableObject
This method needs to be specified by the sub-class, if required.
protected final void infoDialog(java.lang.String msg)
msg
- A message as String
.public final void refresh()
public abstract void refresh(boolean refresh)
UI
. This method needs to be specified by the sub-class.refresh
- true
indicates that this method is called with the intention to refresh the
page with new data, false
means that it was called as initial build.public final java.lang.String getId()
UI
.