本文整理了Java中javafx.scene.Node.getId()
方法的一些代码示例,展示了Node.getId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getId()
方法的具体详情如下:
包路径:javafx.scene.Node
类名称:Node
方法名:getId
暂无
代码示例来源:origin: jfoenixadmin/JFoenix
private void bindNodeToController(Node node, Class<?> controllerClass, Flow flow, FlowHandler flowHandler) {
flow.withGlobalLink(node.getId(), controllerClass);
}
代码示例来源:origin: com.miglayout/miglayout-javafx
private static boolean isReplacement(Node node)
{
return ANIM_REPLACE_ID.equals(node.getId());
}
代码示例来源:origin: com.vektorsoft.demux.desktop/demux-jfx-core
@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);
}
代码示例来源:origin: org.jfxtras/jfxtras-common
/**
*
* @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;
}
代码示例来源:origin: org.jfxtras/jfxtras-common
/**
*
* @param id
* @param node
* @return
*/
public Node addReusableNode(Node node) {
if (node.getId() == null || node.getId().trim().length() == 0) {
throw new IllegalArgumentException("A reusable node must have an id");
}
getReusableNodes().add(node);
return node;
}
代码示例来源:origin: com.vektorsoft.demux.desktop/demux-jfx-core
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;
}
}
代码示例来源:origin: org.tentackle/tentackle-fx
@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();
}
代码示例来源:origin: org.tentackle/tentackle-fx
@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();
}
代码示例来源:origin: com.cathive.fx/fx-guice
/**
* 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;
}
代码示例来源:origin: com.cedarsoft.commons/javafx
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);
});
}
}
代码示例来源:origin: org.jfxtras/jfxtras-common
public String toString() {
return super.toString()
+ (getRoot() == null || getRoot().getId() == null ? "" : ", root-id=" + getRoot().getId())
+ (getRoot() == null? "" : ", root=" + getRoot())
;
}
}
代码示例来源:origin: org.controlsfx/controlsfx
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;
}
代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay
@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);
}
}
代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay
@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);
}
}
代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay
/**
* 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;
}
代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay
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;
}
代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay
@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);
}
}
代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine
@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));
}
}
}
}});
}
代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX
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);
}
});
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls
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);
}
});
}
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!