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


Java Tab.getProperties方法代码示例

本文整理汇总了Java中javafx.scene.control.Tab.getProperties方法的典型用法代码示例。如果您正苦于以下问题:Java Tab.getProperties方法的具体用法?Java Tab.getProperties怎么用?Java Tab.getProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.Tab的用法示例。


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

示例1: getCurrentEditor

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

示例2: addEditor

import javafx.scene.control.Tab; //导入方法依赖的package包/类
/**
 * Add and open the new file editor.
 *
 * @param editor   the editor
 * @param needShow the need show
 */
@FXThread
private void addEditor(@NotNull final FileEditor editor, final boolean needShow) {

    final Path editFile = editor.getEditFile();

    final Tab tab = new Tab(editor.getFileName());
    tab.setGraphic(new ImageView(ICON_MANAGER.getIcon(editFile, DEFAULT_FILE_ICON_SIZE)));
    tab.setContent(editor.getPage());
    tab.setOnCloseRequest(event -> handleRequestToCloseEditor(editor, tab, event));

    final ObservableMap<Object, Object> properties = tab.getProperties();
    properties.put(KEY_EDITOR, editor);

    editor.dirtyProperty().addListener((observable, oldValue, newValue) -> {
        tab.setText(newValue == Boolean.TRUE ? "*" + editor.getFileName() : editor.getFileName());
    });

    final ObservableList<Tab> tabs = getTabs();
    tabs.add(tab);

    if (needShow) {
        final SingleSelectionModel<Tab> selectionModel = getSelectionModel();
        selectionModel.select(tab);
    }

    DictionaryUtils.runInWriteLock(getOpenedEditors(), editFile, tab, ObjectDictionary::put);

    EditorUtil.decrementLoading();

    if (isIgnoreOpenedFiles()) {
        return;
    }

    final Workspace workspace = WORKSPACE_MANAGER.getCurrentWorkspace();

    if (workspace != null) {
        workspace.addOpenedFile(editFile, editor);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:46,代码来源:EditorAreaComponent.java

示例3: handleMovedFiles

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


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