Search in sources :

Example 1 with Estante

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());
}
Also used : JFXTextArea(com.jfoenix.controls.JFXTextArea) JFXButton(com.jfoenix.controls.JFXButton) KeyFrame(javafx.animation.KeyFrame) Initializable(javafx.fxml.Initializable) Label(javafx.scene.control.Label) ListView(javafx.scene.control.ListView) URL(java.net.URL) Timeline(javafx.animation.Timeline) Estante(model.Estante) FXML(javafx.fxml.FXML) Duration(javafx.util.Duration) Calendar(java.util.Calendar) ResourceBundle(java.util.ResourceBundle) AnchorPane(javafx.scene.layout.AnchorPane) ObservableList(javafx.collections.ObservableList) JFXTextField(com.jfoenix.controls.JFXTextField) Timeline(javafx.animation.Timeline) Calendar(java.util.Calendar) KeyFrame(javafx.animation.KeyFrame) Estante(model.Estante) FXML(javafx.fxml.FXML)

Example 2 with Estante

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

Example 3 with Estante

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();
}
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 4 with Estante

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);
    }
}
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)

Example 5 with Estante

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

Aggregations

Estante (model.Estante)7 JFXButton (com.jfoenix.controls.JFXButton)6 MaterialDesignIconView (de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView)5 Insets (javafx.geometry.Insets)5 FXML (javafx.fxml.FXML)4 Paint (javafx.scene.paint.Paint)4 Pratileira (model.Pratileira)4 URL (java.net.URL)3 Calendar (java.util.Calendar)3 ResourceBundle (java.util.ResourceBundle)3 KeyFrame (javafx.animation.KeyFrame)3 Timeline (javafx.animation.Timeline)3 Initializable (javafx.fxml.Initializable)3 Label (javafx.scene.control.Label)3 ScrollPane (javafx.scene.control.ScrollPane)3 AnchorPane (javafx.scene.layout.AnchorPane)3 GridPane (javafx.scene.layout.GridPane)3 Duration (javafx.util.Duration)3 SQLQuery (org.hibernate.SQLQuery)3 JFXTextArea (com.jfoenix.controls.JFXTextArea)2