本文整理汇总了Java中javafx.beans.property.ReadOnlyObjectWrapper类的典型用法代码示例。如果您正苦于以下问题:Java ReadOnlyObjectWrapper类的具体用法?Java ReadOnlyObjectWrapper怎么用?Java ReadOnlyObjectWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ReadOnlyObjectWrapper类属于javafx.beans.property包,在下文中一共展示了ReadOnlyObjectWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: VarsPanel
import javafx.beans.property.ReadOnlyObjectWrapper; //导入依赖的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 ;
});
}
示例2: createClassifierTable
import javafx.beans.property.ReadOnlyObjectWrapper; //导入依赖的package包/类
static <T> TableView<ClassifierResult<T>> createClassifierTable() {
TableView<ClassifierResult<T>> ret = new TableView<>();
ret.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
TableColumn<ClassifierResult<T>, String> tab0 = new TableColumn<>("name");
tab0.setCellValueFactory(data -> new ReadOnlyObjectWrapper<>(data.getValue().getClassifier().getName()));
ret.getColumns().add(tab0);
TableColumn<ClassifierResult<T>, String> tab1 = new TableColumn<>("score");
tab1.setCellValueFactory(data -> new ReadOnlyObjectWrapper<>(String.format("%.2f", data.getValue().getScore())));
ret.getColumns().add(tab1);
TableColumn<ClassifierResult<T>, Double> tab2 = new TableColumn<>("weight");
tab2.setCellValueFactory(data -> new ReadOnlyObjectWrapper<>(data.getValue().getClassifier().getWeight()));
ret.getColumns().add(tab2);
TableColumn<ClassifierResult<T>, String> tab3 = new TableColumn<>("w. score");
tab3.setCellValueFactory(data -> new ReadOnlyObjectWrapper<>(String.format("%.2f", data.getValue().getScore() * data.getValue().getClassifier().getWeight())));
ret.getColumns().add(tab3);
ret.setItems(FXCollections.observableArrayList());
return ret;
}
示例3: initialize
import javafx.beans.property.ReadOnlyObjectWrapper; //导入依赖的package包/类
@FXML
private void initialize() {
content.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
content.setRowFactory(value -> new EditTableRow());
nameColumn.setCellValueFactory((value) -> {
return new ReadOnlyObjectWrapper<>(station.getFilterName(value.getValue()));
});
summaryColumn.setCellValueFactory((value) -> {
return new ReadOnlyObjectWrapper<>(value.getValue().getSummary());
});
editColumn.setCellValueFactory((value) -> {
return new ReadOnlyObjectWrapper<>(value.getValue());
});
editColumn.setSortable(false);
editColumn.setCellFactory(value -> new TriggerRowEditCell<>());
}
示例4: initialize
import javafx.beans.property.ReadOnlyObjectWrapper; //导入依赖的package包/类
@FXML
private void initialize() {
content.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
contentPriorityColumn.setSortable(false);
contentPriorityColumn.setCellValueFactory(value -> new ReadOnlyObjectWrapper<>(value.getValue().getStation().getContexts().indexOf(value.getValue()) + 1));
nameColumn.setCellValueFactory((value) -> {
return new ReadOnlyObjectWrapper<>(value.getValue().getName());
});
summaryColumn.setCellValueFactory((value) -> {
return new ReadOnlyObjectWrapper<>(value.getValue().getSummary());
});
editColumn.setCellValueFactory((value) -> {
return new ReadOnlyObjectWrapper<>(value.getValue());
});
editColumn.setSortable(false);
editColumn.setCellFactory(value -> new TriggerRowEditCell<>());
content.setRowFactory(ControlsHelper.dragDropReorderRowFactory(content, new EditTableRow()));
content.setOnKeyPressed(keyEvent -> {
if(keyEvent.getCode() == KeyCode.DELETE) {
removeEntries();
}
});
}
示例5: init
import javafx.beans.property.ReadOnlyObjectWrapper; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void init() {
getStyleClass().add("hex-table-view");
// setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
TableColumn<Integer, String> count = new TableColumn<>("OFFSET");
count.setId("count-column");
count.setCellValueFactory(cellData -> new ReadOnlyObjectWrapper<String>(createCountItem(cellData.getValue())));
TableColumn<Integer, String> hex = new TableColumn<>("00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
hex.setId("hex-column");
hex.setCellValueFactory(cellData -> new ReadOnlyObjectWrapper<String>(createHexItem(cellData.getValue())));
TableColumn<Integer, String> text = new TableColumn<>("TEXT");
text.setId("text-column");
text.setCellValueFactory(cellData -> new ReadOnlyObjectWrapper<String>(createItem(cellData.getValue())));
getColumns().addAll(count, hex, text);
sortPolicyProperty().set(t -> false);
setColumnResizePolicy((param) -> true);
}
示例6: SourceTreeTable
import javafx.beans.property.ReadOnlyObjectWrapper; //导入依赖的package包/类
/**
* Creates a new source tree table. It comes pre-populated with a key and a value column.
*/
public SourceTreeTable() {
keyColumn.prefWidthProperty().bind(widthProperty().divide(2).subtract(2));
valueColumn.prefWidthProperty().bind(widthProperty().divide(2).subtract(2));
keyColumn.setCellValueFactory(
f -> new ReadOnlyStringWrapper(getEntryForCellData(f).getViewName()));
valueColumn.setCellValueFactory(
f -> new ReadOnlyObjectWrapper(getEntryForCellData(f).getValueView()));
Label placeholder = new Label();
placeholder.textProperty().bind(EasyBind.monadic(sourceType)
.map(SourceType::getName)
.map(n -> "No data available. Is there a connection to " + n + "?")
.orElse("No data available. Is the source connected?"));
setPlaceholder(placeholder);
getColumns().addAll(keyColumn, valueColumn);
}
示例7: recurrenceSourceProperty
import javafx.beans.property.ReadOnlyObjectWrapper; //导入依赖的package包/类
/**
* If the entry is a recurrence (see {@link #recurrenceProperty()}) then
* this property will store a reference to the entry for which the
* recurrence was created.
*
* @return the entry that was the source of the recurrence
*/
public final ReadOnlyObjectProperty<Entry<T>> recurrenceSourceProperty() {
if (recurrenceSource == null) {
recurrenceSource = new ReadOnlyObjectWrapper<Entry<T>>(this, "recurrenceSource") { //$NON-NLS-1$
@Override
public void set(Entry<T> newEntry) {
super.set(newEntry);
if (newEntry != null) {
setRecurrence(true);
} else {
setRecurrence(false);
}
}
};
}
return recurrenceSource.getReadOnlyProperty();
}
示例8: VideosView
import javafx.beans.property.ReadOnlyObjectWrapper; //导入依赖的package包/类
public VideosView(final VideosController controller) {
videosController = controller;
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("videos.fxml"));
fxmlLoader.setRoot(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
lookupViews();
setItems(MediaLibrary.instance().getVideos());
setPlaceholder(new Label("Choose a Directory to play videos"));
titleCol.setCellValueFactory(p -> new ReadOnlyObjectWrapper<>(p.getValue().getTitle()));
durationCol.setCellValueFactory(p -> p.getValue().durationProperty());
// Subtract 20 total to leave room for the scrollbar
titleCol.prefWidthProperty().bind(widthProperty().multiply(0.7).subtract(10));
durationCol.prefWidthProperty().bind(widthProperty().multiply(0.3).subtract(10));
getSelectionModel().selectedItemProperty().addListener(videosController.selectionListener(getItems()));
}
示例9: importSpec
import javafx.beans.property.ReadOnlyObjectWrapper; //导入依赖的package包/类
private ValidSpecification importSpec(String name) throws
ImportException {
List<Type> typeContext = Arrays.asList(TypeInt.INT, TypeBool.BOOL, new TypeEnum("colors",
Arrays.asList("red", "green", "blue")));
List<CodeIoVariable> codeIoVariables = new LinkedList<>();
ConstraintSpecification constraintSpec = ImporterFacade.importConstraintSpec(getClass().getResourceAsStream(name), ImporterFacade
.ImportFormat.XML);
FreeVariableListValidator freeVariableListValidator = new FreeVariableListValidator(new
SimpleObjectProperty<>(typeContext), constraintSpec
.getFreeVariableList());
List<ValidFreeVariable> freeVariables = freeVariableListValidator.validFreeVariablesProperty().get();
this.freeVariables = freeVariables;
ConstraintSpecificationValidator recognizer = new ConstraintSpecificationValidator(
new SimpleObjectProperty<>(typeContext),
new SimpleObjectProperty<>(codeIoVariables),
new ReadOnlyObjectWrapper<>(freeVariables),
constraintSpec);
List<SpecProblem> specProblems = recognizer.problemsProperty().get();
specProblems.stream().map(SpecProblem::getErrorMessage).forEach(System.err::println);
return recognizer.getValidSpecification();
}
示例10: importSpec
import javafx.beans.property.ReadOnlyObjectWrapper; //导入依赖的package包/类
private ValidSpecification importSpec(String name) throws
ImportException {
List<Type> typeContext = Arrays.asList(TypeInt.INT, TypeBool.BOOL, new TypeEnum("colors",
Arrays.asList("red", "green", "blue")));
List<CodeIoVariable> codeIoVariables = new LinkedList<>();
ConstraintSpecification constraintSpec = ImporterFacade.importConstraintSpec(getClass().getResourceAsStream(name), ImporterFacade
.ImportFormat.XML);
FreeVariableListValidator freeVariableListValidator = new FreeVariableListValidator(new
SimpleObjectProperty<>(typeContext), constraintSpec
.getFreeVariableList());
List<ValidFreeVariable> freeVariables = freeVariableListValidator.validFreeVariablesProperty().get();
this.freeVariables = freeVariables;
ConstraintSpecificationValidator validator = new ConstraintSpecificationValidator(
new SimpleObjectProperty<>(typeContext),
new SimpleObjectProperty<>(codeIoVariables),
new ReadOnlyObjectWrapper<>(freeVariables),
constraintSpec);
List<SpecProblem> specProblems = validator.problemsProperty().get();
specProblems.stream().map(SpecProblem::getErrorMessage).forEach(System.out::println);
return validator.getValidSpecification();
}
示例11: tabPanePropertyImpl
import javafx.beans.property.ReadOnlyObjectWrapper; //导入依赖的package包/类
private ReadOnlyObjectWrapper<DockTabPane> tabPanePropertyImpl() {
if (tabPane == null) {
tabPane = new ReadOnlyObjectWrapper<DockTabPane>(this, "tabPane") {
private WeakReference<DockTabPane> oldParent;
@Override
protected void invalidated() {
if (oldParent != null && oldParent.get() != null) {
oldParent.get().disabledProperty().removeListener(parentDisabledChangedListener);
}
updateDisabled();
DockTabPane newParent = get();
if (newParent != null) {
newParent.disabledProperty().addListener(parentDisabledChangedListener);
}
oldParent = new WeakReference<DockTabPane>(newParent);
super.invalidated();
}
};
}
return tabPane;
}
示例12: MakeBusinessFrameComposite
import javafx.beans.property.ReadOnlyObjectWrapper; //导入依赖的package包/类
public MakeBusinessFrameComposite(String title, Object userParam) throws IOException {
// FXMLLoader loader = new FXMLLoader();
// loader.setLocation(MakeBusinessFrameComposite.class.getResource("MakeTriggerFrameView.fxml"));
// loader.setRoot(this);
// loader.setController(this);
// loader.load();
FxUtil.loadRoot(MakeBusinessFrameComposite.class, this, err -> {
LOGGER.error(ValueUtil.toString(err));
});
properties = new ArrayList<>();
titleProperty.set(title);
this.userParam = new ReadOnlyObjectWrapper<Object>(userParam);
this.currentPage.addListener(currentPageChangeListener);
}
示例13: DockNode
import javafx.beans.property.ReadOnlyObjectWrapper; //导入依赖的package包/类
private DockNode() {
station = new SimpleObjectProperty<>(null);
floatableProperty = new SimpleBooleanProperty(true);
closeableProperty = new SimpleBooleanProperty(true);
resizableProperty = new SimpleBooleanProperty(true);
maximizableProperty = new SimpleBooleanProperty(true);
floatingProperty = new ReadOnlyBooleanWrapper(false);
draggingProperty = new ReadOnlyBooleanWrapper(false);
resizingProperty = new ReadOnlyBooleanWrapper(false);
maximizingProperty = new ReadOnlyBooleanWrapper(false);
container = new ReadOnlyObjectWrapper<>(null);
}
示例14: initialize
import javafx.beans.property.ReadOnlyObjectWrapper; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
browseSourceDirButton.disableProperty().bind(manualTitledPane.expandedProperty());
srcPathTextField.disableProperty().bind(manualTitledPane.expandedProperty());
fileTable.setPlaceholder(new Label("Let's add some files!"));
fileTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
fileNameColumn.setCellValueFactory(
p -> new ReadOnlyObjectWrapper<String>(p.getValue().getPath()));
fileNameColumn.setCellFactory(view -> new FileNameCell());
// indexOf operation might not be very fast. Also the code should ensure that the list with
// items contains only unique values.
numberColumn.setCellValueFactory(p -> new ReadOnlyObjectWrapper<String>(
String.valueOf(p.getTableView().getItems().indexOf(p.getValue()) + 1)));
manualPaneDotsAnima = new ThreeDotsAnimation(
"Editing list of <filetype> files", '.',
manualTitledPane.textProperty(), 1, 500, Timeline.INDEFINITE);
setValidationForFileTableWithDelay.setCycleCount(1);
fileTable.getSelectionModel().selectedItemProperty().addListener((o, oldVal, newVal) -> {
sampleFile.set(newVal);
});
initializeListeners();
// Set tooltips showing file paths.
GUIUtil.createAndBindTooltipToTextfield(srcPathTextField);
}
示例15: loadData
import javafx.beans.property.ReadOnlyObjectWrapper; //导入依赖的package包/类
private void loadData(List<Map<String, String>> data) {
batchDataTable.getColumns().clear();
TableColumn<Map<String, String>, String> numberCol = new TableColumn("");
numberCol.setCellValueFactory(row -> new ReadOnlyObjectWrapper(
(row.getTableView().getItems().indexOf(row.getValue()) + 1) + ""));
batchDataTable.getColumns().add(numberCol);
numberCol.setMinWidth(50);
data.get(0).keySet().forEach(varName -> {
TableColumn<Map<String, String>, String> varCol = new TableColumn(varName);
varCol.setCellValueFactory(row -> new ReadOnlyObjectWrapper(row.getValue().get(varName)));
batchDataTable.getColumns().add(varCol);
});
batchDataTable.setItems(new ObservableListWrapper<>(data));
}