Search in sources :

Example 1 with ValidationWarning

use of org.cytoscape.filter.model.ValidationWarning in project cytoscape-impl by cytoscape.

the class ValidationViewListener method formatTooltip.

public static String formatTooltip(List<ValidationWarning> warnings) {
    StringBuilder sb = new StringBuilder();
    sb.append("<html>");
    sb.append("Filter cannot be applied to current network:<br>");
    for (ValidationWarning warning : warnings) {
        sb.append(warning.getWarning()).append("<br>");
    }
    sb.append("</html>");
    return sb.toString();
}
Also used : ValidationWarning(org.cytoscape.filter.model.ValidationWarning)

Example 2 with ValidationWarning

use of org.cytoscape.filter.model.ValidationWarning in project cytoscape-impl by cytoscape.

the class TransformerJsonTunable method validate.

public static boolean validate(NamedTransformer<CyNetwork, CyIdentifiable> namedTransformer, TaskMonitor taskMonitor) {
    boolean valid = true;
    for (Transformer<CyNetwork, CyIdentifiable> transformer : namedTransformer.getTransformers()) {
        if (transformer instanceof ValidatableTransformer) {
            ValidatableTransformer<CyNetwork, CyIdentifiable> validatableTransformer = (ValidatableTransformer<CyNetwork, CyIdentifiable>) transformer;
            List<ValidationWarning> warnings = validatableTransformer.validateCreation();
            if (warnings != null && !warnings.isEmpty()) {
                valid = false;
                for (ValidationWarning warning : warnings) {
                    taskMonitor.showMessage(Level.ERROR, warning.getWarning());
                }
            }
        }
    }
    return valid;
}
Also used : CyNetwork(org.cytoscape.model.CyNetwork) ValidationWarning(org.cytoscape.filter.model.ValidationWarning) ValidatableTransformer(org.cytoscape.filter.model.ValidatableTransformer) CyIdentifiable(org.cytoscape.model.CyIdentifiable)

Example 3 with ValidationWarning

use of org.cytoscape.filter.model.ValidationWarning in project cytoscape-impl by cytoscape.

the class ValidationManager method runValidation.

private void runValidation(ValidatableTransformer<CyNetwork, CyIdentifiable> transformer) {
    ValidationViewListener listener = listeners.get(transformer);
    List<ValidationWarning> warnings = transformer.validate(network);
    if (listener != null) {
        listener.handleValidated(new ValidationEvent(warnings));
    }
}
Also used : ValidationEvent(org.cytoscape.filter.internal.work.ValidationViewListener.ValidationEvent) ValidationWarning(org.cytoscape.filter.model.ValidationWarning)

Aggregations

ValidationWarning (org.cytoscape.filter.model.ValidationWarning)3 ValidationEvent (org.cytoscape.filter.internal.work.ValidationViewListener.ValidationEvent)1 ValidatableTransformer (org.cytoscape.filter.model.ValidatableTransformer)1 CyIdentifiable (org.cytoscape.model.CyIdentifiable)1 CyNetwork (org.cytoscape.model.CyNetwork)1