コード例 #1
0
  public void commandAction(Command c, Displayable d) {
    if (c == cmdCancel) {
      destroyView();
      return;
    }
    if (c == cmdOk) {
      try {
        int type = choiseType.getSelectedIndex();
        String value = textValue.getString();
        if (type == 2) value = PrivacyItem.subscrs[choiceSubscr.getSelectedIndex()];
        if (type != PrivacyItem.ITEM_ANY) if (value.length() == 0) return;
        // int order=Integer.parseInt(textOrder.getString());

        item.action = choiceAction.getSelectedIndex();
        item.type = type;
        item.value = value;
        // item.order=order;
        choiseStanzas.getSelectedFlags(item.stanzasSet);

        if (targetList != null)
          if (!targetList.rules.contains(item)) {
            targetList.addRule(item);
            item.order = targetList.rules.indexOf(item) * 10;
          }
        destroyView();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }