Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Commit

Permalink
Merge 'dev_tools' into 'dev' (#32)
Browse files Browse the repository at this point in the history
* Write function SQL file from Database

* wip task DbToFiles
Rename task CopyFunctionsSchema to FilesToDb

* Parametrize folders adding parameters in properties file

* Bug fix

* Manage UTF-8 without BOM

* Add frame Developer Toolbox
Add functions FilesToDb and DbToFiles

* Bug fixes in Create Schema and Copy Functions

* Bug fix managing execution result

* Dev Tools: manage checkboxes
  • Loading branch information
daviderill authored Nov 8, 2016
1 parent 887c10e commit d0f0102
Show file tree
Hide file tree
Showing 25 changed files with 902 additions and 173 deletions.
6 changes: 6 additions & 0 deletions config/giswater.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ FILE_SQL=
LANGUAGE=en
PROJECT_UPDATE=ask

# DEVELOPER TOOLS
DEV_TOOLS=true
FOLDER_FCT=
FOLDER_FCT_UTILS=
FOLDER_VIEWS=

# FIXED PARAMETERS
DB_CONFIG=config.sqlite
FOLDER_CONFIG=inp
Expand Down
12 changes: 8 additions & 4 deletions i18n/form.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Field ResourceBundle: BUNDLE
#Tue Aug 16 20:10:10 CEST 2016
#Tue Nov 08 17:10:26 CET 2016
ArcCatalogDialog.btnClose.toolTipText=Close window
ArcCatalogDialog.btnCreate.toolTipText=Insert record
ArcCatalogDialog.btnDelete.toolTipText=Delete record
Expand Down Expand Up @@ -105,6 +105,9 @@ DemandDialog.lblPatternId.text=Pattern id\:
DemandDialog.lblTsectid.text=Demand\:
DemandDialog.panelGeneral.borderTitle=GENERAL
DemandDialog.this.title=Demand table
DevToolboxPanel.chkFunctions.text=Functions
DevToolboxPanel.chkTriggers.text=Triggers
DevToolboxPanel.chkViews.text=Views
DownloadPanel.btnCancelar.text=Cancel
EmitterDialog.btnDelete.toolTipText=Delete record
EmitterDialog.btnInsert.toolTipText=Insert record
Expand Down Expand Up @@ -248,7 +251,7 @@ MainForm.rdbtnDbf.text=DBF
MainFrame.gisFrame.title=GIS Configuration
MainFrame.mnAbout.text=About
MainFrame.mnConfiguration.text=Configuration
MainFrame.mnData.text=Data
MainFrame.mnData.text=Tools
MainFrame.mnGisProject.text=Project example
MainFrame.mnManager.text=Data
MainFrame.mnNewVersionAvailable.text=New version available\!
Expand All @@ -264,6 +267,7 @@ MainFrame.mntmCreateHecrasSample.text=River analysis
MainFrame.mntmCurves.text=Curves
MainFrame.mntmDatabase.text=Database connection
MainFrame.mntmDatabaseAdministrator.text=Database Administrator
MainFrame.mntmDevTools.text=Developer toolbox
MainFrame.mntmEditProjectPreferences.text=Edit project preferences
MainFrame.mntmExit.text=Exit
MainFrame.mntmGisProject.text=Create GIS project
Expand Down Expand Up @@ -435,11 +439,11 @@ ProjectPanel.panelTable.borderTitle=Coordinate Reference Systems
ProjectPreferencesPanel.btnAccept.text=Accept
ProjectPreferencesPanel.btnApply.text=Apply
ProjectPreferencesPanel.btnCopy.text=Copy
ProjectPreferencesPanel.btnCopyFunctions.actionCommand=copyFunctions
ProjectPreferencesPanel.btnCopyFunctions.text=Copy functions
ProjectPreferencesPanel.btnCopyFunctions.text=Files to DB
ProjectPreferencesPanel.btnCreate.text=Create
ProjectPreferencesPanel.btnCreateGisProject.text=Create
ProjectPreferencesPanel.btnCreateGisProject.text_1=Create Gis Project
ProjectPreferencesPanel.btnDbToFiles.text=DB to Files
ProjectPreferencesPanel.btnDelete.text=Delete
ProjectPreferencesPanel.btnEpa.text=Go2Epa
ProjectPreferencesPanel.btnGisProject.text=Gis Project
Expand Down
1 change: 1 addition & 0 deletions i18n/form_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ MainFrame.mntmTimeseries.text=Timeseries
MainFrame.mntmVersion.text=Versi\u00F3n
MainFrame.mntmWebPage.text=Ver Web
MainFrame.mntmWelcome.text=Bienvenido
MainFrame.mntmDevTools.text=Developer toolbox
MainFrame.this.title=Giswater panel de control
OptionsDialog.lblIgnoreRainfall.text=Ignorar lluvia\:
ProjectPreferencesPanel.btnCopy.text=Copiar
Expand Down
7 changes: 7 additions & 0 deletions i18n/text_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ gis_panel_qgis = GIS project configuration
gis_creation = WARNING:\nYour database password will be stored in plain text in your project files and in your home directory on Unix-like systems, or in your Windows user profile.\nIf you do not want this to happen, please press 'No' button or consider fixing it in GIS desktop project
gis_dbf_option = DBF option not available for HECRAS software
software_panel = Software configuration
dev_toolbox_panel = Developer toolbox
db_options = Database connection
import_sure = Are you sure that you want to import the selected file into the Database?
close_connection = Close connection
Expand Down Expand Up @@ -133,6 +134,9 @@ CreateSchemaTask.project=Project '
CreateSchemaTask.project_create=Create Project
CreateSchemaTask.project_not_created=Project could not be created

DbToFiles.success=Process completed successfully
DbToFiles.error=Error generating files

download_version = Download new version

DownloadPanel.downloading_file=Downloading file:
Expand Down Expand Up @@ -171,6 +175,9 @@ ExecuteTask.raster_not_found=The raster file 'topo.asc' was not found in the INP
ExportToInp.file_already_exists=The selected file already exists:\n '
ExportToInp.overwrite=' \nDo you want to overwrite it?

FilesToDb.success=Process completed successfully
FilesToDb.error=Error importing files into Database

GisPanel.connect_database=You should connect to a Database
GisPanel.select_folder=You have to select a Folder
GisPanel.type_name=Type a valid name
Expand Down
1 change: 1 addition & 0 deletions i18n/text_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ gis_panel_qgis = Configuraci
gis_creation = WARNING:\nYour database password will be stored in plain text in your project files and in your home directory on Unix-like systems, or in your user profile on Windows.\nIf you do not want this to happen, please press 'No' button or consider fixing it in GIS desktop project
gis_dbf_option = Opción DBF no disponible para el software HECRAS
software_panel = Configuración software
dev_toolbox_panel = Developer toolbox
db_options = Conexión Base de Datos
import_sure = ¿Está seguro que desea importar a la Base de Datos el archivo seleccionado?
close_connection = Cerrar conexión
Expand Down
7 changes: 7 additions & 0 deletions i18n/text_pt.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ gis_panel_qgis = Configura
gis_creation = AVISO:\nA sua palavra-passe da base de dados será armazenada em texto simples nos ficheiros do projeto, na pasta home em sistemas do tipo Unix ou na sua pasta de usuário do Windows.\n Se você não quer que isso aconteça, por favor clique em "Não" ou corrija no projeto SIG
gis_dbf_option = A opção DBF não está disponível para o software HECRAS
software_panel = Configuração do software
dev_toolbox_panel = Developer toolbox
db_options = Conexão à base de dados
import_sure = Tem certeza que você deseja importar o ficheiro selecionado para a base de dados?
close_connection = Fechar conexão
Expand Down Expand Up @@ -133,6 +134,9 @@ CreateSchemaTask.project=Projeto '
CreateSchemaTask.project_create=Criar projeto
CreateSchemaTask.project_not_created=Projeto não pode ser criado

DbToFiles.success=Process completed successfully
DbToFiles.error=Error generating files

download_version=Descarregar nova versão

DownloadPanel.downloading_file=Descarregando o ficheiro:
Expand Down Expand Up @@ -171,6 +175,9 @@ ExecuteTask.raster_not_found=O ficheiro raster 'topo.asc' n
ExportToInp.file_already_exists=O ficheiro selecionado já existe:\n '
ExportToInp.overwrite=' \nVocê deseja substituí-lo?

FilesToDb.success=Process completed successfully
FilesToDb.error=Error importing files into Database

GisPanel.connect_database=Você tem que conetar-se a uma base de dados
GisPanel.select_folder=Você tem que selecionar uma pasta
GisPanel.type_name=Por favor escreva um nome válido
Expand Down
7 changes: 7 additions & 0 deletions i18n/text_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ gis_panel_qgis = Configura
gis_creation = AVISO:\nA sua senha do banco de dados será armazenada em texto simples nos seus arquivos de projeto, na pasta home em sistemas do tipo Unix ou na sua pasta de usuário do Windows.\n Se você não quer que isso aconteça, por favor clique em "Não" ou corrija no projeto SIG
gis_dbf_option = A opção DBF não está disponível para o software HECRAS
software_panel = Configuração do software
dev_toolbox_panel = Developer toolbox
db_options = Conexão ao banco de dados
import_sure = Tem certeza que você deseja importar o arquivo selecionado para o banco de dados?
close_connection = Fechar conexão
Expand Down Expand Up @@ -133,6 +134,9 @@ CreateSchemaTask.project=Projeto '
CreateSchemaTask.project_create=Criar projeto
CreateSchemaTask.project_not_created=Projeto não pode ser criado

DbToFiles.success=Process completed successfully
DbToFiles.error=Error generating files

download_version=Baixar nova versão

DownloadPanel.downloading_file=Baixando arquivo:
Expand Down Expand Up @@ -171,6 +175,9 @@ ExecuteTask.raster_not_found=O arquivo raster 'topo.asc' n
ExportToInp.file_already_exists=O arquivo selecionado já existe:\n '
ExportToInp.overwrite=' \nVocê deseja substituí-lo?

FilesToDb.success=Process completed successfully
FilesToDb.error=Error importing files into Database

GisPanel.connect_database=Você deve se conectar a um banco de dados
GisPanel.select_folder=Você tem que selecionar uma pasta
GisPanel.type_name=Por favor digite um nome válido
Expand Down
9 changes: 0 additions & 9 deletions sql/updates/ud/islast.sql

This file was deleted.

9 changes: 0 additions & 9 deletions sql/updates/ws/islast.sql

This file was deleted.

76 changes: 76 additions & 0 deletions src/org/giswater/controller/DevToolboxController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* This file is part of Giswater
* Copyright (C) 2013 Tecnics Associats
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Author:
* David Erill <derill@giswater.org>
*/
package org.giswater.controller;

import org.giswater.dao.MainDao;
import org.giswater.gui.panel.DevToolboxPanel;
import org.giswater.task.DbToFilesTask;
import org.giswater.task.FilesToDbTask;


public class DevToolboxController extends AbstractController {

private DevToolboxPanel view;


public DevToolboxController(DevToolboxPanel panel) {
this.view = panel;
view.setController(this);
}


public void filesToDb() {

// Get current schema names
String currentSchemaName = MainDao.getSchema();
if (currentSchemaName.equals("")) return;

// Execute task: CopyFunctionsSchema
FilesToDbTask task = new FilesToDbTask(MainDao.getWaterSoftware(), currentSchemaName, currentSchemaName);
task.setPanel(view);
task.addPropertyChangeListener(this);
task.execute();

}


public void dbToFiles() {

// Get current schema names
String currentSchemaName = MainDao.getSchema();
if (currentSchemaName.equals("")) return;

// Execute task: CopyFunctionsSchema
DbToFilesTask task = new DbToFilesTask(MainDao.getWaterSoftware(), currentSchemaName, currentSchemaName);
task.setPanel(view);
task.addPropertyChangeListener(this);
task.execute();

}


public void closePanel() {
// Close frame
view.getFrame().setVisible(false);
}


}
5 changes: 5 additions & 0 deletions src/org/giswater/controller/MenuController.java
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,11 @@ public void executeSqlFile() {
}


public void showDevToolbox() {
mainFrame.openDevToolbox();
}



// Menu Configuration
public void showSoftware() {
Expand Down
26 changes: 22 additions & 4 deletions src/org/giswater/controller/ProjectPreferencesController.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
import org.giswater.gui.panel.HecRasPanel;
import org.giswater.gui.panel.ProjectPanel;
import org.giswater.gui.panel.ProjectPreferencesPanel;
import org.giswater.task.CopyFunctionsSchemaTask;
import org.giswater.task.FilesToDbTask;
import org.giswater.task.CopySchemaTask;
import org.giswater.task.DbToFilesTask;
import org.giswater.task.DeleteSchemaTask;
import org.giswater.task.RenameSchemaTask;
import org.giswater.util.Encryption;
Expand Down Expand Up @@ -185,7 +186,7 @@ public boolean applyPreferences() {
boolean updated = MainDao.checkSchemaVersion();
// If project has been updated, execute copy functions
if (updated) {
copyFunctions();
filesToDb();
}
schemaChanged();

Expand Down Expand Up @@ -553,14 +554,14 @@ public void createGisProject() {
}


public void copyFunctions() {
public void filesToDb() {

// Get current schema names
String currentSchemaName = view.getSelectedSchema();
if (currentSchemaName.equals("")) return;

// Execute task: CopyFunctionsSchema
CopyFunctionsSchemaTask task = new CopyFunctionsSchemaTask(waterSoftware, currentSchemaName, currentSchemaName);
FilesToDbTask task = new FilesToDbTask(waterSoftware, currentSchemaName, currentSchemaName);
task.setController(this);
task.setParentPanel(view);
task.addPropertyChangeListener(this);
Expand All @@ -569,4 +570,21 @@ public void copyFunctions() {
}



public void dbToFiles() {

// Get current schema names
String currentSchemaName = view.getSelectedSchema();
if (currentSchemaName.equals("")) return;

// Execute task: CopyFunctionsSchema
DbToFilesTask task = new DbToFilesTask(waterSoftware, currentSchemaName, currentSchemaName);
task.setController(this);
task.setParentPanel(view);
task.addPropertyChangeListener(this);
task.execute();

}


}
2 changes: 1 addition & 1 deletion src/org/giswater/dao/PropertiesDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class PropertiesDao {
private static PropertiesMap gswProp = new PropertiesMap();
private static String selectedSchema;

private static final String MINOR_VERSION = "1.2";
private static final String MINOR_VERSION = "2.0";
private static final String CONFIG_FILE = "giswater";
private static final String GSW_DEFAULT_FILE = "default_"+MINOR_VERSION+".gsw";
private static final String GSW_TEMPLATE_FILE = "template_"+MINOR_VERSION+".gsw";
Expand Down
Loading

0 comments on commit d0f0102

Please # to comment.