private void bindNodeToController(Node node, Class<?> controllerClass, Flow flow, FlowHandler flowHandler) { flow.withGlobalLink(node.getId(), controllerClass); }
private static boolean isReplacement(Node node) { return ANIM_REPLACE_ID.equals(node.getId()); }
@Override public int compare(Node o1, Node o2) { int i1 = -1; if (o1.getId() != null) { i1 = indexMap.get(o1.getId()); } if (i1 < 0) { i1 = Integer.MAX_VALUE; } int i2 = -1; if (o2.getId() != null) { i2 = indexMap.get(o2.getId()); } if (i2 < 0) { i2 = Integer.MAX_VALUE; } return Integer.compare(i1, i2); }
/** * * @param refId * @return */ Node findResuableNode(String refId) { for (Node lNode : reusableNodes) { if (refId.equals(lNode.getId())) { return lNode; } } System.err.println("Could not find reference " + refId); return null; }
public static Node findToolbarItemById(ToolBar toolbar, String id){ Node out = null; for(Node n : toolbar.getItems()){ if(id.equals(n.getId())){ out = n; break; } } return out; } }
@Override public String toGenericString() { StringBuilder buf = new StringBuilder(); buf.append("container "). append(getContainer().getClass().getName()); String id = ((Node) getContainer()).getId(); if (id != null) { buf.append('[').append(id).append(']'); } return buf.toString(); }
@Override public String toGenericString() { StringBuilder buf = new StringBuilder(); buf.append("component "). append(getComponent().getClass().getName()); String id = ((Node) getComponent()).getId(); if (id != null) { buf.append('[').append(id).append(']'); } return buf.toString(); }
/** * Find a non {@code null} ID on the given {@link Parent}. If the ID is * {@code null} then search up the graph to find a node with the given ID. * * @param node * The starting node. * @return The ID of this node or the ID of the parent if this is * {@code null}, if this is also null then the parent's parent will * be returned if non-{@code null} and so on. If no parent's have an * ID set then {@code null} is returned. */ public static String getParentId(final Node node) { final String parentId; if (node == null) { parentId = null; } else if (node.getId() != null) { parentId = node.getId(); } else { parentId = getParentId(node.getParent()); } return parentId; }
private static void dump(Node node, PrintStream out, int depth) { out.println(Strings.repeat(" ", depth) + node + " #" + node.getId()); Parent parent = (Parent) node; parent.getChildrenUnmodifiable() .forEach(child -> { dump(child, out, depth + 1); }); } }
private boolean readSetting(Node n) { if (n == null) { return false; } Object setting = ValueExtractor.getValue(n); if (setting != null) { // save it into the settings map. // if the node has an id set, we will use that as the setting name String settingName = n.getId(); // but if the id is not set, we will use a generic naming scheme if (settingName == null || settingName.isEmpty()) { settingName = "page_" /*+ previousPageIndex*/ + ".setting_" + settingCounter; //$NON-NLS-1$ //$NON-NLS-2$ } getSettings().put(settingName, setting); settingCounter++; } return setting != null; }
@Override protected void selectionChanged() { super.selectionChanged(); Group footerText = createFooterText(); footerText.setLayoutX(50); footerText.setLayoutY(250 + 36 + 7 * 24); for (Iterator<Node> iterator = getContent().iterator(); iterator.hasNext(); ) { Node child = iterator.next(); if ("footerText".equals(child.getId())) { iterator.remove(); break; } } getContent().add(footerText); } }
@Override protected void selectionChanged() { super.selectionChanged(); initializeRequirements(); Group footerText = createFooterText(); footerText.setLayoutX(50); footerText.setLayoutY(250 + 36 + 7 * 24); for (Iterator<Node> iterator = getContent().iterator(); iterator.hasNext(); ) { Node child = iterator.next(); if ("footerText".equals(child.getId())) { iterator.remove(); break; } } getContent().add(footerText); } }
/** * Remove a node identified by <code>id</code> from the parent * and return the index. * @param parent containing the node * @param id of the id * @return index in the children of the removed node within id. If the node * cannot be found -1 will be returned. */ public int removeById(Pane parent, String id) { Preconditions.checkNotNull(id, "The identifying id must not be null"); ObservableList<Node> children = parent.getChildren(); int index = -1; for (int i = 0; i < children.size(); i++) { Node node = children.get(i); if (id.equals(node.getId())) { index = i; break; } } if (index >= 0) { children.remove(index); } return index; }
private ShipIcon findShipIcon(INavigableVessel vessel) { String id = vessel.getUuid(); for (Node node : shipCanvas.getChildrenUnmodifiable()) { if (node instanceof ShipIcon && id.equals(node.getId())) { return (ShipIcon) node; } } 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"); return null; }
@Override protected void selectionChanged() { super.selectionChanged(); initializeRequirements(); Group footerText = createFooterText(); footerText.setLayoutX(50); footerText.setLayoutY(250 + 36 + 7 * 24); for (Iterator<Node> iterator = getContent().iterator(); iterator.hasNext(); ) { Node child = iterator.next(); if ("footerText".equals(child.getId())) { iterator.remove(); break; } } getContent().add(footerText); } }
@Override public void onChanged(Change<? extends Node> c) { boolean next = c.next(); if(next) { List n = c.getAddedSubList(); for(Object node : n) { if(!"LoadingPane".equalsIgnoreCase(((Node)node).getId())) { folderTable.getContent().getChildren().addAll(((Node)node)); } } } }}); }
private void updateCityEvent() { threadExecution.execute(() -> { ObjectProperty<ECityState> cityEvent = cityState.cityEventProperty(); for (Iterator<Node> iterator = getChildren().iterator(); iterator.hasNext(); ) { Node child = iterator.next(); if (child.getId().equals(CITY_EVENT_ID)) { iterator.remove(); break; } } if (cityEvent.get() != null) { // display event icon Image iconImg = imageLoader.getImage("icons/32/" + getEventIconName(cityEvent.get())); ImageView imgView = new ImageView(iconImg); getChildren().add(imgView); } }); }
private void attachListener() { Node n = getContent(); if (n != null) { for (Node c : n.lookupAll(".component")) { //$NON-NLS-1$ if (c.getId() != null) { for (Node s : c.lookupAll(".shape")) { //$NON-NLS-1$ s.setOnMouseEntered((e) -> { this.hoverNode.set(c); }); s.setOnMouseExited((e) -> { if (this.hoverNode.get() == c) { this.hoverNode.set(null); } }); s.setOnMouseReleased((e) -> { if (e.getClickCount() == 2) { fireEvent(new OpenItemEvent(c)); } else { this.selectedNodes.clear(); this.selectedNodes.add(c); } }); } } } } }