org.millstone.base.ui
Class Panel

java.lang.Object
  |
  +--org.millstone.base.ui.AbstractComponent
        |
        +--org.millstone.base.ui.AbstractComponentContainer
              |
              +--org.millstone.base.ui.Panel
All Implemented Interfaces:
Component, ComponentContainer, ComponentContainer.ComponentAttachListener, ComponentContainer.ComponentDetachListener, java.util.EventListener, MethodEventSource, Paintable, Scrollable, Sizeable, VariableOwner
Direct Known Subclasses:
Window

public class Panel
extends AbstractComponentContainer
implements Sizeable, Scrollable, ComponentContainer.ComponentAttachListener, ComponentContainer.ComponentDetachListener

Panel - a simple single component container.

Since:
3.0
Version:
3.0.3
Author:
IT Mill Ltd.

Nested Class Summary
 
Nested classes inherited from class org.millstone.base.ui.ComponentContainer
ComponentContainer.ComponentAttachEvent, ComponentContainer.ComponentAttachListener, ComponentContainer.ComponentDetachEvent, ComponentContainer.ComponentDetachListener
 
Nested classes inherited from class org.millstone.base.ui.Component
Component.Event, Component.Listener
 
Nested classes inherited from class org.millstone.base.terminal.Paintable
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener
 
Field Summary
 
Fields inherited from interface org.millstone.base.terminal.Sizeable
UNIT_SYMBOLS, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
 
Constructor Summary
Panel()
          Create new empty panel.
Panel(Layout layout)
          Create new empty panel with given layout.
Panel(java.lang.String caption)
          Create new empty panel with caption.
Panel(java.lang.String caption, Layout layout)
          Create new empty panel with caption.
 
Method Summary
 void addComponent(Component c)
          Add a component into this container.
 void changeVariables(java.lang.Object source, java.util.Map variables)
          Called when one or more variables handled by the implementing class are changed.
 void componentAttachedToContainer(ComponentContainer.ComponentAttachEvent event)
          Pass the events from underlying layout forwards.
 void componentDetachedFromContainer(ComponentContainer.ComponentDetachEvent event)
          Pass the events from underlying layout forwards.
 java.util.Iterator getComponentIterator()
          Get component container iterator for going trough all the components in the container.
 int getHeight()
          Get height of the object.
 int getHeightUnits()
          Get height property units.
 Layout getLayout()
          Get the current layout of the panel.
 int getScrollOffsetX()
          Get scroll X offset.
 int getScrollOffsetY()
          Get scroll Y offset.
 java.lang.String getTag()
          Get component UIDL tag.
 int getWidth()
          Get width of the object.
 int getWidthUnits()
          Get width property units.
 boolean isScrollable()
          Is the scrolling enabled.
 void paintContent(PaintTarget target)
          Paint the content of this component.
 void removeComponent(Component c)
          Remove a component from this container.
 void replaceComponent(Component oldComponent, Component newComponent)
          Replace a component in the container with another one without changing position.
 void setHeight(int height)
          Sets the height in pixels.
 void setHeightUnits(int units)
          Set height units.
 void setLayout(Layout layout)
          Set the layout of the panel.
 void setScrollable(boolean isScrollingEnabled)
          Enable or disable scrolling..
 void setScrollOffsetX(int pixelsScrolledLeft)
          Set scroll X offset.
 void setScrollOffsetY(int pixelsScrolledDown)
          Set scroll Y offset.
 void setWidth(int width)
          Sets the width in pixels.
 void setWidthUnits(int units)
          Set width units.
 
Methods inherited from class org.millstone.base.ui.AbstractComponentContainer
addListener, addListener, attach, detach, fireComponentAttachEvent, fireComponentDetachEvent, moveComponentsFrom, removeAllComponents, removeListener, removeListener
 
Methods inherited from class org.millstone.base.ui.AbstractComponent
addListener, addListener, addListener, addListener, childRequestedRepaint, dependsOn, fireComponentEvent, fireEvent, getApplication, getCaption, getComponentError, getDescription, getDirectDependencies, getErrorMessage, getIcon, getLocale, getParent, getStyle, getWindow, isEnabled, isImmediate, isReadOnly, isVisible, paint, removeDirectDependency, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setDescription, setEnabled, setIcon, setImmediate, setLocale, setParent, setReadOnly, setStyle, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.millstone.base.ui.Component
addListener, childRequestedRepaint, getApplication, getCaption, getIcon, getLocale, getParent, getStyle, getWindow, isEnabled, isImmediate, isReadOnly, isVisible, removeListener, setEnabled, setParent, setReadOnly, setStyle, setVisible
 
Methods inherited from interface org.millstone.base.terminal.Paintable
addListener, paint, removeListener, requestRepaint, requestRepaintRequests
 
Methods inherited from interface org.millstone.base.terminal.VariableOwner
dependsOn, getDirectDependencies, removeDirectDependency
 

Constructor Detail

Panel

public Panel()
Create new empty panel. Ordered layout is used.


Panel

public Panel(Layout layout)
Create new empty panel with given layout. Layout must be non-null.

Parameters:
layout - The layout used in the panel.

Panel

public Panel(java.lang.String caption)
Create new empty panel with caption. Ordered layout is used.

Parameters:
caption - The caption used in the panel.

Panel

public Panel(java.lang.String caption,
             Layout layout)
Create new empty panel with caption.

Parameters:
caption - The caption of the panel.
layout - The layout used in the panel.
Method Detail

getLayout

public Layout getLayout()
Get the current layout of the panel.

Returns:
Current layout of the panel.

setLayout

public void setLayout(Layout layout)
Set the layout of the panel. All the components are moved to new layout.

Parameters:
layout - New layout of the panel.

paintContent

public void paintContent(PaintTarget target)
                  throws PaintException
Paint the content of this component.

Overrides:
paintContent in class AbstractComponent
Parameters:
target - target UIDL stream where the component should paint itself to
Throws:
PaintException - The paint operation failed.

getTag

public java.lang.String getTag()
Get component UIDL tag.

Specified by:
getTag in class AbstractComponent
Returns:
Component UIDL tag as string.

addComponent

public void addComponent(Component c)
Add a component into this container.

Specified by:
addComponent in interface ComponentContainer
Overrides:
addComponent in class AbstractComponentContainer
Parameters:
c - The component to be added.
See Also:
ComponentContainer.addComponent(Component)

removeComponent

public void removeComponent(Component c)
Remove a component from this container.

Specified by:
removeComponent in interface ComponentContainer
Overrides:
removeComponent in class AbstractComponentContainer
Parameters:
c - The component to be added.
See Also:
ComponentContainer.removeComponent(Component)

getComponentIterator

public java.util.Iterator getComponentIterator()
Get component container iterator for going trough all the components in the container.

Specified by:
getComponentIterator in interface ComponentContainer
Returns:
Iterator of the components inside the container.

getHeight

public int getHeight()
Description copied from interface: Sizeable
Get height of the object. Negative number implies unspecified size (terminal is free to set the size).

Specified by:
getHeight in interface Sizeable
Returns:
The height in pixels or negative value if not assigned.

getWidth

public int getWidth()
Description copied from interface: Sizeable
Get width of the object. Negative number implies unspecified size (terminal is free to set the size).

Specified by:
getWidth in interface Sizeable
Returns:
The width in pixels or negative value if not assigned.

setHeight

public void setHeight(int height)
Sets the height in pixels. Use negative value to let the client decide the height.

Specified by:
setHeight in interface Sizeable
Parameters:
height - The height to set

setWidth

public void setWidth(int width)
Sets the width in pixels. Use negative value to allow the client decide the width.

Specified by:
setWidth in interface Sizeable
Parameters:
width - The width to set

changeVariables

public void changeVariables(java.lang.Object source,
                            java.util.Map variables)
Description copied from interface: VariableOwner
Called when one or more variables handled by the implementing class are changed.

Specified by:
changeVariables in interface VariableOwner
Overrides:
changeVariables in class AbstractComponent
Parameters:
source - Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.
variables - Mapping from variable names to new variable values
See Also:
VariableOwner.changeVariables(Object, Map)

getHeightUnits

public int getHeightUnits()
Description copied from interface: Sizeable
Get height property units.

Specified by:
getHeightUnits in interface Sizeable
Returns:
units used in height property.
See Also:
Sizeable.getHeightUnits()

getWidthUnits

public int getWidthUnits()
Description copied from interface: Sizeable
Get width property units.

Specified by:
getWidthUnits in interface Sizeable
Returns:
units used in width property.
See Also:
Sizeable.getWidthUnits()

setHeightUnits

public void setHeightUnits(int units)
Set height units. Panel supports only Sizeable.UNITS_PIXELS and this is ignored.

Specified by:
setHeightUnits in interface Sizeable
Parameters:
units - units used in height property.
See Also:
millstone.base.terminal.Sizeable#setHeightUnits(int)

setWidthUnits

public void setWidthUnits(int units)
Set width units. Panel supports only Sizeable.UNITS_PIXELS, and this is ignored.

Specified by:
setWidthUnits in interface Sizeable
Parameters:
units - units used in width property.
See Also:
Sizeable.setWidthUnits(int)

getScrollOffsetX

public int getScrollOffsetX()
Description copied from interface: Scrollable
Get scroll X offset.

Scrolling offset is the number of pixels this scrollable has been scrolled to left.

Specified by:
getScrollOffsetX in interface Scrollable
Returns:
Horizontal scrolling position in pixels.

getScrollOffsetY

public int getScrollOffsetY()
Description copied from interface: Scrollable
Get scroll Y offset.

Scrolling offset is the number of pixels this scrollable has been scrolled to down.

Specified by:
getScrollOffsetY in interface Scrollable
Returns:
Vertical scrolling position in pixels.

isScrollable

public boolean isScrollable()
Description copied from interface: Scrollable
Is the scrolling enabled.

Enabling scrolling allows the user to scroll the scrollable view interactively

Specified by:
isScrollable in interface Scrollable
Returns:
True iff the scrolling is allowed.

setScrollable

public void setScrollable(boolean isScrollingEnabled)
Description copied from interface: Scrollable
Enable or disable scrolling..

Enabling scrolling allows the user to scroll the scrollable view interactively

Specified by:
setScrollable in interface Scrollable
Parameters:
isScrollingEnabled - True iff the scrolling is allowed.

setScrollOffsetX

public void setScrollOffsetX(int pixelsScrolledLeft)
Description copied from interface: Scrollable
Set scroll X offset.

Scrolling offset is the number of pixels this scrollable has been scrolled to left.

Specified by:
setScrollOffsetX in interface Scrollable

setScrollOffsetY

public void setScrollOffsetY(int pixelsScrolledDown)
Description copied from interface: Scrollable
Set scroll Y offset.

Scrolling offset is the number of pixels this scrollable has been scrolled to down.

Specified by:
setScrollOffsetY in interface Scrollable

replaceComponent

public void replaceComponent(Component oldComponent,
                             Component newComponent)
Description copied from interface: ComponentContainer
Replace a component in the container with another one without changing position.

This method replaces component with another one is such way that the new component overtakes the position of the old component. If the old component is not in the container, the new component is added to the container. If the both component are already in the container, their positions are swapped. Component attach and detach events should be taken care as with add and remove.

Specified by:
replaceComponent in interface ComponentContainer
Parameters:
oldComponent - The old component that will be replaced.
newComponent - The new component to be replaced

componentAttachedToContainer

public void componentAttachedToContainer(ComponentContainer.ComponentAttachEvent event)
Pass the events from underlying layout forwards.

Specified by:
componentAttachedToContainer in interface ComponentContainer.ComponentAttachListener
See Also:
ComponentContainer.ComponentAttachListener.componentAttachedToContainer(org.millstone.base.ui.ComponentContainer.ComponentAttachEvent)

componentDetachedFromContainer

public void componentDetachedFromContainer(ComponentContainer.ComponentDetachEvent event)
Pass the events from underlying layout forwards.

Specified by:
componentDetachedFromContainer in interface ComponentContainer.ComponentDetachListener
See Also:
ComponentContainer.ComponentDetachListener.componentDetachedFromContainer(org.millstone.base.ui.ComponentContainer.ComponentDetachEvent)


Copyright © 2000,2001,2002 IT Mill Ltd. All Rights Reserved.