Java Code Examples for javafx.scene.Node#getUserData()

The following examples show how to use javafx.scene.Node#getUserData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReadLayoutPaneSearcher.java    From megan-ce with GNU General Public License v3.0 6 votes vote down vote up
/**
 * update lists, must be called after list of visible labels has changed
 */
public ReadLayoutPaneSearcher updateLists() {
    labels.clear();
    for (Group group : readLayoutPane.getVisibleGroups()) {
        for (Node node : group.getChildren()) {
            if (node instanceof Label && node.getUserData() instanceof IMatchBlock[]) {
                labels.add((Label) node);
            }
        }
    }
    labels.sort((a, b) -> {
        Integer startA = ((IMatchBlock[]) a.getUserData())[0].getAlignedQueryStart();
        return startA.compareTo(((IMatchBlock[]) b.getUserData())[0].getAlignedQueryStart());
    });
    return this;
}
 
Example 2
Source File: WhitespaceOverlayFactory.java    From markdown-writer-fx with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
void layoutOverlayNodes(int paragraphIndex, List<Node> nodes) {
	Insets insets = getInsets();
	double leftInsets = insets.getLeft();
	double topInsets = insets.getTop();

	// all paragraphs except last one have line separators
	boolean showEOL = (paragraphIndex < getTextArea().getParagraphs().size() - 1);
	Node eolNode = nodes.get(nodes.size() - 1);
	if (eolNode.isVisible() != showEOL)
		eolNode.setVisible(showEOL);

	for (Node node : nodes) {
		Range range = (Range) node.getUserData();
		Rectangle2D bounds = getBounds(range.start, range.end);
		node.setLayoutX(leftInsets + (node == eolNode ? bounds.getMaxX() : bounds.getMinX()));
		node.setLayoutY(topInsets + bounds.getMinY());
	}
}
 
Example 3
Source File: GameElimniationController.java    From MyBox with Apache License 2.0 5 votes vote down vote up
protected int getImageIndex(int i, int j) {
    try {
        Node node = getImageNode(i, j);
        return (int) (node.getUserData());
    } catch (Exception e) {
        logger.debug(e.toString());
        return -1;
    }
}
 
Example 4
Source File: ColorPaletteController.java    From MyBox with Apache License 2.0 5 votes vote down vote up
public Rectangle findRect(Color color) {
    int colorValue = ImageColor.getRGB(color);
    for (Node node : colorsPane.getChildren()) {
        try {
            ColorData data = (ColorData) node.getUserData();
            if (data.getColorValue() == colorValue) {
                return (Rectangle) node;
            }
        } catch (Exception e) {
        }
    }
    return null;
}
 
Example 5
Source File: ColorPaletteController.java    From MyBox with Apache License 2.0 5 votes vote down vote up
public Rectangle findRect(ColorData data) {
    for (Node node : colorsPane.getChildren()) {
        try {
            ColorData nodeData = (ColorData) node.getUserData();
            if (nodeData.getColorValue() == data.getColorValue()) {
                return (Rectangle) node;
            }
        } catch (Exception e) {
        }
    }
    return null;
}
 
Example 6
Source File: MetaDeckView.java    From metastone with GNU General Public License v2.0 4 votes vote down vote up
public void deckChanged(MetaDeck metaDeck) {
	for (Node node : contentPane.getChildren()) {
		Deck deck = (Deck) node.getUserData();
		node.setDisable(metaDeck.getDecks().contains(deck));
	}
}