コード例 #1
0
  protected Node getContentNode() {
    Node taskView = getTaskView();

    if (SettingsUtil.loadSettings().isShowStatistics()) {
      LOGGER.debug("Statistics enabled in settings");
      statisticsView = new VBox(20);

      // wrap statistics in scrollpane
      ScrollPane scrollPane = new ScrollPane(statisticsView);
      scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
      scrollPane.setFitToWidth(true);
      scrollPane.setPadding(new Insets(7));

      // both statistics and task view present
      // show both in a split pane
      SplitPane splitPane = new SplitPane();
      splitPane.setOrientation(Orientation.HORIZONTAL);
      splitPane.setDividerPosition(0, 0.8);
      splitPane.getItems().addAll(taskView, scrollPane);
      return splitPane;
    } else {
      LOGGER.debug("Statistics disabled in settings");
      return taskView;
    }
  }
コード例 #2
0
  private void initDialog() {
    dialog.initOwner(mainApp.getPrimaryStage());
    dialog.initModality(Modality.APPLICATION_MODAL);
    dialog.initStyle(StageStyle.DECORATED);
    dialog.setResizable(true);
    dialog.setTitle("Recordings Already Exist");
    dialog.setHeaderText("Replace or rename recordings?");
    dialog.getDialogPane().setPadding(new Insets(10));

    VBox vbox = new VBox();
    vbox.setSpacing(10);
    dialog.getDialogPane().setContent(vbox);

    Label label =
        new Label(
            "Archiving the following recordings will replace files on your computer unless you rename them:");
    vbox.getChildren().add(label);

    VBox recordingBox = new VBox();
    recordingBox.setSpacing(20);
    for (Recording recording : recordingsToDisplay) {
      recording.setFileExistsAction(Recording.FileExistsAction.REPLACE);
      recordingBox.getChildren().add(buildRecordingGrid(recording));
    }

    ScrollPane scrollPane = new ScrollPane();
    scrollPane.getStyleClass().add("recording-exists-list");
    scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);
    scrollPane.setContent(recordingBox);
    scrollPane.setPadding(new Insets(10));
    vbox.getChildren().add(scrollPane);

    dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
  }
コード例 #3
0
  public IndividualLifeBarTitledPane(final IndividualLifeBar individualLifeBar) {
    this.individualLifeBar = individualLifeBar;

    setText("Configuração LifeBar de Objeto");

    VBox layout = new VBox();

    GridPane gridPane = new GridPane();

    ColumnConstraints col1 = new ColumnConstraints();
    col1.setPercentWidth(40);
    ColumnConstraints col2 = new ColumnConstraints();
    col2.setPercentWidth(30);
    ColumnConstraints col3 = new ColumnConstraints();
    col3.setPercentWidth(30);
    gridPane.getColumnConstraints().addAll(col1, col2, col3);

    Label label = new Label("Objeto");
    gridPane.add(label, 0, 0);

    boxLabelObjects = new ComboBox<String>();
    boxLabelObjects.getItems().addAll(individualLifeBar.getWorld().getObjectIds());

    if (individualLifeBar.getOwnerId() != null) {
      boxLabelObjects.getSelectionModel().select(individualLifeBar.getOwnerId());
    }

    boxLabelObjects.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent event) {
            for (String label : individualLifeBar.getWorld().getObjectIds()) {
              if (!boxLabelObjects.getItems().contains(label)) {
                boxLabelObjects.getItems().add(label);
              }
            }
          }
        });

    boxLabelObjects.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            individualLifeBar.setOwner(boxLabelObjects.getValue());
          }
        });

    gridPane.add(boxLabelObjects, 1, 0);
    layout.getChildren().add(gridPane);

    Separator separator = new Separator(Orientation.HORIZONTAL);
    separator.setPadding(new Insets(5, 0, 5, 0));
    layout.getChildren().add(separator);
    layout.setPadding(new Insets(5));

    lifeBarPane = new LifebarPane(individualLifeBar);
    layout.getChildren().add(lifeBarPane);
    ScrollPane scroll = new ScrollPane(layout);
    scroll.setFitToWidth(true);
    setContent(scroll);
  }
  @FXML
  private void reservationsButtonClicked(ActionEvent event) {
    configureButtons();
    reservationsButton.setGraphic(reservationsSelectedIMV);

    // Clear the content of contentPane
    contentPane.getChildren().clear();

    // Set title
    titleLabel.setText("Reservations");

    // Make box for weekly availability and reservations
    VBox box = new VBox();
    box.setSpacing(10);
    box.setAlignment(Pos.TOP_CENTER);
    box.setPrefWidth(900);

    // box for availability
    VBox abox = new VBox();
    box.setSpacing(10);
    box.setAlignment(Pos.TOP_CENTER);
    box.setPrefWidth(900);

    // box for reservations
    VBox resbox = new VBox();
    box.setSpacing(10);
    box.setAlignment(Pos.TOP_CENTER);
    box.setPrefWidth(900);

    // set up for weekly table availability
    Text aHeader = new Text("Tables still available");
    aHeader.setFont(new Font("System", 24));

    TableView aTable = new TableView();
    TableColumn aDateCol = new TableColumn("Date");
    aDateCol.setCellValueFactory(new PropertyValueFactory<>("date"));
    TableColumn tablesCol = new TableColumn("Tables Available");
    tablesCol.setCellValueFactory(new PropertyValueFactory<>("tablesAvailable"));

    // add table and title to availability box
    abox.getChildren().addAll(aHeader, aTable);
    abox.setSpacing(5);

    // set width for all cols
    aDateCol.setMinWidth(100);
    tablesCol.setMinWidth(100);

    aTable.getColumns().addAll(aDateCol, tablesCol);
    // Populate data to the table view
    operation.callDates();
    ObservableList<Availability> adata =
        FXCollections.observableArrayList(operation.getWeeklyAvailability());
    aTable.setItems(adata);
    aTable.setMaxHeight(235);
    aTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    // set up for reservations
    Text resHeader = new Text("All Reservations");
    resHeader.setFont(new Font("System", 24));

    TableView resTable = new TableView();
    TableColumn firstNameCol = new TableColumn("First Name");
    firstNameCol.setCellValueFactory(new PropertyValueFactory<>("firstName"));
    TableColumn lastNameCol = new TableColumn("Last Name");
    lastNameCol.setCellValueFactory(new PropertyValueFactory<>("lastName"));
    TableColumn tidCol = new TableColumn("tID");
    tidCol.setCellValueFactory(new PropertyValueFactory<>("tID"));
    TableColumn partySizeCol = new TableColumn("Party Size");
    partySizeCol.setCellValueFactory(new PropertyValueFactory<>("partySize"));
    TableColumn seatsCol = new TableColumn("Seats");
    seatsCol.setCellValueFactory(new PropertyValueFactory<>("seats"));
    TableColumn dateCol = new TableColumn("Reservation Date");
    dateCol.setCellValueFactory(new PropertyValueFactory<>("reservationDate"));

    // set width for all cols
    firstNameCol.setMinWidth(100);
    lastNameCol.setMinWidth(100);
    tidCol.setMinWidth(100);
    partySizeCol.setMinWidth(100);
    seatsCol.setMinWidth(100);
    dateCol.setMinWidth(300);

    // add table and title to availability box
    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setContent(resTable);
    scrollPane.setFitToWidth(true);
    resbox.getChildren().addAll(resHeader, scrollPane);
    resbox.setSpacing(5);

    resTable
        .getColumns()
        .addAll(firstNameCol, lastNameCol, tidCol, partySizeCol, seatsCol, dateCol);
    // Populate data to the table view
    ObservableList<ReservationInfo> resdata =
        FXCollections.observableArrayList(operation.getAllReservations());
    resTable.setItems(resdata);
    resTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    // add table view to content pane
    box.getChildren().addAll(abox, resbox);
    contentPane.getChildren().add(box);
  }