Java Code Examples for javafx.beans.property.StringProperty#get()

The following examples show how to use javafx.beans.property.StringProperty#get() . 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: UIMenuItem.java    From tcMenu with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the integer value from a text field property and validates it again the conditions provided. It must be
 * a number and within the ranges provided.
 * @param strProp the property to convert
 * @param field the field to report errors against
 * @param errorsBuilder the list of errors recorded so far
 * @param min the minimum value allowed
 * @param max the maximum value allowed
 * @return the integer value if all conditions are met
 */
protected int safeIntFromProperty(StringProperty strProp, String field, List<FieldError> errorsBuilder,
                                  int min, int max)  {
    String s = strProp.get();
    if (StringHelper.isStringEmptyOrNull(s)) {
        return 0;
    }

    int val = 0;
    try {
        val = Integer.valueOf(s);
        if(val < min || val > max) {
            errorsBuilder.add(new FieldError("Value must be between " + min + " and " + max, field));
        }
    } catch (NumberFormatException e) {
        errorsBuilder.add(new FieldError("Value must be a number", field));
    }
    return val;
}
 
Example 2
Source File: SetCustomPropertyController.java    From Vert.X-generator with MIT License 6 votes vote down vote up
@Override
public void initialize(URL location, ResourceBundle resources) {
	tblProperty.setEditable(true);
	tblProperty.setStyle("-fx-font-size:14px");
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_TBL_TIPS);
	String title = property == null ? "可以在右边自定义添加属性..." : property.get();
	tblProperty.setPlaceholder(new Label(title));
	tblPropertyValues = FXCollections.observableArrayList();
	// 设置列的大小自适应
	tblProperty.setColumnResizePolicy(resize -> {
		double width = resize.getTable().getWidth();
		tdKey.setPrefWidth(width / 3);
		tdValue.setPrefWidth(width / 3);
		tdDescribe.setPrefWidth(width / 3);
		return true;
	});
	btnConfirm.widthProperty().addListener(w -> {
		double x = btnConfirm.getLayoutX() + btnConfirm.getWidth() + 10;
		btnCancel.setLayoutX(x);
	});
}
 
Example 3
Source File: SetRouterController.java    From Spring-generator with MIT License 6 votes vote down vote up
@Override
public void initialize(URL location, ResourceBundle resources) {
	tblProperty.setEditable(true);
	tblProperty.setStyle("-fx-font-size:14px");
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_TBL_TIPS);
	String title = property == null ? "可以在右边自定义添加属性..." : property.get();
	tblProperty.setPlaceholder(new Label(title));
	tblPropertyValues = FXCollections.observableArrayList();
	// 设置列的大小自适应
	tblProperty.setColumnResizePolicy(resize -> {
		double width = resize.getTable().getWidth();
		tdKey.setPrefWidth(width / 3);
		tdValue.setPrefWidth(width / 3);
		tdDescribe.setPrefWidth(width / 3);
		return true;
	});
	btnConfirm.widthProperty().addListener(w -> {
		double x = btnConfirm.getLayoutX() + btnConfirm.getWidth() + 10;
		btnCancel.setLayoutX(x);
	});
}
 
Example 4
Source File: TranslationController.java    From BetonQuest-Editor with GNU General Public License v3.0 6 votes vote down vote up
@FXML public void translate() {
	try {
		StringProperty lang = new SimpleStringProperty();
		if (NameEditController.display(lang, true)) {
			if (!manager.getLanguages().containsKey(lang.get())) {
				manager.createLanguage(lang.get());
			}
			translator = new Translator(manager, manager.getDefault(), lang.get());
			choose.setDisable(true);
			translate.setVisible(false);
			translations.setVisible(true);
			next();
		}
	} catch (Exception e) {
		ExceptionController.display(e);
	}
}
 
Example 5
Source File: SetSqlAssistController.java    From Vert.X-generator with MIT License 6 votes vote down vote up
@Override
public void initialize(URL location, ResourceBundle resources) {
	tblProperty.setEditable(true);
	tblProperty.setStyle("-fx-font-size:14px");
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_TBL_TIPS);
	String title = property == null ? "可以在右边自定义添加属性..." : property.get();
	tblProperty.setPlaceholder(new Label(title));
	tblPropertyValues = FXCollections.observableArrayList();
	// 设置列的大小自适应
	tblProperty.setColumnResizePolicy(resize -> {
		double width = resize.getTable().getWidth();
		tdKey.setPrefWidth(width / 3);
		tdValue.setPrefWidth(width / 3);
		tdDescribe.setPrefWidth(width / 3);
		return true;
	});
	btnConfirm.widthProperty().addListener(w -> {
		double x = btnConfirm.getLayoutX() + btnConfirm.getWidth() + 10;
		btnCancel.setLayoutX(x);
	});
}
 
Example 6
Source File: NpcBindingsChooseController.java    From BetonQuest-Editor with GNU General Public License v3.0 6 votes vote down vote up
@FXML private void add() {
	try {
		StringProperty name = new SimpleStringProperty();
		if (NameEditController.display(name, true)) {
			if (list.getItems().contains(name.get())) {
				BetonQuestEditor.showError("already-exists");
				return;
			}
			list.getItems().add(name.get());
			NpcBinding binding = new NpcBinding(conv.getPack(), name.get());
			binding.getConversation().set(conv);
			conv.getPack().getNpcBindings().add(binding);
		}
	} catch (Exception e) {
		ExceptionController.display(e);
	}
}
 
Example 7
Source File: SetServiceImplController.java    From Spring-generator with MIT License 6 votes vote down vote up
@Override
public void initialize(URL location, ResourceBundle resources) {
	tblProperty.setEditable(true);
	tblProperty.setStyle("-fx-font-size:14px");
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_TBL_TIPS);
	String title = property == null ? "可以在右边自定义添加属性..." : property.get();
	tblProperty.setPlaceholder(new Label(title));
	tblPropertyValues = FXCollections.observableArrayList();
	// 设置列的大小自适应
	tblProperty.setColumnResizePolicy(resize -> {
		double width = resize.getTable().getWidth();
		tdKey.setPrefWidth(width / 3);
		tdValue.setPrefWidth(width / 3);
		tdDescribe.setPrefWidth(width / 3);
		return true;
	});
	btnConfirm.widthProperty().addListener(w -> {
		double x = btnConfirm.getLayoutX() + btnConfirm.getWidth() + 10;
		btnCancel.setLayoutX(x);
	});
}
 
Example 8
Source File: SetEntityAttributeController.java    From Spring-generator with MIT License 5 votes vote down vote up
/**
 * 取消关闭该窗口
 * 
 * @param event
 */
public void onCancel(ActionEvent event) {
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_BTN_CANCEL_TIPS);
	String tips = property == null ? "如果取消,全部的设置都将恢复到默认值,确定取消吗?" : property.get();
	boolean result = AlertUtil.showConfirmAlert(tips);
	if (result) {
		indexController.getHistoryConfig().setEntityConfig(null);
		getDialogStage().close();
	}
}
 
Example 9
Source File: SetServiceController.java    From Vert.X-generator with MIT License 5 votes vote down vote up
/**
 * 取消关闭该窗口
 * 
 * @param event
 */
public void onCancel(ActionEvent event) {
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_BTN_CANCEL_TIPS);
	String tips = property == null ? "如果取消,全部的设置都将恢复到默认值,确定取消吗?" : property.get();
	boolean result = AlertUtil.showConfirmAlert(tips);
	if (result) {
		getDialogStage().close();
	}
}
 
Example 10
Source File: IndexController.java    From Spring-generator with MIT License 5 votes vote down vote up
/**
 * 数据库连接
 * 
 * @param event
 */
public void onConnection(MouseEvent event) {
	StringProperty property = Main.LANGUAGE.get(LanguageKey.PAGE_CREATE_CONNECTION);
	String title = property == null ? "新建数据库连接" : property.get();
	ConnectionController controller = (ConnectionController) loadFXMLPage(title, FXMLPage.CONNECTION, false);
	controller.setIndexController(this);
	controller.showDialogStage();
}
 
Example 11
Source File: SetSqlAndParamsController.java    From Vert.X-generator with MIT License 5 votes vote down vote up
/**
 * 取消关闭该窗口
 * 
 * @param event
 */
public void onCancel(ActionEvent event) {
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_BTN_CANCEL_TIPS);
	String tips = property == null ? "如果取消,全部的设置都将恢复到默认值,确定取消吗?" : property.get();
	boolean result = AlertUtil.showConfirmAlert(tips);
	if (result) {
		getDialogStage().close();
	}
}
 
Example 12
Source File: SetCustomController.java    From Vert.X-generator with MIT License 5 votes vote down vote up
/**
 * 取消关闭该窗口
 * 
 * @param event
 */
public void onCancel(ActionEvent event) {
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_BTN_CANCEL_TIPS);
	String tips = property == null ? "如果取消,全部的设置都将恢复到默认值,确定取消吗?" : property.get();
	boolean result = AlertUtil.showConfirmAlert(tips);
	if (result) {
		getDialogStage().close();
	}
}
 
Example 13
Source File: SetSqlController.java    From Spring-generator with MIT License 5 votes vote down vote up
/**
 * 取消关闭该窗口
 * 
 * @param event
 */
public void onCancel(ActionEvent event) {
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_BTN_CANCEL_TIPS);
	String tips = property == null ? "如果取消,全部的设置都将恢复到默认值,确定取消吗?" : property.get();
	boolean result = AlertUtil.showConfirmAlert(tips);
	if (result) {
		getDialogStage().close();
	}
}
 
Example 14
Source File: ConversationOption.java    From BetonQuest-Editor with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String toString() {
	Conversation displayedConversation = ConversationController.getDisplayedConversation();
	if (displayedConversation != null && displayedConversation.equals(conversation)) {
		return id.get();
	} else {
		StringProperty string = conversation.getId();
		String a = string.get();
		String b = id.get();
		return a + "." + b;
	}
}
 
Example 15
Source File: SetServiceController.java    From Spring-generator with MIT License 5 votes vote down vote up
/**
 * 取消关闭该窗口
 * 
 * @param event
 */
public void onCancel(ActionEvent event) {
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_BTN_CANCEL_TIPS);
	String tips = property == null ? "如果取消,全部的设置都将恢复到默认值,确定取消吗?" : property.get();
	boolean result = AlertUtil.showConfirmAlert(tips);
	if (result) {
		getDialogStage().close();
	}
}
 
Example 16
Source File: IndexController.java    From Vert.X-generator with MIT License 5 votes vote down vote up
/**
 * 打开设置实体类
 * 
 * @param event
 */
public void onSetEntity(ActionEvent event) {
	if (selectedTableName == null) {
		StringProperty property = Main.LANGUAGE.get(LanguageKey.INDEX_TIPS_SELECT_TABLE_NAME);
		String tips = property == null ? "请先选择数据库表!打开左侧数据库双击表名便可加载..." : property.get();
		AlertUtil.showWarnAlert(tips);
		return;
	}
	SetEntityAttributeController controller = (SetEntityAttributeController) loadFXMLPage("Entity Attribute Setting",
			FXMLPage.SET_ENTITY_ATTRIBUTE, false);
	controller.setIndexController(this);
	controller.showDialogStage();
	controller.init();
}
 
Example 17
Source File: SetUnitTestController.java    From Spring-generator with MIT License 5 votes vote down vote up
/**
 * 取消关闭该窗口
 * 
 * @param event
 */
public void onCancel(ActionEvent event) {
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_BTN_CANCEL_TIPS);
	String tips = property == null ? "如果取消,全部的设置都将恢复到默认值,确定取消吗?" : property.get();
	boolean result = AlertUtil.showConfirmAlert(tips);
	if (result) {
		getDialogStage().close();
	}
}
 
Example 18
Source File: SetCustomPropertyController.java    From Vert.X-generator with MIT License 5 votes vote down vote up
/**
 * 取消关闭该窗口
 * 
 * @param event
 */
public void onCancel(ActionEvent event) {
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_BTN_CANCEL_TIPS);
	String tips = property == null ? "如果取消,全部的设置都将恢复到默认值,确定取消吗?" : property.get();
	boolean result = AlertUtil.showConfirmAlert(tips);
	if (result) {
		getDialogStage().close();
	}
}
 
Example 19
Source File: IndexController.java    From Vert.X-generator with MIT License 5 votes vote down vote up
/**
 * 数据库连接
 * 
 * @param event
 */
public void onConnection(MouseEvent event) {
	StringProperty property = Main.LANGUAGE.get(LanguageKey.PAGE_CREATE_CONNECTION);
	String title = property == null ? "新建数据库连接" : property.get();
	ConnectionController controller = (ConnectionController) loadFXMLPage(title, FXMLPage.CONNECTION, false);
	controller.setIndexController(this);
	controller.showDialogStage();
}
 
Example 20
Source File: SetAbstractSqlController.java    From Vert.X-generator with MIT License 5 votes vote down vote up
/**
 * 取消关闭该窗口
 * 
 * @param event
 */
public void onCancel(ActionEvent event) {
	StringProperty property = Main.LANGUAGE.get(LanguageKey.SET_BTN_CANCEL_TIPS);
	String tips = property == null ? "如果取消,全部的设置都将恢复到默认值,确定取消吗?" : property.get();
	boolean result = AlertUtil.showConfirmAlert(tips);
	if (result) {
		getDialogStage().close();
	}
}