java.lang.Object
org.tentackle.fx.rdc.table.TablePopup<S>
- Type Parameters:
S
- the table element type
Table popup.
Provides a context menu with several handy features such as export to excel, save and load table settings, etc...
The popup can be used for tables and tree tables.
Provides a context menu with several handy features such as export to excel, save and load table settings, etc...
The popup can be used for tables and tree tables.
- Author:
- harald
-
Constructor Summary
ConstructorDescriptionTablePopup
(FxTableView<S> table, String preferencesSuffix, String title) Creates a table popup.TablePopup
(FxTreeTableView<S> treeTable, String preferencesSuffix, String title) Creates a table popup. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Resizes all columns to fit their content.void
collapseTreeTable
(javafx.scene.control.TreeItem<S> selectedItem) Recursively collapses the items of the treetable.javafx.scene.control.ContextMenu
Creates the context menu.void
expandTreeTable
(javafx.scene.control.TreeItem<S> selectedItem) Recursively expands the items of the treetable.Gets the table preferences suffix.getTable()
Gets the table.getTitle()
Gets the printed title.Gets the tree table.boolean
Returns whether the column menu is enabled.void
Loads the table preferences.
System- or user scope is determined fromPersistedPreferencesFactory
.void
loadPreferences
(boolean system) Loads the table preferences.void
print()
Prints the table.void
Saves the table preferences.
System- or user scope is determined fromPersistedPreferencesFactory
.void
savePreferences
(boolean system) Saves the table preferences.void
setColumnMenuEnabled
(boolean columnMenuEnabled) Enables or disables the column menu.
The column menu allows to set the visibility of columns.void
setPreferencesSuffix
(String preferencesSuffix) Sets the table preferences suffix.void
Sets the printed title.void
toSpreadsheet
(boolean onlySelected) Opens a dialog to export a table to an Excel sheet.void
toXml
(boolean onlySelected) Opens a dialog to export a table to a spreadsheet.
-
Constructor Details
-
TablePopup
Creates a table popup.- Parameters:
table
- the tablepreferencesSuffix
- the preferences suffix to load/save table preferences, null if from table configtitle
- the title of the printed table, null if from table config
-
TablePopup
Creates a table popup.- Parameters:
treeTable
- the treetablepreferencesSuffix
- the preferences suffix to load/save table preferences, null if from table configtitle
- the title of the printed table, null if from table config
-
-
Method Details
-
getTable
Gets the table.- Returns:
- the table, null if treetable popup
-
getTreeTable
Gets the tree table.- Returns:
- the treetable, null if table popup
-
getTitle
Gets the printed title.- Returns:
- the title
-
setTitle
Sets the printed title.- Parameters:
title
- the title for printings
-
getPreferencesSuffix
Gets the table preferences suffix.- Returns:
- the suffix
-
setPreferencesSuffix
Sets the table preferences suffix.- Parameters:
preferencesSuffix
- the suffix
-
isColumnMenuEnabled
public boolean isColumnMenuEnabled()Returns whether the column menu is enabled.- Returns:
- true if column menu is enabled
-
setColumnMenuEnabled
public void setColumnMenuEnabled(boolean columnMenuEnabled) Enables or disables the column menu.
The column menu allows to set the visibility of columns.- Parameters:
columnMenuEnabled
- true to enable column menu (default)
-
expandTreeTable
Recursively expands the items of the treetable.- Parameters:
selectedItem
- the selected item to start, null for whole treetable
-
collapseTreeTable
Recursively collapses the items of the treetable.- Parameters:
selectedItem
- the selected item to start, null for whole treetable
-
createContextMenu
public javafx.scene.control.ContextMenu createContextMenu()Creates the context menu.- Returns:
- the context menu
-
autoWidth
public void autoWidth()Resizes all columns to fit their content. -
print
public void print()Prints the table. -
toSpreadsheet
public void toSpreadsheet(boolean onlySelected) Opens a dialog to export a table to an Excel sheet.- Parameters:
onlySelected
- true if export only selected rows
-
toXml
public void toXml(boolean onlySelected) Opens a dialog to export a table to a spreadsheet.- Parameters:
onlySelected
- true if export only selected rows
-
savePreferences
public void savePreferences(boolean system) Saves the table preferences.- Parameters:
system
- true if system scope, else user
-
savePreferences
public void savePreferences()Saves the table preferences.
System- or user scope is determined fromPersistedPreferencesFactory
. -
loadPreferences
public void loadPreferences(boolean system) Loads the table preferences.- Parameters:
system
- true if from system scope only, else try user first
-
loadPreferences
public void loadPreferences()Loads the table preferences.
System- or user scope is determined fromPersistedPreferencesFactory
.
-