Cytoscape 3.0.0-beta1 API

org.cytoscape.work
Interface TunableValidator


public interface TunableValidator

If implemented, this interface is used to apply a test to the modified values of a Tunable.

        Example:
 
        If using this Test class :
        
                public class Test implements TunableValidator{
                        @Tunable(...)
                        String name = new String("John");
                }
 
 Then we can provide a method to check if the new value for this tunable matches with the conditions that we have set :
 
        public class Test implements TunableValidator{
                @Tunable(...)
                String name = new String("John");
 
                String validate(){
                        if(name.equals("Johnny"))
                        return new String("Please provide a different name!");
                        else return null;
                }
        }
        

The String message returned by validate() method is displayed to the user.

Author:
Pasteur

Cytoscape Backwards Compatibility (SPI Interface): We expect that this interface will be implemented. Therefore to maintain backwards compatibility this interface will only be modified for major version updates.

Nested Class Summary
static class TunableValidator.ValidationState
          This is what the TunableValidator can return.
 
Method Summary
 TunableValidator.ValidationState getValidationState(Appendable errMsg)
          Executes the validation test on the annotated Tunables.
 

Method Detail

getValidationState

TunableValidator.ValidationState getValidationState(Appendable errMsg)
Executes the validation test on the annotated Tunables.

Parameters:
errMsg - if the validation failed an explanatory message can be found here and accessed via errMsg.toString()
Returns:
OK if the test succeeded and INVALID if it failed and REQUEST_CONFIRMATION if the user has to be asked for confirmation, e.g. if a file would have to be overwritten etc.

Cytoscape 3.0.0-beta1 API

Copyright 2011 Cytoscape Consortium. All rights reserved.