Beispiel #1
0
  /**
   * Search for editor extensions and initialize them.
   *
   * @param id editor entity id
   */
  private void createExtensions(Long id) {

    // Step 1 - find and instantiate extensions...
    String entityType = context.getEntityDescriptor().getId();
    List<Object> extensionObjs =
        EditorExtensionUtils.getExtensions(EXTENSION_POINT_EDITOR_EXT, entityType);
    for (Object extObj : extensionObjs) {
      if (extObj instanceof IEntityEditorExtension) {
        IEntityEditorExtension extension = (IEntityEditorExtension) extObj;
        extensions.add(extension);
      } else {
        log.error(
            "EntityEditorExtension for entity "
                + entityType
                + " does not implement IEntityEditorExtension interface.");
      }
    }

    // Step 2 - initialize extensions
    for (IEntityEditorExtension extension : extensions) {
      extension.initialize(context, editor);
      extension.addActions(toolbar);
    }

    List<ICustomEntityActionCreator> tabExtensions =
        EditorExtensionUtils.getExtensions("entityEditorActions", entityType);
    for (ICustomEntityActionCreator entityActionCreator : tabExtensions) {
      toolbar
          .addGroup()
          .addAction(
              entityActionCreator.createAction(
                  ExtendedApplication.getInstance(this).getSite(), entityType, String.valueOf(id)));
    }
  }
Beispiel #2
0
 @Override
 public void modelContentChanged(EditorModelEvent event) {
   if (EditorModelEvent.CLOSE_REQUEST == event.getEventType()) {
     // someone wants to close this
     Site site = ExtendedApplication.getInstance(this).getSite();
     site.popPage(this);
   }
 }
  /* (non-Javadoc)
   * @see de.jwic.base.Control#actionPerformed(java.lang.String, java.lang.String)
   */
  @Override
  public void actionPerformed(String actionId, String parameter) {
    if ("undoChanges".equalsIgnoreCase(actionId)) {

      tableModel.getUserConfigHandler().updateRelatedConfig(true);
      onCancel(); // to close the window

    } else if ("saveCurrent".equalsIgnoreCase(actionId)) {

      tableModel.getUserConfigHandler().updateRelatedConfig(false);
      onCancel(); // to close the window

    } else if ("saveNew".equalsIgnoreCase(actionId)) {

      final IUserViewConfiguration uvc =
          tableModel.getUserConfigHandler().createConfigWithCurrentSettings();
      UserViewConfigurationControl ctrl = createUserConfigControl(uvc, true);
      ctrl.actionEdit();

      ctrl.addListener(
          new IUserViewConfigurationControlListener() {
            @Override
            public void onConfigDeleted(Event event) {}

            @Override
            public void onConfigApplied(Event event) {}

            @Override
            public void onConfigUpdated(Event event) {
              // if it's a new config created from current settings, we need to apply it after it's
              // saved, to make it the main one
              tableModel.getUserConfigHandler().applyConfig(uvc);
            }
          });
    } else if ("loadProfile".equalsIgnoreCase(actionId)) {
      // to prevent opening the dialog multiple times
      if (loadProfileWindow != null) {
        return;
      }

      loadProfileWindow =
          new LoadProfileWindow(ExtendedApplication.getInstance(this).getSite(), tableModel);
      loadProfileWindow.addDialogWindowListener(
          new DialogWindowAdapter() {
            @Override
            public void onDialogAborted(DialogEvent event) {
              loadProfileWindow = null;
            }
          });
      loadProfileWindow.show();
    }
  }
Beispiel #4
0
  protected void closeEditor() {

    Site site = ExtendedApplication.getInstance(this).getSite();
    site.popPage(this);
  }