当前位置: 首页>>代码示例>>Java>>正文


Java ObservableList.set方法代码示例

本文整理汇总了Java中javafx.collections.ObservableList.set方法的典型用法代码示例。如果您正苦于以下问题:Java ObservableList.set方法的具体用法?Java ObservableList.set怎么用?Java ObservableList.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.collections.ObservableList的用法示例。


在下文中一共展示了ObservableList.set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handle

import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Override
public void handle(CellEditEvent<Pair<String, String>, String> event)
{
	ObservableList<Pair<String, String>> deviceList = tblMapDevice.getItems();
	Pair<String, String> pair = event.getRowValue();
	
	int index = deviceList.indexOf(pair);
	
	deviceList.set(index, new Pair<String, String>(pair.first, event.getNewValue()));
}
 
开发者ID:tengai650,项目名称:SnapDup,代码行数:11,代码来源:MapDeviceDialog.java

示例2: replaceElementsTest

import javafx.collections.ObservableList; //导入方法依赖的package包/类
@Test
public void replaceElementsTest()
{
    final ObservableList<Model> collection1 = FXCollections.observableArrayList(new Model("value1"),
                                                                                new Model("value2"),
                                                                                new Model("value3"),
                                                                                new Model("value4"));
    final ObservableList<String> collection2 = FXCollections.observableArrayList();

    IFXContentBinding.bind(collection2, collection1, Model::getText);

    final AtomicReference<ListChangeListener.Change<? extends String>> change = new AtomicReference<>(null);
    collection2.addListener((ListChangeListener<String>) c -> {
        change.set(c);
    });

    collection1.set(1, new Model("value2bis"));

    assertNotNull("Change event", change.get());
    assertTrue("Has change", change.get().next());
    assertTrue("Was added", change.get().wasAdded());
    assertTrue("Was removed", change.get().wasRemoved());
    assertFalse("Was update", change.get().wasUpdated());
    assertFalse("Was permuted", change.get().wasPermutated());
    assertEquals("from", 1, change.get().getFrom());
    assertEquals("to", 2, change.get().getTo());
    assertEquals("Added sub-list", Arrays.asList("value2bis"), change.get().getAddedSubList());
    assertEquals("Removed", Arrays.asList("value2"), change.get().getRemoved());
    assertFalse("Has more change", change.get().next());

    assertEquals(Arrays.asList("value1", "value2bis", "value3", "value4"), collection2);
}
 
开发者ID:ben12,项目名称:infxnity,代码行数:33,代码来源:IFXContentBindingTest.java

示例3: initProcessTable

import javafx.collections.ObservableList; //导入方法依赖的package包/类
private void initProcessTable() {
    ObservableList<TableColumn<Process, ?>> processCols = processTable.getColumns();
    processCols.get(0).setCellValueFactory(new PropertyValueFactory<>("status"));
    TableColumn<Process,Double> processCol = new TableColumn<>("进度");
    processCol.setPrefWidth(475);
    processCol.setCellValueFactory(new PropertyValueFactory<>("progress"));
    processCol.setCellFactory(ProgressBarTableCell.forTableColumn());
    processCols.set(1,processCol);
    processCols.get(2).setCellValueFactory(new PropertyValueFactory<>("percent"));
    processCols.get(3).setCellValueFactory(new PropertyValueFactory<>("lastUpdate"));
}
 
开发者ID:cuiods,项目名称:WIFIProbe,代码行数:12,代码来源:IndexController.java

示例4: addEditLabelsPane

import javafx.collections.ObservableList; //导入方法依赖的package包/类
/**
 * Sets up the editable ListView to edit the labels/items we want to see in
 * the comboboxes on the main screen.
 */
private void addEditLabelsPane() {
    labelsList = new ListView<>();
    // first set up the listview with empty labels in order to allow editing
    ObservableList<String> itemsLabelsList = FXCollections
            .observableArrayList("", "", "", "", "");
    
    // get the labels from the database and store them in the listview
    ArrayList<String> labelStrings = getLabels();
    // add items starting at the top
    for (int i = 0; i < labelStrings.size(); i++) {
        itemsLabelsList.set(i, labelStrings.get(i));
    }
    
    // set a CellFactory on the listview to be able make the cells editable
    // using setEditable(true) isn't enough
    labelsList.setCellFactory(TextFieldListCell.forListView());
    labelsList.setEditable(true);
    
    // give the listview an id (FXML) so we can look it up by its id, and
    // toggle the visibility
    labelsList.setId("labelsListView");
    labelsList.setItems(itemsLabelsList);
    labelsList.setVisible(false);
    // "magik numbers" are figured out by observations
    labelsList.setPrefWidth(120);
    labelsList
            .setPrefHeight((LISTVIEW_ROW_HEIGHT * MAX_NUMBER_LABELS) + 18);
    
    // position the listview in the settings pane
    GridPane.setColumnIndex(labelsList, 1);
    GridPane.setRowIndex(labelsList, 0);
    GridPane.setRowSpan(labelsList, 2);
    
    // when editing a label in the listview, update the value
    // in the database and setup the main gridpane with the new items in the
    // comboboxes
    labelsList.setOnEditCommit(event -> {
        labelsList.getItems().set(event.getIndex(), event.getNewValue());
        updateLabel(event.getIndex(), event.getNewValue());
        controller.setupGridPane(controller.focusDay);
    });
    
    editLabelsPane.getChildren().add(labelsList);
}
 
开发者ID:deltadak,项目名称:plep,代码行数:49,代码来源:SlidingSettingsPane.java


注:本文中的javafx.collections.ObservableList.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。