// https://docs.oracle.com/javafx/2/ui_controls/table-view.htm
 @SuppressWarnings("unchecked")
 public DataPanel(final String string) {
   super(string);
   tableView = new ScrollPane();
   tableView.setPrefSize(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE);
   tableView.setMaxSize(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE);
   // set(MsstGuiPckg.getInstance().getGuiPreferredSize().propertyDataPanelWithHeight(),
   // MsstGuiPckg.getInstance().getGuiPreferredSize().propertyDataPanelWithWidth());
   elementName = new TableColumn<>("element-name");
   elementValue = new TableColumn<>("element-value");
   elementName.setCellValueFactory(new PropertyValueFactory<TableEntry, String>("elementName"));
   elementValue.setCellValueFactory(new PropertyValueFactory<TableEntry, String>("elementValue"));
   dataTable = new TableView<TableEntry>();
   dataTable.getColumns().addAll(elementName, elementValue);
   dataTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
   dataTable.setPrefHeight(
       MsstGuiPckg.getInstance().getGuiPreferredSize().propertyDataPanelWithHeight());
   dataTable.setPrefWidth(
       MsstGuiPckg.getInstance().getGuiPreferredSize().propertyDataPanelWithWidth());
   dataTable.setEditable(true);
   tableView.setContent(dataTable);
   ;
   tableView.setFitToHeight(true);
   tableView.setFitToWidth(true);
   setContent(tableView);
 }
Exemplo n.º 2
0
  @Override
  public void initialize(URL url, ResourceBundle rb) {
    table = new TableView<>();
    data = new ProjectData();

    TableColumn idProjectCol = new TableColumn("ID");
    idProjectCol.setCellValueFactory(
        new PropertyValueFactory<ProjectDataItem, String>("IDProject"));
    idProjectCol.setCellFactory(new EditableCell());

    TableColumn nameCol = new TableColumn("Name");
    nameCol.setCellValueFactory(new PropertyValueFactory<ProjectDataItem, String>("Name"));
    nameCol.setCellFactory(new EditableCell());

    TableColumn descriptionCol = new TableColumn("Description");
    descriptionCol.setCellValueFactory(
        new PropertyValueFactory<ProjectDataItem, String>("Description"));
    descriptionCol.setCellFactory(new EditableCell());

    table.setItems(data.getData());
    table.getColumns().addAll(idProjectCol, nameCol, descriptionCol);
    table.setEditable(true);
    table.setTableMenuButtonVisible(true);
    table.setContextMenu(new ProjectFormController.ProjectContextMenu());
    table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    paneTable.getChildren().add(table);
    AnchorPane.setTopAnchor(table, 0.0);
    AnchorPane.setLeftAnchor(table, 0.0);
    AnchorPane.setRightAnchor(table, 0.0);
    AnchorPane.setBottomAnchor(table, 50.0);
  }
  /**
   * Initializes the controller class. This method is automatically called after fxml file has been
   * loaded.
   */
  @FXML
  private void initialize() {

    // setting up the radioButtons
    final ToggleGroup timeIntervalGroup = new ToggleGroup();
    monthlyRadioButton.setToggleGroup(timeIntervalGroup);
    dailyRadioButton.setToggleGroup(timeIntervalGroup);
    hourlyRadioButton.setToggleGroup(timeIntervalGroup);
    fifteenMinRadioButton.setToggleGroup(timeIntervalGroup);
    fifteenMinRadioButton.setSelected(true);

    final ToggleGroup typOfChartGroup = new ToggleGroup();
    regularTimeSeriesRadioButton.setToggleGroup(typOfChartGroup);
    scatterRadioButton.setToggleGroup(typOfChartGroup);
    dailyTypeOfDayRadioButton.setToggleGroup(typOfChartGroup);
    regularTimeSeriesRadioButton.setSelected(true);

    final ToggleGroup typeOfDayGroup = new ToggleGroup();
    schoolDayRadioButton.setToggleGroup(typeOfDayGroup);
    summerDayRadioButton.setToggleGroup(typeOfDayGroup);
    holidayRadioButton.setToggleGroup(typeOfDayGroup);
    weekendRadioButton.setToggleGroup(typeOfDayGroup);
    everyDayRadioButton.setToggleGroup(typeOfDayGroup);
    everyDayRadioButton.setSelected(true);

    updateEnabledButtons();

    // initialize a unique instance of the database
    database = Database.getInstance();
    // initialize the meter table with all the columns.
    meterNumberColumn.setCellValueFactory(cellData -> cellData.getValue().getMeterNumber());
    meterTable.setEditable(true);
    meterNumberColumn.setCellFactory(TextFieldTableCell.forTableColumn());
    meterNumberColumn.setOnEditCommit(
        new EventHandler<TableColumn.CellEditEvent<Meter, String>>() {
          @Override
          public void handle(CellEditEvent<Meter, String> event) {
            event
                .getTableView()
                .getItems()
                .get(event.getTablePosition().getRow())
                .setMeterNumber(Assistant.parsePropertiesString(event.getNewValue()));
          }
        });
    startDateColumn.setCellValueFactory(
        cellData -> Assistant.parsePropertiesString(cellData.getValue().getStartDate().toString()));
    endDateColumn.setCellValueFactory(
        cellData -> Assistant.parsePropertiesString(cellData.getValue().getEndDate().toString()));

    activatedColumn.setCellFactory(cellData -> new CheckBoxCell());

    colorColumn.setCellFactory(cellData -> new ColorButtonCell(java.awt.Color.GREEN));

    initializeDateTable();
  }
Exemplo n.º 4
0
  private Pane buildUpperArea() {

    Pane up = new Pane();
    up.prefHeightProperty().bind(this.heightProperty());
    up.prefWidthProperty().bind(this.widthProperty());

    TableView<DebateDetails> table = new TableView<DebateDetails>();
    table.prefHeightProperty().bind(up.heightProperty());
    table.prefWidthProperty().bind(up.widthProperty());

    final Label label = new Label("Debate Tournament");
    label.setFont(new Font("Arial", 20));

    table.setEditable(false);

    table.getChildrenUnmodifiable().clear();
    table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    TableColumn<DebateDetails, String> divCol = new TableColumn<DebateDetails, String>("Division");
    divCol.setCellValueFactory(new PropertyValueFactory<>("division"));

    TableColumn<DebateDetails, String> teamCountCol =
        new TableColumn<DebateDetails, String>("Team Count");
    teamCountCol.setCellValueFactory(new PropertyValueFactory<>(String.valueOf("teamCount")));

    TableColumn<DebateDetails, String> debCountCol =
        new TableColumn<DebateDetails, String>("Debate Count");
    debCountCol.setCellValueFactory(new PropertyValueFactory<>(String.valueOf("totalMatch")));

    TableColumn<DebateDetails, String> debCompCol =
        new TableColumn<DebateDetails, String>("Debates Completed ");
    debCompCol.setCellValueFactory(new PropertyValueFactory<>(String.valueOf("matchCompleted")));

    TableColumn<DebateDetails, String> debRemCol =
        new TableColumn<DebateDetails, String>("Upcoming Debates");
    debRemCol.setCellValueFactory(new PropertyValueFactory<>(String.valueOf("matchRemaining")));

    final ObservableList<DebateDetails> data =
        FXCollections.observableArrayList(TeamManager.getDebateDetails());

    table.setItems(data);
    table.getColumns().add(divCol);
    table.getColumns().add(teamCountCol);
    table.getColumns().add(debCountCol);
    table.getColumns().add(debCompCol);
    table.getColumns().add(debRemCol);

    final VBox vbox = new VBox();
    vbox.setSpacing(5);
    vbox.setPadding(new Insets(10, 0, 0, 10));
    vbox.getChildren().addAll(label, table);
    up.getChildren().add(vbox);

    return up;
  }
Exemplo n.º 5
0
  /**
   * Sets up the entire TableView with all its functionalities.
   *
   * @return The created TableView.
   */
  private TableView<FilterInput> setUpTableView() {
    // Set up table view
    final TableView<FilterInput> tableView = new TableView<>();
    tableView.setEditable(true);
    tableView.setMinWidth(522);
    tableView.setMinHeight(280);

    // Set up columns
    setUpFilterColumn(tableView);
    setUpTypeColumn(tableView);
    setUpOriginColumn(tableView);
    setUpColorColumn(tableView);
    setUpPriorityColumn(tableView);
    setUpLegalityColumn(tableView);
    setUpActiveColumn(tableView);

    // Insert data from database into table
    tableView.setItems(data);

    // Set select/deselect on mouse click
    tableView.setRowFactory(
        tableViewLambda -> {
          final TableRow<FilterInput> row = new TableRow<>();
          row.addEventFilter(
              MouseEvent.MOUSE_PRESSED,
              event -> {
                final int index = row.getIndex();
                if (index >= 0
                    && index < tableView.getItems().size()
                    && tableView.getSelectionModel().isSelected(index)) {
                  tableView.getSelectionModel().clearSelection();
                  event.consume();
                }
              });
          return row;
        });

    return tableView;
  }
Exemplo n.º 6
0
  public static Group createPane() {
    Group group = new Group();
    VBox vbox = new VBox();
    Label label = new Label("List of contructors");
    label.setFont(new Font("Arial", 20));
    label.setPadding(new Insets(50, 0, 0, 100));
    // Create TableView
    TableView<ContructorViewer> table = new TableView<ContructorViewer>();
    table.setEditable(true);
    table.setMinWidth(800);
    table.setMaxHeight(500);
    TableColumn<ContructorViewer, Integer> firstNameCol =
        new TableColumn<ContructorViewer, Integer>("id");
    TableColumn<ContructorViewer, String> secondNameCol =
        new TableColumn<ContructorViewer, String>("name");
    firstNameCol.setCellValueFactory(new PropertyValueFactory<ContructorViewer, Integer>("id"));
    firstNameCol.setMinWidth(100);
    secondNameCol.setCellValueFactory(new PropertyValueFactory<ContructorViewer, String>("name"));
    secondNameCol.setMinWidth(400);

    // Добавление колонок в таблицу
    list = getList();
    table.setItems(list);
    table.getColumns().addAll(firstNameCol, secondNameCol);
    // Панель для дополнительных операций
    HBox hb = new HBox();
    hb.setPadding(new Insets(40, 0, 20, 300));
    hb.setSpacing(10);
    TextField nameContructor = new TextField();
    nameContructor.setPromptText("new name of contructor");
    Button add = new Button("Add");
    Button close = new Button("Close");
    Text textEdit = new Text("Edit operation is open");
    textEdit.setFont(new Font(15));

    // Создание кнопок
    HBox btns = new HBox();
    btns.setStyle("-fx-background-color:#E6EFF5");
    btns.setMinHeight(60);
    Button[] buttons = new Button[12];
    String[] commands =
        new String[] {
          "HELP", "SAVE", "", "EDIT", "", "", "ADD", "DELETE", "REFRESH", "EXIT", "IMPORT", "EXPORT"
        };
    for (int i = 0; i < buttons.length; i++) {
      buttons[i] = new Button("F" + Integer.toString(i + 1) + "\n" + commands[i]);
      buttons[i].setTooltip(new Tooltip(commands[i]));
      buttons[i].setStyle("-fx-background-color:#C2CCCF");
      buttons[i].setMaxSize(70, 60);
      buttons[i].setMinSize(70, 60);
    }
    btns.getChildren().addAll(buttons);
    btns.setSpacing(15);
    btns.setPadding(new Insets(10, 0, 0, 0));
    btns.setAlignment(Pos.CENTER);

    //		Добавления таблицы и кнопок на панель
    vbox.getChildren().setAll(table, btns);
    vbox.setMinWidth(800);
    vbox.setMaxHeight(500);
    //		vbox.setAlignment(Pos.CENTER);
    vbox.setPadding(new Insets(100, 20, 20, 20));

    // ==========EDIT============================
    buttons[3].setOnAction(
        new EventHandler<ActionEvent>() {
          int i = 0;

          @Override
          public void handle(ActionEvent event) {
            if (i == 0) vbox.getChildren().add(textEdit);
            // TODO Auto-generated method stub
            // Редактирование колонок
            // Открытие на редактирование колонка NAME
            secondNameCol.setCellFactory(TextFieldTableCell.forTableColumn());
            // Cобытие на изменение ячейки
            secondNameCol.setOnEditCommit(
                new EventHandler<CellEditEvent<ContructorViewer, String>>() {
                  @Override
                  public void handle(CellEditEvent<ContructorViewer, String> value) {
                    int activeRow = value.getTablePosition().getRow();
                    if (value.getNewValue().isEmpty()) {
                      MyAlert er =
                          new MyAlert(
                              "ERROR! Please try again." + "\n" + "Input name of contructor");
                      Stage primaryStage = new Stage();
                      try {
                        er.start(primaryStage);
                      } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                      }
                    } else {
                      value.getTableView().getItems().get(activeRow).setName(value.getNewValue());
                    }
                  }
                });
            i++;
          }
        });
    // ==========ADD POSITION============================
    buttons[6].setOnAction(
        new EventHandler<ActionEvent>() {
          int i = 0;

          @Override
          public void handle(ActionEvent event) {
            // TODO Auto-generated method stub
            if (i == 0) hb.getChildren().addAll(nameContructor, add, close);

            add.setOnAction(
                new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent event) {
                    // TODO Auto-generated method stub
                    if (nameContructor.getText().isEmpty()) {
                      MyAlert er =
                          new MyAlert("ERROR! Please try again." + "\n" + "Input name of product");
                      Stage primaryStage = new Stage();
                      try {
                        er.start(primaryStage);
                      } catch (Exception e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                      }
                    } else {
                      list.add(new ContructorViewer(list.size() + 1, nameContructor.getText()));
                      nameContructor.clear();
                    }
                  }
                });
            i++;
            close.setOnAction(
                new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent event) {
                    // TODO Auto-generated method stub
                    hb.getChildren().removeAll(nameContructor, add, close);
                    i = 0;
                  }
                });
          }
        });
    // ==========DELETE POSITION============================
    buttons[7].setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            int selectedInd = table.getSelectionModel().getSelectedIndex();
            if (selectedInd >= 0) {
              table.getItems().remove(selectedInd);
            } else {
              // Nothing selected
              Stage st = new Stage();
              MyAlert er = new MyAlert("Please select row for delete");
              try {
                er.start(st);
              } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
            }
          }
        });
    // ==========REFRESH============================
    buttons[8].setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            // TODO Auto-generated method stub
            list = getList();
            table.setItems(list);
          }
        });
    // ==========SAVE=============================================
    list = table.getItems();
    buttons[1].setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            // TODO Auto-generated method stub
            setList(list);
            Stage st = new Stage();
            MyAlert er = new MyAlert("Executed store successfully");
            try {
              er.start(st);
            } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        });
    // ==========EXIT=====================================================
    buttons[9].setOnAction(eventExit -> TabPanelJFX.primaryStage.close());

    //		Добавление панели в группу
    group.getChildren().addAll(label, vbox, hb);

    return group;
  }
Exemplo n.º 7
0
  @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;
  }
Exemplo n.º 8
0
  /**
   * createTable is static to allow Army to define a table without having any Actor objects present.
   */
  public static TableView<Actor> createTable() {
    TableView<Actor> table = new TableView<Actor>();
    final double PREF_WIDTH_DOUBLE = 80.0;
    table.setPrefWidth(
        PREF_WIDTH_DOUBLE
            * 7.5); // 7.0 because there are 6 individual columns, but one of those is DOUBLE-WIDTH,
                    // and there is some inter-column spacing
    table.setEditable(true);

    TableColumn<Actor, String> nameCol = new TableColumn<>("Name");
    nameCol.setCellValueFactory(new PropertyValueFactory<Actor, String>("name"));
    nameCol.setPrefWidth(PREF_WIDTH_DOUBLE * 2.0);
    TableColumn<Actor, Number> healthCol = new TableColumn<>("Health");
    healthCol.setCellValueFactory(cell -> cell.getValue().health);
    healthCol.setPrefWidth(PREF_WIDTH_DOUBLE);
    TableColumn<Actor, Number> strengthCol = new TableColumn<>("Strength");
    strengthCol.setCellValueFactory(cell -> cell.getValue().strength);
    strengthCol.setPrefWidth(PREF_WIDTH_DOUBLE);
    TableColumn<Actor, Number> speedCol = new TableColumn<>("Speed");
    speedCol.setCellValueFactory(cell -> cell.getValue().speed);
    speedCol.setPrefWidth(PREF_WIDTH_DOUBLE);
    TableColumn<Actor, Number> locationXCol = new TableColumn<>("X");
    locationXCol.setCellValueFactory(cell -> cell.getValue().getAvatar().translateXProperty());
    locationXCol.setPrefWidth(PREF_WIDTH_DOUBLE);
    TableColumn<Actor, Number> locationYCol = new TableColumn<>("Y");
    locationYCol.setCellValueFactory(cell -> cell.getValue().getAvatar().translateYProperty());
    locationYCol.setPrefWidth(PREF_WIDTH_DOUBLE);
    ObservableList<TableColumn<Actor, ?>> c = table.getColumns();
    c.add(nameCol);
    c.add(healthCol);
    c.add(strengthCol);
    c.add(speedCol);
    c.add(locationXCol);
    c.add(locationYCol);
    // Compare line ABOVE with line BELOW: The BELOW line looks cleaner and does actually work . . .
    // but the compiler spits out a warning. The ABOVE line accomplishes the same thing, less
    // elegantly, but without warnings.
    // table.getColumns().addAll(nameCol, healthCol, strengthCol, speedCol, locationXCol,
    // locationYCol);

    // The following code makes each cell in the selected columns editable (Name, Health, Strength,
    // Speed)
    // We CANNOT implement edit capabilities on the X/Y columns since they are READ-ONLY.
    nameCol.setCellFactory(TextFieldTableCell.<Actor>forTableColumn());
    nameCol.setOnEditCommit(
        event -> {
          Actor a = (event.getTableView().getItems().get(event.getTablePosition().getRow()));
          a.setName(event.getNewValue());
          a.resetAvatarAttributes();
        });

    healthCol.setCellFactory(
        TextFieldTableCell.<Actor, Number>forTableColumn(new NumberStringConverter()));
    healthCol.setOnEditCommit(
        event -> {
          Actor a = (event.getTableView().getItems().get(event.getTablePosition().getRow()));
          a.setHealth((Double) event.getNewValue());
          a.resetAvatarAttributes();
        });

    strengthCol.setCellFactory(
        TextFieldTableCell.<Actor, Number>forTableColumn(new NumberStringConverter()));
    strengthCol.setOnEditCommit(
        event -> {
          Actor a = (event.getTableView().getItems().get(event.getTablePosition().getRow()));
          a.setStrength((Double) event.getNewValue());
          a.resetAvatarAttributes();
        });

    speedCol.setCellFactory(
        TextFieldTableCell.<Actor, Number>forTableColumn(new NumberStringConverter()));
    speedCol.setOnEditCommit(
        event -> {
          Actor a = (event.getTableView().getItems().get(event.getTablePosition().getRow()));
          a.setSpeed((Double) event.getNewValue());
          a.resetAvatarAttributes();
        });

    return table;
  } // end createTable()
Exemplo n.º 9
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    /* create the menu (for the top of the user interface) */
    Menu fileMenu = new Menu("File");
    MenuItem newMenuItem = new MenuItem("New", imageFile("images/new.png"));
    newMenuItem.setAccelerator(KeyCombination.keyCombination("Ctrl+N"));
    fileMenu.getItems().add(newMenuItem);
    fileMenu.getItems().add(new SeparatorMenuItem());
    fileMenu.getItems().add(new MenuItem("Open...", imageFile("images/open.png")));
    fileMenu.getItems().add(new SeparatorMenuItem());
    MenuItem saveMenuItem = new MenuItem("Save", imageFile("images/save.png"));
    fileMenu.getItems().add(saveMenuItem);
    MenuItem saveAsMenuItem = new MenuItem("Save As...", imageFile("images/save_as.png"));
    fileMenu.getItems().add(saveAsMenuItem);
    fileMenu.getItems().add(new SeparatorMenuItem());
    MenuItem exitMenuItem = new MenuItem("Exit", imageFile("images/exit.png"));
    fileMenu.getItems().add(exitMenuItem);
    exitMenuItem.setAccelerator(KeyCombination.keyCombination("Ctrl+Q"));
    exitMenuItem.setOnAction(e -> System.exit(0));

    Menu editMenu = new Menu("Edit");
    editMenu.getItems().add(new MenuItem("Cut", imageFile("images/cut.png")));
    editMenu.getItems().add(new MenuItem("Copy", imageFile("images/copy.png")));
    editMenu.getItems().add(new MenuItem("Paste", imageFile("images/paste.png")));

    Menu helpMenu = new Menu("Help");
    helpMenu.getItems().add(new MenuItem("About...", imageFile("images/about.png")));
    helpMenu.getItems().add(new SeparatorMenuItem());
    helpMenu.getItems().add(new MenuItem("Help...", imageFile("images/help.png")));

    MenuBar menuBar = new MenuBar();
    menuBar.getMenus().add(fileMenu);
    menuBar.getMenus().add(editMenu);
    menuBar.getMenus().add(helpMenu);
    primaryStage.setTitle("Lab08");
    // grid contains all of the textfeilds, labels , buttons, ect..
    GridPane grid = new GridPane();
    // the tableview puts all of our data into a exel like format
    TableView<StudentRecord> table = new TableView<>();
    table.setItems(DataSource.getAllMarks());
    table.setEditable(true);

    TableColumn<StudentRecord, String> IDColumn = null;
    IDColumn = new TableColumn<>("SID");
    IDColumn.setMinWidth(100);
    // the thing in quotes is what it will search for in the StudentRecords.java (MAKE SURE THERE IS
    // A GET FUNCTION FOR THAT VARIBALE)
    IDColumn.setCellValueFactory(new PropertyValueFactory<>("ID"));

    TableColumn<StudentRecord, Double> AssignmentColumn = null;
    AssignmentColumn = new TableColumn<>("Assignment");
    AssignmentColumn.setMinWidth(100);
    AssignmentColumn.setCellValueFactory(new PropertyValueFactory<>("Assign"));

    TableColumn<StudentRecord, Float> MidtermColumn = null;
    MidtermColumn = new TableColumn<>("Midterm");
    MidtermColumn.setMinWidth(100);
    MidtermColumn.setCellValueFactory(new PropertyValueFactory<>("Midterm"));

    TableColumn<StudentRecord, Float> FinalColumn = null;
    FinalColumn = new TableColumn<>("Final Exam");
    FinalColumn.setMinWidth(100);
    FinalColumn.setCellValueFactory(new PropertyValueFactory<>("Final"));

    TableColumn<StudentRecord, String> GradeColumn = null;
    GradeColumn = new TableColumn<>("Letter Grade");
    GradeColumn.setMinWidth(100);
    GradeColumn.setCellValueFactory(new PropertyValueFactory<>("Grade"));

    table.getColumns().add(IDColumn);
    table.getColumns().add(AssignmentColumn);
    table.getColumns().add(MidtermColumn);
    table.getColumns().add(FinalColumn);
    table.getColumns().add(GradeColumn);

    Label IDLabel = new Label("SID:");
    grid.add(IDLabel, 0, 0);
    TextField IDField = new TextField();
    IDField.setPromptText("SID");
    grid.add(IDField, 1, 0);

    Label AssignLabel = new Label("Assignments:");
    grid.add(AssignLabel, 2, 0);

    TextField AssignField = new TextField();
    AssignField.setPromptText("Assignment");
    grid.add(AssignField, 3, 0);

    Label MidLabel = new Label("Midterm:");
    grid.add(MidLabel, 0, 1);

    TextField midField = new TextField();
    midField.setPromptText("Midterm");
    grid.add(midField, 1, 1);

    Label FinalLabel = new Label("Final:");
    grid.add(FinalLabel, 2, 1);

    TextField FinalField = new TextField();
    FinalField.setPromptText("Final");
    grid.add(FinalField, 3, 1);

    Button AddButton = new Button("Add");
    AddButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            char Grade;
            String SID = IDField.getText();
            Float Assignment = Float.parseFloat(AssignField.getText());
            Float Midterm = Float.parseFloat(midField.getText());
            Float Final = Float.parseFloat(FinalField.getText());
            table.getItems().add(new StudentRecord(SID, Assignment, Midterm, Final));

            IDField.setText("");
            AssignField.setText("");
            midField.setText("");
            FinalField.setText("");
          }
        });
    grid.add(AddButton, 0, 2);

    layout = new BorderPane();
    layout.setTop(menuBar);
    layout.setCenter(table);
    layout.setBottom(grid);

    Scene scene = new Scene(layout);
    grid.setPadding(new Insets(10, 10, 10, 10));
    grid.setVgap(10);
    grid.setHgap(10);

    primaryStage.setScene(scene);
    primaryStage.show();
  }
Exemplo n.º 10
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    primaryStage.setTitle("JavaFX Demo");

    /* create the menu (for the top of the user interface) */
    Menu fileMenu = new Menu("File");
    MenuItem newMenuItem = new MenuItem("New", imageFile("images/new.png"));
    newMenuItem.setAccelerator(KeyCombination.keyCombination("Ctrl+N"));
    fileMenu.getItems().add(newMenuItem);
    fileMenu.getItems().add(new SeparatorMenuItem());
    fileMenu.getItems().add(new MenuItem("Open...", imageFile("images/open.png")));
    fileMenu.getItems().add(new SeparatorMenuItem());
    fileMenu.getItems().add(new MenuItem("Save", imageFile("images/save.png")));
    fileMenu.getItems().add(new MenuItem("Save As...", imageFile("images/save_as.png")));
    fileMenu.getItems().add(new SeparatorMenuItem());
    MenuItem exitMenuItem = new MenuItem("Exit", imageFile("images/exit.png"));
    fileMenu.getItems().add(exitMenuItem);
    exitMenuItem.setAccelerator(KeyCombination.keyCombination("Ctrl+Q"));
    exitMenuItem.setOnAction(e -> System.exit(0));

    Menu editMenu = new Menu("Edit");
    editMenu.getItems().add(new MenuItem("Cut", imageFile("images/cut.png")));
    editMenu.getItems().add(new MenuItem("Copy", imageFile("images/copy.png")));
    editMenu.getItems().add(new MenuItem("Paste", imageFile("images/paste.png")));

    Menu helpMenu = new Menu("Help");
    helpMenu.getItems().add(new MenuItem("About...", imageFile("images/about.png")));
    helpMenu.getItems().add(new SeparatorMenuItem());
    helpMenu.getItems().add(new MenuItem("Help...", imageFile("images/help.png")));

    MenuBar menuBar = new MenuBar();
    menuBar.getMenus().add(fileMenu);
    menuBar.getMenus().add(editMenu);
    menuBar.getMenus().add(helpMenu);

    /* create the table (for the center of the user interface) */
    table = new TableView<>();
    table.setItems(DataSource.getAllStudents());
    table.setEditable(true);

    /* create the table's columns */
    TableColumn<Student, Integer> sidColumn = null;
    sidColumn = new TableColumn<>("SID");
    sidColumn.setMinWidth(100);
    sidColumn.setCellValueFactory(new PropertyValueFactory<>("sid"));

    TableColumn<Student, String> firstNameColumn = null;
    firstNameColumn = new TableColumn<>("First Name");
    firstNameColumn.setMinWidth(200);
    firstNameColumn.setCellValueFactory(new PropertyValueFactory<>("firstName"));
    firstNameColumn.setCellFactory(TextFieldTableCell.<Student>forTableColumn());
    firstNameColumn.setOnEditCommit(
        (CellEditEvent<Student, String> event) -> {
          ((Student) event.getTableView().getItems().get(event.getTablePosition().getRow()))
              .setFirstName(event.getNewValue());
        });

    TableColumn<Student, String> lastNameColumn = null;
    lastNameColumn = new TableColumn<>("Last Name");
    lastNameColumn.setMinWidth(200);
    lastNameColumn.setCellValueFactory(new PropertyValueFactory<>("lastName"));
    lastNameColumn.setCellFactory(TextFieldTableCell.<Student>forTableColumn());
    lastNameColumn.setOnEditCommit(
        (CellEditEvent<Student, String> event) -> {
          ((Student) event.getTableView().getItems().get(event.getTablePosition().getRow()))
              .setLastName(event.getNewValue());
        });

    TableColumn<Student, Double> gpaColumn = null;
    gpaColumn = new TableColumn<>("GPA");
    gpaColumn.setMinWidth(100);
    gpaColumn.setCellValueFactory(new PropertyValueFactory<>("gpa"));

    table.getColumns().add(sidColumn);
    table.getColumns().add(lastNameColumn);
    table.getColumns().add(firstNameColumn);
    table.getColumns().add(gpaColumn);

    /* create an edit form (for the bottom of the user interface) */
    GridPane editArea = new GridPane();
    editArea.setPadding(new Insets(10, 10, 10, 10));
    editArea.setVgap(10);
    editArea.setHgap(10);

    Label sidLabel = new Label("SID:");
    editArea.add(sidLabel, 0, 0);
    TextField sidField = new TextField();
    sidField.setPromptText("SID");
    editArea.add(sidField, 1, 0);

    Label fnameLabel = new Label("First name:");
    editArea.add(fnameLabel, 0, 1);
    TextField fnameField = new TextField();
    fnameField.setPromptText("First Name");
    editArea.add(fnameField, 1, 1);

    Label lnameLabel = new Label("Last name:");
    editArea.add(lnameLabel, 0, 2);
    TextField lnameField = new TextField();
    lnameField.setPromptText("Last Name");
    editArea.add(lnameField, 1, 2);

    Label gpaLabel = new Label("GPA:");
    editArea.add(gpaLabel, 0, 3);
    TextField gpaField = new TextField();
    gpaField.setPromptText("GPA");
    editArea.add(gpaField, 1, 3);

    Button addButton = new Button("Add");
    addButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            int sid = Integer.parseInt(sidField.getText());
            String firstName = fnameField.getText();
            String lastName = lnameField.getText();
            double gpa = Double.parseDouble(gpaField.getText());

            table.getItems().add(new Student(sid, firstName, lastName, gpa));

            sidField.setText("");
            fnameField.setText("");
            lnameField.setText("");
            gpaField.setText("");
          }
        });
    editArea.add(addButton, 1, 4);

    /* arrange all components in the main user interface */
    layout = new BorderPane();
    layout.setTop(menuBar);
    layout.setCenter(table);
    layout.setBottom(editArea);

    Scene scene = new Scene(layout, 600, 600);
    primaryStage.setScene(scene);
    primaryStage.show();
  }
Exemplo n.º 11
0
  public void addList(GridPane grid) {
    tableView.setEditable(false);

    Callback<TableColumn, TableCell> integerCellFactory =
        new Callback<TableColumn, TableCell>() {
          @Override
          public TableCell call(TableColumn p) {
            MyIntegerTableCell cell = new MyIntegerTableCell();
            cell.addEventFilter(MouseEvent.MOUSE_CLICKED, new MyEventHandler());
            return cell;
          }
        };

    Callback<TableColumn, TableCell> stringCellFactory =
        new Callback<TableColumn, TableCell>() {
          @Override
          public TableCell call(TableColumn p) {
            MyStringTableCell cell = new MyStringTableCell();
            cell.addEventFilter(MouseEvent.MOUSE_CLICKED, new MyEventHandler());
            return cell;
          }
        };

    Callback<TableColumn, TableCell> activeCellFactory =
        new Callback<TableColumn, TableCell>() {
          @Override
          public TableCell call(TableColumn p) {
            MyStringTableCell cell = new MyStringTableCell();
            cell.addEventFilter(MouseEvent.MOUSE_CLICKED, new MyEventHandler());
            return cell;
          }
        };

    TableColumn colId = new TableColumn("ID");
    colId.setCellValueFactory(new PropertyValueFactory<Record, String>("id"));
    colId.setCellFactory(integerCellFactory);
    colId.setPrefWidth(30);

    TableColumn colName = new TableColumn("Name");
    colName.setCellValueFactory(new PropertyValueFactory<Record, String>("name"));
    colName.setCellFactory(stringCellFactory);
    colName.setPrefWidth(140);

    TableColumn colBoardWidth = new TableColumn("Width");
    colBoardWidth.setCellValueFactory(new PropertyValueFactory<Record, String>("BoardWidth"));
    colBoardWidth.setCellFactory(integerCellFactory);
    colBoardWidth.setPrefWidth(75);

    TableColumn colBoardHeight = new TableColumn("Height");
    colBoardHeight.setCellValueFactory(new PropertyValueFactory<Record, String>("BoardHeight"));
    colBoardHeight.setCellFactory(integerCellFactory);
    colBoardHeight.setPrefWidth(75);

    TableColumn colActive = new TableColumn("Acitve");
    colActive.setCellValueFactory(new PropertyValueFactory<Record, String>("Active"));
    colActive.setCellFactory(activeCellFactory);
    colActive.setPrefWidth(70);

    tableView.setItems(recordList);
    tableView.getColumns().addAll(colId, colName, colBoardWidth, colBoardHeight, colActive);
    tableView.setPrefSize(400, 400);
    grid.add(tableView, 0, 0);
  }
  /** This method initializes the DateColumn */
  private void initializeDateTable() {
    // initialize datetable
    dateTable.setEditable(true);
    dateTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    ;

    ContextMenu menu = new ContextMenu();
    MenuItem holidayChanger = new MenuItem("Holiday");
    MenuItem summerChanger = new MenuItem("Summer Day");
    MenuItem schoolDayChanger = new MenuItem("School Day");
    MenuItem weekendChanger = new MenuItem("Weekend");
    holidayChanger.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            dateTable.getSelectionModel().getSelectedItem().setDayType(DayType.HOLIDAY);
            updateDayType(dateTable.getSelectionModel().getSelectedItems(), DayType.HOLIDAY);
            // update Column
            dateTable.getColumns().get(1).setVisible(false);
            dateTable.getColumns().get(1).setVisible(true);
            dailyDayTypeChartPanel.addNewSeries(dailyIntervalData);
          }
        });

    summerChanger.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            dateTable.getSelectionModel().getSelectedItem().setDayType(DayType.SUMMER_DAY);
            updateDayType(dateTable.getSelectionModel().getSelectedItems(), DayType.SUMMER_DAY);
            // update Column
            dateTable.getColumns().get(1).setVisible(false);
            dateTable.getColumns().get(1).setVisible(true);
            dailyDayTypeChartPanel.addNewSeries(dailyIntervalData);
          }
        });

    schoolDayChanger.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            dateTable.getSelectionModel().getSelectedItem().setDayType(DayType.SCHOOL_DAY);
            updateDayType(dateTable.getSelectionModel().getSelectedItems(), DayType.SCHOOL_DAY);
            // update Column
            dateTable.getColumns().get(1).setVisible(false);
            dateTable.getColumns().get(1).setVisible(true);
            dailyDayTypeChartPanel.addNewSeries(dailyIntervalData);
          }
        });

    weekendChanger.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            dateTable.getSelectionModel().getSelectedItem().setDayType(DayType.WEEKEND);
            updateDayType(dateTable.getSelectionModel().getSelectedItems(), DayType.WEEKEND);
            // update Column
            dateTable.getColumns().get(1).setVisible(false);
            dateTable.getColumns().get(1).setVisible(true);
            dailyDayTypeChartPanel.addNewSeries(dailyIntervalData);
          }
        });

    menu.getItems().add(holidayChanger);
    menu.getItems().add(summerChanger);
    menu.getItems().add(schoolDayChanger);
    menu.getItems().add(weekendChanger);

    dateTable.setContextMenu(menu);

    dateColumn.setCellValueFactory(
        cellData -> Assistant.parsePropertiesString(cellData.getValue().getDate().toString()));

    dayTypeColumn.setCellValueFactory(
        cellData -> Assistant.parsePropertiesString(cellData.getValue().getDayType().toString()));
  }
Exemplo n.º 13
0
  public VBox getPane() {
    gp = new GridPane();
    gp.setVgap(VERTICAL_GAP);
    gp.setHgap(HORIZ_GAP);
    gp.setPadding(new Insets(0, 0, 3, 0));

    Random rand = new Random();
    questionnaireCode = Integer.toString(rand.nextInt());

    // hard coded questions for example
    Question ques1 =
        new Question(
            "111",
            "Employees need to be supervised closely or they are not likely to do their work",
            "Quality Type A");

    Question ques2 =
        new Question(
            "202",
            "Providing guidance without pressure it they key to being a good leader",
            "Quality Type B");

    Question ques3 =
        new Question(
            "097",
            "Most workers want frequent and supportive communication from their leaders",
            "Style Type A");

    Question ques4 =
        new Question("125", "People are basically competent and do a good job", "Style Type B");

    Question ques5 =
        new Question(
            "222",
            "Most workers want frequent and supportive communication from their leaders",
            "Quality Type A");

    Question ques6 =
        new Question("021", "Most employees feel insecure about their work", "Style Type A");

    Question ques7 =
        new Question(
            "435",
            "The leader is the chief judge of the achievements of the group",
            "Style Type A");

    Question ques8 =
        new Question(
            "544",
            "Leaders should allow subordinates to appraise their own work",
            "Quality Type B");

    Question ques9 =
        new Question(
            "787", "Employees must be part of the decision-making process", "Style Type B");

    data = FXCollections.observableArrayList();

    // Add a new question
    Label quesName = new Label("New Question:");

    String lastCode = Question.lastCode();
    int nextCode = Integer.parseInt(lastCode) + 1;
    final String newCode = Integer.toString(nextCode);

    TextField newQuestion = new TextField();
    newQuestion.setPromptText("Question Text");
    newQuestion.setMinWidth(350);

    // later to be a cell factory
    ComboBox<String> typeCombo = new ComboBox<String>();
    typeCombo.getItems().addAll("Quality A", "Quality B", "Style A", "Style B");
    typeCombo.setPromptText("Question Type:");

    // Button to add new questions
    Button addQuesButton = new Button("Add Question");
    gp.setHalignment(addQuesButton, HPos.RIGHT);
    addQuesButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            // if (addQuesButton.isSelected()) {
            //
            data.add(new Question(newCode, newQuestion.getText(), typeCombo.getValue()));

            // qName.clear();
            newQuestion.clear();
          }
        });

    Label quesChoose = new Label("Select a Question:");

    // choose question in db
    ComboBox<String> quesCombo = new ComboBox<String>();

    // to display existing questions in system:
    quesCombo.setPromptText("Existing Questions:");

    TreeMap<String, Question> questionMap = new TreeMap<String, Question>();

    for (Map.Entry<String, Question> entry : Question.getQuesMap().entrySet()) {
      String key = entry.getKey();
      Question value = entry.getValue();

      questionMap.put(entry.getValue().getQuestionText(), value);

      String question = value.getQuestionText();
      quesCombo.getItems().add(question);
    }

    // to create a new question
    Button chooseQues = new Button("Add Question");
    gp.setHalignment(chooseQues, HPos.RIGHT);
    chooseQues.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            //

            data.add(questionMap.get(quesCombo.getValue()));

            // reset combo box
            // quesCombo.setPromptText("Existing Questions:");

          }
        });

    Label or = new Label("OR");

    gp.add(quesName, 0, 0);
    gp.add(newQuestion, 1, 0);
    gp.add(typeCombo, 2, 0);
    gp.add(addQuesButton, 3, 0);
    gp.add(or, 0, 1);

    gp.add(quesChoose, 0, 2);
    gp.add(quesCombo, 1, 2);
    gp.add(chooseQues, 3, 2);

    // Create a table with columns to display Organization information
    TableView<Question> table = new TableView<Question>();
    table.setEditable(true);

    TableColumn<Question, String> actionDelete = new TableColumn<Question, String>("Remove");
    actionDelete.setCellValueFactory(new PropertyValueFactory<Question, String>("OrgCode"));

    // Create button to delete records
    Callback<TableColumn<Question, String>, TableCell<Question, String>> deleteColumnCellFactory =
        new Callback<TableColumn<Question, String>, TableCell<Question, String>>() {

          @Override
          public TableCell call(final TableColumn param) {
            final TableCell cell =
                new TableCell() {

                  @Override
                  public void updateItem(Object item, boolean empty) {
                    super.updateItem(item, empty);
                    if (empty) {
                      setText(null);
                      setGraphic(null);
                    } else {
                      final Button deleteButton = new Button("Remove");
                      deleteButton.setOnAction(
                          new EventHandler<ActionEvent>() {

                            @Override
                            public void handle(ActionEvent event) {
                              param.getTableView().getSelectionModel().select(getIndex());

                              Question item = table.getSelectionModel().getSelectedItem();

                              // if (orgCode != null) {
                              // Confirmation of record deletion
                              Alert alert = new Alert(AlertType.CONFIRMATION);
                              alert.setTitle("ALERT");
                              alert.setHeaderText(
                                  "Please confirm that you would like to delete this record");
                              // alert.setContentText("Are you ok with this?");

                              ButtonType buttonTypeOne = new ButtonType("Cancel");
                              ButtonType buttonTypeTwo = new ButtonType("OK");

                              alert
                                  .showAndWait()
                                  .ifPresent(
                                      response -> {
                                        if (response == ButtonType.OK) {
                                          // code to
                                          // delete
                                          // record
                                          data.remove(item);
                                          table.getSelectionModel().clearSelection();
                                        } else {
                                          return;
                                        }
                                      });
                              // }
                            }
                          });
                      setGraphic(deleteButton);
                      setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
                    }
                  }
                };
            return cell;
          }
        };
    // Add delete button to table cell
    actionDelete.setCellFactory(deleteColumnCellFactory);

    TableColumn<Question, String> quesCode = new TableColumn<Question, String>("Code");
    quesCode.setMinWidth(50);
    quesCode.setCellValueFactory(new PropertyValueFactory<Question, String>("questionCode"));

    TableColumn<Question, String> quesText = new TableColumn<Question, String>("Text");
    quesText.setMinWidth(600);
    quesText.setCellValueFactory(new PropertyValueFactory<Question, String>("questionText"));

    TableColumn<Question, String> quesType = new TableColumn<Question, String>("Type");
    quesType.setMinWidth(150);
    quesType.setCellValueFactory(new PropertyValueFactory<Question, String>("questionType"));

    // Set the items from the ArrayList into the table
    table.setItems(data);
    table.getColumns().addAll(actionDelete, quesCode, quesText, quesType);
    table.setVisible(true);

    Button showQuestionnaire = new Button("Save This Questionnaire and View");
    gp.setHalignment(showQuestionnaire, HPos.RIGHT);
    showQuestionnaire.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            //
            MainMenu.addMap(questionnaireCode, data);
            qv = new QuestionnaireView(data);
            MainMenu.changePane(qv.getPane());
          }
        });

    // Create a vertical box that will display the table and search area
    vbox = new VBox();
    vbox.setSpacing(5);
    vbox.setPadding(new Insets(10, 0, 0, 10));
    vbox.getChildren().addAll(label, gp, table, showQuestionnaire);

    return vbox;
  }
  /** @return Top-level {@link Node} */
  public Node create() {
    // Layout:
    //
    // | table |  [Add]
    // | table |  [Remove]
    // | table |
    // | table |

    // Create table with editable columns for type Double (supported as Number)
    final TableColumn<Point, Number> x_col = new TableColumn<>(Messages.PointsTable_X);
    x_col.setCellValueFactory(
        new Callback<TableColumn.CellDataFeatures<Point, Number>, ObservableValue<Number>>() {
          @Override
          public ObservableValue<Number> call(CellDataFeatures<Point, Number> param) {
            return new SimpleDoubleProperty(param.getValue().getX());
          }
        });
    x_col.setCellFactory(
        TextFieldTableCell.<Point, Number>forTableColumn(new NumberStringConverter()));
    x_col.setOnEditCommit(
        event -> {
          final int row = event.getTablePosition().getRow();
          points.setX(row, event.getNewValue().doubleValue());
        });

    final TableColumn<Point, Number> y_col = new TableColumn<>(Messages.PointsTable_Y);
    y_col.setCellValueFactory(
        new Callback<TableColumn.CellDataFeatures<Point, Number>, ObservableValue<Number>>() {
          @Override
          public ObservableValue<Number> call(CellDataFeatures<Point, Number> param) {
            return new SimpleDoubleProperty(param.getValue().getY());
          }
        });
    y_col.setCellFactory(
        TextFieldTableCell.<Point, Number>forTableColumn(new NumberStringConverter()));
    y_col.setOnEditCommit(
        event -> {
          final int row = event.getTablePosition().getRow();
          points.setY(row, event.getNewValue().doubleValue());
        });

    final ObservableList<Point> data = new PointsAdapter(points);
    final TableView<Point> table = new TableView<>(data);
    table.getColumns().add(x_col);
    table.getColumns().add(y_col);
    table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    table.setPlaceholder(new Label(Messages.PointsTable_Empty));
    table.setEditable(true);

    // Buttons
    final Button add = new Button(Messages.Add, JFXUtil.getIcon("add.png"));
    add.setMaxWidth(Double.MAX_VALUE);
    add.setOnAction(event -> data.add(new Point(0, 0)));

    final Button remove = new Button(Messages.Remove, JFXUtil.getIcon("delete.png"));
    remove.setMaxWidth(Double.MAX_VALUE);
    remove.setOnAction(
        event -> {
          final int sel = table.getSelectionModel().getSelectedIndex();
          if (sel >= 0) data.remove(sel);
        });

    final VBox buttons = new VBox(10, add, remove);
    final HBox content = new HBox(10, table, buttons);
    HBox.setHgrow(table, Priority.ALWAYS);
    return content;
  }
  private void display() {

    // create labels and textfields
    Label lbl_klantNaam = new Label("Klant naam:");
    lbl_klantNaam.setTextFill((Color.valueOf("#FFFC00")));
    Label lbl_klantID = new Label("Klant email:");
    lbl_klantID.setTextFill((Color.valueOf("#FFFC00")));
    Label lbl_klantAdres = new Label("Klant adres:");
    lbl_klantAdres.setTextFill((Color.valueOf("#FFFC00")));
    Label lbl_factuurNummer = new Label("Factuur nummer:");
    lbl_factuurNummer.setTextFill((Color.valueOf("#FFFC00")));
    Label lbl_factuurDatum = new Label("Factuur datum:");
    lbl_factuurDatum.setTextFill((Color.valueOf("#FFFC00")));
    Label lbl_debiteurenNummer = new Label("Debiteuren nummer:");
    lbl_debiteurenNummer.setTextFill((Color.valueOf("#FFFC00")));

    String klantHeleNaam = klantVoornaam + " " + klantAchternaam;
    Label lbl_DklantNaam = new Label(klantHeleNaam);
    lbl_DklantNaam.setTextFill((Color.valueOf("#FFFC00")));
    Label lbl_DklantID = new Label(order.getKlantEmail());
    lbl_DklantID.setTextFill((Color.valueOf("#FFFC00")));
    Label lbl_DklantAdres = new Label(order.getFactuurAdres());
    lbl_DklantAdres.setTextFill((Color.valueOf("#FFFC00")));
    Label lbl_DfactuurNummer = new Label(Integer.toString(order.getOrderID()));
    lbl_DfactuurNummer.setTextFill((Color.valueOf("#FFFC00")));
    Label lbl_DfactuurDatum = new Label(order.getOrderDatum().toString());
    lbl_DfactuurDatum.setTextFill((Color.valueOf("#FFFC00")));
    Label lbl_DdebiteurenNummer = new Label(Integer.toString(debiteurenNummer));
    lbl_DdebiteurenNummer.setTextFill((Color.valueOf("#FFFC00")));

    TextField tf_wijnnaam = new TextField();
    TextField tf_prijs = new TextField();

    table.setEditable(true);

    TableColumn<OrderRegel, Integer> codeCol = new TableColumn<>("Nr");
    codeCol.setCellValueFactory(new PropertyValueFactory<>("orderRegelID"));

    TableColumn<OrderRegel, Integer> aantalCol = new TableColumn("Aantal");
    aantalCol.setCellValueFactory(new PropertyValueFactory<>("aantal"));

    TableColumn<OrderRegel, Integer> wijnCol = new TableColumn("Wijn serie nr");
    wijnCol.setCellValueFactory(new PropertyValueFactory<>("wijnID"));

    TableColumn<OrderRegel, String> naamCol = new TableColumn("Naam");
    naamCol.setCellValueFactory(new PropertyValueFactory<>("wijnNaam"));

    TableColumn<OrderRegel, Integer> jaartalCol = new TableColumn("Jaartal");
    jaartalCol.setCellValueFactory(new PropertyValueFactory<>("wijnJaartal"));

    TableColumn<OrderRegel, Integer> perflesCol = new TableColumn("Per fles");
    perflesCol.setCellValueFactory(new PropertyValueFactory<>("wijnPrijs"));

    TableColumn<OrderRegel, Double> bedragCol = new TableColumn("Bedrag");
    bedragCol.setCellValueFactory(new PropertyValueFactory<>("totaalPrijs"));

    table = new TableView<>();
    ObservableList<OrderRegel> orders =
        FXCollections.observableArrayList(orderController.getAlleOrderRegels(order.getOrderID()));
    table.setItems(orders);
    table.getColumns().addAll(wijnCol, naamCol, jaartalCol, aantalCol, perflesCol, bedragCol);

    // topbox items
    title = new Label("Lions-club Oegstgeest/Warmond");
    title.setId("title");
    title.setTextFill(Color.web("#FFCF03"));
    title.autosize();

    icon = new ImageView(new Image("/images/icon.png"));
    icon.setPreserveRatio(true);
    icon.autosize();

    // buttons
    cancel = new Button("Terug");
    cancel.setOnAction(
        e -> new BestellingOverzichtView(new OrderController(), new KlantController()));

    Button exporteer = new Button("Exporteer naar PDF");
    exporteer.setOnAction(
        e -> {
          factuurGenerator =
              new FactuurGenerator(klantController.getKlantByOrder(order), order, orders);
          factuurGenerator.factuur();

          Alert alert = new Alert(AlertType.INFORMATION);
          alert.setHeaderText(null);
          alert.setTitle("Exporteer naar PDF");
          alert.setContentText("De factuur is succesvol ge�xporteerd. ");

          alert.showAndWait();
        });

    // add elements to panes
    topBox.getChildren().addAll(icon, title);
    topBox.setAlignment(Pos.CENTER);

    centerBox.getChildren().add(form);
    centerBox.getChildren().add(table);

    form.addColumn(
        0,
        lbl_klantNaam,
        lbl_klantID,
        lbl_klantAdres,
        lbl_factuurNummer,
        lbl_factuurDatum,
        lbl_debiteurenNummer);
    form.addColumn(
        1,
        lbl_DklantNaam,
        lbl_DklantID,
        lbl_DklantAdres,
        lbl_DfactuurNummer,
        lbl_DfactuurDatum,
        lbl_DdebiteurenNummer);
    form.addColumn(2, exporteer);

    bottomBox.getChildren().add(cancel);
    bottomBox.getChildren().add(exporteer);

    mainPane.setTop(topBox);
    mainPane.setCenter(centerBox);
    mainPane.setBottom(bottomBox);
    stage.setScene(scene);
  }
Exemplo n.º 16
0
  /** Starts the Gui applicaiton. */
  public void start(Stage myStage) {

    System.out.println("Inside the start() method.");

    table = new TableView<PersonBean>();
    table.setEditable(true);
    // Give the stage a title.
    myStage.setTitle("Person Spam App");
    filteredData = new FilteredList<>(personData, p -> true);
    sortedData = new SortedList<>(filteredData);
    sortedData.comparatorProperty().bind(table.comparatorProperty());

    table.setItems(sortedData);
    table.setPrefWidth(500);
    table.getStylesheets().add("resource/style.css");

    table.setColumnResizePolicy(TableView.UNCONSTRAINED_RESIZE_POLICY);

    // My edition:
    TableColumn<PersonBean, String> wholeNameCol = new TableColumn<PersonBean, String>("Full name");
    wholeNameCol.setCellValueFactory(new PropertyValueFactory("firstAndLastName"));
    wholeNameCol.setCellFactory(TextFieldTableCell.<PersonBean>forTableColumn());
    wholeNameCol.setOnEditCommit(
        (CellEditEvent<PersonBean, String> t) -> { // Start on line below
          ((PersonBean) t.getTableView().getItems().get(t.getTablePosition().getRow()))
              .setFirstAndLastName(t.getNewValue());
        });

    //		TableColumn<PersonBean, String> firstNameCol = new TableColumn<PersonBean, String>("First
    // Name");
    //		firstNameCol.setCellValueFactory(new PropertyValueFactory("firstName"));
    //		firstNameCol.setCellFactory(TextFieldTableCell.<PersonBean> forTableColumn());
    //		firstNameCol.setOnEditCommit((CellEditEvent<PersonBean, String> t) -> {
    //
    //	((PersonBean)t.getTableView().getItems().get(t.getTablePosition().getRow())).setFirstName(t.getNewValue());
    //		});
    //
    //		TableColumn<PersonBean, String> lastNameCol = new TableColumn<PersonBean, String>("Last
    // Name");
    //		lastNameCol.setCellValueFactory(new PropertyValueFactory("lastName"));
    //		lastNameCol.setCellFactory(TextFieldTableCell.<PersonBean> forTableColumn());
    //		lastNameCol.setOnEditCommit((CellEditEvent<PersonBean, String> t) -> {
    //			((PersonBean)
    // t.getTableView().getItems().get(t.getTablePosition().getRow())).setLastName(t.getNewValue());
    //		});

    TableColumn<PersonBean, String> emailCol = new TableColumn<PersonBean, String>("Email");
    emailCol.setCellValueFactory(new PropertyValueFactory("email"));
    emailCol.setCellFactory(TextFieldTableCell.<PersonBean>forTableColumn());
    emailCol.setOnEditCommit(
        (CellEditEvent<PersonBean, String> t) -> {
          ((PersonBean) t.getTableView().getItems().get(t.getTablePosition().getRow()))
              .setEmail(t.getNewValue());
        });

    TableColumn<PersonBean, String> genderCol = new TableColumn<PersonBean, String>("Gender");
    genderCol.setCellValueFactory(new PropertyValueFactory("gender"));
    genderCol.setCellFactory(TextFieldTableCell.<PersonBean>forTableColumn());
    genderCol.setOnEditCommit(
        (CellEditEvent<PersonBean, String> t) -> {
          ((PersonBean) t.getTableView().getItems().get(t.getTablePosition().getRow()))
              .setGender(t.getNewValue());
        });

    TableColumn<PersonBean, Integer> ageCol = new TableColumn<PersonBean, Integer>("Age");
    ageCol.setCellValueFactory(new PropertyValueFactory("age"));
    ageCol.setCellFactory(
        TextFieldTableCell.<PersonBean, Integer>forTableColumn(new IntegerStringConverter()));
    ageCol.setOnEditCommit(
        (CellEditEvent<PersonBean, Integer> t) -> {
          ((PersonBean) t.getTableView().getItems().get(t.getTablePosition().getRow()))
              .setAge(t.getNewValue());
        });
    table.getColumns().setAll(wholeNameCol, emailCol, genderCol, ageCol);
    ageCol.setId("white");

    Button allButton = new Button("All");
    allButton.setMinSize(100, 10);
    allButton.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            System.out.println("Show all!");
            filteredData.setPredicate(showAll());
          }
        });

    Button maleButton = new Button("Male");
    maleButton.setMinSize(100, 10);
    maleButton.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            System.out.println("Show male");
            // printIt();
            filteredData.setPredicate(isMale());
          }
        });
    Button femaleButton = new Button("Female");
    femaleButton.setMinSize(100, 10);
    femaleButton.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            System.out.println("Show female");
            filteredData.setPredicate(isFemale());
          }
        });

    Button over18Button = new Button("Over 18");
    over18Button.setMinSize(100, 10);
    over18Button.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            System.out.println("Above 18");
            // filteredData.setPredicate(over18());
            filteredData.setPredicate(
                new Predicate<PersonBean>() {
                  public boolean test(PersonBean p) {
                    return p.getAge() > 17;
                  }
                });
          }
        });

    Button addButton = new Button("Add row");
    addButton.setMinSize(100, 10);
    addButton.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            System.out.println("Add me!");
            filteredData.setPredicate(showAll());
            addRow();
          }
        });

    Button removeButton = new Button("Delete row");
    removeButton.setMinSize(100, 10);
    removeButton.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            System.out.println("delete me!");
            List items = new ArrayList(table.getSelectionModel().getSelectedItems());
            personData.removeAll(items);
            table.getSelectionModel().clearSelection();
          }
        });

    // Create a root node. In this case, a flow layout
    // is used, but several alternatives exist.
    FlowPane rootNode = new FlowPane();

    rootNode.getStylesheets().add("resource/style.css");

    rootNode
        .getChildren()
        .addAll(table, allButton, maleButton, femaleButton, over18Button, addButton, removeButton);
    // Create a scene.
    Scene myScene = new Scene(rootNode, 800, 800);

    // Set the scene on the stage.
    myStage.setScene(myScene);

    // Show the stage and its scene.
    myStage.show();
  }
  public Veld1RijtechniekKijktechniek(
      SchermController schermCtrl, EvaController evaCtrl, LeerlingController llnCtrl) {
    evaController = evaCtrl;
    schermController = schermCtrl;
    llnController = llnCtrl;

    this.llnController.getLeerling().addView(this);

    aandachtBtn = new Button("Aandachtspunt");
    aandachtBtn.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            aandacht();
          }
        });

    commentaarCol = new TableColumn("Commentaar");
    commentaarCol.setCellValueFactory(new PropertyValueFactory<Rijtechniek, String>("commentaar"));
    commentaarCol.setCellFactory(TextFieldTableCell.forTableColumn());
    commentaarCol.setOnEditCommit(
        new EventHandler<CellEditEvent<Rijtechniek, String>>() {
          @Override
          public void handle(CellEditEvent<Rijtechniek, String> t) {
            ((Rijtechniek) t.getTableView().getItems().get(t.getTablePosition().getRow()))
                .setCommentaar(t.getNewValue());
          }
        });

    table.setItems(data);
    table.getColumns().addAll(commentaarCol);

    commentaarFld = new TextField();
    commentaarFld.setPromptText("Commentaar");

    addButton = new Button("Voeg toe");
    addButton.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            resetAandachtBtn();
            if (!"".equals(commentaarFld.getText())) {
              data.add(new Rijtechniek(commentaarFld.getText()));
              commentaarFld.clear();
            }
          }
        });
    table.setItems(data);
    table.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {
            resetAandachtBtn();
          }
        });
    table.setEditable(true);

    vBox2.getChildren().addAll(table, commentaarFld);
    exit = new Button("Ga terug");

    exit.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            evaController.saveListDataRijtechniek("Stuurtechniek", data);
            Veld1RijtechniekKijktechniek.this.schermController.setScherm(MainApp.RIJTECHNIEK_ID);
            resetAandachtBtn();
          }
        });
    delBtn = new Button("Verwijder");
    delBtn.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            resetAandachtBtn();

            table.getItems().remove(table.getSelectionModel().getSelectedItem());
          }
        });
    delBtn.setMinHeight(30);
    delBtn.setMaxHeight(30);
    delBtn.setMinWidth(125);
    delBtn.setMaxWidth(125);
    delBtn.setAlignment(Pos.CENTER);
    delBtn.setTranslateX(-47);
    delBtn.setStyle("-fx-background-color: #5F6A95; -fx-text-fill:white");
    table.getStylesheets().add("resource/tableView.css");
    commentaarFld.setStyle("-fx-background-color:#789EBF; -fx-text-fill:white");
    commentaarCol.setMaxWidth(496);
    commentaarCol.setMinWidth(496);
    hBox1.getChildren().addAll(titelAfb, titel);
    hBox1.setMinHeight(50);
    hBox1.setMaxHeight(50);
    hBox1.setMinWidth(600);
    hBox1.setMaxWidth(600);
    hBox1.setSpacing(15);
    hBox1.setAlignment(Pos.CENTER);
    titelAfb.setFitHeight(50);
    titelAfb.setFitWidth(50);
    titel.setStyle("-fx-font: 40px Tahoma; -fx-text-fill:white");

    table.setMinWidth(500);
    table.setMaxWidth(500);
    table.setMinHeight(400);
    table.setMaxHeight(400);
    addButton.setMinHeight(30);
    addButton.setMaxHeight(30);
    addButton.setMinWidth(150);
    addButton.setMaxWidth(150);
    addButton.setAlignment(Pos.CENTER);
    aandachtBtn.setMinHeight(30);
    aandachtBtn.setMaxHeight(30);
    aandachtBtn.setMinWidth(150);
    aandachtBtn.setMaxWidth(150);
    aandachtBtn.setAlignment(Pos.CENTER);
    exit.setMinHeight(30);
    exit.setMaxHeight(30);
    exit.setMinWidth(150);
    exit.setMaxWidth(150);
    exit.setAlignment(Pos.CENTER);
    commentaarFld.setMinHeight(30);
    commentaarFld.setMaxHeight(30);
    commentaarFld.setMinWidth(250);
    commentaarFld.setMaxWidth(250);
    commentaarFld.setAlignment(Pos.CENTER);
    table.setTranslateX(70);
    commentaarFld.setTranslateX(90);
    addButton.setTranslateX(90);
    aandachtBtn.setTranslateX(90);
    exit.setTranslateX(90);

    addButton.setStyle("-fx-background-color: #5F6A95; -fx-text-fill:white");
    exit.setStyle("-fx-background-color: #5F6A95; -fx-text-fill:white");
    aandachtBtn.setStyle("-fx-background-color: #5F6A95; -fx-text-fill:white");

    gp.setStyle(
        "-fx-border-color: #282E54; -fx-border-radius:10 10 10 10;"
            + "-fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.8), 10, 0, 0, 0);"
            + "-fx-background-color: #282B3A;"
            + "-fx-background-radius: 5;");
    gp.setMaxWidth(900);
    gp.setMinWidth(900);
    gp.setMinHeight(600);
    gp.setMaxHeight(600);
    gp.setHgap(50);
    gp.setVgap(20);
    gp.setAlignment(Pos.CENTER);
    gp.add(hBox1, 0, 0, 2, 1);
    gp.add(table, 0, 1, 2, 1);
    gp.add(commentaarFld, 0, 2);
    gp.add(addButton, 1, 2);
    gp.add(aandachtBtn, 0, 3);
    gp.add(exit, 1, 3);
    gp.add(delBtn, 1, 3);

    this.setAlignment(Pos.CENTER);
    this.getChildren().add(gp);
    this.setStyle("-fx-background-image: url('resource/achtergrondStandaard.png')");

    update();
  }