[MOBY-guts] biomoby commit
Paul Gordon
gordonp at dev.open-bio.org
Thu Feb 3 22:00:35 UTC 2011
gordonp
Thu Feb 3 17:00:35 EST 2011
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util
In directory dev.open-bio.org:/tmp/cvs-serv21298/src/main/ca/ucalgary/seahawk/util
Modified Files:
SeahawkOptions.java
Log Message:
Added support for font resizing (accessibility), and disabling highlight-while-typing (can cause app to freeze on some machines)
moby-live/Java/src/main/ca/ucalgary/seahawk/util SeahawkOptions.java,1.5,1.6
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/SeahawkOptions.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/SeahawkOptions.java 2007/12/06 18:47:58 1.5
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/SeahawkOptions.java 2011/02/03 22:00:35 1.6
@@ -19,6 +19,8 @@
public static final String REGISTRY_NAMESPACE_PROP = "registryNamespace";
public static final String CONVERTER_HOST_PROP = "documentConverterHost";
public static final String CONVERTER_PORT_PROP = "documentConverterPort";
+ public static final String FONT_SIZE_PROP = "fontSize";
+ public static final String FILTER_INTERACTIVE_PROP = "filterInteractive";
public static final String CUSTOM_REGISTRY_SYNONYM = "custom";
public static final String PROPS_FILE_NAME = "seahawkUserPrefs.xml";
@@ -30,10 +32,12 @@
private static Registry registry = null;
private static File tmpDir = new File(System.getProperty("java.io.tmpdir"));
private static boolean referrerPolicy = true;
+ private static boolean filterInteractive = true;
private static double cacheExpiryInHours = 24.0;
// Used OpenOffice to convert MS Office docs to RTF, currently a Solaris zone on moby.ucalgary.ca
private static String documentConverterHost = "136.159.169.81";
private static int documentConverterPort = 8100;
+ private static String fontSize = "100%";
/**
* Sets the options based on a shortcircuiting set of
@@ -123,6 +127,17 @@
"(will send referrer service header to services).");
}
+ boolString = properties.getProperty(FILTER_INTERACTIVE_PROP);
+ if(boolString != null && boolString.length() > 0){
+ filterInteractive = Boolean.parseBoolean(boolString);
+ }
+ else{
+ System.err.println("No filter interactivity policy (" +FILTER_INTERACTIVE_PROP+
+ ") provided in the Seahawk config file (" +
+ u + "), using default of \"true\" " +
+ "(matches highlighted while the filter criteria are being typed).");
+ }
+
String floatString = properties.getProperty(CACHE_POLICY_PROP);
if(floatString != null && floatString.length() > 0){
double hours = cacheExpiryInHours;
@@ -138,6 +153,25 @@
setCacheExpiry(hours);
}
+ String fontString = properties.getProperty(FONT_SIZE_PROP);
+ if(fontString != null && fontString.length() > 0){
+ String size = fontSize;
+ boolean relative = fontString.endsWith("%");
+ if(relative){
+ fontString = fontString.substring(0, fontString.length()-1); // lop off '%' sign
+ }
+ try{
+ size = ""+Double.parseDouble(fontString);
+ } catch(NumberFormatException nfe){
+ nfe.printStackTrace();
+ System.err.println("Ignoring the font size policy (" +FONT_SIZE_PROP+
+ ") provided in the Seahawk config file (" +
+ u + "), it is not in valid floating-point number format or a relative(trailing %) one: " +
+ fontString);
+ }
+ setFontSize(relative ? size+"%" : ""+size);
+ }
+
String dirPath = properties.getProperty(TEMP_DIR_PROP);
if(dirPath != null && dirPath.length() > 0){
try{
@@ -240,6 +274,8 @@
properties.setProperty(TEMP_DIR_PROP, tmpDir.getCanonicalFile().getPath());
properties.setProperty(CONVERTER_HOST_PROP, documentConverterHost);
properties.setProperty(CONVERTER_PORT_PROP, ""+documentConverterPort);
+ properties.setProperty(FONT_SIZE_PROP, fontSize);
+ properties.setProperty(FILTER_INTERACTIVE_PROP, ""+filterInteractive);
if(registry != null){
properties.setProperty(REGISTRY_SYNONYM_PROP, registry.getSynonym());
properties.setProperty(REGISTRY_ENDPOINT_PROP, registry.getEndpoint());
@@ -395,16 +431,30 @@
}
/**
- * For more details on how to run your own file converter, see http://www.artofsolving.com/node/10
+ * @return the relative size of the display font compared to the system default e.g. 120%
+ */
+ public static String getFontSize(){
+ return fontSize;
+ }
+ /** 100% = 1.0 */
+ public static double getFontSizeAsDouble(){
+ return Double.parseDouble(fontSize.substring(0, fontSize.length()-1))/100.0; // lop off % sign, convert to ratio
+ }
+
+ /**
+ * Sets the display font size for documents.
*
- * @param hostname machine on which an OpenOffice file converter is running
+ * @param size how big the display font should be relative to the system default
*/
- public static void setDocConverterHost(String hostname){
- if(hostname == null ||
- hostname.length() == 0){
- hostname = null;
- }
- documentConverterHost = hostname;
+ public static void setFontSize(String size){
+ fontSize = size;
+ }
+
+ /**
+ * @param port positive number representing where the OpenOffice file converter is listening
+ */
+ public static void setDocConverterHost(String host){
+ documentConverterHost = host;
}
/**
@@ -413,4 +463,14 @@
public static String getDocConverterHost(){
return documentConverterHost;
}
+
+ /**
+ * @param b whether the document should be updated as the filter widget is being typed into (can cause freezing problems on some systems)
+ */
+ public static void setFilterInteractive(boolean b){
+ filterInteractive = b;
+ }
+ public static boolean isFilterInteractive(){
+ return filterInteractive;
+ }
}
More information about the MOBY-guts
mailing list