javafx.scene.control.TableView Java Examples

The following examples show how to use javafx.scene.control.TableView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RFXTableViewCheckBoxTableCellTest.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Test
public void select() {
    TableView<?> tableView = (TableView<?>) getPrimaryStage().getScene().getRoot().lookup(".table-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        Point2D point = getPoint(tableView, 0, 1);
        RFXTableView rfxTableView = new RFXTableView(tableView, null, point, lr);
        rfxTableView.focusGained(null);
        Person person = (Person) tableView.getItems().get(1);
        person.invitedProperty().set(true);
        rfxTableView.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals(":checked", recording.getParameters()[0]);
}
 
Example #2
Source File: JavaFXTableViewElement.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override
public List<IJavaFXElement> getByPseudoElement(String selector, Object[] params) {
    if (selector.equals("mnth-cell")) {
        return Arrays.asList(
                new JavaFXTableCellElement(this, ((Integer) params[0]).intValue() - 1, ((Integer) params[1]).intValue() - 1));
    } else if (selector.equals("all-cells")) {
        TableView<?> tableView = (TableView<?>) getComponent();
        int rowCount = tableView.getItems().size();
        int columnCount = tableView.getColumns().size();
        ArrayList<IJavaFXElement> r = new ArrayList<>();
        for (int i = 0; i < rowCount; i++) {
            for (int j = 0; j < columnCount; j++) {
                r.add(new JavaFXTableCellElement(this, i, j));
            }
        }
        return r;
    } else if (selector.equals("select-by-properties")) {
        return findSelectByProperties(new JSONObject((String) params[0]));
    }
    return super.getByPseudoElement(selector, params);
}
 
Example #3
Source File: TableVisualisation.java    From constellation with Apache License 2.0 6 votes vote down vote up
public TableVisualisation(final AbstractTableTranslator<? extends AnalyticResult<?>, C> translator) {
    this.translator = translator;

    this.tableVisualisation = new VBox();

    this.tableFilter = new TextField();
    tableFilter.setPromptText("Type here to filter results");

    this.table = new TableView<>();
    table.setPlaceholder(new Label("No results"));
    table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    table.setId("table-visualisation");
    table.setPadding(new Insets(5));

    tableVisualisation.getChildren().addAll(tableFilter, table);
}
 
Example #4
Source File: InfluenceAnalysisUI.java    From SONDY with GNU General Public License v3.0 6 votes vote down vote up
public final void availabeMethodsUI(){
    initializeAvailableMethodList();
    methodDescriptionLabel = new Label("Selected method description");
    methodDescriptionLabel.setId("smalltext");
    UIUtils.setSize(methodDescriptionLabel,Main.columnWidthLEFT,24);
    VBox methodsLEFT = new VBox();
    methodsLEFT.getChildren().addAll(methodList,new Rectangle(0,3),methodDescriptionLabel);
    // Right part
    applyButton = createApplyMethodButton();
    UIUtils.setSize(applyButton, Main.columnWidthRIGHT, 24);
    parameterTable = new TableView<>();
    UIUtils.setSize(parameterTable, Main.columnWidthRIGHT, 64);
    initializeParameterTable();
    VBox methodsRIGHT = new VBox();
    methodsRIGHT.getChildren().addAll(parameterTable,new Rectangle(0,3),applyButton);
    // Both parts
    HBox methodsBOTH = new HBox(5);
    methodsBOTH.getChildren().addAll(methodsLEFT,methodsRIGHT);
    grid.add(methodsBOTH,0,2);
}
 
Example #5
Source File: OLcClient.java    From Open-Lowcode with Eclipse Public License 2.0 6 votes vote down vote up
private ActionSourceTransformer getActionSourceTransformer() {
	return new ActionSourceTransformer() {

		@Override
		public Object getParentWidget(Object originwidget) {
			if (originwidget instanceof GanttTaskCell) {
				GanttTaskCell<?> gantttaskcell = (GanttTaskCell<?>) originwidget;
				GanttDisplay<?> parentdisplay = gantttaskcell.getParentGanttDisplay();
				return parentdisplay;
			}
			if (originwidget instanceof TableRow) {
				TableRow<?> tablerow = (TableRow<?>) originwidget;
				TableView<?> table = tablerow.getTableView();
				return table;
			}
			return originwidget;
		}
	};
}
 
Example #6
Source File: WidgetInfoDialog.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
private Tab createMacros(final Macros orig_macros)
{
    final Macros macros = (orig_macros == null) ? new Macros() : orig_macros;
    // Use text field to allow copying the name and value
    // Table uses list of macro names as input
    // Name column just displays the macro name,..
    final TableColumn<String, String> name = new TableColumn<>(Messages.WidgetInfoDialog_Name);
    name.setCellFactory(col -> new ReadOnlyTextCell<>());
    name.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));

    // .. value column fetches the macro value
    final TableColumn<String, String> value = new TableColumn<>(Messages.WidgetInfoDialog_Value);
    value.setCellFactory(col -> new ReadOnlyTextCell<>());
    value.setCellValueFactory(param -> new ReadOnlyStringWrapper(macros.getValue(param.getValue())));

    final TableView<String> table =
        new TableView<>(FXCollections.observableArrayList(macros.getNames()));
    table.getColumns().add(name);
    table.getColumns().add(value);
    table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    return new Tab(Messages.WidgetInfoDialog_TabMacros, table);
}
 
Example #7
Source File: TooltippedTextFieldTableCell.java    From pdfsam with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void commitEdit(String item) {

    // This block is necessary to support commit on losing focus, because the baked-in mechanism
    // sets our editing state to false before we can intercept the loss of focus.
    // The default commitEdit(...) method simply bails if we are not editing...
    if (!isEditing() && !item.equals(getItem())) {
        TableView<SelectionTableRowData> table = getTableView();
        if (table != null) {
            TableColumn<SelectionTableRowData, String> column = getTableColumn();
            CellEditEvent<SelectionTableRowData, String> event = new CellEditEvent<>(table,
                    new TablePosition<>(table, getIndex(), column), TableColumn.editCommitEvent(), item);
            Event.fireEvent(column, event);
        }
    }

    super.commitEdit(item);
    setContentDisplay(ContentDisplay.TEXT_ONLY);
}
 
Example #8
Source File: RFXComponentTest.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public Point2D getPoint(TableView<?> tableView, int columnIndex, int rowIndex) {
    Set<Node> tableRowCell = tableView.lookupAll(".table-row-cell");
    TableRow<?> row = null;
    for (Node tableRow : tableRowCell) {
        TableRow<?> r = (TableRow<?>) tableRow;
        if (r.getIndex() == rowIndex) {
            row = r;
            break;
        }
    }
    Set<Node> cells = row.lookupAll(".table-cell");
    for (Node node : cells) {
        TableCell<?, ?> cell = (TableCell<?, ?>) node;
        if (tableView.getColumns().indexOf(cell.getTableColumn()) == columnIndex) {
            Bounds bounds = cell.getBoundsInParent();
            Point2D localToParent = cell.localToParent(bounds.getWidth() / 2, bounds.getHeight() / 2);
            Point2D rowLocal = row.localToScene(localToParent, true);
            return rowLocal;
        }
    }
    return null;
}
 
Example #9
Source File: ColorTableCell.java    From old-mzmine3 with GNU General Public License v2.0 6 votes vote down vote up
public ColorTableCell(TableColumn<T, Color> column) {
  colorPicker = new ColorPicker();
  colorPicker.editableProperty().bind(column.editableProperty());
  colorPicker.disableProperty().bind(column.editableProperty().not());
  colorPicker.setOnShowing(event -> {
    final TableView<T> tableView = getTableView();
    tableView.getSelectionModel().select(getTableRow().getIndex());
    tableView.edit(tableView.getSelectionModel().getSelectedIndex(), column);
  });
  colorPicker.valueProperty().addListener((observable, oldValue, newValue) -> {
    if (isEditing()) {
      commitEdit(newValue);
    }
  });
  setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
}
 
Example #10
Source File: RFXTableViewComboBoxTableCell.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void selectEditable() {
    TableView<?> tableView = (TableView<?>) getPrimaryStage().getScene().getRoot().lookup(".table-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        Point2D point = getPoint(tableView, 2, 1);
        ComboBoxTableCell cell = (ComboBoxTableCell) getCellAt(tableView, 1, 2);
        cell.setEditable(true);
        RFXTableView rfxTableView = new RFXTableView(tableView, null, point, lr);
        rfxTableView.focusGained(null);
        cell.startEdit();
        tableView.edit(1, (TableColumn) tableView.getColumns().get(2));
        Person person = (Person) tableView.getItems().get(1);
        person.setLastName("Jones");
        cell.commitEdit("Jones");
        rfxTableView.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("Jones", recording.getParameters()[0]);
}
 
Example #11
Source File: ArchiveListPane.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
public ArchiveListPane()
{
    archive_list = new TableView<>(FXCollections.observableArrayList(Preferences.archive_urls));

    final TableColumn<ArchiveDataSource, String> arch_col = new TableColumn<>(Messages.ArchiveName);
    arch_col.setCellValueFactory(cell -> new SimpleStringProperty(cell.getValue().getName()));
    arch_col.setMinWidth(0);
    archive_list.getColumns().add(arch_col);

    final MenuItem item_info = new MenuItem(Messages.ArchiveServerInfo, Activator.getIcon("info_obj"));
    item_info.setOnAction(event -> showArchiveInfo());
    ContextMenu menu = new ContextMenu(item_info);
    archive_list.setContextMenu(menu);

    archive_list.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    archive_list.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    setCenter(archive_list);
}
 
Example #12
Source File: RFXTableViewTest.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Test
public void selectAllCells() {
    TableView<?> tableView = (TableView<?>) getPrimaryStage().getScene().getRoot().lookup(".table-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        tableView.getSelectionModel().setCellSelectionEnabled(true);
        tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        Point2D point = getPoint(tableView, 1, 1);
        RFXTableView rfxTableView = new RFXTableView(tableView, null, point, lr);
        rfxTableView.focusGained(null);
        tableView.getSelectionModel().selectRange(0, getTableColumnAt(tableView, 0), 5, getTableColumnAt(tableView, 2));
        rfxTableView.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("all", recording.getParameters()[0]);
}
 
Example #13
Source File: ButtonCell.java    From mzmine3 with GNU General Public License v2.0 6 votes vote down vote up
public ButtonCell(TableColumn<T, Boolean> column, Glyph onGraphic, Glyph offGraphic) {
  button = new ToggleButton();
  button.setGraphic(onGraphic);
  button.setSelected(true);
  button.setOnMouseClicked(event -> {
    final TableView<T> tableView = getTableView();
    tableView.getSelectionModel().select(getTableRow().getIndex());
    tableView.edit(tableView.getSelectionModel().getSelectedIndex(), column);
    if (button.isSelected()) {
      commitEdit(true);
      button.setGraphic(onGraphic);
    } else {
      commitEdit(false);
      button.setGraphic(offGraphic);
    }
  });

}
 
Example #14
Source File: RFXTableViewTest.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Test
public void selectMultipleCells() {
    TableView<?> tableView = (TableView<?>) getPrimaryStage().getScene().getRoot().lookup(".table-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        tableView.getSelectionModel().setCellSelectionEnabled(true);
        tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        Point2D point = getPoint(tableView, 1, 1);
        RFXTableView rfxTableView = new RFXTableView(tableView, null, point, lr);
        rfxTableView.focusGained(null);
        @SuppressWarnings("rawtypes")
        TableColumn column = getTableColumnAt(tableView, 1);
        tableView.getSelectionModel().select(1, column);
        tableView.getSelectionModel().select(2, column);
        rfxTableView.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("{\"cells\":[[\"1\",\"Last\"],[\"2\",\"Last\"]]}", recording.getParameters()[0]);
}
 
Example #15
Source File: RFXTableViewTest.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Test
public void selectACell() {
    TableView<?> tableView = (TableView<?>) getPrimaryStage().getScene().getRoot().lookup(".table-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        tableView.getSelectionModel().setCellSelectionEnabled(true);
        Point2D point = getPoint(tableView, 1, 1);
        RFXTableView rfxTableView = new RFXTableView(tableView, null, point, lr);
        rfxTableView.focusGained(null);
        @SuppressWarnings("rawtypes")
        TableColumn column = getTableColumnAt(tableView, 1);
        tableView.getSelectionModel().select(1, column);
        rfxTableView.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("{\"cells\":[[\"1\",\"Last\"]]}", recording.getParameters()[0]);
}
 
Example #16
Source File: MemoryController.java    From Sword_emulator with GNU General Public License v3.0 6 votes vote down vote up
public MemoryController(TableView<MemoryBean> tableView, Machine machine,
                        Button jump, Button last, Button next, ComboBox<String> typeBox,
                        TextField addressText, int pageNum, Memory memory) {
    this.tableView = tableView;
    this.pageNum = pageNum;
    this.memoryListWrapper = new MemoryListWrapper(memory, pageNum);
    this.machine = machine;
    machine.addCpuListener(this);
    TimingRenderer.register(this);
    this.jump = jump;
    this.last = last;
    this.next = next;
    this.typeBox = typeBox;
    this.addressText = addressText;
    initView();
}
 
Example #17
Source File: EventDetectionUI.java    From SONDY with GNU General Public License v3.0 6 votes vote down vote up
public final void availabeMethodsUI(){
    initializeAvailableMethodList();
    methodDescriptionLabel = new Label("Selected method description");
    methodDescriptionLabel.setId("smalltext");
    UIUtils.setSize(methodDescriptionLabel,Main.columnWidthLEFT,24);
    VBox methodsLEFT = new VBox();
    methodsLEFT.getChildren().addAll(methodList,new Rectangle(0,3),methodDescriptionLabel);
    // Right part
    applyButton = createApplyMethodButton();
    UIUtils.setSize(applyButton, Main.columnWidthRIGHT, 24);
    parameterTable = new TableView<>();
    UIUtils.setSize(parameterTable, Main.columnWidthRIGHT, 64);
    initializeParameterTable();
    VBox methodsRIGHT = new VBox();
    methodsRIGHT.getChildren().addAll(parameterTable,new Rectangle(0,3),applyButton);
    // Both parts
    HBox methodsBOTH = new HBox(5);
    methodsBOTH.getChildren().addAll(methodsLEFT,methodsRIGHT);
    grid.add(methodsBOTH,0,2);
}
 
Example #18
Source File: RFXTableViewTest.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Test
public void selectMulpitleRows() {
    TableView<?> tableView = (TableView<?>) getPrimaryStage().getScene().getRoot().lookup(".table-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        Point2D point = getPoint(tableView, 1, 1);
        RFXTableView rfxTableView = new RFXTableView(tableView, null, point, lr);
        rfxTableView.focusGained(null);
        tableView.getSelectionModel().selectIndices(1, 3);
        rfxTableView.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("{\"rows\":[1,3]}", recording.getParameters()[0]);
}
 
Example #19
Source File: VoteResultView.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private void createCyclesTable() {
    TableGroupHeadline headline = new TableGroupHeadline(Res.get("dao.results.cycles.header"));
    GridPane.setRowIndex(headline, ++gridRow);
    GridPane.setMargin(headline, new Insets(Layout.GROUP_DISTANCE, -10, -10, -10));
    GridPane.setColumnSpan(headline, 2);
    root.getChildren().add(headline);

    cyclesTableView = new TableView<>();
    cyclesTableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.processingData")));
    cyclesTableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    createCycleColumns(cyclesTableView);

    GridPane.setRowIndex(cyclesTableView, gridRow);
    GridPane.setMargin(cyclesTableView, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, -10, -15, -10));
    GridPane.setColumnSpan(cyclesTableView, 2);
    GridPane.setVgrow(cyclesTableView, Priority.SOMETIMES);
    root.getChildren().add(cyclesTableView);

    cyclesTableView.setItems(sortedCycleListItemList);
    sortedCycleListItemList.comparatorProperty().bind(cyclesTableView.comparatorProperty());


}
 
Example #20
Source File: ColorTableCell.java    From mzmine2 with GNU General Public License v2.0 6 votes vote down vote up
public ColorTableCell(TableColumn<T, Color> column) {
    colorPicker = new ColorPicker();
    colorPicker.editableProperty().bind(column.editableProperty());
    colorPicker.disableProperty().bind(column.editableProperty().not());
    colorPicker.setOnShowing(event -> {
        final TableView<T> tableView = getTableView();
        tableView.getSelectionModel().select(getTableRow().getIndex());
        tableView.edit(tableView.getSelectionModel().getSelectedIndex(),
                column);
    });
    colorPicker.valueProperty()
            .addListener((observable, oldValue, newValue) -> {
                commitEdit(newValue);
            });
    setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
}
 
Example #21
Source File: StateMonitorView.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private void createDetailsView() {
    TableGroupHeadline conflictTableHeadline = new TableGroupHeadline(getConflictTableHeadLine());
    GridPane.setRowIndex(conflictTableHeadline, ++gridRow);
    GridPane.setMargin(conflictTableHeadline, new Insets(Layout.GROUP_DISTANCE, -10, -10, -10));
    root.getChildren().add(conflictTableHeadline);

    conflictTableView = new TableView<>();
    conflictTableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData")));
    conflictTableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    conflictTableView.setPrefHeight(100);

    createConflictColumns();
    GridPane.setRowIndex(conflictTableView, gridRow);
    GridPane.setHgrow(conflictTableView, Priority.ALWAYS);
    GridPane.setVgrow(conflictTableView, Priority.SOMETIMES);
    GridPane.setMargin(conflictTableView, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, -10, 5, -10));
    root.getChildren().add(conflictTableView);

    conflictTableView.setItems(sortedConflictList);
}
 
Example #22
Source File: JavaFXTableViewElementTest.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Test
public void selectAllRows() {
    TableView<?> tableViewNode = (TableView<?>) getPrimaryStage().getScene().getRoot().lookup(".table-view");
    Platform.runLater(() -> {
        tableViewNode.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        tableView.marathon_select("all");
    });
    new Wait("Wating for rows to be select.") {
        @Override
        public boolean until() {
            return tableViewNode.getSelectionModel().getSelectedIndices().size() > 1;
        }
    };
}
 
Example #23
Source File: JavaFXTableCellElement.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public String getViewColumnName() {
    String columnName = getColumnName((TableView<?>) parent.getComponent(), viewColumn);
    if (columnName == null) {
        return "" + (viewColumn + 1);
    }
    return columnName;
}
 
Example #24
Source File: AttributeNodeProvider.java    From constellation with Apache License 2.0 5 votes vote down vote up
public AttributeNodeProvider() {
    schemaLabel = new Label(SeparatorConstants.HYPHEN);
    schemaLabel.setPadding(new Insets(5));
    attributeInfo = FXCollections.observableArrayList();
    table = new TableView<>();
    table.setItems(attributeInfo);
    table.setPlaceholder(new Label("No schema available"));
}
 
Example #25
Source File: SetAction.java    From MythRedisClient with Apache License 2.0 5 votes vote down vote up
public SetAction(TableView dataTable,
                  TableColumn rowColumn, TableColumn keyColumn, TableColumn valueColumn) {
    this.dataTable = dataTable;
    this.rowColumn = rowColumn;
    this.keyColumn = keyColumn;
    this.valueColumn = valueColumn;
}
 
Example #26
Source File: LockedView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void initialize() {
    dateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.dateTime")));
    detailsColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.details")));
    addressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address")));
    balanceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.balanceWithCur", Res.getBaseCurrencyCode())));

    tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    tableView.setPlaceholder(new AutoTooltipLabel(Res.get("funds.locked.noFunds")));

    setDateColumnCellFactory();
    setDetailsColumnCellFactory();
    setAddressColumnCellFactory();
    setBalanceColumnCellFactory();

    addressColumn.setComparator(Comparator.comparing(LockedListItem::getAddressString));
    detailsColumn.setComparator(Comparator.comparing(o -> o.getTrade().getId()));
    balanceColumn.setComparator(Comparator.comparing(LockedListItem::getBalance));
    dateColumn.setComparator(Comparator.comparing(o -> getTradable(o).map(Tradable::getDate).orElse(new Date(0))));
    tableView.getSortOrder().add(dateColumn);
    dateColumn.setSortType(TableColumn.SortType.DESCENDING);

    balanceListener = new BalanceListener() {
        @Override
        public void onBalanceChanged(Coin balance, Transaction tx) {
            updateList();
        }
    };
    openOfferListChangeListener = c -> updateList();
    tradeListChangeListener = c -> updateList();
}
 
Example #27
Source File: RFXTableViewTest.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Test
public void selectNoCells() {
    TableView<?> tableView = (TableView<?>) getPrimaryStage().getScene().getRoot().lookup(".table-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        tableView.getSelectionModel().setCellSelectionEnabled(true);
        RFXTableView rfxTableView = new RFXTableView(tableView, null, null, lr);
        tableView.getSelectionModel().clearSelection();
        rfxTableView.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("", recording.getParameters()[0]);
}
 
Example #28
Source File: ProposalResultsWindow.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private GridPane createVotesTable() {
    GridPane votesGridPane = new GridPane();
    votesGridPane.setHgap(5);
    votesGridPane.setVgap(5);
    votesGridPane.setPadding(new Insets(15));

    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.RIGHT);
    columnConstraints1.setHgrow(Priority.ALWAYS);
    votesGridPane.getColumnConstraints().addAll(columnConstraints1);

    int gridRow = 0;

    TableGroupHeadline votesTableHeader = new TableGroupHeadline(Res.get("dao.results.proposals.voting.detail.header"));
    GridPane.setRowIndex(votesTableHeader, gridRow);
    GridPane.setMargin(votesTableHeader, new Insets(8, 0, 0, 0));
    GridPane.setColumnSpan(votesTableHeader, 2);
    votesGridPane.getChildren().add(votesTableHeader);

    TableView<VoteListItem> votesTableView = new TableView<>();
    votesTableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData")));
    votesTableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    createColumns(votesTableView);
    GridPane.setRowIndex(votesTableView, gridRow);
    GridPane.setMargin(votesTableView, new Insets(Layout.FIRST_ROW_DISTANCE, 0, 0, 0));
    GridPane.setColumnSpan(votesTableView, 2);
    GridPane.setVgrow(votesTableView, Priority.ALWAYS);
    votesGridPane.getChildren().add(votesTableView);

    votesTableView.setItems(sortedVotes);

    addCloseButton(votesGridPane, ++gridRow);

    return votesGridPane;
}
 
Example #29
Source File: TableSelectListener.java    From Animu-Downloaderu with MIT License 5 votes vote down vote up
private void delete(TableView<DownloadInfo> view, DownloadInfo info) {
	Platform.runLater(() -> {
		view.getItems().remove(info);
		manager.cancel(info);
		manager.remove(info);
		view.refresh();
	});
}
 
Example #30
Source File: RFXTableView.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public String _getText() {
    TableView<?> tableView = (TableView<?>) node;
    if (row != -1 && column != -1) {
        TableCell<?, ?> tableCell = getCellAt(tableView, row, column);
        if (tableCell != null) {
            return tableCell.getText();
        }
    }
    return getSelection((TableView<?>) getComponent());
}