use of model.Estante in project arquivoProject by fader-azevedo.
the class CriarEstanteController method salvarEstante.
@FXML
private void salvarEstante() {
if (txtCodigo.getText().isEmpty() || txtDescricao.getText().isEmpty()) {
db.alertInfo("Por Favor, Preenche todos os campos");
return;
}
Calendar cal = Calendar.getInstance();
Estante e = new Estante(1, db.tratamento(txtCodigo.getText().trim()), db.tratamento(txtDescricao.getText().trim()), cal.getTime());
db.salvar(e);
lbMessage.setOpacity(1);
Timeline times = new Timeline(new KeyFrame(Duration.millis(4000), ev -> {
lbMessage.setOpacity(0);
}));
times.play();
txtCodigo.setText("");
txtDescricao.setText("");
lista.setItems(db.listarCogigoEstante());
}
use of model.Estante 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.Estante 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.Estante 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);
}
}
use of model.Estante in project arquivoProject by fader-azevedo.
the class ListaEstanteController method scrollBtsEstante.
public ScrollPane scrollBtsEstante() {
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<Estante> data = sessao.createCriteria(Estante.class).list();
int numColunas = 0;
int numLinha = 0;
for (Estante estante : data) {
JFXButton button = new JFXButton(estante.getCodigo());
MaterialDesignIconView icon = new MaterialDesignIconView(MaterialDesignIcon.BOOK, "40");
icon.setFill(Paint.valueOf("#A17878"));
button.setGraphic(icon);
button.setContentDisplay(ContentDisplay.TOP);
button.setPrefSize(99, 96);
button.setDefaultButton(true);
button.setButtonType(JFXButton.ButtonType.RAISED);
button.setTooltip(db.tooltipEstante(estante.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));
sessao.getTransaction().commit();
sessao.close();
return scroll;
}
Aggregations