@Override
    public void onKeyUp(KeyUpEvent event) {
      TextItemEntityModelBinded source = (TextItemEntityModelBinded) event.getSource();
      String title = source.getTitle();
      Object inputValue = source.getValue();
      Object currentValue = entityModel.getEntity();
      GWT.log("Getting:" + currentValue);

      // parse
      if (parser != null) {
        inputValue = parser.parse((String) inputValue);
      }

      // convert int
      if (convertToInt) {
        try {
          inputValue = Integer.parseInt((String) inputValue);
        } catch (NumberFormatException e) {
          return;
        }
      }

      // do not set if value has not changed
      if (currentValue != null && currentValue.equals(inputValue)) {
        return;
      }

      // set
      GWT.log("Setting " + title + " to: " + inputValue);
      entityModel.setEntity(inputValue);
    }
    @Override
    public void onBlur(BlurEvent event) {
      TextItemEntityModelBinded source = (TextItemEntityModelBinded) event.getSource();
      String inputValue = (String) source.getValue();

      // display formatted value if a parser exists
      if (parser != null) {
        String displayValue = parser.format((String) inputValue);
        source.setValue(displayValue);
      }
    }
 @Override
 public void eventRaised(Event ev, Object sender, EventArgs args) {
   String property = ((PropertyChangedEventArgs) args).PropertyName;
   if (property.equals("IsChangable")) {
     textItem.setDisabled(!((Model) sender).getIsChangable());
   } else if (property.equals("IsAvailable")) {
     if (!entityModel.getIsAvailable()) {
       hide();
     } else {
       show();
     }
   } else if (property.equals("IsValid")) {
     if (!entityModel.getIsValid()) {
       setTextBoxStyle("textBoxInvalid");
       if (entityModel.getInvalidityReasons() != null
           && entityModel.getInvalidityReasons().size() > 0) {
         setTooltip("<nobr>" + entityModel.getInvalidityReasons().iterator().next() + "</nobr>");
         setHoverStyle("gridToolTipStyle");
         setHoverWidth(1);
         setHoverDelay(100);
       }
     } else {
       setTextBoxStyle("engineTextItem");
       setTooltip("");
     }
   }
 }
    @Override
    public void eventRaised(Event ev, Object sender, EventArgs args) {
      GWT.log(
          "Text item changed: "
              + textItem.getTitle()
              + " Changed to: "
              + ((EntityModel) sender).getEntity());

      if (((EntityModel) sender).getEntity() != null) {
        String newValue = ((EntityModel) sender).getEntity().toString();
        // if the value is same as the current one, do nothing
        if (newValue.equals(textItem.getValue())) {
          return;
        }
        if (parser == null) {
          textItem.setValue(newValue);
        } else {
          textItem.setValue(parser.format(newValue));
        }
        textItem.redraw();
      } else {
        textItem.setValue("");
      }
    }