Example #1
0
  /**
   * @param container
   * @param name
   * @throws EditorConfigurationException
   */
  public EntityEditorPage(
      IControlContainer container, String name, IEntity entity, EditorConfiguration editorConfig)
      throws EditorConfigurationException {
    super(container, name);

    String title;
    if (entity.getId() == 0) { // new entity
      String entityType = entity.type().getName();
      try {
        EntityDescriptor descriptor =
            ConfigurationManager.getSetup().getEntityDescriptor(entityType);
        Bundle bundle =
            descriptor.getDomain().getBundle(getSessionContext().getLocale().getLanguage());
        title = "New " + bundle.getString(entityType) + "*";
      } catch (ConfigurationException ce) {
        log.warn("Error retrieving bundle string for entity", ce);
        title = "Editor";
      }
    } else {
      DAO<? extends IEntity> dao = DAOSystem.findDAOforEntity(entity.type());
      title = dao.buildTitle(entity);
    }

    setTitle(title);

    createActions();
    createToolbar();
    createContent(entity, editorConfig);

    createExtensions(entity.getId());
  }
Example #2
0
  /** @return */
  public List<IEntity> getSelectedHistoryEntities() {
    List<IEntity> entities = new ArrayList<IEntity>();
    DAO dao = DAOSystem.findDAOforEntity(baseEntity.type());
    List<IEntity> history = dao.getHistory(baseEntity);

    for (IEntity entity : history) {
      for (Object obj : getSelectedHisKeys()) {
        int id = Integer.parseInt(obj.toString());
        if (entity.getId() == id) {
          entities.add(entity);
          break;
        }
      }
    }

    return entities;
  }
Example #3
0
 /* (non-Javadoc)
  * @see de.jwic.entitytools.file.uc.IAttachmentWrapper#setEntity(de.jwic.entitytools.base.IEntity)
  */
 public void setEntity(IEntity entity) {
   this.entity = entity;
   this.entityId = entity.getId();
   this.entityType = entity.type().getName();
 }
Example #4
0
 /* (non-Javadoc)
  * @see de.jwic.entitytools.file.uc.IAttachmentWrapper#getEntity()
  */
 public int getEntityId() {
   return entity != null ? entity.getId() : entityId;
 }