Search in sources :

Example 6 with Estante

use of model.Estante in project arquivoProject by fader-azevedo.

the class ListaEstanteController method configurarPainel.

private void configurarPainel(StackPane root) {
    paneRegistarEstante = new VBox();
    paneRegistarEstante.setPrefSize(boxBounds.getWidth(), boxBounds.getHeight());
    paneRegistarEstante.setAlignment(Pos.TOP_RIGHT);
    StackPane sp1 = new StackPane();
    sp1.setPadding(new Insets(30, 10, 10, 10));
    sp1.setAlignment(Pos.TOP_LEFT);
    sp1.getStyleClass().add("paneAddNew");
    sp1.setPrefSize(boxBounds.getWidth(), boxBounds.getHeight() - ACTION_BOX_HGT);
    /*Criando campos de registo*/
    JFXTextField txtCodiggo = new JFXTextField();
    txtCodiggo.setPromptText("Código");
    txtCodiggo.setFocusColor(Paint.valueOf("#a17878"));
    txtCodiggo.setUnFocusColor(Paint.valueOf("#a17878"));
    txtCodiggo.setLabelFloat(true);
    JFXTextArea txtDesc = new JFXTextArea();
    txtDesc.setPromptText("Descrição");
    txtDesc.setPrefHeight(35);
    txtDesc.setWrapText(true);
    txtDesc.setPadding(new Insets(0, 5, 0, 5));
    txtDesc.setFocusColor(Paint.valueOf("#a17878"));
    txtDesc.setUnFocusColor(Paint.valueOf("#a17878"));
    txtDesc.setLabelFloat(true);
    JFXButton btnSalvar = new JFXButton("Salvar");
    MaterialDesignIconView icon = new MaterialDesignIconView(MaterialDesignIcon.CONTENT_SAVE, "20");
    icon.setFill(Paint.valueOf("#179e41"));
    btnSalvar.setContentDisplay(ContentDisplay.LEFT);
    btnSalvar.setGraphic(icon);
    btnSalvar.getStyleClass().add("btns");
    btnSalvar.setOnAction(e -> {
        if (txtCodiggo.getText().isEmpty() || txtCodiggo.getText().isEmpty()) {
            db.alertInfo("Preenche todos campos");
            return;
        }
        Calendar c = Calendar.getInstance();
        Estante est = new Estante(1, db.tratamento(txtCodiggo.getText().trim()), db.tratamento(txtDesc.getText().trim()), c.getTime());
        db.salvar(est);
        txtCodiggo.setText("");
        txtDesc.setText("");
        pnButoes.getChildren().clear();
        pnButoes.getChildren().add(scrollBtsEstante());
    });
    HBox hboxBut = new HBox(btnSalvar);
    hboxBut.setPadding(new Insets(12, 8, 0, 0));
    hboxBut.setAlignment(Pos.CENTER_RIGHT);
    VBox txts = new VBox(txtCodiggo, txtDesc, hboxBut);
    txts.getChildren().get(2).setLayoutX(ACTION_BOX_HGT);
    txts.setSpacing(20);
    sp1.getChildren().add(txts);
    StackPane sp2 = new StackPane();
    sp2.setPrefSize(130, ACTION_BOX_HGT);
    sp2.getChildren().add(lbAdicionarEstante);
    sp2.getStyleClass().add("sp");
    sp2.setOnMouseClicked(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent paramT) {
            togglePaneVisibility();
        }
    });
    paneRegistarEstante.getChildren().addAll(GroupBuilder.create().children(sp1).build(), GroupBuilder.create().children(sp2).build());
    root.getChildren().add(GroupBuilder.create().children(paneRegistarEstante).build());
}
Also used : JFXTextArea(com.jfoenix.controls.JFXTextArea) Insets(javafx.geometry.Insets) MouseEvent(javafx.scene.input.MouseEvent) JFXTextField(com.jfoenix.controls.JFXTextField) Calendar(java.util.Calendar) JFXButton(com.jfoenix.controls.JFXButton) MaterialDesignIconView(de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView) Estante(model.Estante)

Example 7 with Estante

use of model.Estante in project arquivoProject by fader-azevedo.

the class ListaPratileiraController method playThis.

private void playThis(JFXButton button) {
    Timeline timeline = new Timeline(new KeyFrame(Duration.millis(250), ev -> {
        clipRectNextPasta.setHeight(pnCarregaPasta.getHeight());
        if (clipRectNextPasta.widthProperty().get() != 0) {
            Timeline timelineUp = new Timeline();
            final KeyValue kvUp1 = new KeyValue(clipRectNextPasta.widthProperty(), 0);
            final KeyValue kvUp2 = new KeyValue(clipRectNextPasta.translateXProperty(), pnCarregaPasta.getWidth());
            final KeyValue kvUp4 = new KeyValue(pnCarregaPasta.prefWidthProperty(), 0);
            final KeyValue kvUp3 = new KeyValue(pnCarregaPasta.translateXProperty(), pnCarregaPasta.getWidth());
            final KeyFrame kfUp = new KeyFrame(Duration.millis(1000), kvUp1, kvUp2, kvUp3, kvUp4);
            timelineUp.getKeyFrames().add(kfUp);
            timelineUp.play();
        } else {
            try {
                if (b == true) {
                    // quando e clicado a pratileira sem estante
                    Pratileira prt = (Pratileira) db.getEstOrPratOrPastByCodigo(button.getText(), Pratileira.class);
                    Estante es = (Estante) db.buscarPorId(Estante.class, prt.getEstante());
                    codigoEstanteLb.setText(es.getCodigo());
                }
                clipRectNextPasta.setHeight(pnCarregaPasta.getHeight());
                pnCarregaPasta.toFront();
                FXMLLoader fxmlLoader = new FXMLLoader();
                fxmlLoader.load(getClass().getResource("/view/ListaPasta.fxml").openStream());
                ListaPastaController lpastaController = fxmlLoader.getController();
                lpastaController.btnBack.setOnAction(xs -> {
                    this.playThis(button);
                });
                lpastaController.scrollBtnPasta(codigoEstanteLb.getText(), button.getText());
                lpastaController.removeClass();
                lpastaController.boxCaminho.setVisible(true);
                lpastaController.btnBack.setVisible(true);
                lpastaController.btnClosePasta.setVisible(false);
                btnClosePratileira.toFront();
                AnchorPane root = fxmlLoader.getRoot();
                pnCarregaPasta.getChildren().clear();
                pnCarregaPasta.getChildren().add(root);
                Timeline timeDireita = new Timeline();
                final KeyValue kvDwn1 = new KeyValue(clipRectNextPasta.widthProperty(), pnCarregaPasta.getWidth());
                final KeyValue kvDwn2 = new KeyValue(clipRectNextPasta.translateXProperty(), 0);
                final KeyValue kvDwn4 = new KeyValue(pnCarregaPasta.prefWidthProperty(), pnCarregaPasta.getWidth());
                final KeyValue kvDwn3 = new KeyValue(pnCarregaPasta.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(ListaPratileiraController.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) FXMLLoader(javafx.fxml.FXMLLoader) KeyValue(javafx.animation.KeyValue) GridPane(javafx.scene.layout.GridPane) Pane(javafx.scene.layout.Pane) HBox(javafx.scene.layout.HBox) KeyFrame(javafx.animation.KeyFrame) Label(javafx.scene.control.Label) 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) FXMLLoader(javafx.fxml.FXMLLoader) AnchorPane(javafx.scene.layout.AnchorPane) IOException(java.io.IOException) 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