@Override
  public void init() {
    // allow multiple rows selection
    tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    // listener for items selection change
    tableView
        .getSelectionModel()
        .getSelectedIndices()
        .addListener(
            (ListChangeListener<Integer>)
                change -> {
                  if (change.getList().size() > 0) {
                    setContextMenuState(true, true, true, true);
                  } else {
                    setContextMenuState(false, false, false, false);
                  }
                });

    // prevent table columns reordering
    tableView
        .getColumns()
        .addListener(
            (ListChangeListener<TableColumn<FileItem, ?>>)
                change -> {
                  change.next();
                  if (change.wasReplaced()) {
                    tableView.getColumns().clear();
                    tableView.getColumns().addAll(selectColumn, filenameColumn, filepathColumn);
                  }
                });

    // set column as a CheckBox column
    selectColumn.setCellFactory(
        cellData -> {
          CheckBoxTableCell<FileItem, Boolean> checkBoxTableCell = new CheckBoxTableCell<>();
          // set value changed listener
          checkBoxTableCell.setSelectedStateCallback(
              index -> tableView.getItems().get(index).selectedProperty());
          return checkBoxTableCell;
        });

    // add checkbox to column heading
    selectFilesCheckBox = new CheckBox();
    selectFilesCheckBox.setDisable(true);
    selectColumn.setGraphic(selectFilesCheckBox);
    selectFilesCheckBox
        .selectedProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              synchronized (LOCK) {
                tableView.getItems().forEach(fileItem -> fileItem.setSelected(newValue));
              }
            });

    // set value of cells in column
    selectColumn.setCellValueFactory(cellData -> cellData.getValue().selectedProperty());
    filenameColumn.setCellValueFactory(cellData -> cellData.getValue().filenameProperty());
    filepathColumn.setCellValueFactory(cellData -> cellData.getValue().filepathProperty());
  }
Esempio n. 2
0
 @SuppressWarnings("unchecked")
 private void initComponents() {
   pane = new AnchorPane();
   pane.setPrefSize(800, 600);
   pane.setStyle(
       "-fx-background-color: linear-gradient(from 0% 0% to 100% 100%, blue 0%, silver 100%);");
   txPesquisa = new TextField();
   DropShadow ds = new DropShadow();
   ds.setSpread(0.5);
   ds.setColor(Color.web("#FF0000"));
   txPesquisa.setEffect(ds);
   txPesquisa.setPromptText("Digite o item para pesquisa");
   txPesquisa.setPrefWidth(200);
   txPesquisa.setFocusTraversable(false);
   tbVitrine = new TableView<ItensProperty>();
   initItens();
   tbVitrine.setItems(listItens);
   tbVitrine.setPrefSize(780, 550);
   columnProduto = new TableColumn<ItensProperty, String>();
   columnProduto.setCellValueFactory(new PropertyValueFactory<ItensProperty, String>("produto"));
   columnProduto.setText("Produto");
   columnPreco = new TableColumn<ItensProperty, Double>();
   columnPreco.setCellValueFactory(new PropertyValueFactory<ItensProperty, Double>("preco"));
   columnPreco.setText("Preço");
   tbVitrine.getColumns().addAll(columnProduto, columnPreco);
   pane.getChildren().addAll(txPesquisa, tbVitrine);
 }
Esempio n. 3
0
 private TableColumn<Dispute, Dispute> getDateColumn() {
   TableColumn<Dispute, Dispute> column =
       new TableColumn<Dispute, Dispute>("Date") {
         {
           setMinWidth(130);
         }
       };
   column.setCellValueFactory((dispute) -> new ReadOnlyObjectWrapper<>(dispute.getValue()));
   column.setCellFactory(
       new Callback<TableColumn<Dispute, Dispute>, TableCell<Dispute, Dispute>>() {
         @Override
         public TableCell<Dispute, Dispute> call(TableColumn<Dispute, Dispute> column) {
           return new TableCell<Dispute, Dispute>() {
             @Override
             public void updateItem(final Dispute item, boolean empty) {
               super.updateItem(item, empty);
               if (item != null && !empty)
                 setText(formatter.formatDateTime(item.getOpeningDate()));
               else setText("");
             }
           };
         }
       });
   return column;
 }
  /**
   * Build a column representing an instance of the Object class. The object is represented by its
   * toString result.
   *
   * @param name label of the column
   * @param propertyName name of the property which is bound to the column
   * @param columnCount number of columns
   * @return a column of name name, bound with the property propertyName and with intelligent size
   */
  @Override
  public TableColumn buildColumn(String name, String propertyName, int columnCount) {
    TableColumn column = new TableColumn(name);
    column.setCellValueFactory(new PropertyValueFactory(propertyName));
    column.prefWidthProperty().bind(owner.widthProperty().divide(columnCount));
    column.setCellFactory(
        new Callback<TableColumn<E, C>, TableCell<E, C>>() {

          @Override
          public TableCell<E, C> call(TableColumn<E, C> p) {
            TableCell<E, C> cell =
                new TableCell<E, C>() {

                  @Override
                  protected void updateItem(C t, boolean bln) {
                    if (t != null) {
                      Text text = new Text(t.toString());
                      setGraphic(text);
                    }
                  }
                };
            return cell;
          }
        });
    return column;
  }
  /** Initializes the controller class. */
  @Override
  public void initialize(URL url, ResourceBundle rb) {
    resultTable.setItems(searchResults);

    titleC.setCellFactory(
        (TableColumn<SearchResult, String> p) -> {
          TextFieldTableCell<SearchResult, String> cell = new TextFieldTableCell<>();
          cell.setOnMouseClicked(
              t -> {
                if (t.getClickCount() == 2 && (!cell.isEmpty())) {
                  try {
                    String file = cell.getTableView().getItems().get(cell.getIndex()).getId().get();
                    Runtime.getRuntime()
                        .exec(
                            "open /Users/Luxin/Documents/UTC/LO17/SearchEngine/TD/TD01/BULLETINS/"
                                + file
                                + ".htm");
                  } catch (IOException ex) {
                    Logger.getLogger(SearchEngineInterfaceController.class.getName())
                        .log(Level.SEVERE, null, ex);
                  }
                }
              });
          return cell;
        });

    scoreC.setCellValueFactory(cell -> cell.getValue().getScore());
    idC.setCellValueFactory(cell -> cell.getValue().getId());
    titleC.setCellValueFactory(cell -> cell.getValue().getTitle());
  }
  @Override
  public void initialize(URL location, ResourceBundle resources) {
    try {

      fillTableFromData();
      action.setSortable(false);

      action.setCellValueFactory(
          new Callback<
              TableColumn.CellDataFeatures<EmployeeVO, Boolean>, ObservableValue<Boolean>>() {

            @Override
            public ObservableValue<Boolean> call(
                TableColumn.CellDataFeatures<EmployeeVO, Boolean> p) {
              return new SimpleBooleanProperty(p.getValue() != null);
            }
          });

      action.setCellFactory(
          new Callback<TableColumn<EmployeeVO, Boolean>, TableCell<EmployeeVO, Boolean>>() {

            @Override
            public TableCell<EmployeeVO, Boolean> call(TableColumn<EmployeeVO, Boolean> p) {
              return new ButtonCell();
            }
          });

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Esempio n. 7
0
 private TableColumn<MarketStatisticItem, MarketStatisticItem> getNumberOfOffersColumn() {
   TableColumn<MarketStatisticItem, MarketStatisticItem> column =
       new TableColumn<MarketStatisticItem, MarketStatisticItem>("Total offers") {
         {
           setMinWidth(100);
         }
       };
   column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
   column.setCellFactory(
       new Callback<
           TableColumn<MarketStatisticItem, MarketStatisticItem>,
           TableCell<MarketStatisticItem, MarketStatisticItem>>() {
         @Override
         public TableCell<MarketStatisticItem, MarketStatisticItem> call(
             TableColumn<MarketStatisticItem, MarketStatisticItem> column) {
           return new TableCell<MarketStatisticItem, MarketStatisticItem>() {
             @Override
             public void updateItem(final MarketStatisticItem item, boolean empty) {
               super.updateItem(item, empty);
               if (item != null && !empty) setText(String.valueOf(item.numberOfOffers));
               else setText("");
             }
           };
         }
       });
   return column;
 }
Esempio n. 8
0
 private TableColumn<MarketStatisticItem, MarketStatisticItem> getSpreadColumn() {
   TableColumn<MarketStatisticItem, MarketStatisticItem> column =
       new TableColumn<MarketStatisticItem, MarketStatisticItem>("Spread") {
         {
           setMinWidth(130);
         }
       };
   column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
   column.setCellFactory(
       new Callback<
           TableColumn<MarketStatisticItem, MarketStatisticItem>,
           TableCell<MarketStatisticItem, MarketStatisticItem>>() {
         @Override
         public TableCell<MarketStatisticItem, MarketStatisticItem> call(
             TableColumn<MarketStatisticItem, MarketStatisticItem> column) {
           return new TableCell<MarketStatisticItem, MarketStatisticItem>() {
             @Override
             public void updateItem(final MarketStatisticItem item, boolean empty) {
               super.updateItem(item, empty);
               if (item != null && !empty && item.spread != null)
                 setText(formatter.formatFiatWithCode(item.spread));
               else setText("");
             }
           };
         }
       });
   return column;
 }
 /*     */ private void rebuildDragRects() /*     */ {
   /* 331 */ if (!isColumnResizingEnabled()) return;
   /*     */
   /* 333 */ getChildren().removeAll(this.dragRects);
   /* 334 */ this.dragRects.clear();
   /*     */
   /* 336 */ if (getColumns() == null) {
     /* 337 */ return;
     /*     */ }
   /*     */
   /* 340 */ boolean bool =
       TableView.CONSTRAINED_RESIZE_POLICY.equals(getTableView().getColumnResizePolicy());
   /*     */
   /* 343 */ for (int i = 0;
       (i < getColumns().size()) && (/* 344 */ (!bool) || (i != getColumns().size() - 1));
       i++)
   /*     */ {
     /* 348 */ TableColumn localTableColumn = (TableColumn) getColumns().get(i);
     /* 349 */ Rectangle localRectangle = new Rectangle();
     /* 350 */ localRectangle.getProperties().put("TableColumn", localTableColumn);
     /* 351 */ localRectangle.getProperties().put("TableColumnHeader", this);
     /* 352 */ localRectangle.setWidth(4.0D);
     /* 353 */ localRectangle.setHeight(getHeight() - this.label.getHeight());
     /* 354 */ localRectangle.setFill(Color.TRANSPARENT);
     /* 355 */ localRectangle.visibleProperty().bind(localTableColumn.visibleProperty());
     /* 356 */ localRectangle.setSmooth(false);
     /* 357 */ localRectangle.setOnMousePressed(rectMousePressed);
     /* 358 */ localRectangle.setOnMouseDragged(rectMouseDragged);
     /* 359 */ localRectangle.setOnMouseReleased(rectMouseReleased);
     /* 360 */ localRectangle.setOnMouseEntered(rectCursorChangeListener);
     /* 361 */ localRectangle.setOnMouseExited(rectCursorChangeListener);
     /*     */
     /* 363 */ this.dragRects.add(localRectangle);
     /*     */ }
   /*     */ }
Esempio n. 10
0
 private TableColumn<MarketStatisticItem, MarketStatisticItem> getCurrencyColumn() {
   TableColumn<MarketStatisticItem, MarketStatisticItem> column =
       new TableColumn<MarketStatisticItem, MarketStatisticItem>("Currency") {
         {
           setMinWidth(100);
         }
       };
   column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
   column.setCellFactory(
       new Callback<
           TableColumn<MarketStatisticItem, MarketStatisticItem>,
           TableCell<MarketStatisticItem, MarketStatisticItem>>() {
         @Override
         public TableCell<MarketStatisticItem, MarketStatisticItem> call(
             TableColumn<MarketStatisticItem, MarketStatisticItem> column) {
           return new TableCell<MarketStatisticItem, MarketStatisticItem>() {
             @Override
             public void updateItem(final MarketStatisticItem item, boolean empty) {
               super.updateItem(item, empty);
               if (item != null && !empty) setText(CurrencyUtil.getNameByCode(item.currencyCode));
               else setText("");
             }
           };
         }
       });
   return column;
 }
Esempio n. 11
0
 private TableColumn<Dispute, Dispute> getRoleColumn() {
   TableColumn<Dispute, Dispute> column =
       new TableColumn<Dispute, Dispute>("Role") {
         {
           setMinWidth(130);
         }
       };
   column.setCellValueFactory((dispute) -> new ReadOnlyObjectWrapper<>(dispute.getValue()));
   column.setCellFactory(
       new Callback<TableColumn<Dispute, Dispute>, TableCell<Dispute, Dispute>>() {
         @Override
         public TableCell<Dispute, Dispute> call(TableColumn<Dispute, Dispute> column) {
           return new TableCell<Dispute, Dispute>() {
             @Override
             public void updateItem(final Dispute item, boolean empty) {
               super.updateItem(item, empty);
               if (item != null && !empty) {
                 if (item.isDisputeOpenerIsOfferer())
                   setText(item.isDisputeOpenerIsBuyer() ? "Buyer/Offerer" : "Seller/Offerer");
                 else setText(item.isDisputeOpenerIsBuyer() ? "Buyer/Taker" : "Seller/Taker");
               } else {
                 setText("");
               }
             }
           };
         }
       });
   return column;
 }
Esempio n. 12
0
  @SuppressWarnings({"unchecked", "rawtypes"})
  public void initialize(URL url, ResourceBundle rb) {

    ObservableList<Medarbejder> data = FXCollections.observableArrayList();

    try {
      Connection con = dataaccess.getConnection();

      PreparedStatement prep =
          con.prepareStatement(
              "SELECT MEDARBEJDER.NAVN, EMAIL, MEDARBEJDER.AFDELING  FROM MEDARBEJDER");

      rs = prep.executeQuery();

      while (rs.next()) {

        data.add(
            new Medarbejder(rs.getString("navn"), rs.getString("email"), rs.getString("afdeling")));
      }

      viewNavn.setCellValueFactory(new PropertyValueFactory("navn"));
      viewEmail.setCellValueFactory(new PropertyValueFactory("email"));
      viewAfdeling.setCellValueFactory(new PropertyValueFactory("afdeling"));

      TableView.setItems(null);
      TableView.setItems(data);

    } catch (Exception e) {
      e.printStackTrace();
      System.out.println("Error on Building Data");
    }
  }
  private void initializeFilteredPersonnelTableView() {
    personnelNameColumn.setCellValueFactory(new PropertyValueFactory<Official, String>("name"));
    personnelRankColumn.setCellValueFactory(
        new Callback<TableColumn.CellDataFeatures<Official, String>, ObservableValue<String>>() {
          @Override
          public ObservableValue<String> call(CellDataFeatures<Official, String> arg0) {
            final Official official = arg0.getValue();
            final StringExpression concat =
                Bindings.selectString(official.rankProperty(), "designation");
            return concat;
          }
        });
    Bindings.bindContent(officialsFilteredTableView.getItems(), officialFilteredList);
    gameData
        .getOfficials()
        .addListener(
            new ListChangeListener<Official>() {
              @Override
              public void onChanged(Change<? extends Official> arg0) {
                updateOfficialFiltersResult();
              }
            });

    // TODO initialize assignOfficialMenuItem to be sure that it's not
    // enable if not correct values are selected
  }
  @FXML
  private void genararb(ActionEvent event) {
    tablabloque.getColumns().clear();
    String[] titulos = {
      "Numero", "bloque", "Fecha De Creacion", "Fecha De Modificacion",
    };

    for (int i = 0; i < titulos.length; i++) {
      final int j = i;
      this.titulo = new TableColumn(titulos[i]);
      this.titulo.setCellValueFactory(
          new Callback<
              TableColumn.CellDataFeatures<ObservableList, String>, ObservableValue<String>>() {
            @Override
            public ObservableValue<String> call(
                TableColumn.CellDataFeatures<ObservableList, String> parametro) {
              return new SimpleStringProperty((String) parametro.getValue().get(j));
            }
          });
      tablabloque.getColumns().addAll(titulo);
      // Asignamos un tamaño a ls columnnas
      titulo.setMinWidth(120);

      // Centrar los datos de la tabla
      titulo.setCellFactory(
          new Callback<TableColumn<String, String>, TableCell<String, String>>() {
            @Override
            public TableCell<String, String> call(TableColumn<String, String> p) {
              TableCell cell =
                  new TableCell() {
                    @Override
                    protected void updateItem(Object t, boolean bln) {
                      if (t != null) {
                        super.updateItem(t, bln);
                        setText(t.toString());
                        setAlignment(Pos.CENTER); // Setting the Alignment
                      }
                    }
                  };
              return cell;
            }
          });
    }

    tbbloque = FXCollections.observableArrayList();
    for (Tbbloque bloq : resultsbloque) {
      ObservableList<String> row = FXCollections.observableArrayList();
      row.add(bloq.getId().toString());
      row.add(bloq.getNombre());
      row.add(df1.format(bloq.getFechacreacion()));
      System.out.print(bloq.getFechacreacion());
      String fecha =
          bloq.getFechamodificacion() == null
              ? bloq.getFechamodificacion() + ""
              : df1.format(bloq.getFechamodificacion());
      row.add(fecha);
      tbbloque.addAll(row);
    }
    tablabloque.setItems(tbbloque);
  }
 // 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);
 }
Esempio n. 16
0
 /**
  * Create the filter column, which holds the name of the filter and also creates a callback to the
  * string property behind it.
  */
 private void setUpFilterColumn(TableView<FilterInput> tableView) {
   // Set up filter column
   final TableColumn<FilterInput, String> filterColumn = new TableColumn<>("Filter");
   filterColumn.setMinWidth(120);
   filterColumn.setPrefWidth(120);
   tableView.getColumns().add(filterColumn);
   filterColumn.setCellValueFactory(p -> p.getValue().getNameProperty());
 }
Esempio n. 17
0
 /**
  * Create the origin column, which holds the type of the origin and also creates a callback to the
  * string property behind it.
  */
 private void setUpOriginColumn(TableView<FilterInput> tableView) {
   // Set up origin column
   final TableColumn<FilterInput, String> originColumn = new TableColumn<>("Filtered By");
   originColumn.setMinWidth(90);
   originColumn.setPrefWidth(90);
   tableView.getColumns().add(originColumn);
   originColumn.setCellValueFactory(p -> p.getValue().getFilterTypeProperty());
 }
Esempio n. 18
0
 /**
  * Create the priority column, which holds the priority of a filter and also creates a callback to
  * the integer property behind it.
  */
 private void setUpPriorityColumn(TableView<FilterInput> tableView) {
   // Set up priority column
   final TableColumn<FilterInput, Integer> priorityColumn = new TableColumn<>("Priority");
   priorityColumn.setMinWidth(50);
   priorityColumn.setPrefWidth(50);
   tableView.getColumns().add(priorityColumn);
   priorityColumn.setCellValueFactory(p -> p.getValue().getPriorityProperty().asObject());
 }
Esempio n. 19
0
 /**
  * Create the legalality column, which holds the legality of a filter and also creates a callback
  * to the string property behind it.
  */
 private void setUpLegalityColumn(TableView<FilterInput> tableView) {
   // Set up priority column
   final TableColumn<FilterInput, Boolean> legalColumn = new TableColumn<>("Authorized");
   legalColumn.setMinWidth(70);
   legalColumn.setPrefWidth(70);
   tableView.getColumns().add(legalColumn);
   legalColumn.setCellValueFactory(p -> p.getValue().getLegalProperty());
 }
Esempio n. 20
0
 /**
  * Create the type column, which holds the type of the filter and also creates a callback to the
  * string property behind it.
  */
 private void setUpTypeColumn(TableView<FilterInput> tableView) {
   // Set up type column
   final TableColumn<FilterInput, String> typeColumn = new TableColumn<>("Selection Model");
   typeColumn.setMinWidth(90);
   typeColumn.setPrefWidth(90);
   tableView.getColumns().add(typeColumn);
   typeColumn.setCellValueFactory(p -> p.getValue().getSelectionModelProperty());
 }
 @Override
 public void preencherTabela() {
   colunaNome.setCellValueFactory(new PropertyValueFactory<Funcionario, String>("nome"));
   colunaCPF.setCellValueFactory(new PropertyValueFactory<Funcionario, Double>("cpf"));
   colunaTel.setCellValueFactory(new PropertyValueFactory<Funcionario, String>("telefones"));
   colunaFun.setCellValueFactory(
       new PropertyValueFactory<Funcionario, String>("tipoDeFuncionario"));
   atualizarLista();
 }
Esempio n. 22
0
  public void putInTable(ObservableList<Medarbejder> datars) {

    viewNavn.setCellValueFactory(new PropertyValueFactory("navn"));
    viewEmail.setCellValueFactory(new PropertyValueFactory("email"));
    viewAfdeling.setCellValueFactory(new PropertyValueFactory("afdeling"));

    TableView.setItems(null);
    TableView.setItems(datars);
  }
  public void initialize() {

    columnaMaterias.setCellValueFactory(
        new PropertyValueFactory<tableHistorial, String>("materia"));
    columnaFecha.setCellValueFactory(new PropertyValueFactory<tableHistorial, String>("fecha"));
    columnaTipoExamen.setCellValueFactory(
        new PropertyValueFactory<tableHistorial, String>("tipoExamen"));
    llenarTablaColoquios();
  }
 /** initializes the tableView (history) */
 private void initializeTableView() {
   historyTable.setItems(HistoryHelper.getHistory());
   nameColumn.setCellValueFactory(
       new PropertyValueFactory<TransformationResultHistory, String>("fileName"));
   percentageColumn.setCellValueFactory(
       new PropertyValueFactory<TransformationResultHistory, Number>("percentOfSuppression"));
   dateColumn.setCellValueFactory(
       new PropertyValueFactory<TransformationResultHistory, Date>("transformationDate"));
 }
  private void CargarTabla() {
    tablabloque.getColumns().clear();
    String[] titulos = {
      "Bloque", "Pregunta",
    };

    for (int i = 0; i < titulos.length; i++) {
      final int j = i;
      this.titulo = new TableColumn(titulos[i]);
      this.titulo.setCellValueFactory(
          new Callback<
              TableColumn.CellDataFeatures<ObservableList, String>, ObservableValue<String>>() {
            @Override
            public ObservableValue<String> call(
                TableColumn.CellDataFeatures<ObservableList, String> parametro) {
              return new SimpleStringProperty((String) parametro.getValue().get(j));
            }
          });
      tablabloque.getColumns().addAll(titulo);
      // Asignamos un tamaño a ls columnnas
      if (i == 0) {
        titulo.setMinWidth(120);
      } else {
        titulo.setMinWidth(450);
      }

      // Centrar los datos de la tabla
      titulo.setCellFactory(
          new Callback<TableColumn<String, String>, TableCell<String, String>>() {
            @Override
            public TableCell<String, String> call(TableColumn<String, String> p) {
              TableCell cell =
                  new TableCell() {
                    @Override
                    protected void updateItem(Object t, boolean bln) {
                      if (t != null) {
                        super.updateItem(t, bln);
                        setText(t.toString());
                        setAlignment(Pos.CENTER); // Setting the Alignment
                      }
                    }
                  };
              return cell;
            }
          });
    }

    tbbloque = FXCollections.observableArrayList();
    for (Tbbloquesxpregunta bloqxpreg : resultsbloqxpreg) {
      ObservableList<String> row = FXCollections.observableArrayList();
      row.add(bloqxpreg.getIdbloque().getNombre());
      row.add(bloqxpreg.getIdpregunta().getNombre());
      tbbloque.addAll(row);
    }
    tablabloque.setItems(tbbloque);
  }
  @Override
  public void loaded() {
    Course course = (Course) parameter;
    courseNameField.textProperty().bindBidirectional(course.getNameProperty());
    universityField.textProperty().bindBidirectional(course.getUniversity().getNameProperty());

    preRequisitesTable.setItems(course.getPreRequisites());
    preRequisiteNameColumn.setCellValueFactory((q) -> q.getValue().getNameProperty());
    preRequisiteFieldColumn.setCellValueFactory((q) -> q.getValue().getFieldProperty());
  }
Esempio n. 27
0
 /**
  * Updates updateEditRecipeList and UpdateIngredients when loading vista. Sets cellValueFactory
  * with the column names for the tableview.
  */
 @Override
 public void initialize(URL location, ResourceBundle resources) {
   System.out.println("Initialize EditRecipesController");
   mainController = VistaNavigator.getMainController();
   updateIngredients();
   Name.setCellValueFactory(new PropertyValueFactory<Ingredient, String>("name"));
   Amount.setCellValueFactory(new PropertyValueFactory<Ingredient, String>("amount"));
   Unit.setCellValueFactory(new PropertyValueFactory<Ingredient, String>("unit"));
   System.out.println("- End of Initialize EditRecipesController");
 }
  @FXML
  private void initialize() {
    // set values for allTeamsTableView's columns
    _allTeamsNameColumn.setCellValueFactory(
        new PropertyValueFactory<DisplayTeamDTO, String>("Name"));

    // set values for addedTeamsTableViews' columns
    _allTeamsOpponentNameColumn.setCellValueFactory(
        new PropertyValueFactory<DisplayTeamDTO, String>("Name"));
  }
Esempio n. 29
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);
  }
 @FXML
 private void initialize() {
   // Initialize the task table with the five columns.
   taskNumberColumn.setCellValueFactory(cellData -> cellData.getValue().taskNumberProperty());
   taskNameColumn.setCellValueFactory(cellData -> cellData.getValue().taskNameProperty());
   startTimeColumn.setCellValueFactory(cellData -> cellData.getValue().startTimeProperty());
   endTimeColumn.setCellValueFactory(cellData -> cellData.getValue().endTimeProperty());
   priority.setCellValueFactory(cellData -> cellData.getValue().priorityProperty());
 }