Exemplo n.º 1
0
  private void update() {
    int lower = -1;
    int upper = -1;

    try {
      Object obj = _getMethod.invoke(_container.getTarget(), _noArg);
      if (obj instanceof MMultiplicity) {
        MMultiplicity mult = (MMultiplicity) obj;
        lower = mult.getLower();
        upper = mult.getUpper();
      }
    } catch (Exception e) {
      System.out.println(e.toString() + " in UMLMultiplicityComboBox.update()");
    }
    boolean match = false;
    for (int i = 0; i < _mults.length; i++) {
      if (lower == _lower[i] && upper == _upper[i]) {
        setSelectedIndex(i);
        match = true;
        break;
      }
    }
    if (!match) {
      StringBuffer buf = new StringBuffer();
      if (lower <= 0) {
        buf.append("0..");
      } else {
        buf.append(Integer.toString(lower));
        buf.append("..");
      }
      if (upper < 0) {
        buf.append("*");
      } else {
        buf.append(Integer.toString(upper));
      }
      setSelectedItem(buf.toString());
    }
  }