protected Node buildtoolsFiltroAlumno(boolean index) { HBox hBox = new HBox(10); hBox.setMaxHeight(maxHeightCabezera); hBox.setMaxWidth(DefaultAncho); hBox.setMinWidth(DefaultAncho); hBox.setPadding(new Insets(10, 10, 5, 10)); hBox.setStyle("-fx-background-color:black"); hBox.getChildren().add(txtFiltroTitulo); hBox.getChildren() .add( TextBuilder.create() .text("|") .fill(Color.WHITE) .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28)) .build()); hBox.getChildren().add(txtFiltroAutor); hBox.getChildren() .add( TextBuilder.create() .text("|") .fill(Color.WHITE) .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28)) .build()); hBox.getChildren().add(txtFiltroEditorial); hBox.getChildren() .add( TextBuilder.create() .text("|") .fill(Color.WHITE) .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28)) .build()); hBox.getChildren().add(txtRanking); hBox.getChildren() .add( TextBuilder.create() .text("|") .fill(Color.WHITE) .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28)) .build()); // Agregando el Efecto Bloom Bloom bloom = BloomBuilder.create().threshold(0f).build(); hBox.setEffect(bloom); if (index) { StackPane agrupador = new StackPane(); agrupador.getChildren().add(hBox); agrupador.getChildren().add(imgIndex); StackPane.setAlignment(imgIndex, Pos.BOTTOM_RIGHT); StackPane.setMargin(imgIndex, new Insets(0, -6, -17, 0)); return agrupador; } else { return hBox; } }
@Override protected Node createNode() { final Procedure1<RectangleBorderPane> _function = (RectangleBorderPane it) -> { ObservableList<Node> _children = it.getChildren(); Text _text = new Text(); final Procedure1<Text> _function_1 = (Text it_1) -> { it_1.setTextOrigin(VPos.TOP); String _name = this.getName(); it_1.setText(_name); Insets _insets = new Insets(10, 20, 10, 20); StackPane.setMargin(it_1, _insets); }; Text _doubleArrow = ObjectExtensions.<Text>operator_doubleArrow(_text, _function_1); _children.add((this.label = _doubleArrow)); }; return ObjectExtensions.<RectangleBorderPane>operator_doubleArrow(this.pane, _function); }
@SuppressWarnings("unchecked") public StackPane viewStock(String categoryId, String categoryName) { stack = new StackPane(); GridPane grid = new GridPane(); grid.setVgap(8); grid.setPadding(new Insets(30)); final ObservableList<ItemVO> dataTable; // final ObservableList<ItemVO> dataTable1; // final ObservableList<ItemVO> dataTable2; ObservableList<CategoryTypeVO> typeList; Rectangle roundRect = RectangleBuilder.create() .x(50) .y(50) .width(Screen.getPrimary().getVisualBounds().getWidth() - 428) .height(Screen.getPrimary().getVisualBounds().getHeight() - 150) .arcWidth(30) .arcHeight(30) .build(); roundRect.setFill(Color.DARKGRAY); roundRect.setOpacity(0.2); roundRect.setStroke(Color.TRANSPARENT); HBox hlabel = new HBox(); hlabel.setMaxWidth(Screen.getPrimary().getVisualBounds().getWidth() - 170); hlabel.setMaxHeight(30); hlabel.setStyle("-fx-background-color:black;"); hlabel.setOpacity(0.3); hlabel.setLayoutX(20); try { typeList = FXCollections.observableArrayList(); typeList = UtiliesDAO.getUtiliesDAO().fetchTypes(categoryId); dataTable = FXCollections.observableArrayList(); dataTable.addAll(stockDetailsService.viewStock(categoryId)); /*dataTable1 = FXCollections.observableArrayList(); dataTable2 = FXCollections.observableArrayList(); for(int i=0;i<dataTable.size();i++) { dataTable1.add(dataTable.get(i++)); if(i<=dataTable.size()-1) { dataTable2.add(dataTable.get(i)); } }*/ final Label label = new Label(categoryName + " Stock"); final Text text5 = new Text(25, 175, categoryName + " Stock"); text5.setFill(Color.DARKORANGE); // text5.setFont(Font.font ("Edwardian Script ITC", 50)); text5.setFont(Font.loadFont("file:resources/fonts/ITCEDSCR.TTF", 50)); final Light.Distant light = new Light.Distant(); light.setAzimuth(-135.0); final Lighting lighting = new Lighting(); lighting.setLight(light); lighting.setSurfaceScale(9.0); text5.setEffect(lighting); label.setAlignment(Pos.CENTER_LEFT); // grid.add(label,1,0); final TableView<ItemVO> table1 = new TableView<ItemVO>(); table1.setEditable(false); // table1.setMaxSize(roundRect.getWidth()*0.41, roundRect.getHeight()*0.519);//400,300 table1.setMinSize(roundRect.getWidth() * 0.41, roundRect.getHeight() * 0.519); // 400,300 table1.setMaxSize(roundRect.getWidth() - 50, roundRect.getHeight() - 200); table1.getSelectionModel().setCellSelectionEnabled(false); table1.setStyle("-fx-background-color: transparent;"); TableColumn<ItemVO, String> itemName = new TableColumn<ItemVO, String>("Item"); itemName.setResizable(false); itemName.setMaxWidth(roundRect.getWidth() * 0.5); itemName.setMinWidth(roundRect.getWidth() * 0.5); // 200 itemName.setCellValueFactory(new PropertyValueFactory<ItemVO, String>("itemName")); TableColumn<ItemVO, Integer> quantity = new TableColumn<ItemVO, Integer>("Quantity#"); quantity.setResizable(false); quantity.setMinWidth(roundRect.getWidth() * 0.107); // 200 /*quantity.setCellValueFactory( new PropertyValueFactory<ItemVO, Integer>("quantity"));*/ for (final CategoryTypeVO type : typeList) { TableColumn<ItemVO, Integer> col = new TableColumn<ItemVO, Integer>(type.getTypeName()); col.setMinWidth(roundRect.getWidth() * 0.107); // 100 col.setResizable(false); col.setCellValueFactory( new Callback<CellDataFeatures<ItemVO, Integer>, ObservableValue<Integer>>() { @Override public ObservableValue<Integer> call(CellDataFeatures<ItemVO, Integer> item) { ItemVO itemVO = item.getValue(); if (itemVO == null) { return null; // or perhaps // return new ReadOnlyObjectWrapper<Integer>(null); } else { ObservableMap<String, ItemTypeVO> itemTypesMap = FXCollections.observableHashMap(); itemTypesMap = item.getValue().getListType(); return new ReadOnlyObjectWrapper<Integer>( itemTypesMap.get(type.getTypeId()).getQuantity()); } } }); col.setCellFactory( new Callback<TableColumn<ItemVO, Integer>, TableCell<ItemVO, Integer>>() { @Override public TableCell<ItemVO, Integer> call(TableColumn<ItemVO, Integer> paramP) { // TODO Auto-generated method stub return new TableCell<ItemVO, Integer>() { @Override public void updateItem(Integer item, boolean empty) { super.updateItem(item, empty); if (!isEmpty()) { setText(item.toString()); if (item <= 5) { this.getStyleClass().add("celllow"); setTextFill(Color.RED); } } } }; } }); quantity.getColumns().add(col); } if (quantity.getColumns().size() >= 5 && quantity.getColumns().size() <= 7) { itemName.setMinWidth(itemName.getWidth() - (quantity.getColumns().size() - 4) * 100); } if (quantity.getColumns().size() > 7) { itemName.setMinWidth(itemName.getWidth() - ((7 - 4) * 100)); } table1.setItems(dataTable); final TableColumn[] columns1 = {itemName, quantity}; table1.getColumns().addAll(columns1); table1 .getColumns() .addListener( new ListChangeListener() { public boolean suspended; @Override public void onChanged(Change change) { change.next(); if (change.wasReplaced() && !suspended) { this.suspended = true; table1.getColumns().setAll(columns1); this.suspended = false; } } }); /*//final TableView<ItemVO> table2 = new TableView<ItemVO>(); table2.setEditable(false); table2.setMaxSize(roundRect.getWidth()*0.41, roundRect.getHeight()*0.519); table2.setMinSize(roundRect.getWidth()*0.35, roundRect.getHeight()*0.519);//400,300 table2.setStyle("-fx-background-color: transparent;"); TableColumn<ItemVO,String> itemName2 = new TableColumn<ItemVO,String> ("Item"); itemName2.setMinWidth(roundRect.getWidth()*0.3);//200 itemName2.setCellValueFactory( new PropertyValueFactory<ItemVO, String>("itemName")); TableColumn<ItemVO, Integer> quantity2 = new TableColumn<ItemVO, Integer> ("Quantity#"); quantity2.setMinWidth(roundRect.getWidth()*0.107);//200 quantity.setCellValueFactory( new PropertyValueFactory<ItemVO, Integer>("quantity")); for (final CategoryTypeVO type : typeList) { TableColumn<ItemVO, Integer> col2 = new TableColumn<ItemVO, Integer>(type.getTypeName()); col2.setMinWidth(roundRect.getWidth()*0.107);//100 col2.setResizable(false); col2.setCellValueFactory(new Callback<CellDataFeatures<ItemVO,Integer>, ObservableValue<Integer>>() { @Override public ObservableValue<Integer> call(CellDataFeatures<ItemVO,Integer> item) { ItemVO itemVO = item.getValue(); if (itemVO == null) { return null ; // or perhaps // return new ReadOnlyObjectWrapper<Integer>(null); } else { ObservableMap<String,ItemTypeVO> itemTypesMap = FXCollections.observableHashMap(); itemTypesMap = item.getValue().getListType(); return new ReadOnlyObjectWrapper<Integer>(itemTypesMap.get(type.getTypeId()).getQuantity()); } } }); col2.setCellFactory(new Callback<TableColumn<ItemVO,Integer>, TableCell<ItemVO,Integer>>() { @Override public TableCell<ItemVO, Integer> call(TableColumn<ItemVO, Integer> paramP) { // TODO Auto-generated method stub return new TableCell<ItemVO, Integer>(){ @Override public void updateItem(Integer item, boolean empty) { super.updateItem(item, empty); if(item!=null) { setText(item.toString()); if(item<=5) { this.getStyleClass().add("celllow"); setTextFill(Color.RED); } } } }; } }); quantity2.getColumns().add(col2); } table2.setItems(dataTable2); final TableColumn[] columns2 = {itemName2, quantity2}; table2.getColumns().addAll(columns2); table2.getColumns().addListener(new ListChangeListener() { public boolean suspended; @Override public void onChanged(Change change) { change.next(); if (change.wasReplaced() && !suspended) { this.suspended = true; table2.getColumns().setAll(columns2); this.suspended = false; } } });*/ Rectangle qtyRect = RectangleBuilder.create().x(50).y(50).width(10).height(10).build(); qtyRect.setFill(Color.rgb(240, 128, 128)); grid.add(table1, 0, 12); // grid.add(table2,1,12); grid.setAlignment(Pos.TOP_CENTER); Text man_text = new Text(CommonConstants.STAR_MSG); man_text.setFill(Color.DARKKHAKI); man_text.setFont(Font.font("Arial", 12)); Text msg_qty = new Text(CommonConstants.QTY_MSG1); msg_qty.setFill(Color.DARKKHAKI); msg_qty.setFont(Font.font("Arial", 12)); Text msg_qtyLow = new Text(CommonConstants.QTY_LOW); msg_qtyLow.setFill(Color.DARKKHAKI); msg_qtyLow.setFont(Font.font("Arial", 12)); StackPane.setMargin(grid, new Insets(10, 0, 0, 0)); StackPane.setMargin(qtyRect, new Insets(197, 850, 100, 0)); StackPane.setAlignment(qtyRect, Pos.BASELINE_CENTER); StackPane.setMargin(msg_qtyLow, new Insets(197, 765, 100, 0)); StackPane.setAlignment(msg_qtyLow, Pos.BASELINE_CENTER); StackPane.setAlignment(roundRect, Pos.TOP_CENTER); StackPane.setMargin(text5, new Insets(50, 8, 8, 8)); StackPane.setAlignment(text5, Pos.TOP_CENTER); StackPane.setMargin(man_text, new Insets(197, 100, 20, 0)); StackPane.setAlignment(man_text, Pos.BASELINE_RIGHT); StackPane.setMargin(msg_qty, new Insets(210, 95, 20, 0)); StackPane.setAlignment(msg_qty, Pos.BASELINE_RIGHT); stack.getChildren().addAll(text5, roundRect, grid, man_text, msg_qty, qtyRect, msg_qtyLow); } catch (Exception e) { e.printStackTrace(); } return stack; }
public Cutaway(SubScene scene, double width, double height) { // Make sure "world" is a group assert scene.getRoot().getClass().equals(Group.class); setFillWidth(true); setPrefSize(width, height + controlSize); setMaxSize(width, height + controlSize); this.setBorder( new Border( new BorderStroke( Color.DARKKHAKI, BorderStrokeStyle.SOLID, new CornerRadii(25), new BorderWidths(5)))); Rectangle closeSquare = new Rectangle(controlSize, controlSize, Color.LIGHTCORAL); closeSquare.setOnMouseClicked( (MouseEvent me) -> { this.fireEvent(new CloseCutawayEvent(this)); }); Circle dragCircle = new Circle(controlSize / 2, Color.STEELBLUE); HBox top = new HBox(20, closeSquare, dragCircle); dragCircle.setVisible(false); StackPane.setAlignment(closeSquare, Pos.TOP_RIGHT); StackPane.setMargin(closeSquare, new Insets(50)); top.setBackground( new Background( new BackgroundFill(Color.KHAKI, new CornerRadii(20, 20, 0, 0, false), Insets.EMPTY))); top.setAlignment(Pos.TOP_RIGHT); top.setOnMousePressed( (MouseEvent me) -> { cutawayPosX = me.getSceneX(); cutawayPosY = me.getSceneY(); cutawayOldX = me.getSceneX(); cutawayOldY = me.getSceneY(); }); top.setOnMouseDragged( (MouseEvent me) -> { cutawayOldX = cutawayPosX; cutawayOldY = cutawayPosY; cutawayPosX = me.getSceneX(); cutawayPosY = me.getSceneY(); cutawayDeltaX = (cutawayPosX - cutawayOldX); cutawayDeltaY = (cutawayPosY - cutawayOldY); setTranslateX(getTranslateX() + cutawayDeltaX); setTranslateY(getTranslateY() + cutawayDeltaY); }); getChildren().addAll(top, imageView); worldToView = (Group) scene.getRoot(); camera.setNearClip(0.1); camera.setFarClip(15000.0); camera.setTranslateZ(-1500); params.setCamera(camera); params.setDepthBuffer(true); params.setFill(Color.rgb(0, 0, 0, 0.5)); viewTimer = new AnimationTimer() { @Override public void handle(long now) { redraw(); } }; setOnMouseEntered( e -> { requestFocus(); }); }