Skip to content

Commit

Permalink
Entrega 5.3 - Implementação de Interface Gráfica (GUI) (#55)
Browse files Browse the repository at this point in the history
Entrega 5.3 - Implementação de Interface Gráfica (GUI)


Co-authored-by: Haga Fedra de Brito <hagafedra@users.noreply.github.com>
Co-authored-by: Gerorsh <62017578+Gerorsch@users.noreply.github.com>
  • Loading branch information
3 people committed Jun 29, 2021
2 parents 19e0ccf + 6e3af8a commit 5e7cd80
Show file tree
Hide file tree
Showing 43 changed files with 3,188 additions and 27 deletions.
23 changes: 23 additions & 0 deletions src/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import gui.GerenciadorTelas;
import javafx.application.Application;
import javafx.stage.Stage;

public class Main extends Application {

public static void main(String[] args) {
launch(args);
}

@Override
public void start(Stage primaryStage) {
primaryStage.setScene(GerenciadorTelas.getInstance().getMainScene());
primaryStage.setTitle("Sistema de Gerenciamento de Empréstimo Pessoal Alternativo");

primaryStage.setWidth(1024);
primaryStage.setHeight(768);

GerenciadorTelas.getInstance().setPrimaryStage(primaryStage);

primaryStage.show();
}
}
15 changes: 15 additions & 0 deletions src/exceptions/PropostaInvalidaException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package exceptions;

public class PropostaInvalidaException extends Exception {
/**
* Constructs a new exception with the specified detail message. The
* cause is not initialized, and may subsequently be initialized by
* a call to {@link #initCause}.
*
* @param message the detail message. The detail message is saved for
* later retrieval by the {@link #getMessage()} method.
*/
public PropostaInvalidaException(String message) {
super(message);
}
}
63 changes: 63 additions & 0 deletions src/gerenciamento/SessionManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package gerenciamento;

import negocio.beans.*;

public class SessionManager {
private static SessionManager instance;
private Pessoa pessoaSessao;
private Bens bensSessao;
private Proposta propostaSessao;
private Emprestimo emprestimoSessao;
private Movimentacao movimentacaoSessao;

private SessionManager() {

}

public static SessionManager getInstance() {
if (instance == null) {
instance = new SessionManager();
}
return instance;
}

public Pessoa getPessoaSessao() {
return pessoaSessao;
}

public void setPessoaSessao(Pessoa pessoaSessao) {
this.pessoaSessao = pessoaSessao;
}

public Bens getBensSessao() {
return bensSessao;
}

public void setBensSessao(Bens bensSessao) {
this.bensSessao = bensSessao;
}

public Proposta getPropostaSessao() {
return propostaSessao;
}

public void setPropostaSessao(Proposta propostaSessao) {
this.propostaSessao = propostaSessao;
}

public Emprestimo getEmprestimoSessao() {
return emprestimoSessao;
}

public void setEmprestimoSessao(Emprestimo emprestimoSessao) {
this.emprestimoSessao = emprestimoSessao;
}

public Movimentacao getMovimentacaoSessao() {
return movimentacaoSessao;
}

public void setMovimentacaoSessao(Movimentacao movimentacaoSessao) {
this.movimentacaoSessao = movimentacaoSessao;
}
}
161 changes: 161 additions & 0 deletions src/gui/GerenciadorTelas.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
package gui;

import javafx.event.ActionEvent;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

import java.io.IOException;

public class GerenciadorTelas {
private static GerenciadorTelas instance;
private Stage primaryStage;
private Scene mainScene;

private GerenciadorTelas() {
this.initialize();
}

public static GerenciadorTelas getInstance() {
if (instance == null) {
instance = new GerenciadorTelas();
}
return instance;
}

private void initialize() {
FXMLLoader fxmlLoader = new FXMLLoader();
Parent telaLogin = null;

try {
telaLogin = fxmlLoader.load(getClass().getResource("/gui/TelaLogin.fxml").openStream());
} catch (IOException e) {
e.printStackTrace();
}
this.mainScene = new Scene(telaLogin);
}

public void changeScreen(String tela) {
FXMLLoader fxmlLoader = new FXMLLoader();
Parent telaAtual = null;

switch (tela) {
case "telaCliente": {
try {
telaAtual = fxmlLoader.load(getClass().getResource("/gui/TelaPrincipalCliente.fxml").openStream());
} catch (IOException e) {
e.printStackTrace();
}
break;
}
case "telaEmpregado": {
try {
telaAtual = fxmlLoader.load(getClass().getResource("/gui/TelaPrincipalEmpregado.fxml").openStream());
} catch (IOException e) {
e.printStackTrace();
}
break;
}
case "telaAdmin": {
try {
telaAtual = fxmlLoader.load(getClass().getResource("/gui/TelaPrincipalAdmin.fxml").openStream());
} catch (IOException e) {
e.printStackTrace();
}
break;
}
case "telaCadastrar":{
try {
telaAtual = fxmlLoader.load(getClass().getResource("/gui/TelaCadastrarCliente.fxml").openStream());
} catch (IOException e) {
e.printStackTrace();
}
break;
}
case "telaCadastrarEmpregado": {
try {
telaAtual = fxmlLoader.load(getClass().getResource("/gui/TelaCadastroEmpregados.fxml").openStream());
} catch (IOException e) {
e.printStackTrace();
}
break;
}
case "telaLogin": {
try {
telaAtual = fxmlLoader.load(getClass().getResource("/gui/TelaLogin.fxml").openStream());
} catch (IOException e) {
e.printStackTrace();
}
break;
}
case "telaBensEmpresa": {
try {
telaAtual = fxmlLoader.load(getClass().getResource("/gui/TelaBensEmpresa.fxml").openStream());
} catch (IOException e) {
e.printStackTrace();
}
break;
}
case "telaAnaliseProposta": {
try {
telaAtual = fxmlLoader.load(getClass().getResource("/gui/TelaAnaliseProposta.fxml").openStream());
} catch (IOException e) {
e.printStackTrace();
}
break;
}
case "telaDevedorDetalhe": {
try {
telaAtual = fxmlLoader.load(getClass().getResource("/gui/TelaDevedorDetalhe.fxml").openStream());
} catch (IOException e) {
e.printStackTrace();
}
break;
}
case "telaInformacoesPessoais": {
try {
telaAtual = fxmlLoader.load(getClass().getResource("/gui/TelaInformacoesPessoais.fxml").openStream());
} catch (IOException e) {
e.printStackTrace();
}
break;
}
case "telaBENS": {
try {
telaAtual = fxmlLoader.load(getClass().getResource("/gui/TelaBENS.fxml").openStream());
} catch (IOException e) {
e.printStackTrace();
}
break;
}
case "telaCriarProposta": {
try {
telaAtual = fxmlLoader.load(getClass().getResource("/gui/TelaCriarProposta.fxml").openStream());
} catch (IOException e) {
e.printStackTrace();
}
break;
}
default:
throw new IllegalArgumentException("Unexpected value: " + tela);
}

this.mainScene = new Scene(telaAtual);
primaryStage.setScene(mainScene);

}

public Scene getMainScene() {
return mainScene;
}

public Stage getPrimaryStage() {
return primaryStage;
}

public void setPrimaryStage(Stage primaryStage) {
this.primaryStage = primaryStage;
}
}
81 changes: 81 additions & 0 deletions src/gui/TelaAnaliseProposta.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Accordion?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.DatePicker?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.Pane?>

<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="768.0" prefWidth="1028.0" xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gui.TelaAnalisePropostaController">
<children>
<SplitPane dividerPositions="0.29797979797979796" layoutX="97.0" layoutY="42.0" prefHeight="313.0" prefWidth="588.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<Label layoutX="14.0" layoutY="14.0" text="Cliente:" />
<Label layoutX="15.0" layoutY="60.0" text="Data:" />
<Label layoutX="14.0" layoutY="108.0" text="Motivo:" />
<Label layoutX="13.0" layoutY="163.0" text="Valor:" />
<Label layoutX="11.0" layoutY="199.0" text="Parcelas:" />
<Label layoutX="12.0" layoutY="240.0" text="Prazo:" />
<Label layoutX="13.0" layoutY="280.0" text="Garantia(s):" />
</children>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="211.0" prefWidth="210.0">
<children>
<TextField layoutX="14.0" layoutY="14.0" />
<TextArea layoutX="14.0" layoutY="97.0" prefHeight="46.0" prefWidth="200.0" />
<TextField layoutX="14.0" layoutY="156.0" />
<TextField layoutX="14.0" layoutY="194.0" />
<DatePicker layoutX="14.0" layoutY="54.0" />
<TextField layoutX="14.0" layoutY="233.0" />
<TextField layoutX="14.0" layoutY="272.0" />
</children>
</AnchorPane>
</items>
</SplitPane>
<Label layoutX="100.0" layoutY="6.0" prefHeight="36.0" prefWidth="126.0" text="Detalhes da Proposta" />
<ChoiceBox layoutX="725.0" layoutY="42.0" prefHeight="28.0" prefWidth="270.0" />
<Button layoutX="926.0" layoutY="79.0" mnemonicParsing="false" text="Confirmar" />
<Label layoutX="734.0" layoutY="48.0" text="Cliente em Detalhe" />
<Accordion layoutX="97.0" layoutY="347.0" />
<Button layoutX="567.0" layoutY="317.0" mnemonicParsing="false" text="Criar Empréstimo" />
<Label layoutX="24.0" layoutY="24.0" />
<SplitPane dividerPositions="0.29797979797979796" layoutX="97.0" layoutY="388.0" prefHeight="313.0" prefWidth="588.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<Label layoutX="14.0" layoutY="14.0" text="Cliente:" />
<Label layoutX="15.0" layoutY="60.0" text="Data:" />
<Label layoutX="13.0" layoutY="104.0" text="Motivo:" />
<Label layoutX="13.0" layoutY="167.0" text="Valor:" />
<Label layoutX="11.0" layoutY="203.0" text="Parcelas:" />
<Label layoutX="11.0" layoutY="236.0" text="Prazo:" />
<Label layoutX="13.0" layoutY="273.0" text="Garantia(s):" />
</children>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="312.0" prefWidth="408.0">
<children>
<DatePicker layoutX="14.0" layoutY="55.0" />
<TextArea layoutX="14.0" layoutY="96.0" prefHeight="46.0" prefWidth="366.0" />
<TextField layoutX="14.0" layoutY="14.0" />
<TextField layoutX="14.0" layoutY="156.0" />
<TextField layoutX="14.0" layoutY="196.0" />
<TextField layoutX="14.0" layoutY="235.0" />
<TextField layoutX="14.0" layoutY="272.0" />
</children>
</AnchorPane>
</items>
</SplitPane>
<AnchorPane layoutY="329.0" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" />
<Label layoutX="14.0" layoutY="371.0" />
<Button layoutX="546.0" layoutY="665.0" mnemonicParsing="false" text="Criar Contraproposta" />
<Label layoutX="100.0" layoutY="353.0" prefHeight="36.0" prefWidth="126.0" text="Contraproposta" />
<Button layoutX="866.0" layoutY="665.0" mnemonicParsing="false" onAction="#btnVoltarPressed" text="Voltar à tela principal" />
</children>
</Pane>
Loading

0 comments on commit 5e7cd80

Please sign in to comment.