use of de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView 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;
}
use of de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIconView 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());
}
Aggregations