本文整理汇总了Java中javafx.collections.ObservableMap.get方法的典型用法代码示例。如果您正苦于以下问题:Java ObservableMap.get方法的具体用法?Java ObservableMap.get怎么用?Java ObservableMap.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.collections.ObservableMap
的用法示例。
在下文中一共展示了ObservableMap.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setIfUpdate
import javafx.collections.ObservableMap; //导入方法依赖的package包/类
private static <T> T setIfUpdate(ObservableMap<? extends String, ? extends Object> map,
String key, WritableValue<T>... props) {
T newValue = (T) map.get(key);
if (newValue != null) {
boolean stringEmpty = false;
if (newValue instanceof String) {
String newStr = (String) newValue;
stringEmpty = newStr.isEmpty();
}
for (WritableValue<T> prop : props) {
if (stringEmpty) {
if (prop.getValue() == null) {
prop.setValue(newValue);
}
} else {
prop.setValue(newValue);
}
}
}
return newValue;
}
示例2: redraw
import javafx.collections.ObservableMap; //导入方法依赖的package包/类
private void redraw(ObservableMap<String, String> data) {
this.getChildren().clear();
bonuses = new Text(myResources.getString(NUM_BONUSES) + data.get(myResources.getString(bonusKey)));
gold = new Text(myResources.getString(NUM_GOLD) + data.get(myResources.getString(goldKey)));
levels = new Text(myResources.getString(NUM_LEVEL) + data.get(myResources.getString(levelKey)));
lives = new Text(myResources.getString(NUM_LIVES) + data.get(myResources.getString(livesKey)));
this.getChildren().addAll(lives, levels, gold, bonuses);
}
示例3: getCurrentEditor
import javafx.collections.ObservableMap; //导入方法依赖的package包/类
/**
* Get the current showed editor.
*
* @return the current editor.
*/
@FXThread
public @Nullable FileEditor getCurrentEditor() {
final Tab selectedTab = getSelectionModel().getSelectedItem();
if (selectedTab == null) return null;
final ObservableMap<Object, Object> properties = selectedTab.getProperties();
return (FileEditor) properties.get(KEY_EDITOR);
}
示例4: updateColour
import javafx.collections.ObservableMap; //导入方法依赖的package包/类
/**
* Method to update the {@link Color} of a {@link Label}.
* @param coloursMap the {@link ObservableMap} of {@link Color}s to use.
* @param configurationProperty the {@link ObjectProperty} from the {@link BuildWallConfiguration}.
* @param textLabel the {@link Label} to update.
*/
private void updateColour(
ObservableMap< BuildResultStatus, Color > coloursMap,
ObjectProperty< Color > configurationProperty,
Label textLabel
){
Color themeColor = coloursMap.get( job.getBuildStatus() );
if ( themeColor != null ) {
textLabel.textFillProperty().set( themeColor );
} else {
textLabel.textFillProperty().set( configurationProperty.get() );
}
}
示例5: HeaderNode
import javafx.collections.ObservableMap; //导入方法依赖的package包/类
public HeaderNode(
ObservableMap<ColumnId, Filter<?>> filterCache,
TreeTableColumn<RefexDynamicGUI, ?> col,
ColumnId columnId,
Scene scene,
DataProvider<T> dataProvider) {
this.column = col;
this.scene = scene;
this.image.setFitHeight(8);
this.image.setFitWidth(8);
this.dataProvider = dataProvider;
if (filterCache.get(columnId) != null) {
this.filter = castFilterFromCache(filterCache.get(columnId));
this.filter.dataProvider = dataProvider;
} else {
this.filter = new Filter<>(columnId, dataProvider);
filterCache.put(columnId, filter);
}
filterConfigurationButton.setGraphic(image);
Platform.runLater(() ->
{
filterConfigurationButton.setTooltip(new Tooltip("Press to configure filters for " + col.getText()));
});
filter.getFilterValues().addListener(new ListChangeListener<Object>() {
@Override
public void onChanged(
javafx.collections.ListChangeListener.Change<? extends Object> c) {
updateButton();
}
});
updateButton();
filterConfigurationButton.setOnAction(event -> { setUserFilters(column.getText()); });
}
示例6: handleMovedFiles
import javafx.collections.ObservableMap; //导入方法依赖的package包/类
/**
* Handle a moved/renamed file.
*
* @param prevFile the prev version of the file.
* @param newFile the new version of the file.
*/
@FXThread
private void handleMovedFiles(@NotNull final Path prevFile, @NotNull final Path newFile) {
final ConcurrentObjectDictionary<Path, Tab> openedEditors = getOpenedEditors();
final long stamp = openedEditors.writeLock();
try {
final Array<Path> files = openedEditors.keyArray(Path.class);
for (final Path file : files) {
if (!file.startsWith(prevFile)) {
continue;
}
final Tab tab = openedEditors.get(file);
final ObservableMap<Object, Object> properties = tab.getProperties();
final FileEditor fileEditor = (FileEditor) properties.get(KEY_EDITOR);
fileEditor.notifyRenamed(prevFile, newFile);
if (fileEditor.isDirty()) {
tab.setText("*" + fileEditor.getFileName());
} else {
tab.setText(fileEditor.getFileName());
}
final Path editFile = fileEditor.getEditFile();
openedEditors.remove(file);
openedEditors.put(editFile, tab);
final Workspace workspace = WORKSPACE_MANAGER.getCurrentWorkspace();
if (workspace != null) {
workspace.removeOpenedFile(file);
workspace.addOpenedFile(editFile, fileEditor);
}
}
} finally {
openedEditors.writeUnlock(stamp);
}
}
示例7: updateActivityRectangles
import javafx.collections.ObservableMap; //导入方法依赖的package包/类
private void updateActivityRectangles(ObservableMap<LocalDate, Activity> activities) {
rectangles = new ActivityRectangle[WEEKS][WEEKDAYS];
LocalDate day = now().plusDays(WEEKDAYS - getWeekday(now()) - 1);
int weekOffset = WEEKS - getWeek(day);
int week;
int weekday;
int month = getMonth(day);
do {
week = (getWeek(day) + weekOffset - 1) % WEEKS;
weekday = getWeekday(day);
if (month != getMonth(day)) {
monthLabelPositions[week] = month;
month = getMonth(day);
}
rectangles[week][weekday] = new ActivityRectangle();
ObservableList<String> styleClass = rectangles[week][weekday].getStyleClass();
styleClass.add("week-activity-day");
Activity activity = activities.get(day);
if (activity != null) {
rectangles[week][weekday].setActivity(activity);
if (activity.getActivity() > 0.8f)
styleClass.add("week-activity-day-5");
else if (activity.getActivity() > 0.6f)
styleClass.add("week-activity-day-4");
else if (activity.getActivity() > 0.4f)
styleClass.add("week-activity-day-3");
else if (activity.getActivity() > 0.2f)
styleClass.add("week-activity-day-2");
else if (activity.getActivity() > 0.0f)
styleClass.add("week-activity-day-1");
}
// If today, add 'today' style class.
if (day.isEqual(now()))
styleClass.add("week-activity-today");
// If day is in future, add 'future' style class.
if (day.isAfter(now()))
styleClass.add("week-activity-future");
getChildren().addAll(rectangles[week][weekday]);
day = day.minusDays(1);
} while ((week > 0) || (weekday > 0));
}