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

java.lang.Object
  extended by org.olat.core.gui.components.table.DefaultColumnDescriptor
All Implemented Interfaces:
ColumnDescriptor
Direct Known Subclasses:
BooleanColumnDescriptor, CustomRenderColumnDescriptor, ThreadColumnDescriptor, TotalAwareColumnDescriptor

public class DefaultColumnDescriptor
extends java.lang.Object
implements ColumnDescriptor

Description:

Author:
Felix Jost

Field Summary
static java.lang.String DEFAULT_POPUP_ATTRIBUTES
           
 
Fields inherited from interface org.olat.core.gui.components.table.ColumnDescriptor
ALIGNMENT_CENTER, ALIGNMENT_LEFT, ALIGNMENT_RIGHT
 
Constructor Summary
DefaultColumnDescriptor(java.lang.String headerKey, int dataColumn, java.lang.String action, java.util.Locale locale)
          Constructor for table default column descriptor
DefaultColumnDescriptor(java.lang.String headerKey, int dataColumn, java.lang.String action, java.util.Locale locale, int alignment)
           
 
Method Summary
 int compareTo(int rowa, int rowb)
          is called repeatedly caused by Collections.sort(...);
 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.util.Locale getLocale()
           
 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 sb, int row, Renderer renderer)
           
 void setAlignment(int alignment)
          Sets the alignment.
 void setHrefGenerator(HrefGenerator hrefGenerator)
           
 void setIsPopUpWindowAction(boolean popUpWindowAction, java.lang.String popUpWindowAttributes)
          TODO:fj:b replace with PopupObject which is easily configurable Optional action link configuration
 void setTable(Table table)
           
 void setTranslateHeaderKey(boolean translateHeaderKey)
           
 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
 

Field Detail

DEFAULT_POPUP_ATTRIBUTES

public static final java.lang.String DEFAULT_POPUP_ATTRIBUTES
See Also:
Constant Field Values
Constructor Detail

DefaultColumnDescriptor

public DefaultColumnDescriptor(java.lang.String headerKey,
                               int dataColumn,
                               java.lang.String action,
                               java.util.Locale locale)
Constructor for table default column descriptor

Parameters:
headerKey - translation key for column header
dataColumn - position of column
action - name of event that should be fired when rows column is clicken. null allowed for no action
locale - the users locale

DefaultColumnDescriptor

public DefaultColumnDescriptor(java.lang.String headerKey,
                               int dataColumn,
                               java.lang.String action,
                               java.util.Locale locale,
                               int alignment)
Parameters:
headerKey -
dataColumn -
action -
locale - used ONLY for method getRenderValue in case the Object is of type Date to provide locale-sensitive Date formatting
alignment - left, middle or right; constants in ColumnDescriptor
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

setTranslateHeaderKey

public void setTranslateHeaderKey(boolean translateHeaderKey)

renderValue

public void renderValue(StringOutput sb,
                        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)

getAlignment

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

compareTo

public int compareTo(int rowa,
                     int rowb)
is called repeatedly caused by Collections.sort(...);

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

setTable

public void setTable(Table table)
Specified by:
setTable in interface ColumnDescriptor
Parameters:
table - 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()

getLocale

public java.util.Locale getLocale()
Returns:
Locale

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)
TODO:fj:b replace with PopupObject which is easily configurable 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"

getHrefGenerator

public HrefGenerator getHrefGenerator()
Specified by:
getHrefGenerator in interface ColumnDescriptor
Returns:
Returns the hrefGenerator.

setHrefGenerator

public void setHrefGenerator(HrefGenerator hrefGenerator)
Specified by:
setHrefGenerator in interface ColumnDescriptor
Parameters:
hrefGenerator - The hrefGenerator to set.

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: