diff --git a/README.md b/README.md index 29820f6..6c12907 100644 --- a/README.md +++ b/README.md @@ -48,16 +48,17 @@ Library Manager System writen in Java-Swing available for Windows, Linux and Mac * ~~instalador mysql + script criação banco de dados em first run (create if no exits)~~ * ON CONFLICT DO NOTHING import xlsx em janela de opcoes de importacao * relatorios de emprestimos e devolucoes -* limitar consultas de select * para especificas nos codigos +* limitar consultas de select * para especificas nos códigos. * suporte a internacionalização **BUGS?^^ -* regra de negocio emprestimo? atrasado mas marca como dias restantes e ta gerando multa -* livro cadastro dublica se alterar isbn -* botao salver em cartao faz nada (abrir explorer na url) +* Regra de negocio emprestimo? atrasado mas marca como dias restantes e ta gerando multa(com mais de 15 dias) +* livro cadastro dublica se alterar isbn. +* Botão salver em cartao faz nada (abrir explorer na url). Softwares: -https://cloud.librography.com/index.php/s/3kQZ9DkmAGaCWw6 \ No newline at end of file +https://cloud.librography.com/index.php/s/3kQZ9DkmAGaCWw6 + diff --git a/Windows Setup/License.txt b/Windows Setup/License.txt new file mode 100644 index 0000000..b6ff3de --- /dev/null +++ b/Windows Setup/License.txt @@ -0,0 +1,90 @@ + 7-Zip + ~~~~~ + License for use and distribution + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + 7-Zip Copyright (C) 1999-2019 Igor Pavlov. + + The licenses for files are: + + 1) 7z.dll: + - The "GNU LGPL" as main license for most of the code + - The "GNU LGPL" with "unRAR license restriction" for some code + - The "BSD 3-clause License" for some code + 2) All other files: the "GNU LGPL". + + Redistributions in binary form must reproduce related license information from this file. + + Note: + You can use 7-Zip on any computer, including a computer in a commercial + organization. You don't need to register or pay for 7-Zip. + + + GNU LGPL information + -------------------- + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You can receive a copy of the GNU Lesser General Public License from + http://www.gnu.org/ + + + + + BSD 3-clause License + -------------------- + + The "BSD 3-clause License" is used for the code in 7z.dll that implements LZFSE data decompression. + That code was derived from the code in the "LZFSE compression library" developed by Apple Inc, + that also uses the "BSD 3-clause License": + + ---- + Copyright (c) 2015-2016, Apple Inc. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ---- + + + + + unRAR license restriction + ------------------------- + + The decompression engine for RAR archives was developed using source + code of unRAR program. + All copyrights to original unRAR code are owned by Alexander Roshal. + + The license for original unRAR code has the following restriction: + + The unRAR sources cannot be used to re-create the RAR compression algorithm, + which is proprietary. Distribution of modified unRAR sources in separate form + or as a part of other software is permitted, provided that it is clearly + stated in the documentation and source comments that the code may + not be used to develop a RAR (WinRAR) compatible archiver. + + + -- + Igor Pavlov diff --git a/Windows Setup/copyToC.bat b/Windows Setup/copyJarToC.bat similarity index 100% rename from Windows Setup/copyToC.bat rename to Windows Setup/copyJarToC.bat diff --git a/Windows Setup/data b/Windows Setup/data index 78256c3..0795f52 100644 Binary files a/Windows Setup/data and b/Windows Setup/data differ diff --git a/Windows Setup/packData.bat b/Windows Setup/packData.bat new file mode 100644 index 0000000..bda67fa --- /dev/null +++ b/Windows Setup/packData.bat @@ -0,0 +1,8 @@ +@echo off + +copy ..\dist\Librography.jar C:\Librography\ +copy Librography.bat C:\Librography\ + +7z.exe a -tZip data C:\Librography\ + +rename data.zip data \ No newline at end of file diff --git a/Windows Setup/postgresql-10.19-1-windows-x64.exe b/Windows Setup/postgresql-10.19-1-windows-x64.exe new file mode 100644 index 0000000..08b6239 Binary files /dev/null and b/Windows Setup/postgresql-10.19-1-windows-x64.exe differ diff --git a/Windows Setup/script-postgresql.sql b/Windows Setup/script-postgresql.sql new file mode 100644 index 0000000..a0f05c1 --- /dev/null +++ b/Windows Setup/script-postgresql.sql @@ -0,0 +1,354 @@ +-- SQLINES DEMO *** rated by MySQL Workbench +-- 11/01/21 23:54:12 +-- SQLINES DEMO *** Version: 1.0 +-- SQLINES DEMO *** orward Engineering + +/* SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; */ +/* SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; */ +/* SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; */ + +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES DEMO *** aphy +-- SQLINES DEMO *** ------------------------------------ + +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES DEMO *** aphy +-- SQLINES DEMO *** ------------------------------------ +CREATE SCHEMA IF NOT EXISTS "applibrography"; +-- TEMPLATE = template0 +-- WITH OWNER "applibrography" +-- ENCODING 'UTF8' LC_COLLATE = +-- 'en_US.UTF-8' +-- LC_CTYPE = 'en_US.UTF-8'; + +SET SCHEMA 'applibrography' ; + +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES DEMO *** aphy`.`tb_leitores` +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES LICENSE FOR EVALUATION USE ONLY +CREATE SEQUENCE applibrography.tb_leitores_seq; + +CREATE TABLE IF NOT EXISTS applibrography.tb_leitores ( + id INT ZEROFILL NOT NULL DEFAULT NEXTVAL ('applibrography.tb_leitores_seq'), + nome VARCHAR(100) NULL, + rg VARCHAR(30) NULL DEFAULT NULL, + cpf VARCHAR(20) NULL DEFAULT NULL, + email VARCHAR(200) NULL DEFAULT NULL, + telefone VARCHAR(30) NULL DEFAULT NULL, + celular VARCHAR(30) NULL DEFAULT NULL, + cep VARCHAR(100) NULL DEFAULT NULL, + endereco VARCHAR(255) NULL DEFAULT NULL, + numero VARCHAR(50) NULL DEFAULT NULL, + complemento VARCHAR(200) NULL DEFAULT NULL, + bairro VARCHAR(100) NULL DEFAULT NULL, + cidade VARCHAR(100) NULL DEFAULT NULL, + estado VARCHAR(2) NULL DEFAULT NULL, + tipo VARCHAR(15) NULL, + is_locked SMALLINT NULL, + curso VARCHAR(45) NULL, + curso_ano VARCHAR(45) NULL, + qtd_emprestimos INT NULL, + emprestmax INT NULL, + observacoes VARCHAR(225) NULL, + PRIMARY KEY (id)) +; + +ALTER SEQUENCE applibrography.tb_leitores_seq RESTART WITH 00000100; + + +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES DEMO *** aphy`.`tb_fornecedores` +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES LICENSE FOR EVALUATION USE ONLY +CREATE SEQUENCE applibrography.tb_fornecedores_seq; + +CREATE TABLE IF NOT EXISTS applibrography.tb_fornecedores ( + id INT NOT NULL DEFAULT NEXTVAL ('applibrography.tb_fornecedores_seq'), + nome VARCHAR(100) NULL DEFAULT NULL, + cnpj VARCHAR(100) NULL DEFAULT NULL, + email VARCHAR(200) NULL DEFAULT NULL, + telefone VARCHAR(30) NULL DEFAULT NULL, + celular VARCHAR(30) NULL DEFAULT NULL, + cep VARCHAR(100) NULL DEFAULT NULL, + endereco VARCHAR(255) NULL DEFAULT NULL, + numero VARCHAR(50) NULL DEFAULT NULL, + complemento VARCHAR(200) NULL DEFAULT NULL, + bairro VARCHAR(100) NULL DEFAULT NULL, + cidade VARCHAR(100) NULL DEFAULT NULL, + estado VARCHAR(2) NULL DEFAULT NULL, + PRIMARY KEY (id)) +; + + +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES DEMO *** aphy`.`tb_funcionarios` +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES LICENSE FOR EVALUATION USE ONLY +CREATE SEQUENCE applibrography.tb_funcionarios_seq; + +CREATE TABLE IF NOT EXISTS applibrography.tb_funcionarios ( + id INT NOT NULL DEFAULT NEXTVAL ('applibrography.tb_funcionarios_seq'), + nome VARCHAR(100) NOT NULL, + rg VARCHAR(30) NULL, + cpf VARCHAR(20) NULL, + email VARCHAR(200) NULL, + senha VARCHAR(10) NOT NULL, + cargo VARCHAR(100) NOT NULL, + nivel_acesso VARCHAR(50) NOT NULL, + telefone VARCHAR(30) NULL, + celular VARCHAR(30) NULL, + cep VARCHAR(100) NOT NULL, + endereco VARCHAR(255) NULL, + numero VARCHAR(50) NULL, + complemento VARCHAR(200) NULL, + bairro VARCHAR(100) NULL, + cidade VARCHAR(100) NOT NULL, + estado VARCHAR(2) NOT NULL, + PRIMARY KEY (id)) +; + + +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES DEMO *** aphy`.`tb_livros` +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES LICENSE FOR EVALUATION USE ONLY +CREATE SEQUENCE applibrography.tb_livros_seq; + +CREATE TABLE IF NOT EXISTS applibrography.tb_livros ( + id INT NOT NULL DEFAULT NEXTVAL ('applibrography.tb_livros_seq'), + titulo VARCHAR(100) NOT NULL, + autor VARCHAR(45) NOT NULL, + editora VARCHAR(45) NOT NULL, + isbn VARCHAR(13) NOT NULL, + ano VARCHAR(4) NOT NULL, + serie VARCHAR(45) NULL, + edicao VARCHAR(45) NULL, + idioma VARCHAR(25) NOT NULL, + tb_fornecedores_id INT NULL, + piso VARCHAR(45) NULL, + corredor VARCHAR(45) NULL, + posicao VARCHAR(45) NULL, + secao VARCHAR(45) NULL, + disponibilidade VARCHAR(15) NOT NULL, + observacoes VARCHAR(225) NULL, + is_emprestado SMALLINT NULL, + PRIMARY KEY (id) + , + CONSTRAINT fk_tb_livros_tb_fornecedores1 + FOREIGN KEY (tb_fornecedores_id) + REFERENCES applibrography.tb_fornecedores (id) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +; + +CREATE INDEX fk_tb_livros_tb_fornecedores1_idx ON applibrography.tb_livros (tb_fornecedores_id ASC); + + +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES DEMO *** aphy`.`tb_emprestimos` +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES LICENSE FOR EVALUATION USE ONLY +CREATE SEQUENCE applibrography.tb_emprestimos_seq; + +CREATE TABLE IF NOT EXISTS applibrography.tb_emprestimos ( + id INT ZEROFILL NOT NULL DEFAULT NEXTVAL ('applibrography.tb_emprestimos_seq'), + data_emprestimo TIMESTAMP(0) NULL, + data_devolucao TIMESTAMP(0) NULL DEFAULT NULL, + observacoes TEXT NULL DEFAULT NULL, + tb_funcionarios_id INT NULL, + tb_livros_id INT NULL, + tb_livros_tb_fornecedores_id INT NULL, + tb_leitores_id INT ZEROFILL NULL, + data_entrega_agendada TIMESTAMP(0) NULL, + tb_funcionarios_iddevol INT NULL, + static_id_emprestimo INT NULL, + PRIMARY KEY (id) + , + CONSTRAINT fk_tb_emprestimos_tb_funcionarios1 + FOREIGN KEY (tb_funcionarios_id) + REFERENCES applibrography.tb_funcionarios (id) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT fk_tb_emprestimos_tb_livros1 + FOREIGN KEY (tb_livros_id) + REFERENCES applibrography.tb_livros (id) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT fk_tb_emprestimos_tb_leitores1 + FOREIGN KEY (tb_leitores_id) + REFERENCES applibrography.tb_leitores (id) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT fk_tb_emprestimos_tb_funcionarios2 + FOREIGN KEY (tb_funcionarios_iddevol) + REFERENCES applibrography.tb_funcionarios (id) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +; + +ALTER SEQUENCE applibrography.tb_emprestimos_seq RESTART WITH 10000000; + +CREATE INDEX fk_tb_emprestimos_tb_funcionarios1_idx ON applibrography.tb_emprestimos (tb_funcionarios_id ASC); +CREATE INDEX fk_tb_emprestimos_tb_livros1_idx ON applibrography.tb_emprestimos (tb_livros_id ASC, tb_livros_tb_fornecedores_id ASC); +CREATE INDEX fk_tb_emprestimos_tb_leitores1_idx ON applibrography.tb_emprestimos (tb_leitores_id ASC); +CREATE INDEX fk_tb_emprestimos_tb_funcionarios2_idx ON applibrography.tb_emprestimos (tb_funcionarios_iddevol ASC); + + +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES DEMO *** aphy`.`tb_multa` +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES LICENSE FOR EVALUATION USE ONLY +CREATE SEQUENCE applibrography.tb_multa_seq; + +CREATE TABLE IF NOT EXISTS applibrography.tb_multa ( + idmulta INT NOT NULL DEFAULT NEXTVAL ('applibrography.tb_multa_seq'), + dias_atraso INT NOT NULL, + valor_multa DECIMAL(10,2) NULL, + esta_pago SMALLINT NULL, + tb_leitores_id INT ZEROFILL NOT NULL, + tb_emprestimos_id INT ZEROFILL NOT NULL, + PRIMARY KEY (idmulta, tb_emprestimos_id) + , + CONSTRAINT fk_multa_tb_leitores1 + FOREIGN KEY (tb_leitores_id) + REFERENCES applibrography.tb_leitores (id) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT fk_tb_multa_tb_emprestimos1 + FOREIGN KEY (tb_emprestimos_id) + REFERENCES applibrography.tb_emprestimos (id) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +; + +CREATE INDEX fk_multa_tb_leitores1_idx ON applibrography.tb_multa (tb_leitores_id ASC); +CREATE INDEX fk_tb_multa_tb_emprestimos1_idx ON applibrography.tb_multa (tb_emprestimos_id ASC); + + +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES DEMO *** aphy`.`tb_opcoes` +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES LICENSE FOR EVALUATION USE ONLY +CREATE SEQUENCE applibrography.tb_opcoes_seq; + +CREATE TABLE IF NOT EXISTS applibrography.tb_opcoes ( + id INT NOT NULL DEFAULT NEXTVAL ('applibrography.tb_opcoes_seq'), + data VARCHAR(45) NOT NULL, + parentid INT NULL, + PRIMARY KEY (id) + , + CONSTRAINT fk_Opcoes_Opcoes1 + FOREIGN KEY (parentid) + REFERENCES applibrography.tb_opcoes (id) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +; + +CREATE INDEX fk_Opcoes_Opcoes1_idx ON applibrography.tb_opcoes (parentid ASC); + + +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES DEMO *** aphy`.`tb_recibos` +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES LICENSE FOR EVALUATION USE ONLY +CREATE SEQUENCE applibrography.tb_recibos_seq; + +CREATE TABLE IF NOT EXISTS applibrography.tb_recibos ( + id INT NOT NULL DEFAULT NEXTVAL ('applibrography.tb_recibos_seq'), + emprestimo_id INT NULL, + data_emprestimo VARCHAR(45) NULL, + data_devolucao_agendada VARCHAR(45) NULL, + data_entrega VARCHAR(45) NULL, + livro VARCHAR(45) NULL, + usuario VARCHAR(45) NULL, + tipo VARCHAR(45) NULL, + multa VARCHAR(45) NULL, + status VARCHAR(45) NULL, + funcionario VARCHAR(45) NULL, + PRIMARY KEY (id)) +; + + +/* SET SQL_MODE=@OLD_SQL_MODE; */ +/* SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; */ +/* SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; */ + +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES DEMO *** pplibrography`.`tb_leitores` +-- SQLINES DEMO *** ------------------------------------ +START TRANSACTION; +SET SCHEMA 'applibrography'; +INSERT INTO applibrography.tb_leitores (id, nome, rg, cpf, email, telefone, celular, cep, endereco, numero, complemento, bairro, cidade, estado, tipo, is_locked, curso, curso_ano, qtd_emprestimos, emprestmax, observacoes) VALUES (00000101, 'Leitor Teste', '5.432.234-1', '099.999.345-23', 'leitor@mail.com', '(42)98877-2299', '(42)98877-2299', '854670-000', 'Rua 1 de abril', '13', 'casa', 'Centro', 'Mallet', 'PR', 'Estudante', 0, 'Letras', '1', 0, 123, 'Ok'); + +COMMIT; + + +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES DEMO *** pplibrography`.`tb_fornecedores` +-- SQLINES DEMO *** ------------------------------------ +START TRANSACTION; +SET SCHEMA 'applibrography'; +INSERT INTO applibrography.tb_fornecedores (id, nome, cnpj, email, telefone, celular, cep, endereco, numero, complemento, bairro, cidade, estado) VALUES (1, 'Fornecedor Teste', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +COMMIT; + + +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES DEMO *** pplibrography`.`tb_funcionarios` +-- SQLINES DEMO *** ------------------------------------ +START TRANSACTION; +SET SCHEMA 'applibrography'; +INSERT INTO applibrography.tb_funcionarios (id, nome, rg, cpf, email, senha, cargo, nivel_acesso, telefone, celular, cep, endereco, numero, complemento, bairro, cidade, estado) VALUES (1, 'Administrador', NULL, NULL, 'admin@admin', 'admin', 'Administrador', 'Administrador', NULL, NULL, '84570-000', NULL, NULL, NULL, NULL, 'Mallet', 'PR'); + +COMMIT; + + +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES DEMO *** pplibrography`.`tb_livros` +-- SQLINES DEMO *** ------------------------------------ +START TRANSACTION; +SET SCHEMA 'applibrography'; +INSERT INTO applibrography.tb_livros (id, titulo, autor, editora, isbn, ano, serie, edicao, idioma, tb_fornecedores_id, piso, corredor, posicao, secao, disponibilidade, observacoes, is_emprestado) VALUES (1, 'Alice no Pis das maravilhas', 'Lewis Carrol', 'Nope', '1231231231231', '1894', '1', '1', 'Portugues', 1, NULL, NULL, NULL, 'Literatura Universal', '5', 'ok', 0); + +COMMIT; + + +-- SQLINES DEMO *** ------------------------------------ +-- SQLINES DEMO *** pplibrography`.`tb_opcoes` +-- SQLINES DEMO *** ------------------------------------ +START TRANSACTION; +SET SCHEMA 'applibrography'; +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (1, 'piso', NULL); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (2, 'corredor', NULL); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (3, 'secao', NULL); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (4, 'posicao', NULL); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (5, 'disponibilidade', NULL); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (6, 'printerurl', NULL); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (7, 'instituicaonome', NULL); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (8, 'instiuicaoendereco', NULL); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (17, 'piso 1', 1); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (20, 'corredor 1', 2); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (21, '1A', 3); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (22, 'Literatura Universal', 4); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (13, '0', 5); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (14, '3', 5); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (15, 'Biblioteca de Hogwarts', 7); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (16, 'Rua Epsilon, 888, Cidade Imaginaria, LA ', 8); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (9, 'tiposdeusuarios', NULL); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (18, 'Estudante', 9); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (19, 'Professor', 9); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (10, 'server url', NULL); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (11, 'libraryname', NULL); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (12, 'libraryAddress', NULL); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (23, '127.0.0.1', 12); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (24, 'Nome da Biblioteca', NULL); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (25, 'valor_multa', NULL); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (26, '300', 25); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (27, 'MsgReceipt', NULL); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (28, 'Obrigado!!', 27); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (29, 'theme', NULL); +INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (30, 'dark', 29); + +COMMIT; + diff --git a/Windows Setup/setupPostgres.bat b/Windows Setup/setupPostgres.bat new file mode 100644 index 0000000..f44e837 --- /dev/null +++ b/Windows Setup/setupPostgres.bat @@ -0,0 +1,62 @@ +@echo off +:start + + +PATH=C:\Librography_data\postgres\bin;%path% +netstat -o -n -a | findstr 5432 +if %ERRORLEVEL% equ 0 goto FOUND +echo Postgresql not found or not usisng default port 5432... +ECHO Do you wanto open open browser to download it? +ECHO 1. yes +ECHO 2. no +set /p choice=Choose your option. +if '%choice%'=='' ECHO "%choice%" is not valid please try again +if '%choice%'=='1' goto open +if '%choice%'=='2' goto FIN +ECHO. +goto start +:open +echo opening the Postgresql download link.... +pause +START Https://www.enterprisedb.com/postgresql-tutorial-resources-training?uuid=ea5c8104-3940-4ed1-b427-81cf19781581&campaignId=70138000000rYFmAAM +ECHO 1 - Download the setup from link opening on browser and after install and then we will continue the setup +ECHO 2 - Install with optiion "Only Server" and setup a root password +ECHO 3 - take a note of the root password, fisnish the installer and continue this setup +Rem %Downloads%/postgresql-10.19-1-windows-x64.exe --mode unattended --unattendedmodeui minimal --superpassword MIRANDA --prefix C:\Librography_data\postgres --datadir C:\Librography_data\postgres\data +pause +Rem :continue +Rem echo ok +goto start +Rem goto FIN +:FOUND +echo port found. It mean the Postgresql is installed +echo we can continue the setup... +pause +:FIN + +echo . +echo . +@echo off +rem ------------------------------------------------ +echo Creating access to user. Waiting ... +echo Enter the Postgresql user password: +set /p rootpassword= +set dbname=applibrography +set dbuser=applibrography +set userpassword=gowl +set PGPASSWORD=MIRANDA +Rem "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" "--defaults-file=C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" "-uroot" "-p" +SET PATH=%PATH%;C:\Librography_data\postgres\bin +psql -U postgres -c "CREATE DATABASE %dbname%;" +psql -U postgres -c "CREATE USER '%dbuser%'@'localhost' IDENTIFIED BY '%userpassword%';" +psql -U postgres -c "GRANT ALL PRIVILEGES ON %dbuser%.* TO '%dbuser%'@'localhost';" + +psql -U postgres -c "FLUSH PRIVILEGES;" +psql -U postgres -c "source script-posgresql.sql" +echo Done. +echo "Postgresql user created." +echo "Username: %dbuser%" +echo "Password: %userpassword%" +rem ------------------------------------------------ +echo . +echo . diff --git a/build/classes/br/com/projeto/dao/EmprestimoDao.class b/build/classes/br/com/projeto/dao/EmprestimoDao.class index 8f7dd93..cb745ae 100644 Binary files a/build/classes/br/com/projeto/dao/EmprestimoDao.class and b/build/classes/br/com/projeto/dao/EmprestimoDao.class differ diff --git a/build/classes/br/com/projeto/jdbc/ConexaoBanco$1.class b/build/classes/br/com/projeto/jdbc/ConexaoBanco$1.class index 58fa9f7..03082f3 100644 Binary files a/build/classes/br/com/projeto/jdbc/ConexaoBanco$1.class and b/build/classes/br/com/projeto/jdbc/ConexaoBanco$1.class differ diff --git a/build/classes/br/com/projeto/jdbc/ConexaoBanco.class b/build/classes/br/com/projeto/jdbc/ConexaoBanco.class index 0124a24..04189f2 100644 Binary files a/build/classes/br/com/projeto/jdbc/ConexaoBanco.class and b/build/classes/br/com/projeto/jdbc/ConexaoBanco.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$1.class b/build/classes/br/com/projeto/view/FormOptions$1.class index 5b3c157..395d82e 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$1.class and b/build/classes/br/com/projeto/view/FormOptions$1.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$11.class b/build/classes/br/com/projeto/view/FormOptions$11.class index 1e42158..5839917 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$11.class and b/build/classes/br/com/projeto/view/FormOptions$11.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$12.class b/build/classes/br/com/projeto/view/FormOptions$12.class index dd5d6b0..6ed9a82 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$12.class and b/build/classes/br/com/projeto/view/FormOptions$12.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$13.class b/build/classes/br/com/projeto/view/FormOptions$13.class index a90731e..0d4fdee 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$13.class and b/build/classes/br/com/projeto/view/FormOptions$13.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$14.class b/build/classes/br/com/projeto/view/FormOptions$14.class index 4f9f286..0294c79 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$14.class and b/build/classes/br/com/projeto/view/FormOptions$14.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$15.class b/build/classes/br/com/projeto/view/FormOptions$15.class index 31e6d3b..9fed39b 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$15.class and b/build/classes/br/com/projeto/view/FormOptions$15.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$16.class b/build/classes/br/com/projeto/view/FormOptions$16.class index 5d4f4fa..58efc74 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$16.class and b/build/classes/br/com/projeto/view/FormOptions$16.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$17.class b/build/classes/br/com/projeto/view/FormOptions$17.class index ffe4ec1..324d21c 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$17.class and b/build/classes/br/com/projeto/view/FormOptions$17.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$18.class b/build/classes/br/com/projeto/view/FormOptions$18.class index 9b34e39..b0a18f4 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$18.class and b/build/classes/br/com/projeto/view/FormOptions$18.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$19.class b/build/classes/br/com/projeto/view/FormOptions$19.class index 85a41cb..85f8127 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$19.class and b/build/classes/br/com/projeto/view/FormOptions$19.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$2.class b/build/classes/br/com/projeto/view/FormOptions$2.class index 755d6bb..a9c08f6 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$2.class and b/build/classes/br/com/projeto/view/FormOptions$2.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$20.class b/build/classes/br/com/projeto/view/FormOptions$20.class index ba757da..67ce93b 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$20.class and b/build/classes/br/com/projeto/view/FormOptions$20.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$21.class b/build/classes/br/com/projeto/view/FormOptions$21.class index d2cc20c..5176254 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$21.class and b/build/classes/br/com/projeto/view/FormOptions$21.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$22.class b/build/classes/br/com/projeto/view/FormOptions$22.class index 860d129..dfeb375 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$22.class and b/build/classes/br/com/projeto/view/FormOptions$22.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$23.class b/build/classes/br/com/projeto/view/FormOptions$23.class index 6e6efc7..e20a72a 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$23.class and b/build/classes/br/com/projeto/view/FormOptions$23.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$24.class b/build/classes/br/com/projeto/view/FormOptions$24.class index a4668a3..264ac5f 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$24.class and b/build/classes/br/com/projeto/view/FormOptions$24.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$25.class b/build/classes/br/com/projeto/view/FormOptions$25.class index a3af677..ff99498 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$25.class and b/build/classes/br/com/projeto/view/FormOptions$25.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$26.class b/build/classes/br/com/projeto/view/FormOptions$26.class index 10ef6aa..67069cd 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$26.class and b/build/classes/br/com/projeto/view/FormOptions$26.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$27.class b/build/classes/br/com/projeto/view/FormOptions$27.class index c9e6227..659e54f 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$27.class and b/build/classes/br/com/projeto/view/FormOptions$27.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$28.class b/build/classes/br/com/projeto/view/FormOptions$28.class index 20be6e4..c937f0c 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$28.class and b/build/classes/br/com/projeto/view/FormOptions$28.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$29.class b/build/classes/br/com/projeto/view/FormOptions$29.class index 6c64a68..e9b8715 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$29.class and b/build/classes/br/com/projeto/view/FormOptions$29.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$3.class b/build/classes/br/com/projeto/view/FormOptions$3.class index 0bb1763..2e09128 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$3.class and b/build/classes/br/com/projeto/view/FormOptions$3.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$30.class b/build/classes/br/com/projeto/view/FormOptions$30.class index b2a920e..27122d5 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$30.class and b/build/classes/br/com/projeto/view/FormOptions$30.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$31.class b/build/classes/br/com/projeto/view/FormOptions$31.class index 954cb08..6e6a9d1 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$31.class and b/build/classes/br/com/projeto/view/FormOptions$31.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$32.class b/build/classes/br/com/projeto/view/FormOptions$32.class index fc687b9..0e1d583 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$32.class and b/build/classes/br/com/projeto/view/FormOptions$32.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$33.class b/build/classes/br/com/projeto/view/FormOptions$33.class index d67e75d..5f2f76b 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$33.class and b/build/classes/br/com/projeto/view/FormOptions$33.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$34.class b/build/classes/br/com/projeto/view/FormOptions$34.class new file mode 100644 index 0000000..f5ad57f Binary files /dev/null and b/build/classes/br/com/projeto/view/FormOptions$34.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$35.class b/build/classes/br/com/projeto/view/FormOptions$35.class new file mode 100644 index 0000000..b89307e Binary files /dev/null and b/build/classes/br/com/projeto/view/FormOptions$35.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$36.class b/build/classes/br/com/projeto/view/FormOptions$36.class new file mode 100644 index 0000000..bc3c242 Binary files /dev/null and b/build/classes/br/com/projeto/view/FormOptions$36.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$37.class b/build/classes/br/com/projeto/view/FormOptions$37.class new file mode 100644 index 0000000..80c8a03 Binary files /dev/null and b/build/classes/br/com/projeto/view/FormOptions$37.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$38.class b/build/classes/br/com/projeto/view/FormOptions$38.class new file mode 100644 index 0000000..d0c7e02 Binary files /dev/null and b/build/classes/br/com/projeto/view/FormOptions$38.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$4.class b/build/classes/br/com/projeto/view/FormOptions$4.class index 1092909..26fb20c 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$4.class and b/build/classes/br/com/projeto/view/FormOptions$4.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$5.class b/build/classes/br/com/projeto/view/FormOptions$5.class index 5c3168a..9d7a206 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$5.class and b/build/classes/br/com/projeto/view/FormOptions$5.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$6.class b/build/classes/br/com/projeto/view/FormOptions$6.class index 2f21927..638fa9f 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$6.class and b/build/classes/br/com/projeto/view/FormOptions$6.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$7.class b/build/classes/br/com/projeto/view/FormOptions$7.class index 024a41d..7fb70d3 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$7.class and b/build/classes/br/com/projeto/view/FormOptions$7.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions$9.class b/build/classes/br/com/projeto/view/FormOptions$9.class index 01d7eed..3cff1bb 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions$9.class and b/build/classes/br/com/projeto/view/FormOptions$9.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions.class b/build/classes/br/com/projeto/view/FormOptions.class index b72b747..c17f112 100644 Binary files a/build/classes/br/com/projeto/view/FormOptions.class and b/build/classes/br/com/projeto/view/FormOptions.class differ diff --git a/build/classes/br/com/projeto/view/FormOptions.form b/build/classes/br/com/projeto/view/FormOptions.form index 9a6ce92..e9aae99 100644 --- a/build/classes/br/com/projeto/view/FormOptions.form +++ b/build/classes/br/com/projeto/view/FormOptions.form @@ -99,25 +99,25 @@ - + - + - + - + - + @@ -125,58 +125,64 @@ - + - - - - - - - - - - - - - - - + - - - + - - - - + + + + + + + - - - - + + + + + + - + + + + + + + - + - - - - - - - + + + + + + + + + + + + + + + + + + + - @@ -184,64 +190,65 @@ + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - @@ -277,6 +284,7 @@ + @@ -393,6 +401,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -555,7 +593,7 @@ - + @@ -818,7 +856,7 @@ - + @@ -829,10 +867,10 @@ - + - + @@ -843,12 +881,12 @@ - + - + @@ -861,6 +899,9 @@ + + + diff --git a/lib/postgresql-42.3.1.jar b/lib/postgresql-42.3.1.jar new file mode 100644 index 0000000..17af3fc Binary files /dev/null and b/lib/postgresql-42.3.1.jar differ diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index 9cc755b..895212e 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -2,6 +2,11 @@ - + + file:/G:/Desktop/git/Librography/src/br/com/projeto/view/FormOptions.java + file:/G:/Desktop/git/Librography/src/br/com/projeto/jdbc/ConexaoBanco.java + file:/G:/Desktop/git/Librography/src/br/com/projeto/view/FormEmprestimos.java + file:/G:/Desktop/git/Librography/src/br/com/projeto/jdbc/TestarConexao.java + diff --git a/nbproject/project.properties b/nbproject/project.properties index a6add9d..fc36e10 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -46,6 +46,7 @@ file.reference.mysql-connector-java-5.1.23-bin.jar=lib/mysql-connector-java-5.1. file.reference.poi-5.0.0.jar=lib/poi-5.0.0.jar file.reference.poi-ooxml-5.0.0.jar=lib/poi-ooxml-5.0.0.jar file.reference.poi-ooxml-lite-5.0.0.jar-1=lib/poi-ooxml-lite-5.0.0.jar +file.reference.postgresql-42.3.1.jar=lib/postgresql-42.3.1.jar file.reference.xmlbeans-5.0.0.jar=lib/xmlbeans-5.0.0.jar file.reference.yaz4j-1.7.0-SNAPSHOT.jar=lib/yaz4j-1.7.0-SNAPSHOT.jar includes=** @@ -71,7 +72,8 @@ javac.classpath=\ ${file.reference.poi-ooxml-5.0.0.jar}:\ ${file.reference.poi-ooxml-lite-5.0.0.jar-1}:\ ${file.reference.xmlbeans-5.0.0.jar}:\ - ${file.reference.yaz4j-1.7.0-SNAPSHOT.jar} + ${file.reference.yaz4j-1.7.0-SNAPSHOT.jar}:\ + ${file.reference.postgresql-42.3.1.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false diff --git a/src/br/com/projeto/dao/EmprestimoDao.java b/src/br/com/projeto/dao/EmprestimoDao.java index 1811925..a3bf76e 100644 --- a/src/br/com/projeto/dao/EmprestimoDao.java +++ b/src/br/com/projeto/dao/EmprestimoDao.java @@ -295,8 +295,8 @@ public class EmprestimoDao { } public String campoStatusColor(Timestamp data_devolucao, int atraso) throws Exception { - if (atraso < -15) { - String d = "+ de 15 dias atrasado"; + if (atraso < -15) { //errado + String d = "+ de 15 dias restantes ou ilimitado"; return d; } else if (data_devolucao == null && atraso == 0) { String d = "Vence Hoje"; @@ -308,7 +308,7 @@ public class EmprestimoDao { String d = String.valueOf(atraso) + " dias de atraso"; return d; } else if (atraso > 15) { - String d = "+de 15 dias restantes ou ilimitado"; + String d = "+ de 15 dias de atraso"; return d; } else { int x = Math.abs(atraso); diff --git a/src/br/com/projeto/jdbc/ConexaoBanco.java b/src/br/com/projeto/jdbc/ConexaoBanco.java index a208800..737429f 100644 --- a/src/br/com/projeto/jdbc/ConexaoBanco.java +++ b/src/br/com/projeto/jdbc/ConexaoBanco.java @@ -31,17 +31,20 @@ public class ConexaoBanco { String ipserverPath = ""; String dbuserpPath = ""; String dbpassPath = ""; + String dbTypePath = ""; switch (util.getOS()) { case WINDOWS: ipserverPath = "C:\\Librography\\ipserver"; dbuserpPath = "C:\\Librography\\DBUser"; dbpassPath = "C:\\Librography\\DBPass"; + dbTypePath = "C:\\Librography\\DBType"; break; case MAC: ipserverPath = "//Applications//Librography.app//config//ipserver"; dbuserpPath = "//Applications//Librography.app//config//DBUser"; dbpassPath = "//Applications//Librography.app//config//DBPass"; + dbTypePath = "//Applications//Librography.app//config//DBType"; break; case LINUX: // some stuff @@ -59,8 +62,18 @@ public class ConexaoBanco { String contentPass; contentPass = new String(Files.readAllBytes(Paths.get(dbpassPath))); + + String contentDBType = new String(Files.readAllBytes(Paths.get(dbTypePath))); + + String contentDBPort = ""; + if(contentDBType.contains("mysql")) { + contentDBPort = "3306"; + } else if (contentDBType.contains("postgresql")) { + contentDBPort = "5432"; + } - String url = "jdbc:mysql://" + contentIP + ":3306/applibrography"; //Nome da base de dados + //String url = "jdbc:mysql://" + contentIP + ":3306/applibrography"; //Nome da base de dados + String url = "jdbc:" + contentDBType + "://" + contentIP + ":" + contentDBPort + "/applibrography"; //Nome da base de dados String user = contentUser; //nome do usuário do MySQL String password = contentPass; //senha do MySQL //System.out.println(url + user + password); diff --git a/src/br/com/projeto/view/FormOptions.form b/src/br/com/projeto/view/FormOptions.form index 9a6ce92..e9aae99 100644 --- a/src/br/com/projeto/view/FormOptions.form +++ b/src/br/com/projeto/view/FormOptions.form @@ -99,25 +99,25 @@ - + - + - + - + - + @@ -125,58 +125,64 @@ - + - - - - - - - - - - - - - - - + - - - + - - - - + + + + + + + - - - - + + + + + + - + + + + + + + - + - - - - - - - + + + + + + + + + + + + + + + + + + + - @@ -184,64 +190,65 @@ + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - @@ -277,6 +284,7 @@ + @@ -393,6 +401,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -555,7 +593,7 @@ - + @@ -818,7 +856,7 @@ - + @@ -829,10 +867,10 @@ - + - + @@ -843,12 +881,12 @@ - + - + @@ -861,6 +899,9 @@ + + + diff --git a/src/br/com/projeto/view/FormOptions.java b/src/br/com/projeto/view/FormOptions.java index 64caa05..ed0e51f 100644 --- a/src/br/com/projeto/view/FormOptions.java +++ b/src/br/com/projeto/view/FormOptions.java @@ -10,6 +10,7 @@ import br.com.projeto.model.Options; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.File; +import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; @@ -77,6 +78,9 @@ public class FormOptions extends javax.swing.JFrame { btnSaveMsgRecibo = new javax.swing.JButton(); jLabel16 = new javax.swing.JLabel(); txtmsgRecibo = new javax.swing.JTextField(); + jLabel21 = new javax.swing.JLabel(); + boxDBType = new javax.swing.JComboBox<>(); + btnSaveDBType = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); @@ -111,7 +115,7 @@ public class FormOptions extends javax.swing.JFrame { btnExcluirTipos = new javax.swing.JButton(); jPanel4 = new javax.swing.JPanel(); jLabel17 = new javax.swing.JLabel(); - jButton1 = new javax.swing.JButton(); + btnSaveTheme = new javax.swing.JButton(); cboxTema = new javax.swing.JComboBox<>(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); @@ -160,6 +164,11 @@ public class FormOptions extends javax.swing.JFrame { boxPrinterMouseClicked(evt); } }); + boxPrinter.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + boxPrinterActionPerformed(evt); + } + }); btnSavePrinter.setText("Salvar"); btnSavePrinter.addActionListener(new java.awt.event.ActionListener() { @@ -230,12 +239,33 @@ public class FormOptions extends javax.swing.JFrame { jLabel16.setText("Mensagem Recibo:"); + jLabel21.setText("Tipo de Banco de Dados:"); + + boxDBType.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "postgresql", "mysql" })); + boxDBType.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + boxDBTypeMouseClicked(evt); + } + }); + boxDBType.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + boxDBTypeActionPerformed(evt); + } + }); + + btnSaveDBType.setText("Salvar"); + btnSaveDBType.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnSaveDBTypeActionPerformed(evt); + } + }); + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() - .addGap(20, 20, 20) + .addGap(17, 17, 17) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) @@ -258,93 +288,103 @@ public class FormOptions extends javax.swing.JFrame { .addGap(18, 18, 18) .addComponent(btnSavePassDB)) .addGroup(jPanel2Layout.createSequentialGroup() - .addComponent(jLabel16) + .addComponent(jLabel21) .addGap(18, 18, 18) - .addComponent(txtmsgRecibo, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(24, 24, 24) - .addComponent(btnSaveMsgRecibo))) - .addGap(101, 101, 101) + .addComponent(boxDBType, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(btnSaveDBType)) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(jLabel9) + .addGap(18, 18, 18) + .addComponent(boxPrinter, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(btnSavePrinter)) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(jLabel16) + .addGap(18, 18, 18) + .addComponent(txtmsgRecibo, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(24, 24, 24) + .addComponent(btnSaveMsgRecibo)))) + .addGap(66, 66, 66) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(lblLibraryLogo, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(38, 38, 38) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(lblLibraryLogo, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel2Layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(btnSetLibraryLogo))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(7, 7, 7) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addGap(22, 22, 22) - .addComponent(jLabel9) - .addGap(18, 18, 18) - .addComponent(boxPrinter, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(btnSavePrinter)) - .addGroup(jPanel2Layout.createSequentialGroup() - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel10)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(txtLibraryName, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(txtLibraryAddress, javax.swing.GroupLayout.PREFERRED_SIZE, 317, javax.swing.GroupLayout.PREFERRED_SIZE)))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel10)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addGap(0, 0, Short.MAX_VALUE) - .addComponent(btnSetLibraryLogo)) - .addGroup(jPanel2Layout.createSequentialGroup() - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(btnLibraryName) - .addComponent(btnLibraryAddress)) - .addGap(0, 0, Short.MAX_VALUE))))) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(txtLibraryName, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(txtLibraryAddress, javax.swing.GroupLayout.PREFERRED_SIZE, 317, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(24, 24, 24) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(btnLibraryName) + .addComponent(btnLibraryAddress)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(12, 12, 12) - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel6) - .addComponent(txtIp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(btnSaveIp)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel12) - .addComponent(txtUserDB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(btnSaveUserDB)) - .addGap(18, 18, 18) - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel15) - .addComponent(btnSavePassDB)) - .addComponent(txtPassDB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(btnSaveMsgRecibo) - .addComponent(jLabel16) - .addComponent(txtmsgRecibo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGroup(jPanel2Layout.createSequentialGroup() - .addComponent(jLabel13) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(lblLibraryLogo, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(jLabel13) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(lblLibraryLogo, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) + .addComponent(btnSetLibraryLogo) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel21) + .addComponent(boxDBType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnSaveDBType)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6) + .addComponent(txtIp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnSaveIp)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel12) + .addComponent(txtUserDB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnSaveUserDB)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(btnSetLibraryLogo) - .addGroup(jPanel2Layout.createSequentialGroup() - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel9) - .addComponent(boxPrinter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(btnSavePrinter)) - .addGap(18, 18, 18) - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel10) - .addComponent(txtLibraryName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(btnLibraryName)) - .addGap(23, 23, 23) - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel11) - .addComponent(txtLibraryAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(btnLibraryAddress)))) - .addContainerGap(59, Short.MAX_VALUE)) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel15) + .addComponent(btnSavePassDB)) + .addComponent(txtPassDB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btnSaveMsgRecibo) + .addComponent(jLabel16) + .addComponent(txtmsgRecibo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel9) + .addComponent(boxPrinter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnSavePrinter)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel10) + .addComponent(txtLibraryName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnLibraryName)) + .addGap(23, 23, 23) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel11) + .addComponent(txtLibraryAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnLibraryAddress)) + .addGap(132, 132, 132)) ); jTabbedPane2.addTab("Geral", jPanel2); @@ -624,22 +664,27 @@ public class FormOptions extends javax.swing.JFrame { .addComponent(btnExcluirTipos) .addComponent(txtTipos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel14)) - .addContainerGap(57, Short.MAX_VALUE)) + .addContainerGap(140, Short.MAX_VALUE)) ); jTabbedPane2.addTab("Biblioteca", jPanel3); jLabel17.setText("Tema Padrão:"); - jButton1.setText("Salvar"); - jButton1.addActionListener(new java.awt.event.ActionListener() { + btnSaveTheme.setText("Salvar"); + btnSaveTheme.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - jButton1ActionPerformed(evt); + btnSaveThemeActionPerformed(evt); } }); cboxTema.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Tema Claro", "Tema Escuro" })); cboxTema.setSelectedIndex(-1); + cboxTema.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cboxTemaActionPerformed(evt); + } + }); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); @@ -651,7 +696,7 @@ public class FormOptions extends javax.swing.JFrame { .addGap(18, 18, 18) .addComponent(cboxTema, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jButton1) + .addComponent(btnSaveTheme) .addContainerGap(279, Short.MAX_VALUE)) ); jPanel4Layout.setVerticalGroup( @@ -660,9 +705,9 @@ public class FormOptions extends javax.swing.JFrame { .addGap(38, 38, 38) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel17) - .addComponent(jButton1) + .addComponent(btnSaveTheme) .addComponent(cboxTema, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(324, Short.MAX_VALUE)) + .addContainerGap(407, Short.MAX_VALUE)) ); jTabbedPane2.addTab("Aparência", jPanel4); @@ -846,29 +891,6 @@ public class FormOptions extends javax.swing.JFrame { // TODO add your handling code here: }//GEN-LAST:event_boxTiposActionPerformed - private void btnSaveIpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveIpActionPerformed - try { - //mudar para dao com esse - PrintWriter out = new PrintWriter(new FileWriter("C:\\Librography\\ipserver")); - //txtIp.getText(); - txtIp.write(out); - } catch (IOException e1) { - System.err.println("Error occurred"); - e1.printStackTrace(); - } - //editar - //mostrar ip no inicio - try { - Options obj = new Options(); - obj.setServer_ip((String) txtIp.getText());// aqui - OptionsDao dao = new OptionsDao(); - dao.setIp(obj); - JOptionPane.showMessageDialog(null, "Ip Salvo!"); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Erro:" + e); - } - }//GEN-LAST:event_btnSaveIpActionPerformed - private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated //impressoas padrão aqui @@ -952,7 +974,6 @@ public class FormOptions extends javax.swing.JFrame { }//GEN-LAST:event_btnLibraryNameActionPerformed private void btnLibraryAddressActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLibraryAddressActionPerformed - try { Options obj = new Options(); obj.setLibrary_name((String) txtLibraryAddress.getText());// aqui @@ -964,27 +985,6 @@ public class FormOptions extends javax.swing.JFrame { } }//GEN-LAST:event_btnLibraryAddressActionPerformed - private void btnSaveUserDBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveUserDBActionPerformed - try { - PrintWriter out = new PrintWriter(new FileWriter("C:\\Librography\\DBUser")); - txtUserDB.write(out); - } catch (IOException e1) { - System.err.println("Error occurred"); - e1.printStackTrace(); - } - - }//GEN-LAST:event_btnSaveUserDBActionPerformed - - private void btnSavePassDBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSavePassDBActionPerformed - try { - PrintWriter out = new PrintWriter(new FileWriter("C:\\Librography\\DBPass")); - txtPassDB.write(out); - } catch (IOException e1) { - System.err.println("Error occurred"); - e1.printStackTrace(); - } - }//GEN-LAST:event_btnSavePassDBActionPerformed - private void boxPrinterMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_boxPrinterMouseClicked PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null); boxPrinter.addItem("Dialogo"); @@ -995,7 +995,7 @@ public class FormOptions extends javax.swing.JFrame { private void btnSavePrinterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSavePrinterActionPerformed try { - //mudar para dao com esse + //mudar para dao com esse PrintWriter out = new PrintWriter(new FileWriter("C:\\Librography\\DefaultPrinter")); String printer = (String) boxPrinter.getSelectedItem(); //System.out.println(printer); @@ -1019,11 +1019,93 @@ public class FormOptions extends javax.swing.JFrame { } }//GEN-LAST:event_btnSaveMsgReciboActionPerformed - private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + private void btnSaveThemeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveThemeActionPerformed OptionsDao optionsdao = new OptionsDao(); optionsdao.setTheme((int) cboxTema.getSelectedIndex()); JOptionPane.showMessageDialog(null, "Tema Salvo! reinicie o aplicativo para aplicar!"); - }//GEN-LAST:event_jButton1ActionPerformed + }//GEN-LAST:event_btnSaveThemeActionPerformed + + private void btnSavePassDBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSavePassDBActionPerformed + try { + PrintWriter out = new PrintWriter(new FileWriter("C:\\Librography\\DBPass")); + txtPassDB.write(out); + } catch (IOException e1) { + System.err.println("Error occurred"); + e1.printStackTrace(); + } + }//GEN-LAST:event_btnSavePassDBActionPerformed + + private void btnSaveUserDBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveUserDBActionPerformed + try { + PrintWriter out = new PrintWriter(new FileWriter("C:\\Librography\\DBUser")); + txtUserDB.write(out); + } catch (IOException e1) { + System.err.println("Error occurred"); + e1.printStackTrace(); + } + + }//GEN-LAST:event_btnSaveUserDBActionPerformed + + private void btnSaveIpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveIpActionPerformed + try { + //mudar para dao com esse + PrintWriter out = new PrintWriter(new FileWriter("C:\\Librography\\ipserver")); + //txtIp.getText(); + txtIp.write(out); + } catch (IOException e1) { + System.err.println("Error occurred"); + e1.printStackTrace(); + } + //editar + //mostrar ip no inicio + try { + Options obj = new Options(); + obj.setServer_ip((String) txtIp.getText());// aqui + OptionsDao dao = new OptionsDao(); + dao.setIp(obj); + JOptionPane.showMessageDialog(null, "Ip Salvo!"); + } catch (Exception e) { + JOptionPane.showMessageDialog(null, "Erro:" + e); + } + }//GEN-LAST:event_btnSaveIpActionPerformed + + private void boxDBTypeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_boxDBTypeMouseClicked + // PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null); + //boxDBType.addItem("Dialogo"); + // for (PrintService printer : printServices) { + //boxDBType.addItem(printer.getName()); + // erro + // } + }//GEN-LAST:event_boxDBTypeMouseClicked + + private void btnSaveDBTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveDBTypeActionPerformed + try { + //mudar para dao com esse + + FileOutputStream out = new FileOutputStream("C:\\Librography\\DBType"); + String printer = (String) boxDBType.getSelectedItem(); + out.write(printer.trim().getBytes()); + out.close(); + //System.out.println(printer); + + } catch (IOException e1) { + System.err.println("Error occurred"); + e1.printStackTrace(); + } + + }//GEN-LAST:event_btnSaveDBTypeActionPerformed + + private void boxDBTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boxDBTypeActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_boxDBTypeActionPerformed + + private void boxPrinterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boxPrinterActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_boxPrinterActionPerformed + + private void cboxTemaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cboxTemaActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_cboxTemaActionPerformed //############################################################################ /** @@ -1070,6 +1152,7 @@ public class FormOptions extends javax.swing.JFrame { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JComboBox boxCorredor; + private javax.swing.JComboBox boxDBType; private javax.swing.JComboBox boxDisponibilidade; private javax.swing.JComboBox boxPiso; private javax.swing.JComboBox boxPosicao; @@ -1090,14 +1173,15 @@ public class FormOptions extends javax.swing.JFrame { private javax.swing.JButton btnExcluirTipos; private javax.swing.JButton btnLibraryAddress; private javax.swing.JButton btnLibraryName; + private javax.swing.JButton btnSaveDBType; private javax.swing.JButton btnSaveIp; private javax.swing.JButton btnSaveMsgRecibo; private javax.swing.JButton btnSavePassDB; private javax.swing.JButton btnSavePrinter; + private javax.swing.JButton btnSaveTheme; private javax.swing.JButton btnSaveUserDB; private javax.swing.JButton btnSetLibraryLogo; private javax.swing.JComboBox cboxTema; - private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; @@ -1108,6 +1192,7 @@ public class FormOptions extends javax.swing.JFrame { private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel21; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5;