コード例 #1
0
    @Override
    public void eventRaised(Event ev, Object sender, EventArgs args) {
      if (async && getForm() == null) return;

      valueMap = new LinkedHashMap<String, String>();
      ListModel listModel = (ListModel) sender;
      Iterable items = listModel.getItems();

      if (items != null) {
        GWT.log("Select box " + selectBox.getTitle() + " items loaded: " + items);
        itemsCount = 0;
        for (Object o : items) {
          itemsCount++;
          valueMap.put(getItemId(o), getItemName(o));
        }
        if (model.getIsChangable()) {
          setShowDisabled(false);
          setDisabled(false);
        } else {
          setShowDisabled(true);
          setDisabled(!model.getIsChangable());
        }

        // Set a tool tip with a prohibition reason when the select box is non-changeable
        if (!listModel.getIsChangable() && !listModel.getChangeProhibitionReasons().isEmpty()) {
          setTooltip("<nobr>" + model.getChangeProhibitionReasons().iterator().next() + "</nobr>");
          setHoverStyle("gridToolTipStyle");
          setHoverWidth(1);
          setHoverDelay(100);
        }
      } else {
        GWT.log("Select box " + selectBox.getTitle() + " items loaded are null");
      }
      selectBox.setValueMap(valueMap);
    }