Exemplo n.º 1
0
  public MediaTable() {
    imageColumnHeaderText = new SimpleStringProperty("Image");
    titleColumnHeaderText = new SimpleStringProperty("Title");
    descriptionColumnHeaderText = new SimpleStringProperty("Description");

    imageColumnHeaderVisible = new SimpleBooleanProperty(true);
    titleColumnHeaderVisible = new SimpleBooleanProperty(true);
    descriptionColumnHeaderVisible = new SimpleBooleanProperty(true);

    TableColumn<T, Image> imageTableColumn = new TableColumn<>();
    imageTableColumn.setCellValueFactory(c -> c.getValue().imageProperty());
    imageTableColumn.textProperty().bind(imageColumnHeaderText);
    imageTableColumn.visibleProperty().bind(imageColumnHeaderVisible);
    imageTableColumn.setCellFactory(c -> new ImageTableCell());

    TableColumn<T, String> titleTableColumn = new TableColumn<>();
    titleTableColumn.setCellValueFactory(c -> c.getValue().titleProperty());
    titleTableColumn.textProperty().bind(titleColumnHeaderText);
    titleTableColumn.visibleProperty().bind(titleColumnHeaderVisible);

    TableColumn<T, String> descriptionTableColumn = new TableColumn<>();
    descriptionTableColumn.setCellValueFactory(c -> c.getValue().descriptionProperty());
    descriptionTableColumn.textProperty().bind(descriptionColumnHeaderText);
    descriptionTableColumn.visibleProperty().bind(descriptionColumnHeaderVisible);

    getColumns().addAll(imageTableColumn, titleTableColumn, descriptionTableColumn);
  }
 /*     */ 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);
     /*     */ }
   /*     */ }