javafx.scene.Node.getId()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(326)

本文整理了Java中javafx.scene.Node.getId()方法的一些代码示例,展示了Node.getId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getId()方法的具体详情如下:
包路径:javafx.scene.Node
类名称:Node
方法名:getId

Node.getId介绍

暂无

代码示例

代码示例来源:origin: jfoenixadmin/JFoenix

  1. private void bindNodeToController(Node node, Class<?> controllerClass, Flow flow, FlowHandler flowHandler) {
  2. flow.withGlobalLink(node.getId(), controllerClass);
  3. }

代码示例来源:origin: com.miglayout/miglayout-javafx

  1. private static boolean isReplacement(Node node)
  2. {
  3. return ANIM_REPLACE_ID.equals(node.getId());
  4. }

代码示例来源:origin: com.vektorsoft.demux.desktop/demux-jfx-core

  1. @Override
  2. public int compare(Node o1, Node o2) {
  3. int i1 = -1;
  4. if (o1.getId() != null) {
  5. i1 = indexMap.get(o1.getId());
  6. }
  7. if (i1 < 0) {
  8. i1 = Integer.MAX_VALUE;
  9. }
  10. int i2 = -1;
  11. if (o2.getId() != null) {
  12. i2 = indexMap.get(o2.getId());
  13. }
  14. if (i2 < 0) {
  15. i2 = Integer.MAX_VALUE;
  16. }
  17. return Integer.compare(i1, i2);
  18. }

代码示例来源:origin: org.jfxtras/jfxtras-common

  1. /**
  2. *
  3. * @param refId
  4. * @return
  5. */
  6. Node findResuableNode(String refId) {
  7. for (Node lNode : reusableNodes) {
  8. if (refId.equals(lNode.getId())) {
  9. return lNode;
  10. }
  11. }
  12. System.err.println("Could not find reference " + refId);
  13. return null;
  14. }

代码示例来源:origin: org.jfxtras/jfxtras-common

  1. /**
  2. *
  3. * @param id
  4. * @param node
  5. * @return
  6. */
  7. public Node addReusableNode(Node node) {
  8. if (node.getId() == null || node.getId().trim().length() == 0) {
  9. throw new IllegalArgumentException("A reusable node must have an id");
  10. }
  11. getReusableNodes().add(node);
  12. return node;
  13. }

代码示例来源:origin: com.vektorsoft.demux.desktop/demux-jfx-core

  1. public static Node findToolbarItemById(ToolBar toolbar, String id){
  2. Node out = null;
  3. for(Node n : toolbar.getItems()){
  4. if(id.equals(n.getId())){
  5. out = n;
  6. break;
  7. }
  8. }
  9. return out;
  10. }
  11. }

代码示例来源:origin: org.tentackle/tentackle-fx

  1. @Override
  2. public String toGenericString() {
  3. StringBuilder buf = new StringBuilder();
  4. buf.append("container ").
  5. append(getContainer().getClass().getName());
  6. String id = ((Node) getContainer()).getId();
  7. if (id != null) {
  8. buf.append('[').append(id).append(']');
  9. }
  10. return buf.toString();
  11. }

代码示例来源:origin: org.tentackle/tentackle-fx

  1. @Override
  2. public String toGenericString() {
  3. StringBuilder buf = new StringBuilder();
  4. buf.append("component ").
  5. append(getComponent().getClass().getName());
  6. String id = ((Node) getComponent()).getId();
  7. if (id != null) {
  8. buf.append('[').append(id).append(']');
  9. }
  10. return buf.toString();
  11. }

代码示例来源:origin: com.cathive.fx/fx-guice

  1. /**
  2. * Find a non {@code null} ID on the given {@link Parent}. If the ID is
  3. * {@code null} then search up the graph to find a node with the given ID.
  4. *
  5. * @param node
  6. * The starting node.
  7. * @return The ID of this node or the ID of the parent if this is
  8. * {@code null}, if this is also null then the parent's parent will
  9. * be returned if non-{@code null} and so on. If no parent's have an
  10. * ID set then {@code null} is returned.
  11. */
  12. public static String getParentId(final Node node) {
  13. final String parentId;
  14. if (node == null) {
  15. parentId = null;
  16. } else if (node.getId() != null) {
  17. parentId = node.getId();
  18. } else {
  19. parentId = getParentId(node.getParent());
  20. }
  21. return parentId;
  22. }

代码示例来源:origin: com.cedarsoft.commons/javafx

  1. private static void dump(Node node, PrintStream out, int depth) {
  2. out.println(Strings.repeat(" ", depth) + node + " #" + node.getId());
  3. Parent parent = (Parent) node;
  4. parent.getChildrenUnmodifiable()
  5. .forEach(child -> {
  6. dump(child, out, depth + 1);
  7. });
  8. }
  9. }

代码示例来源:origin: org.jfxtras/jfxtras-common

  1. public String toString() {
  2. return super.toString()
  3. + (getRoot() == null || getRoot().getId() == null ? "" : ", root-id=" + getRoot().getId())
  4. + (getRoot() == null? "" : ", root=" + getRoot())
  5. ;
  6. }
  7. }

代码示例来源:origin: org.controlsfx/controlsfx

  1. private boolean readSetting(Node n) {
  2. if (n == null) {
  3. return false;
  4. }
  5. Object setting = ValueExtractor.getValue(n);
  6. if (setting != null) {
  7. // save it into the settings map.
  8. // if the node has an id set, we will use that as the setting name
  9. String settingName = n.getId();
  10. // but if the id is not set, we will use a generic naming scheme
  11. if (settingName == null || settingName.isEmpty()) {
  12. settingName = "page_" /*+ previousPageIndex*/ + ".setting_" + settingCounter; //$NON-NLS-1$ //$NON-NLS-2$
  13. }
  14. getSettings().put(settingName, setting);
  15. settingCounter++;
  16. }
  17. return setting != null;
  18. }

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

  1. @Override
  2. protected void selectionChanged() {
  3. super.selectionChanged();
  4. Group footerText = createFooterText();
  5. footerText.setLayoutX(50);
  6. footerText.setLayoutY(250 + 36 + 7 * 24);
  7. for (Iterator<Node> iterator = getContent().iterator(); iterator.hasNext(); ) {
  8. Node child = iterator.next();
  9. if ("footerText".equals(child.getId())) {
  10. iterator.remove();
  11. break;
  12. }
  13. }
  14. getContent().add(footerText);
  15. }
  16. }

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

  1. @Override
  2. protected void selectionChanged() {
  3. super.selectionChanged();
  4. initializeRequirements();
  5. Group footerText = createFooterText();
  6. footerText.setLayoutX(50);
  7. footerText.setLayoutY(250 + 36 + 7 * 24);
  8. for (Iterator<Node> iterator = getContent().iterator(); iterator.hasNext(); ) {
  9. Node child = iterator.next();
  10. if ("footerText".equals(child.getId())) {
  11. iterator.remove();
  12. break;
  13. }
  14. }
  15. getContent().add(footerText);
  16. }
  17. }

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

  1. /**
  2. * Remove a node identified by <code>id</code> from the parent
  3. * and return the index.
  4. * @param parent containing the node
  5. * @param id of the id
  6. * @return index in the children of the removed node within id. If the node
  7. * cannot be found -1 will be returned.
  8. */
  9. public int removeById(Pane parent, String id) {
  10. Preconditions.checkNotNull(id, "The identifying id must not be null");
  11. ObservableList<Node> children = parent.getChildren();
  12. int index = -1;
  13. for (int i = 0; i < children.size(); i++) {
  14. Node node = children.get(i);
  15. if (id.equals(node.getId())) {
  16. index = i;
  17. break;
  18. }
  19. }
  20. if (index >= 0) {
  21. children.remove(index);
  22. }
  23. return index;
  24. }

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

  1. private ShipIcon findShipIcon(INavigableVessel vessel) {
  2. String id = vessel.getUuid();
  3. for (Node node : shipCanvas.getChildrenUnmodifiable()) {
  4. if (node instanceof ShipIcon && id.equals(node.getId())) {
  5. return (ShipIcon) node;
  6. }
  7. }
  8. logger.trace("The vessel "+vessel.getUuid()+": "+vessel.getName()+" of "+vessel.getOwner().getClass().getSimpleName()+" "+vessel.getOwner().getName()+" "+vessel.getOwner().getLastName()+" is not visible on the map");
  9. return null;
  10. }

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

  1. @Override
  2. protected void selectionChanged() {
  3. super.selectionChanged();
  4. initializeRequirements();
  5. Group footerText = createFooterText();
  6. footerText.setLayoutX(50);
  7. footerText.setLayoutY(250 + 36 + 7 * 24);
  8. for (Iterator<Node> iterator = getContent().iterator(); iterator.hasNext(); ) {
  9. Node child = iterator.next();
  10. if ("footerText".equals(child.getId())) {
  11. iterator.remove();
  12. break;
  13. }
  14. }
  15. getContent().add(footerText);
  16. }
  17. }

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

  1. @Override
  2. public void onChanged(Change<? extends Node> c) {
  3. boolean next = c.next();
  4. if(next) {
  5. List n = c.getAddedSubList();
  6. for(Object node : n) {
  7. if(!"LoadingPane".equalsIgnoreCase(((Node)node).getId())) {
  8. folderTable.getContent().getChildren().addAll(((Node)node));
  9. }
  10. }
  11. }
  12. }});
  13. }

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

  1. private void updateCityEvent() {
  2. threadExecution.execute(() -> {
  3. ObjectProperty<ECityState> cityEvent = cityState.cityEventProperty();
  4. for (Iterator<Node> iterator = getChildren().iterator(); iterator.hasNext(); ) {
  5. Node child = iterator.next();
  6. if (child.getId().equals(CITY_EVENT_ID)) {
  7. iterator.remove();
  8. break;
  9. }
  10. }
  11. if (cityEvent.get() != null) {
  12. // display event icon
  13. Image iconImg = imageLoader.getImage("icons/32/" + getEventIconName(cityEvent.get()));
  14. ImageView imgView = new ImageView(iconImg);
  15. getChildren().add(imgView);
  16. }
  17. });
  18. }

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

  1. private void attachListener() {
  2. Node n = getContent();
  3. if (n != null) {
  4. for (Node c : n.lookupAll(".component")) { //$NON-NLS-1$
  5. if (c.getId() != null) {
  6. for (Node s : c.lookupAll(".shape")) { //$NON-NLS-1$
  7. s.setOnMouseEntered((e) -> {
  8. this.hoverNode.set(c);
  9. });
  10. s.setOnMouseExited((e) -> {
  11. if (this.hoverNode.get() == c) {
  12. this.hoverNode.set(null);
  13. }
  14. });
  15. s.setOnMouseReleased((e) -> {
  16. if (e.getClickCount() == 2) {
  17. fireEvent(new OpenItemEvent(c));
  18. } else {
  19. this.selectedNodes.clear();
  20. this.selectedNodes.add(c);
  21. }
  22. });
  23. }
  24. }
  25. }
  26. }
  27. }

相关文章

Node类方法