當前位置: 首頁>>代碼示例>>Java>>正文


Java ObservableMap.get方法代碼示例

本文整理匯總了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;
}
 
開發者ID:brightgenerous,項目名稱:fx-player,代碼行數:22,代碼來源:MediaInfo.java

示例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);
}
 
開發者ID:LtubSalad,項目名稱:voogasalad-ltub,代碼行數:9,代碼來源:GeneralGameDataBar.java

示例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);
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:13,代碼來源:EditorAreaComponent.java

示例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() );
   }
}
 
開發者ID:DanGrew,項目名稱:JttDesktop,代碼行數:19,代碼來源:JobPanelDescriptionBaseImpl.java

示例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()); });
}
 
開發者ID:Apelon-VA,項目名稱:ISAAC,代碼行數:39,代碼來源:HeaderNode.java

示例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);
    }
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:49,代碼來源:EditorAreaComponent.java

示例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));
    }
 
開發者ID:tbressler,項目名稱:waterrower-workout,代碼行數:61,代碼來源:ActivityDiagramSkin.java


注:本文中的javafx.collections.ObservableMap.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。