taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/ShowReferencingObjectsHandler.java -text
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java -text
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java -text
+taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/GroupEditorInput.java -text
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/NameEditorInput.java -text
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/NameRelationshipEditorInput.java -text
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/OccurrenceEditorInput.java -text
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/ReferenceEditorInput.java -text
+taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/UserEditorInput.java -text
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/AgentCreator.java -text
+taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/GroupCreator.java -text
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/NameCreator.java -text
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/OccurrenceCreator.java -text
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/ReferenceCreator.java -text
+taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/UserCreator.java -text
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/AbstractDateComparator.java -text
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/AbstractSortProvider.java -text
taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/sortprovider/CdmBaseSortProvider.java -text
taxeditor-store/p2.inf -text
taxeditor-store/plugin.xml -text
taxeditor-store/pom.xml -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/handler/CreateUserHandler.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/handler/EditUserHandler.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/handler/ToggleUserEnablementHandler.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/CreateUserOperation.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/DeleteUserOperation.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/EditUserOperation.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/operation/ToggleUserEnablementOperation.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/wizard/UserWizard.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/account/user/wizard/UserWizardPage.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/datasource/CdmDataSourceRepository.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/datasource/wizard/CdmDataSourceCredentialsWizardPage.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/datasource/wizard/CdmDataSourceH2WizardPage.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewCollectionWizard.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewDerivedUnitBaseWizard.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewFieldObservationWizard.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewGroupWizard.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewInstitutionWizard.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewNonViralNameWizard.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewPersonWizard.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/FeatureSelectionDialog.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/FeatureTreeSelectionDialog.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/FieldObservationSelectionDialog.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/GroupSelectionDialog.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/InstitutionSelectionDialog.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/NameSelectionDialog.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/NamedAreaSelectionDialog.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/TaxonBaseSelectionDialog.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/TaxonNodeSelectionDialog.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/TeamSelectionDialog.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/UserSelectionDialog.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/AbstractCdmEntityWizardPage.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/AbstractCdmFormElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/AbstractCdmFormElementWithErrors.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/TimePeriodElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/ToggleableTextElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/UriWithLabelElement.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/EditPasswordElement.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/PasswordWizard.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/PasswordWizardPage.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/openurl/IOpenUrlEnabled.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/openurl/OpenUrlContentProvider.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/openurl/OpenUrlLabelProvider.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/operation/ChangeDescriptionElementType.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureDistributionDetailElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureDistributionDetailSection.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GrantedAuthorityDetailElement.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GrantedAuthorityDetailSection.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailElement.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailSection.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/GroupDetailWizardPage.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/MemberDetailElement.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/group/MemberDetailSection.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/GeographicalScopeDetailSection.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyDetailElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyDetailSection.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/FeatureSelectionElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/FeatureTreeSelectionElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/FieldObservationSelectionElement.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/GroupSelectionElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/InstitutionSelectionElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/NameSelectionElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/NamedAreaSelectionElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/TaxonNodeSelectionElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/TaxonSelectionElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/TeamSelectionElement.java -text
+taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/UserSelectionElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/term/AbstractEnumComboElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/term/AbstractTermComboElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/ui/term/AnnotationTypeComboElement.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/detail/CdmSectionPart.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/group/GroupLabelProvider.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/group/GroupViewPart.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/reporting/ReportingViewPart.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java -text
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewer.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/user/UserContentProvider.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/user/UserLabelProvider.java -text
-taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/view/user/UserView.java -text
taxeditor-store/src/main/resources/eu/etaxonomy/cdm/editorApplicationContext.xml -text
taxeditor-store/src/main/resources/log4j.properties -text
taxeditor-store/src/test/java/eu/etaxonomy/taxeditor/store/CdmStoreTest.java -text
import org.eclipse.ui.progress.IProgressConstants;
import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
-import eu.etaxonomy.taxeditor.view.user.UserView;
/**
* @author n.hoffmann
folderAdditional.addPlaceholder(CdmDataSourceViewPart.ID);
folderAdditional.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
- folderAdditional.addPlaceholder(UserView.ID);
}
}
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.IAnnotatableEntity;
+import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.Marker;
import eu.etaxonomy.cdm.model.common.MarkerType;
*/
/** {@inheritDoc} */
public String getText(Object entity) {
- String text = null;
-
- if(entity instanceof IdentifiableEntity){
- IdentifiableEntity identifiableEntity = (IdentifiableEntity) HibernateProxyHelper.deproxy(entity);
- if(identifiableEntity instanceof TaxonNameBase){
- // TODO it is not very nice to do this here. Please refactor
- text = ((TaxonNameBase) identifiableEntity).getFullTitleCache();
- }else{
- text = identifiableEntity.getTitleCache();
- }
- }
-
- return text == null ? "" : text;
+ return editor.getEditorInput().getText((ICdmBase) entity);
}
import org.eclipse.ui.IEditorInput;
import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.model.name.NameRelationship;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.AgentEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.input.GroupEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.NameEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.NameRelationshipEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.OccurrenceEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.ReferenceEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.input.UserEditorInput;
/**
* <p>BulkEditorInputTypeValues class.</p>
REFERENCE("Reference", ReferenceEditorInput.ID),
NAME("Name", NameEditorInput.ID),
AGENT("Authors and Author Teams", AgentEditorInput.ID),
- OCCURRENCE("Specimen or Observations", OccurrenceEditorInput.ID),
- NAME_RELATIONSHIP("Name Relationship", NameRelationshipEditorInput.ID);
+ OCCURRENCE("Specimens or Observations", OccurrenceEditorInput.ID),
+ NAME_RELATIONSHIP("Name Relationship", NameRelationshipEditorInput.ID),
+ USER("User", UserEditorInput.ID),
+ GROUP("Group", GroupEditorInput.ID);
+
public String id;
public String label;
else if (NameRelationship.class.isAssignableFrom(clazz)){
return NAME_RELATIONSHIP;
}
+ else if (Group.class.isAssignableFrom(clazz)){
+ return GROUP;
+ }
+ else if (User.class.isAssignableFrom(clazz)){
+ return USER;
+ }
return null;
}
else if (input instanceof NameRelationshipEditorInput) {
return NAME_RELATIONSHIP;
}
+ else if(input instanceof UserEditorInput){
+ return USER;
+ }
+ else if(input instanceof GroupEditorInput){
+ return GROUP;
+ }
return null;
}
return new OccurrenceEditorInput();
case NAME_RELATIONSHIP:
return new NameRelationshipEditorInput();
+ case USER:
+ return new UserEditorInput();
+ case GROUP:
+ return new GroupEditorInput();
default:
- return null;
+ throw new IllegalStateException("No input class for the given input type defined.");
}
}
}
import eu.etaxonomy.cdm.api.service.ICommonService;
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.MarkerType;
return entity.getClass().getSimpleName();
}
+ /**
+ * @param entity
+ * @return
+ */
+ public String getText(T entity) {
+ if(entity instanceof IdentifiableEntity){
+ IdentifiableEntity identifiableEntity = (IdentifiableEntity) HibernateProxyHelper.deproxy(entity);
+
+ return identifiableEntity.getTitleCache();
+ }
+
+ return "No text. Implement in subclass";
+ }
+
/**
* @return
*/
public List<?> getModel() {
return model;
}
+
+
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.bulkeditor.input;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+import eu.etaxonomy.cdm.api.service.IGroupService;
+import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+import eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorInputTypeValues.BulkEditorInputType;
+import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.GroupCreator;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class GroupEditorInput extends AbstractBulkEditorInput<Group> {
+
+ public static final String ID = "bulkeditor.input.group";
+
+ private static GroupEditorInput instance;
+
+ /**
+ * @return the instance
+ */
+ public static GroupEditorInput getInstance() {
+ if(instance == null){
+ instance = new GroupEditorInput();
+ }
+ return instance;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getName()
+ */
+ @Override
+ public String getName() {
+ return BulkEditorInputType.GROUP.label;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getToolTipText()
+ */
+ @Override
+ public String getToolTipText() {
+ return getName();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object)
+ */
+ @Override
+ public boolean save(Group entity) {
+ return CdmStore.getService(IGroupService.class).saveOrUpdate(entity) != null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#delete(java.lang.Object)
+ */
+ @Override
+ public boolean delete(Group entity) {
+ return CdmStore.getService(IGroupService.class).delete(entity) != null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#listEntities(eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator)
+ */
+ @Override
+ protected List<Group> listEntities(
+ IIdentifiableEntityServiceConfigurator configurator) {
+ return CdmStore.getSearchManager().findGroups(configurator);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#loadEntity(java.util.UUID)
+ */
+ @Override
+ protected Group loadEntity(UUID entityUuid) {
+ List<String> propertyPaths = Arrays.asList(new String[]{});
+ return CdmStore.getService(IGroupService.class).load(entityUuid, propertyPaths);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#createEntityCreator()
+ */
+ @Override
+ protected IEntityCreator<Group> createEntityCreator() {
+ return new GroupCreator();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getText(eu.etaxonomy.cdm.model.common.ICdmBase)
+ */
+ @Override
+ public String getText(Group entity) {
+ return entity.getName();
+ }
+
+}
}
return super.getTypeText(entity);
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getText(eu.etaxonomy.cdm.model.common.ICdmBase)
+ */
+ @Override
+ public String getText(TaxonNameBase entity) {
+ return ((TaxonNameBase) entity).getFullTitleCache();
+ }
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.bulkeditor.input;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+import eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorInputTypeValues.BulkEditorInputType;
+import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.UserCreator;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class UserEditorInput extends AbstractBulkEditorInput<User> {
+
+ public static final String ID = "bulkeditor.input.user";
+
+ private static UserEditorInput instance;
+
+ /**
+ * @return the instance
+ */
+ public static UserEditorInput getInstance() {
+ if(instance == null){
+ instance = new UserEditorInput();
+ }
+ return instance;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getName()
+ */
+ @Override
+ public String getName() {
+ return BulkEditorInputType.USER.label;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getToolTipText()
+ */
+ @Override
+ public String getToolTipText() {
+ return getName();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object)
+ */
+ @Override
+ public boolean save(User entity) {
+ return CdmStore.getService(IUserService.class).saveOrUpdate(entity) != null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#delete(java.lang.Object)
+ */
+ @Override
+ public boolean delete(User entity) {
+ return CdmStore.getService(IUserService.class).delete(entity) != null;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#listEntities(eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator)
+ */
+ @Override
+ protected List<User> listEntities(
+ IIdentifiableEntityServiceConfigurator configurator) {
+ return CdmStore.getSearchManager().findUsers(configurator);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#loadEntity(java.util.UUID)
+ */
+ @Override
+ protected User loadEntity(UUID entityUuid) {
+ List<String> propertyPaths = Arrays.asList(new String[]{});
+ return CdmStore.getService(IUserService.class).load(entityUuid, propertyPaths);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#createEntityCreator()
+ */
+ @Override
+ protected IEntityCreator<User> createEntityCreator() {
+ return new UserCreator();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput#getText(eu.etaxonomy.cdm.model.common.ICdmBase)
+ */
+ @Override
+ public String getText(User entity) {
+ return String.format("%s, %s", entity.getUsername(), entity.getPerson());
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class GroupCreator implements IEntityCreator<Group> {
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.String)
+ */
+ @Override
+ public Group createEntity(String text) {
+ return createEntity(null, text);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.Object, java.lang.String)
+ */
+ @Override
+ public Group createEntity(Object key, String text) {
+ return Group.NewInstance(text);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#getKeyLabelPairs()
+ */
+ @Override
+ public Map<Object, String> getKeyLabelPairs() {
+ Map<Object, String> result = new HashMap<Object, String>();
+ result.put(Group.class, "Group");
+ return result;
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class UserCreator implements IEntityCreator<User>{
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.String)
+ */
+ @Override
+ public User createEntity(String text) {
+ return createEntity(null, text);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.Object, java.lang.String)
+ */
+ @Override
+ public User createEntity(Object key, String text) {
+ User user = User.NewInstance(text, text);
+ CdmStore.getService(IUserService.class).createUser(user);
+ return user;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#getKeyLabelPairs()
+ */
+ @Override
+ public Map<Object, String> getKeyLabelPairs() {
+ Map<Object, String> result = new HashMap<Object, String>();
+ result.put(User.class, "User");
+ return result;
+ }
+
+}
name="Datasource"
restorable="true">
</view>
- <view
- class="eu.etaxonomy.taxeditor.view.user.UserView"
- icon="icons/system-users.png"
- id="eu.etaxonomy.taxeditor.store.userManagerView"
- name="User"
- restorable="true">
- </view>
- <view
- class="eu.etaxonomy.taxeditor.view.group.GroupViewPart"
- id="eu.etaxonomy.taxeditor.store.groupView"
- name="Group"
- restorable="true">
- </view>
<view
name="Progress View"
category="org.eclipse.ui"
value="eu.etaxonomy.taxeditor.view.datasource">
</parameter>
</command>
- <command
- commandId="org.eclipse.ui.views.showView"
- label="Users"
- style="push">
- <parameter
- name="org.eclipse.ui.views.showView.viewId"
- value="eu.etaxonomy.taxeditor.store.userManagerView">
- </parameter>
- </command>
<command
commandId="org.eclipse.ui.views.showView"
label="Messages"
</reference>
</visibleWhen>
</command>
- <command
- commandId="org.eclipse.ui.views.showView"
- label="Groups"
- style="push">
- <parameter
- name="org.eclipse.ui.views.showView.viewId"
- value="eu.etaxonomy.taxeditor.store.groupView">
- </parameter>
- </command>
</menu>
</menuContribution>
<menuContribution
</visibleWhen>
</command>
</menuContribution>
- <menuContribution
- locationURI="popup:eu.etaxonomy.taxeditor.store.userManagerView">
- <command
- commandId="eu.etaxonomy.taxeditor.store.createUser"
- label="New"
- style="push">
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.store.editUser"
- label="Edit"
- style="push">
- </command>
- <separator
- name="eu.etaxonomy.taxeditor.store.userManager.separator"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.store.disableUser"
- label="Toggle Enablement"
- style="push">
- </command>
- </menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.ui.trim.status">
<toolbar
name="Update Datasource">
</command>
</extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- defaultHandler="eu.etaxonomy.taxeditor.account.user.handler.CreateUserHandler"
- id="eu.etaxonomy.taxeditor.store.createUser"
- name="Create User">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.account.user.handler.EditUserHandler"
- id="eu.etaxonomy.taxeditor.store.editUser"
- name="Edit User">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.account.user.handler.ToggleUserEnablementHandler"
- id="eu.etaxonomy.taxeditor.store.disableUser"
- name="Toggle User Enablement">
- </command>
- </extension>
<extension
point="org.eclipse.ui.importWizards">
<category
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.taxeditor.newWizard.NewUserWizard;
-import eu.etaxonomy.taxeditor.view.user.UserView;
-
-/**
- * <p>CreateUserHandler class.</p>
- *
- * @author n.hoffmann
- * @created 02.07.2009
- * @version 1.0
- */
-public class CreateUserHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- UserView part = (UserView) HandlerUtil.getActivePart(event);
-
- NewUserWizard wizard = new NewUserWizard();
- wizard.init(null, null);
-
- WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
- if(dialog.open() == IStatus.OK){
- part.getViewer().refresh();
- }
- return null;
- }
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.account.user.wizard.UserWizard;
-import eu.etaxonomy.taxeditor.view.user.UserView;
-
-/**
- * <p>EditUserHandler class.</p>
- *
- * @author n.hoffmann
- * @created 02.07.2009
- * @version 1.0
- */
-public class EditUserHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection menuSelection = HandlerUtil.getActiveMenuSelection(event);
- User user = (User) ((StructuredSelection) menuSelection).getFirstElement();
-
- UserView part = (UserView) HandlerUtil.getActivePart(event);
-
- UserWizard wizard = new UserWizard(part, user);
- WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
- dialog.open();
-
- return null;
- }
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.account.user.operation.ToggleUserEnablementOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.view.user.UserView;
-
-/**
- * <p>ToggleUserEnablementHandler class.</p>
- *
- * @author n.hoffmann
- * @created 02.07.2009
- * @version 1.0
- */
-public class ToggleUserEnablementHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- StructuredSelection menuSelection = (StructuredSelection) HandlerUtil.getActiveMenuSelection(event);
-
- for (Object object : menuSelection.toArray()){
-
- User user = (User) object;
-
- // TODO refresh the list -> set postOperationEnabled to the real deal
- UserView userManagerView = (UserView) HandlerUtil.getActivePart(event);
-
- AbstractPostOperation operation = null;
- try {
- operation = new ToggleUserEnablementOperation(event.getCommand().getName(),
- StoreUtil.getUndoContext(), user, userManagerView, userManagerView);
-
- StoreUtil.executeOperation(operation);
- } catch (NotDefinedException e) {
- StoreUtil.warn(this.getClass(), "Command name not set");
- }
- }
-
- return null;
- }
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.operation;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.api.service.IUserService;
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * <p>CreateUserOperation class.</p>
- *
- * @author n.hoffmann
- * @created Jan 19, 2010
- * @version 1.0
- */
-public class CreateUserOperation extends AbstractPersistentPostOperation {
-
- private User user;
-
- /**
- * <p>Constructor for CreateUserOperation.</p>
- *
- * @param label a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
- * @param user a {@link eu.etaxonomy.cdm.model.common.User} object.
- */
- public CreateUserOperation(String label, IUndoContext undoContext, User user,
- IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled);
- this.user = user;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- /** {@inheritDoc} */
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- bind();
- monitor.worked(20);
- CdmStore.getService(IUserService.class).createUser(user);
- monitor.worked(40);
-
- return postExecute(null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- /** {@inheritDoc} */
- @Override
- public IStatus redo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- /** {@inheritDoc} */
- @Override
- public IStatus undo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- return null;
- }
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.operation;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.api.service.IUserService;
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * @author n.hoffmann
- * @created Dec 2, 2010
- * @version 1.0
- */
-public class DeleteUserOperation extends AbstractPersistentPostOperation {
-
- private User user;
-
- /**
- * @param label
- * @param undoContext
- * @param postOperationEnabled
- * @param conversationEnabled
- */
- protected DeleteUserOperation(String label, IUndoContext undoContext,
- IPostOperationEnabled postOperationEnabled, User user,
- IConversationEnabled conversationEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled);
- this.user = user;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- bind();
- monitor.worked(20);
- CdmStore.getService(IUserService.class).delete(user);
- monitor.worked(40);
-
- return postExecute(null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- @Override
- public IStatus redo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- @Override
- public IStatus undo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- return null;
- }
-
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.operation;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.api.service.IUserService;
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * <p>EditUserOperation class.</p>
- *
- * @author n.hoffmann
- * @created Jan 25, 2010
- * @version 1.0
- */
-public class EditUserOperation extends AbstractPersistentPostOperation {
-
- private User user;
-
- /**
- * <p>Constructor for EditUserOperation.</p>
- *
- * @param label a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
- * @param user a {@link eu.etaxonomy.cdm.model.common.User} object.
- */
- public EditUserOperation(String label, IUndoContext undoContext, User user,
- IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled);
- this.user = user;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- /** {@inheritDoc} */
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- bind();
- monitor.worked(20);
-
- CdmStore.getService(IUserService.class).updateUser(user);
- monitor.worked(40);
-
- return postExecute(null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- /** {@inheritDoc} */
- @Override
- public IStatus redo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- /** {@inheritDoc} */
- @Override
- public IStatus undo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- return null;
- }
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.operation;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.api.service.IUserService;
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * <p>ToggleUserEnablementOperation class.</p>
- *
- * @author n.hoffmann
- * @created 02.07.2009
- * @version 1.0
- */
-public class ToggleUserEnablementOperation extends AbstractPersistentPostOperation {
-
- private User user;
-
- /**
- * <p>Constructor for ToggleUserEnablementOperation.</p>
- *
- * @param label a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- * @param user a {@link eu.etaxonomy.cdm.model.common.User} object.
- * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
- */
- public ToggleUserEnablementOperation(String label, IUndoContext undoContext,
- User user, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled);
- this.user = user;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- /** {@inheritDoc} */
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
-
- bind();
- monitor.worked(20);
-
- user.setEnabled(! user.isEnabled());
-
- CdmStore.getService(IUserService.class).saveOrUpdate(user);
- monitor.worked(40);
-
- return postExecute(null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- /** {@inheritDoc} */
- @Override
- public IStatus redo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- return execute(monitor, info);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
- /** {@inheritDoc} */
- @Override
- public IStatus undo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- bind();
- CdmStore.getService(IUserService.class).createUser(user);
- return postExecute(null);
- }
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.wizard;
-
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.wizard.Wizard;
-
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.account.user.operation.CreateUserOperation;
-import eu.etaxonomy.taxeditor.account.user.operation.EditUserOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.view.user.UserView;
-
-/**
- * <p>UserWizard class.</p>
- *
- * @author n.hoffmann
- * @created 02.07.2009
- * @version 1.0
- */
-public class UserWizard extends Wizard {
- private User user;
- private UserWizardPage page;
- private UserView view;
- private boolean createMode;
-
- /**
- * <p>Constructor for UserWizard.</p>
- *
- * @param view a {@link eu.etaxonomy.taxeditor.view.user.UserView} object.
- */
- public UserWizard(UserView view){
- this.view = view;
- setWindowTitle("User Wizard");
- createMode = true;
- }
-
- /**
- * <p>Constructor for UserWizard.</p>
- *
- * @param view a {@link eu.etaxonomy.taxeditor.view.user.UserView} object.
- * @param user a {@link eu.etaxonomy.cdm.model.common.User} object.
- */
- public UserWizard(UserView view, User user){
- this(view);
- if(user != null){
- this.user = user;
- createMode = false;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#addPages()
- */
- /** {@inheritDoc} */
- @Override
- public void addPages() {
- super.addPages();
-
- page = new UserWizardPage(user);
-
- addPage(page);
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
- /** {@inheritDoc} */
- @Override
- public boolean performFinish() {
-
- AbstractPostOperation operation;
- if(createMode){
- operation = new CreateUserOperation("Create User",
- StoreUtil.getUndoContext(), page.getUser(), view, view);
- }else{
- operation = new EditUserOperation("Edit User",
- StoreUtil.getUndoContext(), page.getUser(), view, view);
- }
-
- return StoreUtil.executeOperation(operation) == Status.OK_STATUS ? true : false;
- }
-
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.account.user.wizard;
-
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Text;
-
-import eu.etaxonomy.cdm.api.service.IUserService;
-import eu.etaxonomy.cdm.model.agent.Person;
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.model.CommonHelper;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * <p>UserWizardPage class.</p>
- *
- * @author n.hoffmann
- * @created 02.07.2009
- * @version 1.0
- */
-public class UserWizardPage extends WizardPage implements ModifyListener{
-
-// private static final Logger logger = Logger.getLogger(UserWizardPage.class);
-
- /** Constant <code>NAME="USER_WIZARD_PAGE"</code> */
- public static final String NAME = "USER_WIZARD_PAGE";
-
-
- private Composite composite;
- private Text text_username;
- private Text text_oldPassword;
- private Text text_password;
- private Text text_passwordRepeat;
- private User user;
- private boolean newMode = false;
- private Group group_person;
- private Text text_personFirstName;
- private Text text_personLastName;
- private Text text_userEmail;
-
- private IInputValidator uniqueUserNameValidator;
- private PasswordValidator passwordValidator;
-
- /**
- * <p>Constructor for UserWizardPage.</p>
- *
- * @param user a {@link eu.etaxonomy.cdm.model.common.User} object.
- */
- protected UserWizardPage(User user) {
- super(NAME);
-
- this.user = user;
-
- if(user == null){
- setTitle("Create new user");
- setDescription("Enter information for new user.");
- newMode = true;
- this.user = User.NewInstance(null, null);
- }else{
- setTitle("Edit existing user");
- setDescription("Edit information for the selected user.");
- }
-
- uniqueUserNameValidator = new UniqueUserNameValidator();
- passwordValidator = new PasswordValidator();
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- /** {@inheritDoc} */
- public void createControl(Composite parent) {
- // right - edit Form
- composite = new Composite(parent, SWT.NULL);
- GridLayout compositeLayout = new GridLayout();
- compositeLayout.numColumns = 2;
- composite.setLayout(compositeLayout);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- CLabel label_username = new CLabel(composite, SWT.NULL);
- label_username.setText("Username");
- text_username = new Text(composite, SWT.BORDER);
- text_username.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- text_username.addModifyListener(this);
-
- if(! newMode){
- text_username.setEnabled(false);
- }
-
- if(newMode){
- createPasswordFieldsNew(composite);
- setPageComplete(false);
- }else if(userIsAuthenticated()){
- createPasswordFieldsEdit(composite);
- setPageComplete(false);
- }
-
- group_person = createPersonGroup(composite);
- group_person.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
-
- setControl(composite);
-
-
-
- init();
- }
-
- /**
- * @return
- */
- private boolean userIsAuthenticated() {
- return user.equals(CdmStore.getLoginManager().getAuthenticatedUser());
- }
-
- private void createPasswordFieldsEdit(Composite parent){
- CLabel label_oldPassword = new CLabel(parent, SWT.NULL);
- label_oldPassword.setText("Old Password");
- text_oldPassword = new Text(parent, SWT.PASSWORD | SWT.BORDER);
- text_oldPassword.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- text_oldPassword.addModifyListener(this);
-
- createPasswordFieldsNew(parent);
- }
-
- private void createPasswordFieldsNew(Composite parent){
- CLabel label_password = new CLabel(parent, SWT.NULL);
- label_password.setText("Password");
-
- text_password = new Text(parent, SWT.PASSWORD | SWT.BORDER);
- text_password.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- text_password.addModifyListener(this);
-
- new CLabel(parent, SWT.NULL);
- text_passwordRepeat = new Text(parent, SWT.PASSWORD | SWT.BORDER);
- text_passwordRepeat.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- text_passwordRepeat.addModifyListener(this);
- }
-
- private Group createPersonGroup(Composite parent){
-
- Group group = new Group(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- group.setLayout(layout);
-
- CLabel label_personFirstName = new CLabel(group, SWT.NULL);
- label_personFirstName.setText("First Name");
- text_personFirstName = new Text(group, SWT.BORDER);
- text_personFirstName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- text_personFirstName.addModifyListener(this);
-
- CLabel label_personLastName = new CLabel(group, SWT.NULL);
- label_personLastName.setText("Last Name");
- text_personLastName = new Text(group, SWT.BORDER);
- text_personLastName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- text_personLastName.addModifyListener(this);
-
-
- CLabel label_userEmail = new CLabel(group, SWT.NULL);
- label_userEmail.setText("Email");
- text_userEmail = new Text(group, SWT.BORDER);
- text_userEmail.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- text_userEmail.addModifyListener(this);
-
- return group;
- }
-
- /**
- *
- */
- private void init() {
- CommonHelper.editTextWithoutTriggeringListeners(text_username, this, user.getUsername());
- if(user.getPerson() == null){
- user.setPerson(Person.NewInstance());
- }else{
- CommonHelper.editTextWithoutTriggeringListeners(text_personFirstName, this, user.getPerson().getFirstname());
- CommonHelper.editTextWithoutTriggeringListeners(text_personLastName, this, user.getPerson().getLastname());
- CommonHelper.editTextWithoutTriggeringListeners(text_userEmail, this, user.getEmailAddress());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- /** {@inheritDoc} */
- public void modifyText(ModifyEvent e) {
- if(newMode){
- user.setUsername(text_username.getText().trim());
- user.setPassword(text_password.getText());
- validate();
- }else if(userIsAuthenticated()){
- user.setPassword(text_password.getText());
- validate();
- }
- user.getPerson().setFirstname(text_personFirstName.getText());
- user.getPerson().setLastname(text_personLastName.getText());
- user.setEmailAddress(text_userEmail.getText());
- }
-
- /**
- * <p>Getter for the field <code>user</code>.</p>
- *
- * @return a {@link eu.etaxonomy.cdm.model.common.User} object.
- */
- public User getUser() {
- return user;
- }
-
- private void validate(){
- String message;
-
- if(!userIsAuthenticated()){
- if((message = uniqueUserNameValidator.isValid(text_username.getText())) != null){
- // pass
- }
- }else if((message = passwordValidator.isValid(text_password.getText())) != null){
- // pass
- }else if((message = passwordValidator.passwordsMatch(text_password.getText(), text_passwordRepeat.getText())) != null){
- // pass
- }
-
- setErrorMessage(message);
- }
-
- private class UniqueUserNameValidator implements IInputValidator{
-
- private static final String USER_EXISTS = "Username already exists";
- private static final String NAME_TO_SHORT = "Username is empty";
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
- */
- public String isValid(String newText) {
- // query for username
- if(newText.length() < 1){
- setPageComplete(false);
- return NAME_TO_SHORT;
- }
- if(CdmStore.getService(IUserService.class).userExists(newText)){
- setPageComplete(false);
- return USER_EXISTS;
- }
-
- setPageComplete(true);
- return null;
- }
- }
-
- private class PasswordValidator implements IInputValidator{
-
- private static final int PW_MIN_LENGTH = 5;
-
- private static final String TO_SHORT = "Password has to have at least " + PW_MIN_LENGTH + " characters";
- private static final String NO_MATCH = "The passwords do not match";
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
- */
- public String isValid(String newText) {
- if(newText.length() < PW_MIN_LENGTH){
- setPageComplete(false);
- return TO_SHORT;
- }
-
- setPageComplete(true);
- return null;
- }
-
- public String passwordsMatch(String password1, String password2){
-
- if(! password1.equals(password2)){
- setPageComplete(false);
- return NO_MATCH;
- }
-
- setPageComplete(true);
- return null;
- }
-
- }
-}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.newWizard;
+
+import eu.etaxonomy.cdm.api.service.IGroupService;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailWizardPage;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class NewGroupWizard extends AbstractNewEntityWizard<Group> {
+
+ private GroupDetailWizardPage groupPage;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ @Override
+ public void addPages() {
+ groupPage = new GroupDetailWizardPage(formFactory, getConversationHolder(), getEntity());
+ super.addPage(groupPage);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard#saveEntity()
+ */
+ @Override
+ protected void saveEntity() {
+ CdmStore.getService(IGroupService.class).saveOrUpdate(getEntity());
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard#createNewEntity()
+ */
+ @Override
+ protected Group createNewEntity() {
+ return Group.NewInstance();
+ }
+
+}
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
/**
* <p>LoginManager class.</p>
* @created 03.07.2009
* @version 1.0
*/
-public class LoginManager extends Observable{
+public class LoginManager extends Observable implements IConversationEnabled{
+
+ private ConversationHolder conversation;
/**
* <p>authenticate</p>
*/
public void authenticate(String username, String password){
try{
+ getConversationHolder().bind();
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
SecurityContextHolder.clearContext();
SecurityContextHolder.clearContext();
notifyObservers();
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
+ */
+ @Override
+ public void update(CdmDataChangeMap arg) {}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
+ */
+ @Override
+ public ConversationHolder getConversationHolder() {
+ if(conversation == null){
+ conversation = CdmStore.createConversation();
+ }
+ return conversation;
+ }
}
import java.util.List;
import eu.etaxonomy.cdm.api.service.IAgentService;
+import eu.etaxonomy.cdm.api.service.IGroupService;
import eu.etaxonomy.cdm.api.service.INameService;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.api.service.IReferenceService;
import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.api.service.IUserService;
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator;
import eu.etaxonomy.cdm.model.agent.AgentBase;
-import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
* @param configurator a {@link eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator} object.
* @return a {@link java.util.List} object.
*/
- public static List<TaxonNameBase> findNames(IIdentifiableEntityServiceConfigurator configurator){
+ public List<TaxonNameBase> findNames(IIdentifiableEntityServiceConfigurator configurator){
// TODO we want to use IIdentifiableEntityServiceConfigurator for all find methods
// unfortunately this is not consistently implemented in the library.
// FIXME use proper method once it is implemented in the library
* @param configurator a {@link eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator} object.
* @return a {@link java.util.List} object.
*/
- public static List<UuidAndTitleCache<TaxonBase>> findTaxaAndNames(ITaxonServiceConfigurator configurator){
+ public List<UuidAndTitleCache<TaxonBase>> findTaxaAndNames(ITaxonServiceConfigurator configurator){
return CdmStore.getService(ITaxonService.class).findTaxaAndNamesForEditor(configurator);
}
* @param configurator a {@link eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator} object.
* @return a {@link java.util.List} object.
*/
- public static List<Reference> findReferences(IIdentifiableEntityServiceConfigurator configurator){
+ public List<Reference> findReferences(IIdentifiableEntityServiceConfigurator configurator){
// TODO we want to use IIdentifiableEntityServiceConfigurator for all find methods
// unfortunately this is not consistently implemented in the library.
// FIXME use proper method once it is implemented in the library
* @param configurator a {@link eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator} object.
* @return a {@link java.util.List} object.
*/
- public static List<AgentBase> findAgents(IIdentifiableEntityServiceConfigurator configurator){
+ public List<AgentBase> findAgents(IIdentifiableEntityServiceConfigurator configurator){
// TODO we want to use IIdentifiableEntityServiceConfigurator for all find methods
// unfortunately this is not consistently implemented in the library.
// FIXME use proper method once it is implemented in the library
* @param configurator a {@link eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator} object.
* @return a {@link java.util.List} object.
*/
- public static List<AgentBase> findTeamOrPersons(IIdentifiableEntityServiceConfigurator configurator){
+ public List<AgentBase> findTeamOrPersons(IIdentifiableEntityServiceConfigurator configurator){
// TODO move this to cdmlib
List<AgentBase> result = new ArrayList<AgentBase>();
for (AgentBase agent : findAgents(configurator)) {
* @param configurator a {@link eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator} object.
* @return a {@link java.util.List} object.
*/
- public static List<SpecimenOrObservationBase> findOccurrences(IIdentifiableEntityServiceConfigurator configurator){
+ public List<SpecimenOrObservationBase> findOccurrences(IIdentifiableEntityServiceConfigurator configurator){
// TODO we want to use IIdentifiableEntityServiceConfigurator for all find methods
// unfortunately this is not consistently implemented in the library.
// FIXME use proper method once it is implemented in the library
return CdmStore.getService(IOccurrenceService.class).findByTitle(SpecimenOrObservationBase.class, titleSearchString, null, null, null, null, null, null).getRecords();
}
+
+ public List<User> findUsers(IIdentifiableEntityServiceConfigurator configurator){
+ String userNameSearchString = configurator.getTitleSearchString().replace("*", "%");
+
+ // FIXME there is no search at the moment, we will return all users for starters
+ return CdmStore.getService(IUserService.class).list(User.class, null, null, null, null);
+ }
+
+ public List<Group> findGroups(IIdentifiableEntityServiceConfigurator configurator){
+ String groupNameSearchString = configurator.getTitleSearchString().replace("*", "%");
+
+ // FIXME there is no search at the moment, we will return all users for starters
+ return CdmStore.getService(IGroupService.class).list(Group.class, null, null, null, null);
+ }
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.IGroupService;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
+import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
+import eu.etaxonomy.taxeditor.newWizard.NewGroupWizard;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class GroupSelectionDialog extends
+ AbstractFilteredCdmResourceSelectionDialog<Group> {
+
+ public static Group select(Shell shell, ConversationHolder conversation, Group group){
+ GroupSelectionDialog dialog = new GroupSelectionDialog(shell, conversation,
+ "Choose Group", false, GroupSelectionDialog.class.getCanonicalName(), group);
+ return getSelectionFromDialog(dialog);
+ }
+
+ /**
+ * @param shell
+ * @param conversation
+ * @param title
+ * @param multi
+ * @param settings
+ * @param cdmObject
+ */
+ protected GroupSelectionDialog(Shell shell,
+ ConversationHolder conversation, String title, boolean multi,
+ String settings, Group cdmObject) {
+ super(shell, conversation, title, multi, settings, cdmObject);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#initModel()
+ */
+ @Override
+ protected void initModel() {
+ List<Group> groups = CdmStore.getService(IGroupService.class).list(Group.class, null, null, null, null);
+
+ model = new ArrayList<UuidAndTitleCache<Group>>();
+
+ for(Group group : groups){
+ model.add(new UuidAndTitleCache<Group>(Group.class, group.getUuid(),String.format("%s", group.getName())));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardLinkText()
+ */
+ @Override
+ protected String getNewWizardLinkText() {
+ return "Create a new <A>Group</A>.";
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewEntityWizard(java.lang.String)
+ */
+ @Override
+ protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
+ return new NewGroupWizard();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
+ */
+ @Override
+ protected Group getPersistentObject(UUID uuid) {
+ return CdmStore.getService(IGroupService.class).load(uuid);
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
+import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
+import eu.etaxonomy.taxeditor.newWizard.NewUserWizard;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class UserSelectionDialog extends
+ AbstractFilteredCdmResourceSelectionDialog<User> {
+
+ /**
+ *
+ * @param shell
+ * @param conversation
+ * @param user
+ * @return
+ */
+ public static User select(Shell shell, ConversationHolder conversation, User user){
+ UserSelectionDialog dialog = new UserSelectionDialog(shell, conversation,
+ "Choose User", false, UserSelectionDialog.class.getCanonicalName(), user);
+ return getSelectionFromDialog(dialog);
+ }
+
+ /**
+ * @param shell
+ * @param conversation
+ * @param title
+ * @param multi
+ * @param settings
+ * @param cdmObject
+ */
+ protected UserSelectionDialog(Shell shell, ConversationHolder conversation,
+ String title, boolean multi, String settings, User cdmObject) {
+ super(shell, conversation, title, multi, settings, cdmObject);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#initModel()
+ */
+ @Override
+ protected void initModel() {
+ List<User> users = CdmStore.getService(IUserService.class).list(User.class, null, null, null, null);
+
+ model = new ArrayList<UuidAndTitleCache<User>>();
+
+ for(User user : users){
+ model.add(new UuidAndTitleCache<User>(User.class, user.getUuid(),String.format("%s, %s", user.getUsername(), user.getPerson())));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardLinkText()
+ */
+ @Override
+ protected String getNewWizardLinkText() {
+ return "Create a new <A>User</A>.";
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewEntityWizard(java.lang.String)
+ */
+ @Override
+ protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
+ return new NewUserWizard();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
+ */
+ @Override
+ protected User getPersistentObject(UUID uuid) {
+ return CdmStore.getService(IUserService.class).load(uuid);
+ }
+
+}
*/
public abstract AbstractCdmDetailElement<T> createElement(ICdmFormElement rootElement);
- private class WizardPageRootElement extends RootElement implements IConversationEnabled{
+ protected class WizardPageRootElement extends RootElement implements IConversationEnabled{
private ConversationHolder conversation;
@Override
public void dispose() {
super.dispose();
- detailElement.removeElements();
+ if(detailElement != null){
+ detailElement.removeElements();
+ }
}
/**
import org.eclipse.ui.forms.widgets.TableWrapLayout;
import org.eclipse.ui.internal.forms.widgets.FormFonts;
import org.joda.time.Partial;
+import org.springframework.security.core.GrantedAuthority;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.agent.Institution;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.cdm.model.common.DescriptionElementSource;
import eu.etaxonomy.cdm.model.common.Extension;
import eu.etaxonomy.cdm.model.common.ExtensionType;
+import eu.etaxonomy.cdm.model.common.Group;
import eu.etaxonomy.cdm.model.common.IAnnotatableEntity;
import eu.etaxonomy.cdm.model.common.ICdmBase;
-import eu.etaxonomy.cdm.model.common.IVersionableEntity;
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.common.LanguageString;
import eu.etaxonomy.cdm.model.common.Marker;
import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.cdm.model.common.TimePeriod;
+import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.model.common.VersionableEntity;
import eu.etaxonomy.cdm.model.description.CategoricalData;
import eu.etaxonomy.cdm.model.description.CommonTaxonName;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.forms.password.EditPasswordElement;
import eu.etaxonomy.taxeditor.ui.openurl.IOpenUrlEnabled;
import eu.etaxonomy.taxeditor.ui.openurl.OpenUrlSelectorElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.description.detail.TextDataDetailElement;
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailElement;
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.group.GrantedAuthorityDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.group.GrantedAuthorityDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
import eu.etaxonomy.taxeditor.ui.section.key.GeographicalScopeDetailSection;
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailElement;
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
import eu.etaxonomy.taxeditor.ui.selection.FeatureSelectionElement;
import eu.etaxonomy.taxeditor.ui.selection.FeatureTreeSelectionElement;
import eu.etaxonomy.taxeditor.ui.selection.FieldObservationSelectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.GroupSelectionElement;
import eu.etaxonomy.taxeditor.ui.selection.InstitutionSelectionElement;
import eu.etaxonomy.taxeditor.ui.selection.NameSelectionElement;
import eu.etaxonomy.taxeditor.ui.selection.NamedAreaSelectionElement;
import eu.etaxonomy.taxeditor.ui.selection.TaxonNodeSelectionElement;
import eu.etaxonomy.taxeditor.ui.selection.TaxonSelectionElement;
import eu.etaxonomy.taxeditor.ui.selection.TeamSelectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.UserSelectionElement;
import eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement;
import eu.etaxonomy.taxeditor.ui.term.AbstractTermComboElement;
import eu.etaxonomy.taxeditor.ui.term.AnnotationTypeComboElement;
return element;
}
+ /**
+ *
+ * @param parentElement
+ * @param labelString
+ * @param conversationEnabled
+ * @param user
+ * @param style
+ * @return
+ */
+ public EditPasswordElement createEditPasswordElement(ICdmFormElement parentElement, String labelString,
+ ConversationHolder conversation, User user, int style){
+ EditPasswordElement element = new EditPasswordElement(this, parentElement, labelString, user, conversation);
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
+
/**
* <p>createIntegerTextWithLabelElement</p>
*
COLLECTION,
FEATURE,
POLYTOMOUS_KEY,
- POLYTOMOUS_KEY_NODE
+ POLYTOMOUS_KEY_NODE,
+ USER,
+ GROUP
}
/**
INSTITUTION,
DERIVED_UNIT_GENERAL,
HYBRID,
- USER,
- GROUPS_BY_USER
+ USER,
+ GROUP
}
/**
case USER:
section = new UserDetailSection(this, conversation, parentElement, selectionProvider, style);
break;
- case GROUPS_BY_USER:
- section = new GroupsByUserDetailSection(this, conversation, parentElement, selectionProvider, style);
+ case GROUP:
+ section = new GroupDetailSection(this, conversation, parentElement, selectionProvider, style);
break;
}
case USER:
element = new UserDetailElement(this, parentElement);
break;
- case GROUPS_BY_USER:
- element = new GroupsByUserDetailElement(this, parentElement);
+ case GROUP:
+ element = new GroupDetailElement(this, parentElement);
break;
}
SPECIMEN_COLLECTION,
IDENTIFIABLE_SOURCE_COLLECTION,
GEOGRAPHICAL_SCOPE,
- SCOPE_RESTRICTION
+ SCOPE_RESTRICTION,
+ MEMBER,
+ GRANTED_AUTHORITY,
+ GROUPS_BY_USER
}
/**
case SCOPE_RESTRICTION:
section = new ScopeRestrictionSection(this, conversation, parentElement, style);
break;
+ case MEMBER:
+ section = new MemberDetailSection(this, conversation, parentElement, style);
+ break;
+ case GRANTED_AUTHORITY:
+ section = new GrantedAuthorityDetailSection(this, conversation, parentElement, style);
+ break;
+ case GROUPS_BY_USER:
+ section = new GroupsByUserDetailSection(this, conversation, parentElement, style);
+ break;
}
parentElement.addElement(section);
adapt(section);
* @param backgroundColor a {@link org.eclipse.swt.graphics.Color} object.
* @return a {@link eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement} object.
*/
- public AbstractEntityCollectionElement createEntityCollectionElement(AbstractFormSection parentElement, IVersionableEntity versionableEntity, SelectionListener removeListener, Color backgroundColor, int style){
+ public AbstractEntityCollectionElement createEntityCollectionElement(AbstractFormSection parentElement, Object versionableEntity, SelectionListener removeListener, Color backgroundColor, int style){
AbstractEntityCollectionElement element = null;
- VersionableEntity entity = (VersionableEntity) HibernateProxyHelper.deproxy(versionableEntity);
+ Object entity = HibernateProxyHelper.deproxy(versionableEntity);
if(entity instanceof Annotation){
element = new AnnotationElement(this, parentElement, (Annotation) entity, removeListener, style);
else if(entity instanceof Specimen){
element = new SpecimenCollectionDetailElement(this, parentElement, (Specimen) entity, removeListener, style);
}
-
+ else if(entity instanceof User){
+ element = new MemberDetailElement(this, parentElement, (User) entity, removeListener, style);
+ }
+ else if(entity instanceof GrantedAuthority){
+ element = new GrantedAuthorityDetailElement(this, parentElement, (GrantedAuthority) entity, removeListener, style);
+ }
+ else if(entity instanceof Group){
+ element = new GroupsByUserDetailElement(this, parentElement, (Group) entity, removeListener, style);
+ }
else if(entity instanceof DescriptionElementBase){
// this is the special case for protologs, maybe we can do this differently when API improves
DescriptionElementBase descriptionElement = (DescriptionElementBase) entity;
case POLYTOMOUS_KEY_NODE:
element = new PolytomousKeyNodeSelectionElement(this, conversation, parentElement, labelString, (PolytomousKeyNode) entity, style);
break;
+ case USER:
+ element = new UserSelectionElement(this, conversation, parentElement, labelString, (User) entity, style);
+ break;
+ case GROUP:
+ element = new GroupSelectionElement(this, conversation, parentElement, labelString, (Group) entity, style);
+ break;
default:
new RuntimeException("There is no selection composite for the desired selection type.");
break;
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.forms.password;
+
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Label;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.ui.forms.AbstractCdmFormElement;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class EditPasswordElement extends AbstractCdmFormElement implements SelectionListener, IConversationEnabled{
+
+ private User user;
+ private Button button;
+
+ private ConversationHolder conversation;
+
+ /**
+ * @param formFactory
+ * @param formElement
+ */
+ public EditPasswordElement(CdmFormFactory formFactory,
+ ICdmFormElement formElement, String labelString, User user, ConversationHolder conversation) {
+ super(formFactory, formElement);
+
+ this.conversation = conversation;
+
+ Label label = formFactory.createLabel(getLayoutComposite(), null);
+ addControl(label);
+
+ String buttonLabelString = (labelString != null) ? labelString : "Change Password";
+
+ button = formFactory.createButton(getLayoutComposite(), buttonLabelString, SWT.PUSH);
+ button.setLayoutData(CdmFormFactory.RIGHT());
+ addControl(button);
+
+ button.addSelectionListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.forms.ISelectable#setSelected(boolean)
+ */
+ @Override
+ public void setSelected(boolean selected) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ PasswordWizard wizard = new PasswordWizard(conversation, user);
+ WizardDialog dialog = new WizardDialog(getLayoutComposite().getShell(), wizard);
+
+ dialog.open();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
+ */
+ @Override
+ public void update(CdmDataChangeMap arg0) {}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
+ */
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return conversation;
+ }
+
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.forms.password;
+
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Display;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class PasswordWizard extends Wizard implements IConversationEnabled{
+
+ private PasswordWizardPage passwordPage;
+ private User user;
+ private ConversationHolder conversation;
+
+ public PasswordWizard(ConversationHolder conversation, User user){
+ this.conversation = conversation;
+ this.user = user;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ @Override
+ public void addPages() {
+ CdmFormFactory formFactory = new CdmFormFactory(Display.getDefault());
+ passwordPage = new PasswordWizardPage(formFactory, getConversationHolder(), user);
+ super.addPage(passwordPage);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+ ConversationHolder internalConversation = CdmStore.getLoginManager().getConversationHolder();
+ internalConversation.bind();
+ CdmStore.getService(IUserService.class).changePassword(passwordPage.getOldPassword(), passwordPage.getNewPassword());
+ internalConversation.commit();
+ conversation.bind();
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
+ */
+ @Override
+ public void update(CdmDataChangeMap arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
+ */
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return conversation;
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.forms.password;
+
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ * <p>UserWizardPage class.</p>
+ *
+ * @author n.hoffmann
+ * @created 02.07.2009
+ * @version 1.0
+ */
+public class PasswordWizardPage extends AbstractCdmEntityWizardPage<User> implements ModifyListener{
+
+ /** Constant <code>NAME="USER_WIZARD_PAGE"</code> */
+ public static final String NAME = "USER_WIZARD_PAGE";
+
+ private TextWithLabelElement text_oldPassword;
+ private TextWithLabelElement text_password;
+ private TextWithLabelElement text_passwordRepeat;
+ private PasswordValidator passwordValidator;
+
+ /**
+ * @param formFactory
+ * @param conversation
+ * @param entity
+ */
+ protected PasswordWizardPage(CdmFormFactory formFactory,
+ ConversationHolder conversation, User entity) {
+ super(formFactory, conversation, entity);
+
+ passwordValidator = new PasswordValidator();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+ Composite control = formFactory.createComposite(parent);
+ control.setLayoutData(CdmFormFactory.FILL());
+
+ setPageComplete(false);
+
+ control.setLayout(CdmFormFactory.LAYOUT(2, false));
+ WizardPageRootElement rootElement = new WizardPageRootElement(formFactory, control, getConversationHolder());
+
+ text_oldPassword = formFactory.createTextWithLabelElement(rootElement, "Old Password", null, SWT.PASSWORD);
+
+ text_password = formFactory.createTextWithLabelElement(rootElement, "New Password", null, SWT.PASSWORD);
+ text_passwordRepeat = formFactory.createTextWithLabelElement(rootElement, "Repeat Password", null, SWT.PASSWORD);
+
+ ((Text)text_passwordRepeat.getMainControl()).addModifyListener(this);
+
+ setControl(control);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement)
+ */
+ @Override
+ public AbstractCdmDetailElement<User> createElement(
+ ICdmFormElement rootElement) {
+ // not used
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ /** {@inheritDoc} */
+ public void modifyText(ModifyEvent e) {
+ validate();
+ }
+
+ private void validate(){
+ String message;
+
+ if((message = passwordValidator.passwordsMatch(text_password.getText(), text_passwordRepeat.getText())) != null){
+ // pass
+ }
+ else if((message = passwordValidator.isValid(text_password.getText())) != null){
+ // pass
+ }
+
+ setErrorMessage(message);
+ }
+
+ private class UniqueUserNameValidator implements IInputValidator{
+
+ private static final String USER_EXISTS = "Username already exists";
+ private static final String NAME_TO_SHORT = "Username is empty";
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
+ */
+ public String isValid(String newText) {
+ // query for username
+ if(newText.length() < 1){
+ setPageComplete(false);
+ return NAME_TO_SHORT;
+ }
+ if(CdmStore.getService(IUserService.class).userExists(newText)){
+ setPageComplete(false);
+ return USER_EXISTS;
+ }
+
+ setPageComplete(true);
+ return null;
+ }
+ }
+
+ private class PasswordValidator implements IInputValidator{
+
+ private static final int PW_MIN_LENGTH = 5;
+
+ private static final String TO_SHORT = "Password has to have at least " + PW_MIN_LENGTH + " characters";
+ private static final String NO_MATCH = "The passwords do not match";
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
+ */
+ public String isValid(String newText) {
+ if(newText.length() < PW_MIN_LENGTH){
+ setPageComplete(false);
+ return TO_SHORT;
+ }
+
+ setPageComplete(true);
+ return null;
+ }
+
+ public String passwordsMatch(String password1, String password2){
+
+ if(! password1.equals(password2)){
+ setPageComplete(false);
+ return NO_MATCH;
+ }
+
+ setPageComplete(true);
+ return null;
+ }
+
+ }
+
+ /**
+ * @return
+ */
+ public String getOldPassword() {
+ return text_oldPassword.getText();
+ }
+
+ /**
+ * @return
+ */
+ public String getNewPassword() {
+ return text_password.getText();
+ }
+}
* @author n.hoffmann
* @version $Id: $
*/
-public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT extends IVersionableEntity> extends AbstractFormSection<ENTITY> implements IExpansionListener{
+public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends AbstractFormSection<ENTITY> implements IExpansionListener{
protected Composite container;
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.group;
+
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.springframework.security.core.GrantedAuthority;
+
+import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class GrantedAuthorityDetailElement extends AbstractEntityCollectionElement<GrantedAuthority> {
+
+ /**
+ * @param formFactory
+ * @param section
+ * @param entity
+ * @param removeListener
+ * @param backgroundColor
+ * @param style
+ */
+ public GrantedAuthorityDetailElement(CdmFormFactory formFactory,
+ AbstractFormSection section, GrantedAuthority entity,
+ SelectionListener removeListener, int style) {
+ super(formFactory, section, entity, removeListener, null, style);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#setEntity(java.lang.Object)
+ */
+ @Override
+ public void setEntity(GrantedAuthority entity) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, int)
+ */
+ @Override
+ public void createControls(ICdmFormElement element, int style) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
+ */
+ @Override
+ public void handleEvent(Object eventSource) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.group;
+
+import java.util.Collection;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.springframework.security.core.GrantedAuthority;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class GrantedAuthorityDetailSection extends AbstractEntityCollectionSection<Group, GrantedAuthority> {
+
+ /**
+ * @param formFactory
+ * @param conversation
+ * @param parentElement
+ * @param title
+ * @param style
+ */
+ public GrantedAuthorityDetailSection(CdmFormFactory formFactory,
+ ConversationHolder conversation, ICdmFormElement parentElement,
+ int style) {
+ super(formFactory, conversation, parentElement, "Granted Authorities", style);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
+ */
+ @Override
+ public Collection<GrantedAuthority> getCollection(Group entity) {
+ return entity.getGrantedAuthorities();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
+ */
+ @Override
+ public GrantedAuthority createNewElement() {
+ GrantedAuthority selection = null; // TODO GrantedAuthoritySelectionDialog.select(...);
+ return selection;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(java.lang.Object)
+ */
+ @Override
+ public void addElement(GrantedAuthority element) {
+ getEntity().addGrantedAuthority(element);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(java.lang.Object)
+ */
+ @Override
+ public void removeElement(GrantedAuthority element) {
+ getEntity().removeGrantedAuthority(element);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
+ */
+ @Override
+ public String getEmptyString() {
+ return "No Granted Athorities yet.";
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
+ */
+ @Override
+ protected String getTooltipString() {
+ return "Add a Granted Authority";
+ }
+
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.group;
+
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class GroupDetailElement extends AbstractCdmDetailElement<Group> {
+
+ private TextWithLabelElement text_name;
+
+ /**
+ * @param formFactory
+ * @param formElement
+ */
+ public GroupDetailElement(CdmFormFactory formFactory,
+ ICdmFormElement formElement) {
+ super(formFactory, formElement);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, java.lang.Object, int)
+ */
+ @Override
+ protected void createControls(ICdmFormElement formElement, Group entity,
+ int style) {
+ text_name = formFactory.createTextWithLabelElement(formElement, "Name", entity.getName(), style);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
+ */
+ @Override
+ public void handleEvent(Object eventSource) {
+ if(eventSource == text_name){
+ getEntity().setName(text_name.getText());
+ }
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.group;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class GroupDetailSection extends AbstractCdmDetailSection<Group> {
+
+ /**
+ * @param formFactory
+ * @param conversation
+ * @param parentElement
+ * @param selectionProvider
+ * @param style
+ */
+ public GroupDetailSection(CdmFormFactory formFactory,
+ ConversationHolder conversation, ICdmFormElement parentElement,
+ ISelectionProvider selectionProvider, int style) {
+ super(formFactory, conversation, parentElement, selectionProvider, style);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getDetailType()
+ */
+ @Override
+ protected DetailType getDetailType() {
+ return DetailType.GROUP;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading()
+ */
+ @Override
+ public String getHeading() {
+ return "Group " + (getEntity() != null ? getEntity().getName() : "");
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.group;
+
+import org.eclipse.swt.SWT;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class GroupDetailWizardPage extends AbstractCdmEntityWizardPage<Group>{
+
+ /**
+ * @param formFactory
+ * @param conversation
+ * @param entity
+ */
+ public GroupDetailWizardPage(CdmFormFactory formFactory,
+ ConversationHolder conversation, Group entity) {
+ super(formFactory, conversation, entity);
+ setTitle("Group");
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement)
+ */
+ @Override
+ public AbstractCdmDetailElement<Group> createElement(
+ ICdmFormElement rootElement) {
+ GroupDetailElement groupElement = (GroupDetailElement) formFactory.createCdmDetailElement(DetailType.GROUP, rootElement, SWT.NULL);
+ return groupElement;
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.group;
+
+import org.eclipse.swt.events.SelectionListener;
+
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.UserSelectionElement;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class MemberDetailElement extends AbstractEntityCollectionElement<User> {
+
+ private UserSelectionElement selection_user;
+
+ /**
+ * @param formFactory
+ * @param section
+ * @param entity
+ * @param removeListener
+ * @param backgroundColor
+ * @param style
+ */
+ public MemberDetailElement(CdmFormFactory formFactory,
+ AbstractFormSection section, User entity,
+ SelectionListener removeListener, int style) {
+ super(formFactory, section, entity, removeListener, null, style);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#setEntity(java.lang.Object)
+ */
+ @Override
+ public void setEntity(User entity) {
+ selection_user.setEntity(entity);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, int)
+ */
+ @Override
+ public void createControls(ICdmFormElement element, int style) {
+ selection_user = (UserSelectionElement) formFactory.createSelectionElement(SelectionType.USER, getConversationHolder(), element, "Member", entity, style);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
+ */
+ @Override
+ public void handleEvent(Object eventSource) {
+ if(eventSource == selection_user){
+ setEntity(selection_user.getEntity());
+ }
+ }
+
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.group;
+
+import java.util.Collection;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.UserSelectionDialog;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 9, 2011
+ * @version 1.0
+ */
+public class MemberDetailSection extends AbstractEntityCollectionSection<Group, User> {
+
+ /**
+ * @param formFactory
+ * @param conversation
+ * @param parentElement
+ * @param title
+ * @param style
+ */
+ public MemberDetailSection(CdmFormFactory formFactory,
+ ConversationHolder conversation, ICdmFormElement parentElement,
+ int style) {
+ super(formFactory, conversation, parentElement, "Members", style);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
+ */
+ @Override
+ public Collection<User> getCollection(Group entity) {
+ return entity.getMembers();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
+ */
+ @Override
+ public User createNewElement() {
+ User selection = UserSelectionDialog.select(getLayoutComposite().getShell(), getConversationHolder(), null);
+ return selection;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
+ */
+ @Override
+ public void addElement(User element) {
+ getEntity().addMember(element);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
+ */
+ @Override
+ public void removeElement(User element) {
+ getEntity().removeMember(element);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
+ */
+ @Override
+ public String getEmptyString() {
+ return "No members yet.";
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
+ */
+ @Override
+ protected String getTooltipString() {
+ return "Add a memeber to this group";
+ }
+
+
+
+}
package eu.etaxonomy.taxeditor.ui.section.user;
-import eu.etaxonomy.cdm.model.common.User;
+import org.eclipse.swt.events.SelectionListener;
+
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType;
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.GroupSelectionElement;
-public class GroupsByUserDetailElement extends AbstractCdmDetailElement<User> {
+/**
+ *
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class GroupsByUserDetailElement extends AbstractEntityCollectionElement<Group> {
+ private GroupSelectionElement selection_group;
+
+ /**
+ * @param formFactory
+ * @param section
+ * @param entity
+ * @param removeListener
+ * @param backgroundColor
+ * @param style
+ */
public GroupsByUserDetailElement(CdmFormFactory formFactory,
- ICdmFormElement formElement) {
- super(formFactory, formElement);
+ AbstractFormSection section, Group entity,
+ SelectionListener removeListener, int style) {
+ super(formFactory, section, entity, removeListener, null, style);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#setEntity(java.lang.Object)
+ */
@Override
- protected void createControls(ICdmFormElement formElement, User entity,
- int style) {
-
-
+ public void setEntity(Group entity) {
+ selection_group.setEntity(entity);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, int)
+ */
@Override
- public void handleEvent(Object eventSource) {
-
+ public void createControls(ICdmFormElement element, int style) {
+ selection_group = (GroupSelectionElement) formFactory.createSelectionElement(SelectionType.GROUP, getConversationHolder(), element, "Group", getEntity(), style);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
+ */
+ @Override
+ public void handleEvent(Object eventSource) {
+ if(eventSource == selection_group){
+
+ }
+ }
}
*/
package eu.etaxonomy.taxeditor.ui.section.user;
-import org.eclipse.jface.viewers.ISelectionProvider;
+import java.util.Collection;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.Group;
import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.GroupSelectionDialog;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
* @author n.hoffmann
*
*/
-public class GroupsByUserDetailSection extends AbstractCdmDetailSection<User> {
+public class GroupsByUserDetailSection extends AbstractEntityCollectionSection<User, Group> {
+ /**
+ * @param formFactory
+ * @param conversation
+ * @param parentElement
+ * @param title
+ * @param style
+ */
public GroupsByUserDetailSection(CdmFormFactory formFactory,
ConversationHolder conversation, ICdmFormElement parentElement,
- ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ int style) {
+ super(formFactory, conversation, parentElement, "Groups", style);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
+ */
@Override
- protected DetailType getDetailType() {
- return DetailType.GROUPS_BY_USER;
+ public Collection<Group> getCollection(User entity) {
+ return entity.getGroups();
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
+ */
@Override
- public String getHeading() {
- return "Groups";
+ public Group createNewElement() {
+ Group selectedGroup = GroupSelectionDialog.select(getShell(), getConversationHolder(), null);
+ return selectedGroup;
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(java.lang.Object)
+ */
+ @Override
+ public void addElement(Group element) {
+ element.addMember(getEntity());
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(java.lang.Object)
+ */
+ @Override
+ public void removeElement(Group element) {
+ element.removeMember(getEntity());
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
+ */
+ @Override
+ public String getEmptyString() {
+ return "No groups yet.";
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
+ */
+ @Override
+ protected String getTooltipString() {
+ return "Add this user to a group";
+ }
}
*/
package eu.etaxonomy.taxeditor.ui.section.user;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+
+import eu.etaxonomy.cdm.api.service.IUserService;
import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType;
import eu.etaxonomy.taxeditor.ui.forms.CheckboxElement;
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.forms.TextActionElement;
import eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.forms.password.EditPasswordElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.PersonSelectionElement;
public class UserDetailElement extends AbstractCdmDetailElement<User> {
private TextWithLabelElement text_username;
- private TextWithLabelElement text_password;
- private TextWithLabelElement text_passwordRepeat;
+ private EditPasswordElement element_editPassword;
private TextWithLabelElement text_emailAdress;
private PersonSelectionElement selection_person;
private CheckboxElement checkbox_credentialsNonExpired;
int style) {
text_username = formFactory.createTextWithLabelElement(formElement, "Username", entity.getUsername(), style);
+ if(userIsAuthenticated()){
+ element_editPassword = formFactory.createEditPasswordElement(formElement, "Change Password", getConversationHolder(), entity, style);
+ }
+
text_emailAdress = formFactory.createTextWithLabelElement(formElement, "Email Adress", entity.getEmailAddress(), style);
selection_person = (PersonSelectionElement) formFactory.createSelectionElement(SelectionType.PERSON, getConversationHolder(), formElement, "Person", entity.getPerson(), style);
checkbox_credentialsNonExpired = formFactory.createCheckbox(formElement, "Credentials Non Expired", entity.isCredentialsNonExpired(), style);
}
+ /**
+ *
+ * @return
+ */
+ private boolean userIsAuthenticated() {
+ return getEntity().equals(CdmStore.getLoginManager().getAuthenticatedUser());
+ }
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
*/
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.selection;
+
+import org.eclipse.swt.events.SelectionEvent;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.GroupSelectionDialog;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class GroupSelectionElement extends AbstractSelectionElement<Group> {
+
+ /**
+ * @param formFactory
+ * @param conversation
+ * @param parentElement
+ * @param labelString
+ * @param entity
+ * @param isEditable
+ * @param isSelectable
+ * @param isDeletable
+ * @param style
+ */
+ public GroupSelectionElement(CdmFormFactory formFactory,
+ ConversationHolder conversation, ICdmFormElement parentElement,
+ String labelString, Group entity, int style) {
+ super(formFactory, conversation, parentElement, labelString, entity,
+ false, false, false, style);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Group newSelection = GroupSelectionDialog.select(getShell(), getConversationHolder(), getEntity());
+ setSelectionInternal(newSelection);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement#getTitle()
+ */
+ @Override
+ protected String getTitle() {
+ return (getEntity() != null) ? getEntity().getName() : "UNTITLED GROUP";
+ }
+
+}
* @version 1.0
*/
public class NamedAreaSelectionElement extends AbstractSelectionElement<NamedArea> {
-
-
-
- private static final Logger logger = Logger
- .getLogger(NamedAreaSelectionElement.class);
/**
* <p>Constructor for NamedAreaSelectionElement.</p>
ICdmFormElement parentElement, String labelString,
NamedArea entity, int style) {
super(formFactory, conversation, parentElement, labelString, entity,
- false, false, true, style);
+ false, false, false, style);
}
/** {@inheritDoc} */
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.selection;
+
+import org.eclipse.swt.events.SelectionEvent;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.UserSelectionDialog;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 10, 2011
+ * @version 1.0
+ */
+public class UserSelectionElement extends AbstractSelectionElement<User> {
+
+ /**
+ * @param formFactory
+ * @param conversation
+ * @param parentElement
+ * @param labelString
+ * @param entity
+ * @param isEditable
+ * @param isSelectable
+ * @param isDeletable
+ * @param style
+ */
+ public UserSelectionElement(CdmFormFactory formFactory,
+ ConversationHolder conversation, ICdmFormElement parentElement,
+ String labelString, User entity, int style) {
+ super(formFactory, conversation, parentElement, labelString, entity,
+ false, false, false, style);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ User newSelection = UserSelectionDialog.select(getShell(), getConversationHolder(), entity);
+ setSelectionInternal(newSelection);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement#getTitle()
+ */
+ @Override
+ protected String getTitle() {
+ return (entity != null) ? entity.getUsername() : "NO USER";
+ }
+}
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.cdm.model.agent.Team;
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
+import eu.etaxonomy.cdm.model.common.Group;
import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.ui.forms.RootElement;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EntityDetailType;
+import eu.etaxonomy.taxeditor.ui.forms.RootElement;
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.group.GrantedAuthorityDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
import eu.etaxonomy.taxeditor.ui.section.key.GeographicalScopeDetailSection;
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
FEATURE_DISTRIBUTION,
POLYTOMOUS_KEY,
POLYTOMOUS_KEY_NODE,
- USER
+ USER,
+ GROUP
}
private VIEW_PART currentViewPart;
createPolytomousKeyNodeSection(rootElement);
currentViewPart = VIEW_PART.POLYTOMOUS_KEY_NODE;
}
- }else if(getInput() instanceof User){
+ }
+ else if(getInput() instanceof User){
if(currentViewPart != VIEW_PART.USER){
createUserSection(rootElement);
currentViewPart = VIEW_PART.USER;
}
- }else{
+ }
+ else if(getInput() instanceof Group){
+ if(currentViewPart != VIEW_PART.GROUP){
+ createGroupSection(rootElement);
+ currentViewPart = VIEW_PART.GROUP;
+ }
+ }
+ else{
destroySections();
currentViewPart = VIEW_PART.EMPTY;
}
layout();
}
+ /**
+ * @param rootElement
+ */
+ private void createGroupSection(RootElement parent) {
+ destroySections();
+
+ GroupDetailSection groupDetailSection = (GroupDetailSection)
+ formFactory.createCdmDetailSection(DetailType.GROUP, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED);
+ MemberDetailSection memberDetailSection = (MemberDetailSection)
+ formFactory.createEntityDetailSection(EntityDetailType.MEMBER, getConversationHolder(), parent, Section.TWISTIE | Section.EXPANDED);
+ GrantedAuthorityDetailSection grantedAuthorityDetailSection = (GrantedAuthorityDetailSection)
+ formFactory.createEntityDetailSection(EntityDetailType.GRANTED_AUTHORITY, getConversationHolder(), parent, Section.TWISTIE | Section.EXPANDED);
+
+ addPart(groupDetailSection);
+ addPart(memberDetailSection);
+ addPart(grantedAuthorityDetailSection);
+ }
+
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.Viewer#getSelection()
*/
UserDetailSection userDetailSection = (UserDetailSection)
formFactory.createCdmDetailSection(DetailType.USER, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED);
- GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection) formFactory.createCdmDetailSection(DetailType.GROUPS_BY_USER, getConversationHolder(), parent, this, Section.TWISTIE | Section.EXPANDED);
+ GroupsByUserDetailSection groupByUserDetailSection = (GroupsByUserDetailSection)
+ formFactory.createEntityDetailSection(EntityDetailType.GROUPS_BY_USER, getConversationHolder(), parent, Section.TWISTIE | Section.EXPANDED);
addPart(userDetailSection);
addPart(groupByUserDetailSection);
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.group;
-
-import org.eclipse.jface.viewers.LabelProvider;
-
-import eu.etaxonomy.cdm.model.common.Group;
-
-/**
- * @author n.hoffmann
- * @created Feb 16, 2011
- * @version 1.0
- */
-public class GroupLabelProvider extends LabelProvider {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
- */
- @Override
- public String getText(Object element) {
- if(element instanceof Group){
-
- return ((Group) element).getName();
-
- }
- return super.getText(element);
- }
-
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.group;
-
-import java.util.Collection;
-
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbenchPart;
-
-import eu.etaxonomy.cdm.api.service.IUserService;
-import eu.etaxonomy.cdm.model.common.Group;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.view.AbstractAccountViewPart;
-
-/**
- * @author n.hoffmann
- * @created Feb 16, 2011
- * @version 1.0
- */
-public class GroupViewPart extends AbstractAccountViewPart<Group>{
-
- public static String ID = "eu.etaxonomy.taxeditor.store.groupView";
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.account.AbstractAccountView#getInput()
- */
- @Override
- public Collection<String> getInput() {
- return CdmStore.getService(IUserService.class).findAllGroups();
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.account.AbstractAccountView#getLabelProvider()
- */
- @Override
- protected IBaseLabelProvider getLabelProvider() {
- return new GroupLabelProvider();
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.account.AbstractAccountView#createColumns(org.eclipse.jface.viewers.TableViewer)
- */
- @Override
- protected void createColumns(TableViewer viewer) {
- }
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.user;
-
-import java.util.List;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-import eu.etaxonomy.cdm.model.common.User;
-
-/**
- * <p>UserManagerContentProvider class.</p>
- *
- * @author n.hoffmann
- * @created 01.07.2009
- * @version 1.0
- */
-public class UserContentProvider implements IStructuredContentProvider {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- /**
- * <p>dispose</p>
- */
- public void dispose() {
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- /** {@inheritDoc} */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- /** {@inheritDoc} */
- public Object[] getElements(Object inputElement) {
- List<User> users = (List<User>) inputElement;
- return users.toArray();
- }
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.user;
-
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-import eu.etaxonomy.cdm.model.agent.Person;
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * <p>UserManagerLabelProvider class.</p>
- *
- * @author n.hoffmann
- * @created 01.07.2009
- * @version 1.0
- */
-public class UserLabelProvider extends LabelProvider implements ITableLabelProvider {
-
- /** {@inheritDoc} */
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- /** {@inheritDoc} */
- public String getColumnText(Object element, int columnIndex) {
- User user = (User) element;
-
- User authenticatedUser = CdmStore.getLoginManager().getAuthenticatedUser();
-
- switch(columnIndex){
- case 0:
- return user.equals(authenticatedUser) ? "*" : "";
- case 1:
- return user.getUsername();
- case 2:
- return user.isEnabled() ? "Yes" : "No";
- case 3:
- return user.isAccountNonLocked() ? "No" : "Yes";
- case 4:
- Person person = user.getPerson();
- if (person != null){
- return person.getTitleCache();
- }
- case 5:
- return user.getEmailAddress();
-
- }
-
- return "-";
- }
-
-}
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.view.user;
-
-import java.util.List;
-
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Table;
-
-import eu.etaxonomy.cdm.api.service.IUserService;
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.view.AbstractAccountViewPart;
-
-/**
- * <p>UserManagerView class.</p>
- *
- * @author n.hoffmann
- * @created 01.07.2009
- * @version 1.0
- */
-public class UserView extends AbstractAccountViewPart<User>{
-
-
- /** Constant <code>ID="eu.etaxonomy.taxeditor.store.userManage"{trunked}</code> */
- public static String ID = "eu.etaxonomy.taxeditor.store.userManagerView";
-
- // This will create the columns for the table
- protected void createColumns(TableViewer viewer) {
- Table table = viewer.getTable();
- String[] titles = {"Active", "Name", "Enabled", "Locked", "Person", "Email"};
- int[] bounds = { 20, 200, 50, 50, 200, 100};
-
- for (int i = 0; i < titles.length; i++) {
- TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
- column.getColumn().setText(titles[i]);
- column.getColumn().setWidth(bounds[i]);
- column.getColumn().setResizable(true);
- column.getColumn().setMoveable(true);
- }
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- }
-
-
- /**
- *
- * @return
- */
- public List<User> getInput(){
- return CdmStore.getService(IUserService.class).list(null, null, null, null, null);
- }
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.account.AbstractAccountView#getLabelProvider()
- */
- @Override
- protected IBaseLabelProvider getLabelProvider() {
- return new UserLabelProvider();
- }
-
-}