org.ow2.weblab.portlet.tool
Class MediaUnitLegend

java.lang.Object
  extended by org.ow2.weblab.portlet.tool.MediaUnitLegend

public class MediaUnitLegend
extends java.lang.Object

Class representing an editable Media Unit legend and get it HTML representation. The legend contains a set of fields. For each field, corresponding a color and a name. Legend can be modified with HTML browser using a colorpicker. modification on legend can be retrieved, using a HTML form.

Author:
emilien

Field Summary
static java.lang.String LEGEND_CHECKBOX_COLOR
           
static java.lang.String LEGEND_CHECKBOX_INPUT
           
static java.lang.String LEGEND_COLOR_INPUT
           
static java.lang.String SAVE_LEGEND_SUBMIT
           
 
Constructor Summary
MediaUnitLegend()
          Public constructor without parameters.
MediaUnitLegend(java.util.List<LegendField> fields, java.lang.String appContext, java.lang.String styleContext)
          Public constructor taking in parameters
 
Method Summary
 java.lang.String getActionURL()
           
 java.lang.String getAppContext()
          Getters and setters
 java.lang.String getCheckBoxInputName(LegendField field)
          To get the checkbox value of the field in the HTML form.
 java.util.Map<java.lang.String,java.lang.Boolean> getCheckedMap()
           
 java.lang.String getColor(NamedEntity ne)
          Method to get the color of a typed valued entity in the legend.
 java.lang.String getColorInputName(LegendField field)
          To get the color of the field in the HTML form.
 java.util.Map<java.lang.String,java.lang.String> getColorMap()
           
 java.lang.String getDisplayName(NamedEntity ne, java.util.ResourceBundle resourceBundle)
          to get the display class name for the entity
 java.util.List<LegendField> getFields()
           
 java.lang.String getHTMLLegend(boolean editable, java.util.ResourceBundle resourceBundle)
          Method used to get a HTML representation of the legend, where colors are editable or not throw a JavaScript color picker .
 java.util.Set<java.lang.String> getMachedValuesOnPredicat(java.lang.String predicat)
          Get values corresponding a predicate in the legend.
 java.util.Set<java.lang.String> getPredicats()
           
 java.lang.String getStyle(NamedEntity ne)
          Method to get the css style name of an named entity.
 java.lang.String getStyleContext()
           
 java.util.Map<java.lang.String,java.lang.String> getStyleMap()
           
 void setActionURL(java.lang.String actionURL)
           
 void setAppContext(java.lang.String appContext)
           
 void setCheckedMap(java.util.Map<java.lang.String,java.lang.Boolean> checkedMap)
           
 void setColorMap(java.util.Map<java.lang.String,java.lang.String> colorMap)
           
 void setFields(java.util.List<LegendField> fields)
           
 void setStyleContext(java.lang.String styleContext)
           
 void setStyleMap(java.util.Map<java.lang.String,java.lang.String> styleMap)
           
 boolean show(NamedEntity ne)
          Method to get visibility of the named entity.
 void updateShemColor()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SAVE_LEGEND_SUBMIT

public static java.lang.String SAVE_LEGEND_SUBMIT

LEGEND_COLOR_INPUT

public static java.lang.String LEGEND_COLOR_INPUT

LEGEND_CHECKBOX_INPUT

public static java.lang.String LEGEND_CHECKBOX_INPUT

LEGEND_CHECKBOX_COLOR

public static java.lang.String LEGEND_CHECKBOX_COLOR
Constructor Detail

MediaUnitLegend

public MediaUnitLegend()
Public constructor without parameters.


MediaUnitLegend

public MediaUnitLegend(java.util.List<LegendField> fields,
                       java.lang.String appContext,
                       java.lang.String styleContext)
Public constructor taking in parameters

Parameters:
fields - the list of fields of the legend
appContext - the application context used
styleContext - the HTML element class root name
Method Detail

getHTMLLegend

public java.lang.String getHTMLLegend(boolean editable,
                                      java.util.ResourceBundle resourceBundle)
Method used to get a HTML representation of the legend, where colors are editable or not throw a JavaScript color picker .

Parameters:
editable - boolean allowing color edition
Returns:

getColor

public java.lang.String getColor(NamedEntity ne)
Method to get the color of a typed valued entity in the legend. Value may be null.

Parameters:
entityType - entity type (For example "http://weblab.eads.com/property/gate/annotation")
matchedValue - (For example "Person")
Returns:
the color of the typed valued entity in the legend.

getStyle

public java.lang.String getStyle(NamedEntity ne)
Method to get the css style name of an named entity.

Parameters:
ne - the named entity
Returns:
the css style name of named entity for this legend.

show

public boolean show(NamedEntity ne)
Method to get visibility of the named entity. Corresponding field is always visible in legend.

Parameters:
ne - the named entity
Returns:
true if named entity checked, false otherwise.

getPredicats

public java.util.Set<java.lang.String> getPredicats()

getMachedValuesOnPredicat

public java.util.Set<java.lang.String> getMachedValuesOnPredicat(java.lang.String predicat)
Get values corresponding a predicate in the legend.

Parameters:
predicat - the predicate.
Returns:
a set of values for predicat.

getColorInputName

public java.lang.String getColorInputName(LegendField field)
To get the color of the field in the HTML form.

Parameters:
field -
Returns:
the color input name of the field in form

getCheckBoxInputName

public java.lang.String getCheckBoxInputName(LegendField field)
To get the checkbox value of the field in the HTML form.

Parameters:
field -
Returns:
the checkbox input name of the field in form

getDisplayName

public java.lang.String getDisplayName(NamedEntity ne,
                                       java.util.ResourceBundle resourceBundle)
to get the display class name for the entity


getAppContext

public java.lang.String getAppContext()
Getters and setters


setAppContext

public void setAppContext(java.lang.String appContext)

getStyleContext

public java.lang.String getStyleContext()

setStyleContext

public void setStyleContext(java.lang.String styleContext)

getFields

public java.util.List<LegendField> getFields()

setFields

public void setFields(java.util.List<LegendField> fields)

getActionURL

public java.lang.String getActionURL()

setActionURL

public void setActionURL(java.lang.String actionURL)

updateShemColor

public void updateShemColor()

getColorMap

public java.util.Map<java.lang.String,java.lang.String> getColorMap()

setColorMap

public void setColorMap(java.util.Map<java.lang.String,java.lang.String> colorMap)

getStyleMap

public java.util.Map<java.lang.String,java.lang.String> getStyleMap()

setStyleMap

public void setStyleMap(java.util.Map<java.lang.String,java.lang.String> styleMap)

getCheckedMap

public java.util.Map<java.lang.String,java.lang.Boolean> getCheckedMap()

setCheckedMap

public void setCheckedMap(java.util.Map<java.lang.String,java.lang.Boolean> checkedMap)


Copyright © 2004-2011. All Rights Reserved.