Search in sources :

Example 1 with MainController

use of org.hortonmachine.style.MainController 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)

Aggregations

ActionEvent (java.awt.event.ActionEvent)1 File (java.io.File)1 IOException (java.io.IOException)1 AbstractAction (javax.swing.AbstractAction)1 ImageIcon (javax.swing.ImageIcon)1 JFrame (javax.swing.JFrame)1 DefaultGuiBridgeImpl (org.hortonmachine.gui.utils.DefaultGuiBridgeImpl)1 MainController (org.hortonmachine.style.MainController)1