Ejemplo n.º 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)));
    }
  }
Ejemplo n.º 2
0
  private void createToolbar() {

    toolbar = new ToolBar(this, "toolbar");
    ToolBarGroup grpDefault = toolbar.addGroup();

    grpDefault.addAction(actionClose);
    grpDefault.addAction(actionSaveClose);
    grpDefault.addAction(actionSave);
    grpDefault.addAction(actionEdit);
  }
Ejemplo n.º 3
0
  /** Setup the ActionBar. */
  private void setupActionBar() {
    ToolBar abar = new ToolBar(this, "actionBar");
    ToolBarGroup group = abar.addGroup();
    Button btReturn = group.addButton();
    btReturn.setIconEnabled(ImageLibrary.IMAGE_RETURN);
    btReturn.setTitle("Return");
    btReturn.setConfirmMsg("Changes will get lost!");
    btReturn.addSelectionListener(
        new SelectionListener() {
          public void objectSelected(SelectionEvent event) {
            close();
          }
        });

    btSave = group.addButton();
    btSave.setIconEnabled(ImageLibrary.IMAGE_TABLE_SAVE);
    btSave.setTitle("Save & Close");
    btSave.addSelectionListener(
        new SelectionListener() {
          public void objectSelected(SelectionEvent event) {
            onSaveAndClose();
          }
        });

    Button btAdd = group.addButton();
    btAdd.setTitle("Create Element");
    btAdd.setIconEnabled(ImageLibrary.IMAGE_ADD);
    btAdd.addSelectionListener(
        new SelectionListener() {
          public void objectSelected(SelectionEvent event) {
            mapEditor.createNewElement();
          }
        });

    Button btSortEx = group.addButton();
    btSortEx.setTitle("Sort By Expression");
    btSortEx.setIconEnabled(ImageLibrary.IMAGE_REFRESH);
    btSortEx.addSelectionListener(
        new SelectionListener() {
          public void objectSelected(SelectionEvent event) {
            onSortMappings(true);
          }
        });

    Button btSortPath = group.addButton();
    btSortPath.setTitle("Sort By Element");
    btSortPath.setIconEnabled(ImageLibrary.IMAGE_REFRESH);
    btSortPath.addSelectionListener(
        new SelectionListener() {
          public void objectSelected(SelectionEvent event) {
            onSortMappings(false);
          }
        });

    Button btDeleteAll = group.addButton();
    btDeleteAll.setTitle("Delete All");
    btDeleteAll.setConfirmMsg("Do you really want to delete ALL mapping entries?");
    btDeleteAll.setIconEnabled(ImageLibrary.IMAGE_SCRIPT_DELETE);
    btDeleteAll.addSelectionListener(
        new SelectionListener() {
          public void objectSelected(SelectionEvent event) {
            onDeleteAll();
          }
        });
  }