コード例 #1
0
  private void onDataObjectChange(@Observes DataObjectChangeEvent event) {
    if (event.isFromContext(context != null ? context.getContextId() : null)) {
      if (event.getChangeType() == ChangeType.CLASS_NAME_CHANGE
          || event.getChangeType() == ChangeType.PACKAGE_NAME_CHANGE
          || event.getChangeType() == ChangeType.OBJECT_NAME_CHANGE
          || MainDomainAnnotations.LABEL_ANNOTATION.equals(event.getAnnotationClassName())) {

        refreshObjectSelector(dataObject);

        // For self references: in case name or package changes redraw properties table
        skipNextFieldNotification = true;
        dataObjectPropertiesProvider.refresh();
        dataObjectPropertiesTable.redraw();

        Scheduler.get()
            .scheduleDeferred(
                new Scheduler.ScheduledCommand() {
                  @Override
                  public void execute() {
                    selectCurrentObject(false);
                  }
                });
      }
    }
  }
コード例 #2
0
  private void onDataObjectPropertyChange(@Observes DataObjectFieldChangeEvent event) {
    if (event.isFromContext(context != null ? context.getContextId() : null)) {

      if (event.getChangeType() == ChangeType.FIELD_NAME_CHANGE
          || event.getChangeType() == ChangeType.FIELD_TYPE_CHANGE
          || event.getChangeType() == ChangeType.FIELD_ANNOTATION_VALUE_CHANGE
          || event.getChangeType() == ChangeType.FIELD_ANNOTATION_ADD_CHANGE
          || event.getChangeType() == ChangeType.FIELD_ANNOTATION_REMOVE_CHANGE) {
        // TODO add filtering for the Label annotation class name.

        // use the annotationClassName
        List<ObjectProperty> props = dataObjectPropertiesProvider.getList();
        for (int i = 0; i < props.size(); i++) {
          if (event.getCurrentField() == props.get(i)) {
            dataObjectPropertiesTable.redrawRow(i);
            break;
          }
        }
      }
    }
  }