JavaView® v2.00.008

jv.object
Class PsPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--jv.object.PsPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, PsUpdateIf, java.io.Serializable
Direct Known Subclasses:
MyClass_IP, PdArray_IP, PdColor_IP, PdVector_IP, PgAxes_CP, PgCatenoid_CP, PgDomain_CP, PgDomainDescr_IP, PgGraph_CP, PgParmSurface_IP, PgPointSet_IP, PgPointSet_MP, PgRuler_CP, PgSurfacePair_IP, PgTube_CP, PgVectorField_IP, PgWeierstrassDescr_IP, PiArray_IP, PiVector_IP, PjEvolve_IP, PjProject_IP, PnCellOperator_IP, PnEnergyMinimizer_IP, PsAnimation_IP, PsAuthorInfo_IP, PsCategoryList_IP, PsGeometryInfo_IP, PsTabPanel, PuColorPicker, PuComplexP_IP, PuDouble_IP, PuFunction_EvalPanel, PuFunction_IP, PuInteger_IP, PvCamera_IP, PvDisplay_IP, PwClip_IP, PwGeodesic_IP, PwHodge_IP, PwLIC_IP, PwModel_IP, PwPlatonic_IP, PwSimplify_IP, PwVectorField_IP, slider_IP

public class PsPanel
extends java.awt.Panel
implements PsUpdateIf, java.io.Serializable

Default base class for info panels, and often used instead of Panel. Implements the update mechanism and simplifies setting of layouts. Each non-gui class may have associated inspectors derived from PsPanel. Subclasses must call the init() method in each constructor and each init() method must call super.init() at first.

	public class myClass extends mySuperClass
		public myClass() {
			...
			if (getClass() == myClass.class)
				init();
		}
		public void init() {
			super.init();
			...
		}
 
Only this ensures that the init() method is called. Otherwise even the init() methods of the superclasses will not be called.

Version:
12.11.00, 2.30 revised (kp) Drawing of background image implemented.
10.08.00, 2.02 revised (kp) Static constants _LAYOUT removed.
10.08.00, 2.01 revised (kp) Methods fillBottom(), add(Component), setLayout(LayoutManager) removed.
10.08.00, 2.00 revised (kp) No longer special handling for GridBagLayout, instance variables removed.
20.03.00, 1.20 revised (kp) Constructor changed to different instanceOf method.
23.01.99, 1.10 revised (kp) Initialization with setParent instead of update.
00.00.97, 1.00 created (kp)
Author:
Konrad Polthier
See Also:
Serialized Form

Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static int BORDER_GROOVE
           
static int BORDER_LINE
           
static int BORDER_NONE
           
static int BORDER_SUNK
           
protected  int m_borderType
           
protected  boolean m_bOutOfDate
          Flag determines whether this panel is out of sync with its parent.
protected  java.awt.Image m_image
          Image to be shown in the background of the canvas.
protected  int m_insetSize
           
protected  java.lang.String m_language
          Language used for text on this panel during construction.
protected  java.awt.Label m_lTitle
          Title of panel usually displayed in bold.
protected  PsUpdateIf m_parent
          Sends update events to this instance.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PsPanel()
          Constructor of panel with PsStackLayout(1) as default layout.
 
Method Summary
 java.awt.Panel addLabelComponent(java.lang.String label, java.awt.Component comp)
          Add a horizontal panel with a label and a component with GridLayout(1, 2).
 void addLine(int size)
          Add a horizontal line with specified thickness as separator.
 java.awt.Label addSubTitle(java.lang.String aTitle)
          Add subtitle to dialog in subheader font and return label.
 java.awt.TextField addTextField(java.lang.String title, int length)
          Add a label and textField in a horizontal panel with GridLayout(1, 2).
 java.awt.Label addTitle(java.lang.String aTitle)
          Add title to dialog in header font and return label m_lTitle.
static void drawBorder(java.awt.Component comp, java.awt.Graphics g, int borderType)
          Draw border around panel.
 void drawBorder(java.awt.Graphics g, int borderType)
          Draw border around panel.
 void drawText(java.awt.Graphics g, java.awt.Point point, java.lang.String string)
          Draw text at specified position.
 PsUpdateIf getFather()
          Get parent and do nothing else.
 java.awt.Insets getInsets()
          Overwrite Container.getInsets() to create a border of m_insetSize pixels to allow drawing of a border around panel.
 java.lang.String getLanguage()
          Get language used in this panel.
 java.awt.Label getTitle()
          Get label of panel title, or null of no title exists.
 boolean hasTitle()
          Check whether dialog has a title.
 void init()
           
 boolean instanceOf(java.lang.String aClassName)
          Deprecated. use "if (getClass() == PsObject.class)" instead
 void paint(java.awt.Graphics g)
          Call super.paint(g) and draw border around panel.
 void setBorderType(int borderType)
          Set border of panel which is automatically drawn.
 void setImage(java.awt.Image image)
          Image to be shown in the background of the canvas and set layout to null.
 void setInsetSize(int size)
           
 void setOutOfDate(boolean state)
          Mark this panel as being not synchronized with the correct data of its parent.
 void setParent(PsUpdateIf aParent)
          Set parent and do nothing else.
 void setTitle(java.lang.String title)
          Set string of panel title.
 void setVisible(boolean flag)
          Override Component.setVisible(boolean) to give panel a chance to update its content when is becomes visible.
 void update(java.awt.Graphics g)
          Override Component.update(Graphics) to avoid clearing the component if an image is available.
 boolean update(java.lang.Object event)
          Update the class whenever a child has changed.
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jv.object.PsUpdateIf
getName
 

Field Detail

BORDER_NONE

public static final int BORDER_NONE

BORDER_LINE

public static final int BORDER_LINE

BORDER_SUNK

public static final int BORDER_SUNK

BORDER_GROOVE

public static final int BORDER_GROOVE

m_borderType

protected int m_borderType

m_insetSize

protected int m_insetSize

m_lTitle

protected java.awt.Label m_lTitle
Title of panel usually displayed in bold.
See Also:
addTitle(String), addSubTitle(String), setTitle(String)

m_language

protected java.lang.String m_language
Language used for text on this panel during construction. This reference is used to decide if panel is out of date when language changes.
See Also:
getLanguage()

m_parent

protected PsUpdateIf m_parent
Sends update events to this instance.
See Also:
PsObject.update(Object)

m_image

protected java.awt.Image m_image
Image to be shown in the background of the canvas. Currently, this should only be used if no components are added to panel.

m_bOutOfDate

protected boolean m_bOutOfDate
Flag determines whether this panel is out of sync with its parent.
See Also:
setOutOfDate(boolean)
Constructor Detail

PsPanel

public PsPanel()
Constructor of panel with PsStackLayout(1) as default layout.
Method Detail

init

public void init()

getLanguage

public java.lang.String getLanguage()
Get language used in this panel.

setImage

public void setImage(java.awt.Image image)
Image to be shown in the background of the canvas and set layout to null. Currently, this should only be used if no components are added to panel.

setVisible

public void setVisible(boolean flag)
Override Component.setVisible(boolean) to give panel a chance to update its content when is becomes visible. Parent of panel usually does not update panel if panel is hidden.
Overrides:
setVisible in class java.awt.Component

getFather

public PsUpdateIf getFather()
Description copied from interface: PsUpdateIf
Get parent and do nothing else.
Specified by:
getFather in interface PsUpdateIf
Following copied from interface: jv.object.PsUpdateIf
See Also:
PsUpdateIf.setParent(PsUpdateIf), PsUpdateIf.update(Object)

setParent

public void setParent(PsUpdateIf aParent)
Description copied from interface: PsUpdateIf
Set parent and do nothing else. Method is implemented by PsObject and PsPanel, and should be called if overwritten.
Specified by:
setParent in interface PsUpdateIf
Following copied from interface: jv.object.PsUpdateIf
Parameters:
aParent - will receive events which this does not handle
See Also:
PsUpdateIf.getFather(), PsUpdateIf.update(Object)

update

public boolean update(java.lang.Object event)
Update the class whenever a child has changed. Method is usually invoked from the children.
Specified by:
update in interface PsUpdateIf
Following copied from interface: jv.object.PsUpdateIf
Parameters:
event - carries a lot of information
Returns:
true if event has been handled, otherwise false
See Also:
PsObject, PsUpdateIf.getFather(), PsUpdateIf.setParent(PsUpdateIf)

instanceOf

public final boolean instanceOf(java.lang.String aClassName)
Deprecated. use "if (getClass() == PsObject.class)" instead

Return true iff string is exact classname of current instance. Even if string denotes a super class method returns false. This method is different from Java operator instanceof which is true even if current instance is subclass of class 'aClassName'.
Parameters:
aClassName - name of class without package identifiers
Returns:
true if current object is exact instance of class

getInsets

public java.awt.Insets getInsets()
Overwrite Container.getInsets() to create a border of m_insetSize pixels to allow drawing of a border around panel.
Overrides:
getInsets in class java.awt.Container
See Also:
setInsetSize(int), setBorderType(int)

setInsetSize

public void setInsetSize(int size)

getTitle

public java.awt.Label getTitle()
Get label of panel title, or null of no title exists.

hasTitle

public boolean hasTitle()
Check whether dialog has a title.

setTitle

public void setTitle(java.lang.String title)
Set string of panel title. Method does not add the title to the panel.

addTitle

public java.awt.Label addTitle(java.lang.String aTitle)
Add title to dialog in header font and return label m_lTitle.

addSubTitle

public java.awt.Label addSubTitle(java.lang.String aTitle)
Add subtitle to dialog in subheader font and return label.

addLine

public void addLine(int size)
Add a horizontal line with specified thickness as separator.

addTextField

public java.awt.TextField addTextField(java.lang.String title,
                                       int length)
Add a label and textField in a horizontal panel with GridLayout(1, 2).

addLabelComponent

public java.awt.Panel addLabelComponent(java.lang.String label,
                                        java.awt.Component comp)
Add a horizontal panel with a label and a component with GridLayout(1, 2).

drawText

public void drawText(java.awt.Graphics g,
                     java.awt.Point point,
                     java.lang.String string)
Draw text at specified position.

drawBorder

public void drawBorder(java.awt.Graphics g,
                       int borderType)
Draw border around panel.

drawBorder

public static void drawBorder(java.awt.Component comp,
                              java.awt.Graphics g,
                              int borderType)
Draw border around panel.

setBorderType

public void setBorderType(int borderType)
Set border of panel which is automatically drawn. If borderType==PsPanel.BORDER_NONE drawing is disabled, otherwise the borderType is set and drawing is enabled.
Parameters:
borderType - type of border, for possible values see PsPanel.
See Also:
paint(Graphics)

setOutOfDate

public void setOutOfDate(boolean state)
Mark this panel as being not synchronized with the correct data of its parent. Usually, this method is invoked whenever a parent changes but this panel is temporarily not visible. In this case the next invocation of this paint(Graphics) method will at first update this panel with new data from its parent by calling this.update(m_parent).

paint

public void paint(java.awt.Graphics g)
Call super.paint(g) and draw border around panel. If this panel is out of date, then this panel is first synchronised with new data from its parent by calling this.update(m_parent).
Overrides:
paint in class java.awt.Container
See Also:
setBorderType(int)

update

public void update(java.awt.Graphics g)
Override Component.update(Graphics) to avoid clearing the component if an image is available.
Overrides:
update in class java.awt.Container

JavaView® v2.00.008

The software JavaView® is copyright protected. All Rights Reserved.