本文整理汇总了Java中javafx.beans.property.ReadOnlyStringWrapper类的典型用法代码示例。如果您正苦于以下问题:Java ReadOnlyStringWrapper类的具体用法?Java ReadOnlyStringWrapper怎么用?Java ReadOnlyStringWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ReadOnlyStringWrapper类属于javafx.beans.property包,在下文中一共展示了ReadOnlyStringWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SourceTreeTable
import javafx.beans.property.ReadOnlyStringWrapper; //导入依赖的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);
}
示例2: initialize
import javafx.beans.property.ReadOnlyStringWrapper; //导入依赖的package包/类
@FXML
private void initialize() {
nameColumn.setCellValueFactory(cd -> cd.getValue().nameProperty());
slotColumn.setCellValueFactory(cd ->
new ReadOnlyStringWrapper(cd.getValue().slotProperty().get().toString()));
astabColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.ASTAB).asObject());
aslashColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.ASLASH).asObject());
acrushColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.ACRUSH).asObject());
arangeColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.ARANGE).asObject());
amagicColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.AMAGIC).asObject());
dstabColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.DSTAB).asObject());
dslashColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.DSLASH).asObject());
dcrushColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.DCRUSH).asObject());
drangeColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.DRANGE).asObject());
dmagicColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.DMAGIC).asObject());
strColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.STR).asObject());
rstrColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.RSTR).asObject());
mdmgColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.MDMG).asObject());
prayColumn.setCellValueFactory(cd -> cd.getValue().statsProperty(ArmorStats.PRAYER).asObject());
}
示例3: getColumns
import javafx.beans.property.ReadOnlyStringWrapper; //导入依赖的package包/类
/**
* Returns the columns associated to this columnizer. They can directly be added to a {@link TableView}.
* <p>
* The visibility and width of the returned columns are bound to the column definitions of this Columnizer, so that
* they are stored in the config.
*
* @return the columns associated to this columnizer
*/
@NotNull
public List<TableColumn<LogEntry, String>> getColumns() {
List<TableColumn<LogEntry, String>> columns = new ArrayList<>();
for (ColumnDefinition columnDefinition : columnDefinitions) {
TableColumn<LogEntry, String> col = new TableColumn<>();
// we need to keep the original text to avoid breaking the table visibility menu
col.textProperty().bind(columnDefinition.headerLabelProperty());
col.setGraphic(columnDefinition.createBoundHeaderLabel());
col.setVisible(columnDefinition.isVisible());
col.setPrefWidth(columnDefinition.getWidth());
columnDefinition.visibleProperty().bindBidirectional(col.visibleProperty());
columnDefinition.widthProperty().bind(col.widthProperty());
col.setCellValueFactory(data -> {
LogEntry log = data.getValue();
String cellValue = log.getColumnValues().get(columnDefinition.getCapturingGroupName());
return new ReadOnlyStringWrapper(cellValue);
});
columns.add(col);
}
return columns;
}
示例4: MasterView
import javafx.beans.property.ReadOnlyStringWrapper; //导入依赖的package包/类
public MasterView(ClientContext clientContext) {
super(clientContext, Constants.MASTER_CONTROLLER_NAME);
listView = new ListView<>();
listView.setCellFactory(c -> new StockItemListCell());
rootNode = new StackPane(listView);
selectedStockIdent = new ReadOnlyStringWrapper();
listView.getSelectionModel().selectedItemProperty().addListener((obs, oldVal, newVal) -> {
if (newVal == null) {
selectedStockIdent.set(null);
getModel().setSelectedStockIdent(null);
} else {
selectedStockIdent.set(newVal.getStockIdent());
getModel().setSelectedStockIdent(newVal.getStockIdent());
}
});
}
示例5: createMacros
import javafx.beans.property.ReadOnlyStringWrapper; //导入依赖的package包/类
private Tab createMacros(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(TextFieldTableCell.forTableColumn());
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(TextFieldTableCell.forTableColumn());
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.setEditable(true);
table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
return new Tab(Messages.WidgetInfoDialog_TabMacros, table);
}
示例6: getAuthenticatedConnection
import javafx.beans.property.ReadOnlyStringWrapper; //导入依赖的package包/类
@Test
public void getAuthenticatedConnection() throws IOException {
webserver.requireLogin = true;
AuthHandler handler = new AuthHandler(
new ReadOnlyStringWrapper("localhost:"+webserver.port),
new ReadOnlyBooleanWrapper(false),
new ReadOnlyStringWrapper(TEST_USER),
new ReadOnlyStringWrapper(TEST_PASSWORD)
);
CloseableHttpClient client = handler.getAuthenticatedClient();
assertNotNull(client);
HttpUriRequest request = new HttpGet("http://localhost:"+webserver.port+"/testUri");
client.execute(request);
Header authHeader = webserver.lastRequest.getFirstHeader("Authorization");
assertNotNull(authHeader);
String compareToken = "Basic "+Base64.getEncoder().encodeToString((TEST_USER + ":" + TEST_PASSWORD).getBytes());
assertEquals("Auth token should be expected format", authHeader.getValue(), compareToken);
}
示例7: addTableColumns
import javafx.beans.property.ReadOnlyStringWrapper; //导入依赖的package包/类
@Override
protected void addTableColumns(TableView<ArchiveEntry> table) {
TableColumn<ArchiveEntry, String> ordinalColumn = new TableColumn<ArchiveEntry, String>(
"Ordinal");
ordinalColumn.setCellValueFactory(cellData -> {
return new ReadOnlyStringWrapper(
Integer.toString(cellData.getValue().ordinal()));
});
table.getColumns().add(ordinalColumn);
TableColumn<ArchiveEntry, String> sizeColumn = new TableColumn<ArchiveEntry, String>(
"Size(Bytes)");
sizeColumn.setCellValueFactory(cellData -> {
long size = cellData.getValue().size();
return new ReadOnlyStringWrapper(
size < 0 ? null : Long.toString(size));
});
table.getColumns().add(sizeColumn);
TableColumn<ArchiveEntry, String> nameColumn = new TableColumn<ArchiveEntry, String>(
"Name");
nameColumn.setCellValueFactory(cellData -> {
return new ReadOnlyStringWrapper(cellData.getValue().name());
});
table.getColumns().add(nameColumn);
}
示例8: getAllMusicalWorks
import javafx.beans.property.ReadOnlyStringWrapper; //导入依赖的package包/类
public void getAllMusicalWorks() {
tableAvailableMusicalWorks.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));
tableSelectedMusicalWorks.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));
List<MusicalWorkDTO> musicalWorks = MusicalWorkAdministratonManager.getAllMusicalWorks();
for(MusicalWorkDTO mwDTO : musicalWorks) {
tableAvailable.getItems().add(mwDTO.getName());
}
this.musicalWorks = musicalWorks;
}
示例9: initialize
import javafx.beans.property.ReadOnlyStringWrapper; //导入依赖的package包/类
@FXML
public void initialize() {
initializeMandatoryFields();
selectedMusicalWorks.setCellValueFactory(param -> new ReadOnlyStringWrapper(param.getValue()));
points.textProperty().addListener((observable, oldValue, newValue) -> {
if (!newValue.matches("\\d*[\\,.]?\\d*?")) {
points.setText(newValue.replaceAll("[^\\d*[\\,.]?\\d*?]", ""));
}
});
}
示例10: initialize
import javafx.beans.property.ReadOnlyStringWrapper; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
menuBar.setUseSystemMenuBar(true);
if (System.getProperty("os.name").toLowerCase().contains("mac")) {
quitMenu.setVisible(false);
}
tableCombinationColumn.setCellValueFactory(param -> new ReadOnlyStringWrapper(String.join(", ", param.getValue().getKey())));
tableNumberOfItems.setCellValueFactory(param -> new ReadOnlyObjectWrapper<>(param.getValue().getValue().size()));
tableItems.setCellValueFactory(param -> new ReadOnlyStringWrapper(String.join(", ", param.getValue().getValue())));
ContextMenu tableContextMenu = new ContextMenu();
MenuItem copyMenuItem = new MenuItem("Copy items");
copyMenuItem.setOnAction(event -> {
String text = combinationTable.getSelectionModel().getSelectedItems().stream().flatMap(it -> it.getValue().stream()).collect(Collectors.joining("\n"));
ClipboardContent content = new ClipboardContent();
content.putString(text);
Clipboard.getSystemClipboard().setContent(content);
});
tableContextMenu.getItems().add(copyMenuItem);
combinationTable.setContextMenu(tableContextMenu);
splitter.getDividers().get(0).positionProperty().addListener((observable, oldValue, newValue) -> {
refreshVennFigure();
});
splitter2.getDividers().get(0).positionProperty().addListener((observable, oldValue, newValue) -> {
refreshVennFigure();
});
splitter2.boundsInLocalProperty().addListener((observable, oldValue, newValue) -> {
refreshVennFigure();
});
addGroup().setElements(Arrays.asList("A", "B", "C"));
addGroup().setElements(Arrays.asList("B", "C", "D"));
groupViewControllerList.get(0).getTitledPane().setExpanded(true);
modified = false;
}
示例11: initialize
import javafx.beans.property.ReadOnlyStringWrapper; //导入依赖的package包/类
@FXML
private void initialize() {
// replaces CONSTRAINED_RESIZE_POLICY
summaryCol.prefWidthProperty().bind(
table.widthProperty()
.subtract(timeCol.widthProperty())
.subtract(levelCol.widthProperty())
.subtract(fromCol.widthProperty())
);
table.itemsProperty().bind(MessageLogger.messagesProperty());
final DateFormat df = DateFormat.getTimeInstance();
timeCol.setCellValueFactory((r) ->
new ReadOnlyStringWrapper(df.format(new Date(r.getValue().timestamp))));
levelCol.setCellValueFactory((r) ->
new ReadOnlyStringWrapper(r.getValue().level.toString()));
fromCol.setCellValueFactory((r) ->
new ReadOnlyStringWrapper(r.getValue().from));
summaryCol.setCellValueFactory((r) ->
new ReadOnlyStringWrapper(r.getValue().summary));
table.getSelectionModel().selectedItemProperty().addListener((o, oldValue, newValue) -> {
if (newValue != null) {
detailsField.setText(newValue.summary + '\n' + newValue.details);
} else {
detailsField.setText("");
}
});
logLevel.getItems().setAll(Message.Level.values());
logLevel.getSelectionModel().select(MessageLogger.logLevelProperty().get());
logLevel.getSelectionModel().selectedItemProperty().addListener(
(o, oldValue, newValue) -> MessageLogger.logLevelProperty().set(newValue));
}
示例12: loadToDoLists
import javafx.beans.property.ReadOnlyStringWrapper; //导入依赖的package包/类
private void loadToDoLists() {
toDoList = FXCollections.observableArrayList();
toDoList.addAll(toDoDAO.getToDoList());
toDoTitel.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(((String) cellData.getValue().getTitle())));
toDoCategory.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(((String) cellData.getValue().getCategory())));
toDoDescription.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(((String) cellData.getValue().getDescription())));
toDoDateCreated.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(new SimpleDateFormat("yyyy-MM-dd").format(cellData.getValue().getDateCreated())));
// toDoTable.setItems(null);
toDoTable.setItems(toDoList);
}
示例13: ObservableEntity
import javafx.beans.property.ReadOnlyStringWrapper; //导入依赖的package包/类
public ObservableEntity(Entity entity) {
this.entity = entity;
index = new ReadOnlyStringWrapper(String.valueOf(entity.getIndex()));
name = new ReadOnlyStringWrapper(entity.getDtClass().getDtName());
List<FieldPath> fieldPaths = entity.getDtClass().collectFieldPaths(entity.getState());
for (FieldPath fieldPath : fieldPaths) {
indices.add(fieldPath);
properties.add(new ObservableEntityProperty(entity, fieldPath));
}
}
示例14: createTable
import javafx.beans.property.ReadOnlyStringWrapper; //导入依赖的package包/类
private Node createTable() {
recentProjectsTable.setPrefWidth(TABLE_WIDTH);
TableColumn<File, String> recentProjectsPathColumn = new TableColumn<>("Recent Projects");
recentProjectsPathColumn.setCellValueFactory(cellData -> new ReadOnlyStringWrapper(cellData.getValue().getPath()));
recentProjectsTable.getColumns().add(recentProjectsPathColumn);
recentProjectsTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
return recentProjectsTable;
}
示例15: getProperty
import javafx.beans.property.ReadOnlyStringWrapper; //导入依赖的package包/类
/**
* Returns an Observable Property which contains the localized string for the given identifier.
*
* @param identifier the identifier
* @return a property with the localized string
*/
public static ReadOnlyStringProperty getProperty(final String identifier) {
ReadOnlyStringWrapper localizedProperty = new ReadOnlyStringWrapper();
addObserverFor(identifier, (locale, text) -> localizedProperty.set(text));
return localizedProperty.getReadOnlyProperty();
}