コード例 #1
0
ファイル: MiComboBox.java プロジェクト: justacoder/mica
  public void setValue(String value) {
    if (value != null) {
      value = MiSystem.getProperty(value, value);
    }

    if (Utility.isEqualTo(value, textField.getValue())) {
      return;
    }

    if (restrictingValuesToThoseInList) {
      if ((list.getIndexOfItem(value, restrictionIgnoresCase) == -1)
          && (list.getNumberOfItems() > 0)) {
        if (restrictionWarnsOnly) {
          textField.setValue(value);
          list.getSelectionManager().deSelectAll();
        } else {
          throw new IllegalArgumentException(
              MiDebug.getMicaClassName(this)
                  + ": Rejecting value: \""
                  + value
                  + "\" because it is not present in list"
                  + " (see MiComboBox.setRestrictingValuesToThoseInList()).\n"
                  + "Values present in list are: "
                  + getContents());
        }
      }
    }
    textField.setValue(value);
    if (!list.getContents().contains(value)) list.getSelectionManager().deSelectAll();
    else list.setValue(textField.getValue());
  }
コード例 #2
0
  public int processEvent(MiEvent event) {
    if ((isEnabled())
        && (event.getType() != MiEvent.Mi_TIMER_TICK_EVENT)
        && (event.getType() != MiEvent.Mi_IDLE_EVENT)) {
      tmpPoint.copy(event.worldPt);
      MiPageManager pageManager = event.editor.getPageManager();
      String unitsName = "";
      if (pageManager != null) {
        pageManager.transformWorldPointToUnitsPoint(tmpPoint);
        unitsName = pageManager.getUnits().getAbbreviation();
      }

      if (tmpPoint.x != lastX) {
        lastX = tmpPoint.x;
        xPos.setValue("X: " + Utility.toShortString(tmpPoint.x) + " " + unitsName);
      }
      if (tmpPoint.y != lastY) {
        lastY = tmpPoint.y;
        yPos.setValue("Y: " + Utility.toShortString(tmpPoint.y) + " " + unitsName);
      }
    }
    return (Mi_PROPOGATE_EVENT);
  }
コード例 #3
0
ファイル: MiComboBox.java プロジェクト: justacoder/mica
 /**
  * ------------------------------------------------------ Creates a prototype from the class named
  * by the Mi_COMBOBOX_PROTOTYPE_CLASS_NAME system property, if specified.
  * ------------------------------------------------------
  */
 static {
   String prototypeClassName = MiSystem.getProperty(Mi_COMBOBOX_PROTOTYPE_CLASS_NAME);
   if (prototypeClassName != null) {
     prototype = (MiComboBox) Utility.makeInstanceOfClass(prototypeClassName);
   }
 }