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


Java TextFieldTreeCell类代码示例

本文整理汇总了Java中javafx.scene.control.cell.TextFieldTreeCell的典型用法代码示例。如果您正苦于以下问题:Java TextFieldTreeCell类的具体用法?Java TextFieldTreeCell怎么用?Java TextFieldTreeCell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: TextFieldTreeViewSample

import javafx.scene.control.cell.TextFieldTreeCell; //导入依赖的package包/类
public TextFieldTreeViewSample() {
    final TreeItem<String> treeRoot = new TreeItem<String>("Root node");
    treeRoot.getChildren().addAll(Arrays.asList(new TreeItem<String>("Child Node 1"), new TreeItem<String>("Child Node 2"),
            new TreeItem<String>("Child Node 3")));

    treeRoot.getChildren().get(2).getChildren().addAll(Arrays.asList(new TreeItem<String>("Child Node 4"),
            new TreeItem<String>("Child Node 5"), new TreeItem<String>("Child Node 6"), new TreeItem<String>("Child Node 7"),
            new TreeItem<String>("Child Node 8"), new TreeItem<String>("Child Node 9"), new TreeItem<String>("Child Node 10"),
            new TreeItem<String>("Child Node 11"), new TreeItem<String>("Child Node 12")));

    final TreeView treeView = new TreeView();
    treeView.setShowRoot(true);
    treeView.setRoot(treeRoot);
    treeRoot.setExpanded(true);
    treeView.setEditable(true);
    treeView.setCellFactory(TextFieldTreeCell.forTreeView());

    getChildren().add(treeView);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:TextFieldTreeViewSample.java

示例2: select

import javafx.scene.control.cell.TextFieldTreeCell; //导入依赖的package包/类
@Test public void select() {
    @SuppressWarnings("unchecked")
    TreeView<String> treeView = (TreeView<String>) getPrimaryStage().getScene().getRoot().lookup(".tree-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        @SuppressWarnings("unchecked")
        TextFieldTreeCell<String> cell = (TextFieldTreeCell<String>) getCellAt(treeView, 2);
        Point2D point = getPoint(treeView, 2);
        RFXTreeView rfxTreeView = new RFXTreeView(treeView, null, point, lr);
        rfxTreeView.focusGained(rfxTreeView);
        cell.startEdit();
        cell.updateItem("Child node 4 Modified", false);
        cell.commitEdit("Child node 4 Modified");
        rfxTreeView.focusLost(rfxTreeView);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("Child node 4 Modified", recording.getParameters()[0]);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:RFXTreeViewTextFieldTreeCellTest.java

示例3: call

import javafx.scene.control.cell.TextFieldTreeCell; //导入依赖的package包/类
@Override
public TreeCell<V> call(TreeView<V> param) {
	TextFieldTreeCell<V> textFieldTreeCell = new TextFieldTreeCell<V>(treeItemStringConverter) {

		@Override
		public void updateItem(V item, boolean empty) {
			super.updateItem(item, empty);
			if (empty) {
				setGraphic(null);
			} else {
				ObservableList<File> items = item.getItems();
				if (!items.isEmpty()) {
					File file = items.get(0);
					setGraphic(new FileIconImageView(file));
				}

			}
		}

	};

	return textFieldTreeCell;
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:24,代码来源:FilesAnalysisComposite.java

示例4: FxControlsTreeItem

import javafx.scene.control.cell.TextFieldTreeCell; //导入依赖的package包/类
public FxControlsTreeItem(TreeView<Node> tv) {
	this.tv = tv;

	tv.setCellFactory(param -> {
		TreeCell<Node> treeCell = new TextFieldTreeCell<Node>(new StringConverter<Node>() {
			@Override
			public String toString(Node n) {
				return getName(n);
			}

			@Override
			public Node fromString(String string) {
				return null;
			}

		});
		return treeCell;
	});

}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:21,代码来源:FxControlsTreeItem.java

示例5: _getValue

import javafx.scene.control.cell.TextFieldTreeCell; //导入依赖的package包/类
@SuppressWarnings("unchecked") @Override public String _getValue() {
    TextFieldTreeCell<?> cell = (TextFieldTreeCell<?>) node;
    @SuppressWarnings("rawtypes")
    StringConverter converter = cell.getConverter();
    if (converter != null) {
        return converter.toString(cell.getItem());
    }
    return cell.getItem().toString();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:10,代码来源:RFXTextFieldTreeCell.java

示例6: RaxStructureTreeView

import javafx.scene.control.cell.TextFieldTreeCell; //导入依赖的package包/类
public RaxStructureTreeView() {

		setCellFactory(new Callback<TreeView<RaxItem>, TreeCell<RaxItem>>() {

			@Override
			public TreeCell<RaxItem> call(TreeView<RaxItem> param) {

				return new TextFieldTreeCell<>(new StringConverter<RaxItem>() {

					@Override
					public String toString(RaxItem object) {
						if (object == null)
							return "";
						return object.getText();
					}

					@Override
					public RaxItem fromString(String string) {
						return null;
					}
				});

			}
		});

		setRoot(treeItem);

	}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:29,代码来源:RaxStructureTreeView.java

示例7: testGetTextFieldTreeCellAdjuster

import javafx.scene.control.cell.TextFieldTreeCell; //导入依赖的package包/类
@Test
public void testGetTextFieldTreeCellAdjuster() {
	Adjuster adjuster = Adjuster.getAdjuster(TextFieldTreeCell.class);
	
	assertThat(adjuster, is(instanceOf(ControlAdjuster.class)));
	assertThat(adjuster.getNodeClass(), is(sameInstance(Control.class)));
}
 
开发者ID:yumix,项目名称:javafx-dpi-scaling,代码行数:8,代码来源:AdjusterTest.java

示例8: initialize

import javafx.scene.control.cell.TextFieldTreeCell; //导入依赖的package包/类
public void initialize() {
    NavItem.navs.stream().forEach((ni) -> {
        root.getChildren().add(new TreeItem<>(ni));
    });

    nav2.setCellFactory(new Callback<TreeView<NavItem>, TreeCell<NavItem>>() {

        @Override
        public TreeCell<NavItem> call(TreeView<NavItem> param) {
            return new TextFieldTreeCell<>(new StringConverter<NavItem>() {

                @Override
                public String toString(NavItem object) {
                    return object == null ? "null" : object.getName();
                }

                @Override
                public NavItem fromString(String string) {
                    throw new UnsupportedOperationException();
                }
            });
        }
    });

    nav2.setRoot(root);

    rootGroup.addEventHandler(NavItemEvent.NAV_CHANGED, new EventHandler<NavItemEvent>() {

        @Override
        public void handle(NavItemEvent event) {
            NavItem newItem = event.getNewValue();
            swithBy(newItem);
        }

    });

    splitPane.getStyleClass().add("hidden-splitter");

}
 
开发者ID:cosysoft,项目名称:agile,代码行数:40,代码来源:MainView.java

示例9: XMLTreeView

import javafx.scene.control.cell.TextFieldTreeCell; //导入依赖的package包/类
public XMLTreeView() {
	this.setCellFactory(TextFieldTreeCell.forTreeView(new StringConverter<XMLMeta>() {

		@Override
		public String toString(XMLMeta object) {
			if (object == null)
				return "";

			String name = object.getName() == null ? "" : object.getName();
			String text = ValueUtil.isEmpty(object.getText()) ? "" : String.format(" (%s)", object.getText());
			return name.concat(text);

		}

		@Override
		public XMLMeta fromString(String string) {
			return null;
		}
	}));

	this.setShowRoot(false);
	this.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

	xml.addListener(new ChangeListener<String>() {

		@Override
		public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {

			if (ValueUtil.isEmpty(newValue))
				return;

			TreeItem<XMLMeta> tiRoot = new TreeItem<>();
			XMLTreeView.this.setRoot(tiRoot);
			tiRoot.setExpanded(true);

			try {
				SAXPasrerUtil.getAll(new ByteArrayInputStream(newValue.getBytes()), new XMLTreeHandler(tiRoot));
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	});

	this.setOnKeyPressed(this::keyOnPressd);
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:46,代码来源:XMLTreeView.java

示例10: addContextMenus

import javafx.scene.control.cell.TextFieldTreeCell; //导入依赖的package包/类
/**
 * 컨텍스트 메뉴 등록
 *
 * @작성자 : KYJ
 * @작성일 : 2016. 4. 4.
 */
void addContextMenus() {
	menuNew = new Menu("New");
	menuAddNewLocation = new MenuItem("Repository Location");
	menuDiscardLocation = new MenuItem("Discard Location");
	menuReflesh = new MenuItem("Reflesh");
	menuCheckout = new MenuItem("Checkout");
	menuCopy = new MenuItem("Copy");

	menuSvnGraph = new MenuItem("SVN Graph");
	menuProperties = new MenuItem("Properties");

	menuNew.getItems().add(menuAddNewLocation);

	menuAddNewLocation.setOnAction(this::menuAddNewLocationOnAction);
	menuDiscardLocation.setOnAction(this::menuDiscardLocationOnAction);
	menuCheckout.setOnAction(this::menuCheckoutOnAction);
	menuSvnGraph.setOnAction(this::menuSVNGraphOnAction);
	menuProperties.setOnAction(this::menuPropertiesOnAction);
	menuCopy.setOnAction(this::menuCopyOnAction);
	contextMenuDir = new ContextMenu(menuNew, new SeparatorMenuItem(), menuCheckout, menuCopy, new SeparatorMenuItem(), menuSvnGraph,
			new SeparatorMenuItem(), menuDiscardLocation, menuReflesh, new SeparatorMenuItem(), menuProperties);

	// contextMenuFile = new ContextMenu(menuProperties);
	// setContextMenu(contextMenu);

	// setOnContextMenuRequested(ev -> {
	//
	// Node intersectedNode = ev.getPickResult().getIntersectedNode();
	// if (intersectedNode instanceof TreeCell) {
	// contextMenuDir.show(FxUtil.getWindow(this));
	// }
	//
	// });
	setCellFactory(new Callback<TreeView<SVNItem>, TreeCell<SVNItem>>() {
		@Override
		public TreeCell<SVNItem> call(TreeView<SVNItem> tv) {
			TextFieldTreeCell<SVNItem> textFieldTreeCell = new TextFieldTreeCell<SVNItem>();
			textFieldTreeCell.setContextMenu(contextMenuDir);
			return textFieldTreeCell;
		}
	});

	// 특정 조건에 따른 메뉴 VISIBLE 처리를 정의함.
	contextMenuDir.setOnShown(contextMenuVisibleEvent);
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:52,代码来源:SVNTreeView.java

示例11: createContent

import javafx.scene.control.cell.TextFieldTreeCell; //导入依赖的package包/类
@Override
public Node createContent() {
    final BorderPane borderPane = new BorderPane();
    factoryLogRootUpdater= root -> {
        TreeView<FactoryLogWidgetTreeData> treeView = new TreeView<>();
        if (factoryLog.root!=null){
            treeView.setRoot(createLogTree(factoryLog.root, System.currentTimeMillis()+5000,new HashMap<>()));
        }
        treeView.setCellFactory(param-> new TextFieldTreeCell<FactoryLogWidgetTreeData>(){
            @Override
            public void updateItem(FactoryLogWidgetTreeData item, boolean empty) {
                super.updateItem(item, empty);
                if (!empty) {
                    setText(item.getText());
                    setGraphic(uniformDesign.createIcon(item.getIcon()));
                }
            }
        });
        final TabPane tabPane = new TabPane();
        tabPane.getStyleClass().add("floating");

        final Tab treeTab = new Tab("Updated Tree");
        treeTab.setContent(treeView);
        tabPane.getTabs().add(treeTab);

        final Tab tableTab = new Tab("Updated Table");
        tableTab.setContent(treeView);
        if (factoryLog.root!=null){
            tableTab.setContent(createTable(factoryLog.root.getListDeep()));
        }
        tabPane.getTabs().add(tableTab);

        final Tab removedTab = new Tab("Removed");
        removedTab.setContent(treeView);
        removedTab.setContent(createTable(factoryLog.removedFactoryLogs));
        tabPane.getTabs().add(removedTab);

        borderPane.setCenter(tabPane);
        final Label totalDuarion = new Label("total update duration: " + (factoryLog.totalDurationNs / 1000000.0) + "ms");
        BorderPane.setMargin(totalDuarion,new Insets(3));
        borderPane.setTop(totalDuarion);
    };
    if (factoryLog!=null) {
        factoryLogRootUpdater.accept(factoryLog);
    }
    return borderPane;
}
 
开发者ID:factoryfx,项目名称:factoryfx,代码行数:48,代码来源:FactoryUpdateLogWidget.java

示例12: ProjectionSelectionDialog

import javafx.scene.control.cell.TextFieldTreeCell; //导入依赖的package包/类
public ProjectionSelectionDialog() {
	projMap = new HashMap<TreeItem<String>, Projection>();
	
	final TreeItem<String> root = new TreeItem<String>();
	menu = new TreeView<String>(root);
	menu.setShowRoot(false); //create and configure the TreeView of options
	menu.setPrefWidth(MENU_WIDTH);
	
	flow = new TextFlow(); //create and configure the description area
	flow.setPrefWidth(TEXT_WIDTH);
	text = new GridPane();
	text.setHgap(10);
	
	menu.getSelectionModel().selectedItemProperty().addListener((observable, old, now) -> {
			if (projMap.containsKey(now)) //selection callback to describe each projection
				describe(projMap.get(now));
			else if (now != null) {
				describe(null);
			}
		});
	menu.setCellFactory((tView) -> { //factoring cells to detect double-clicks
			final TreeCell<String> cell = new TextFieldTreeCell<String>();
			cell.setOnMouseClicked((event) -> { //on double click, close dialog
					if (event.getClickCount() >= 2 && projMap.containsKey(cell.getTreeItem())) {
						this.setResult(projMap.get(cell.getTreeItem()));
					}
				});
			return cell;
		});
	
	String[] categories = MapApplication.PROJECTION_CATEGORIES;
	Projection[][] projections = MapApplication.ALL_PROJECTIONS;
	for (int i = 0; i < categories.length; i ++) { //finally, populate the TreeView
		final TreeItem<String> header = new TreeItem<String>(categories[i]);
		root.getChildren().add(header);
		for (int j = 0; j < projections[i].length; j ++) {
			final TreeItem<String> leaf = new TreeItem<String>(projections[i][j].getName());
			projMap.put(leaf, projections[i][j]);
			header.getChildren().add(leaf);
		}
	}
	
	this.setTitle("Projection selection"); //set general properties for the dialog
	final DialogPane pane = this.getDialogPane();
	pane.setHeaderText("Choose a projection from the list below.");
	pane.getButtonTypes().addAll(new ButtonType[] { ButtonType.OK, ButtonType.CANCEL }); //add buttons
	pane.setContent(new HBox(10, menu, new VBox(10, flow, text)));
	
	this.setResultConverter((btn) -> { //how to return a result:
			if (btn != null && btn.getButtonData() == ButtonData.OK_DONE) {
				final TreeItem<String> selection =  menu.getSelectionModel().getSelectedItem();
				return projMap.getOrDefault(selection, Projection.NULL_PROJECTION); //return the corresponding projection
			} //or NULL_PROJECTION if the user never chose anything
			else {
				return null;
			}
		});
}
 
开发者ID:jkunimune15,项目名称:Map-Projections,代码行数:59,代码来源:ProjectionSelectionDialog.java

示例13: initialize

import javafx.scene.control.cell.TextFieldTreeCell; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {

    // ルートの子要素を作成
    TreeItem<String> item1 = new TreeItem<String>("Item 1");
    TreeItem<String> item2 = new TreeItem<String>("Item 2");
    TreeItem<String> item3 = new TreeItem<String>("Item 3");
    TreeItem<String> item4 = new TreeItem<String>("Item 4");

    // item4 の子要素
    TreeItem<String> item41 = new TreeItem<String>("Item 4-1");
    TreeItem<String> item42 = new TreeItem<String>("Item 4-2");
    TreeItem<String> item43 = new TreeItem<String>("Item 4-3");

    // item4 に子要素を追加する
    ObservableList<TreeItem<String>> image4tChildren =
            item4.getChildren();
    image4tChildren.add(item41);
    image4tChildren.add(item42);
    image4tChildren.add(item43);

    TreeItem<String> root = new TreeItem<String>("root");
    treeView.setRoot(root);

    // ルート要素に子要素を追加する
    ObservableList<TreeItem<String>> rootChildren =
            root.getChildren();
    rootChildren.add(item1);
    rootChildren.add(item2);
    rootChildren.add(item3);
    rootChildren.add(item4);

    // 子を持つノードを開く
    root.setExpanded(true);
    item4.setExpanded(true);

    // 編集可能にする
    treeView.setEditable(true);
    treeView.setCellFactory(
            (TreeView<String> p) -> {
                TextFieldTreeCell<String> cell = new TextFieldTreeCell<String>();

                // 編集した文字列を、
                // セルが持つデータに反映させるロジックを指定。
                // 今回はテキストフィールドに入力した文字列を
                // そのままセルが持つデータとして使うので、
                // DefaultStringConverter を使用。
                cell.setConverter(new DefaultStringConverter());
                return cell;
            });
}
 
开发者ID:mikoto2000,项目名称:MiscellaneousStudy,代码行数:52,代码来源:EditableTreeViewController.java


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