Java Code Examples for javafx.scene.control.Tooltip#uninstall()

The following examples show how to use javafx.scene.control.Tooltip#uninstall() . 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: DesignerUtil.java    From pmd-designer with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public static <T> Callback<ListView<T>, ListCell<T>> simpleListCellFactory(Function<T, String> converter, Function<T, String> toolTipMaker) {
    return collection -> new ListCell<T>() {
        @Override
        protected void updateItem(T item, boolean empty) {
            super.updateItem(item, empty);

            if (empty || item == null) {
                setText(null);
                setGraphic(null);
                Tooltip.uninstall(this, getTooltip());
            } else {
                setText(converter.apply(item));
                Tooltip.install(this, new Tooltip(toolTipMaker.apply(item)));
            }
        }
    };
}
 
Example 2
Source File: ChartCanvas.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets the tooltip text, with the (x, y) location being used for the
 * anchor.  If the text is {@code null}, no tooltip will be displayed.
 * This method is intended for calling by the {@link TooltipHandlerFX}
 * class, you won't normally call it directly.
 * 
 * @param text  the text ({@code null} permitted).
 * @param x  the x-coordinate of the mouse pointer.
 * @param y  the y-coordinate of the mouse pointer.
 */
public void setTooltip(String text, double x, double y) {
    if (text != null) {
        if (this.tooltip == null) {
            this.tooltip = new Tooltip(text);
            Tooltip.install(this, this.tooltip);
        } else {
            this.tooltip.setText(text);           
            this.tooltip.setAnchorX(x);
            this.tooltip.setAnchorY(y);
        }                   
    } else {
        Tooltip.uninstall(this, this.tooltip);
        this.tooltip = null;
    }
}
 
Example 3
Source File: ViewText.java    From latexdraw with GNU General Public License v3.0 6 votes vote down vote up
private void updateImageText(final Tuple<Image, String> values) {
	if(currentCompilation != null && currentCompilation.isDone()) {
		currentCompilation = null;
	}

	compiledText.setUserData(values.b);

	// A text will be used to render the text shape.
	if(values.a == null) {
		compileTooltip.setText(SystemUtils.getInstance().getLatexErrorMessageFromLog(values.b));
		Tooltip.install(text, compileTooltip);
		setImageTextEnable(false);
		compiledText.setImage(null);
	}else {
		// An image will be used to render the text shape.
		compileTooltip.setText(null);
		Tooltip.uninstall(text, compileTooltip);
		compiledText.setImage(values.a);
		setImageTextEnable(true);
		updateTranslationCompiledText();

		getCanvasParent().ifPresent(canvas -> canvas.update());
	}
}
 
Example 4
Source File: ChartCanvas.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Sets the tooltip text, with the (x, y) location being used for the
 * anchor.  If the text is {@code null}, no tooltip will be displayed.
 * This method is intended for calling by the {@link TooltipHandlerFX}
 * class, you won't normally call it directly.
 * 
 * @param text  the text ({@code null} permitted).
 * @param x  the x-coordinate of the mouse pointer.
 * @param y  the y-coordinate of the mouse pointer.
 */
public void setTooltip(String text, double x, double y) {
    if (text != null) {
        if (this.tooltip == null) {
            this.tooltip = new Tooltip(text);
            Tooltip.install(this, this.tooltip);
        } else {
            this.tooltip.setText(text);           
            this.tooltip.setAnchorX(x);
            this.tooltip.setAnchorY(y);
        }                   
    } else {
        Tooltip.uninstall(this, this.tooltip);
        this.tooltip = null;
    }
}
 
Example 5
Source File: HandCard.java    From metastone with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void setCard(GameContext context, Card card, Player player) {
	super.setCard(context, card, player);
	if (tooltipContent == null) {
		tooltip = new Tooltip();
		tooltipContent = new CardTooltip();
		tooltipContent.setCard(context, card, player);
		tooltip.setGraphic(tooltipContent);
		Tooltip.install(this, tooltip);
	} else {
		tooltipContent.setCard(context, card, player);
	}

	hideCard(player.hideCards());

	if (player.hideCards()) {
		Tooltip.uninstall(this, tooltip);
		tooltipContent = null;
		tooltip = null;
	}
}
 
Example 6
Source File: ChartCanvas.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the tooltip text, with the (x, y) location being used for the
 * anchor.  If the text is {@code null}, no tooltip will be displayed.
 * This method is intended for calling by the {@link TooltipHandlerFX}
 * class, you won't normally call it directly.
 * 
 * @param text  the text ({@code null} permitted).
 * @param x  the x-coordinate of the mouse pointer.
 * @param y  the y-coordinate of the mouse pointer.
 */
public void setTooltip(String text, double x, double y) {
    if (text != null) {
        if (this.tooltip == null) {
            this.tooltip = new Tooltip(text);
            Tooltip.install(this, this.tooltip);
        } else {
            this.tooltip.setText(text);           
            this.tooltip.setAnchorX(x);
            this.tooltip.setAnchorY(y);
        }                   
    } else {
        Tooltip.uninstall(this, this.tooltip);
        this.tooltip = null;
    }
}
 
Example 7
Source File: ChartCanvas.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets the tooltip text, with the (x, y) location being used for the
 * anchor.  If the text is {@code null}, no tooltip will be displayed.
 * This method is intended for calling by the {@link TooltipHandlerFX}
 * class, you won't normally call it directly.
 * 
 * @param text  the text ({@code null} permitted).
 * @param x  the x-coordinate of the mouse pointer.
 * @param y  the y-coordinate of the mouse pointer.
 */
public void setTooltip(String text, double x, double y) {
    if (text != null) {
        if (this.tooltip == null) {
            this.tooltip = new Tooltip(text);
            Tooltip.install(this, this.tooltip);
        } else {
            this.tooltip.setText(text);           
            this.tooltip.setAnchorX(x);
            this.tooltip.setAnchorY(y);
        }                   
    } else {
        Tooltip.uninstall(this, this.tooltip);
        this.tooltip = null;
    }
}
 
Example 8
Source File: TaChartCanvas.java    From TAcharting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Sets the tooltip text, with the (x, y) location being used for the
 * anchor.  If the text is {@code null}, no tooltip will be displayed.
 * This method is intended for calling by the {@link TooltipHandlerFX}
 * class, you won't normally call it directly.
 *
 * @param text  the text ({@code null} permitted).
 * @param x  the x-coordinate colorOf the mouse pointer.
 * @param y  the y-coordinate colorOf the mouse pointer.
 */
public void setTooltip(String text, double x, double y) {
    if (text != null) {
        if (this.tooltip == null) {
            this.tooltip = new Tooltip(text);
            Tooltip.install(this, this.tooltip);
        } else {
            this.tooltip.setText(text);
            this.tooltip.setAnchorX(x);
            this.tooltip.setAnchorY(y);
        }
    } else {
        Tooltip.uninstall(this, this.tooltip);
        this.tooltip = null;
    }
}
 
Example 9
Source File: ChartCanvas.java    From jfreechart-fx with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Sets the tooltip text, with the (x, y) location being used for the
 * anchor.  If the text is {@code null}, no tooltip will be displayed.
 * This method is intended for calling by the {@link TooltipHandlerFX}
 * class, you won't normally call it directly.
 * 
 * @param text  the text ({@code null} permitted).
 * @param x  the x-coordinate of the mouse pointer.
 * @param y  the y-coordinate of the mouse pointer.
 */
public void setTooltip(String text, double x, double y) {
    if (text != null) {
        if (this.tooltip == null) {
            this.tooltip = new Tooltip(text);
            Tooltip.install(this, this.tooltip);
        } else {
            this.tooltip.setText(text);           
            this.tooltip.setAnchorX(x);
            this.tooltip.setAnchorY(y);
        }                   
    } else {
        Tooltip.uninstall(this, this.tooltip);
        this.tooltip = null;
    }
}
 
Example 10
Source File: ChartCanvas.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets the tooltip text, with the (x, y) location being used for the
 * anchor.  If the text is {@code null}, no tooltip will be displayed.
 * This method is intended for calling by the {@link TooltipHandlerFX}
 * class, you won't normally call it directly.
 * 
 * @param text  the text ({@code null} permitted).
 * @param x  the x-coordinate of the mouse pointer.
 * @param y  the y-coordinate of the mouse pointer.
 */
public void setTooltip(String text, double x, double y) {
    if (text != null) {
        if (this.tooltip == null) {
            this.tooltip = new Tooltip(text);
            Tooltip.install(this, this.tooltip);
        } else {
            this.tooltip.setText(text);           
            this.tooltip.setAnchorX(x);
            this.tooltip.setAnchorY(y);
        }                   
    } else {
        Tooltip.uninstall(this, this.tooltip);
        this.tooltip = null;
    }
}
 
Example 11
Source File: AttributeNameTableCell.java    From pmd-designer with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void updateAttr(@Nullable Attribute attr) {
    if (tooltip != null) {
        Tooltip.uninstall(this, tooltip);
        getStyleClass().remove(DEPRECATED_CSS_CLASS);
        tooltip = null;
    }

    if (attr == null) {
        return;
    }

    String replacement = attr.replacementIfDeprecated();
    if (replacement != null) {
        String txt = "This attribute is deprecated";
        if (!replacement.isEmpty()) {
            txt += ", please use " + replacement + " instead";
        }
        Tooltip t = new Tooltip(txt);
        tooltip = t;
        getStyleClass().add(DEPRECATED_CSS_CLASS);
        Tooltip.install(this, t);
    }
}
 
Example 12
Source File: ChartCanvas.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets the tooltip text, with the (x, y) location being used for the
 * anchor.  If the text is {@code null}, no tooltip will be displayed.
 * This method is intended for calling by the {@link TooltipHandlerFX}
 * class, you won't normally call it directly.
 * 
 * @param text  the text ({@code null} permitted).
 * @param x  the x-coordinate of the mouse pointer.
 * @param y  the y-coordinate of the mouse pointer.
 */
public void setTooltip(String text, double x, double y) {
    if (text != null) {
        if (this.tooltip == null) {
            this.tooltip = new Tooltip(text);
            Tooltip.install(this, this.tooltip);
        } else {
            this.tooltip.setText(text);           
            this.tooltip.setAnchorX(x);
            this.tooltip.setAnchorY(y);
        }                   
    } else {
        Tooltip.uninstall(this, this.tooltip);
        this.tooltip = null;
    }
}
 
Example 13
Source File: TooltipSupport.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
/** Detach tool tip.
 *  @param node Node that should have the tool tip removed.
 */
public static void detach(final Node node)
{
    if (disable_tooltips)
        return;
    final Tooltip tooltip = (Tooltip) node.getProperties().get(TOOLTIP_PROP_KEY);
    if (tooltip != null)
        Tooltip.uninstall(node, tooltip);
}
 
Example 14
Source File: InfoRegion.java    From tilesfx with Apache License 2.0 5 votes vote down vote up
public void setTooltipText(final String TEXT) {
    if (null == TEXT || TEXT.isEmpty()) {
        Tooltip.uninstall(path, tooltip);
    } else {
        tooltip.setText(TEXT);
        Tooltip.install(path, tooltip);
    }
}
 
Example 15
Source File: LowerRightRegion.java    From tilesfx with Apache License 2.0 5 votes vote down vote up
public void setTooltipText(final String TEXT) {
    if (null == TEXT || TEXT.isEmpty()) {
        Tooltip.uninstall(path, tooltip);
    } else {
        tooltip.setText(TEXT);
        Tooltip.install(path, tooltip);
    }
}
 
Example 16
Source File: NotifyRegion.java    From tilesfx with Apache License 2.0 5 votes vote down vote up
public void setTooltipText(final String TEXT) {
    if (null == TEXT || TEXT.isEmpty()) {
        Tooltip.uninstall(path, tooltip);
    } else {
        tooltip.setText(TEXT);
        Tooltip.install(path, tooltip);
    }
}
 
Example 17
Source File: ModernSkin.java    From Medusa with Apache License 2.0 5 votes vote down vote up
@Override protected void handleEvents(final String EVENT_TYPE) {
    super.handleEvents(EVENT_TYPE);
    if ("VISIBILITY".equals(EVENT_TYPE)) {
        Helper.enableNode(titleText, !gauge.getTitle().isEmpty());
        Helper.enableNode(subTitleText, !gauge.getSubTitle().isEmpty());
        Helper.enableNode(unitText, !gauge.getUnit().isEmpty());
        Helper.enableNode(valueText, gauge.isValueVisible());
        sectionsVisible = gauge.getSectionsVisible();
        redraw();
    } else if ("RECALC".equals(EVENT_TYPE)) {
        angleStep = ANGLE_RANGE / gauge.getRange();
        redraw();
        rotateNeedle(gauge.getCurrentValue());
    } else if ("INTERACTIVITY".equals(EVENT_TYPE)) {
        if (gauge.isInteractive()) {
            centerKnob.setOnMousePressed(mouseHandler);
            centerKnob.setOnMouseReleased(mouseHandler);
            buttonTooltip.setText(gauge.getButtonTooltipText());
            Tooltip.install(centerKnob, buttonTooltip);
        } else {
            centerKnob.removeEventHandler(MouseEvent.MOUSE_PRESSED, mouseHandler);
            centerKnob.removeEventHandler(MouseEvent.MOUSE_RELEASED, mouseHandler);
            Tooltip.uninstall(centerKnob, buttonTooltip);
        }
    } else if ("SECTIONS".equals(EVENT_TYPE)) {
        sectionsVisible = gauge.getSectionsVisible();
        sections        = gauge.getSections();
    }
}
 
Example 18
Source File: ValidatorBase.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
private void uninstall(Node node, Tooltip tooltip) {
    if (tooltip instanceof JFXTooltip) {
        JFXTooltip.uninstall(node);
    } else {
        Tooltip.uninstall(node, tooltip);
    }
}
 
Example 19
Source File: ResourceTreeCell.java    From jmonkeybuilder with Apache License 2.0 4 votes vote down vote up
@FxThread
private void removeToolTip() {
    if (tooltip == null) return;
    Tooltip.uninstall(this, tooltip);
    tooltip = null;
}
 
Example 20
Source File: FxmlControl.java    From MyBox with Apache License 2.0 4 votes vote down vote up
public static void removeTooltip(final Node node, final Tooltip tooltip) {
    Tooltip.uninstall(node, tooltip);
}