当前位置: 首页>>代码示例>>Java>>正文


Java ValidationResult.fromResults方法代码示例

本文整理汇总了Java中org.controlsfx.validation.ValidationResult.fromResults方法的典型用法代码示例。如果您正苦于以下问题:Java ValidationResult.fromResults方法的具体用法?Java ValidationResult.fromResults怎么用?Java ValidationResult.fromResults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.controlsfx.validation.ValidationResult的用法示例。


在下文中一共展示了ValidationResult.fromResults方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: recreateValidationSupport

import org.controlsfx.validation.ValidationResult; //导入方法依赖的package包/类
/**
 * Recreates {@link #validationSupport}, so the old validationSupport which is bound to unwanted
 * fields can be garbage collected.
 */
private void recreateValidationSupport() {
	validationSupport = new ValidationSupport();
	CuteGraphicValidationDecoration cuteGVD = new CuteGraphicValidationDecoration(
			validationSupport);
	CompoundValidationDecoration validationDecor = new CompoundValidationDecoration(
			// These styles are located in /StreamSis/src/main/resources/css/validation.css
			new StyleClassValidationDecoration("cuteerror", "cutewarning"), cuteGVD);
	validationSupport.setValidationDecorator(validationDecor);
	Validator<String> nameTextFieldValidator = (c, newValue) -> {
		ValidationResult alreadyExistanceResult = ValidationResult.fromErrorIf(c,
				"The name is already taken. Please choose another one",
				validateNameAlreadyExistence(c, newValue));
		ValidationResult emptyResult = ValidationResult.fromErrorIf(c,
				"Please choose a name for the element", !allowEmptyName && newValue.equals(""));
		ValidationResult finalResult = ValidationResult.fromResults(emptyResult,
				alreadyExistanceResult);
		buttonStateManager.reportNewValueOfControl(originalName, newValue, c, finalResult);
		return finalResult;
	};
	validationSupport.registerValidator(nameTextField, nameTextFieldValidator);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:26,代码来源:CommonElementFieldsController.java

示例2: setValidationSupport

import org.controlsfx.validation.ValidationResult; //导入方法依赖的package包/类
@Override
public void setValidationSupport(ValidationSupport validationSupport) {
	this.validationSupport = validationSupport;
	Validator<String> ssNameTextFieldValidator = (c, newValue) -> {
		boolean sisExist = ProjectManager.getProject().getSisSceneByName(newValue)!= null;
		ValidationResult emptyResult = ValidationResult.fromErrorIf(c,
				"Please specify existing SisScene name", newValue.isEmpty());
		ValidationResult unexistingSisScene = ValidationResult.fromErrorIf(c,
				"SisScene with such name does not exist", !sisExist);
		ValidationResult finalResult = ValidationResult.fromResults(emptyResult,
				unexistingSisScene);
		buttonStateManager.reportNewValueOfControl(origSssAction.getSisSceneName(),
				newValue, c, finalResult);
		return finalResult;
	};
	this.validationSupport.registerValidator(ssNameTextField, ssNameTextFieldValidator);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:18,代码来源:SwitchSisSceneActionController.java

示例3: setValidationSupport

import org.controlsfx.validation.ValidationResult; //导入方法依赖的package包/类
@Override
public void setValidationSupport(ValidationSupport validationSupport) {
	this.validationSupport = validationSupport;
	Validator<String> soundFileTextFieldValidator = (c, newValue) -> {
		boolean extensionsValidationPassed = true;
		if (!newValue.isEmpty()) {
			extensionsValidationPassed = Util.checkFileExtension(newValue, allowedExtensions);
		}
		ValidationResult emptyResult = ValidationResult.fromErrorIf(c,
				"Please select a path to sound file", newValue.isEmpty());
		ValidationResult badExtensionResult = ValidationResult.fromErrorIf(c,
				"The selected sound file has wrong extension", !extensionsValidationPassed);
		ValidationResult existingPathResult = ValidationResult.fromErrorIf(c,
				"Sound file is not found on this path",
				!Util.checkIfPathIsAbsoluteAndFileExists(newValue));
		ValidationResult finalResult = ValidationResult.fromResults(emptyResult,
				existingPathResult, badExtensionResult);
		buttonStateManager.reportNewValueOfControl(origSoundAction.getSoundPath(),
				newValue, c, finalResult);
		return finalResult;
	};
	this.validationSupport.registerValidator(soundFileTextField, soundFileTextFieldValidator);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:24,代码来源:SoundActionController.java

示例4: enableModifiersTextFieldValidation

import org.controlsfx.validation.ValidationResult; //导入方法依赖的package包/类
private void enableModifiersTextFieldValidation() {
	if (validationSupport != null) {
		Validator<String> modifiersTextFieldValidator = (c, newValue) -> {
			KeyCodeCombination kcc = keyCombinationProperty.get();
			// Allow empty modifiers only if KeyCodeCombination is not set.
			ValidationResult emptyResult = ValidationResult.fromErrorIf(c,
					"Need at least one modifier", kcc != null && newValue.isEmpty());
			ValidationResult finalResult = ValidationResult.fromResults(emptyResult);
			return finalResult;
		};
		validationSupport.registerValidator(modifiersTextField, modifiersTextFieldValidator);
	}
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:14,代码来源:HotkeyRow.java

示例5: setValidationSupport

import org.controlsfx.validation.ValidationResult; //导入方法依赖的package包/类
@Override
public void setValidationSupport(ValidationSupport validationSupport) {
	this.validationSupport = validationSupport;
	Validator<String> targetFieldValidator = (c, newValue) -> {
		boolean extensionsValidationPassed = true;
		if (!newValue.isEmpty()) {
			extensionsValidationPassed = Util.checkFileExtension(newValue, allowedExtensions);
		}
		ValidationResult emptyResult = ValidationResult.fromErrorIf(c,
				"Please select a path to Target image file", newValue.isEmpty());
		ValidationResult badExtensionResult = ValidationResult.fromErrorIf(c,
				"The selected target Image file has wrong extension",
				!extensionsValidationPassed);
		ValidationResult invalidPathResult = ValidationResult.fromErrorIf(c,
				"The path seems slightly... invalid",
				!Util.checkIfAbsolutePathSeemsValid(newValue));
		ValidationResult validPathResult = ValidationResult.fromErrorIf(c,
				"Image file is not found on this path",
				!Util.checkIfPathIsAbsoluteAndFileExists(newValue));
		ValidationResult finalResult = ValidationResult.fromResults(emptyResult,
				invalidPathResult, badExtensionResult, validPathResult);
		if (finalResult.getErrors().isEmpty()) {
			updateViewBasedOnTargetImagePath(newValue);
		} else {
			// If there are errors, let's not show image in ImageView.
			updateViewBasedOnTargetImagePath(null);
		}
		buttonStateManager.reportNewValueOfControl(origTiwa.getTargetImagePath(),
				newValue, c, finalResult);
		return finalResult;
	};
	this.validationSupport.registerValidator(targetTextField, targetFieldValidator);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:34,代码来源:TargetImageWithActionsController.java

示例6: setValidationSupport

import org.controlsfx.validation.ValidationResult; //导入方法依赖的package包/类
@Override
public void setValidationSupport(ValidationSupport validationSupport) {
	this.validationSupport = validationSupport;
	coordsController.setValidationSupport(validationSupport);
	simController.setValidationSupport(validationSupport);
	Validator<String> targetFieldValidator = (c, newValue) -> {
		boolean extensionsValidationPassed = true;
		if (!newValue.isEmpty()) {
			extensionsValidationPassed = Util.checkFileExtension(newValue, allowedExtensions);
		}
		ValidationResult emptyResult = ValidationResult.fromErrorIf(c,
				"Please select a path to Target image file", newValue.isEmpty());
		ValidationResult badExtensionResult = ValidationResult.fromErrorIf(c,
				"The selected target Image file has wrong extension",
				!extensionsValidationPassed);
		ValidationResult invalidPathResult = ValidationResult.fromErrorIf(c,
				"The path seems slightly... invalid",
				!Util.checkIfAbsolutePathSeemsValid(newValue));
		ValidationResult validPathResult = ValidationResult.fromErrorIf(c,
				"Image file is not found on this path",
				!Util.checkIfPathIsAbsoluteAndFileExists(newValue));
		ValidationResult finalResult = ValidationResult.fromResults(emptyResult,
				invalidPathResult, badExtensionResult, validPathResult);
		if (finalResult.getErrors().isEmpty()) {
			updateViewBasedOnTargetImagePath(newValue);
		} else {
			// If there are errors, let's not show image in ImageView.
			updateViewBasedOnTargetImagePath(null);
		}
		buttonStateManager.reportNewValueOfControl(origRegCounter.getTargetImagePath(),
				newValue, c, finalResult);
		return finalResult;
	};
	this.validationSupport.registerValidator(targetTextField, targetFieldValidator);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:36,代码来源:RegionTargetCounterController.java

示例7: setValidationSupport

import org.controlsfx.validation.ValidationResult; //导入方法依赖的package包/类
@Override
public void setValidationSupport(ValidationSupport validationSupport) {
	this.validationSupport = validationSupport;
	Validator<String> sceneNameTextFieldValidator = (c, newValue) -> {
		ValidationResult emptyResult = ValidationResult.fromErrorIf(c,
				"Specify existing scene name in Streaming Program", newValue.isEmpty());
		ValidationResult finalResult = ValidationResult.fromResults(emptyResult);
		buttonStateManager.reportNewValueOfControl(origSspsAction.getSceneName(), newValue, c,
				finalResult);
		return finalResult;
	};
	this.validationSupport.registerValidator(sceneNameTextField, sceneNameTextFieldValidator);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:14,代码来源:SwitchSPSceneActionController.java

示例8: setValidationSupport

import org.controlsfx.validation.ValidationResult; //导入方法依赖的package包/类
@Override
public void setValidationSupport(ValidationSupport validationSupport) {
	this.validationSupport = validationSupport;
	Validator<String> destinationFieldValidator = (c, newValue) -> {
		ValidationResult emptyResult = ValidationResult.fromErrorIf(c,
				"Please select a path to file", newValue.isEmpty());
		ValidationResult invalidPathResult = ValidationResult.fromErrorIf(c,
				"The path seems slightly... invalid",
				!Util.checkIfAbsolutePathSeemsValid(newValue));
		ValidationResult noExtensionResult = ValidationResult.fromErrorIf(c,
				"The file should have an extension",
				!newValue.isEmpty() && Util.extractFileExtensionFromPath(newValue) == null);
		ValidationResult notAbsolutePathResult = ValidationResult.fromErrorIf(c,
				"The path should be absolute. No exceptions.",
				!(new File(newValue).isAbsolute()));
		ValidationResult finalResult = ValidationResult.fromResults(emptyResult,
				noExtensionResult, invalidPathResult, notAbsolutePathResult);
		if (finalResult.getMessages().size() == 0) {
			filePickerHBox.setDisable(false);
		} else {
			filePickerHBox.setDisable(true);
		}
		buttonStateManager.reportNewValueOfControl(origMFCAction.getDstFilePath(), newValue, c,
				finalResult);
		return finalResult;
	};
	this.validationSupport.registerValidator(destinationTextField, destinationFieldValidator);
	MSFCPontroller.setValidationSupport(validationSupport);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:30,代码来源:MultiFileCopyActionController.java

示例9: setValidationSupport

import org.controlsfx.validation.ValidationResult; //导入方法依赖的package包/类
@Override
public void setValidationSupport(ValidationSupport validationSupport) {
	this.validationSupport = validationSupport;
	Validator<String> keyTextFieldValidator = (c, newValue) -> {
		ValidationResult emptyResult = ValidationResult.fromErrorIf(c,
				"Please choose a keyboard key", newValue.isEmpty());
		ValidationResult finalResult = ValidationResult.fromResults(emptyResult);
		KeyCodeCombination OrigKK = parseKeyCodeCombinationFromString(origHkAction.getHotkey());
		buttonStateManager.reportNewValueOfControl(keyTextFromKeyCombination(OrigKK), newValue,
				c, finalResult);
		return finalResult;
	};
	this.validationSupport.registerValidator(keyTextField, keyTextFieldValidator);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:15,代码来源:HotkeyActionController.java

示例10: setValidationForSrcPathTextField

import org.controlsfx.validation.ValidationResult; //导入方法依赖的package包/类
private void setValidationForSrcPathTextField() {
	if (buttonStateManager != null) {
		if (validationSupport != null) {
			if (validationSupport.getRegisteredControls().contains(fileTable)) {
				disableValidationForFileTable();
			}
			Validator<String> srcPathFieldValidator = (c, newValue) -> {
				ValidationResult emptyResult = ValidationResult.fromErrorIf(c,
						"Select a path to directory with files", newValue.isEmpty());
				ValidationResult invalidPathResult = ValidationResult.fromErrorIf(c,
						"The path seems slightly... invalid",
						!Util.checkIfAbsolutePathSeemsValid(newValue));
				ValidationResult notAbsolutePathResult = ValidationResult.fromErrorIf(c,
						"The path should be absolute. No exceptions.",
						!(new File(newValue).isAbsolute()));
				ValidationResult notDirectoryResult = ValidationResult.fromErrorIf(c,
						"The path should be to an existing directory",
						!(new File(newValue).isDirectory()));
				ValidationResult finalResult = ValidationResult.fromResults(emptyResult,
						notDirectoryResult, invalidPathResult, notAbsolutePathResult);
				buttonStateManager.reportNewValueOfControl(origLister.getSrcPath(), newValue,
						c, finalResult);
				if (finalResult.getErrors().size() != 0) {
					sampleFile.set(null);
				}
				return finalResult;
			};
			validationSupport.registerValidator(srcPathTextField, true,
					srcPathFieldValidator);
		}
	} else {
		throw new RuntimeException(
				"Check if CuteButtonsStatesManager is set to this controller.");
	}
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:36,代码来源:MultiSourceFileListerController.java

示例11: generateValidatorForIntervalTextField

import org.controlsfx.validation.ValidationResult; //导入方法依赖的package包/类
/**
 * Generate {@link Validator} for IntegerTextField containing time interval.
 *
 * @param originalInterval
 *            The original value of IntegerTextField.
 * @param checkOrRepeat
 *            Make validator for check interval or repeat interval. True for check interval.
 * @return the Validator.
 */
private Validator<String> generateValidatorForIntervalTextField(int originalInterval,
		boolean checkOrRepeat) {
	Validator<String> intervalFieldValidator = (c, newValue) -> {
		String tooSmallWarning = "Be careful when setting such small time interval, because it"
				+ " can cause high CPU usage depending on Actor's ";
		if (checkOrRepeat) {
			tooSmallWarning += "Checker.";
		} else {
			tooSmallWarning += "On Actions and Off Actions.";
		}
		IntegerTextField tf = (IntegerTextField) c;
		int number = tf.numberProperty().get();
		ValidationResult emptyResult = ValidationResult.fromErrorIf(c,
				"This field can't be empty.", newValue.isEmpty());
		ValidationResult justMinusResult = ValidationResult.fromErrorIf(c,
				"Oh, come on, you can't input just minus!", newValue.equals("-"));
		ValidationResult tooSmallResult = ValidationResult.fromErrorIf(c,
				"The number can't be smaller than " + ConstsAndVars.minimumCheckInterval + ".",
				checkIfIntervalBigEnough(number));
		ValidationResult aBitSmallResult = ValidationResult.fromWarningIf(c, tooSmallWarning,
				ConstsAndVars.minimumCheckInterval <= number && number < 1000);
		ValidationResult finalResult = ValidationResult.fromResults(emptyResult,
				tooSmallResult, justMinusResult, aBitSmallResult);
		buttonStateManager.reportNewValueOfControl(originalInterval, number, c, finalResult);
		return finalResult;
	};
	return intervalFieldValidator;
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:38,代码来源:UniversalActorController.java

示例12: setValidationSupport

import org.controlsfx.validation.ValidationResult; //导入方法依赖的package包/类
@Override
public void setValidationSupport(ValidationSupport validationSupport) {
	this.validationSupport = validationSupport;
	coordsController.setValidationSupport(validationSupport);
	simController.setValidationSupport(validationSupport);
	Validator<String> targetFieldValidator = (c, newValue) -> {
		boolean extensionsValidationPassed = true;
		if (!newValue.isEmpty()) {
			extensionsValidationPassed = Util.checkFileExtension(newValue, allowedExtensions);
		}
		ValidationResult emptyResult = ValidationResult.fromErrorIf(c,
				"Please select a path to Target image file", newValue.isEmpty());
		ValidationResult badExtensionResult = ValidationResult.fromErrorIf(c,
				"The selected target Image file has wrong extension",
				!extensionsValidationPassed);
		ValidationResult invalidPathResult = ValidationResult.fromErrorIf(c,
				"The path seems slightly... invalid",
				!Util.checkIfAbsolutePathSeemsValid(newValue));
		ValidationResult validPathResult = ValidationResult.fromErrorIf(c,
				"Image file is not found on this path",
				!Util.checkIfPathIsAbsoluteAndFileExists(newValue));
		ValidationResult finalResult = ValidationResult.fromResults(emptyResult,
				invalidPathResult, badExtensionResult, validPathResult);
		if (finalResult.getErrors().isEmpty()) {
			updateViewBasedOnTargetImagePath(newValue);
		} else {
			// If there are errors, let's not show image in ImageView.
			updateViewBasedOnTargetImagePath(null);
		}
		buttonStateManager.reportNewValueOfControl(origRegChecker.getTargetImagePath(),
				newValue, c, finalResult);
		return finalResult;
	};
	this.validationSupport.registerValidator(targetTextField, targetFieldValidator);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:36,代码来源:RegionCheckerController.java

示例13: setValidationSupport

import org.controlsfx.validation.ValidationResult; //导入方法依赖的package包/类
@Override
public void setValidationSupport(ValidationSupport validationSupport) {
	this.validationSupport = validationSupport;
	Validator<Number> similaritySliderValidator = (c, newValue) -> {
		// Not using newValue.intValue(), because we want rounded value, not truncated.
		int intValue = Math.round(newValue.floatValue());
		ValidationResult zeroResult = ValidationResult.fromErrorIf(c,
				"Zero minimum acceptable similarity means any random image on screen can be "
						+ "matched with Target image. It's pointless. Forget about it.",
				intValue < 1);
		ValidationResult lowResult = ValidationResult.fromWarningIf(c,
				"Minimum acceptable similarity is too low. This Checker will often react like "
				+ "it sees the Target image on screen when something else is on the screen. "
				+ "False positive result.",
				intValue >= 1 && intValue <= 40);
		int originalValue = Math.round(origSimilarity.get()*100);
		buttonStateManager.reportNewValueOfControl(originalValue, intValue, c, zeroResult);
		String similarityComment;
		if (intValue > 98) {
			similarityComment = "Find an exact match. May not recognize even identical image "
					+ "in some cases.";
		} else if (intValue >= 95) {
			similarityComment = "Find a precise match. Recommended to use.";
		} else if (intValue >= 70) {
			similarityComment = "Find a good match or better. Some risk of false positive "
					+ "results.";
		} else if (intValue >= 40) {
			similarityComment = "Find a bad match or better. "
					+ "High risk of false positive results.";
		} else if (intValue >= 30) {
			similarityComment = "Find almost any match. Super high risk of false positive "
					+ "results.";
		} else if (intValue >= 20) {
			similarityComment = "You want false positive results? Because that's how you get "
					+ "false positive results.";
		} else {
			similarityComment = "No. Just no.";
		}
		similarityDescriptionLabel.setText(similarityComment);
		similarityLabel.setText(similarityLabelOrigText + newValue.intValue() + "%");
		ValidationResult finalResult = ValidationResult.fromResults(zeroResult, lowResult);
		return finalResult;
	};
	this.validationSupport.registerValidator(similaritySlider, similaritySliderValidator);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:46,代码来源:SimilarityController.java


注:本文中的org.controlsfx.validation.ValidationResult.fromResults方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。