Class FWTableChoiceSubComponent

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ListSelectionListener

public class FWTableChoiceSubComponent extends FWAbstractFormSubComponent implements ListSelectionListener
This class is used to visualize a FWChoiceFormComponent of type "table". Each table row represents a choice value. The parameter "selectionColIdx" determines from which table column the choice value is taken (Default: 0 = first column). Like for FWListChoiceSubComponent multi selection is possible. In this case
  • An extra checkbox column is added to the table (using SelectionTableModel), so that it is not necessary to hold Strg-Key to select individual table rows.
  • The choice return value holds a separated concatenation of the selection column value of each row. The separator can be specified in the "multiselect_seperator" parameter (Default: comma). An apostrophe can be places additionally to the parameter "multiselect_seperator" to indicate that the concatenated values are masked with apostrophe.
  • If "sql_where_param" parameter is set, the choice return value is constructed as an SQL condition with OR-concatenation.
Restrictions:
  • The attribute "showAll" is not yet supported. The table is always placed in JScrollPane.
Author:
M.Schmitz
See Also:
  • Field Details

    • iTable

      protected de.schmitzm.swing.SortableJTable iTable
    • iTableModel

    • iIsMultiSelect

      protected boolean iIsMultiSelect
    • iIsRequired

      protected boolean iIsRequired
    • iShowAll

      protected boolean iShowAll
    • iSelectionColIdx

      protected int iSelectionColIdx
    • iWhereFormParam

      protected String iWhereFormParam
    • iMultiselectSeperatorParam

      protected String iMultiselectSeperatorParam
    • iUseApostroph

      protected boolean iUseApostroph
    • iChoiceFieldId

      protected String iChoiceFieldId
  • Constructor Details

    • FWTableChoiceSubComponent

      public FWTableChoiceSubComponent(Vector<FWFormOption> aOptions, boolean aMultiSelect, boolean aRequired, boolean aIsEnabled, boolean aShowAll, FWObservable aObservable, Map<String,Object> aFormComponentParameterMap, String aDefaultValueID, String aChoiceFieldId)
      Parameters:
      aOptions - form options to generate the table content from
      aMultiSelect - indicates whether multiple table rows can be selected
      aRequired - indicates whether row choice is required
      aIsEnabled - indicated whether table component is enabled
      aShowAll - indicated whether all table rows are shown (not supported!)
      aObservable -
      aFormComponentParameterMap -
      aDefaultValueID - ID of default selection
      aChoiceFieldId - id of the parent choice field (used to localize column headers)
  • Method Details

    • getPreferredSize

      public Dimension getPreferredSize()
      Returns the preferred size for the sub component. If the table is smaller than the preferred scroll pane size, then the table's size is returned (+ table header size).
      Overrides:
      getPreferredSize in class JComponent
    • getValue

      public String getValue()
      Returns the current table selection. Depending on single or multi selection the functions returns a single cell value (
      Specified by:
      getValue in class FWAbstractFormSubComponent
      Returns:
      value of the implemented subcomponent
    • getSelectedValueList

      public List<Object> getSelectedValueList()
      Returns all selected values as list. In single selection mode the list always contains only one element.
      Specified by:
      getSelectedValueList in class FWAbstractFormSubComponent
      Returns:
      value of the implemented subcomponent
    • setValue

      public void setValue(String aValues)
      Sets the table selection by value. Multiple values can be specified as comma-separated list of values. If no table row with a value to select (in selection column) can be identified, the specified value(s) are used as option ids to define a selection. Note: If multiple table rows contain the same value in the selection column, only the FIRST row is selected (even in multi selection mode!)
      Specified by:
      setValue in class FWAbstractFormSubComponent
      Parameters:
      aValues - String representation of the value to be set
    • setSelectedIDs

      public void setSelectedIDs(String aIds)
      Sets the table selection by option id. Multiple option ids can be specified as comma-separated list.
      Parameters:
      aIds -
    • updateTable

      public void updateTable(Vector<FWFormOption> aFormOptionVector)
      Updates the choice list
      Parameters:
      aFormOptionVector - Vector of niew FormOptions
    • setEnabled

      public void setEnabled(boolean aIsEnabled)
      Allows to set the value of the implemented subcomponent
      Overrides:
      setEnabled in class FWAbstractFormSubComponent
      Parameters:
      aValue - String representation of the value to be set
    • valueChanged

      public void valueChanged(ListSelectionEvent e)
      Notifies the parent component whenever the value (selection) of this component changes
      Specified by:
      valueChanged in interface ListSelectionListener