com.itmill.toolkit.ui
Class Panel

java.lang.Object
  extended by com.itmill.toolkit.ui.AbstractComponent
      extended by com.itmill.toolkit.ui.AbstractComponentContainer
          extended by com.itmill.toolkit.ui.Panel
All Implemented Interfaces:
Action.Container, MethodEventSource, Paintable, Scrollable, Sizeable, VariableOwner, Component, ComponentContainer, ComponentContainer.ComponentAttachListener, ComponentContainer.ComponentDetachListener, EventListener
Direct Known Subclasses:
Window

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

Panel - a simple single component container.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class com.itmill.toolkit.ui.AbstractComponent
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler
 
Nested classes/interfaces inherited from interface com.itmill.toolkit.ui.ComponentContainer
ComponentContainer.ComponentAttachEvent, ComponentContainer.ComponentAttachListener, ComponentContainer.ComponentDetachEvent, ComponentContainer.ComponentDetachListener
 
Nested classes/interfaces inherited from interface com.itmill.toolkit.ui.Component
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener
 
Nested classes/interfaces inherited from interface com.itmill.toolkit.terminal.Paintable
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener
 
Field Summary
static String STYLE_LIGHT
           
 
Fields inherited from interface com.itmill.toolkit.terminal.Sizeable
SIZE_UNDEFINED, UNIT_SYMBOLS, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
 
Constructor Summary
Panel()
          Creates a new empty panel.
Panel(Layout layout)
          Creates a new empty panel with given layout.
Panel(String caption)
          Creates a new empty panel with caption.
Panel(String caption, Layout layout)
          Creates a new empty panel with caption.
 
Method Summary
 void addActionHandler(Action.Handler actionHandler)
          Registers a new action handler for this container
 void addComponent(Component c)
          Adds the component into this container.
 void attach()
          Notifies the component that it is connected to an application.
 void changeVariables(Object source, Map variables)
          Called when one or more variables handled by the implementing class are changed.
 void componentAttachedToContainer(ComponentContainer.ComponentAttachEvent event)
          A new component is attached to container.
 void componentDetachedFromContainer(ComponentContainer.ComponentDetachEvent event)
          A component has been detached from container.
 void detach()
          Notifies the component that it is detached from the application.
 Iterator getComponentIterator()
          Gets the component container iterator for going trough all the components in the container.
 Layout getLayout()
          Gets the current layout of the panel.
 int getScrollLeft()
          Gets scroll left offset.
 int getScrollOffsetX()
          Deprecated. use getScrollLeft() instead
 int getScrollOffsetY()
          Deprecated. use getScrollTop() instead
 int getScrollTop()
          Gets scroll top offset.
 String getTag()
          Gets the component UIDL tag.
 boolean isScrollable()
          Is the scrolling enabled.
 void paintContent(PaintTarget target)
          Paints the content of this component.
 void removeActionHandler(Action.Handler actionHandler)
          Removes an action handler.
 void removeAllComponents()
          Removes all components from this container.
 void removeComponent(Component c)
          Removes the component from this container.
 void replaceComponent(Component oldComponent, Component newComponent)
          Replaces the component in the container with another one without changing position.
 void requestRepaintAll()
          Causes a repaint of this component, and all components below it.
 void setLayout(Layout newLayout)
          Sets the layout of the panel.
 void setScrollable(boolean isScrollingEnabled)
          Enables or disables scrolling..
 void setScrollLeft(int pixelsScrolled)
          Sets scroll left offset.
 void setScrollOffsetX(int pixels)
          Deprecated. use setScrollLeft() method instead
 void setScrollOffsetY(int pixels)
          Deprecated. use setScrollTop() method instead
 void setScrollTop(int pixelsScrolledDown)
          Sets scroll top offset.
 
Methods inherited from class com.itmill.toolkit.ui.AbstractComponentContainer
addListener, addListener, fireComponentAttachEvent, fireComponentDetachEvent, moveComponentsFrom, removeListener, removeListener, setEnabled, setHeight, setWidth
 
Methods inherited from class com.itmill.toolkit.ui.AbstractComponent
addListener, addListener, addListener, addListener, addStyleName, childRequestedRepaint, fireComponentErrorEvent, fireComponentEvent, fireEvent, getApplication, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getErrorMessage, getHeight, getHeightUnits, getIcon, getLocale, getParent, getStyle, getStyleName, getWidth, getWidthUnits, getWindow, handleError, isEnabled, isImmediate, isReadOnly, isVisible, paint, removeListener, removeListener, removeListener, removeListener, removeListener, removeStyleName, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setData, setDebugId, setDescription, setErrorHandler, setHeight, setHeight, setHeightUnits, setIcon, setImmediate, setLocale, setParent, setReadOnly, setSizeFull, setSizeUndefined, setStyle, setStyleName, setWidth, setWidth, setWidthUnits, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.itmill.toolkit.ui.Component
addListener, addStyleName, childRequestedRepaint, getApplication, getCaption, getIcon, getLocale, getParent, getStyleName, getWindow, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setIcon, setParent, setReadOnly, setStyleName, setVisible
 
Methods inherited from interface com.itmill.toolkit.terminal.Paintable
addListener, getDebugId, paint, removeListener, requestRepaint, requestRepaintRequests, setDebugId
 
Methods inherited from interface com.itmill.toolkit.terminal.VariableOwner
isImmediate
 
Methods inherited from interface com.itmill.toolkit.terminal.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUnits, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUnits
 

Field Detail

STYLE_LIGHT

public static final String STYLE_LIGHT
See Also:
Constant Field Values
Constructor Detail

Panel

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


Panel

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

Parameters:
layout - the layout used in the panel.

Panel

public Panel(String caption)
Creates a new empty panel with caption. Default layout is used.

Parameters:
caption - the caption used in the panel.

Panel

public Panel(String caption,
             Layout layout)
Creates a 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()
Gets the current layout of the panel.

Returns:
the Current layout of the panel.

setLayout

public void setLayout(Layout newLayout)
Sets the layout of the panel. If given layout is null, a VerticalLayout with margins set is used as a default. Components from old layout are not moved to new layout by default (changed in 5.2.2). Use function in Layout interface manually.

Parameters:
newLayout - the New layout of the panel.

paintContent

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

Overrides:
paintContent in class AbstractComponent
Parameters:
target - the Paint Event.
Throws:
PaintException - if the paint operation failed.

requestRepaintAll

public void requestRepaintAll()
Description copied from interface: ComponentContainer
Causes a repaint of this component, and all components below it. This should only be used in special cases, e.g when the state of a descendant depends on the state of a ancestor.

Specified by:
requestRepaintAll in interface ComponentContainer
Overrides:
requestRepaintAll in class AbstractComponentContainer

getTag

public String getTag()
Gets the component UIDL tag.

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

addComponent

public void addComponent(Component c)
Adds the component into this container.

Specified by:
addComponent in interface ComponentContainer
Overrides:
addComponent in class AbstractComponentContainer
Parameters:
c - the component to be added.
See Also:
AbstractComponentContainer.addComponent(com.itmill.toolkit.ui.Component)

removeComponent

public void removeComponent(Component c)
Removes the component from this container.

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

getComponentIterator

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

Specified by:
getComponentIterator in interface ComponentContainer
Returns:
the Iterator of the components inside the container.
See Also:
ComponentContainer.getComponentIterator()

changeVariables

public void changeVariables(Object source,
                            Map variables)
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 - the Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.
variables - the Mapping from variable names to new variable values.
See Also:
VariableOwner.changeVariables(Object, Map)

getScrollLeft

public int getScrollLeft()
Description copied from interface: Scrollable
Gets scroll left offset.

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

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

getScrollOffsetX

@Deprecated
public int getScrollOffsetX()
Deprecated. use getScrollLeft() instead


getScrollTop

public int getScrollTop()
Description copied from interface: Scrollable
Gets scroll top offset.

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

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

getScrollOffsetY

@Deprecated
public int getScrollOffsetY()
Deprecated. use getScrollTop() instead


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 if the scrolling is allowed, otherwise false.

setScrollable

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

Enabling scrolling allows the user to scroll the scrollable view interactively

Specified by:
setScrollable in interface Scrollable
Parameters:
isScrollingEnabled - true if the scrolling is allowed.

setScrollLeft

public void setScrollLeft(int pixelsScrolled)
Description copied from interface: Scrollable
Sets scroll left offset.

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

Specified by:
setScrollLeft in interface Scrollable
Parameters:
pixelsScrolled - the xOffset.

setScrollOffsetX

@Deprecated
public void setScrollOffsetX(int pixels)
Deprecated. use setScrollLeft() method instead


setScrollTop

public void setScrollTop(int pixelsScrolledDown)
Description copied from interface: Scrollable
Sets scroll top offset.

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

Specified by:
setScrollTop in interface Scrollable
Parameters:
pixelsScrolledDown - the yOffset.

setScrollOffsetY

@Deprecated
public void setScrollOffsetY(int pixels)
Deprecated. use setScrollTop() method instead


replaceComponent

public void replaceComponent(Component oldComponent,
                             Component newComponent)
Description copied from interface: ComponentContainer
Replaces the 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)
A new component is attached to container.

Specified by:
componentAttachedToContainer in interface ComponentContainer.ComponentAttachListener
Parameters:
event - the component attach event.
See Also:
ComponentContainer.ComponentAttachListener.componentAttachedToContainer(com.itmill.toolkit.ui.ComponentContainer.ComponentAttachEvent)

componentDetachedFromContainer

public void componentDetachedFromContainer(ComponentContainer.ComponentDetachEvent event)
A component has been detached from container.

Specified by:
componentDetachedFromContainer in interface ComponentContainer.ComponentDetachListener
Parameters:
event - the component detach event.
See Also:
ComponentContainer.ComponentDetachListener.componentDetachedFromContainer(com.itmill.toolkit.ui.ComponentContainer.ComponentDetachEvent)

attach

public void attach()
Notifies the component that it is connected to an application.

Specified by:
attach in interface Component
Overrides:
attach in class AbstractComponentContainer
See Also:
Component.attach()

detach

public void detach()
Notifies the component that it is detached from the application.

Specified by:
detach in interface Component
Overrides:
detach in class AbstractComponentContainer
See Also:
Component.detach()

removeAllComponents

public void removeAllComponents()
Removes all components from this container.

Specified by:
removeAllComponents in interface ComponentContainer
Overrides:
removeAllComponents in class AbstractComponentContainer
See Also:
ComponentContainer.removeAllComponents()

addActionHandler

public void addActionHandler(Action.Handler actionHandler)
Description copied from interface: Action.Container
Registers a new action handler for this container

Specified by:
addActionHandler in interface Action.Container
Parameters:
actionHandler - the new handler to be added.

removeActionHandler

public void removeActionHandler(Action.Handler actionHandler)
Removes an action handler.

Specified by:
removeActionHandler in interface Action.Container
Parameters:
actionHandler - the handler to be removed.
See Also:
Action.Container.removeActionHandler(Action.Handler)


Copyright © 2000-2009 IT Mill Ltd. All Rights Reserved.