Search in sources :

Example 1 with ValidatableTransformer

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

the class CompositeTransformerPanel method createViewModel.

private TransformerElementViewModel<TransformerPanel> createViewModel(Transformer<CyNetwork, CyIdentifiable> transformer) {
    JComponent component = transformerPanelController.createView(parent, transformer, 0);
    TransformerElementViewModel<TransformerPanel> viewModel = new TransformerElementViewModel<>(component, transformerPanelController, parent);
    if (transformer instanceof ValidatableTransformer) {
        transformerPanelController.getValidationManager().register((ValidatableTransformer<CyNetwork, CyIdentifiable>) transformer, viewModel);
    }
    return viewModel;
}
Also used : TransformerPanel(org.cytoscape.filter.internal.view.TransformerPanel) JComponent(javax.swing.JComponent) TransformerElementViewModel(org.cytoscape.filter.internal.view.TransformerElementViewModel) CyNetwork(org.cytoscape.model.CyNetwork) ValidatableTransformer(org.cytoscape.filter.model.ValidatableTransformer) CyIdentifiable(org.cytoscape.model.CyIdentifiable)

Example 2 with ValidatableTransformer

use of org.cytoscape.filter.model.ValidatableTransformer 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 ValidatableTransformer

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

the class CompositeFilterPanel method createViewModel.

@SuppressWarnings("unchecked")
private TransformerElementViewModel<P> createViewModel(Filter<CyNetwork, CyIdentifiable> filter) {
    JComponent component = filterPanelController.createView(parent, filter, depth + 1);
    TransformerElementViewModel<P> viewModel = new TransformerElementViewModel<P>(component, filterPanelController, parent);
    if (filter instanceof ValidatableTransformer) {
        filterPanelController.getValidationManager().register((ValidatableTransformer<CyNetwork, CyIdentifiable>) filter, viewModel);
    }
    return viewModel;
}
Also used : JComponent(javax.swing.JComponent) TransformerElementViewModel(org.cytoscape.filter.internal.view.TransformerElementViewModel) CyNetwork(org.cytoscape.model.CyNetwork) ValidatableTransformer(org.cytoscape.filter.model.ValidatableTransformer) CyIdentifiable(org.cytoscape.model.CyIdentifiable)

Aggregations

ValidatableTransformer (org.cytoscape.filter.model.ValidatableTransformer)3 CyIdentifiable (org.cytoscape.model.CyIdentifiable)3 CyNetwork (org.cytoscape.model.CyNetwork)3 JComponent (javax.swing.JComponent)2 TransformerElementViewModel (org.cytoscape.filter.internal.view.TransformerElementViewModel)2 TransformerPanel (org.cytoscape.filter.internal.view.TransformerPanel)1 ValidationWarning (org.cytoscape.filter.model.ValidationWarning)1