Class GuiHelper
- java.lang.Object
-
- org.teichert.databaseexplorer.utils.GuiHelper
-
public final class GuiHelper extends Object
Helper-class for GUI-handling like sorting the treeview or creating/addingTreeItem
s or showingYesNoDialog
s or other dialog-types and more.
-
-
Field Summary
Fields Modifier and Type Field Description static Comparator<SaveItem>
comparatorPosition
static Comparator<javafx.scene.control.TreeItem<?>>
treeComparator
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addDatabaseToTree(UnvisibleRoot root, javafx.scene.control.TreeItem rootNode, SQLDatabase db, SaveItem item, boolean refillGlobalLists)
static void
addServerToTree(UnvisibleRoot root, javafx.scene.control.TreeItem rootNode, SQLServer server, SaveItem item, boolean refillGlobalLists)
static void
addTableInfos(SQLTable table, javafx.scene.control.TreeItem tableItem)
Add the TreeItems which represents the table informations of the givenSQLTable
like TableColumns, Indexes or ForeignKeys (Constraints).static List<javafx.scene.control.MenuItem>
createDefaultMenuItems(javafx.scene.control.TextInputControl t)
static List<javafx.scene.control.TreeItem<SQLForeignInfo>>
createForeignInfoTreeItems(SQLTable table, javafx.scene.control.TreeItem tableItem)
static List<javafx.scene.control.TreeItem<SQLIndex>>
createIndexTreeItems(SQLTable table, javafx.scene.control.TreeItem tableItem)
static javafx.scene.control.TreeItem<SQLTable>
createTableTreeItem(javafx.scene.control.TreeItem<SQLTable> dbItem, SQLTable table)
static List<javafx.scene.control.TreeItem<SQLTrigger>>
createTriggerTreeItems(SQLTable table, javafx.scene.control.TreeItem tableItem)
static void
fillConstraints(boolean preventSaving)
static <T> javafx.scene.control.TreeItem<T>
getSpecificTreeItem(javafx.scene.control.TreeItem<?> ti, T searchedItem)
static String
openInputDialog(String localId, String defaultVal, String initText)
Returns a specific text from the user inputstatic String
openInputDialog(String localId, String defaultVal, String initText, boolean asPasswordField)
Returns a specific text from the user inputstatic String
openInputDialog(javafx.stage.Window parent, javafx.stage.Modality modality, String localId, String defaultVal, String initText)
Returns a specific text from the user inputstatic String
openInputDialog(javafx.stage.Window parent, javafx.stage.Modality modality, String localId, String defaultVal, String initText, boolean asPasswordField)
Returns a specific text from the user inputstatic void
openMessage(String message, double timeInSeconds)
Opens a MessageDialog with "Success" as title.
timeInSeconds
will be the time how long the messageDialog is being showed.
A Value below 1 will show the dialog until the user close it!static void
openMessage(String title, String message, String localIdTitle, String localIdMessagee, double timeInSeconds)
Opens a Info MessageDialog.
timeInSeconds
will be the time how long the messageDialog is being showed.
A Value below 1 will show the dialog until the user close it!static void
openMessage(String title, String message, String localIdTitle, String localIdMessagee, MessageNotificationType notificationType, double timeInSeconds)
Opens a MessageDialog depending on its notificationType.
timeInSeconds
will be the time how long the messageDialog is being showed.
A Value below 1 will show the dialog until the user close it!static void
openMessage(String title, String message, MessageNotificationType notificationType, double timeInSeconds)
Opens a MessageDialog depending on its notificationType.
timeInSeconds
will be the time how long the messageDialog is being showed.
A Value below 1 will show the dialog until the user close it!static boolean
openYesNoDialog(String localId, String defaultVal)
Returnstrue
if the user pressed the OK-Button, otherwisefalse
!static boolean
openYesNoDialog(javafx.stage.Window parent, javafx.stage.Modality modality, String localId, String defaultVal)
Returnstrue
if the user pressed the OK-Button, otherwisefalse
!static void
refreshHiarically(javafx.scene.control.TreeView tree, javafx.scene.control.TreeItem<?> item, IItemLoadedListener... listeners)
Refresh the given treeItem downwards (recursivly).static void
refreshSelected(javafx.scene.control.TreeView tree, javafx.scene.control.TreeItem<?> item, IItemLoadedListener... listeners)
static void
refreshTree(javafx.scene.control.TreeView<?> tree, UnvisibleRoot root, javafx.scene.control.Menu menuTools, boolean refillGlobalLists, boolean showMessage, boolean useCache, IItemLoadedListener... listeners)
Main Refresh-Method which also loads over the cache if it is activated.static void
refreshTree(javafx.scene.control.TreeView tree, SQLDatabase db, javafx.scene.control.TreeItem itemDB, boolean refreshTree, IItemLoadedListener... listeners)
static void
refreshTree(javafx.scene.control.TreeView tree, SQLServer server, javafx.scene.control.TreeItem itemServer, boolean refreshTree, IItemLoadedListener... listeners)
static void
refreshTree(javafx.scene.control.TreeView tree, SQLTable table, javafx.scene.control.TreeItem<?> tableItem, boolean refreshTree, IItemLoadedListener... listeners)
static void
refreshTreeViaCache(javafx.scene.control.TreeView<?> tree, UnvisibleRoot root, javafx.scene.control.Menu menuTools, IItemLoadedListener... listeners)
static void
saveForeignKeys(SQLTableColumn colAlloc)
static void
setTreeMenuItemVisibility(javafx.scene.control.MenuItem item, javafx.collections.ObservableList<? extends javafx.scene.control.TreeItem<?>> selectedItems)
static SQLDatabase
tryGetSQLDatabase(Object obj)
static javafx.scene.control.TreeItem<SQLTable>
tryGetSQLDatabase(javafx.scene.control.TreeItem<?> treeItem)
static SQLTable
tryGetSQLTable(Object obj)
-
-
-
Field Detail
-
treeComparator
public static Comparator<javafx.scene.control.TreeItem<?>> treeComparator
-
comparatorPosition
public static final Comparator<SaveItem> comparatorPosition
-
-
Method Detail
-
addTableInfos
public static void addTableInfos(SQLTable table, javafx.scene.control.TreeItem tableItem)
Add the TreeItems which represents the table informations of the givenSQLTable
like TableColumns, Indexes or ForeignKeys (Constraints).- Parameters:
table
-tableItem
-
-
createIndexTreeItems
public static List<javafx.scene.control.TreeItem<SQLIndex>> createIndexTreeItems(SQLTable table, javafx.scene.control.TreeItem tableItem)
-
createForeignInfoTreeItems
public static List<javafx.scene.control.TreeItem<SQLForeignInfo>> createForeignInfoTreeItems(SQLTable table, javafx.scene.control.TreeItem tableItem)
-
createTriggerTreeItems
public static List<javafx.scene.control.TreeItem<SQLTrigger>> createTriggerTreeItems(SQLTable table, javafx.scene.control.TreeItem tableItem)
-
createTableTreeItem
public static javafx.scene.control.TreeItem<SQLTable> createTableTreeItem(javafx.scene.control.TreeItem<SQLTable> dbItem, SQLTable table)
-
openYesNoDialog
public static boolean openYesNoDialog(javafx.stage.Window parent, javafx.stage.Modality modality, String localId, String defaultVal)
Returnstrue
if the user pressed the OK-Button, otherwisefalse
!- Parameters:
parent
-modality
-localId
-defaultVal
-- Returns:
-
openYesNoDialog
public static boolean openYesNoDialog(String localId, String defaultVal)
Returnstrue
if the user pressed the OK-Button, otherwisefalse
!- Parameters:
localId
-defaultVal
-- Returns:
-
openInputDialog
public static String openInputDialog(javafx.stage.Window parent, javafx.stage.Modality modality, String localId, String defaultVal, String initText)
Returns a specific text from the user input- Parameters:
parent
-modality
-localId
-defaultVal
-- Returns:
-
openInputDialog
public static String openInputDialog(String localId, String defaultVal, String initText)
Returns a specific text from the user input- Parameters:
localId
-defaultVal
-- Returns:
-
createDefaultMenuItems
public static List<javafx.scene.control.MenuItem> createDefaultMenuItems(javafx.scene.control.TextInputControl t)
-
openInputDialog
public static String openInputDialog(javafx.stage.Window parent, javafx.stage.Modality modality, String localId, String defaultVal, String initText, boolean asPasswordField)
Returns a specific text from the user input- Parameters:
parent
-modality
-localId
-defaultVal
-asPasswordField
-- Returns:
-
openInputDialog
public static String openInputDialog(String localId, String defaultVal, String initText, boolean asPasswordField)
Returns a specific text from the user input- Parameters:
localId
-defaultVal
-asPasswordField
-- Returns:
-
openMessage
public static void openMessage(String message, double timeInSeconds)
Opens a MessageDialog with "Success" as title.
timeInSeconds
will be the time how long the messageDialog is being showed.
A Value below 1 will show the dialog until the user close it!- Parameters:
message
-timeInSeconds
-
-
openMessage
public static void openMessage(String title, String message, MessageNotificationType notificationType, double timeInSeconds)
Opens a MessageDialog depending on its notificationType.
timeInSeconds
will be the time how long the messageDialog is being showed.
A Value below 1 will show the dialog until the user close it!- Parameters:
title
-message
-notificationType
-timeInSeconds
-
-
openMessage
public static void openMessage(String title, String message, String localIdTitle, String localIdMessagee, double timeInSeconds)
Opens a Info MessageDialog.
timeInSeconds
will be the time how long the messageDialog is being showed.
A Value below 1 will show the dialog until the user close it!- Parameters:
title
-message
-localIdTitle
-localIdMessagee
-timeInSeconds
-
-
openMessage
public static void openMessage(String title, String message, String localIdTitle, String localIdMessagee, MessageNotificationType notificationType, double timeInSeconds)
Opens a MessageDialog depending on its notificationType.
timeInSeconds
will be the time how long the messageDialog is being showed.
A Value below 1 will show the dialog until the user close it!- Parameters:
title
-message
-localIdTitle
-localIdMessagee
-notificationType
-timeInSeconds
-
-
refreshHiarically
public static void refreshHiarically(javafx.scene.control.TreeView tree, javafx.scene.control.TreeItem<?> item, IItemLoadedListener... listeners)
Refresh the given treeItem downwards (recursivly).- Parameters:
tree
-item
-listeners
-
-
refreshSelected
public static void refreshSelected(javafx.scene.control.TreeView tree, javafx.scene.control.TreeItem<?> item, IItemLoadedListener... listeners)
-
setTreeMenuItemVisibility
public static void setTreeMenuItemVisibility(javafx.scene.control.MenuItem item, javafx.collections.ObservableList<? extends javafx.scene.control.TreeItem<?>> selectedItems)
-
refreshTreeViaCache
public static void refreshTreeViaCache(javafx.scene.control.TreeView<?> tree, UnvisibleRoot root, javafx.scene.control.Menu menuTools, IItemLoadedListener... listeners)
-
refreshTree
public static void refreshTree(javafx.scene.control.TreeView<?> tree, UnvisibleRoot root, javafx.scene.control.Menu menuTools, boolean refillGlobalLists, boolean showMessage, boolean useCache, IItemLoadedListener... listeners)
Main Refresh-Method which also loads over the cache if it is activated.- Parameters:
tree
-root
-menuTools
-refillGlobalLists
-showMessage
-useCache
-listeners
-
-
addServerToTree
public static void addServerToTree(UnvisibleRoot root, javafx.scene.control.TreeItem rootNode, SQLServer server, SaveItem item, boolean refillGlobalLists) throws SQLException
- Throws:
SQLException
-
addDatabaseToTree
public static void addDatabaseToTree(UnvisibleRoot root, javafx.scene.control.TreeItem rootNode, SQLDatabase db, SaveItem item, boolean refillGlobalLists)
-
tryGetSQLDatabase
public static SQLDatabase tryGetSQLDatabase(Object obj)
-
tryGetSQLDatabase
public static javafx.scene.control.TreeItem<SQLTable> tryGetSQLDatabase(javafx.scene.control.TreeItem<?> treeItem)
-
refreshTree
public static void refreshTree(javafx.scene.control.TreeView tree, SQLDatabase db, javafx.scene.control.TreeItem itemDB, boolean refreshTree, IItemLoadedListener... listeners)
-
refreshTree
public static void refreshTree(javafx.scene.control.TreeView tree, SQLServer server, javafx.scene.control.TreeItem itemServer, boolean refreshTree, IItemLoadedListener... listeners)
-
refreshTree
public static void refreshTree(javafx.scene.control.TreeView tree, SQLTable table, javafx.scene.control.TreeItem<?> tableItem, boolean refreshTree, IItemLoadedListener... listeners)
-
fillConstraints
public static void fillConstraints(boolean preventSaving)
-
getSpecificTreeItem
public static <T> javafx.scene.control.TreeItem<T> getSpecificTreeItem(javafx.scene.control.TreeItem<?> ti, T searchedItem)
-
saveForeignKeys
public static void saveForeignKeys(SQLTableColumn colAlloc)
-
-