Search in sources :

Example 1 with DefaultGuiBridgeImpl

use of org.hortonmachine.gui.utils.DefaultGuiBridgeImpl in project hortonmachine by TheHortonMachine.

the class LasInfoController method main.

public static void main(String[] args) {
    GuiUtilities.setDefaultLookAndFeel();
    DefaultGuiBridgeImpl gBridge = new DefaultGuiBridgeImpl();
    final LasInfoController controller = new LasInfoController();
    final JFrame frame = gBridge.showWindow(controller.asJComponent(), "HortonMachine Las Info Viewer");
    GuiUtilities.setDefaultFrameIcon(frame);
    GuiUtilities.addClosingListener(frame, controller);
}
Also used : JFrame(javax.swing.JFrame) DefaultGuiBridgeImpl(org.hortonmachine.gui.utils.DefaultGuiBridgeImpl)

Example 2 with DefaultGuiBridgeImpl

use of org.hortonmachine.gui.utils.DefaultGuiBridgeImpl in project hortonmachine by TheHortonMachine.

the class SpatialtoolboxController method main.

public static void main(String[] args) throws Exception {
    GuiUtilities.setDefaultLookAndFeel();
    File libsFile = null;
    try {
        String libsPath = args[0];
        libsFile = new File(libsPath);
    } catch (Exception e1) {
    // IGNORE
    }
    if (libsFile == null || !libsFile.exists() || !libsFile.isDirectory()) {
        Logger.INSTANCE.insertWarning("", "The libraries folder is missing or not properly set.");
        libsFile = new File("/home/hydrologis/development/hortonmachine-git/extras/deploy/libs");
        if (!libsFile.exists()) {
            libsFile = new File("/Users/hydrologis/development/hortonmachine-git/extras/deploy/libs");
        }
    // System.exit(1);
    }
    Logger.INSTANCE.insertInfo("", "Libraries folder used: " + libsFile.getAbsolutePath());
    HortonmachineModulesManager.getInstance().init();
    DefaultGuiBridgeImpl gBridge = new DefaultGuiBridgeImpl();
    gBridge.setLibsFolder(libsFile);
    final SpatialtoolboxController controller = new SpatialtoolboxController(gBridge);
    final JFrame frame = gBridge.showWindow(controller.asJComponent(), "The HortonMachine Spatial Toolbox");
    GuiUtilities.setDefaultFrameIcon(frame);
    GuiUtilities.addClosingListener(frame, controller);
}
Also used : JFrame(javax.swing.JFrame) DefaultGuiBridgeImpl(org.hortonmachine.gui.utils.DefaultGuiBridgeImpl) File(java.io.File) IOException(java.io.IOException)

Example 3 with DefaultGuiBridgeImpl

use of org.hortonmachine.gui.utils.DefaultGuiBridgeImpl in project hortonmachine by TheHortonMachine.

the class DatabaseViewer method main.

public static void main(String[] args) throws Exception {
    GuiUtilities.setDefaultLookAndFeel();
    DefaultGuiBridgeImpl gBridge = new DefaultGuiBridgeImpl();
    final DatabaseViewer controller = new DatabaseViewer(gBridge);
    SettingsController.applySettings(controller);
    final JFrame frame = gBridge.showWindow(controller.asJComponent(), "HortonMachine Database Viewer");
    GuiUtilities.setDefaultFrameIcon(frame);
    GuiUtilities.addClosingListener(frame, controller);
    File openFile = null;
    if (args.length > 0 && new File(args[0]).exists()) {
        openFile = new File(args[0]);
    } else {
        String lastPath = PreferencesHandler.getPreference(DatabaseGuiUtils.HM_SPATIALITE_LAST_FILE, (String) null);
        if (lastPath != null) {
            File tmp = new File(lastPath);
            if (tmp.exists()) {
                openFile = tmp;
            }
        }
    }
    if (openFile != null) {
        String absolutePath = openFile.getAbsolutePath();
        EDb dbType = null;
        if (SpatialiteCommonMethods.isSqliteFile(openFile)) {
            if (absolutePath.endsWith(EDb.GEOPACKAGE.getExtension())) {
                dbType = EDb.GEOPACKAGE;
            } else {
                dbType = EDb.SPATIALITE;
            }
        } else if (absolutePath.endsWith(EDb.H2GIS.getExtension())) {
            dbType = EDb.H2GIS;
        } else {
            absolutePath = null;
        }
        controller.openDatabase(dbType, absolutePath, null, null);
    }
}
Also used : EDb(org.hortonmachine.dbs.compat.EDb) JFrame(javax.swing.JFrame) DefaultGuiBridgeImpl(org.hortonmachine.gui.utils.DefaultGuiBridgeImpl) File(java.io.File)

Example 4 with DefaultGuiBridgeImpl

use of org.hortonmachine.gui.utils.DefaultGuiBridgeImpl in project hortonmachine by TheHortonMachine.

the class SqlTemplatesAndActions method getOpenInSldEditorAction.

public Action getOpenInSldEditorAction(TableLevel table, DatabaseViewer spatialiteViewer) {
    if (isNosql) {
        return null;
    }
    if (spatialiteViewer.currentConnectedSqlDatabase.getType() == EDb.GEOPACKAGE || spatialiteViewer.currentConnectedSqlDatabase.getType() == EDb.POSTGRES || spatialiteViewer.currentConnectedSqlDatabase.getType() == EDb.POSTGIS) {
        return new AbstractAction("Open in SLD editor") {

            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    DefaultGuiBridgeImpl gBridge = new DefaultGuiBridgeImpl();
                    String databasePath = spatialiteViewer.currentConnectedSqlDatabase.getDatabasePath();
                    final MainController controller = new MainController(new File(databasePath), table.tableName);
                    final JFrame frame = gBridge.showWindow(controller.asJComponent(), "HortonMachine SLD Editor");
                    Class<DatabaseViewer> class1 = DatabaseViewer.class;
                    ImageIcon icon = new ImageIcon(class1.getResource("/org/hortonmachine/images/hm150.png"));
                    frame.setIconImage(icon.getImage());
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        };
    } else {
        return null;
    }
}
Also used : ImageIcon(javax.swing.ImageIcon) JFrame(javax.swing.JFrame) ActionEvent(java.awt.event.ActionEvent) DefaultGuiBridgeImpl(org.hortonmachine.gui.utils.DefaultGuiBridgeImpl) MainController(org.hortonmachine.style.MainController) AbstractAction(javax.swing.AbstractAction) File(java.io.File) IOException(java.io.IOException)

Example 5 with DefaultGuiBridgeImpl

use of org.hortonmachine.gui.utils.DefaultGuiBridgeImpl in project hortonmachine by TheHortonMachine.

the class SqlTemplatesAndActions method getOpenInGformsEditorAction.

public Action getOpenInGformsEditorAction(TableLevel table, DatabaseViewer spatialiteViewer) {
    if (isNosql) {
        return null;
    }
    if (spatialiteViewer.currentConnectedSqlDatabase.getType() == EDb.GEOPACKAGE || spatialiteViewer.currentConnectedSqlDatabase.getType() == EDb.POSTGRES || spatialiteViewer.currentConnectedSqlDatabase.getType() == EDb.POSTGIS) {
        return new AbstractAction("Open in FORMS editor") {

            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    DefaultGuiBridgeImpl gBridge = new DefaultGuiBridgeImpl();
                    IFormHandler formHandler = new DbFormHandler(spatialiteViewer.currentConnectedSqlDatabase, table.tableName);
                    final FormBuilderController controller = new FormBuilderController(formHandler);
                    final JFrame frame = gBridge.showWindow(controller.asJComponent(), "HortonMachine FORMS Editor");
                    Class<DatabaseViewer> class1 = DatabaseViewer.class;
                    ImageIcon icon = new ImageIcon(class1.getResource("/org/hortonmachine/images/hm150.png"));
                    frame.setIconImage(icon.getImage());
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        };
    } else {
        return null;
    }
}
Also used : ImageIcon(javax.swing.ImageIcon) DbFormHandler(org.hortonmachine.gforms.DbFormHandler) JFrame(javax.swing.JFrame) ActionEvent(java.awt.event.ActionEvent) DefaultGuiBridgeImpl(org.hortonmachine.gui.utils.DefaultGuiBridgeImpl) IFormHandler(org.hortonmachine.gforms.IFormHandler) AbstractAction(javax.swing.AbstractAction) FormBuilderController(org.hortonmachine.gforms.FormBuilderController) IOException(java.io.IOException)

Aggregations

DefaultGuiBridgeImpl (org.hortonmachine.gui.utils.DefaultGuiBridgeImpl)12 JFrame (javax.swing.JFrame)11 File (java.io.File)7 IOException (java.io.IOException)4 ActionEvent (java.awt.event.ActionEvent)3 AbstractAction (javax.swing.AbstractAction)3 ImageIcon (javax.swing.ImageIcon)3 BadLocationException (javax.swing.text.BadLocationException)1 ADb (org.hortonmachine.dbs.compat.ADb)1 EDb (org.hortonmachine.dbs.compat.EDb)1 QueryResult (org.hortonmachine.dbs.compat.objects.QueryResult)1 EDataType (org.hortonmachine.dbs.datatypes.EDataType)1 DbFormHandler (org.hortonmachine.gforms.DbFormHandler)1 FormBuilderController (org.hortonmachine.gforms.FormBuilderController)1 IFormHandler (org.hortonmachine.gforms.IFormHandler)1 MainController (org.hortonmachine.style.MainController)1