be.ac.vub.cocompose.eclipse.model
Class IconValidator

java.lang.Object
  extended bybe.ac.vub.cocompose.eclipse.model.IconValidator
All Implemented Interfaces:
ICellEditorValidator

public class IconValidator
extends Object
implements ICellEditorValidator

Validates CoCompose RefinedElement icon URIs.

Since:
0.2.1
Version:
0.2.4, 22/01/2004
Author:
Dennis Wagelaar

Constructor Summary
IconValidator(RefinedElement subject)
          Creates an IconValidator.
 
Method Summary
 String convertToPath(String uri)
          Converts a URI to a file path, if possible.
 boolean imageExistsAt(String file)
          Returns true if a valid image exists at the given filename.
 boolean imageExistsAt(URL url)
          Returns true if a valid image exists at the given URL.
 boolean isPath(String uri)
          If no protocol specified, assume this is a file path.
 String isValid(Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IconValidator

public IconValidator(RefinedElement subject)
Creates an IconValidator.

Method Detail

isValid

public String isValid(Object value)
Specified by:
isValid in interface ICellEditorValidator
See Also:
ICellEditorValidator.isValid(java.lang.Object)

isPath

public boolean isPath(String uri)
If no protocol specified, assume this is a file path.

Parameters:
uri - the uri to check.
Returns:
true if uri is a file path.

convertToPath

public String convertToPath(String uri)
                     throws IOException
Converts a URI to a file path, if possible.

Parameters:
uri - the URI to convert
Returns:
the file path
Throws:
IOException - if conversion failed.

imageExistsAt

public boolean imageExistsAt(String file)
Returns true if a valid image exists at the given filename.

Parameters:
file - the filename
Returns:
true if a valid image exists at the given filename.

imageExistsAt

public boolean imageExistsAt(URL url)
Returns true if a valid image exists at the given URL.

Parameters:
url - the URL.
Returns:
true if a valid image exists at the given URL.