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

The following examples show how to use javafx.scene.Node#getId() . 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: RcmController.java    From ns-usbloader with GNU General Public License v3.0 6 votes vote down vote up
@FXML
public void selectPldrPane(MouseEvent mouseEvent) {
    final Node selectedPane = (Node)mouseEvent.getSource();

    switch (selectedPane.getId()){
        case "pldPane1":
            pldrRadio1.fire();
            break;
        case "pldPane2":
            pldrRadio2.fire();
            break;
        case "pldPane3":
            pldrRadio3.fire();
            break;
        case "pldPane4":
            pldrRadio4.fire();
            break;
        case "pldPane5":
            pldrRadio5.fire();
            break;
    }
}
 
Example 2
Source File: ModalDialog.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
private String createTooltipText(Node node) {
    StringBuilder tooltipText = new StringBuilder();
    String id = node.getId();
    if (id != null && !"".equals(id)) {
        tooltipText.append("#" + id);
    }
    ObservableList<String> styleClass = node.getStyleClass();
    if (styleClass.size() > 0) {
        tooltipText.append("(");
        for (String string : styleClass) {
            tooltipText.append(string + ",");
        }
        tooltipText.setLength(tooltipText.length() - 1);
        tooltipText.append(")");
    }
    return tooltipText.toString();
}
 
Example 3
Source File: ImageMaskController.java    From MyBox with Apache License 2.0 5 votes vote down vote up
public void clearMaskRulerX() {
    if (needNotRulers || maskPane == null || imageView.getImage() == null) {
        return;
    }
    List<Node> nodes = new ArrayList<>();
    nodes.addAll(maskPane.getChildren());
    for (Node node : nodes) {
        if (node.getId() != null && node.getId().startsWith("MaskRulerX")) {
            maskPane.getChildren().remove(node);
            node = null;
        }
    }
}
 
Example 4
Source File: ViewUtils.java    From ApkToolPlus with Apache License 2.0 5 votes vote down vote up
/**
 * 反射注入字段值
 *
 * @param parent
 * @param controller
 */
public static void injectFields(Parent parent, Object controller){
    Class<?> controllerClass = controller.getClass();
    // injectFields
    for(Node node : parent.getChildrenUnmodifiable()){
        if(node.getId() != null){
            ReflectUtils.setFieldValue(controllerClass,controller,node.getId(),node);
        }
        if(node instanceof Parent){
            injectFields((Parent) node, controller);
        }
    }
}
 
Example 5
Source File: RegexConfigFragment.java    From mdict-java with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void changed(ObservableValue observable, Object oldValue, Object newValue) {
	if(observable instanceof Property) {
		Property prop = (Property) observable;
		if(prop.getBean() instanceof Node) {
			Node node = (Node) prop.getBean();
			switch (node.getId()) {
				case ps_case:
					opt.SetPageSearchCaseSensitive((boolean) newValue);
				break;
				case ps_separate:
					opt.SetPageSearchSeparateWord((boolean) newValue);
				break;
				case regex_head:
					opt.SetRegexSearchEngineAutoAddHead((boolean) newValue);
				break;
				case regex_case:
					opt.SetRegexSearchEngineCaseSensitive((boolean) newValue);
				break;
				case page_regex_case:
					opt.SetPageSearchCaseSensitive((boolean) newValue);
				break;
				case pagewutsp:
					opt.SetPageWithoutSpace((boolean)newValue);
				break;
			}
		}
	}
}
 
Example 6
Source File: ControlStyle.java    From MyBox with Apache License 2.0 5 votes vote down vote up
public static void setColorStyle(Node node, ColorStyle color) {
    String id = node.getId();
    if (id == null) {
        return;
    }
    ControlStyle controlStyle = getControlStyle(node);
    setIcon(node, getIcon(controlStyle, color));

}
 
Example 7
Source File: ControlStyle.java    From MyBox with Apache License 2.0 5 votes vote down vote up
public static void setTips(Node node) {
    String id = node.getId();
    if (id == null) {
        return;
    }
    ControlStyle style = getControlStyle(node);
    String tips = getTips(style);
    if (tips == null || tips.isEmpty()) {
        return;
    }
    FxmlControl.setTooltip(node, new Tooltip(tips));
}
 
Example 8
Source File: ControlStyle.java    From MyBox with Apache License 2.0 5 votes vote down vote up
public static ControlStyle getControlStyle(Node node) {
    if (node == null || node.getId() == null) {
        return null;
    }
    String id = node.getId();
    ControlStyle style = null;
    if (id.startsWith("his")) {
        style = getHisControlStyle(id);
    } else if (id.startsWith("settings")) {
        style = getSettingsControlStyle(id);
    } else if (id.startsWith("scope")) {
        style = getScopeControlStyle(id);
    } else if (id.startsWith("color")) {
        style = getColorControlStyle(id);
    } else if (id.startsWith("imageManu")) {
        style = getImageManuControlStyle(id);
    } else if (node instanceof ImageView) {
        style = getImageViewStyle(id);
    } else if (node instanceof RadioButton) {
        style = getRadioButtonStyle(id);
    } else if (node instanceof CheckBox) {
        style = getCheckBoxStyle(id);
    } else if (node instanceof ToggleButton) {
        style = getToggleButtonStyle(id);
    } else if (node instanceof Button) {
        style = getButtonControlStyle(id);
    }
    return style;
}
 
Example 9
Source File: RcmController.java    From ns-usbloader with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Drag-n-drop support (drop consumer)
 * */
@FXML
private void handleDrop(DragEvent event){
    Node sourceNode = (Node) event.getSource();
    File fileDrpd = event.getDragboard().getFiles().get(0);

    if (fileDrpd.isDirectory()){
        event.setDropCompleted(true);
        event.consume();
        return;
    }

    String fileNameDrpd = fileDrpd.getAbsolutePath();

    switch (sourceNode.getId()){
        case "plHbox1":
            setPayloadFile( 1, fileNameDrpd);
            break;
        case "plHbox2":
            setPayloadFile( 2, fileNameDrpd);
            break;
        case "plHbox3":
            setPayloadFile( 3, fileNameDrpd);
            break;
        case "plHbox4":
            setPayloadFile( 4, fileNameDrpd);
            break;
        case "plHbox5":
            setPayloadFile( 5, fileNameDrpd);
    }
    event.setDropCompleted(true);
    event.consume();
}
 
Example 10
Source File: ImageMaskController.java    From MyBox with Apache License 2.0 5 votes vote down vote up
public void clearMaskRulerY() {
    if (needNotRulers || maskPane == null || imageView.getImage() == null) {
        return;
    }
    List<Node> nodes = new ArrayList<>();
    nodes.addAll(maskPane.getChildren());
    for (Node node : nodes) {
        if (node.getId() != null && node.getId().startsWith("MaskRulerY")) {
            maskPane.getChildren().remove(node);
            node = null;
        }
    }
}
 
Example 11
Source File: IccProfileEditorController.java    From MyBox with Apache License 2.0 5 votes vote down vote up
public void resetMarkLabel(Node node) {
    if (node == null) {
        return;
    }
    if (node.getId() != null && node.getId().endsWith("MarkLabel")) {
        Label label = (Label) node;
        label.setText("");
    }
    if (node instanceof Parent) {
        for (Node c : ((Parent) node).getChildrenUnmodifiable()) {
            resetMarkLabel(c);
        }
    }
}
 
Example 12
Source File: SVRemoteNodeAdapter.java    From scenic-view with GNU General Public License v3.0 5 votes vote down vote up
public SVRemoteNodeAdapter(final Node node, final boolean collapseControls, final boolean collapseContentControls, final boolean fillChildren, final SVRemoteNodeAdapter parent) {
    super(ConnectorUtils.nodeClass(node), node.getClass().getName());
    boolean mustBeExpanded = !(node instanceof Control) || !collapseControls;
    if (!mustBeExpanded && !collapseContentControls) {
        mustBeExpanded = node instanceof TabPane || node instanceof SplitPane || node instanceof ScrollPane || node instanceof Accordion || node instanceof TitledPane;
    }
    setExpanded(mustBeExpanded);
    this.id = node.getId();
    this.nodeId = ConnectorUtils.getNodeUniqueID(node);
    this.focused = node.isFocused();
    if (node.getParent() != null && parent == null) {
        this.parent = new SVRemoteNodeAdapter(node.getParent(), collapseControls, collapseContentControls, false, null);
    } else if (parent != null) {
        this.parent = parent;
    }
    /**
     * Check visibility and mouse transparency after calculating the parent
     */
    this.mouseTransparent = node.isMouseTransparent() || (this.parent != null && this.parent.isMouseTransparent());
    this.visible = node.isVisible() && (this.parent == null || this.parent.isVisible());

    /**
     * TODO This should be improved
     */
    if (fillChildren) {
        nodes = ChildrenGetter.getChildren(node)
                  .stream()
                  .map(childNode -> new SVRemoteNodeAdapter(childNode, collapseControls, collapseContentControls, true, this))
                  .collect(Collectors.toList());
    }
}
 
Example 13
Source File: ConnectorUtils.java    From scenic-view with GNU General Public License v3.0 5 votes vote down vote up
public static boolean acceptWindow(final Window window) {
    if (window instanceof Stage) {
        final Node root = window.getScene() != null ? window.getScene().getRoot() : null;
        if (root != null && (root.getId() == null || !root.getId().startsWith(StageController.FX_CONNECTOR_BASE_ID))) {
            return true;
        }
    }
    return false;
}
 
Example 14
Source File: FxSchema.java    From FxDock with Apache License 2.0 5 votes vote down vote up
private static String getName(Node n)
{
	Object x = n.getProperties().get(PROP_NAME);
	if(x instanceof String)
	{
		return (String)x;
	}
	
	if(n instanceof MenuBar)
	{
		return null;
	}
	else if(n instanceof Shape)
	{
		return null;
	}
	else if(n instanceof ImageView)
	{
		return null;
	}
	
	String id = n.getId();
	if(id != null)
	{
		return id;
	}
			
	return n.getClass().getSimpleName();
}
 
Example 15
Source File: RcmController.java    From ns-usbloader with GNU General Public License v3.0 5 votes vote down vote up
@FXML
private void bntResetPayloader(ActionEvent event){
    final Node btn = (Node)event.getSource();

    switch (btn.getId()){
        case "resPldBtn1":
            payloadFNameLbl1.setText("");
            payloadFPathLbl1.setText("");
            statusLbl.setText("");
            break;
        case "resPldBtn2":
            payloadFNameLbl2.setText("");
            payloadFPathLbl2.setText("");
            statusLbl.setText("");
            break;
        case "resPldBtn3":
            payloadFNameLbl3.setText("");
            payloadFPathLbl3.setText("");
            statusLbl.setText("");
            break;
        case "resPldBtn4":
            payloadFNameLbl4.setText("");
            payloadFPathLbl4.setText("");
            statusLbl.setText("");
            break;
        case "resPldBtn5":
            payloadFNameLbl5.setText("");
            payloadFPathLbl5.setText("");
            statusLbl.setText("");
    }
}
 
Example 16
Source File: ImageSplitController.java    From MyBox with Apache License 2.0 4 votes vote down vote up
private void checkSplitMethod() {
    splitOptionsBox.getChildren().clear();
    imageView.setImage(image);
    List<Node> nodes = new ArrayList<>();
    nodes.addAll(maskPane.getChildren());
    for (Node node : nodes) {
        if (node.getId() != null && node.getId().startsWith("SplitLines")) {
            maskPane.getChildren().remove(node);
            node = null;
        }
    }
    RadioButton selected = (RadioButton) splitGroup.getSelectedToggle();
    if (AppVariables.message("Predefined").equals(selected.getText())) {
        splitMethod = SplitMethod.Predefined;
        splitOptionsBox.getChildren().addAll(splitPredefinedPane);
        promptLabel.setText("");
    } else if (AppVariables.message("Customize").equals(selected.getText())) {
        splitMethod = SplitMethod.Customize;
        splitOptionsBox.getChildren().addAll(splitCustomized1Pane, splitCustomized2Pane);
        promptLabel.setText(AppVariables.message("SplitCustomComments"));
        checkCustomValues();
    } else if (AppVariables.message("ByNumber").equals(selected.getText())) {
        splitMethod = SplitMethod.ByNumber;
        splitOptionsBox.getChildren().addAll(splitNumberPane, okButton);
        promptLabel.setText("");
        isSettingValues = true;
        rowsInput.setText("3");
        colsInput.setText("3");
        isSettingValues = false;
        checkNumberValues();
    } else if (AppVariables.message("BySize").equals(selected.getText())) {
        splitMethod = SplitMethod.BySize;
        splitOptionsBox.getChildren().addAll(splitSizePane, okButton);
        promptLabel.setText(AppVariables.message("SplitSizeComments"));
        isSettingValues = true;
        widthInput.setText(imageInformation.getWidth() / 3 + "");
        heightInput.setText(imageInformation.getHeight() / 3 + "");
        isSettingValues = false;
        checkSizeValues();
    }
    FxmlControl.refreshStyle(splitOptionsBox);

}
 
Example 17
Source File: FxDump.java    From FxDock with Apache License 2.0 4 votes vote down vote up
protected void dump(Node n)
{
	SB sb = new SB(4096);
	sb.nl();
	
	while(n != null)
	{
		sb.a(CKit.getSimpleName(n));
		
		String id = n.getId();
		if(CKit.isNotBlank(id))
		{
			sb.a(" #");
			sb.a(id);
		}
		
		for(String s: n.getStyleClass())
		{
			sb.a(" .").a(s);
		}
		
		for(PseudoClass c: n.getPseudoClassStates())
		{
			sb.a(" :").a(c);
		}
		
		sb.nl();
		
		if(n instanceof Text)
		{
			sb.sp(4);
			sb.a("text: ");
			sb.a(TextTools.escapeControlsForPrintout(((Text)n).getText()));
			sb.nl();
		}
		
		CList<CssMetaData<? extends Styleable,?>> md = new CList<>(n.getCssMetaData());
		sort(md);
		
		for(CssMetaData d: md)
		{
			String k = d.getProperty();
			Object v = d.getStyleableProperty(n).getValue();
			if(shouldShow(v))
			{
				Object val = describe(v);
				sb.sp(4).a(k);
				sb.sp().a(val);
				if(d.isInherits())
				{
					sb.a(" *");
				}
				sb.nl();
			}
		}
		
		n = n.getParent();
	}
	D.print(sb);
}
 
Example 18
Source File: SettingsDialog.java    From mdict-java with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void changed(ObservableValue observable, Object oldValue, Object newValue) {
	if(observable instanceof Property){
		Property prop = (Property) observable;
		if(prop.getBean() instanceof Node){
			Node node = (Node) prop.getBean();
			switch (node.getId()){
				case UI.overwrite_browser:
					if(prop instanceof StringProperty)
						opt.setBrowserPathOverwrite((String)newValue);
					else
						opt.SetBrowserPathOverwriteEnabled((boolean)newValue);
				break;
				case UI.ow_bsrarg:
					opt.setBrowserArgs((String)newValue);
				break;
				case UI.overwrite_browser_search:
					if(prop instanceof StringProperty)
						opt.setSearchUrlOverwrite((String)newValue);
					else
						opt.SetSearchUrlOverwritEnabled((boolean)newValue);
				break;
				case UI.overwrite_browser_search1:
					opt.setSearchUrlMiddle((String)newValue);
				break;
				case UI.overwrite_browser_search2:
					opt.setSearchUrlRight((String)newValue);
				break;
				case UI.overwrite_pdf_reader:
					if(prop instanceof StringProperty)
						opt.setPdfOverwrite((String)newValue);
					else
						opt.SetPdfOverwriteEnabled((boolean)newValue);
				break;
				case UI.overwrite_pdf_reader_args:
					if(prop instanceof StringProperty)
						opt.setPdfArgsOverwrite((String)newValue);
					else
						opt.SetPdfArgsOverwriteEnabled((boolean)newValue);
				break;
				case tintwild:
					opt.SetTintWildResult((boolean)newValue);
				break;
				case remwsize:
					opt.SetRemWindowSize((boolean)newValue);
				break;
				case remwpos:
					opt.SetRemWindowPos((boolean)newValue);
				break;
				case tintfull:
					opt.SetTintFullResult((boolean)newValue);
				break;
				case doclsset:
					opt.SetDoubleClickCloseSet((boolean)newValue);
				break;
				case doclsdict:
					opt.SetDoubleClickCloseDict((boolean)newValue);
				break;
				case dt_setting:
					opt.SetDetachSettings((boolean)newValue);
				break;
				case dt_advsrch:
					opt.SetDetachAdvSearch((boolean)newValue);
				break;
				case dt_dictpic:
					opt.SetDetachDictPicker((boolean)newValue);
				break;
				case autopaste:
					opt.SetAutoPaste((boolean)newValue);
				break;
				case filterpaste:
					opt.SetFilterPaste((boolean)newValue);
				break;
				case regex_enable:
					opt.SetRegexSearchEngineEnabled((boolean)newValue);
				break;
				case ps_regex:
					opt.SetPageSearchUseRegex((boolean)newValue);
				break;
				case class_case:
					opt.SetClassicalKeyCaseStrategy((boolean)newValue);
				break;
			}
		}
	}
}
 
Example 19
Source File: ConnectorUtils.java    From scenic-view with GNU General Public License v3.0 4 votes vote down vote up
public final static boolean isNormalNode(final Node node) {
    return (node.getId() == null || !node.getId().startsWith(StageController.FX_CONNECTOR_BASE_ID));
}
 
Example 20
Source File: RcmController.java    From ns-usbloader with GNU General Public License v3.0 4 votes vote down vote up
@FXML
private void bntSelectPayloader(ActionEvent event){
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle(rb.getString("btn_Select"));

    File validator = new File(payloadFPathLbl1.getText()).getParentFile();
    if (validator != null && validator.exists())
        fileChooser.setInitialDirectory(validator);
    else
        fileChooser.setInitialDirectory(new File(System.getProperty("user.home")));

    fileChooser.getExtensionFilters().addAll(
            new FileChooser.ExtensionFilter("bin", "*.bin"),
            new FileChooser.ExtensionFilter("Any file", "*.*")
    );

    File payloadFile = fileChooser.showOpenDialog(payloadFPathLbl1.getScene().getWindow());

    if (payloadFile == null)
        return;

    final String fullFileName = payloadFile.getAbsolutePath();
    final Node btn = (Node)event.getSource();

    switch (btn.getId()){
        case "selPldBtn1":
            setPayloadFile(1, fullFileName);
            break;
        case "selPldBtn2":
            setPayloadFile(2, fullFileName);
            break;
        case "selPldBtn3":
            setPayloadFile(3, fullFileName);
            break;
        case "selPldBtn4":
            setPayloadFile(4, fullFileName);
            break;
        case "selPldBtn5":
            setPayloadFile(5, fullFileName);
    }
}