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;
}
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;
}
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;
}
Aggregations