EchoPoint
1.0

echopoint
Class ExpandableSection

java.lang.Object
  extended bynextapp.echo.Component
      extended bynextapp.echo.Container
          extended byechopoint.EchoPointComponent
              extended byechopoint.BoxSection
                  extended byechopoint.ExpandableSection
All Implemented Interfaces:
Borderable, MouseCursorable, ReflectionSetter, java.io.Serializable, ToolTipPopUpSupport, nextapp.echo.ToolTipSupport

public class ExpandableSection
extends BoxSection
implements Borderable

The ExpandableSection class provides a Component that can be expanded and collapsed. The contents of the ExpandableSection can be another Component.

In general a Component that can contain other Components, such as a Panel or Grid, is used as the contents.

The ExpandableSection has two modes. The default is server side mode, where each click to expand the section is sent to the server and the model is updated directly. This allows server side code to run on each expand event.

The second mode is client side mode, whereby the content within the ExpandableSection is only hidden or shown on the client. No events are sent back to the server. However should another component cause the client screen to be updated, then the state of the ExpandableSection is saved.

Server side gives you the best functionality whilst client side mode provides the performance on the client.

The class uses the ExpandableModel interface to keep track of whether the section is expanded or not. The model used is contained with the title TitleBar. Therefore it is illegal to have a null title TitleBar.

Please note that the ExpandableModel interface of the footer TitleBar is never used.

Author:
Brad Baker
See Also:
Serialized Form

Nested Class Summary
static class ExpandableSection.NestedStyleInfo
          Nested public static StyleInfo class.
 
Field Summary
static java.lang.String MODEL_CHANGED_PROPERTY
           
static java.lang.String SERVER_SIDE_CHANGED_PROPERTY
           
static java.lang.String STYLE_EXPANDED
          A style constant for the Expanded property.
 
Fields inherited from class echopoint.BoxSection
DEFAULT_INSETS, FOOTER_CHANGED_PROPERTY, INSETS_CHANGED_PROPERTY, RULER_COLOR_CHANGED_PROPERTY, RULER_WIDTH_CHANGED_PROPERTY, STYLE_INSETS, STYLE_RULER_COLOR, STYLE_RULER_DRAWN, STYLE_RULER_WIDTH, TITLE_CHANGED_PROPERTY
 
Fields inherited from class echopoint.EchoPointComponent
STYLE_TOOL_TIP_TEXT, TOOL_TIP_TEXT_CHANGED_PROPERTY, toolTipPopUp
 
Fields inherited from class nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, listenerList, LOCALE_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Fields inherited from interface echopoint.positionable.Borderable
BORDER_DASHED, BORDER_DOTTED, BORDER_DOUBLE, BORDER_GROOVE, BORDER_INSET, BORDER_NONE, BORDER_OUTSET, BORDER_RIDGE, BORDER_SOLID, borderStyleSymbolics, STYLE_BORDER_COLOR, STYLE_BORDER_SIZE, STYLE_BORDER_STYLE, STYLE_BOTTOM_BORDER_COLOR, STYLE_BOTTOM_BORDER_SIZE, STYLE_BOTTOM_BORDER_STYLE, STYLE_LEFT_BORDER_COLOR, STYLE_LEFT_BORDER_SIZE, STYLE_LEFT_BORDER_STYLE, STYLE_RIGHT_BORDER_COLOR, STYLE_RIGHT_BORDER_SIZE, STYLE_RIGHT_BORDER_STYLE, STYLE_TOP_BORDER_COLOR, STYLE_TOP_BORDER_SIZE, STYLE_TOP_BORDER_STYLE
 
Fields inherited from interface echopoint.positionable.MouseCursorable
borderStyleSymbolics, CURSOR_AUTO, CURSOR_CROSSHAIR, CURSOR_CUSTOM_URI, CURSOR_DEFAULT, CURSOR_E_RESIZE, CURSOR_HELP, CURSOR_MOVE, CURSOR_N_RESIZE, CURSOR_NE_RESIZE, CURSOR_NW_RESIZE, CURSOR_POINTER, CURSOR_S_RESIZE, CURSOR_SE_RESIZE, CURSOR_SW_RESIZE, CURSOR_TEXT, CURSOR_W_RESIZE, CURSOR_WAIT, STYLE_MOUSE_CURSOR, STYLE_MOUSE_CURSOR_URI
 
Constructor Summary
ExpandableSection()
          Constructs a ExpandableSection that is not expanded.
ExpandableSection(boolean isExpanded)
          Constructs a ExpandableSection with the isExpanded parameter controlling whether the ExpandableSection is expanded.
ExpandableSection(boolean isExpanded, nextapp.echo.Component content)
          Constructs a ExpandableSection with the isExpanded parameter controlling whether the ExpandableSection is expanded.
ExpandableSection(boolean isExpanded, java.lang.String title)
          Constructs a ExpandableSection with the isExpanded parameter controlling whether the ExpandableSection is expanded and with the given title.
ExpandableSection(boolean isExpanded, java.lang.String title, nextapp.echo.Component content)
          Constructs a ExpandableSection with the isExpanded parameter controlling whether the ExpandableSection is expanded, with the given title The contents of the section is the component.
ExpandableSection(boolean isExpanded, TitleBar titleBar, nextapp.echo.Component content)
          Constructs a ExpandableSection with the isExpanded parameter controlling whether the ExpandableSection is expanded, with the given title.
ExpandableSection(java.lang.String title, nextapp.echo.Component content)
          Constructs a ExpandableSection with that is no expanded with the given title and content
 
Method Summary
 void addActionListener(nextapp.echo.event.ActionListener l)
          Adds an ActionListener to the expandable section.
 void addChangeListener(nextapp.echo.event.ChangeListener l)
          Adds a ChangeListener to the section
 void applyStyle(nextapp.echo.Style style)
          This will apply the borderColor, borderWidth and borderStyle properties first followed by the left, top, right and bottom borer properties.
 ExpandableModel getModel()
           
 boolean isExpanded()
           
 boolean isServerSideSection()
          Retursn true if the ExpandableSection is a server side section or false if its a client side expansion.
 void removeActionListener(nextapp.echo.event.ActionListener l)
          Removes an ActionListener to the expandable section.
 void removeChangeListener(nextapp.echo.event.ChangeListener l)
          Removes a ChangeListener from this component.
 java.lang.Object set(java.lang.reflect.Field field, java.lang.Object newValue)
          Called to save the old value of a field, set in a new value and return the old value of a field.
 void setExpanded(boolean isExpanded)
          Sets whether the ExpandableSection is expanded or not
This methods causes the underlying ExpandableModel to change.
 void setFooter(java.lang.String newFooter)
          Sets the footer used by the ExpandableSection.
 void setModel(ExpandableModel newModel)
          Sets the ExpandableModel model used by the ExpandableSection.
 void setServerSideSection(boolean newServerSideSection)
          Sets whether the ExpandableSection will expand on the server side or the client side.
 void setTitle(java.lang.String newTitle)
          Sets the title used by the ExpandableSection.
 void setTitle(TitleBar newTitle)
          Sets the title used by the ExpandableSection.
 
Methods inherited from class echopoint.BoxSection
getBorderColor, getBorderSize, getBorderStyle, getBottomBorderColor, getBottomBorderSize, getBottomBorderStyle, getFooter, getInsets, getLeftBorderColor, getLeftBorderSize, getLeftBorderStyle, getRightBorderColor, getRightBorderSize, getRightBorderStyle, getRulerColor, getRulerWidth, getTitle, getTopBorderColor, getTopBorderSize, getTopBorderStyle, reRegisterComponents, setBorderColor, setBorderSize, setBorderStyle, setBottomBorderColor, setBottomBorderSize, setBottomBorderStyle, setFooter, setInsets, setLeftBorderColor, setLeftBorderSize, setLeftBorderStyle, setRightBorderColor, setRightBorderSize, setRightBorderStyle, setRulerColor, setRulerWidth, setTopBorderColor, setTopBorderSize, setTopBorderStyle
 
Methods inherited from class echopoint.EchoPointComponent
getMouseCursor, getMouseCursorURI, getToolTipPopUp, getToolTipText, set, set, set, set, set, set, set, set, set, setEnabledAllChildren, setMouseCursor, setMouseCursorURI, setToolTipText, validate
 
Methods inherited from class nextapp.echo.Component
add, add, addHierarchyListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getComponent, getComponentCount, getComponents, getEchoInstance, getFont, getForeground, getIdentifier, getLocale, getParent, indexOf, init, isAncestorOf, isEnabled, isRegistered, isShowing, isVisible, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setBackground, setEnabled, setFont, setForeground, setIdentifier, setLocale, setVisible, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface echopoint.positionable.Borderable
getBorderColor, getBorderSize, getBorderStyle, getBottomBorderColor, getBottomBorderSize, getBottomBorderStyle, getLeftBorderColor, getLeftBorderSize, getLeftBorderStyle, getRightBorderColor, getRightBorderSize, getRightBorderStyle, getTopBorderColor, getTopBorderSize, getTopBorderStyle, setBorderColor, setBorderSize, setBorderStyle, setBottomBorderColor, setBottomBorderSize, setBottomBorderStyle, setLeftBorderColor, setLeftBorderSize, setLeftBorderStyle, setRightBorderColor, setRightBorderSize, setRightBorderStyle, setTopBorderColor, setTopBorderSize, setTopBorderStyle
 

Field Detail

MODEL_CHANGED_PROPERTY

public static final java.lang.String MODEL_CHANGED_PROPERTY
See Also:
Constant Field Values

SERVER_SIDE_CHANGED_PROPERTY

public static final java.lang.String SERVER_SIDE_CHANGED_PROPERTY
See Also:
Constant Field Values

STYLE_EXPANDED

public static final java.lang.String STYLE_EXPANDED
A style constant for the Expanded property. Values of this key must be of type Boolean.

See Also:
Constant Field Values
Constructor Detail

ExpandableSection

public ExpandableSection()
Constructs a ExpandableSection that is not expanded.


ExpandableSection

public ExpandableSection(boolean isExpanded)
Constructs a ExpandableSection with the isExpanded parameter controlling whether the ExpandableSection is expanded.


ExpandableSection

public ExpandableSection(boolean isExpanded,
                         nextapp.echo.Component content)
Constructs a ExpandableSection with the isExpanded parameter controlling whether the ExpandableSection is expanded.


ExpandableSection

public ExpandableSection(boolean isExpanded,
                         java.lang.String title)
Constructs a ExpandableSection with the isExpanded parameter controlling whether the ExpandableSection is expanded and with the given title.


ExpandableSection

public ExpandableSection(boolean isExpanded,
                         java.lang.String title,
                         nextapp.echo.Component content)
Constructs a ExpandableSection with the isExpanded parameter controlling whether the ExpandableSection is expanded, with the given title The contents of the section is the component.


ExpandableSection

public ExpandableSection(java.lang.String title,
                         nextapp.echo.Component content)
Constructs a ExpandableSection with that is no expanded with the given title and content


ExpandableSection

public ExpandableSection(boolean isExpanded,
                         TitleBar titleBar,
                         nextapp.echo.Component content)
Constructs a ExpandableSection with the isExpanded parameter controlling whether the ExpandableSection is expanded, with the given title. The contents of the section is the component.

Method Detail

addActionListener

public void addActionListener(nextapp.echo.event.ActionListener l)
Adds an ActionListener to the expandable section.

Parameters:
l - The ActionListener to be added.

addChangeListener

public void addChangeListener(nextapp.echo.event.ChangeListener l)
Adds a ChangeListener to the section

Parameters:
l - The ChangeListener to be added.

applyStyle

public void applyStyle(nextapp.echo.Style style)
Description copied from interface: Borderable
This will apply the borderColor, borderWidth and borderStyle properties first followed by the left, top, right and bottom borer properties.

Specified by:
applyStyle in interface Borderable
Overrides:
applyStyle in class BoxSection
See Also:
Component.applyStyle(nextapp.echo.Style)

getModel

public ExpandableModel getModel()
Returns:
the ExpandableModel model of the ExpandableSection.

isExpanded

public boolean isExpanded()
Returns:
the ExpandableSection is expanded or not

isServerSideSection

public boolean isServerSideSection()
Retursn true if the ExpandableSection is a server side section or false if its a client side expansion.

Returns:
boolean

removeActionListener

public void removeActionListener(nextapp.echo.event.ActionListener l)
Removes an ActionListener to the expandable section.

Parameters:
l - The ActionListener to be removed.

removeChangeListener

public void removeChangeListener(nextapp.echo.event.ChangeListener l)
Removes a ChangeListener from this component.

Parameters:
l - the ChangeListener to remove

setExpanded

public void setExpanded(boolean isExpanded)
Sets whether the ExpandableSection is expanded or not
This methods causes the underlying ExpandableModel to change.


setFooter

public void setFooter(java.lang.String newFooter)
Sets the footer used by the ExpandableSection.

Overrides:
setFooter in class BoxSection

setModel

public void setModel(ExpandableModel newModel)
Sets the ExpandableModel model used by the ExpandableSection.


setServerSideSection

public void setServerSideSection(boolean newServerSideSection)
Sets whether the ExpandableSection will expand on the server side or the client side.

Parameters:
newServerSideSection - boolean

setTitle

public void setTitle(java.lang.String newTitle)
Sets the title used by the ExpandableSection.

Overrides:
setTitle in class BoxSection

setTitle

public void setTitle(TitleBar newTitle)
Sets the title used by the ExpandableSection.

Overrides:
setTitle in class BoxSection

set

public java.lang.Object set(java.lang.reflect.Field field,
                            java.lang.Object newValue)
                     throws java.lang.Exception
Description copied from interface: ReflectionSetter
Called to save the old value of a field, set in a new value and return the old value of a field. This interface allows a field set operation to be "delegated" back into the class that has permission to perform the field set.

 public Object set(Field f, Object newValue) throws Exception {
      Object oldValue = f.get(this);
      f.set(this,newValue);
      return oldValue;
 }
 

Specified by:
set in interface ReflectionSetter
Overrides:
set in class BoxSection
Throws:
java.lang.Exception
See Also:
ReflectionSetter.set(Field, Object)

EchoPoint
1.0