當前位置: 首頁>>代碼示例>>Java>>正文


Java TableRow類代碼示例

本文整理匯總了Java中javafx.scene.control.TableRow的典型用法代碼示例。如果您正苦於以下問題:Java TableRow類的具體用法?Java TableRow怎麽用?Java TableRow使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TableRow類屬於javafx.scene.control包,在下文中一共展示了TableRow類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPoint

import javafx.scene.control.TableRow; //導入依賴的package包/類
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;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:23,代碼來源:JavaFXElementPropertyAccessor.java

示例2: VarsPanel

import javafx.scene.control.TableRow; //導入依賴的package包/類
public VarsPanel(AppSession session) {
    this.session = session;        
    table = new TableView();
    table.setPrefWidth(300);
    table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    setCenter(table);
    TableColumn nameCol = new TableColumn("Variable");
    nameCol.setMinWidth(120);
    nameCol.setMaxWidth(250);
    nameCol.setCellValueFactory(new PropertyValueFactory("name"));
    nameCol.setCellFactory(c -> new StringTooltipCell());
    TableColumn typeCol = new TableColumn("Type");
    typeCol.setMinWidth(45);
    typeCol.setMaxWidth(60);
    typeCol.setCellValueFactory(new PropertyValueFactory("type"));
    TableColumn<Var, ScriptValue> valueCol = new TableColumn("Value");
    valueCol.setCellValueFactory(c -> new ReadOnlyObjectWrapper(c.getValue().getValue()));        
    valueCol.setCellFactory(c -> new VarValueCell());
    table.getColumns().addAll(nameCol, typeCol, valueCol);
    table.setItems(session.getVars());
    table.setRowFactory(tv -> {
        TableRow<Var> row = new TableRow<>();
        row.setOnMouseClicked(e -> {
            if (e.getClickCount() == 2 && !row.isEmpty()) {
                Var var = row.getItem();
                session.logVar(var);
            }
        });
        return row ;
    });        
}
 
開發者ID:intuit,項目名稱:karate,代碼行數:32,代碼來源:VarsPanel.java

示例3: getVisibleCellAt

import javafx.scene.control.TableRow; //導入依賴的package包/類
public TableCell<?, ?> getVisibleCellAt(TableView<?> tableView, int row, int column) {
    Set<Node> lookupAll = getTableCells(tableView);
    TableCell<?, ?> cell = null;
    for (Node node : lookupAll) {
        TableCell<?, ?> cell1 = (TableCell<?, ?>) node;
        TableRow<?> tableRow = cell1.getTableRow();
        TableColumn<?, ?> tableColumn = cell1.getTableColumn();
        if (tableRow.getIndex() == row && tableColumn == tableView.getColumns().get(column)) {
            cell = cell1;
            break;
        }
    }
    if (cell != null) {
        return cell;
    }
    return null;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:18,代碼來源:JavaFXElementPropertyAccessor.java

示例4: updateItem

import javafx.scene.control.TableRow; //導入依賴的package包/類
@Override
@SuppressWarnings("unchecked") 
protected void updateItem(String item, boolean empty) {
	super.updateItem(item, empty);
	if (!empty) {
		TableView<DesignVariable> tv = getTableView();
		TableRow<DesignVariable> tr = getTableRow();
		if ((tv != null) && (tr != null))  {
			if (tv.getItems().get(getTableRow().getIndex()).isOutput()) {
				setTextFill(Color.BLUE);
			} else if (tv.getItems().get(getTableRow().getIndex()).getValue().equals("INVALID")) {
				setTextFill(Color.ORANGE);
			} else {
				setTextFill(Color.GREEN);
			}
		} else {
			setTextFill(Color.YELLOW);
		}
		setText(item);
	} else {
		setText("");
	}
}
 
開發者ID:nasa,項目名稱:OpenVSP3Plugin,代碼行數:24,代碼來源:DesignVariableTableCell.java

示例5: recomputeVisibleIndexes

import javafx.scene.control.TableRow; //導入依賴的package包/類
private void recomputeVisibleIndexes() {
    firstIndex = -1;
    lastIndex = -1;

    // Work out which of the rows are visible
    double tblViewHeight = tableView.getHeight();
    double headerHeight = tableView.lookup(".column-header-background").getBoundsInLocal().getHeight();
    double viewPortHeight = tblViewHeight - headerHeight;
    for(TableRow<T> r : rows) {
        double minY = r.getBoundsInParent().getMinY();
        double maxY = r.getBoundsInParent().getMaxY();

        boolean hidden  = (maxY < 0) || (minY > viewPortHeight);
        // boolean fullyVisible = !hidden && (maxY <= viewPortHeight) && (minY >= 0);
        if (!hidden) {
            if (firstIndex < 0 || r.getIndex() < firstIndex) {
                firstIndex = r.getIndex();
            }
            if (lastIndex < 0 || r.getIndex() > lastIndex) {
                lastIndex = r.getIndex();
            }
        }
    }
}
 
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:25,代碼來源:TableViewExt.java

示例6: initTableRowFactory

import javafx.scene.control.TableRow; //導入依賴的package包/類
private void initTableRowFactory() {
	setRowFactory(facotry -> {
		final TableRow<SampServer> row = new TableRow<>();

		row.setOnMouseClicked(clicked -> {
			// A row has been clicked, so we want to hide the previous context menu
			contextMenu.hide();

			if (Objects.nonNull(row.getItem())) {
				// If there is an item in this row, we want to proceed further
				handleClick(row, clicked);
			} else {
				// Otherwise we clear the selection.
				getSelectionModel().clearSelection();
			}
		});

		return row;
	});
}
 
開發者ID:Bios-Marcel,項目名稱:ServerBrowser,代碼行數:21,代碼來源:SampServerTable.java

示例7: call

import javafx.scene.control.TableRow; //導入依賴的package包/類
@Override
public TableRow call(TableView param) {
    TableRow row = new TableRow();

    row.itemProperty().addListener(new ChangeListener() {
        @Override
        public void changed(ObservableValue observable, Object oldValue, Object newValue) {
            updateRowStyle(row);
        }
    });

    rowsToHighlight.addListener(new ListChangeListener<Integer>() {
        @Override
        public void onChanged(ListChangeListener.Change<? extends Integer> c) {
            updateRowStyle(row);
        }
    });

    return row;
}
 
開發者ID:exalt-tech,項目名稱:trex-stateless-gui,代碼行數:21,代碼來源:ImportedPacketTableView.java

示例8: shouldSinglePrimaryClickOnCellTrackInPlaylist

import javafx.scene.control.TableRow; //導入依賴的package包/類
@Test
public void shouldSinglePrimaryClickOnCellTrackInPlaylist() {
    TableCell<TrackTableModel, String> tableCell = cellFactory.call(new TableColumn<>());
    tableCell.setItem("trackId");

    Track track = new Track("123", "Artist Name", "Artist Image", "456", "Album Name", "Album Image", 2000, "789",
        "Track Name", 1, "Location", true, Arrays.asList("Genre 1", "Genre 2"));
    track.setPlaylistId(999);
    TrackTableModel trackTableModel = new TrackTableModel(track);

    @SuppressWarnings("unchecked")
    TableRow<TrackTableModel> mockTableRow = (TableRow<TrackTableModel>)mock(TableRow.class);
    when(mockTableRow.getItem()).thenReturn(trackTableModel);

    ReflectionTestUtils.invokeMethod(tableCell, "setTableRow", mockTableRow);

    when(mockPlaylistManager.isTrackInPlaylist(anyInt(), anyString())).thenReturn(true);

    tableCell.onMouseClickedProperty().get()
        .handle(getMouseEvent(MouseEvent.MOUSE_CLICKED, MouseButton.PRIMARY, 1));

    verify(mockPlaylistManager, never()).addTrackToPlaylist(PLAYLIST_ID_FAVOURITES, track);
    verify(mockPlaylistManager, times(1)).removeTrackFromPlaylist(PLAYLIST_ID_FAVOURITES, track);
    verify(getMockEventManager(), times(1)).fireEvent(Event.PLAYLIST_CONTENT_UPDATED, track.getPlaylistId());
}
 
開發者ID:mpcontracting,項目名稱:rpmjukebox,代碼行數:26,代碼來源:LoveButtonTableCellFactoryTest.java

示例9: shouldSinglePrimaryClickOnCellTrackNotInPlaylist

import javafx.scene.control.TableRow; //導入依賴的package包/類
@Test
public void shouldSinglePrimaryClickOnCellTrackNotInPlaylist() {
    TableCell<TrackTableModel, String> tableCell = cellFactory.call(new TableColumn<>());
    tableCell.setItem("trackId");

    Track track = new Track("123", "Artist Name", "Artist Image", "456", "Album Name", "Album Image", 2000, "789",
        "Track Name", 1, "Location", true, Arrays.asList("Genre 1", "Genre 2"));
    track.setPlaylistId(999);
    TrackTableModel trackTableModel = new TrackTableModel(track);

    @SuppressWarnings("unchecked")
    TableRow<TrackTableModel> mockTableRow = (TableRow<TrackTableModel>)mock(TableRow.class);
    when(mockTableRow.getItem()).thenReturn(trackTableModel);

    ReflectionTestUtils.invokeMethod(tableCell, "setTableRow", mockTableRow);

    when(mockPlaylistManager.isTrackInPlaylist(anyInt(), anyString())).thenReturn(false);

    tableCell.onMouseClickedProperty().get()
        .handle(getMouseEvent(MouseEvent.MOUSE_CLICKED, MouseButton.PRIMARY, 1));

    verify(mockPlaylistManager, times(1)).addTrackToPlaylist(PLAYLIST_ID_FAVOURITES, track);
    verify(mockPlaylistManager, never()).removeTrackFromPlaylist(PLAYLIST_ID_FAVOURITES, track);
    verify(getMockEventManager(), times(1)).fireEvent(Event.PLAYLIST_CONTENT_UPDATED, track.getPlaylistId());
}
 
開發者ID:mpcontracting,項目名稱:rpmjukebox,代碼行數:26,代碼來源:LoveButtonTableCellFactoryTest.java

示例10: moveDataWithAnimation

import javafx.scene.control.TableRow; //導入依賴的package包/類
private void moveDataWithAnimation(final TableView<Person> sourceTable,
		final TableView<Person> destinationTable,
		final Pane commonTableAncestor, final TableRow<Person> row) {
	// Create imageview to display snapshot of row:
	final ImageView imageView = createImageView(row);
	// Start animation at current row:
	final Point2D animationStartPoint = row.localToScene(new Point2D(0, 0)); // relative to Scene
	final Point2D animationEndPoint = computeAnimationEndPoint(destinationTable); // relative to Scene
	// Set start location
	final Point2D startInRoot = commonTableAncestor.sceneToLocal(animationStartPoint); // relative to commonTableAncestor
	imageView.relocate(startInRoot.getX(), startInRoot.getY());
	// Create animation
	final Animation transition = createAndConfigureAnimation(
			sourceTable, destinationTable, commonTableAncestor, row,
			imageView, animationStartPoint, animationEndPoint);
	// add animated image to display
	commonTableAncestor.getChildren().add(imageView);
	// start animation
	transition.play();
}
 
開發者ID:mars-sim,項目名稱:mars-sim,代碼行數:21,代碼來源:AnimatedTableRow.java

示例11: call

import javafx.scene.control.TableRow; //導入依賴的package包/類
@Override
public TableRow<EditableTableRowItem> call(TableView<EditableTableRowItem> p) {
  final TableRow<EditableTableRowItem> row = new TableRow<EditableTableRowItem>() {
    @Override
    protected void updateItem(EditableTableRowItem entityWrapper, boolean empty) {
      super.updateItem(entityWrapper, empty);
      if (!empty && entityWrapper != null && entityWrapper.getIsSummary()) {
        if (!getStyleClass().contains("summaryRow")) {
          getStyleClass().add("summaryRow");
        }
      } else {
        getStyleClass().removeAll(Collections.singleton("summaryRow"));
      }
    }
  };
  return row;
}
 
開發者ID:gaborfeher,項目名稱:grantmaster,代碼行數:18,代碼來源:SummaryHighlighterRowFactory.java

示例12: setTableContextMenu

import javafx.scene.control.TableRow; //導入依賴的package包/類
private void setTableContextMenu()
{
	tableTrace.setRowFactory(param ->
	{
		TableRow<TraceLineInfo> row = new TableRow<>();

		MenuItem moreGeoIPInfo = new MenuItem("  Show GeoIP results from multiple sources");
		moreGeoIPInfo.setOnAction(event9 -> Main.openInBrowser(GeoIPResolver.getSecondaryGeoIpPrefix() + row.getItem().ipAddressProperty().get()));
		
		Menu copyMenu = generateCopyMenu(row);
		
		ContextMenu rowMenu = new ContextMenu(moreGeoIPInfo, copyMenu);
		
		row.contextMenuProperty().bind(Bindings.when(Bindings.isNotNull(row.itemProperty())).then(rowMenu).otherwise((ContextMenu) null));
		
		return row;
	});
}
 
開發者ID:ck3ck3,項目名稱:WhoWhatWhere,代碼行數:19,代碼來源:VisualTraceController.java

示例13: SpinnerTableCell

import javafx.scene.control.TableRow; //導入依賴的package包/類
public SpinnerTableCell(TableColumn<T, Integer> column, int min, int max) {

    spinner = new Spinner<>(min, max, 1);

    spinner.editableProperty().bind(column.editableProperty());
    spinner.disableProperty().bind(column.editableProperty().not());

    tableRowProperty().addListener(e -> {
      TableRow<?> row = getTableRow();
      if (row == null)
        return;
      MsSpectrumDataSet dataSet = (MsSpectrumDataSet) row.getItem();
      if (dataSet == null)
        return;
      spinner.getValueFactory().valueProperty().bindBidirectional(dataSet.lineThicknessProperty());
      disableProperty().bind(dataSet.renderingTypeProperty().isEqualTo(MsSpectrumType.CENTROIDED));

    });
  }
 
開發者ID:mzmine,項目名稱:mzmine3,代碼行數:20,代碼來源:SpinnerTableCell.java

示例14: SpinnerTableCell

import javafx.scene.control.TableRow; //導入依賴的package包/類
public SpinnerTableCell(TableColumn<T, Integer> column, int min, int max) {

    spinner = new Spinner<>(min, max, 1);

    spinner.editableProperty().bind(column.editableProperty());
    spinner.disableProperty().bind(column.editableProperty().not());

    tableRowProperty().addListener(e -> {
      TableRow<?> row = getTableRow();
      if (row == null)
        return;
      ChromatogramPlotDataSet dataSet = (ChromatogramPlotDataSet) row.getItem();
      if (dataSet == null)
        return;
      spinner.getValueFactory().valueProperty().bindBidirectional(dataSet.lineThicknessProperty());

    });
  }
 
開發者ID:mzmine,項目名稱:mzmine3,代碼行數:19,代碼來源:SpinnerTableCell.java

示例15: call

import javafx.scene.control.TableRow; //導入依賴的package包/類
@Override
public TableRow<File> call(TableView<File> param) {
    TableRow<File> row = new TableRow<>();
    row.setOnMousePressed(event -> {
        if (event.isPrimaryButtonDown() && event.getClickCount() == 2 && !row.isEmpty()) {
            File recentProject = row.getItem();
            if (recentProject.exists()) {
                DataService.getInstance().loadProject(recentProject);
                if (controller.getView().getStage().isShowing()) {
                    controller.getView().getStage().close(); //закрываем стартовое окно
                }
            } else {
                Alert alert = new Alert(Alert.AlertType.ERROR, "File does not exist");
                alert.showAndWait();
                RecentProjectsController.getInstance().removeRecentProject(recentProject);
                SettingsManager.getInstance().writeRecentProjects(RecentProjectsController.getInstance().getRecentProjects());
            }
        }
    });
    return row;
}
 
開發者ID:khasang,項目名稱:Cachoeira,代碼行數:22,代碼來源:RecentProjectsRowFactory.java


注:本文中的javafx.scene.control.TableRow類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。