Example usage for javafx.application Platform isAccessibilityActive

List of usage examples for javafx.application Platform isAccessibilityActive

Introduction

In this page you can find the example usage for javafx.application Platform isAccessibilityActive.

Prototype

public static boolean isAccessibilityActive() 

Source Link

Usage

From source file:cz.lbenda.dataman.db.DbStructureFactory.java

public void generateStructure() {
    try (Connection conn = connectionProvider.getConnection()) {
        Map<String, CatalogDesc> catalogs = new HashMap<>();

        DatabaseMetaData dmd = conn.getMetaData();
        SQLDialect dialect = dbConfig.getDialect();
        StatusHelper.getInstance().progressStart(this, TASK_NAME, progressStepCount);
        try (ResultSet tabs = dmd.getTables(null, null, null, null)) {
            tabs.last();//from w  w  w  .  j a v a 2 s  .c o m
            StatusHelper.getInstance().progressNextStep(this, STEP_READ_TABLES, tabs.getRow());
        } catch (SQLException e) {
            StatusHelper.getInstance().progressNextStep(this, STEP_READ_TABLES, 200);
        }
        try (ResultSet tabs = dmd.getTables(null, null, null, null)) {
            while (tabs.next()) {
                StatusHelper.getInstance().progress(this);
                String catalogName = tabs.getString(dialect.tableCatalog());
                String schemaName = tabs.getString(dialect.tableSchema());
                String tableName = tabs.getString(dialect.tableName());
                CatalogDesc catalogDesc = catalogs.get(catalogName);
                if (catalogDesc == null) {
                    catalogDesc = new CatalogDesc(catalogName);
                    catalogs.put(catalogDesc.getName(), catalogDesc);
                }
                SchemaDesc schema = catalogDesc.getSchema(schemaName);
                if (schema == null) {
                    schema = new SchemaDesc(catalogDesc, schemaName);
                    catalogDesc.getSchemas().add(schema);
                }
                TableDesc tableDesc = schema.getTable(tableName);
                if (tableDesc == null) {
                    tableDesc = new TableDesc(schema, tabs.getString(dialect.tableType()), tableName);
                    tableDesc.setDbConfig(dbConfig);
                    schema.getTables().add(tableDesc);
                }
                tableDesc.setSavableRegister(connectionProvider.getSavableRegistry());
                tableDesc.setComment(dialect.tableRemarks());
            }
            generateStructureColumns(catalogs, dmd);
            generatePKColumns(catalogs.values(), dmd);
            generateStructureForeignKeys(catalogs, dmd);
            dbConfig.getCatalogs().clear();
            if (Platform.isAccessibilityActive()) {
                Platform.runLater(() -> dbConfig.getCatalogs().addAll(catalogs.values()));
            } else {
                dbConfig.getCatalogs().addAll(catalogs.values());
            }
            StatusHelper.getInstance().progressFinish(this, STEP_FINISH);
        }
    } catch (Exception e) {
        LOG.error("Problem with read database structure", e);
        throw new RuntimeException(e);
    }
}