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


Java CellEditEvent类代码示例

本文整理汇总了Java中javafx.scene.control.TableColumn.CellEditEvent的典型用法代码示例。如果您正苦于以下问题:Java CellEditEvent类的具体用法?Java CellEditEvent怎么用?Java CellEditEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: initializeParameterTable

import javafx.scene.control.TableColumn.CellEditEvent; //导入依赖的package包/类
public final void initializeParameterTable(){
    parameterTable.setEditable(true);
    TableColumn keyColumn = new TableColumn("Parameter");
    keyColumn.setMinWidth(Main.columnWidthRIGHT/2-1);
    keyColumn.setCellValueFactory(new PropertyValueFactory<>("name"));
    TableColumn valueColumn = new TableColumn("Value");
    valueColumn.setMinWidth(Main.columnWidthRIGHT/2-1);
    valueColumn.setCellFactory(TextFieldTableCell.forTableColumn());
    valueColumn.setCellValueFactory(new PropertyValueFactory<>("value")); 
    valueColumn.setOnEditCommit(
        new EventHandler<CellEditEvent<Parameter, String>>() {
            @Override
            public void handle(CellEditEvent<Parameter, String> t) {
                ((Parameter) t.getTableView().getItems().get(t.getTablePosition().getRow())).setValue(t.getNewValue());
            }
        }
    );
    parameterTable.getColumns().addAll(keyColumn,valueColumn);
}
 
开发者ID:AdrienGuille,项目名称:SONDY,代码行数:20,代码来源:EventDetectionUI.java

示例2: commitEdit

import javafx.scene.control.TableColumn.CellEditEvent; //导入依赖的package包/类
@Override
	public void commitEdit(T item) {

		if (!isEditing() && !item.equals(getItem())) {
			TableView<S> table = getTableView();
			if (table != null) {
				TableColumn<S, T> column = getTableColumn();

//				S dvo = getTableView().getItems().get(getIndex());
//				if (!CommonConst._STATUS_CREATE.equals(dvo.get_status())) {
//					dvo.set_status(CommonConst._STATUS_UPDATE);
//				}
				// ObservableValue<T> ov = column.getCellObservableValue(dvo);
				// if (ov instanceof WritableValue) {
				// ((WritableValue) ov).setValue(item);
				// }
				CellEditEvent<S, T> event = new CellEditEvent<>(table, new TablePosition<S, T>(table, getIndex(), column),
						TableColumn.editCommitEvent(), item);
				Event.fireEvent(column, event);
			}
		}
		super.commitEdit(item);
		getTableView().refresh();
	}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:25,代码来源:TableEditCell.java

示例3: addCol

import javafx.scene.control.TableColumn.CellEditEvent; //导入依赖的package包/类
private void addCol() {
    TableColumn tc = new TableColumn();
    tc.setEditable(true);
    tc.setCellValueFactory(param -> {
        CellDataFeatures<ZRow, String> dtf = (CellDataFeatures<ZRow, String>) param;
        return new SimpleStringProperty(dtf.getValue().getRow().get(0));
    });

    tc.setCellFactory(TextFieldTableCell.forTableColumn());
    tc.setOnEditCommit(t -> {
        CellEditEvent<ZRow, String> evt = (CellEditEvent<ZRow, String>) t;
        List<String> row = evt.getTableView().getItems().get(evt.getTablePosition().getRow()).getRow();
        row.set(evt.getTablePosition().getColumn(), evt.getNewValue());
    });
    tc.setPrefWidth(150);
    TextField txf = new TextField();
    txf.setPrefWidth(150);
    txf.setPromptText(Configuration.getBundle().getString("ui.dialog.table_editor.colon") +
            (tableView.getColumns().size()+1));
    tc.setGraphic(txf);
    tableView.getColumns().addAll(tc);
    postAddColumn();
}
 
开发者ID:firm1,项目名称:zest-writer,代码行数:24,代码来源:TableController.java

示例4: initializeTable

import javafx.scene.control.TableColumn.CellEditEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void initializeTable () {
    this.setEditable(true);
    this.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    
    TableColumn<IVariable, String> nameColumn = new TableColumn<IVariable, String>("Name");
    TableColumn<IVariable, Double> valueColumn = new TableColumn<IVariable, Double>("Value");
    
    // set where to read values from
    nameColumn.setCellValueFactory(new PropertyValueFactory<IVariable, String>("name"));
    valueColumn.setCellValueFactory(new PropertyValueFactory<IVariable, Double>("value"));
    
    // set editable column (valueColumn)
    valueColumn.setCellFactory(TextFieldTableCell
            .<IVariable, Double> forTableColumn(new DoubleStringConverter()));
    
    // Set listener to execute when on edit commit runs
    valueColumn.setOnEditCommit( (CellEditEvent<IVariable, Double> event) -> setVariableValue(event));
    valueColumn.setEditable(true);

    this.getColumns().addAll(nameColumn, valueColumn);
}
 
开发者ID:adisrini,项目名称:slogo,代码行数:23,代码来源:Variables.java

示例5: initializeTable

import javafx.scene.control.TableColumn.CellEditEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void initializeTable () {
    this.setEditable(true);
    this.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
    
    TableColumn<Object, String> nameColumn = new TableColumn<Object, String>("Name");
    TableColumn<Object, Double> valueColumn = new TableColumn<Object, Double>("Value");
    
    // set where to read values from
    nameColumn.setCellValueFactory(new PropertyValueFactory<Object, String>("name"));
    valueColumn.setCellValueFactory(new PropertyValueFactory<Object, Double>("value"));
    
    // set editable column (valueColumn)
    valueColumn.setCellFactory(TextFieldTableCell.<Object, Double> forTableColumn(new DoubleStringConverter()));
    
    // Set listener to execute when on edit commit runs
    valueColumn.setOnEditCommit( (CellEditEvent<Object, Double> event) -> setVariableValue(event));
    valueColumn.setEditable(true);

    this.getColumns().addAll(nameColumn, valueColumn);
}
 
开发者ID:adisrini,项目名称:slogo,代码行数:22,代码来源:TableWindow.java

示例6: ColumnFilter

import javafx.scene.control.TableColumn.CellEditEvent; //导入依赖的package包/类
public ColumnFilter(TableFilter<S> tablefilter, TableColumn<S, T> columnToFilter) {
	super();
	this.tableFilter = tablefilter;
	this.column = columnToFilter;
	EventHandler<CellEditEvent<S, T>> editCommitHandler = this.column.getOnEditCommit();
	this.column.setOnEditCommit(event -> {
		editCommitHandler.handle(event);
		updateCellValues();
	});

	// set custom header
	header = new FilteredColumnHeader(column);
	header.prefWidthProperty().bind(column.widthProperty());
	header.getFilterButton().setOnMouseClicked(this::onFilterButtonClicked);
	header.isFilteredProperty().bind(blacklistedCellValues.emptyProperty().not());
	column.setGraphic(header);

	filterPopup = new FilterPopUp<>(mergedCellValues, blacklistedCellValues);
	blacklistedCellValues.addListener(this::onBlacklistedCellValuesChanged);
	initColumnFilter();
}
 
开发者ID:maimArt,项目名称:TableFilterFX,代码行数:22,代码来源:ColumnFilter.java

示例7: commitEdit

import javafx.scene.control.TableColumn.CellEditEvent; //导入依赖的package包/类
/** {@inheritDoc} */
 @Override
 public void commitEdit(T newValue) {
     if (!isEditing())
         return;
     final TableView < S > table = getTableView();
     if (table != null) {
         // Inform the TableView of the edit being ready to be committed.
         @SuppressWarnings({ "rawtypes", "unchecked" })
CellEditEvent editEvent = new CellEditEvent(table, tablePos,
             TableColumn.editCommitEvent(), newValue);
         Event.fireEvent(getTableColumn(), editEvent);
     }
     // we need to setEditing(false):
     super.cancelEdit(); // this fires an invalid EditCancelEvent.
     // update the item within this cell, so that it represents the new value
     updateItem(newValue, false);
     if (table != null) {
         // reset the editing cell on the TableView
         table.edit(-1, null);
     }
 }
 
开发者ID:relinc,项目名称:SurePulseDataProcessor,代码行数:23,代码来源:EditCell.java

示例8: commitEdit

import javafx.scene.control.TableColumn.CellEditEvent; //导入依赖的package包/类
@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);
}
 
开发者ID:torakiki,项目名称:pdfsam,代码行数:20,代码来源:TooltippedTextFieldTableCell.java

示例9: onTaskNameEditCommit

import javafx.scene.control.TableColumn.CellEditEvent; //导入依赖的package包/类
private void onTaskNameEditCommit(CellEditEvent<ObservableGanttTask, String> event) {
	if(event.getOldValue().equals(event.getNewValue())) {
		event.consume();
		return;
	}
	event.getRowValue().setName(event.getNewValue());
	//onEditCommit(event); // TODO maybe not necessary to propagate name change
}
 
开发者ID:vibridi,项目名称:qgu,代码行数:9,代码来源:TaskTableView.java

示例10: onStartDateEditCommit

import javafx.scene.control.TableColumn.CellEditEvent; //导入依赖的package包/类
private void onStartDateEditCommit(CellEditEvent<ObservableGanttTask, String> event) {
	if(event.getOldValue().equals(event.getNewValue())) {
		event.consume();
		return;
	}
	event.getRowValue().setStartDate(event.getNewValue());
	onEditCommit(event);
}
 
开发者ID:vibridi,项目名称:qgu,代码行数:9,代码来源:TaskTableView.java

示例11: onEndDateEditCommit

import javafx.scene.control.TableColumn.CellEditEvent; //导入依赖的package包/类
private void onEndDateEditCommit(CellEditEvent<ObservableGanttTask, String> event) {
	if(event.getOldValue().equals(event.getNewValue())) {
		event.consume();
		return;
	}
	event.getRowValue().setEndDate(event.getNewValue());
	onEditCommit(event);
}
 
开发者ID:vibridi,项目名称:qgu,代码行数:9,代码来源:TaskTableView.java

示例12: handle

import javafx.scene.control.TableColumn.CellEditEvent; //导入依赖的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

示例13: createTableColumn

import javafx.scene.control.TableColumn.CellEditEvent; //导入依赖的package包/类
public TableColumn<TTRow, String> createTableColumn(String name, String input, TruthTable m) {
	TableColumn<TTRow, String> tc = new TableColumn<TTRow, String>(name);
	tc.setMinWidth((tableSize / (tt.getInputs().size() + 1)) + 1);
	tc.setMaxWidth((tableSize / (tt.getInputs().size() + 1)) + 1);
	tc.setCellValueFactory(new PropertyValueFactory<>(input));

	if (input.equals("4")) {
		if (!tt.isTrue() && m==tt) {

			tc.setCellFactory(TextFieldTableCell.forTableColumn());
			tc.setOnEditCommit(new EventHandler<CellEditEvent<TTRow, String>>() {
				TableView<TTRow> old = tableV1;

				public void handle(CellEditEvent<TTRow, String> t) {

					if (t.getNewValue().equals("1") || t.getNewValue().equals("0")) {
						System.out.println(t.getOldValue());
						((TTRow) t.getTableView().getItems().get(t.getTablePosition().getRow())).getCol()[t
						                                                                                  .getTablePosition().getColumn()] = t.getNewValue();
						tt.edit(t.getTablePosition().getColumn(), t.getTablePosition().getRow(), t.getNewValue());
						updatetableV2();
						kmap.drawKMap(tt, tt.getInputs().size(), pane, (int)(Screen.getPrimary().getVisualBounds().getWidth()/2)-(15*tt.getInputs().size()), 10);
					} else {
						tableV1 = old;
					}
					refreshTable(tableV1);
					refreshTableV2(tableV2);
				}
			});
		}
	}
	tc.getStyleClass().add("tablecolumn");
	return tc;
}
 
开发者ID:mehmetalpsumer,项目名称:boolean-simplifier-visualizer,代码行数:35,代码来源:Main.java

示例14: setVariableValue

import javafx.scene.control.TableColumn.CellEditEvent; //导入依赖的package包/类
private void setVariableValue (CellEditEvent<IVariable, Double> event) {
    IVariable changedVariable = event.getTableView().getItems().get(event.getTablePosition().getRow());
    ((Variable) changedVariable).setValue(event.getNewValue());
    
    memory.getStorageMemory().writeVariable(changedVariable.getName(), changedVariable.getValue());
    
    System.out.println(changedVariable);
}
 
开发者ID:adisrini,项目名称:slogo,代码行数:9,代码来源:Variables.java

示例15: updateObservableListProperties

import javafx.scene.control.TableColumn.CellEditEvent; //导入依赖的package包/类
/**
 * Updates view by input data.
 * @param nameCol the name column.
 */
private void updateObservableListProperties(TableColumn<SliceData, String> nameCol) {
	nameCol.setOnEditCommit(new EventHandler<CellEditEvent<SliceData, String>>() {
		@Override public void handle(CellEditEvent<SliceData, String> t) {
			((SliceData) t.getTableView().getItems().get(t.getTablePosition().getRow())).setValue(t.getNewValue());
		}
	});
}
 
开发者ID:o3project,项目名称:mlo-gui,代码行数:12,代码来源:MloCommonTable.java


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