Class GuiHelper


  • public final class GuiHelper
    extends Object
    Helper-class for GUI-handling like sorting the treeview or creating/adding TreeItems or showing YesNoDialogs or other dialog-types and more.
    • Field Detail

      • treeComparator

        public static Comparator<javafx.scene.control.TreeItem<?>> treeComparator
    • Method Detail

      • addTableInfos

        public static void addTableInfos​(SQLTable table,
                                         javafx.scene.control.TreeItem tableItem)
        Add the TreeItems which represents the table informations of the given SQLTable 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)
        Returns true if the user pressed the OK-Button, otherwise false!
        Parameters:
        parent -
        modality -
        localId -
        defaultVal -
        Returns:
      • openYesNoDialog

        public static boolean openYesNoDialog​(String localId,
                                              String defaultVal)
        Returns true if the user pressed the OK-Button, otherwise false!
        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 -
      • addDatabaseToTree

        public static void addDatabaseToTree​(UnvisibleRoot root,
                                             javafx.scene.control.TreeItem rootNode,
                                             SQLDatabase db,
                                             SaveItem item,
                                             boolean refillGlobalLists)
      • tryGetSQLTable

        public static SQLTable tryGetSQLTable​(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)