org.olat.core.gui.components.table
Class StaticColumnDescriptor

java.lang.Object
  extended by org.olat.core.gui.components.table.StaticColumnDescriptor
All Implemented Interfaces:
ColumnDescriptor

public class StaticColumnDescriptor
extends java.lang.Object
implements ColumnDescriptor

Description:
The static column descriptor displays the same value on every row. Usually this is used to execute an action like 'edit this record'

Author:
Felix Jost

Field Summary
 
Fields inherited from interface org.olat.core.gui.components.table.ColumnDescriptor
ALIGNMENT_CENTER, ALIGNMENT_LEFT, ALIGNMENT_RIGHT
 
Constructor Summary
StaticColumnDescriptor(java.lang.String action, java.lang.String headerKey, java.lang.String cellValue)
          Constructor for StaticColumnDescriptor.
 
Method Summary
 int compareTo(int rowa, int rowb)
           
 java.lang.String getAction(int row)
          gets the action code for the column, null if no action
 int getAlignment()
           
 java.lang.String getHeaderKey()
           
 HrefGenerator getHrefGenerator()
           
 java.lang.String getPopUpWindowAttributes()
           
 boolean isPopUpWindowAction()
           
 boolean isSortingAllowed()
           
 void modelChanged()
          called by the table if the model has changed.
 void otherColumnDescriptorSorted()
          called when this columnDescriptor is not being sorted by the user, but another columnDescriptor.
 void renderValue(StringOutput so, int row, Renderer renderer)
           
 void setAlignment(int alignment)
          Sets the alignment.
 void setHrefGenerator(HrefGenerator h)
           
 void setIsPopUpWindowAction(boolean popUpWindowAction, java.lang.String popUpWindowAttributes)
          Optional action link configuration
 void setTable(Table arg0)
           
 void setTranslateHeaderKey(boolean translateHeaderKey)
          Option to set the flag to not translate the header key.
 void sortingAboutToStart()
          called before the actual sorting calls with compareTo(int rowa, int rowb) take place
 java.lang.String toString(int rowid)
          String represenation of the value at specified row
 boolean translateHeaderKey()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticColumnDescriptor

public StaticColumnDescriptor(java.lang.String action,
                              java.lang.String headerKey,
                              java.lang.String cellValue)
Constructor for StaticColumnDescriptor. The default alignment ist left

Parameters:
action -
headerKey -
cellValue -
Method Detail

getHeaderKey

public java.lang.String getHeaderKey()
Specified by:
getHeaderKey in interface ColumnDescriptor
Returns:
the key of the header of this column. Is translated by the translator of the table to which this columndescriptor belongs to.
See Also:
ColumnDescriptor.getHeaderKey()

translateHeaderKey

public boolean translateHeaderKey()
Specified by:
translateHeaderKey in interface ColumnDescriptor
Returns:
true if the header key should be translated by the renderer, otherwise false
See Also:
ColumnDescriptor.translateHeaderKey()

setTranslateHeaderKey

public void setTranslateHeaderKey(boolean translateHeaderKey)
Option to set the flag to not translate the header key. In this case, the header key value is actually not a key but rather an already translated value

Parameters:
translateHeaderKey -

getAlignment

public int getAlignment()
Specified by:
getAlignment in interface ColumnDescriptor
Returns:
See Also:
ColumnDescriptor.getAlignment()

renderValue

public void renderValue(StringOutput so,
                        int row,
                        Renderer renderer)
Specified by:
renderValue in interface ColumnDescriptor
renderer - the Renderer. if null this means that the renderValue should be in plain text (e.g. for excel download)
See Also:
ColumnDescriptor.renderValue(org.olat.core.gui.render.StringOutput, int, org.olat.core.gui.render.Renderer)

compareTo

public int compareTo(int rowa,
                     int rowb)
Specified by:
compareTo in interface ColumnDescriptor
Returns:
See Also:
ColumnDescriptor.compareTo(int, int)

setTable

public void setTable(Table arg0)
Specified by:
setTable in interface ColumnDescriptor
Parameters:
arg0 - the backreference to the table
See Also:
ColumnDescriptor.setTable(org.olat.core.gui.components.table.Table)

getAction

public java.lang.String getAction(int row)
Description copied from interface: ColumnDescriptor
gets the action code for the column, null if no action

Specified by:
getAction in interface ColumnDescriptor
Parameters:
row - the current row
Returns:
See Also:
ColumnDescriptor.getAction(int)

setAlignment

public void setAlignment(int alignment)
Sets the alignment.

Parameters:
alignment - The alignment to set

modelChanged

public void modelChanged()
Description copied from interface: ColumnDescriptor
called by the table if the model has changed. Useful in combination with sortingAboutToStart() to know when sortingAboutToStart() can use the cache or when it has to resort again

Specified by:
modelChanged in interface ColumnDescriptor
See Also:
ColumnDescriptor.modelChanged()

sortingAboutToStart

public void sortingAboutToStart()
Description copied from interface: ColumnDescriptor
called before the actual sorting calls with compareTo(int rowa, int rowb) take place

Specified by:
sortingAboutToStart in interface ColumnDescriptor
See Also:
ColumnDescriptor.sortingAboutToStart()

otherColumnDescriptorSorted

public void otherColumnDescriptorSorted()
Description copied from interface: ColumnDescriptor
called when this columnDescriptor is not being sorted by the user, but another columnDescriptor. usage: e.g. so getRenderValue(int row) can deliver different results w/o being active (formatting or such)

Specified by:
otherColumnDescriptorSorted in interface ColumnDescriptor
See Also:
ColumnDescriptor.otherColumnDescriptorSorted()

isSortingAllowed

public boolean isSortingAllowed()
Specified by:
isSortingAllowed in interface ColumnDescriptor
Returns:
true if this column should offer sorting (by clicking on the column header)
See Also:
ColumnDescriptor.isSortingAllowed()

isPopUpWindowAction

public boolean isPopUpWindowAction()
Specified by:
isPopUpWindowAction in interface ColumnDescriptor
Returns:
true if the action link should open in a new window using java script
See Also:
ColumnDescriptor.isPopUpWindowAction()

getPopUpWindowAttributes

public java.lang.String getPopUpWindowAttributes()
Specified by:
getPopUpWindowAttributes in interface ColumnDescriptor
Returns:
javascript window.open attributes or null if browsers default should be used
See Also:
ColumnDescriptor.getPopUpWindowAttributes()

setIsPopUpWindowAction

public void setIsPopUpWindowAction(boolean popUpWindowAction,
                                   java.lang.String popUpWindowAttributes)
Optional action link configuration

Parameters:
popUpWindowAction - true: action link will open in new window, false: action opens in current window
popUpWindowAttributes - javascript window.open attributes or null if default values are used e.g. something like this: "height=600, width=600, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no"

setHrefGenerator

public void setHrefGenerator(HrefGenerator h)
Specified by:
setHrefGenerator in interface ColumnDescriptor

getHrefGenerator

public HrefGenerator getHrefGenerator()
Specified by:
getHrefGenerator in interface ColumnDescriptor

toString

public java.lang.String toString(int rowid)
Description copied from interface: ColumnDescriptor
String represenation of the value at specified row

Specified by:
toString in interface ColumnDescriptor
Returns: