예제 #1
0
  /** @return */
  public String getBehavior() {
    if (properties.getProperty("behavior") != null) {
      return properties.getProperty("behavior");
    } else {
      LOG.warning("Undefined property 'behavior' in command '" + this.getName() + "'");

      return "undefined-behavior";
    }
  }
예제 #2
0
 public void executeSetScreenMode(Config params) {
   boolean executed = executeCommand("set screenmode", params);
   if (executed) {
     setScreenMode(params.getProperty("value"));
     setChanged(true);
   }
 }
예제 #3
0
 public void executeSetAVSelection(Config params) {
   boolean executed = executeCommand("set avselection", params);
   if (executed) {
     setAVSelection(params.getProperty("value"));
     setChanged(true);
   }
 }
예제 #4
0
 public void executeSetInput(Config params) {
   boolean executed = executeCommand("set input", params);
   if (executed) {
     setInput(params.getProperty("value"));
     setChanged(true);
   }
 }
예제 #5
0
 public void destroy() {
   name = null;
   receiver = null;
   description = null;
   stopIf = null;
   properties.getProperties().clear();
   properties = null;
 }
예제 #6
0
  /**
   * Creates an oredred list reading the command properties writed in format
   * "parameter[AN_INT_FROM_0_TO_999]" other properties format are ignored (not added to the
   * returned List) The indexs must be contiguous (1,2,3,...) for example:
   *
   * <p>
   * <li>parameter[0] = foo
   * <li>
   * <li>parameter[1] = bar
   * <li>parameter[3] = asd
   * <li>object = Light 1
   * <li>another-param = myValue
   *
   *     <p>The returned ArrayList<String> is
   * <li>[0]->foo
   * <li>[1]->bar because the index = 2 is missing.
   *
   * @return an ordered ArrayList<String> of command parameter values
   */
  public ArrayList<String> getParametersAsList() {
    ArrayList<String> output = new ArrayList<String>();

    // 99 is the max num of elements in list
    for (int i = 0; i < 99; i++) {
      String value = null;
      value = properties.getProperties().getProperty("parameter[" + i + "]");

      if (value != null) {
        // add to array
        output.add(value);
      } else {
        // if the elements are not contiguous return
        return output;
      }
    }

    return output;
  }
예제 #7
0
 /**
  * @param key
  * @param value
  */
 public void setProperty(String key, String value) {
   if (!key.isEmpty()) {
     properties.setProperty(key, value);
   }
 }
예제 #8
0
 /**
  * @param key
  * @return
  */
 public String getProperty(String key) {
   return properties.getProperty(key);
 }