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.

VoidParameter.java 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. abstract public class VoidParameter {
  22. public VoidParameter(String name_, String desc_,
  23. Configuration.ConfigurationObject co)
  24. {
  25. immutable = false; _hasBeenSet = false; name = name_; description = desc_;
  26. Configuration conf = null;
  27. switch (co) {
  28. case ConfGlobal:
  29. conf = Configuration.global();
  30. break;
  31. case ConfServer:
  32. conf = Configuration.server();
  33. break;
  34. case ConfViewer:
  35. conf = Configuration.viewer();
  36. break;
  37. }
  38. _next = conf.head;
  39. conf.head = this;
  40. }
  41. public VoidParameter(String name_, String desc_) {
  42. this(name_, desc_, Configuration.ConfigurationObject.ConfGlobal);
  43. }
  44. final public String getName() {
  45. return name;
  46. }
  47. final public String getDescription() {
  48. return description;
  49. }
  50. abstract public boolean setParam(String value);
  51. public boolean setParam() { return false; }
  52. abstract public String getDefaultStr();
  53. abstract public String getValueStr();
  54. public boolean isBool() { return false; }
  55. public void setImmutable() {
  56. vlog.debug("set immutable "+getName());
  57. immutable = true;
  58. }
  59. public void setHasBeenSet() {
  60. _hasBeenSet = true;
  61. }
  62. public boolean hasBeenSet() {
  63. return _hasBeenSet;
  64. }
  65. protected String name;
  66. protected String description;
  67. public VoidParameter _next;
  68. protected boolean immutable;
  69. protected boolean _hasBeenSet;
  70. static LogWriter vlog = new LogWriter("VoidParameter");
  71. }