JAL-3005 new argument type FileParameter for file chooser
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 30 May 2018 11:09:51 +0000 (12:09 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 30 May 2018 11:09:51 +0000 (12:09 +0100)
src/jalview/ws/params/ValueConstrainI.java
src/jalview/ws/params/simple/FileParameter.java [new file with mode: 0644]

index 47f454a..d1bdc98 100644 (file)
@@ -29,7 +29,7 @@ public interface ValueConstrainI
 
   public enum ValueType
   {
-    Integer, Float, String, Double
+    Integer, Float, String, Double, File
   };
 
   ValueType getType();
diff --git a/src/jalview/ws/params/simple/FileParameter.java b/src/jalview/ws/params/simple/FileParameter.java
new file mode 100644 (file)
index 0000000..aa8e7ad
--- /dev/null
@@ -0,0 +1,47 @@
+package jalview.ws.params.simple;
+
+import jalview.ws.params.ValueConstrainI;
+
+/**
+ * A class that represents a file parameter. User entry options should include
+ * direct input of a file path as text, or file selection using a file browser.
+ * 
+ * @author gmcarstairs
+ *
+ */
+public class FileParameter extends StringParameter
+{
+
+  public FileParameter(String name, String description, boolean required,
+          String defValue, String value)
+  {
+    super(name, description, required, defValue, value);
+  }
+
+  @Override
+  public ValueConstrainI getValidValue()
+  {
+    return new ValueConstrainI()
+    {
+
+      @Override
+      public ValueType getType()
+      {
+        return ValueType.File;
+      }
+
+      @Override
+      public Number getMax()
+      {
+        return null;
+      }
+
+      @Override
+      public Number getMin()
+      {
+        return null;
+      }
+    };
+  }
+
+}