Exemple #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());
  }
  /**
   * @param key
   * @return
   */
  public String getResourceString(String key) {
    if (null != bundle) {
      return bundle.getString(key);
    }

    return "!" + key + "!";
  }