use of model.Pratileira in project arquivoProject by fader-azevedo.
the class CriarPastaController method salvar.
@FXML
private void salvar() {
if (txtCodigo.getText().isEmpty() || txtCurso.getText().isEmpty() || cbAno.getSelectionModel().isEmpty() || cbPratileira.getSelectionModel().isEmpty() || cbSemestre.getSelectionModel().isEmpty()) {
db.alertInfo("Preenche todos campos");
return;
}
Pratileira prat = (Pratileira) db.getEstOrPratOrPastByCodigo(cbPratileira.getValue().toString(), Pratileira.class);
Calendar c = Calendar.getInstance();
Pasta p = new Pasta(prat.getIdpratileira(), 1, txtCodigo.getText().trim(), Integer.parseInt(cbAno.getValue().toString()), txtCurso.getText(), cbSemestre.getValue().toString(), c.getTime());
db.salvar(p);
lista.setItems(db.listarCogigoPasta());
txtCodigo.setText("");
txtCurso.setText("");
cbAno.getSelectionModel().clearSelection();
cbPratileira.getSelectionModel().clearSelection();
cbSemestre.getSelectionModel().clearSelection();
}
use of model.Pratileira in project arquivoProject by fader-azevedo.
the class CriarPratileiraController method salvar.
@FXML
private void salvar() {
String codigo = txtCodigo.getText().trim();
if (cbEstante.getSelectionModel().isEmpty() || codigo.isEmpty()) {
db.alertInfo("Preenche todos campos");
return;
}
Estante est = (Estante) db.getEstOrPratOrPastByCodigo(cbEstante.getValue().toString(), Estante.class);
Calendar cal = Calendar.getInstance();
Pratileira p = new Pratileira(est.getIdestante(), 1, codigo, cal.getTime());
db.salvar(p);
lista.setItems(db.listarCogigoPratileira());
txtCodigo.setText("");
cbEstante.getSelectionModel().clearSelection();
}
use of model.Pratileira in project arquivoProject by fader-azevedo.
the class ListaPastaController method scrollBtnPasta.
public void scrollBtnPasta(String codigoEstante, String codigoPratileira) {
GridPane gr = new GridPane();
gr.setHgap(12);
gr.setVgap(16);
gr.setPadding(new Insets(5, 5, 5, 5));
sessao = HibernateUtil.getSessionFactory().openSession();
sessao.beginTransaction();
List<Pasta> data = null;
if (!codigoEstante.equalsIgnoreCase("") && !codigoEstante.equalsIgnoreCase("")) {
codigoEstanteLb.setText(codigoEstante);
codigoPratileiraLb.setText(codigoPratileira);
codigoEstanteLb.getStyleClass().add("lbCamiho");
codigoPratileiraLb.getStyleClass().add("lbCamiho");
MaterialDesignIconView iconEstant = new MaterialDesignIconView(MaterialDesignIcon.BOOK, "20");
boxCaminho.getChildren().add(iconEstant);
boxCaminho.getChildren().add(codigoEstanteLb);
OctIconView iconNext = new OctIconView(OctIcon.CHEVRON_RIGHT, "20");
iconNext.setFill(Paint.valueOf("#0078D7"));
boxCaminho.getChildren().add(iconNext);
MaterialDesignIconView iconPrat = new MaterialDesignIconView(MaterialDesignIcon.LIBRARY_BOOKS, "20");
boxCaminho.getChildren().add(iconPrat);
boxCaminho.getChildren().add(codigoPratileiraLb);
Pratileira es = (Pratileira) db.getEstOrPratOrPastByCodigo(codigoPratileira, Pratileira.class);
int idPratileira = es.getIdpratileira();
SQLQuery query = sessao.createSQLQuery("SELECT * FROM Pasta WHERE idpratileira =?").addEntity(Pasta.class);
data = query.setString(0, idPratileira + "%").list();
} else {
b = true;
this.lbInfo.setVisible(false);
data = sessao.createCriteria(Pasta.class).list();
sessao.getTransaction().commit();
}
int numColunas = 0;
int numLinha = 0;
for (Pasta obj : data) {
JFXButton button = new JFXButton(obj.getCodigo());
MaterialDesignIconView icon = new MaterialDesignIconView(MaterialDesignIcon.FOLDER, "40");
icon.setFill(Paint.valueOf("#A17878"));
button.setGraphic(icon);
button.setContentDisplay(ContentDisplay.TOP);
button.setPrefSize(99, 96);
button.setButtonType(JFXButton.ButtonType.RAISED);
button.setDefaultButton(true);
button.setTooltip(db.getPastaInfoToolTip(obj.getCodigo()));
if (numColunas < 6) {
gr.add(button, numColunas, numLinha);
numColunas += 1;
} else {
numColunas = 0;
numLinha += 1;
gr.add(button, numColunas, numLinha);
numColunas += 1;
}
button.setOnAction(bb -> {
playThis(button);
});
}
ScrollPane scroll = new ScrollPane(gr);
scroll.setStyle("-fx-background-color:transparent;");
scroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scroll.setPrefSize(680, 331);
scroll.setPadding(new Insets(2, 0, 0, 2));
if (data.isEmpty()) {
lbInfo.setVisible(true);
} else {
pnButoes.getChildren().add(scroll);
}
}
use of model.Pratileira in project arquivoProject by fader-azevedo.
the class ListaPastaController method playThis.
private void playThis(JFXButton button) {
Timeline timeline = new Timeline(new KeyFrame(Duration.millis(250), ev -> {
clipRectNextDocument.setHeight(pnCarregaDocumentos.getHeight());
if (clipRectNextDocument.widthProperty().get() != 0) {
Timeline timelineUp = new Timeline();
final KeyValue kvUp1 = new KeyValue(clipRectNextDocument.widthProperty(), 0);
final KeyValue kvUp2 = new KeyValue(clipRectNextDocument.translateXProperty(), pnCarregaDocumentos.getWidth());
final KeyValue kvUp4 = new KeyValue(pnCarregaDocumentos.prefWidthProperty(), 0);
final KeyValue kvUp3 = new KeyValue(pnCarregaDocumentos.translateXProperty(), pnCarregaDocumentos.getWidth());
final KeyFrame kfUp = new KeyFrame(Duration.millis(1000), kvUp1, kvUp2, kvUp3, kvUp4);
timelineUp.getKeyFrames().add(kfUp);
timelineUp.play();
} else {
try {
if (b == true) {
Pasta past = (Pasta) db.getEstOrPratOrPastByCodigo(button.getText(), Pasta.class);
Pratileira prat = (Pratileira) db.buscarPorId(Pratileira.class, past.getPratileira());
codigoPratileiraLb.setText(prat.getCodigo());
Estante es = (Estante) db.buscarPorId(Estante.class, prat.getEstante());
codigoEstanteLb.setText(es.getCodigo());
}
clipRectNextDocument.setHeight(pnCarregaDocumentos.getHeight());
pnCarregaDocumentos.toFront();
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.load(getClass().getResource("/view/ListaDocumento.fxml").openStream());
ListaDocumentoController lDocController = fxmlLoader.getController();
lDocController.btnBack.setOnAction(xs -> {
this.playThis(button);
});
lDocController.scrollBtnPauta(codigoEstanteLb.getText(), codigoPratileiraLb.getText(), button.getText());
lDocController.removeClass();
lDocController.boxCaminho.setVisible(true);
lDocController.btnBack.setVisible(true);
lDocController.btnCloseDoc.setVisible(false);
clipRectNextDocument.toFront();
AnchorPane root = fxmlLoader.getRoot();
pnCarregaDocumentos.getChildren().clear();
pnCarregaDocumentos.getChildren().add(root);
Timeline timeDireita = new Timeline();
final KeyValue kvDwn1 = new KeyValue(clipRectNextDocument.widthProperty(), pnCarregaDocumentos.getWidth());
final KeyValue kvDwn2 = new KeyValue(clipRectNextDocument.translateXProperty(), 0);
final KeyValue kvDwn4 = new KeyValue(pnCarregaDocumentos.prefWidthProperty(), pnCarregaDocumentos.getWidth());
final KeyValue kvDwn3 = new KeyValue(pnCarregaDocumentos.translateXProperty(), 0);
final KeyFrame kfDwn = new KeyFrame(Duration.millis(600), kvDwn1, kvDwn2, kvDwn3, kvDwn4);
timeDireita.getKeyFrames().add(kfDwn);
timeDireita.play();
} catch (Exception ex) {
Logger.getLogger(ListaDocumentoController.class.getName()).log(Level.SEVERE, null, ex);
}
}
}));
timeline.play();
}
use of model.Pratileira in project arquivoProject by fader-azevedo.
the class ListaPratileiraController method scrollBtnPratileira.
public void scrollBtnPratileira(String codigoEstante) {
GridPane gr = new GridPane();
gr.setHgap(12);
gr.setVgap(16);
gr.setPadding(new Insets(5, 5, 5, 5));
sessao = HibernateUtil.getSessionFactory().openSession();
sessao.beginTransaction();
List<Pratileira> data = null;
if (!codigoEstante.equalsIgnoreCase("")) {
codigoEstanteLb.setText(codigoEstante);
codigoEstanteLb.getStyleClass().add("lbCamiho");
MaterialDesignIconView iconEstante = new MaterialDesignIconView(MaterialDesignIcon.BOOK, "20");
boxCaminho.getChildren().add(iconEstante);
boxCaminho.getChildren().add(codigoEstanteLb);
Estante es = (Estante) db.getEstOrPratOrPastByCodigo(codigoEstante, Estante.class);
int idEstante = es.getIdestante();
SQLQuery query = sessao.createSQLQuery("SELECT * FROM Pratileira WHERE idestante =?").addEntity(Pratileira.class);
data = query.setString(0, idEstante + "%").list();
} else {
// Qunado clica directamente na pratileira
b = true;
this.lbInfo.setVisible(false);
data = sessao.createCriteria(Pratileira.class).list();
sessao.getTransaction().commit();
}
int numColunas = 0;
int numLinha = 0;
for (Pratileira prat : data) {
JFXButton button = new JFXButton(prat.getCodigo());
MaterialDesignIconView icon = new MaterialDesignIconView(MaterialDesignIcon.LIBRARY_BOOKS, "40");
icon.setFill(Paint.valueOf("#A17878"));
button.setGraphic(icon);
button.setContentDisplay(ContentDisplay.TOP);
button.setPrefSize(99, 96);
button.setButtonType(JFXButton.ButtonType.RAISED);
button.setDefaultButton(true);
button.setTooltip(db.tooltipPratileira(prat.getCodigo()));
if (numColunas < 6) {
gr.add(button, numColunas, numLinha);
numColunas += 1;
} else {
numColunas = 0;
numLinha += 1;
gr.add(button, numColunas, numLinha);
numColunas += 1;
}
button.setOnAction(e -> {
playThis(button);
});
}
ScrollPane scroll = new ScrollPane(gr);
scroll.setStyle("-fx-background-color:transparent;");
scroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scroll.setPrefSize(680, 331);
scroll.setPadding(new Insets(2, 0, 0, 2));
if (data.isEmpty()) {
lbInfo.setVisible(true);
} else {
pnButoes.getChildren().add(scroll);
}
}
Aggregations