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


Java TreeItem.getValue方法代码示例

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


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

示例1: changed

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
@Override public void changed(ObservableValue<? extends TreeItem<Object>> observable, TreeItem<Object> oldValue,
        TreeItem<Object> newValue) {
    if (newValue == null) {
        okButton.setDisable(true);
        documentArea.setText("");
        argumentPane.getChildren().clear();
        return;
    }
    TreeItem<Object> item = tree.getSelectionModel().getSelectedItem();
    String doc = "";
    boolean disable = true;
    functionItem = item;
    Object value = item.getValue();
    if (value instanceof Module) {
        doc = ((Module) value).getDocumentation();
    } else {
        doc = ((Function) value).getDocumentation();
        disable = false;
    }
    okButton.setDisable(disable);
    documentArea.setText(doc);
    argumentPane.getChildren().clear();
    if (item.isLeaf()) {
        addArguments(item);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:27,代码来源:FunctionStage.java

示例2: getTreeItemText

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private String getTreeItemText(TreeItem<?> lastPathComponent) {
    if (lastPathComponent == null || lastPathComponent.getValue() == null) {
        return "";
    }
    String original = lastPathComponent.getValue().toString();
    String itemText = original;
    int suffixIndex = 0;
    TreeItem<?> parent = lastPathComponent.getParent();
    if (parent == null)
        return itemText;
    ObservableList<?> children = parent.getChildren();
    for (int i = 0; i < children.indexOf(lastPathComponent); i++) {
        TreeItem<?> child = (TreeItem<?>) children.get(i);
        String current = child.getValue().toString();
        if (current.equals(original)) {
            itemText = String.format("%s(%d)", original, ++suffixIndex);
        }
    }
    return itemText;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:JavaFXElementPropertyAccessor.java

示例3: handleMouseClicked

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
@FXML
private void handleMouseClicked(MouseEvent mouseEvent) {
    if(mouseEvent.getClickCount() == 1){
        try{
            TreeItem<String> item = treeview.getSelectionModel().getSelectedItem();
            Fx1.CurrDirName = item.getValue();
            System.out.println("Selected Text : " + item.getValue());
            Fx1.CurrDirFile = new File(Fx1.FindAbsolutePath(item,item.getValue()));
            Fx1.CurrDirStr = Fx1.CurrDirFile.getAbsolutePath();
            label.setText(Fx1.CurrDirStr);
            Fx2.tableview.getItems().clear();
            Fx2.CreateTableView();
            Fx3.CreateTiles();
            /**tableview.getItems().clear();
             CreateTableView();
             /**call some other function to activate createtableview() in corres controller */
        }catch(Exception x){
            System.out.println(x.getMessage());
        }
    }
    //Fx2.tableview.getItems().clear();
    //Fx2.CreateTableView();
}
 
开发者ID:maximstewart,项目名称:UDE,代码行数:24,代码来源:Controller.java

示例4: LinkToTreeClass

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private void LinkToTreeClass(TreeItem<TypeController> tree){
	
	if(tree.getValue() != null && tree.getValue().getType().getName().equals(this.classe.getName())) {
		this.treeClass = tree.getValue();
		this.treeClassTreeItem = tree;
		tree.getValue().getClassNameController().addObserver(this);
		tree.getValue().getClassColorController().addObserver(this);
		tree.getValue().getAddPropertySchemeController().addObserver(this);	
		tree.getValue().getRemovePropertySchemeController().addObserver(this);
		tree.getValue().GetAddPropertySchemeWithValueController().addObserver(this);
		tree.getValue().getAddClassSchemeController().addObserver(this);
		tree.getValue().getRemoveClassSchemeController().addObserver(this);
		return;
	}
	
	if(!tree.isLeaf()) {
		for(TreeItem<TypeController> t : tree.getChildren()) {
			LinkToTreeClass(t);
		}
	}
}
 
开发者ID:coco35700,项目名称:uPMT,代码行数:22,代码来源:TypeClassRepresentationController.java

示例5: getGlobalIndexOf

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private int getGlobalIndexOf(TreeItem<String> fileNode)
{
	TreeItem<String> root = projectTreeDisplay.getRoot();
	ObservableList<TreeItem<String>> projectNodes = root.getChildren();
	
	int index = 0;
	for (TreeItem<String> node : projectNodes)
	{
		if (node.equals(fileNode))
			return index;
		
		index++;
		for (TreeItem<String> child : node.getChildren())
		{
			if (child.equals(fileNode))
				return index;
			index++;
		}
	}
	
	throw new IllegalArgumentException(fileNode.getValue() + " not found in tree");
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:23,代码来源:ProjectExplorerTree.java

示例6: processSelected

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
/**
 * Handle selected element in the tree.
 *
 * @param newValue the new selected item.
 */
@FXThread
protected void processSelected(@Nullable final TreeItem<T> newValue) {

    final T element = newValue == null ? null : newValue.getValue();
    final String assetPath = element == null ? null : getAssetPath(element);
    final Path realFile = element == null ? null : getRealFile(element);

    validate(getWarningLabel(), element);
    try {

        if (assetPath != null) {
            updatePreview(assetPath);
        } else if (realFile != null) {
            updatePreview(realFile);
        } else {
            updatePreview((String) null);
        }

    } catch (final Exception e) {
        EditorUtil.handleException(LOGGER, this, e);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:28,代码来源:BaseAssetEditorDialog.java

示例7: processOk

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
@Override
@FXThread
protected void processOk() {
    super.processOk();

    final VirtualResourceTree<C> resourceTree = getResourceTree();
    final MultipleSelectionModel<TreeItem<VirtualResourceElement<?>>> selectionModel = resourceTree.getSelectionModel();
    final TreeItem<VirtualResourceElement<?>> selectedItem = selectionModel.getSelectedItem();

    if (selectedItem == null) {
        hide();
        return;
    }

    final VirtualResourceElement<?> element = selectedItem.getValue();
    final Object object = element.getObject();
    final Class<C> type = getObjectsType();

    if (type.isInstance(object)) {
        getConsumer().accept(type.cast(object));
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:23,代码来源:VirtualAssetEditorDialog.java

示例8: fillContextMenu

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
/**
 * Fill the items actions for this node.
 *
 * @param nodeTree the node tree
 * @param items    the items
 */
@FXThread
public void fillContextMenu(@NotNull final NodeTree<?> nodeTree, @NotNull final ObservableList<MenuItem> items) {
    if (canEditName()) items.add(new RenameNodeAction(nodeTree, this));
    if (canCopy()) items.add(new CopyNodeAction(nodeTree, this));

    final Clipboard clipboard = Clipboard.getSystemClipboard();
    final Object content = clipboard.getContent(DATA_FORMAT);
    if (!(content instanceof Long)) {
        return;
    }

    final Long objectId = (Long) content;
    final TreeItem<?> treeItem = UIUtils.findItem(nodeTree.getTreeView(), objectId);
    final TreeNode<?> treeNode = treeItem == null ? null : (TreeNode<?>) treeItem.getValue();

    if (treeNode != null && canAccept(treeNode, true)) {
        items.add(new PasteNodeAction(nodeTree, this, treeNode));
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:26,代码来源:TreeNode.java

示例9: fill

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
/**
 * Fill the tree item.
 *
 * @param item the tree item.
 */
@FXThread
private void fill(@NotNull final TreeItem<VirtualResourceElement<?>> item) {

    final VirtualResourceElement<?> element = item.getValue();
    if(!element.hasChildren()) {
        return;
    }

    final ObservableList<TreeItem<VirtualResourceElement<?>>> items = item.getChildren();

    final Array<VirtualResourceElement<?>> children = element.getChildren();
    children.sort(NAME_COMPARATOR);
    children.forEach(child -> items.add(new TreeItem<>(child)));

    items.forEach(this::fill);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:22,代码来源:VirtualResourceTree.java

示例10: onSave

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private void onSave() {
    File parentFile;
    if (doesAllowChildren) {
        TreeItem<File> selectedItem = parentTreeView.getSelectionModel().getSelectedItem();
        parentFile = selectedItem.getValue();
    } else {
        parentFile = fileChooserInfo.getRoot();
    }
    File file = new File(parentFile, fileNameBox.getText());
    fileChooserHandler.handle(file);
    if (propertiesView != null) {
        fileChooserInfo.setProperties(propertiesView);
    }
    dispose();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:16,代码来源:MarathonFileChooser.java

示例11: onNewFolder

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private void onNewFolder() {
    MarathonInputStage testNameStage = new MarathonInputStage("Folder name", "Create a new folder",
            FXUIUtils.getIcon("fldr_closed")) {

        @Override protected String validateInput(String name) {
            String errorMessage = null;
            if (name.length() == 0 || name.trim().isEmpty()) {
                errorMessage = "Enter a valid name";
            }
            return errorMessage;
        }

        @Override protected String getInputFiledLabelText() {
            return "Enter a folder name: ";
        }

        @Override protected void setDefaultButton() {
            okButton.setDefaultButton(true);
        }
    };
    FolderNameHandler testNameHandler = new FolderNameHandler();
    testNameStage.setInputHandler(testNameHandler);
    testNameStage.getStage().showAndWait();
    TreeItem<File> selectedItem = parentTreeView.getSelectionModel().getSelectedItem();
    String testName = testNameHandler.getTestName();
    if (testName == null || "".equals(testName)) {
        return;
    }
    File file = new File(selectedItem.getValue(), testName);
    if (file.exists()) {
        FXUIUtils.showMessageDialog(getStage(), "Folder with name '" + testName + "' already exists.", "File exists",
                AlertType.INFORMATION);
    } else {
        selectedItem.getChildren().add(new TreeItem<File>(file));
        if (!file.mkdir()) {
            FXUIUtils.showMessageDialog(getStage(), "Couldn't create folder with name '" + testName + "'", "Creation Fail",
                    AlertType.ERROR);
        }
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:41,代码来源:MarathonFileChooser.java

示例12: copy

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private void copy(ObservableList<TreeItem<Resource>> selectedItems) {
    Clipboard clipboard = Clipboard.getSystemClipboard();
    Map<DataFormat, Object> content = new HashMap<>();
    for (TreeItem<Resource> treeItem : selectedItems) {
        Resource resource = treeItem.getValue();
        if (resource != null) {
            if (!resource.copy(content)) {
                FXUIUtils.showMessageDialog(null, "Clipboard operation failed", "Unhandled resource selection",
                        AlertType.ERROR);
            }
        }
    }
    clipboard.setContent(content);
    clipboardOperation = Operation.COPY;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:16,代码来源:ResourceView.java

示例13: contains

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private TreeItem<Resource> contains(ObservableList<TreeItem<Resource>> l, Resource r) {
    for (TreeItem<Resource> treeItem : l) {
        Resource other = treeItem.getValue();
        if (other.getFilePath().getFileName().equals(r.getFilePath().getFileName())) {
            return treeItem;
        }
    }
    return null;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:10,代码来源:FolderResource.java

示例14: onRun

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
public void onRun() {
    errorMsgLabel.setVisible(false);
    console.clear();
    TreeItem<Test> root = testTree.getRoot();
    resetTestState(root);
    if (root != null) {
        Test testSuite = root.getValue();
        progressBar.reset(testSuite.countTestCases());
        doRunTest(testSuite);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:12,代码来源:TestRunner.java

示例15: selectItemAction

import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private void selectItemAction(ListChangeListener.Change<? extends TreeItem<FileComponent>> c) {
    if (c.next() && c.wasAdded()) {
        TreeItem<FileComponent> node = c.getList().get(c.getFrom());
        if (node != null && node.getParent() != null) {
            FileComponent cc = node.getValue();
            Log.info("Select " + cc);
            statusLabel.setText(cc.toString());
            if (cc.getLength() > 0) {
                hexPane.select(cc);
                bytesBar.select(cc);
            }
        }
    }
}
 
开发者ID:Glavo,项目名称:ClassViewer,代码行数:15,代码来源:ParsedViewerPane.java


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