diff options
author | Brian Hinz <bphinz@users.sourceforge.net> | 2012-05-14 02:19:41 +0000 |
---|---|---|
committer | Brian Hinz <bphinz@users.sourceforge.net> | 2012-05-14 02:19:41 +0000 |
commit | 19810efe31bad78889dc001ecd8b62e2ee91bf30 (patch) | |
tree | 1cb1ac5fae815fb1086e77dffeae21f1cc4c501e /java/com/tigervnc/rfb/IntParameter.java | |
parent | 8970bf4ddb106dc880cd37b916a2cc4c2f08168d (diff) | |
download | tigervnc-19810efe31bad78889dc001ecd8b62e2ee91bf30.tar.gz tigervnc-19810efe31bad78889dc001ecd8b62e2ee91bf30.zip |
Implemented rfb/Configuration similar to the native client methods. Added equivalent cmd line options for all native client options except "-menuKey", which needs a little more work on the GUI side before it can be added.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4913 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'java/com/tigervnc/rfb/IntParameter.java')
-rw-r--r-- | java/com/tigervnc/rfb/IntParameter.java | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/java/com/tigervnc/rfb/IntParameter.java b/java/com/tigervnc/rfb/IntParameter.java index c794c6b7..d9497109 100644 --- a/java/com/tigervnc/rfb/IntParameter.java +++ b/java/com/tigervnc/rfb/IntParameter.java @@ -1,4 +1,6 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * Copyright 2004-2005 Cendio AB. + * Copyright 2012 Brian P. Hinz * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,26 +21,55 @@ package com.tigervnc.rfb; public class IntParameter extends VoidParameter { - public IntParameter(String name_, String desc_, int v) { - super(name_, desc_); + public IntParameter(String name_, String desc_, int v, + int minValue_, int maxValue_, + Configuration.ConfigurationObject co) + { + super(name_, desc_, co); value = v; defValue = v; + minValue = minValue_; + maxValue = maxValue_; + } + + public IntParameter(String name_, String desc_, int v) + { + this(name_, desc_, v, Integer.MIN_VALUE, Integer.MAX_VALUE, + Configuration.ConfigurationObject.ConfGlobal); } public boolean setParam(String v) { + if (immutable) return true; + vlog.debug("set "+getName()+"(Int) to "+v); try { - value = Integer.parseInt(v); + int i; + i = Integer.parseInt(v); + if (i < minValue || i > maxValue) + return false; + value = i; + return true; } catch (NumberFormatException e) { - return false; + throw new Exception(e.toString()); } + } + + public boolean setParam(int v) { + if (immutable) return true; + vlog.debug("set "+getName()+"(Int) to "+v); + if (v < minValue || v > maxValue) + return false; + value = v; return true; } public String getDefaultStr() { return Integer.toString(defValue); } public String getValueStr() { return Integer.toString(value); } + //public int int() { return value; } public int getValue() { return value; } protected int value; protected int defValue; + protected int minValue; + protected int maxValue; } |