com.cc.framework.ui.painter.html
Class HtmlSwapSelectPainter

java.lang.Object
  extended bycom.cc.framework.ui.painter.ControlPainter
      extended bycom.cc.framework.ui.painter.html.HtmlPainterBase
          extended bycom.cc.framework.ui.painter.html.HtmlSwapSelectPainter

public class HtmlSwapSelectPainter
extends HtmlPainterBase

Painter for the Swap Select Control

Since:
1.0
Version:
$Revision: 1.55 $
Author:
Gernot Schulz

Nested Class Summary
protected static class HtmlSwapSelectPainter.AvailableOptionsIterator
          Iterator that filters on available option elements only
protected static interface HtmlSwapSelectPainter.OptionFilter
          Used to filter options from the option list
protected static class HtmlSwapSelectPainter.OptionItemImpl
          Simple option item implementation
protected static class HtmlSwapSelectPainter.OverallOptionsIterator
          Iterator that keeps the sorting order of the selected value list!
protected static class HtmlSwapSelectPainter.SelectedFilter
           
protected static class HtmlSwapSelectPainter.UnselectedFilter
           
 
Field Summary
 
Fields inherited from class com.cc.framework.ui.painter.ControlPainter
log
 
Constructor Summary
HtmlSwapSelectPainter(PainterContext painterContext, SwapSelectControl ctrl)
          Constructor
 
Method Summary
protected  java.lang.String addGroupIndex(java.lang.String styleId, int groupIndex)
           
protected  org.apache.ecs.html.Table createButtonTable(java.util.Collection buttons)
           
protected  OptionsIterator createIterator(int groupIndex)
          Creates an option iterator
protected  OptionsIterator createSelectedAllIterator()
          Creates an option iterator for all selected values (in all groups)
protected  org.apache.ecs.ConcreteElement doCreateAddAllButton(int groupIndex, boolean enabled)
          Creates the add all Button
protected  org.apache.ecs.ConcreteElement doCreateAddButton(int groupIndex, boolean enabled)
          Creates the add Button
protected  java.util.Collection doCreateButtons(int groupIndex)
          Creates the buttons to move the option elements from one window to the other
protected  org.apache.ecs.ConcreteElement doCreateDisplayElement()
          Creates the element for display only.
protected  org.apache.ecs.ConcreteElement doCreateElement()
          Creates the HTML-Element.
protected  org.apache.ecs.ElementContainer doCreateHiddenFields()
          This method creates all the hidden fields that are necessary to synchronize the selected values back to the server
protected  java.util.Collection doCreateMoveButtons(int groupIndex)
          Creates the buttons to move the order of option elements
protected  org.apache.ecs.ConcreteElement doCreateMoveDownButton(int groupIndex, boolean enabled)
          Creates the move down Button
protected  org.apache.ecs.ConcreteElement doCreateMoveUpButton(int groupIndex, boolean enabled)
          Creates the move up Button
protected  org.apache.ecs.ConcreteElement doCreateRemoveAllButton(int groupIndex, boolean enabled)
          Creates the remove all Button
protected  org.apache.ecs.ConcreteElement doCreateRemoveButton(int groupIndex, boolean enabled)
          Creates the remove Button
protected  JavaScript doCreateScript()
          Creates the Java Script Code which is needed by the control
protected  org.apache.ecs.ConcreteElement doCreateSelectBox(int groupIndex)
          Creates on single select box
protected  void doPaintHorizontal(org.apache.ecs.html.Table control)
          Paints the control in horizontal orientation
protected  void doPaintVertical(org.apache.ecs.html.Table control)
          Paints the control in vertical orientation
protected  SwapSelectControl getCtrl()
          Retrieves the control for this painter
protected  int getGroupCount()
           
protected  java.lang.String getHiddenFieldName(int groupIndex)
           
protected  java.lang.String getLabelLeft()
          Retrieves the label for the available options select box
protected  java.lang.String getLabelRight(int groupIndex)
          Retrieves the label for the given element group
protected  int getSize(int groupIndex)
           
protected  java.lang.Object[] getValues()
          Retrieves the value for the text control
protected  java.lang.Object[] getValues(int groupIndex)
           
protected  java.lang.String imgRes(ControlButton type, boolean enabled)
          Selects the image resource to use for the specified button
protected  boolean isHorizontal()
          Checks if the controls orientation is horizontal
protected  boolean isMultiple()
           
protected  boolean showLabels()
          Checks if the labels should be visible
protected  boolean showMoveButtons()
           
 
Methods inherited from class com.cc.framework.ui.painter.ControlPainter
ajaxPaint, attr, attr, attr, beginPaint, createActionPainter, createActionPainter, createElement, createImage, createImage, createImage, createInput, createInput, createSpacer, createSpacer, createSpacer, decorateURL, doAddDecorationsToRow, doAddDecorationsToRow, doAfterCreate, doAttachDecorations, doBeforeCreate, encodeURL, endPaint, forceControlName, getAsString, getAwtColor, getColor, getContextPath, getControlName, getDecorationsOnce, getElementClass, getElementName, getFramePainter, getFrameworkString, getFrameworkString, getImage, getImage, getImage, getImageSrc, getImageSrc, getImageSrc, getLocale, getPageContext, getPainterContext, getPrincipal, getRequest, getResponse, getSession, getSmartCaption, getSmartDetail, getSource, getSource, getStringResource, getStyleId, html, html, html, init, isRunAtClient, localize, localize, localize, paint, removeHtml, removeHtml, request, response, session, showComments
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlSwapSelectPainter

public HtmlSwapSelectPainter(PainterContext painterContext,
                             SwapSelectControl ctrl)
Constructor

Parameters:
painterContext - The PainterContext
ctrl - The Control to render
Method Detail

getCtrl

protected SwapSelectControl getCtrl()
Retrieves the control for this painter

Returns:
Control

isMultiple

protected boolean isMultiple()
Returns:
returns true when the control should be rendered as a multiple swap select control with multiple shift targets

showLabels

protected boolean showLabels()
Checks if the labels should be visible

Returns:
true if the labels should be visible

isHorizontal

protected boolean isHorizontal()
Checks if the controls orientation is horizontal

Returns:
true if the controls orientation is horizontal

showMoveButtons

protected boolean showMoveButtons()
Returns:
true when the control should show buttons for data movement

getLabelLeft

protected java.lang.String getLabelLeft()
Retrieves the label for the available options select box

Returns:
label

getLabelRight

protected java.lang.String getLabelRight(int groupIndex)
Retrieves the label for the given element group

Parameters:
groupIndex - the index of the element group
Returns:
label

getSize

protected int getSize(int groupIndex)

getGroupCount

protected int getGroupCount()
Returns:
returns the number of swap targets for this control

createIterator

protected OptionsIterator createIterator(int groupIndex)
Creates an option iterator

Parameters:
groupIndex - When set to >= 0 the method will return an iterator for the selected option elements (the right side of the swap select) only. When set to -1 it will create an iterator for the available options (the left side of the control) only.
Returns:
Iterator

createSelectedAllIterator

protected OptionsIterator createSelectedAllIterator()
Creates an option iterator for all selected values (in all groups)

Returns:
Iterator

getHiddenFieldName

protected java.lang.String getHiddenFieldName(int groupIndex)

doCreateHiddenFields

protected org.apache.ecs.ElementContainer doCreateHiddenFields()
This method creates all the hidden fields that are necessary to synchronize the selected values back to the server

Returns:
Collection of hidden fields

addGroupIndex

protected java.lang.String addGroupIndex(java.lang.String styleId,
                                         int groupIndex)

doCreateSelectBox

protected org.apache.ecs.ConcreteElement doCreateSelectBox(int groupIndex)
Creates on single select box

Parameters:
groupIndex - the index of the select box to create
Returns:
returns the HTML select element

imgRes

protected java.lang.String imgRes(ControlButton type,
                                  boolean enabled)
Selects the image resource to use for the specified button

Parameters:
type - Button Type
enabled - Indicates if the button is enabled or disables
Returns:
Image resource name

doCreateAddAllButton

protected org.apache.ecs.ConcreteElement doCreateAddAllButton(int groupIndex,
                                                              boolean enabled)
Creates the add all Button

Parameters:
enabled - true if the Button is enabled
Returns:
ConcreteElement

doCreateAddButton

protected org.apache.ecs.ConcreteElement doCreateAddButton(int groupIndex,
                                                           boolean enabled)
Creates the add Button

Parameters:
enabled - true if the Button is enabled
Returns:
ConcreteElement

doCreateRemoveButton

protected org.apache.ecs.ConcreteElement doCreateRemoveButton(int groupIndex,
                                                              boolean enabled)
Creates the remove Button

Parameters:
enabled - true if the Button is enabled
Returns:
ConcreteElement

doCreateRemoveAllButton

protected org.apache.ecs.ConcreteElement doCreateRemoveAllButton(int groupIndex,
                                                                 boolean enabled)
Creates the remove all Button

Parameters:
enabled - true if the Button is enabled
Returns:
ConcreteElement

doCreateMoveUpButton

protected org.apache.ecs.ConcreteElement doCreateMoveUpButton(int groupIndex,
                                                              boolean enabled)
Creates the move up Button

Parameters:
enabled - true if the Button is enabled
Returns:
ConcreteElement

doCreateMoveDownButton

protected org.apache.ecs.ConcreteElement doCreateMoveDownButton(int groupIndex,
                                                                boolean enabled)
Creates the move down Button

Parameters:
enabled - true if the Button is enabled
Returns:
ConcreteElement

doCreateButtons

protected java.util.Collection doCreateButtons(int groupIndex)
Creates the buttons to move the option elements from one window to the other

Returns:
collection of ConcreteElement Items

doCreateMoveButtons

protected java.util.Collection doCreateMoveButtons(int groupIndex)
Creates the buttons to move the order of option elements

Returns:
collection of ConcreteElement Items

createButtonTable

protected org.apache.ecs.html.Table createButtonTable(java.util.Collection buttons)

doPaintHorizontal

protected void doPaintHorizontal(org.apache.ecs.html.Table control)
Paints the control in horizontal orientation

Parameters:
control - The resulting table element

doPaintVertical

protected void doPaintVertical(org.apache.ecs.html.Table control)
Paints the control in vertical orientation

Parameters:
control - The resulting table element

doCreateDisplayElement

protected org.apache.ecs.ConcreteElement doCreateDisplayElement()
Creates the element for display only. It shows the selected values

Returns:
HTML Element

doCreateElement

protected org.apache.ecs.ConcreteElement doCreateElement()
Description copied from class: ControlPainter
Creates the HTML-Element. This Method must be implemented by the concrete Sub-Class

Specified by:
doCreateElement in class ControlPainter
Returns:
ConcreteElement
See Also:
ControlPainter.doCreateElement()

doCreateScript

protected JavaScript doCreateScript()
Creates the Java Script Code which is needed by the control

Returns:
Java Script Code

getValues

protected java.lang.Object[] getValues()
Retrieves the value for the text control

Returns:
value

getValues

protected java.lang.Object[] getValues(int groupIndex)


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.