Interface DomTableEditorValue
- All Superinterfaces:
EditorValue<Table>
The
DomTableEditorValue
interface represents the FirstSpirit input component CMS_INPUT_DOMTABLE
- Since:
- 2.3.17
- Example:
- How to get and store value
import de.espirit.firstspirit.access.editor.*; import de.espirit.firstspirit.access.Language; import de.espirit.firstspirit.access.editor.value.InvalidValueException; import de.espirit.firstspirit.access.editor.value.Table; import de.espirit.firstspirit.access.editor.value.TableCell; /** * Example how to get the value of a DomTableEditorValue and how to store a value into a DomTableEditorValue. * * @since 4.2.34 */ public class DomTableEditorValueExample { /** * A simple example how to append rows and columns to an empty DomTableEditorValue. * * ----------------------------- * | cell 0 (initial) | cell 1 | * ----------------------------- * | cell 2 | cell 3 | * ----------------------------- * * @since 4.2.34 */ public void setValueForLanguage(final DomTableEditorValue editor, final Language language) throws InvalidValueException { // 1. check if language is provided if editor is language dependent ("useLanguages='yes'" in gom syntax) if (editor.isLanguageDependent() && language == null) { throw new NullPointerException("Language is missing!"); } // 2. get the table of the editor value final Table table = editor.get(language); // 3. by default a new table already has one table cell - retrieve the already existing table cell final TableCell firstCell = table.getCell(0, 0); // 4. append an initial text to this cell firstCell.appendChild("cell 0 (initial)"); // 3. create new table structure table.addRow(table.getRows()); // add a new row at the end table.addColumn(table.getColumns()); // add a new column at the end // 4. retrieve table cells and append text content final TableCell tableCell1 = table.getCell(0, 1); tableCell1.appendChild("cell 1"); final TableCell tableCell2 = table.getCell(1, 0); tableCell2.appendChild("cell 2"); final TableCell tableCell3 = table.getCell(1, 1); tableCell3.appendChild("cell 3"); // 5. store dom element back into the editor value editor.set(language, table); } /** * Returns the value of the DomTableEditorValue for the given language. * * @since 4.2.34 */ public Table getValueForLanguage(final DomTableEditorValue editor, final Language language) { // 1. get the stored instance in the editor value final Table value = editor.get(language); // 2. and return the value for further processing return value; } }
-
Field Summary
FieldsFields inherited from interface de.espirit.firstspirit.access.editor.EditorValue
COPY_PRESET, DEFAULT, DELETE, FALLBACK_LANGUAGE, LANG_KEY, SOLE_LANGUAGE, UNSUPPORTED
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a column for the given language after the defined column index.void
Adds a row for the given language after the defined row index.void
deleteColumn
(Language language, int column) Deletes the column for the given language and the defined index.void
Deletes the row for the given language and the defined index.@NotNull List<LinkTemplate>
Get a list of allowed link types.@Nullable TableCell
Gets thecell
of this dom table with the givenrow
&col
index ornull
if no cell exists with these indices.int
getColumns
(Language language) Provides the number of columns for the given language.getForm()
Get the form definition.int
Provides the number of rows for the given language.getSection
(Language language, int row, int column) Get a cell defined by language, row, and column as Section object.Methods inherited from interface de.espirit.firstspirit.access.editor.EditorValue
addEditorValueListener, assimilate, beSet, clear, clear, findReferences, get, getContentType, getDataValue, getEditorLanguages, getGuiXml, getMatches, getSearchableString, getTagName, getValueType, initialize, isDefault, isEmpty, isLanguageDependent, isSet, isSet, isValid, removeEditorValueListener, set, setTagName, setValueNode, toXml, toXml, validate
-
Field Details
-
TABLE_KEY
Key for the table content.- Since:
- 4.0.17
- See Also:
-
-
Method Details
-
getRows
Provides the number of rows for the given language.- Parameters:
language
- The language for that the number of rows should be submitted.- Since:
- 3.0.95
-
getColumns
Provides the number of columns for the given language.- Parameters:
language
- The language for that the number of columns should be submitted.- Since:
- 3.0.95
-
addRow
Adds a row for the given language after the defined row index.- Parameters:
language
- The language for which the row should be added.afterRow
- The row index after which the row should be added.- Since:
- 3.0.95
-
deleteRow
Deletes the row for the given language and the defined index.- Parameters:
language
- The language for which the row should be deleted.row
- The row's index that should be deleted.- Since:
- 3.0.95
-
addColumn
Adds a column for the given language after the defined column index.- Parameters:
language
- The language for which the column should be added.afterColumn
- The column index after which the column should be added.- Since:
- 3.0.95
-
deleteColumn
Deletes the column for the given language and the defined index.- Parameters:
language
- The language for which the column should be deleted.column
- The column's index that should be deleted.- Since:
- 3.0.95
-
getCell
Gets thecell
of this dom table with the givenrow
&col
index ornull
if no cell exists with these indices.- Parameters:
language
- the language to get the cell value forrow
- the row indexcolumn
- the col index- Returns:
- TableCell or
null
if no cell exists for given indices - Since:
- 4.0.17
-
getForm
GomDomTable getForm()Get the form definition.- Specified by:
getForm
in interfaceEditorValue<Table>
- Returns:
- The form definition.
- Since:
- 4.0.17
-
getSection
Get a cell defined by language, row, and column as Section object.- Parameters:
language
- The language to look up.row
- The row of the cell.column
- The column of the cell.- Returns:
- The matching section or null.
- Since:
- 4.0.17
-
getAllowedLinkTemplates
Get a list of allowed link types.- Returns:
- The list of allowed link types.
- Since:
- 4.2.8
-