javafx.scene.control.cell.ChoiceBoxTableCell#javafx.util.StringConverter源码实例Demo

下面列出了javafx.scene.control.cell.ChoiceBoxTableCell#javafx.util.StringConverter 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: FxDock   文件: Converters.java
public static StringConverter<Object> OBJECT()
{
	if(objectConverter == null)
	{
		objectConverter = new StringConverter<Object>()
		{
			public String toString(Object x)
			{
				return x == null ? null : x.toString();
			}

			public Object fromString(String s)
			{
				return s;
			}
		};
	}
	return objectConverter;
}
 
源代码2 项目: ARMStrong   文件: CellUtils.java
static <T> void startEdit(final Cell<T> cell,
                          final StringConverter<T> converter,
                          final HBox hbox,
                          final Node graphic,
                          final TextField textField) {
    if (textField != null) {
        textField.setText(getItemText(cell, converter));
    }
    cell.setText(null);

    if (graphic != null) {
        hbox.getChildren().setAll(graphic, textField);
        cell.setGraphic(hbox);
    } else {
        cell.setGraphic(textField);
    }

    textField.selectAll();

    // requesting focus so that key input can immediately go into the
    // TextField (see RT-28132)
    textField.requestFocus();
}
 
源代码3 项目: AsciidocFX   文件: CellUtils.java
static <T> void startEdit(final Cell<T> cell,
                          final StringConverter<T> converter,
                          final HBox hbox,
                          final Node graphic,
                          final TextField textField) {
    if (textField != null) {
        textField.setText(getItemText(cell, converter));
    }
    cell.setText(null);

    if (graphic != null) {
        hbox.getChildren().setAll(graphic, textField);
        cell.setGraphic(hbox);
    } else {
        cell.setGraphic(textField);
    }

    textField.selectAll();

    // requesting focus so that key input can immediately go into the
    // TextField (see RT-28132)
    textField.requestFocus();
}
 
private void initComboBox() {
    interfacesComboBox.setItems(FXCollections.observableList(new ArrayList<>(interfacesInfo.values())));
    interfacesComboBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        propertiesTableView.setItems(FXCollections.observableList(new ArrayList<>(newValue.getProperties().entrySet())));
    });

    interfacesComboBox.setConverter(new StringConverter<InterfaceInfo>() {
        @Override
        public String toString(InterfaceInfo object) {
            return object.Slot_str;
        }

        @Override
        public InterfaceInfo fromString(String string) {
            return null;
        }
    });
    interfacesComboBox.getSelectionModel().select(0);
}
 
源代码5 项目: ARMStrong   文件: CellUtils.java
static <T> TextField createTextField(final Cell<T> cell, final StringConverter<T> converter) {
    final TextField textField = new TextField(getItemText(cell, converter));

    // Use onAction here rather than onKeyReleased (with check for Enter),
    // as otherwise we encounter RT-34685
    textField.setOnAction(event -> {
        if (converter == null) {
            throw new IllegalStateException(
                    "Attempting to convert text input into Object, but provided "
                            + "StringConverter is null. Be sure to set a StringConverter "
                            + "in your cell factory.");
        }
        cell.commitEdit(converter.fromString(textField.getText()));
        event.consume();
    });
    textField.setOnKeyReleased(t -> {
        if (t.getCode() == KeyCode.ESCAPE) {
            cell.cancelEdit();
            t.consume();
        }
    });
    return textField;
}
 
源代码6 项目: cute-proxy   文件: SimpleButton.java
private void init() {
    Bindings.bindBidirectional(tooltipText, tooltipProperty(), new StringConverter<Tooltip>() {
        @Override
        public String toString(Tooltip tooltip) {
            if (tooltip == null) {
                return null;
            }
            return tooltip.getText();
        }

        @Override
        public Tooltip fromString(String string) {
            if (string == null) {
                return null;
            }
            return new Tooltip(string);
        }
    });
    iconPath.addListener((observable, oldValue, newValue) ->
            graphicProperty().set(new ImageView(new Image(getClass().getResourceAsStream(newValue)))));
}
 
源代码7 项目: bisq   文件: DebugView.java
private void addGroup(String title, ObservableList<Class<? extends Task>> list) {
    final Tuple2<Label, ComboBox<Class<? extends Task>>> selectTaskToIntercept =
            addTopLabelComboBox(root, ++rowIndex, title, "Select task to intercept", 15);
    ComboBox<Class<? extends Task>> comboBox = selectTaskToIntercept.second;
    comboBox.setVisibleRowCount(list.size());
    comboBox.setItems(list);
    comboBox.setConverter(new StringConverter<>() {
        @Override
        public String toString(Class<? extends Task> item) {
            return item.getSimpleName();
        }

        @Override
        public Class<? extends Task> fromString(String s) {
            return null;
        }
    });
    comboBox.setOnAction(event -> Task.taskToIntercept = comboBox.getSelectionModel().getSelectedItem());
}
 
源代码8 项目: oim-fx   文件: ItemRemoveListCell.java
@Override
    public void updateItem(T item, boolean empty) {
        super.updateItem(item, empty);
        if (!empty) {
//        	removeButton.setOnAction(new EventHandler<ActionEvent>() {
//                @Override
//                public void handle(ActionEvent event) {
//                    if (null != removeValueAction) {
//                    	removeValueAction.value(getItem());;
//                    }
//                }
//            });
        	Button b=new Button("(x)");
        	b.setOnAction(a->{
        		System.out.println(888);
        	});
            StringConverter<T> c = getConverter();
            //setGraphic(b);
            setText(c != null ? c.toString(item) : (item == null ? "" : item.toString()));
        } else {
            //setGraphic(null);
            setText(null);
        }
    }
 
源代码9 项目: oim-fx   文件: ItemListCell.java
public ItemListCell(ExecuteAction executeAction, final StringConverter<T> converter) {
    setConverter(converter);
    this.executeAction = executeAction;
    this.button = new Button();
    button.getStyleClass().clear();
    button.setMinHeight(20);
    button.setMinWidth(20);

    //Image image = ImageBox.getImageClassPath("/resources/common/imagse/close/1_cancel_button_hover.png");
    //button.setGraphic(new ImageView(image));
    
    button.setText("X");
    setAlignment(Pos.CENTER_LEFT);
    setContentDisplay(ContentDisplay.LEFT);
    setGraphic(null);
}
 
void initializeIntervalChartAxes() {
    final NumberAxis xAxis = (NumberAxis) intervalChart.getXAxis();
    xAxis.setForceZeroInRange(false);

    // Bind X Tick label formatter to choice-box
    intervalXTickLabel.getItems().addAll(IntervalTickFormatter.values());
    intervalXTickLabel.getSelectionModel().select(0);
    ObjectBinding<StringConverter<Number>> intervalXLabelConverter = Bindings.createObjectBinding(
            () -> intervalXTickLabel.getSelectionModel().getSelectedItem().getConverter(),
            intervalXTickLabel.getSelectionModel().selectedItemProperty()
    );
    xAxis.tickLabelFormatterProperty().bind(intervalXLabelConverter);

}
 
源代码11 项目: jace   文件: ConfigurationUIController.java
private Node buildDynamicSelectComponent(ConfigNode node, String settingName, Serializable value) {
    try {
        DynamicSelection sel = (DynamicSelection) node.subject.getClass().getField(settingName).get(node.subject);
        ChoiceBox widget = new ChoiceBox(FXCollections.observableList(new ArrayList(sel.getSelections().keySet())));
        widget.setMinWidth(175.0);
        widget.setConverter(new StringConverter() {
            @Override
            public String toString(Object object) {
                return (String) sel.getSelections().get(object);
            }
            
            @Override
            public Object fromString(String string) {
                return sel.findValueByMatch(string);
            }
        });
        Object selected = value == null ? null : widget.getConverter().fromString(String.valueOf(value));
        if (selected == null) {
            widget.getSelectionModel().selectFirst();
        } else {
            widget.setValue(selected);
        }
        widget.valueProperty().addListener((Observable e) -> {
            node.setFieldValue(settingName, widget.getConverter().toString(widget.getValue()));
        });
        return widget;
    } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) {
        Logger.getLogger(ConfigurationUIController.class.getName()).log(Level.SEVERE, null, ex);
        return null;
    }
}
 
源代码12 项目: ARMStrong   文件: CellUtils.java
/***************************************************************************
 *                                                                         *
 * General convenience                                                     *
 *                                                                         *
 **************************************************************************/

/*
 * Simple method to provide a StringConverter implementation in various cell
 * implementations.
 */
@SuppressWarnings("unchecked")
static <T> StringConverter<T> defaultStringConverter() {
    return (StringConverter<T>) defaultStringConverter;
}
 
源代码13 项目: constellation   文件: DateTimeRangeInputPane.java
/**
 * Build a single datetime picker.
 *
 * @param label
 * @param ld
 * @param h
 * @param m
 * @param s
 * @param listener
 * @return
 */
private Pane createPicker(final String label, final ChangeListener<String> changed) {
    final Label dpLabel = new Label(label);
    final DatePicker dp = new DatePicker();
    dp.setConverter(new StringConverter<LocalDate>() {
        @Override
        public String toString(final LocalDate date) {
            return date != null ? DATE_FORMATTER.format(date) : "";
        }

        @Override
        public LocalDate fromString(final String s) {
            return s != null && !s.isEmpty() ? LocalDate.parse(s, DATE_FORMATTER) : null;
        }
    });
    dpLabel.setLabelFor(dp);
    final HBox dpBox = new HBox(dpLabel, dp);
    final HBox spinnerBox = new HBox(CONTROLPANE_SPACING / 2);
    dp.maxWidthProperty().bind(spinnerBox.widthProperty().multiply(2.0 / 3.0));
    spinnerBox.getChildren().addAll(createSpinner("Hour", 0, 23, changed), createSpinner("Minute", 0, 59, changed), createSpinner("Second", 0, 59, changed));
    final VBox picker = new VBox(dpBox, spinnerBox);
    picker.setStyle("-fx-padding:4; -fx-border-radius:4; -fx-border-color: grey;");

    dp.getEditor().textProperty().addListener(changed);

    // The DatePicker has the horrible problem that you can type in the text field, but the value won't change,
    // so if you type a new date and click Go, the old date will be used, not the new date that you can see.
    // The simplest way to avoid this is to disable the text field. :-(
    dp.getEditor().setDisable(true);

    datePickers.add(dp);

    return picker;
}
 
源代码14 项目: Open-Lowcode   文件: LargeTextTableCell.java
/**
 * creates a large text table cell with no restriction for data entry and
 * aligned on left
 * 
 * @param converter    converter to generate the object from string entered
 * @param largedisplay true if several lines (large display)
 * @param lineheight   line height in pixel
 */
public LargeTextTableCell(StringConverter<T> converter, boolean largedisplay, double lineheight) {
	this.lineheightfortable = lineheight;
	setConverter(converter);
	this.alignonright = false;
	this.largedisplay = largedisplay;
	if (this.largedisplay) {
		this.getStyleClass().add("text-area-table-cell");
	} else {
		this.getStyleClass().add("text-field-table-cell");
	}
}
 
源代码15 项目: phoebus   文件: CellUtiles.java
static <T> void updateItem(final Cell<T> cell,
                           final StringConverter<T> converter,
                           final HBox hbox,
                           final Node graphic,
                           final ComboBox<T> comboBox) {
    if (cell.isEmpty()) {
        cell.setText(null);
        cell.setGraphic(null);
    } else {
        if (cell.isEditing()) {
            if (comboBox != null) {
                comboBox.getSelectionModel().select(cell.getItem());
            }
            cell.setText(null);

            if (graphic != null) {
                hbox.getChildren().setAll(graphic, comboBox);
                cell.setGraphic(hbox);
            } else {
                cell.setGraphic(comboBox);
            }
        } else {
            cell.setText(getItemText(cell, converter));
            cell.setGraphic(graphic);
        }
    }
}
 
源代码16 项目: ARMStrong   文件: CellUtils.java
/***************************************************************************
 *                                                                         *
 * ChoiceBox convenience                                                   *
 *                                                                         *
 **************************************************************************/

static <T> void updateItem(final Cell<T> cell,
                           final StringConverter<T> converter,
                           final ChoiceBox<T> choiceBox) {
    updateItem(cell, converter, null, null, choiceBox);
}
 
源代码17 项目: marathonv5   文件: JavaFXChoiceBoxCellElement.java
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public String _getValue() {
    StringConverter converter = getConverter();
    Object item = ((Cell) node).getItem();
    if (converter != null) {
        return converter.toString(item);
    }
    return item.toString();
}
 
源代码18 项目: phoebus   文件: CellUtiles.java
/***************************************************************************
 *                                                                         *
 * TextField convenience                                                   *
 *                                                                         *
 **************************************************************************/

static <T> void updateItem(final Cell<T> cell,
                           final StringConverter<T> converter,
                           final TextField textField) {
    updateItem(cell, converter, null, null, textField);
}
 
源代码19 项目: Open-Lowcode   文件: LargeTextTreeTableCell.java
/**
 * creates a large text table cell with no restriction for data entry and
 * aligned on left
 * 
 * @param converter    converter to generate the object from string entered
 * @param largedisplay true if several lines (large display)
 * @param lineheight   line height in pixel
 */
public LargeTextTreeTableCell(StringConverter<T> converter, boolean largedisplay, double lineheight) {
	this.lineheightfortable = lineheight;
	setConverter(converter);
	this.alignonright = false;
	this.largedisplay = largedisplay;
	if (this.largedisplay) {
		this.getStyleClass().add("text-area-table-cell");
	} else {
		this.getStyleClass().add("text-field-table-cell");
	}
}
 
源代码20 项目: Game2048FX   文件: SettingsPresenter.java
public void initialize() {
    settings.showingProperty().addListener((obs, oldValue, newValue) -> {
        if (newValue) {
            AppBar appBar = getApp().getAppBar();
            appBar.setNavIcon(MaterialDesignIcon.ARROW_BACK.button(e -> getApp().goHome()));
            appBar.setTitleText("Game Settings");
            appBar.getActionItems().add(MaterialDesignIcon.CLOSE.button(e -> getApp().goHome()));
            gameMode.set(gameModel.getGameMode());
        }
    });

    gameMode.addListener((obs, ov, nv) -> {
        if (nv != gameModel.getGameMode()) {
            showAlertDialog(nv);
        }
    });
    final DefaultOption<ObjectProperty<GameMode>> gameModeOption = new DefaultOption<>(MaterialDesignIcon.APPS.graphic(),
            "Game Mode", "Choose the Game Mode", "Mode", gameMode, true);
    gameModeOption.setExtendedDescription("Select between: \n\n"
            + "\u2022 Easy: Save and restore are allowed at any time\n\n\n"
            + "\u2022 Advanced: Save allowed only after a 2048 tile, you can restore at any time\n\n\n"
            + "\u2022 Expert: Save and restore are not allowed.");
    gameModeOption.setStringConverter(new StringConverter() {
        @Override
        public String toString(Object object) {
            return ((GameMode) object).getText();
        }

        @Override
        public Object fromString(String string) {
            return GameMode.valueOf(string);
        }
    });
    
    final DefaultOption<BooleanProperty> vibrateOption = new DefaultOption<>(MaterialDesignIcon.VIBRATION.graphic(),
            "Vibrate", "Vibrate every 2048 tile", "Options", gameModel.vibrateModeOnProperty(), true);
    
    settingsPane.getOptions().addAll(gameModeOption, vibrateOption);
    
}
 
源代码21 项目: bisq   文件: GUIUtil.java
public static StringConverter<TradeCurrency> getTradeCurrencyConverter(String postFixSingle,
                                                                       String postFixMulti,
                                                                       Map<String, Integer> offerCounts) {
    return new StringConverter<>() {
        @Override
        public String toString(TradeCurrency tradeCurrency) {
            String code = tradeCurrency.getCode();
            Optional<Integer> offerCountOptional = Optional.ofNullable(offerCounts.get(code));
            final String displayString;
            displayString = offerCountOptional
                    .map(offerCount -> CurrencyUtil.getNameAndCode(code)
                            + " - " + offerCount + " " + (offerCount == 1 ? postFixSingle : postFixMulti))
                    .orElseGet(() -> CurrencyUtil.getNameAndCode(code));
            // http://boschista.deviantart.com/journal/Cool-ASCII-Symbols-214218618
            if (code.equals(GUIUtil.SHOW_ALL_FLAG))
                return "▶ " + Res.get("list.currency.showAll");
            else if (code.equals(GUIUtil.EDIT_FLAG))
                return "▼ " + Res.get("list.currency.editList");
            return tradeCurrency.getDisplayPrefix() + displayString;
        }

        @Override
        public TradeCurrency fromString(String s) {
            return null;
        }
    };
}
 
源代码22 项目: ARMStrong   文件: CellUtils.java
/***************************************************************************
 *                                                                         *
 * TextField convenience                                                   *
 *                                                                         *
 **************************************************************************/

static <T> void updateItem(final Cell<T> cell,
                           final StringConverter<T> converter,
                           final TextField textField) {
    updateItem(cell, converter, null, null, textField);
}
 
源代码23 项目: bisq   文件: AssetFeeView.java
@Override
public void initialize() {
    addTitledGroupBg(root, gridRow, 3, Res.get("dao.burnBsq.header"));

    assetComboBox = FormBuilder.addComboBox(root, gridRow,
            Res.get("dao.burnBsq.selectAsset"), Layout.FIRST_ROW_DISTANCE);
    assetComboBox.setConverter(new StringConverter<>() {
        @Override
        public String toString(StatefulAsset statefulAsset) {
            return CurrencyUtil.getNameAndCode(statefulAsset.getAsset().getTickerSymbol());
        }

        @Override
        public StatefulAsset fromString(String string) {
            return null;
        }
    });

    feeAmountInputTextField = addInputTextField(root, ++gridRow, Res.get("dao.burnBsq.fee"));
    feeAmountInputTextField.setValidator(bsqValidator);

    trialPeriodTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.burnBsq.trialPeriod")).second;

    payFeeButton = addButtonAfterGroup(root, ++gridRow, Res.get("dao.burnBsq.payFee"));

    tableView = FormBuilder.addTableViewWithHeader(root, ++gridRow, Res.get("dao.burnBsq.allAssets"), 20, "last");
    createColumns();
    tableView.setItems(sortedList);

    createListeners();
}
 
源代码24 项目: old-mzmine3   文件: SpinnerAutoCommit.java
private void commitEditorText() {
  if (!isEditable())
    return;
  String text = getEditor().getText();
  SpinnerValueFactory<T> valueFactory = getValueFactory();
  if (valueFactory != null) {
    StringConverter<T> converter = valueFactory.getConverter();
    if (converter != null) {
      T value = converter.fromString(text);
      valueFactory.setValue(value);
    }
  }
}
 
源代码25 项目: pmd-designer   文件: DesignerUtil.java
public static <T> StringConverter<T> stringConverter(Function<T, String> toString, Function<String, T> fromString) {
    return new StringConverter<T>() {
        @Override
        public String toString(T object) {
            return toString.apply(object);
        }


        @Override
        public T fromString(String string) {
            return fromString.apply(string);
        }
    };
}
 
源代码26 项目: pmd-designer   文件: LanguageVersionRangeSlider.java
public LanguageVersionRangeSlider() {

        setMin(NO_MIN);
        setBlockIncrement(1);
        setMajorTickUnit(1);
        setMinorTickCount(0);
        setSnapToTicks(true);

        currentLanguage.values().distinct().subscribe(this::initLanguage);

        StringConverter<Number> converter = DesignerUtil.stringConverter(
            num -> {
                int n = num.intValue();
                if (n < 0) {
                    return NO_MIN_STR;
                } else if (n >= curVersions.size()) {
                    return NO_MAX_STR;
                } else {
                    return curVersions.get(n).getShortName();
                }
            },
            ver -> {
                switch (ver) {
                case NO_MIN_STR:
                    return -1;
                case NO_MAX_STR:
                    return curVersions.size();
                default:
                    LanguageVersion withName = curVersions.stream().filter(lv -> lv.getShortName().equals(ver)).findFirst().get();
                    return curVersions.indexOf(withName);
                }
            }
        );

        setLabelFormatter(converter);


    }
 
源代码27 项目: ARMStrong   文件: CellUtils.java
static <T> void updateItem(final Cell<T> cell,
                           final StringConverter<T> converter,
                           final HBox hbox,
                           final Node graphic,
                           final ComboBox<T> comboBox) {
    if (cell.isEmpty()) {
        cell.setText(null);
        cell.setGraphic(null);
    } else {
        if (cell.isEditing()) {
            if (comboBox != null) {
                comboBox.getSelectionModel().select(cell.getItem());
            }
            cell.setText(null);

            if (graphic != null) {
                hbox.getChildren().setAll(graphic, comboBox);
                cell.setGraphic(hbox);
            } else {
                cell.setGraphic(comboBox);
            }
        } else {
            cell.setText(getItemText(cell, converter));
            cell.setGraphic(graphic);
        }
    }
}
 
源代码28 项目: milkman   文件: CreateWorkspaceDialog.java
public void showAndWait(List<WorkspaceSynchronizer> synchronizers, Toaster toaster) {
	this.toaster = toaster;
	JFXDialogLayout content = new CreateWorkspaceDialogFxml(this);
	synchronizers.forEach(i -> syncSelector.getItems().add(i.getDetailFactory()));
	
	//default to first item
	if (syncSelector.getItems().size() > 0) {
		SynchronizationDetailFactory defaultSync = syncSelector.getItems().get(0);
		syncSelector.setValue(defaultSync);
		syncDetailsArea.getChildren().add(defaultSync.getSyncDetailsControls());
		selectedSynchronizer = defaultSync;
	}
	
	syncSelector.setConverter(new StringConverter<SynchronizationDetailFactory>() {
		
		@Override
		public String toString(SynchronizationDetailFactory object) {
			return object.getName();
		}
		
		@Override
		public SynchronizationDetailFactory fromString(String string) {
			return null;
		}
	});
	syncSelector.getSelectionModel().selectedItemProperty().addListener((obs, o, v) -> {
		if (o != v && v != null) {
			selectedSynchronizer = v;
			syncDetailsArea.getChildren().clear();
			syncDetailsArea.getChildren().add(v.getSyncDetailsControls());
		} 
	});
	dialog = FxmlUtil.createDialog(content);
	dialog.showAndWait();
}
 
源代码29 项目: milkman   文件: ExportDialog.java
public void showAndWait(List<Exporter<T>> exporters, Templater templater, Toaster toaster, T objToExport) {
	this.templater = templater;
	this.toaster = toaster;
	this.objToExport = objToExport;
	JFXDialogLayout content = new ExportDialogFxml(this);
	exportSelector.setPromptText("Select Exporter");
	exporters.forEach(exportSelector.getItems()::add);
	exportSelector.setConverter(new StringConverter<Exporter<T>>() {
		
		@Override
		public String toString(Exporter<T> object) {
			return object.getName();
		}
		
		@Override
		public Exporter<T> fromString(String string) {
			return null;
		}
	});
	exportSelector.getSelectionModel().selectedItemProperty().addListener((obs, o, v) -> {
		if (o != v && v != null) {
			selectedExporter = v;
			exportArea.getChildren().clear();
			exportArea.getChildren().add(v.getRoot(objToExport, templater));
			exportBtn.setDisable(v.isAdhocExporter());
		} 
	});
	dialog = FxmlUtil.createDialog(content);
	dialog.showAndWait();
}
 
源代码30 项目: JFoenix   文件: JFXComboBox.java
private boolean updateDisplayText(ListCell<T> cell, T item, boolean empty) {
    if (empty) {
        // create empty cell
        if (cell == null) {
            return true;
        }
        cell.setGraphic(null);
        cell.setText(null);
        return true;
    } else if (item instanceof Node) {
        Node currentNode = cell.getGraphic();
        Node newNode = (Node) item;
        //  create a node from the selected node of the listview
        //  using JFXComboBox {@link #nodeConverterProperty() NodeConverter})
        NodeConverter<T> nc = this.getNodeConverter();
        Node node = nc == null ? null : nc.toNode(item);
        if (currentNode == null || !currentNode.equals(newNode)) {
            cell.setText(null);
            cell.setGraphic(node == null ? newNode : node);
        }
        return node == null;
    } else {
        // run item through StringConverter if it isn't null
        StringConverter<T> c = this.getConverter();
        String s = item == null ? this.getPromptText() : (c == null ? item.toString() : c.toString(item));
        cell.setText(s);
        cell.setGraphic(null);
        return s == null || s.isEmpty();
    }
}