From: <bh...@us...> - 2008-02-27 19:05:47
|
Revision: 641 http://cishell.svn.sourceforge.net/cishell/?rev=641&view=rev Author: bh2 Date: 2008-02-27 11:04:07 -0800 (Wed, 27 Feb 2008) Log Message: ----------- Re-enabled use of DataValidators for algorithms. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2008-02-26 23:31:15 UTC (rev 640) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2008-02-27 19:04:07 UTC (rev 641) @@ -26,6 +26,7 @@ import org.cishell.framework.algorithm.Algorithm; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.algorithm.AlgorithmProperty; +import org.cishell.framework.algorithm.DataValidator; import org.cishell.framework.algorithm.ProgressMonitor; import org.cishell.framework.algorithm.ProgressTrackable; import org.cishell.framework.data.Data; @@ -94,6 +95,21 @@ ciContext.getService(GUIBuilderService.class.getName()); AlgorithmFactory factory = (AlgorithmFactory) bContext.getService(ref); + + if (factory instanceof DataValidator) { + String validation = ((DataValidator) factory).validate(data); + + if (validation != null && validation.length() > 0) { + String label = (String) ref.getProperty(LABEL); + if (label == null) { + label = "Algorithm"; + } + + builder.showError("Invalid Data", "The data given to \""+label+"\" is incompatible for this reason: "+validation , (String) null); + return null; + } + } + this.provider = factory.createParameters(data); String pid = (String)ref.getProperty(Constants.SERVICE_PID); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |