/** * @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()); }
/** @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; }
/* (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(); }
/* (non-Javadoc) * @see de.jwic.entitytools.file.uc.IAttachmentWrapper#getEntity() */ public int getEntityId() { return entity != null ? entity.getId() : entityId; }