Search in sources :

Example 1 with Pratileira

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();
}
Also used : Pratileira(model.Pratileira) Calendar(java.util.Calendar) Pasta(model.Pasta) FXML(javafx.fxml.FXML)

Example 2 with Pratileira

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();
}
Also used : Pratileira(model.Pratileira) Calendar(java.util.Calendar) Estante(model.Estante) FXML(javafx.fxml.FXML)

Example 3 with Pratileira

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);
    }
}
Also used : GridPane(javafx.scene.layout.GridPane) Insets(javafx.geometry.Insets) Pratileira(model.Pratileira) OctIconView(de.jensd.fx.glyphs.octicons.OctIconView) ScrollPane(javafx.scene.control.ScrollPane) Pasta(model.Pasta) JFXButton(com.jfoenix.controls.JFXButton) SQLQuery(org.hibernate.SQLQuery) MaterialDesignIconView(de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView) Paint(javafx.scene.paint.Paint)

Example 4 with Pratileira

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();
}
Also used : JFXButton(com.jfoenix.controls.JFXButton) MaterialDesignIconView(de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView) Initializable(javafx.fxml.Initializable) URL(java.net.URL) SQLQuery(org.hibernate.SQLQuery) Session(org.hibernate.Session) Pratileira(model.Pratileira) Level(java.util.logging.Level) Insets(javafx.geometry.Insets) ScrollPane(javafx.scene.control.ScrollPane) ResourceBundle(java.util.ResourceBundle) Pasta(model.Pasta) FXMLLoader(javafx.fxml.FXMLLoader) KeyValue(javafx.animation.KeyValue) GridPane(javafx.scene.layout.GridPane) OctIconView(de.jensd.fx.glyphs.octicons.OctIconView) Pane(javafx.scene.layout.Pane) HBox(javafx.scene.layout.HBox) KeyFrame(javafx.animation.KeyFrame) Label(javafx.scene.control.Label) OctIcon(de.jensd.fx.glyphs.octicons.OctIcon) Timeline(javafx.animation.Timeline) Rectangle(javafx.scene.shape.Rectangle) IOException(java.io.IOException) Logger(java.util.logging.Logger) Estante(model.Estante) FXML(javafx.fxml.FXML) List(java.util.List) Duration(javafx.util.Duration) AnchorPane(javafx.scene.layout.AnchorPane) Paint(javafx.scene.paint.Paint) MaterialDesignIcon(de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon) ContentDisplay(javafx.scene.control.ContentDisplay) Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) Pratileira(model.Pratileira) KeyFrame(javafx.animation.KeyFrame) Pasta(model.Pasta) FXMLLoader(javafx.fxml.FXMLLoader) AnchorPane(javafx.scene.layout.AnchorPane) IOException(java.io.IOException) Estante(model.Estante)

Example 5 with Pratileira

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);
    }
}
Also used : GridPane(javafx.scene.layout.GridPane) Insets(javafx.geometry.Insets) Pratileira(model.Pratileira) ScrollPane(javafx.scene.control.ScrollPane) JFXButton(com.jfoenix.controls.JFXButton) SQLQuery(org.hibernate.SQLQuery) MaterialDesignIconView(de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView) Paint(javafx.scene.paint.Paint) Estante(model.Estante)

Aggregations

Pratileira (model.Pratileira)6 JFXButton (com.jfoenix.controls.JFXButton)4 MaterialDesignIconView (de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView)4 FXML (javafx.fxml.FXML)4 Insets (javafx.geometry.Insets)4 ScrollPane (javafx.scene.control.ScrollPane)4 GridPane (javafx.scene.layout.GridPane)4 Paint (javafx.scene.paint.Paint)4 Estante (model.Estante)4 SQLQuery (org.hibernate.SQLQuery)4 Pasta (model.Pasta)3 MaterialDesignIcon (de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon)2 OctIconView (de.jensd.fx.glyphs.octicons.OctIconView)2 IOException (java.io.IOException)2 URL (java.net.URL)2 Calendar (java.util.Calendar)2 List (java.util.List)2 ResourceBundle (java.util.ResourceBundle)2 Level (java.util.logging.Level)2 Logger (java.util.logging.Logger)2