You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

StringParameter.java 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. * Copyright 2004-2005 Cendio AB.
  3. * Copyright 2012 Brian P. Hinz
  4. *
  5. * This is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This software is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this software; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
  18. * USA.
  19. */
  20. package com.tigervnc.rfb;
  21. public class StringParameter extends VoidParameter {
  22. public StringParameter(String name_, String desc_, String v,
  23. Configuration.ConfigurationObject co)
  24. {
  25. super(name_, desc_, co);
  26. value = v;
  27. defValue = v;
  28. }
  29. public StringParameter(String name_, String desc_, String v)
  30. {
  31. this(name_, desc_, v, Configuration.ConfigurationObject.ConfGlobal);
  32. }
  33. public void setDefaultStr(String v) {
  34. value = defValue = v;
  35. }
  36. public boolean setParam(String v) {
  37. if (immutable) return true;
  38. if (v == null)
  39. throw new Exception("setParam(<null>) not allowed");
  40. value = v;
  41. return value != null;
  42. }
  43. public String getDefaultStr() { return defValue; }
  44. public String getValueStr() { return value; }
  45. public String getValue() { return value; }
  46. public String getData() { return value; }
  47. protected String value;
  48. protected String defValue;
  49. }