eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/operation/CreateNodeOperation.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/operation/DeleteNodeOperation.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/operation/RefreshNodeNumberingOperation.java -text
-eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractGroup.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractGroupedContainer.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractHomotypicalGroupContainer.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvNameExportWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvPrintExportWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/DarwinCoreArchiveExportWizard.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/EndnoteImportWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExcelNormalExplicitTaxaImportWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExportToFileDestinationWizardPage.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/GenericConfiguratorWizardPage.java -text
eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/api/cache/CdmClientCachingTest.xml -text
eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/cdm.datasources.xml -text
eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/PolytomousKeyTest.xml -text
-eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNameEditorTest.xml -text
eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/model/TaxonNavigatorTest.xml -text
eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/cdm/testRemotingApplicationContext.xml -text
eu.etaxonomy.taxeditor.test/src/main/resources/eu/etaxonomy/taxeditor/lazyloading/AbstractLazyInitializerTest.xml -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/api/cache/CdmClientCachingTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/api/cache/CdmModelGetMethodCacherTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/PolytomousKeyTest.java -text
-eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNameEditorTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/cdm/model/TaxonNavigatorTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/application/menu/general/NewMenuTest.java -text
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/BaseRemotingTest.java -text
eu.etaxonomy.taxeditor.cdmlib/lib/spring-expression-4.*.jar
eu.etaxonomy.taxeditor.cdmlib/lib/spring-jdbc-4.*.jar
eu.etaxonomy.taxeditor.cdmlib/lib/spring-oxm-4.*.jar
+eu.etaxonomy.taxeditor.cdmlib/lib/spring-orm-4.*.jar
eu.etaxonomy.taxeditor.cdmlib/lib/spring-security-core-4.*.jar
eu.etaxonomy.taxeditor.cdmlib/lib/spring-test-4.*.jar
eu.etaxonomy.taxeditor.cdmlib/lib/spring-tx-4.*.jar
eu.etaxonomy.taxeditor.cdmlib/lib/poi-ooxml-schemas-4.*.jar
eu.etaxonomy.taxeditor.cdmlib/lib/commons-collections-3.*.jar
eu.etaxonomy.taxeditor.cdmlib/lib/commons-collections4-4.*.jar
+eu.etaxonomy.taxeditor.cdmlib/lib/commons-beanutils-1.*.jar
+eu.etaxonomy.taxeditor.cdmlib/lib/json-lib-2.*.jar
eu.etaxonomy.taxeditor.cdmlib/lib/commons-math3-3.*.jar
eu.etaxonomy.taxeditor.cdmlib/lib/jaxb-api-2.*.jar
eu.etaxonomy.taxeditor.cdmlib/lib/javax.activation-api-1.*.jar
eu.etaxonomy.taxeditor.cdmlib/lib/hibernate-core-5.*.Final.jar
eu.etaxonomy.taxeditor.cdmlib/lib/hibernate-entitymanager-5.*.Final.jar
eu.etaxonomy.taxeditor.cdmlib/lib/hibernate-envers-5.*.Final.jar
+eu.etaxonomy.taxeditor.cdmlib/lib/hibernate-search-engine-5.*.jar
eu.etaxonomy.taxeditor.cdmlib/lib/antlr-2.*.jar
eu.etaxonomy.taxeditor.cdmlib/lib/cglib-nodep-3.*.jar
eu.etaxonomy.taxeditor.cdmlib/lib/ehcache-2.*.jar
Bundle-ManifestVersion: 2
Bundle-Name: Application
Bundle-SymbolicName: eu.etaxonomy.taxeditor.application;singleton:=true
-Bundle-Version: 5.34.0
+Bundle-Version: 5.42.0
Bundle-Activator: eu.etaxonomy.taxeditor.TaxonomicEditorPlugin
Bundle-Vendor: EDIT
Bundle-Localization: OSGI-INF/l10n/plugin
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.34.0</version>
+ <version>5.42.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
import org.springframework.remoting.RemoteAccessException;
import org.springframework.remoting.RemoteConnectFailureException;
-import eu.etaxonomy.cdm.database.PermissionDeniedException;
+import eu.etaxonomy.cdm.persistence.permission.PermissionDeniedException;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmAuthenticationException;
else if (t instanceof NoHttpResponseException
|| t.getCause() instanceof CdmAuthenticationException
|| (t.getMessage() != null && t.getMessage().contains("status code = 403"))){
+ t.printStackTrace();
MessagingUtils.informationDialog("Access denied", MessagingUtils.ACCESS_DENIED);
}else if (includesCause(t, OptionalDataException.class)){
MessagingUtils.informationDialog("Error (OptionalDataException)",
}
/**
- * analyzes whether the
+ * Analyzes whether the throwable includes an exception of type clazz
+ * in the stacktrace.
*/
private <T extends Exception> boolean includesCause(Throwable t, Class<? extends Throwable> clazz) {
boolean result = false;
-// $Id$
/**
* Copyright (C) 2017 EDIT
* European Distributed Institute of Taxonomy
.getActiveWorkbenchWindow();
if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowChecklistPerspective.getKey())){
-
IPerspectiveRegistry registry = workbench.getPerspectiveRegistry();
IWorkbenchPage page = window.getActivePage();
page.setPerspective(registry.findPerspectiveWithId("eu.etaxonomy.taxeditor.perspective.checklistperspective"));
EditorUtil.setMediaVisible(false);
}else{
-
IPerspectiveRegistry registry = workbench.getPerspectiveRegistry();
IWorkbenchPage page = window.getActivePage();
page.setPerspective(registry.findPerspectiveWithId("eu.etaxonomy.taxeditor.application.perspective.taxonomic"));
hideParts();
PreferencesUtil.checkNomenclaturalCode();
-
}
- /**
- * {@inheritDoc}
- */
@Override
public void contextRefresh(IProgressMonitor monitor) {
}
- /**
- * {@inheritDoc}
- */
@Override
public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
}
-
-}
+}
\ No newline at end of file
package eu.etaxonomy.taxeditor;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.eclipse.equinox.p2.operations.ProvisioningSession;
* @author n.hoffmann
*/
public class TaxonomicEditorPlugin extends AbstractUIPlugin {
-
- private static final Logger logger = LogManager.getLogger(TaxonomicEditorPlugin.class);
+
+ private static final Logger logger = LogManager.getLogger();
// The plug-in ID
/** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.application"</code> */
if (ui == null) {
ServiceReference<?> reference = bundleContext.getServiceReference(IProvisioningAgent.SERVICE_NAME);
IProvisioningAgent agent = (IProvisioningAgent) bundleContext.getService(reference);
-
+
session = new ProvisioningSession(agent);
-
+
Policy policy = null;// = (Policy) ServiceHelper.getService(ProvUIActivator.getContext(), Policy.class.getName());
if (policy == null) {
policy = new Policy();
-
+
}
ui = new ProvisioningUI(session, IProfileRegistry.SELF, policy);
}
protected static final String DETAILS_VIEW = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_E4_DETAILS_DETAILSPARTE4;
protected static final String SUPPLEMENTAL_VIEW = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_E4_SUPPLEMENTALDATA_SUPPLEMENTALDATAPARTE4;
protected static final String NAVIGATOR = eu.etaxonomy.taxeditor.navigation.AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR;
- protected static final String NAME_EDITOR = eu.etaxonomy.taxeditor.editor.AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_TAXONNAMEEDITORE4;
+ protected static final String NAME_EDITOR = eu.etaxonomy.taxeditor.editor.AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_TAXONEDITOR;
protected static final String FACTUAL_DATA_VIEW = eu.etaxonomy.taxeditor.editor.AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_FACTUALDATAPARTE4;
protected static final String MEDIA_VIEW = eu.etaxonomy.taxeditor.editor.AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_E4_MEDIAVIEWPARTE4;
protected static final String SEARCH_RESULTS = eu.etaxonomy.taxeditor.navigation.AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_SEARCH_E4_SEARCHRESULTVIEWE4;
Bundle-ManifestVersion: 2
Bundle-Name: Bulkeditor Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.bulkeditor;singleton:=true
-Bundle-Version: 5.34.0
+Bundle-Version: 5.42.0
Bundle-Activator: eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin
Bundle-Vendor: EDIT
Export-Package: eu.etaxonomy.taxeditor.annotatedlineeditor,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.34.0</version>
+ <version>5.42.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
}
bulkEditor.getEditorInput().getModel().add(createdEntity);
if (createdEntity instanceof CdmBase){
- if (!((CdmBase)createdEntity).isPersited()){
+ if (!((CdmBase)createdEntity).isPersisted()){
bulkEditor.getEditorInput().addSaveCandidate((CdmBase)createdEntity);
bulkEditor.setDirty();
}
import eu.etaxonomy.taxeditor.bulkeditor.input.GroupEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.MediaEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.OccurrenceEditorInput;
-import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonBulkEditorInput;
/**
* @author p.ciardelli
return bulkEditor.getEditorInput() instanceof OccurrenceEditorInput;
}
else if(IS_TAXON_EDITOR.equals(property)){
- return bulkEditor.getEditorInput() instanceof TaxonEditorInput;
+ return bulkEditor.getEditorInput() instanceof TaxonBulkEditorInput;
}
else if(IS_MEDIA_EDITOR.equals(property)){
return bulkEditor.getEditorInput() instanceof MediaEditorInput;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorQuery;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.GroupEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.MediaEditorInput;
-import eu.etaxonomy.taxeditor.bulkeditor.input.NameEditorInput;
-import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonBulkEditorInput;
import eu.etaxonomy.taxeditor.editor.IBulkEditor;
import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
* @author pplitzner
* @since Sep 8, 2017
*/
-public class BulkEditor implements IPartContentHasDetails, IConversationEnabled, IPostOperationEnabled,
+public class BulkEditor implements IPartContentHasDetails, IPostOperationEnabled,
IDirtyMarkable, IDerivedUnitFacadePart, IPartContentHasFactualData,
IPartContentHasSupplementalData, IPartContentHasMedia, IE4SavablePart, ITaxonEditor, IBulkEditor {
private AbstractBulkEditorInput input;
- private ConversationHolder conversation;
-
@Inject
private IEventBroker eventBroker;
private BulkEditorQuery lastQuery = null;
private BulkEditorComposite bulkEditorComposite;
-
+
private Set<AbstractPostOperation> operations = new HashSet<>();
@Inject
public void init(AbstractBulkEditorInput<?> input){
this.input = input;
- this.conversation = input.getConversation();
thisPart.setLabel(input.getEditorName());
bulkEditorComposite.init(input);
String operationlabel = entry.getLabel();
try {
entry.addContext(IOperationHistory.GLOBAL_UNDO_CONTEXT);
-
+
status = entry.execute(new NullProgressMonitor(), uiInfoAdapter);
} catch (ExecutionException e) {
MessagingUtils.operationDialog(AbstractUtility.class, e, TaxeditorStorePlugin.PLUGIN_ID, operationlabel, null);
}
input.saveModel(resetMerge);
-// IStructuredSelection selection = getSelection();
-
dirty.setDirty(false);
input.dispose();
input.bind();
- conversation.commit(true);
if (lastQuery != null){
bulkEditorComposite.performSearch(lastQuery, selection);
}
-
+
}
return new StructuredSelection(this.bulkEditorComposite.getLastSelectedObject());
}
- @Focus
+ @Override
+ @Focus
public void setFocus() {
//make sure to bind again if maybe in another view the conversation was unbound
- if(conversation!=null && !conversation.isBound()){
- conversation.bind();
- }
+
if(input!=null && input.getCdmEntitySession()!= null) {
input.getCdmEntitySession().bind();
}
@PreDestroy
public void dispose() {
- if(conversation!=null){
- conversation.unregisterForDataStoreChanges(this);
- conversation.close();
- }
if(input!=null){
input.dispose();
}
return bulkEditorComposite.getCellSelection();
}
+ @Override
public void setSelection(IStructuredSelection selection){
bulkEditorComposite.setSelection(selection);
}
bulkEditorComposite.copyDataToClipboard();
}
- @Override
- public void update(CdmDataChangeMap arg0) {
- }
-
@Override
public boolean canAttachMedia() {
return true;
if (element instanceof DescriptionBase){
if (element instanceof TaxonNameDescription){
TaxonName changedName = ((TaxonNameDescription)element).getTaxonName();
- if (getEditorInput() instanceof TaxonEditorInput){
+ if (getEditorInput() instanceof TaxonBulkEditorInput){
IStructuredSelection sel = getSelection();
Object firstElement = sel.getFirstElement();
if (firstElement instanceof TaxonBase){
if (((DescriptionElementBase)element).getInDescription() instanceof TaxonNameDescription){
TaxonName changedName = ((TaxonNameDescription)((DescriptionElementBase)element).getInDescription()).getTaxonName();
//check whether the bulk editor is taxon or name bulk editor
- if (getEditorInput() instanceof TaxonEditorInput){
+ if (getEditorInput() instanceof TaxonBulkEditorInput){
IStructuredSelection sel = getSelection();
Object firstElement = sel.getFirstElement();
if (firstElement instanceof TaxonBase){
}else if (element instanceof Media && input instanceof MediaEditorInput){
getEditorInput().addSaveCandidate((Media)element);
input.replaceInModel((Media)element);
- }else if (element instanceof Media ) {
+ }else if (element instanceof Media ) {
IStructuredSelection sel = getSelection();
Object firstElement = sel.getFirstElement();
if (firstElement instanceof TaxonBase){
SpecimenOrObservationBase changedSpecimen = (SpecimenOrObservationBase)sel.getFirstElement();
getEditorInput().addSaveCandidate(changedSpecimen);
input.replaceInModel(changedSpecimen);
- }
+ }
}else if(element instanceof Group){
Group oldGroup = ((GroupEditorInput)input).getEntityFromModel((Group)element);
((GroupEditorInput)input).getSaveUserCandidates().addAll(oldGroup.getMembers());
getEditorInput().addSaveCandidate((Group)element);
input.replaceInModel((CdmBase) element);
- }else if(element instanceof TaxonName && input instanceof TaxonEditorInput){
+ }else if(element instanceof TaxonName && input instanceof TaxonBulkEditorInput){
IStructuredSelection sel = this.getSelection();
TaxonBase taxonBase = null;
if (sel.getFirstElement() instanceof TaxonBase){
getEditorInput().addSaveCandidate(taxon);
input.replaceInModel(taxon);
}
-
+
}
else{
getEditorInput().addSaveCandidate((CdmBase)element);
return false;
}
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
+
public BulkEditorQuery getLastQuery() {
return lastQuery;
@Inject
@Optional
private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_NAME_EDITOR) List<CdmBase> cdmBases) {
- if (getEditorInput() instanceof TaxonEditorInput){
+ if (getEditorInput() instanceof TaxonBulkEditorInput){
for (CdmBase cdmBase: cdmBases){
if (getEditorInput().getModel().contains(cdmBase)){
input.performSearch(lastQuery, getSelection());
Set<CdmBase> removeFromSelection = new HashSet();
for(selection.iterator();iterator.hasNext();){
CdmBase cdmBase = (CdmBase) iterator.next();
- if (!cdmBase.isPersited()){
+ if (!cdmBase.isPersisted()){
editor.getEditorInput().getModel().remove(cdmBase);
editor.getEditorInput().getSaveCandidates().remove(cdmBase);
removeFromSelection.add(cdmBase);
iterator = selection.iterator();
for(selection.iterator();iterator.hasNext();){
CdmBase cdmBase = (CdmBase) iterator.next();
- if (cdmBase.isPersited()){
+ if (cdmBase.isPersisted()){
delete(cdmBase, shell, editor);
}
}
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
-import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonBulkEditorInput;
import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
public class OpenBulkEditorForTaxonNodeHandler extends DefaultOpenHandlerBaseE4<ITaxonTreeNode, TaxonNodeDto> {
@Override
protected void open(TaxonNodeDto entity, Shell shell, EPartService partService) {
- AbstractBulkEditorInput<?> input = TaxonEditorInput.getInstance();
+ AbstractBulkEditorInput<?> input = TaxonBulkEditorInput.getInstance();
input.setEntityUuid(entity.getTaxonUuid());
BulkEditorUtil.openBulkEditor(input, modelService, partService, application);
}
import org.eclipse.jface.viewers.IStructuredSelection;
import ca.odell.glazedlists.BasicEventList;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
private HashMap<T, Set<T>> mergedEntities = new HashMap<>();
private IEntityCreator<T> entityCreator;
- private final ConversationHolder conversation;
+
private Job searchJob;
public AbstractBulkEditorInput() {
super(true);
- this.conversation = CdmStore.createConversation();
+
}
static public AbstractBulkEditorInput<?> NewInstance(BulkEditorInputType inputType) {
}
//-> continue with standard search
- int pageSize = configurator.getPageSize()!=null?configurator.getPageSize():getPageSize();
+ int pageSize = configurator.getPageSize() != null ? configurator.getPageSize():getPageSize();
configurator.setPageSize(pageSize);
long count = countEntities(configurator);
int totalWork = count>Integer.MAX_VALUE?Integer.MAX_VALUE:(int)count;
return null;
}
- public ConversationHolder getConversation() {
- return conversation;
- }
+
public Set<T> getSaveCandidates() {
return saveCandidates;
OCCURRENCE(Messages.BulkEditorInputType_4, OccurrenceEditorInput.ID),
USER(Messages.BulkEditorInputType_5, UserEditorInput.ID),
GROUP(Messages.BulkEditorInputType_6, GroupEditorInput.ID),
- TAXON(Messages.BulkEditorInputType_7, TaxonEditorInput.ID),
+ TAXON(Messages.BulkEditorInputType_7, TaxonBulkEditorInput.ID),
MEDIA(Messages.BulkEditorInputType_8, MediaEditorInput.ID);
public String id;
return USER;
} else if (input instanceof GroupEditorInput) {
return GROUP;
- } else if (input instanceof TaxonEditorInput){
+ } else if (input instanceof TaxonBulkEditorInput){
return TAXON;
}else if (input instanceof MediaEditorInput){
return MEDIA;
case GROUP:
return new GroupEditorInput();
case TAXON:
- return new TaxonEditorInput();
+ return new TaxonBulkEditorInput();
case MEDIA:
return new MediaEditorInput();
default:
@Override
public List listEntities(IIdentifiableEntityServiceConfigurator configurator) {
configurator.setPropertyPaths(getPropertyPaths());
- return CdmStore.getSearchManager().findNames(configurator, this.getConversation());
+ return CdmStore.getSearchManager().findNames(configurator);
}
@Override
public void addSaveCandidate(TaxonName name){
if (!name.getHybridChildRelations().isEmpty()){
for (HybridRelationship rel: name.getHybridChildRelations()){
- if (!rel.getParentName().isPersited()){
+ if (!rel.getParentName().isPersisted()){
super.addSaveCandidate(rel.getParentName());
}
- if (!rel.getHybridName().isPersited()){
+ if (!rel.getHybridName().isPersisted()){
super.addSaveCandidate(rel.getHybridName());
}
}
* 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.ArrayList;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
+import eu.etaxonomy.cdm.api.service.config.FindOccurrencesConfigurator;
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
* @author n.hoffmann
* @created Jun 16, 2010
*/
-public class OccurrenceEditorInput extends AbstractBulkEditorInput<SpecimenOrObservationBase> {
-
+public class OccurrenceEditorInput
+ extends AbstractBulkEditorInput<SpecimenOrObservationBase> {
public static final String ID = "bulkeditor.input.occurrence"; //$NON-NLS-1$
@Override
protected List<SpecimenOrObservationBase> listEntities(
IIdentifiableEntityServiceConfigurator configurator) {
- return CdmStore.getSearchManager().findOccurrences(configurator, false);
+ return CdmStore.getSearchManager().findOccurrences((FindOccurrencesConfigurator)configurator, false);
}
@Override
-/**\r
-* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy\r
-* http://www.e-taxonomy.eu\r
-*\r
-* The contents of this file are subject to the Mozilla Public License Version 1.1\r
-* See LICENSE.TXT at the top of this package for the full license terms.\r
-*/\r
-package eu.etaxonomy.taxeditor.bulkeditor.input;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Arrays;\r
-import java.util.List;\r
-import java.util.UUID;\r
-\r
-import eu.etaxonomy.cdm.api.service.INameService;\r
-import eu.etaxonomy.cdm.api.service.ITaxonService;\r
-import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;\r
-import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;\r
-import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator;\r
-import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;\r
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;\r
-import eu.etaxonomy.cdm.model.name.HybridRelationship;\r
-import eu.etaxonomy.cdm.model.name.TaxonName;\r
-import eu.etaxonomy.cdm.model.taxon.Synonym;\r
-import eu.etaxonomy.cdm.model.taxon.Taxon;\r
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
-import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;\r
-import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;\r
-import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.TaxonCreator;\r
-import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.IdentifiableEntitySortProvider;\r
-import eu.etaxonomy.taxeditor.l10n.Messages;\r
-import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
-import eu.etaxonomy.taxeditor.store.CdmStore;\r
-\r
-public class TaxonEditorInput extends AbstractBulkEditorInput<TaxonBase>{\r
-\r
- private static TaxonEditorInput instance;\r
-\r
- public static final String ID = "bulkeditor.input.taxon";\r
-\r
- private static final String PROPERTY_PUBLISH = "Publish";\r
-\r
- private List<TaxonName> saveNameCandidates = new ArrayList<>();\r
-\r
- public static AbstractBulkEditorInput getInstance() {\r
- if (instance == null) {\r
- instance = new TaxonEditorInput();\r
- }\r
-\r
- return instance;\r
- }\r
-\r
- @Override\r
- protected List<String> getPropertyKeys_internal() {\r
- List<String> propertyKeysInternal = new ArrayList<>();\r
- propertyKeysInternal.add(PROPERTY_PUBLISH);\r
- return propertyKeysInternal;\r
- }\r
-\r
- @Override\r
- public Object getPropertyValue(TaxonBase cdmBase, String property) {\r
- if(property.equals(PROPERTY_PUBLISH)){\r
- return cdmBase.isPublish();\r
- }\r
- return super.getPropertyValue(cdmBase, property);\r
- }\r
-\r
- @Override\r
- public boolean isBooleanProperty(String property) {\r
- if(property.equals(PROPERTY_PUBLISH)){\r
- return true;\r
- }\r
- return super.isBooleanProperty(property);\r
- }\r
-\r
- @Override\r
- public String getName() {\r
- return BulkEditorInputType.TAXON.label;\r
- }\r
-\r
- public static Object getID() {\r
- return ID;\r
- }\r
-\r
- @Override\r
- public List<IBulkEditorSortProvider<TaxonBase>> getSortProviders() {\r
- List<IBulkEditorSortProvider<TaxonBase>> sortProviders = super.getSortProviders();\r
-\r
- sortProviders.add(0, new IdentifiableEntitySortProvider<TaxonBase>());\r
-\r
- return sortProviders;\r
- }\r
-\r
- @Override\r
- public boolean isMergingEnabled() {\r
- return false;\r
- }\r
- @Override\r
- public TaxonBase save(TaxonBase entity) {\r
- return CdmStore.getService(ITaxonService.class).merge(entity, true).getMergedEntity();\r
- }\r
-\r
- @Override\r
- protected long countEntities(IIdentifiableEntityServiceConfigurator configurator) {\r
- return CdmStore.getService(ITaxonService.class).countByTitle(configurator);\r
- }\r
-\r
- @Override\r
- public List listEntities(IIdentifiableEntityServiceConfigurator configurator) {\r
-// IFindTaxaAndNamesConfigurator<TaxonBase> newConfig = new FindTaxaAndNamesConfiguratorImpl<>();\r
-// newConfig.setTitleSearchString(configurator.getTitleSearchStringSqlized());\r
-// newConfig.setMatchMode(MatchMode.ANYWHERE);\r
- List<String> propertyPaths = getPropertyPaths();\r
- configurator.setPropertyPaths(propertyPaths);\r
- List<TaxonBase> taxa = CdmStore.getSearchManager().findTaxa(configurator);\r
- List<TaxonBase> taxaCopy = new ArrayList<TaxonBase>();\r
- for (TaxonBase taxon:taxa){\r
-\r
- if (taxon instanceof Taxon){\r
- taxaCopy.add(HibernateProxyHelper.deproxy(taxon, Taxon.class));\r
- }else{\r
- taxaCopy.add(HibernateProxyHelper.deproxy(taxon, Synonym.class));\r
- }\r
- }\r
- return taxaCopy;\r
- }\r
-\r
- @Override\r
- protected TaxonBase loadEntity(UUID entityUuid) {\r
- List<String> propertyPaths = Arrays.asList(new String[]{});\r
- return CdmStore.getService(ITaxonService.class).load(entityUuid, propertyPaths);\r
- }\r
-\r
- @Override\r
- public boolean delete(TaxonBase entity, DeleteConfiguratorBase config) {\r
- if (entity instanceof Taxon){\r
- TaxonDeletionConfigurator taxonConfig = null;\r
- if (config instanceof TaxonDeletionConfigurator){\r
- taxonConfig = (TaxonDeletionConfigurator)config;\r
- }else{\r
-\r
- }\r
-\r
- return CdmStore.getService(ITaxonService.class).deleteTaxon(entity.getUuid(), taxonConfig, null) != null;\r
- } else{\r
- SynonymDeletionConfigurator synConfig = null;\r
- if (config instanceof SynonymDeletionConfigurator){\r
- synConfig = (SynonymDeletionConfigurator)config;\r
- }else{\r
-\r
- }\r
-\r
- return CdmStore.getService(ITaxonService.class).deleteSynonym(entity.getUuid(), synConfig) != null;\r
- }\r
- }\r
-\r
- @Override\r
- protected IEntityCreator<TaxonBase> createEntityCreator() {\r
- return new TaxonCreator();\r
- }\r
-\r
- @Override\r
- public void merge() {\r
-\r
- }\r
-\r
- @Override\r
- public void addSaveCandidate(TaxonBase taxonBase){\r
- if (taxonBase == null){\r
- MessagingUtils.info(Messages.TAXON_EDITOR_INPUT_Selection_lost);\r
- return;\r
- }\r
- if (!taxonBase.getName().getHybridChildRelations().isEmpty()){\r
- for (HybridRelationship rel: taxonBase.getName().getHybridChildRelations()){\r
- if (!rel.getParentName().isPersited()){\r
- this.saveNameCandidates.add(rel.getParentName());\r
- }\r
- if (!rel.getHybridName().isPersited()){\r
- this.saveNameCandidates.add(rel.getHybridName());\r
- }\r
- }\r
- }\r
-\r
- super.addSaveCandidate(taxonBase);\r
- }\r
-\r
- @Override\r
- public void saveModel(boolean resetMerge){\r
- CdmStore.getService(INameService.class).save(this.saveNameCandidates);\r
- super.saveModel(resetMerge);\r
- }\r
-\r
- private List<String> getPropertyPaths(){\r
- List<String> taxonBasePropertyPaths = Arrays.asList(new String[] {\r
- "descriptions.descriptionElements.*",\r
- "typeDesignations"});\r
-\r
- return taxonBasePropertyPaths;\r
- }\r
-\r
-}\r
+/**
+* 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.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+import eu.etaxonomy.cdm.api.service.INameService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
+import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
+import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.name.HybridRelationship;
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;
+import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.TaxonCreator;
+import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.IdentifiableEntitySortProvider;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+public class TaxonBulkEditorInput extends AbstractBulkEditorInput<TaxonBase>{
+
+ private static TaxonBulkEditorInput instance;
+
+ public static final String ID = "bulkeditor.input.taxon";
+
+ private static final String PROPERTY_PUBLISH = "Publish";
+
+ private List<TaxonName> saveNameCandidates = new ArrayList<>();
+
+ public static AbstractBulkEditorInput getInstance() {
+ if (instance == null) {
+ instance = new TaxonBulkEditorInput();
+ }
+
+ return instance;
+ }
+
+ @Override
+ protected List<String> getPropertyKeys_internal() {
+ List<String> propertyKeysInternal = new ArrayList<>();
+ propertyKeysInternal.add(PROPERTY_PUBLISH);
+ return propertyKeysInternal;
+ }
+
+ @Override
+ public Object getPropertyValue(TaxonBase cdmBase, String property) {
+ if(property.equals(PROPERTY_PUBLISH)){
+ return cdmBase.isPublish();
+ }
+ return super.getPropertyValue(cdmBase, property);
+ }
+
+ @Override
+ public boolean isBooleanProperty(String property) {
+ if(property.equals(PROPERTY_PUBLISH)){
+ return true;
+ }
+ return super.isBooleanProperty(property);
+ }
+
+ @Override
+ public String getName() {
+ return BulkEditorInputType.TAXON.label;
+ }
+
+ public static Object getID() {
+ return ID;
+ }
+
+ @Override
+ public List<IBulkEditorSortProvider<TaxonBase>> getSortProviders() {
+ List<IBulkEditorSortProvider<TaxonBase>> sortProviders = super.getSortProviders();
+
+ sortProviders.add(0, new IdentifiableEntitySortProvider<TaxonBase>());
+
+ return sortProviders;
+ }
+
+ @Override
+ public boolean isMergingEnabled() {
+ return false;
+ }
+ @Override
+ public TaxonBase save(TaxonBase entity) {
+ return CdmStore.getService(ITaxonService.class).merge(entity, true).getMergedEntity();
+ }
+
+ @Override
+ protected long countEntities(IIdentifiableEntityServiceConfigurator configurator) {
+ return CdmStore.getService(ITaxonService.class).countByTitle(configurator);
+ }
+
+ @Override
+ public List listEntities(IIdentifiableEntityServiceConfigurator configurator) {
+// IFindTaxaAndNamesConfigurator<TaxonBase> newConfig = new FindTaxaAndNamesConfiguratorImpl<>();
+// newConfig.setTitleSearchString(configurator.getTitleSearchStringSqlized());
+// newConfig.setMatchMode(MatchMode.ANYWHERE);
+ List<String> propertyPaths = getPropertyPaths();
+ configurator.setPropertyPaths(propertyPaths);
+ List<TaxonBase> taxa = CdmStore.getSearchManager().findTaxa(configurator);
+ List<TaxonBase> taxaCopy = new ArrayList<TaxonBase>();
+ for (TaxonBase taxon:taxa){
+
+ if (taxon instanceof Taxon){
+ taxaCopy.add(HibernateProxyHelper.deproxy(taxon, Taxon.class));
+ }else{
+ taxaCopy.add(HibernateProxyHelper.deproxy(taxon, Synonym.class));
+ }
+ }
+ return taxaCopy;
+ }
+
+ @Override
+ protected TaxonBase loadEntity(UUID entityUuid) {
+ List<String> propertyPaths = Arrays.asList(new String[]{});
+ return CdmStore.getService(ITaxonService.class).load(entityUuid, propertyPaths);
+ }
+
+ @Override
+ public boolean delete(TaxonBase entity, DeleteConfiguratorBase config) {
+ if (entity instanceof Taxon){
+ TaxonDeletionConfigurator taxonConfig = null;
+ if (config instanceof TaxonDeletionConfigurator){
+ taxonConfig = (TaxonDeletionConfigurator)config;
+ }else{
+
+ }
+
+ return CdmStore.getService(ITaxonService.class).deleteTaxon(entity.getUuid(), taxonConfig, null) != null;
+ } else{
+ SynonymDeletionConfigurator synConfig = null;
+ if (config instanceof SynonymDeletionConfigurator){
+ synConfig = (SynonymDeletionConfigurator)config;
+ }else{
+
+ }
+
+ return CdmStore.getService(ITaxonService.class).deleteSynonym(entity.getUuid(), synConfig) != null;
+ }
+ }
+
+ @Override
+ protected IEntityCreator<TaxonBase> createEntityCreator() {
+ return new TaxonCreator();
+ }
+
+ @Override
+ public void merge() {
+
+ }
+
+ @Override
+ public void addSaveCandidate(TaxonBase taxonBase){
+ if (taxonBase == null){
+ MessagingUtils.info(Messages.TAXON_EDITOR_INPUT_Selection_lost);
+ return;
+ }
+ if (!taxonBase.getName().getHybridChildRelations().isEmpty()){
+ for (HybridRelationship rel: taxonBase.getName().getHybridChildRelations()){
+ if (!rel.getParentName().isPersisted()){
+ this.saveNameCandidates.add(rel.getParentName());
+ }
+ if (!rel.getHybridName().isPersisted()){
+ this.saveNameCandidates.add(rel.getHybridName());
+ }
+ }
+ }
+
+ super.addSaveCandidate(taxonBase);
+ }
+
+ @Override
+ public void saveModel(boolean resetMerge){
+ CdmStore.getService(INameService.class).save(this.saveNameCandidates);
+ super.saveModel(resetMerge);
+ }
+
+ private List<String> getPropertyPaths(){
+ List<String> taxonBasePropertyPaths = Arrays.asList(new String[] {
+ "descriptions.descriptionElements.*",
+ "typeDesignations"});
+
+ return taxonBasePropertyPaths;
+ }
+}
\ No newline at end of file
import java.util.HashMap;
import java.util.Map;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.cdm.model.agent.Team;
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
/**
- * <p>TeamOrPersonCreator class.</p>
- *
* @author p.ciardelli
* @created 18.09.2009
*/
public class AgentCreator implements IEntityCreator<TeamOrPersonBase> {
- private static final Logger logger = LogManager.getLogger(AgentCreator.class);
+ private static final Logger logger = LogManager.getLogger();
@Override
public TeamOrPersonBase createEntity(String text) {
return teamOrPerson;
}
- /**
- * <p>getKeyLabelPairs</p>
- *
- * @return a {@link java.util.Map} object.
- */
@Override
public Map<Object, String> getKeyLabelPairs() {
Map<Object, String> result = new HashMap<>();
* 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.Comparator;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>NameCreator class.</p>
- *
* @author p.ciardelli
* @created 07.07.2009
*/
return ParseHandler.parseName(text, (Rank) key);
}
- /**
- * <p>getKeyLabelPairs</p>
- *
- * @return a {@link java.util.Map} object.
- */
@Override
public Map<Rank, String> getKeyLabelPairs() {
Map<Rank, String> result = new TreeMap<Rank, String>(
// TODO Auto-generated method stub
return false;
}
-}
+}
\ No newline at end of file
import javax.annotation.PreDestroy;
import org.apache.commons.lang3.StringUtils;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.DescriptionHelper;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPartE4;
+import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPart;
/**
* This view loads and presents referencing objects information asynchronously.
* @author a.mueller
* @since Aug 16, 2017
*/
-public class ReferencingObjectsViewE4 extends AbstractCdmEditorPartE4 implements IReferencingObjectsView{
+public class ReferencingObjectsViewE4
+ extends AbstractCdmEditorPart<TableViewer>
+ implements IReferencingObjectsView{
- private static final Logger logger = LogManager.getLogger(ReferencingObjectsViewE4.class);
+ private static final Logger logger = LogManager.getLogger();
private static final List<ReferencingObjectDto> EMPTY_LIST = Arrays.asList(); //immutable empty list
private static final RefObjectDtoComparator COMPARATOR = new RefObjectDtoComparator();
to.setReferencedEntity(from.getReferencedEntity());
}
- private Set<ReferencingObjectDto> loadReferencingObjects(UUID entity, Class objectClass) {
+ private Set<ReferencingObjectDto> loadReferencingObjects(UUID entity, Class<? extends CdmBase> objectClass) {
//TODO why do we need to load the referenced object here
CdmBase referencedObject = null;
try {
if (referencedObject != null){
setOfReferencingObjects = CdmStore.getCommonService().getReferencingObjectDtos(referencedObject);
- return setOfReferencingObjects;
+ if (setOfReferencingObjects != null){
+ return setOfReferencingObjects;
+ }else{
+ //for some reason sometimes this seems to return null, whenever it is called
+ throw new RuntimeException("getReferencingObjectDtos() did not return a value for object uuid: " + referencedObject.getUuid() + ", class: " + referencedObject.getClass());
+ }
+ }else{
+ throw new RuntimeException("referenced object could not be retrieved for uuid: " + entity + ", class: " + objectClass);
}
} catch (Exception e) {
logger.debug("Error retrieving referencing objects", e);
e.printStackTrace();
updateDescriptionLabel("The referencing objects view could not be loaded completely. Some problems occurred: " + e.getMessage());
+ return null;
}
- return null;
}
/**
dto.itemClass = cdmBase.getClass();
dto.itemId = cdmBase.getId();
}else if (firstElement instanceof UuidAndTitleCache<?>){
- UuidAndTitleCache<? extends CdmBase> element = (UuidAndTitleCache<? extends CdmBase>) firstElement;
+ @SuppressWarnings("unchecked")
+ UuidAndTitleCache<? extends CdmBase> element = (UuidAndTitleCache<? extends CdmBase>) firstElement;
dto.typeName = CdmUtils.userFriendlyClassName(element.getType());
dto.itemLabel = element.getTitleCache();
if (CdmUtils.isBlank(dto.itemLabel)){
ReferencingObjectsLabelProvider_No_description_available=No description available
ConvertPerson2TeamHandler_warning=While reloading the data an exception occurred
ConvertPerson2TeamHandler_lable=Convert Person to Team
-DeleteHandler_CAN_BE_DELETED=can be deleted but related object(s) could not be deleted.
+DeleteHandler_CAN_BE_DELETED= can be deleted but related object(s) could not be deleted.
DeleteHandler_CONFIRM=Confirm Deletion
-DeleteHandler_COULD_NOT_BE_DELETED=could not be deleted.
-DeleteHandler_ALREADY_DELETED=was already deleted
+DeleteHandler_COULD_NOT_BE_DELETED= could not be deleted.
+DeleteHandler_ALREADY_DELETED= was already deleted
DeleteHandler_DELETE=Delete
DeleteHandler_DELETE_NOT_POSSIBLE=Delete not possible
DeleteHandler_EXCEPTION=An exception occurred.
Bundle-ManifestVersion: 2
Bundle-Name: CDM Library Dependencies Plugin
Bundle-SymbolicName: eu.etaxonomy.taxeditor.cdmlib;singleton:=true
-Bundle-Version: 5.34.0
+Bundle-Version: 5.42.0
Eclipse-BundleShape: dir
-Export-Package: com.sun.istack.internal.tools,
+Export-Package: com.fasterxml.jackson.core,
+ com.fasterxml.jackson.core.type,
+ com.fasterxml.jackson.databind,
+ com.fasterxml.jackson.databind.node,
+ com.sun.istack.internal.tools,
com.sun.istack.internal.ws,
eu.etaxonomy.cdm,
eu.etaxonomy.cdm.api.application,
eu.etaxonomy.cdm.api.cache,
eu.etaxonomy.cdm.api.conversation,
- eu.etaxonomy.cdm.api.facade,
+ eu.etaxonomy.cdm.api.filter,
eu.etaxonomy.cdm.api.remoting,
eu.etaxonomy.cdm.api.service,
eu.etaxonomy.cdm.api.service.config,
eu.etaxonomy.cdm.api.service.description,
eu.etaxonomy.cdm.api.service.dto,
eu.etaxonomy.cdm.api.service.exception,
+ eu.etaxonomy.cdm.api.service.geo,
eu.etaxonomy.cdm.api.service.l10n,
eu.etaxonomy.cdm.api.service.longrunningService,
eu.etaxonomy.cdm.api.service.lsid,
eu.etaxonomy.cdm.ext.occurrence.gbif,
eu.etaxonomy.cdm.ext.openurl,
eu.etaxonomy.cdm.ext.sru,
+ eu.etaxonomy.cdm.facade,
eu.etaxonomy.cdm.filter,
eu.etaxonomy.cdm.format,
eu.etaxonomy.cdm.format.common,
eu.etaxonomy.cdm.format.description,
+ eu.etaxonomy.cdm.format.description.distribution,
eu.etaxonomy.cdm.format.taxon,
eu.etaxonomy.cdm.hibernate,
eu.etaxonomy.cdm.hibernate.search,
eu.etaxonomy.cdm.io.api.application,
eu.etaxonomy.cdm.io.berlinModel,
eu.etaxonomy.cdm.io.cdmLight,
+ eu.etaxonomy.cdm.io.coldp,
eu.etaxonomy.cdm.io.common,
eu.etaxonomy.cdm.io.common.events,
eu.etaxonomy.cdm.io.common.mapping,
eu.etaxonomy.cdm.io.markup,
eu.etaxonomy.cdm.io.markup.handler,
eu.etaxonomy.cdm.io.pilotOutputHtml,
- eu.etaxonomy.cdm.io.reference.endnote.in,
eu.etaxonomy.cdm.io.reference.ris.in,
eu.etaxonomy.cdm.io.sdd,
eu.etaxonomy.cdm.io.sdd.ikeyplus,
eu.etaxonomy.cdm.io.service,
eu.etaxonomy.cdm.io.specimen,
eu.etaxonomy.cdm.io.specimen.abcd206.in,
- eu.etaxonomy.cdm.io.specimen.excel.in,
eu.etaxonomy.cdm.io.specimen.gbif.in,
eu.etaxonomy.cdm.io.taxonx,
eu.etaxonomy.cdm.io.tcsxml,
eu.etaxonomy.cdm.io.tcsxml.in,
eu.etaxonomy.cdm.io.tcsxml.out,
+ eu.etaxonomy.cdm.io.wfo.out,
eu.etaxonomy.cdm.jaxb,
eu.etaxonomy.cdm.model,
eu.etaxonomy.cdm.model.agent,
eu.etaxonomy.taxeditor.remoting.source,
eu.etaxonomy.taxeditor.service,
eu.etaxonomy.taxeditor.session,
- eu.etaxonomy.taxeditor.session.mock,
jakarta.validation,
javax.persistence,
junit.framework;uses:="org.junit.runner.manipulation,org.junit.runner,org.junit.runner.notification",
net.sf.ehcache.store,
net.sf.ehcache.util,
org.aopalliance.aop,
+ org.apache.commons.collections4,
org.apache.commons.collections4.map,
org.apache.commons.dbcp,
org.apache.commons.imaging,
org.joda.time.field;uses:="org.joda.time",
org.joda.time.format;uses:="org.joda.time",
org.joda.time.tz;uses:="org.joda.time",
- org.json,
org.junit;uses:="org.hamcrest",
org.junit.runner,
org.slf4j,
org.eclipse.swt
Bundle-ClassPath: .,
lib/aspectjweaver-1.9.7.jar,
- lib/cdmlib-commons-5.34.0.jar,
- lib/cdmlib-ext-5.34.0.jar,
- lib/cdmlib-io-5.34.0.jar,
- lib/cdmlib-model-5.34.0.jar,
- lib/cdmlib-api-5.34.0.jar,
- lib/cdmlib-persistence-5.34.0.jar,
- lib/cdmlib-cache-5.34.0.jar,
- lib/cdmlib-services-5.34.0.jar,
+ lib/cdmlib-commons-5.42.0.jar,
+ lib/cdmlib-ext-5.42.0.jar,
+ lib/cdmlib-io-5.42.0.jar,
+ lib/cdmlib-model-5.42.0.jar,
+ lib/cdmlib-api-5.42.0.jar,
+ lib/cdmlib-persistence-5.42.0.jar,
+ lib/cdmlib-cache-5.42.0.jar,
+ lib/cdmlib-services-5.42.0.jar,
lib/commons-codec-1.15.jar,
lib/commons-collections4-4.4.jar,
lib/commons-dbcp-1.4.jar,
lib/hibernate-core-5.4.33.Final.jar,
lib/hibernate-envers-5.4.33.Final.jar,
lib/hibernate-validator-6.2.3.Final.jar,
+ lib/hibernate-search-engine-5.11.10.Final.jar,
lib/byte-buddy-1.12.10.jar,
lib/javax.persistence-api-2.2.jar,
lib/jackson-annotations-2.13.3.jar,
lib/spring-security-core-4.2.20.RELEASE.jar,
lib/spring-tx-4.3.30.RELEASE.jar,
lib/spring-web-4.3.30.RELEASE.jar,
+ lib/spring-orm-4.3.30.RELEASE.jar,
lib/tools.jar,
lib/jakarta.validation-api-3.0.2.jar,
+ lib/validation-api-2.0.1.Final.jar,
lib/xml-apis-1.4.01.jar,
lib/opencsv-2.3.jar,
lib/junit-4.13.2.jar,
- lib/json-20220320.jar,
lib/antlr-2.7.7.jar,
- lib/postgresql-42.3.6.jar,
+ lib/postgresql-42.5.1.jar,
lib/lucene-core-5.5.5.jar,
lib/lucene-queryparser-5.5.5.jar,
lib/lucene-analyzers-common-5.5.5.jar,
bin.includes = META-INF/,\
.,\
lib/aspectjweaver-1.9.7.jar,\
- lib/cdmlib-commons-5.34.0.jar,\
- lib/cdmlib-ext-5.34.0.jar,\
- lib/cdmlib-io-5.34.0.jar,\
- lib/cdmlib-model-5.34.0.jar,\
- lib/cdmlib-api-5.34.0.jar,\
- lib/cdmlib-persistence-5.34.0.jar,\
- lib/cdmlib-services-5.34.0.jar,\
- lib/commons-codec-1.15.jar,\
+ lib/cdmlib-commons-5.42.0.jar,\
+ lib/cdmlib-ext-5.42.0.jar,\
+ lib/cdmlib-io-5.42.0.jar,\
+ lib/cdmlib-model-5.42.0.jar,\
+ lib/cdmlib-api-5.42.0.jar,\
+ lib/cdmlib-persistence-5.42.0.jar,\
+ lib/cdmlib-services-5.42.0.jar,\
lib/commons-collections4-4.4.jar,\
+ lib/commons-codec-1.15.jar,\
lib/commons-dbcp-1.4.jar,\
lib/commons-io-2.11.0.jar,\
lib/commons-lang-2.6.jar,\
lib/h2-1.4.190.jar,\
lib/hibernate-core-5.4.33.Final.jar,\
lib/hibernate-envers-5.4.33.Final.jar,\
+ lib/hibernate-search-engine-5.11.10.Final.jar,\
lib/lucene-core-5.5.5.jar,\
lib/byte-buddy-1.12.10.jar,\
lib/antlr-2.7.7.jar,\
lib/spring-security-core-4.2.20.RELEASE.jar,\
lib/spring-tx-4.3.30.RELEASE.jar,\
lib/spring-web-4.3.30.RELEASE.jar,\
+ lib/spring-orm-4.3.30.RELEASE.jar,\
lib/tools.jar,\
lib/jakarta.validation-api-3.0.2.jar,\
+ lib/validation-api-2.0.1.Final.jar,\
lib/xml-apis-1.4.01.jar,\
lib/opencsv-2.3.jar,\
lib/junit-4.13.2.jar,\
- lib/json-20220320.jar,\
- lib/postgresql-42.3.6.jar,\
+ lib/postgresql-42.5.1.jar,\
lib/mchange-commons-java-0.2.11.jar,\
- lib/cdmlib-cache-5.34.0.jar,\
+ lib/cdmlib-cache-5.42.0.jar,\
lib/org.swtchart_0.10.0.v20160212.jar,\
lib/mysql-connector-java-8.0.29.jar,\
lib/c3p0-0.9.5.2.jar,\
<parent>\r
<groupId>eu.etaxonomy</groupId>\r
<artifactId>taxeditor-parent</artifactId>\r
- <version>5.34.0</version>\r
+ <version>5.42.0</version>\r
</parent>\r
<modelVersion>4.0.0</modelVersion>\r
<artifactId>eu.etaxonomy.taxeditor.cdmlib</artifactId>\r
<jackson.version>2.13.3</jackson.version>\r
<poi.version>4.1.2</poi.version>\r
<hibernate.version>5.4.33.Final</hibernate.version>\r
+ <hibernate-search.version>5.11.10.Final</hibernate-search.version>\r
<lucene.version>5.5.5</lucene.version>\r
<spring.version>4.3.30.RELEASE</spring.version> <!-- checked 2021-12, further upgrade possible -->\r
<spring-security.version>4.2.20.RELEASE</spring-security.version> <!-- checked 2021-12, further upgrade possible -->\r
<includeArtifactIds>\r
httpclient,JavaAPIforKml,iiif-apis,commons-lang3,commons-lang,commons-text,\r
commons-codec,commons-io,\r
- json,\r
log4j-core,log4j-api,slf4j-api,jboss-logging,jcl-over-slf4j,log4j-slf4j-impl,\r
lucene-analyzers-common,lucene-core,lucene-queryparser,lucene-suggest,lucene-sandbox,\r
commons-imaging,jackson-databind,jackson-annotations,jackson-core,\r
- jakarta.validation-api,\r
+ jakarta.validation-api,validation-api,\r
ehcache,\r
hibernate-validator,\r
spring-context,spring-aspects,spring-beans,\r
spring-tx,spring-web,spring-core,spring-aop,\r
- spring-jdbc,spring-security-core,\r
+ spring-jdbc,spring-orm,\r
+ spring-security-core,\r
aspectjweaver,\r
byte-buddy,\r
- hibernate-core,hibernate-envers,antlr,\r
+ hibernate-core,hibernate-envers,hibernate-search-engine,\r
+ antlr,\r
javax.persistence-api,\r
xml-apis,lsid-client,jdom,\r
commons-collections4,commons-math3,\r
<artifactId>httpcore</artifactId>\r
<version>4.4.15</version>\r
</dependency>\r
- <dependency>\r
- <!-- used e.g. by CdmServerInfo -->\r
+ <!--<dependency>\r
+ \r
<groupId>org.json</groupId>\r
<artifactId>json</artifactId>\r
<version>20220320</version>\r
- </dependency>\r
- <dependency>\r
+ </dependency>-->\r
+ <dependency>\r
<!-- used e.g. by CdmServerInfo -->\r
<groupId>com.fasterxml.jackson.core</groupId>\r
<artifactId>jackson-core</artifactId>\r
\r
<!-- used by bulkeditor -->\r
<dependency>\r
- <!-- used by CharacterMatrix/bulkeditor (LinkedList) -->\r
+ <!-- used by CharacterMatrix/bulkeditor (LinkedList) and UpdateResult.exceptions (CircularFifoQueue) -->\r
<groupId>org.apache.commons</groupId>\r
<artifactId>commons-collections4</artifactId>\r
<version>4.4</version>\r
</dependency>\r
- \r
- <!-- used by taxeditor.local -->\r
+ <!-- used by taxeditor.local -->\r
<dependency>\r
<!-- used by datasource dialogue finish button -->\r
<groupId>com.mchange</groupId>\r
\r
<!-- required during RUNTIME -->\r
\r
+ <dependency>\r
+ <!-- for handling HibernateSystemException, see #10277, TODO try to handle without adding dependency -->\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-orm</artifactId>\r
+ <version>${spring.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <!-- for handling BridgeException, see #10277, TODO try to handle without adding dependency -->\r
+ <groupId>org.hibernate</groupId>\r
+ <artifactId>hibernate-search-engine</artifactId>\r
+ <version>${hibernate-search.version}</version>\r
+ </dependency>\r
<dependency>\r
<!-- throws exception in bulk editor after search if not present -->\r
<groupId>org.hibernate</groupId>\r
<version>2.2.1</version>\r
</dependency>\r
\r
+ <dependency>\r
+ <!-- used if a validation result is returned, see https://dev.e-taxonomy.eu/redmine/issues/10182#note-10 -->\r
+ <!-- can probably be removed after switching to jakarta.validation-api with spring 6.x -->\r
+ <groupId>javax.validation</groupId>\r
+ <artifactId>validation-api</artifactId>\r
+ <version>2.0.1.Final</version>\r
+ </dependency>\r
+ \r
<dependency>\r
<!-- used in datasource view and in test, maybe enough if in taxeditor.local and taxeditor.test -->\r
<groupId>com.mchange</groupId>\r
</dependency>\r
\r
<!-- database related, should be moved to local/test when possible -->\r
- <!-- only for supporting test button in datasource dialogue, dialogue should be moved to taxeditor.webapp -->\r
+ <!-- only for supporting test button in datasource dialogue, dialogue should be moved to taxeditor.local -->\r
<dependency>\r
<groupId>mysql</groupId>\r
<artifactId>mysql-connector-java</artifactId>\r
<dependency>\r
<groupId>org.postgresql</groupId>\r
<artifactId>postgresql</artifactId>\r
- <version>42.3.6</version>\r
+ <version>42.5.1</version>\r
</dependency>\r
\r
<!-- Only added for correct package export, but reported as needed -->\r
import org.apache.commons.lang3.StringUtils;\r
import org.apache.logging.log4j.LogManager;\r
import org.apache.logging.log4j.Logger;\r
-import org.springframework.beans.BeansException;\r
-import org.springframework.context.ApplicationContext;\r
-import org.springframework.context.ApplicationContextAware;\r
import org.springframework.remoting.httpinvoker.CachingHttpInvokerProxyFactoryBean;\r
import org.springframework.remoting.httpinvoker.HttpComponentsHttpInvokerRequestExecutor;\r
import org.springframework.security.access.AccessDecisionVoter;\r
import org.springframework.security.core.context.SecurityContext;\r
import org.springframework.security.core.context.SecurityContextHolder;\r
import org.springframework.stereotype.Component;\r
-import org.springframework.transaction.PlatformTransactionManager;\r
-import org.springframework.transaction.TransactionStatus;\r
\r
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
-import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock;\r
import eu.etaxonomy.cdm.api.service.IAgentService;\r
import eu.etaxonomy.cdm.api.service.IAnnotationService;\r
import eu.etaxonomy.cdm.api.service.IClassificationService;\r
import eu.etaxonomy.cdm.api.service.IRightsService;\r
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;\r
import eu.etaxonomy.cdm.api.service.ITaxonService;\r
+import eu.etaxonomy.cdm.api.service.ITermCollectionService;\r
import eu.etaxonomy.cdm.api.service.ITermNodeService;\r
import eu.etaxonomy.cdm.api.service.ITermService;\r
import eu.etaxonomy.cdm.api.service.ITermTreeService;\r
import eu.etaxonomy.cdm.api.service.ITestService;\r
import eu.etaxonomy.cdm.api.service.IUserService;\r
import eu.etaxonomy.cdm.api.service.IVocabularyService;\r
+import eu.etaxonomy.cdm.api.service.geo.IDistributionService;\r
import eu.etaxonomy.cdm.api.service.longrunningService.ILongRunningTasksService;\r
import eu.etaxonomy.cdm.api.service.media.MediaInfoFactory;\r
import eu.etaxonomy.cdm.api.service.molecular.IAmplificationService;\r
*/\r
@Component\r
// TODO split into CdmRepository and proper @Configuration class\r
-public class CdmApplicationRemoteConfiguration implements ICdmRepository, ApplicationContextAware {\r
+public class CdmApplicationRemoteConfiguration implements ICdmRepository {\r
\r
@SuppressWarnings("unused")\r
- private static final Logger logger = LogManager.getLogger(CdmApplicationRemoteConfiguration.class);\r
+ private static final Logger logger = LogManager.getLogger();\r
\r
/**\r
* Timeout for service lookup etc. This timeout (milliseconds) should be more\r
*/\r
public static final int HTTP_READ_TIMEOUT = 10 * 60 * 1000;\r
\r
- protected ApplicationContext applicationContext;\r
-\r
private ICdmRemoteSource remoteSource;\r
\r
//TODO should be something like Map<Class<IService>, IService>, but we have no common service base interface yet\r
\r
// ****************************** APPLICATION CONTEXT *************************************************/\r
\r
- @Override\r
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException{\r
- this.applicationContext = applicationContext;\r
- }\r
-\r
- @Override\r
- public PlatformTransactionManager getTransactionManager() throws UnsupportedOperationException {\r
- throw new UnsupportedOperationException("getTransactionManager is not implemented for CdmApplicationRemoteConfiguration");\r
- }\r
-\r
public IEditGeoService getEditGeoService() {\r
return (IEditGeoService) getService(IEditGeoService.class, "/remoting/editgeo.service", new AuthenticatingHttpInvokerRequestExecutor());\r
}\r
\r
// ****************************** GETTER *************************************************/\r
\r
- @Override\r
- public final Object getBean(String name){\r
- throw new UnsupportedOperationException("getBean is not implemented for CdmApplicationRemoteConfiguration");\r
- }\r
-\r
@Override\r
public IAccountRegistrationService getAccountRegistrationService() {\r
return (IAccountRegistrationService) getService(IAccountRegistrationService.class, "/remoting/accountregistrationservice.service", new AuthenticatingHttpInvokerRequestExecutor());\r
return (IDescriptionService) getService(IDescriptionService.class, "/remoting/description.service", new AuthenticatingHttpInvokerRequestExecutor());\r
}\r
\r
+ @Override\r
+ public IDistributionService getDistributionService(){\r
+ return (IDistributionService) getService(IDistributionService.class, "/remoting/distribution.service", new AuthenticatingHttpInvokerRequestExecutor());\r
+ }\r
+\r
@Override\r
public IDescriptionElementService getDescriptionElementService(){\r
return (IDescriptionElementService) getService(IDescriptionElementService.class, "/remoting/descriptionelement.service", new AuthenticatingHttpInvokerRequestExecutor());\r
return new ProviderManager(Arrays.asList((AuthenticationProvider)daoAuthenticationProvider));\r
}\r
\r
-\r
- @Override\r
- public ConversationHolder NewConversation() {\r
- return new ConversationHolderMock();\r
- }\r
-\r
@Override\r
public ICollectionService getCollectionService(){\r
return (ICollectionService) getService(ICollectionService.class, "/remoting/collection.service", new AuthenticatingHttpInvokerRequestExecutor());\r
return (ITermTreeService) getService(ITermTreeService.class, "/remoting/termtree.service", new AuthenticatingHttpInvokerRequestExecutor());\r
}\r
\r
+ @Override\r
+ public ITermCollectionService getTermCollectionService() {\r
+ return (ITermCollectionService) getService(ITermCollectionService.class, "/remoting/termcollection.service", new AuthenticatingHttpInvokerRequestExecutor());\r
+ }\r
+\r
@Override\r
public ITermNodeService getTermNodeService() {\r
return (ITermNodeService) getService(ITermNodeService.class, "/remoting/termnode.service", new AuthenticatingHttpInvokerRequestExecutor());\r
return cdmPermissionEvaluator;\r
}\r
\r
- @Override\r
- public TransactionStatus startTransaction() throws UnsupportedOperationException {\r
- throw new UnsupportedOperationException("startTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
- }\r
-\r
- @Override\r
- public TransactionStatus startTransaction(Boolean readOnly) throws UnsupportedOperationException {\r
- throw new UnsupportedOperationException("startTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
- }\r
-\r
- @Override\r
- public void commitTransaction(TransactionStatus txStatus) throws UnsupportedOperationException {\r
- throw new UnsupportedOperationException("commitTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
- }\r
-\r
- @Override\r
- public void rollbackTransaction(TransactionStatus arg0) {\r
- throw new UnsupportedOperationException("rollbackTransaction is not implemented for CdmApplicationRemoteConfiguration");\r
- }\r
-\r
@Override\r
public void authenticate(String username, String password){\r
UsernamePasswordAuthenticationToken tokenForUser = new UsernamePasswordAuthenticationToken(username, password);\r
import java.util.List;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.hibernate.collection.internal.AbstractPersistentCollection;
import org.hibernate.proxy.AbstractLazyInitializer;
import org.springframework.context.ApplicationListener;
/**
* CDM Application Controller class for remoting clients
- *
- * FIXME:Remoting extending {@link CdmApplicationController} is a temporary workaround.
- * The {@link CdmApplicationController} should be split into a CdmApplicationControllerBase
- * class with {@link CdmApplicationController} and this class as subclasses
*/
-public class CdmApplicationRemoteController extends CdmApplicationController {
+public class CdmApplicationRemoteController
+ extends CdmApplicationControllerBase<ICdmRepository> {
- private static final Logger logger = LogManager.getLogger(CdmApplicationRemoteController.class);
+ private static final Logger logger = LogManager.getLogger();
public static final Resource DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE =
new ClassPathResource("/eu/etaxonomy/cdm/remotingApplicationContext.xml");
/**
* Creates new instance of CdmApplicationRemoteController
- *
- * @param applicationContextResource
- * @param remoteSource
- * @param omitTermLoading
- * @param progressMonitor
- * @param listeners
- * @return
*/
public static CdmApplicationRemoteController NewInstance(ICdmRemoteSource remoteSource,
IProgressMonitor progressMonitor,
/**
* Constructs CdmApplicationRemoteController
- *
- * @param applicationContextResource
- * @param remoteSource
- * @param omitTermLoading
- * @param progressMonitor
- * @param listeners
*/
private CdmApplicationRemoteController(Resource applicationContextResource,
ICdmRemoteSource remoteSource,
progressMonitor.beginTask("Connecting to '" + remoteSource.getName() + "'", nTasks);
progressMonitor.subTask("Initialising CDM Model Cache ...");
- CdmRemoteCacheManager.getInstance();
+ CdmRemoteCacheManager.INSTANCE();
CdmRemoteCacheManager.removeEntityCaches();
progressMonitor.worked(1);
progressMonitor.subTask("Starting application context ...");
@Override
protected void init(){
configuration = new CdmApplicationRemoteConfiguration(remoteSource);
- ((CdmApplicationRemoteConfiguration)configuration).setApplicationContext(applicationContext);
AbstractLazyInitializer.setConfiguration((CdmApplicationRemoteConfiguration)configuration);
AbstractPersistentCollection.setConfiguration((CdmApplicationRemoteConfiguration)configuration);
}
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
-import eu.etaxonomy.cdm.common.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Dictionary;
import org.osgi.framework.Constants;
import org.springframework.security.core.context.SecurityContext;
-import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
import eu.etaxonomy.cdm.api.service.ICommonService;
import eu.etaxonomy.cdm.api.service.IService;
import eu.etaxonomy.cdm.api.service.ITestService;
import eu.etaxonomy.cdm.api.service.longrunningService.ILongRunningTasksService;
+import eu.etaxonomy.cdm.common.URI;
import eu.etaxonomy.cdm.io.service.IIOService;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.taxeditor.service.ICachedCommonService;
private static CdmApplicationState cdmApplicationState;
- private ICdmRepository appConfig;
+ private CdmApplicationRemoteController appConfig;
private ICdmDataChangeService dataChangeService;
//FIXME SecurityContextHolder.getContext()
private SecurityContext securityContext;
- private static CdmServiceCacher cdmServiceCacher;
+ private static CdmServiceCachingProxy termProxy;
private static String cdmlibVersion = null;
private static String cdmlibLastModified = null;
return cdmApplicationState;
}
- public void setAppConfig(ICdmRepository appConfig) {
+ public void setAppConfig(CdmApplicationRemoteController appConfig) {
this.appConfig = appConfig;
- if(appConfig instanceof CdmApplicationRemoteController) {
- CdmBase.setNewEntityListener(new DefaultNewEntityListener());
- } else {
- CdmBase.setNewEntityListener(null);
- }
+ CdmBase.setNewEntityListener(new DefaultNewEntityListener());
}
- public ICdmRepository getAppConfig() {
+ public CdmApplicationRemoteController getAppConfig() {
return appConfig;
}
- public static void setCurrentAppConfig(ICdmRepository appConfig) {
+ public static void setCurrentAppConfig(CdmApplicationRemoteController appConfig) {
getInstance().setAppConfig(appConfig);
}
- public static ICdmRepository getCurrentAppConfig() {
+ public static CdmApplicationRemoteController getCurrentAppConfig() {
return getInstance().getAppConfig();
}
getInstance().setAppConfig(null);
getInstance().setSecurityContext(null);
cdmApplicationState = null;
- cdmServiceCacher = null;
+ termProxy = null;
cdmlibVersion = null;
cdmlibLastModified = null;
}
return ((CdmApplicationRemoteController)configuration).getCachedCommonService();
}
- public static CdmServiceCacher getCdmServiceCacher() {
- return cdmServiceCacher;
+ public static CdmServiceCachingProxy getTermProxy() {
+ return termProxy;
}
- public static void setCdmServiceCacher(CdmServiceCacher cacher) {
- cdmServiceCacher = cacher;
+ public static void setTermProxy(CdmServiceCachingProxy cacher) {
+ termProxy = cacher;
}
public static void updateCdmlibManifestInfo() {
if(jar.startsWith(cdmlibPathPrefix) && jar.endsWith(jarSuffix)) {
URL fileURL = bundle.getEntry(jar);
File file = null;
+ String urlString = null;
try {
- String urlString = FileLocator.resolve(fileURL).toExternalForm().replace(" ", "%20");
-
+ urlString = FileLocator.resolve(fileURL).toExternalForm().replace(" ", "%20");
+
file = new File(new URI(urlString).getJavaUri());
JarFile jarFile = new JarFile(file);
Manifest manifest = jarFile.getManifest();
} catch (IOException ioe) {
throw new IllegalStateException(ioe);
} catch (IllegalArgumentException iae) {
- String message = iae.getMessage().concat("uri" + jar);
+ String message = iae.getMessage().concat("uri " + jar + "\n " + urlString);
throw new IllegalStateException(message);
}
}
import java.io.File;
import java.util.UUID;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver;
+import net.sf.ehcache.CacheManager;
import net.sf.ehcache.config.CacheConfiguration;
import net.sf.ehcache.config.DiskStoreConfiguration;
import net.sf.ehcache.config.SizeOfPolicyConfiguration;
+import net.sf.ehcache.store.MemoryStoreEvictionPolicy;
/**
* Class which uses CDM services to cache cdm entities
* FIXME: Currently only handles term entities. It would be
* interesting to have a generic method which finds the
* correct service to load / cache the entity.
+ * TODO by AM: compare with {@link CdmTermCacher} and merge if possible
*
* @author cmathew
*/
-public class CdmServiceCacher extends CdmCacherBase implements ICdmEntitySessionManagerObserver {
+public class CdmServiceCachingProxy
+ extends CdmPermanentCacheBase
+ implements ICdmEntitySessionManagerObserver {
+
+ private static final Logger logger = LogManager.getLogger();
private ICdmEntitySessionManager cdmEntitySessionManager;
private CacheLoader cacheLoader;
+ //NOTE AM: this is currently not used
@Autowired
private ConfigFileUtil configFileUtil = null;
+ public CdmServiceCachingProxy() {
+ super();
+ }
+
@Override
protected void setup() {
DefinedTermBase.setCacher(this);
CdmTransientEntityCacher.setPermanentCacher(this);
- //TermServiceRequestExecutor.setDefaultCacher(this);
RemoteInvocationTermCacher.setDefaultCacher(this);
cacheLoader = new CacheLoader(this);
}
+ //FIXME #10218 setting up the cache manager here probably has no effect
+ // as described in #10214
private void setUpCacheManager() {
- EhCacheConfiguration cacheConfig = new EhCacheConfiguration();
-
DiskStoreConfiguration diskStoreConfiguration = new DiskStoreConfiguration();
File ehcacheFolder = null;
if(configFileUtil != null){
ehcacheFolder = ConfigFileUtil.getCdmHomeSubDirFallback("taxeditor-ehcache");
}
- // FIXME use subfolder per taxeditor version to allow running multiple installations in parallel
+ // FIXME use subfolder per taxeditor version to allow running multiple
+ // installations in parallel
// String taxEditorVersion = ..;
// File ehcacheFolder = new File(ehcacheFolder, taxEditorVersion);
diskStoreConfiguration.setPath(ehcacheFolder.getAbsolutePath());
+ EhCacheConfiguration cacheConfig = new EhCacheConfiguration();
cacheConfig.setDiskStoreConfiguration(diskStoreConfiguration);
- addCacheManager(cacheConfig.cacheManager());
+
+ CacheManager cacheManager = cacheConfig.cacheManager();
+ setCacheManager(cacheManager);
}
@Override
- protected CacheConfiguration getDefaultCacheConfiguration() {
+ protected CacheConfiguration getPermanentCacheConfiguration() {
+
// For a better understanding on how to size caches, refer to
- // http://ehcache.org/documentation/configuration/cache-size
+ // https://www.ehcache.org/documentation/2.8/configuration/cache-size.html
+ //probably size of policy configuration is not really needed here
SizeOfPolicyConfiguration sizeOfConfig = new SizeOfPolicyConfiguration();
sizeOfConfig.setMaxDepth(100);
sizeOfConfig.setMaxDepthExceededBehavior("abort");
- return new CacheConfiguration(DEFAULT_CACHE_NAME, 0)
- .eternal(true)
- .statistics(true)
- .sizeOfPolicy(sizeOfConfig)
- .overflowToOffHeap(false);
+ CacheConfiguration config = new CacheConfiguration(PERMANENT_CACHE_NAME, 1000)
+ .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU)
+ .eternal(false)
+ .sizeOfPolicy(sizeOfConfig)
+ // default ttl and tti set to 1 hour and 20 min
+ .timeToLiveSeconds(60*60*1)
+ .timeToIdleSeconds(60*20);
+ return config;
}
@Override
return load(term);
}
+ /**
+ * <code>true</code> if the parameter is a term or a representation
+ */
@Override
public boolean isCachable(CdmBase cdmEntity) {
if(cdmEntity == null){
// first we check in the active session cache if the
// entity has been loaded there
// FIXME:Remoting do we really need the cdmTransientEntityCacher
- // here. Is it not guaranteed that all every entity which 'isCachable'
+ // here. Is it not guaranteed that every entity which 'isCachable'
// by this cacher is cached only in this cacher ?
if(!isCachable(cdmBase) && cdmTransientEntityCacher != null) {
CdmEntityCacheKey<T> key = CdmTransientEntityCacher.generateKey(cdmBase);
T cachedCdmEntity = (T)getFromCache(cdmEntity.getUuid());
if(isCachable(cdmEntity) && cachedCdmEntity == null) {
- cachedCdmEntity = cacheLoader.load(cdmEntity, false, true);
+ cachedCdmEntity = cacheLoader.load(cdmEntity, false, true);
}
return cachedCdmEntity;
}
/**
* 'Around' advice for the initialization of Collection objects
- *
*/
@Around(value = "possibleCollectionLazyInitializationException()")
public Object preloadCollectionOnDemand(ProceedingJoinPoint pjp) throws Throwable {
package eu.etaxonomy.taxeditor.remoting;
/**
+ * Singleton/static class to log the last httpInvoker
+ * request and response metadata.
+ * This is currently static to be easily accessible by MessagingUtils.
+ *
+ * Note: does not work clean in a multi-thread environment yet.
+ *
* @author a.kohlbecker
* @since Jan 17, 2020
*/
public class RemoteExecutionTimestampsUtil {
- protected static String lastRequestClientTime = null;
+ private static String lastRequestClientTime = null;
- protected static String lastResponseHeaderTime = null;
+ private static String lastResponseHeaderTime = null;
- protected static String lastServiceMethod = null;
+ private static String lastService = null;
+
+ private static String lastMethod = null;
- public RemoteExecutionTimestampsUtil() {
+ public RemoteExecutionTimestampsUtil() {
}
static public String getLastRequestClientTime() {
lastResponseHeaderTime = time;
}
- static public String getLastServiceMethod() {
- return lastServiceMethod;
+ static public String getLastService() {
+ return lastService;
+ }
+
+ static public void setLastService(String lastService) {
+ RemoteExecutionTimestampsUtil.lastService = lastService;
+ }
+
+ static public String getLastMethod() {
+ return lastMethod;
}
- static public void setLastServiceMethod(String lastMethod) {
- lastServiceMethod = lastMethod;
+ static public void setLastMethod(String lastMethod) {
+ RemoteExecutionTimestampsUtil.lastMethod = lastMethod;
}
}
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
private final static String NAME_DEMO_1 = "demo I";
private final static String SERVER_DEMO_1 = "160.45.63.230";
+ private final static String NAME_DEMO_2 = "demo II";
+ private final static String SERVER_DEMO_2 = "160.45.63.231";
+
public final static String SERVER_LOCALHOST = "localhost";
private final static String NAME_LOCALHOST = "localhost";
} else {
addInstancesViaHttp();
}
-
-
Collections.sort(instances, new Comparator<CdmInstanceInfo>() {
@Override
public int compare(CdmInstanceInfo cii1, CdmInstanceInfo cii2){
String url = guessProtocol() + "://" + server + ":" + String.valueOf(port) + "/" + prefix + "info.jsp";
String responseBody = getResponse(url);
if(responseBody != null) {
+ JsonNode tree = null;
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode resultNode = null;
try {
- JSONObject info = new JSONObject(responseBody);
- cdmlibServicesVersion = info.getString("cdmlibServicesVersion");
- cdmlibServicesLastModified = info.getString("cdmlibServicesLastModified");
- } catch (JSONException e) {
- throw new CdmServerException(e);
+ tree = mapper.readTree(responseBody);
+
+ if (tree != null) {
+ cdmlibServicesVersion = tree.get("cdmlibServicesVersion").textValue();
+ cdmlibServicesLastModified = tree.get("cdmlibServicesLastModified").textValue();
+ }
+ } catch (JsonProcessingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
+
}
}
String responseBody = getResponse(url);
if(responseBody != null) {
try {
- JSONArray array = new JSONArray(responseBody);
- for(int i=0;i<array.length();i++) {
- JSONObject instance = (JSONObject)array.get(i);
- if(instance != null) {
- JSONObject conf = (JSONObject)instance.get("configuration");
- if(conf != null) {
- String instanceName = conf.getString("instanceName");
- // we need to remove the first (char) forward slash from
- // the base path
- String basePath = conf.getString("basePath").substring(1);
- addInstance(instanceName, basePath);
- logger.info("Added instance with name : " + instanceName + ", basePath : " + basePath);
+ JsonNode tree = null;
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode resultNode = null;
+
+ tree = mapper.readTree(responseBody);
+ if (tree != null) {
+ for(int i=0;i<tree.size();i++) {
+ JsonNode instance = tree.get(i);
+ if(instance != null) {
+ JsonNode conf = instance.get("configuration");
+ if(conf != null) {
+ String instanceName = conf.get("instanceName").textValue();
+ // we need to remove the first (char) forward slash from
+ // the base path
+ String basePath = conf.get("basePath").textValue().substring(1);
+ addInstance(instanceName, basePath);
+ logger.info("Added instance with name : " + instanceName + ", basePath : " + basePath);
+ }
}
}
}
- } catch (JSONException e) {
- throw new CdmServerException(e);
+ } catch (JsonProcessingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
+
+
+
}
}
return serverInfoList;
}
- protected static List<CdmServerInfoConfig> loadFromConfigFile(File file) {
+ public static List<CdmServerInfoConfig> loadFromConfigFile(File file) {
List<CdmServerInfoConfig> serverList = null;
return serverList;
}
+ public static boolean saveToConfigFile(Collection<CdmServerInfoConfig> serverList, File file) {
+
+ ObjectMapper mapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);;
+ try {
+ mapper.writeValue(file, serverList);
+
+
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ return true;
+ }
+
+
private static List<CdmServerInfoConfig> createDefaultServerConfigList() {
List<CdmServerInfoConfig> serverInfoList = new ArrayList<>();
serverInfoList.add(new CdmServerInfoConfig(NAME_PRODUCTION, SERVER_PRODUCTION, 443, "", false));
serverInfoList.add(new CdmServerInfoConfig(NAME_DEMO_1, SERVER_DEMO_1, 80, CDMSERVER_PREFIX, false));
+ serverInfoList.add(new CdmServerInfoConfig(NAME_DEMO_2, SERVER_DEMO_2, 80, CDMSERVER_PREFIX, false));
serverInfoList.add(new CdmServerInfoConfig(NAME_LOCALHOST, SERVER_LOCALHOST, 8080, CDMSERVER_PREFIX, true));
return serverInfoList;
}
private String name;
private String server;
- private int port;
+ private Integer port;
private String prefix;
private boolean ignoreCdmLibVersion;
this.ignoreCdmLibVersion = ignoreCdmLibVersion;
}
- public CdmServerInfoConfig() {
-
+ public CdmServerInfoConfig(String name) {
+ this.name = name;
+ this.server = "";
+ this.port = null;
+ this.prefix = "";
+ this.ignoreCdmLibVersion = false;
}
-
+ public CdmServerInfoConfig() {
+ }
+
public String getName() {
return name;
}
this.server = server;
}
- public int getPort() {
+ public Integer getPort() {
return port;
}
- public void setPort(int port) {
+ public void setPort(Integer port) {
this.port = port;
}
import org.springframework.stereotype.Component;
-import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
private List<String> getPropertyPaths(Object obj) {
List<String> propertyPaths = null;
ICdmEntitySession cdmEntitySession =
- ((CdmApplicationRemoteController)CdmApplicationState.getCurrentAppConfig()).getCdmEntitySessionManager().getActiveSession();
+ CdmApplicationState.getCurrentAppConfig().getCdmEntitySessionManager().getActiveSession();
if(cdmEntitySession != null) {
propertyPaths = cdmEntitySession.getPropertyPaths(obj);
}
public boolean containsValue(UUID ownerUuid, String fieldName, Object element) {
return CdmApplicationState.getCurrentAppConfig().getCommonService().containsValue(ownerUuid, fieldName, element);
}
-
-}
+}
\ No newline at end of file
import org.springframework.remoting.support.RemoteInvocation;
import org.springframework.remoting.support.RemoteInvocationResult;
-import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.term.TermType;
*/
public class RemoteInvocationTermCacher implements IRemoteInvocationTermCacher {
- private static final Logger logger = LogManager.getLogger(RemoteInvocationTermCacher.class);
+ private static final Logger logger = LogManager.getLogger();
private static Map<TermType, RemoteInvocationResult> termTypeMap = new HashMap<>();
- private static CdmServiceCacher cdmServiceCacher;
+ private static CdmServiceCachingProxy termCachingProxy;
- public static void setDefaultCacher(CdmServiceCacher csc) {
- cdmServiceCacher = csc;
+ public static void setDefaultCacher(CdmServiceCachingProxy termCache) {
+ termCachingProxy = termCache;
}
@Override
public void cacheTerms(RemoteInvocation remoteInvoc, RemoteInvocationResult remoteInvocResul) {
- if(cdmServiceCacher != null) {
+ if(termCachingProxy != null) {
if(remoteInvoc.getMethodName().equals("listByTermType")) {
if(remoteInvoc.getArguments()[1] == null) {
Set<DefinedTermBase<?>> terms = new HashSet<>();
terms.addAll((List<DefinedTermBase<?>>)remoteInvocResul.getValue());
for(DefinedTermBase<?> term : terms) {
- cdmServiceCacher.load(term);
+ termCachingProxy.load(term);
}
termTypeMap.put((TermType)remoteInvoc.getArguments()[0], remoteInvocResul);
}
}
@Override
- public RemoteInvocationResult termsFromCache(RemoteInvocation ri) {
- return termTypeMap.get(ri.getArguments()[0]);
+ public RemoteInvocationResult termsFromCache(RemoteInvocation remoteInvocation) {
+ return termTypeMap.get(remoteInvocation.getArguments()[0]);
}
}
\ No newline at end of file
setExecutionRequestClientTimestamp(httpPost.getURI());
- HttpResponse respone = super.executeHttpPost(config, httpClient, httpPost);
+ HttpResponse response = super.executeHttpPost(config, httpClient, httpPost);
- setExecutionResponseHttpHeaderTimestamp(respone);
+ setExecutionResponseHttpHeaderTimestamp(response);
- return respone;
+ return response;
}
private void setExecutionRequestClientTimestamp(URI requestURI){
String dateTimeStr = date.format(DateTimeFormatter.ISO_DATE_TIME);
RemoteExecutionTimestampsUtil.setLastRequestClientTime(dateTimeStr);
if(requestURI != null){
- RemoteExecutionTimestampsUtil.setLastServiceMethod(requestURI.toString());
+ RemoteExecutionTimestampsUtil.setLastService(requestURI.toString());
}
}
import java.util.Map;
import java.util.UUID;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import eu.etaxonomy.cdm.api.service.IService;
import eu.etaxonomy.cdm.api.service.UpdateResult;
*/
public class CdmEntitySession implements ICdmEntitySession {
- private static final Logger logger = LogManager.getLogger(CdmEntitySession.class);
+ private static final Logger logger = LogManager.getLogger();
private final CdmEntitySessionManager cdmEntitySessionManager;
- private final ICdmEntitySessionEnabled sessionOwner;
+ private final ICdmEntitySessionEnabled<?> sessionOwner;
private ConversationalTransientEntityCacher cdmTransientEntityCacher;
- private List<ICdmEntitySessionEnabled> changeObservers;
+ private List<ICdmEntitySessionEnabled<?>> changeObservers;
- public CdmEntitySession(ICdmEntitySessionEnabled sessionOwner, CdmEntitySessionManager cdmEntitySessionManager) {
+ public CdmEntitySession(ICdmEntitySessionEnabled<?> sessionOwner, CdmEntitySessionManager cdmEntitySessionManager) {
this.sessionOwner = sessionOwner;
this.cdmEntitySessionManager = cdmEntitySessionManager;
init(sessionOwner, cdmEntitySessionManager);
}
- private void init(ICdmEntitySessionEnabled sessionOwner, CdmEntitySessionManager cdmEntitySessionManager) {
+ private void init(ICdmEntitySessionEnabled<?> sessionOwner, CdmEntitySessionManager cdmEntitySessionManager) {
this.cdmTransientEntityCacher = new ConversationalTransientEntityCacher(sessionOwner);
this.changeObservers = new ArrayList<>();
cdmEntitySessionManager.addToOwnerSessionMap(sessionOwner, this);
@Override
public <T extends CdmBase> Collection<T> getRootEntities() {
- return sessionOwner.getRootEntities();
+ return getOwner().getRootEntities();
}
public CdmTransientEntityCacher getCacher() {
import java.util.Map;
import java.util.Set;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Component;
import eu.etaxonomy.cdm.api.service.UpdateResult;
@Component
public class CdmEntitySessionManager implements ICdmEntitySessionManager {
- private static final Logger logger = LogManager.getLogger(CdmEntitySessionManager.class);
+ private static final Logger logger = LogManager.getLogger();
- private final Map<ICdmEntitySessionEnabled, ICdmEntitySession> ownerSessionMap = new HashMap<>();
+ private final Map<ICdmEntitySessionEnabled<?>, ICdmEntitySession> ownerSessionMap = new HashMap<>();
private final List<ICdmEntitySessionManagerObserver> sessionObservers = new ArrayList<>();
- //private ICdmEntitySession activeSession;
-
private final InheritableThreadLocal<ICdmEntitySession> tlActiveSession = new InheritableThreadLocal<>();
private NullSession nullSession;
}
@Override
- public ICdmEntitySession newSession(ICdmEntitySessionEnabled sessionOwner, boolean setAsActive) {
+ public ICdmEntitySession newSession(ICdmEntitySessionEnabled<?> sessionOwner, boolean setAsActive) {
ICdmEntitySession session = ownerSessionMap.get(sessionOwner);
if(session == null) {
session = new CdmEntitySession(sessionOwner, this);
}
private void setActiveSession(ICdmEntitySession activeSession) {
- this. tlActiveSession.set(activeSession);
+ this.tlActiveSession.set(activeSession);
notifyObservers();
}
}
@Override
- public void bind(ICdmEntitySessionEnabled sessionOwner) {
+ public void bind(ICdmEntitySessionEnabled<?> sessionOwner) {
if(sessionOwner == null) {
setActiveSession(null);
return;
}
- ICdmEntitySession session = ownerSessionMap.get(sessionOwner);
+ ICdmEntitySession session = ownerSessionMap.get(sessionOwner);
if(session == null) {
throw new CdmClientSessionException("Trying to bind session which does not exist");
}
}
@Override
- public boolean contains(ICdmEntitySessionEnabled sessionOwner) {
+ public boolean contains(ICdmEntitySessionEnabled<?> sessionOwner) {
return ownerSessionMap.containsKey(sessionOwner);
}
@Override
public <T extends Object> T load(T obj, boolean update) {
- if(tlActiveSession.get() == null) {
+ ICdmEntitySession session = tlActiveSession.get();
+ if(session == null) {
return obj;
} else {
- return tlActiveSession.get().load(obj, update);
+ return session.load(obj, update);
}
}
return tlActiveSession.get().load(cdmBaseList, update);
}
- void remove(ICdmEntitySessionEnabled owner) {
+ void remove(ICdmEntitySessionEnabled<?> owner) {
ICdmEntitySession session = ownerSessionMap.get(owner);
if(session == null) {
logger.info("No Session connected to owner, nothing to do");
}
@Override
- public void dispose(ICdmEntitySessionEnabled owner) {
+ public void dispose(ICdmEntitySessionEnabled<?> owner) {
ICdmEntitySession session = ownerSessionMap.get(owner);
if(session != null) {
session.dispose();
@Override
public void disposeAll() {
- Set<ICdmEntitySessionEnabled> owners =
- new HashSet<ICdmEntitySessionEnabled>(ownerSessionMap.keySet());
- for(ICdmEntitySessionEnabled owner : owners) {
+ Set<ICdmEntitySessionEnabled<?>> owners =
+ new HashSet<>(ownerSessionMap.keySet());
+ for(ICdmEntitySessionEnabled<?> owner : owners) {
ICdmEntitySession session = ownerSessionMap.get(owner);
if(session != null) {
session.dispose();
}
}
- public void addToOwnerSessionMap(ICdmEntitySessionEnabled owner, ICdmEntitySession session) {
+ public void addToOwnerSessionMap(ICdmEntitySessionEnabled<?> owner, ICdmEntitySession session) {
ownerSessionMap.put(owner, session);
notifyObservers();
}
sessionObserver.changed();
}
}
-
- @Override
- public boolean isRemoting() {
- // FIXME:Remoting stupid method to check whether we are in remoting
- return true;
- }
-
-}
-
+}
\ No newline at end of file
+/**
+ * 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.session;
import java.util.Collection;
* @param setAsActive if
* @return the new session
*/
- public abstract ICdmEntitySession newSession(ICdmEntitySessionEnabled sessionOwner, boolean setAsActive);
+ public abstract ICdmEntitySession newSession(ICdmEntitySessionEnabled<?> sessionOwner, boolean setAsActive);
/**
* Makes the {@link NullSession} the active session.
*
* @param sessionOwner
*/
- public abstract void bind(ICdmEntitySessionEnabled sessionOwner);
+ public abstract void bind(ICdmEntitySessionEnabled<?> sessionOwner);
/**
* Loads an object intto the active session and returns the cached object
public void addSessionObserver(ICdmEntitySessionManagerObserver sessionObserver);
- public boolean isRemoting();
-
- public void dispose(ICdmEntitySessionEnabled owner);
+ public void dispose(ICdmEntitySessionEnabled<?> owner);
public void disposeAll();
* @param sessionOwner the session owner
* @return <code>true</code> if a session exists
*/
- public boolean contains(ICdmEntitySessionEnabled sessionOwner);
+ public boolean contains(ICdmEntitySessionEnabled<?> sessionOwner);
/**
* Returns the {@link NullSession} singleton instance (within this session manager)
+++ /dev/null
-/**
-* Copyright (C) 2015 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.session.mock;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
-
-import eu.etaxonomy.cdm.api.service.IService;
-import eu.etaxonomy.cdm.api.service.UpdateResult;
-import eu.etaxonomy.cdm.cache.EntityCacherDebugResult;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.persistence.dto.MergeResult;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
-import net.sf.ehcache.statistics.FlatStatistics;
-
-/**
- * @author cmathew
- * @date 29 Jan 2015
- */
-public class MockCdmEntitySession implements ICdmEntitySession {
-
- @Override
- public <O extends Object> O load(O obj, boolean update) {
- return obj;
- }
-
- @Override
- public <T extends CdmBase> T load(T cdmBase, boolean update) {
- return cdmBase;
- }
-
- @Override
- public <T extends CdmBase> Collection<T> load(Collection<T> cdmBaseList, boolean update) {
- return cdmBaseList;
- }
-
- @Override
- public void setEntitiesAsLatest() {
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void bind() {
- }
-
- @Override
- public <T extends CdmBase> EntityCacherDebugResult debug(T cdmBase) {
- return new EntityCacherDebugResult();
- }
-
-
- @Override
- public <T extends CdmBase> T remoteLoad(IService<T> service, UUID uuid) {
- return service.load(uuid);
- }
-
- @Override
- public <T extends CdmBase> T remoteLoad(IService<T> service, UUID uuid, List<String> propertyPaths) {
- return service.load(uuid, propertyPaths);
- }
-
- @Override
- public <T extends CdmBase> UUID remoteSave(IService<T> service, T cdmBase) {
- return service.save(cdmBase).getUuid();
- }
-
- @Override
- public <T extends CdmBase> T remoteUpdate(IService<T> service, T cdmBase) {
- return cdmBase;
- }
-
- @Override
- public ICdmEntitySessionEnabled getOwner() {
- return null;
- }
-
- @Override
- public FlatStatistics getCacheStatistics() {
- return null;
- }
-
- @Override
- public boolean isActive() {
- return false;
- }
-
- @Override
- public <T extends CdmBase> List<T> getRootEntities() {
- return null;
- }
-
- @Override
- public <T extends CdmBase> EntityCacherDebugResult debug(Collection<T> cdmBase, boolean includeIgnored) {
- return null;
- }
-
- @Override
- public <T extends CdmBase> EntityCacherDebugResult debug(boolean includeIgnored) {
- return null;
- }
-
- @Override
- public <T extends CdmBase> void update() {
- }
-
- @Override
- public UpdateResult load(UpdateResult updateResult, boolean update) {
- return updateResult;
- }
-
- @Override
- public List<String> getPropertyPaths(Object obj) {
- return null;
- }
-
- @Override
- public void addNewCdmEntity(CdmBase newEntity) {
- }
-
- @Override
- public <T extends CdmBase> MergeResult<T> load(MergeResult<T> mergeResult, boolean update) {
- return mergeResult;
- }
-}
\ No newline at end of file
+++ /dev/null
-/**
-* Copyright (C) 2015 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.session.mock;
-
-import java.util.Collection;
-
-import eu.etaxonomy.cdm.api.service.UpdateResult;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.common.ICdmBase;
-import eu.etaxonomy.cdm.persistence.dto.MergeResult;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver;
-
-public class MockCdmEntitySessionManager implements ICdmEntitySessionManager {
-
- @Override
- public void bind(ICdmEntitySessionEnabled sessionOwner) {
- }
-
- @Override
- public <T> T load(T obj, boolean update) {
- return obj;
- }
-
- @Override
- public <T extends CdmBase> T load(T obj, boolean update) {
- return obj;
- }
-
- @Override
- public <T extends CdmBase> Collection<T> load(Collection<T> cdmBaseList, boolean update) {
- return cdmBaseList;
- }
-
- @Override
- public ICdmEntitySession newSession(ICdmEntitySessionEnabled sessionOwner, boolean setAsActive) {
- return new MockCdmEntitySession();
- }
-
- @Override
- public ICdmEntitySession getActiveSession() {
- return new MockCdmEntitySession();
- }
-
- @Override
- public Collection<ICdmEntitySession> getSessions() {
- return null;
- }
-
- @Override
- public void addSessionObserver(ICdmEntitySessionManagerObserver sessionObserver) {
-
- }
-
- @Override
- public boolean isRemoting() {
- return false;
- }
-
- @Override
- public void dispose(ICdmEntitySessionEnabled owner) {
- }
-
- @Override
- public void disposeAll() {
- }
-
- @Override
- public <T extends CdmBase> void update() {
- }
-
- @Override
- public UpdateResult load(UpdateResult updateResult, boolean update) {
- return updateResult;
- }
-
- @Override
- public boolean contains(ICdmEntitySessionEnabled sessionOwner) {
- return false;
- }
-
- @Override
- public ICdmEntitySession bindNullSession() {
- return new MockCdmEntitySession();
- }
-
- @Override
- public ICdmEntitySession getNullSession() {
- return new MockCdmEntitySession();
- }
-
- @Override
- public <T extends ICdmBase> MergeResult<T> load(MergeResult<T> mergeResult, boolean update) {
- return mergeResult;
- }
-}
\ No newline at end of file
if (getOwner() != null && !initialized) {
Object collectionType = null;
Field field = null;
+ String fieldName = null;
Class<?> clazz = null;
String codePart = "1";
try {
String role = getRole();
- String fieldName = role.substring(role.lastIndexOf(".") + 1);
+ fieldName = role.substring(role.lastIndexOf(".") + 1);
LOG.info("--> Remote Lazy Initializing Collection " + getRole() + " , owner : " + getOwner().getClass() + "/" + getKey() + " , field : " + fieldName);
Object owner = getOwner();
CdmBase cdmBase;
}
} catch (Exception ex) {
String originalMessage = ex.getMessage();
- String message = originalMessage + ", clazz: " + (clazz == null? "" :clazz.getSimpleName())+ ", field: " + field + ", collectionType: " + collectionType + ", at code part: " + codePart;
+ String message = originalMessage + ", clazz: " + (clazz == null? "" :clazz.getSimpleName())+ ", field: " + field != null? field.getName(): fieldName + ", collectionType: " + collectionType + ", at code part: " + codePart;
throw new CdmEagerLoadingException(message);
}
}
*/
package org.springframework.remoting.httpinvoker;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
import java.util.HashSet;
import java.util.Set;
import org.springframework.remoting.support.RemoteInvocation;
import org.springframework.remoting.support.RemoteInvocationResult;
-import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.taxeditor.remoting.RemoteExecutionTimestampsUtil;
import eu.etaxonomy.taxeditor.service.IRemoteInvocationTermCacher;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
persistingMethods.add("findWithUpdate");
persistingMethods.add("loadWithUpdate");
measureDuration = System.getProperty(PROP_KEY_MEASURE_DURATION) != null;
+ //measureDuration = true;
}
@Override
}
// A) if this is a term service call for term lists try to get the terms from the cache
- if(ITermService.class.isAssignableFrom(originalInvocation.getMethod().getDeclaringClass())){
+
+
+ if(ITermService.class.isAssignableFrom(this.getServiceInterface())){
return handleTermRequest(invocation, originalInvocation);
}
// B) handle other service calls
//Note AM (2022-06-15): the debug information seem to be misleading (also because cache() is not used/implemented anymore)
if(persistingMethods.contains(invocation.getMethodName())) {
invocationResult = new RemoteInvocationResult(cdmEntitySessionManager().load(invocationResult.getValue(), true));
- logger.debug("Entity cached with updating cached data");
+ if (logger.isDebugEnabled()){logger.debug("Entity cached with updating cached data");}
} else if(invocationResult.getValue() instanceof UpdateResult){
UpdateResult result = (UpdateResult)invocationResult.getValue();
if(result.isOk()){
- logger.debug("Entity from UpdateResult stored in cache with updating cached data" );
+ if (logger.isDebugEnabled()){logger.debug("Entity from UpdateResult stored in cache with updating cached data" );}
try {
cdmEntitySessionManager().load(result, true);
} catch (Exception e) {
}
} else {
invocationResult = new RemoteInvocationResult(cdmEntitySessionManager().load(invocationResult.getValue(), false));
- logger.debug("Entity cached without updating cached data" );
+ if (logger.isDebugEnabled()){logger.debug("Entity cached without updating cached data" );}
}
}
cache(invocation, invocationResult);
String message = "Error when caching terms in TaxEditor";
throw new RuntimeException(message, e);
}
- logger.debug("Term list loaded and cached");
+ logger.warn("Term list loaded and cached");
} else {
logger.debug("Term list found in cache, not loaded");
}
startTime = System.currentTimeMillis();
}
try {
+ //setLastMethod can not be done later as invocation is not avaiable later or super class method are final
+ RemoteExecutionTimestampsUtil.setLastMethod(invocation.getMethodName());
RemoteInvocationResult result = super.executeRequest(invocation, originalInvocation);
if(measureDuration){
double duration = System.currentTimeMillis() - startTime;
- logger.info(getServiceUrl() + "#" + invocation.getMethodName() + " [" + duration + " ms]");
+
+ LocalDateTime date = LocalDateTime.now();
+ String dateTimeStr = date.format(DateTimeFormatter.ISO_DATE_TIME);
+ System.out.println(dateTimeStr + ": "+ getServiceUrl() + "#" + invocation.getMethodName() + " [" + duration + " ms]");
+ logger.info(dateTimeStr + getServiceUrl() + "#" + invocation.getMethodName() + " [" + duration + " ms]");
}
return result;
} catch(Exception e) {
private ICdmEntitySessionManager cdmEntitySessionManager(){
if(cdmEntitySessionManager == null) {
cdmEntitySessionManager =
- ((CdmApplicationRemoteController)CdmApplicationState.getCurrentAppConfig()).getCdmEntitySessionManager();
+ CdmApplicationState.getCurrentAppConfig().getCdmEntitySessionManager();
}
return cdmEntitySessionManager;
}
<File name="A1" fileName="A1.log" append="true">
<XMLLayout/> <!-- maybe we need to add jackson-dataformat-xml dependency for this -->
</File>
- <Console name="STDOUT" target="System.out">
+ <!-- <Console name="STDOUT" target="System.out">
<PatternLayout pattern="%d %p [%c] - %m%n"/>
<Filters>
<RegexFilter regex=".*has a maxElementsInMemory of 0. This might lead to performance degradation or OutOfMemoryError at Terracotta client.*"
<RegexFilter regex=".*object references was reached while attempting to calculate the size of the object graph.*"
onMatch="DENY"/>
</Filters>
- </Console>
+ </Console>-->
</Appenders>
<Loggers>
<Root level="warn">
<Logger name="eu.etaxonomy.taxeditor.handler.update.UpdateHandler" level="info"/>
<Logger name="org.eclipse.equinox.p2.operations.ProvisioningSession" level="info"/>
<Logger name="org.eclipse.equinox.internal.p2.engine.ProvisioningPlan" level="info"/>
-
+ <Logger name="org.springframework.remoting.httpinvoker.CachingHttpInvokerProxyFactoryBean" level="info"/>
<!-- ### NOT USED
<Logger name="org.hibernate.proxy.AbstractLazyInitializer" level="info"/>
<Logger name="org.hibernate.collection.internal.AbstractPersistentCollection" level="info"/>
Bundle-ManifestVersion: 2
Bundle-Name: Editor Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.editor;singleton:=true
-Bundle-Version: 5.34.0
+Bundle-Version: 5.42.0
Bundle-Activator: eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: OSGI-INF/l10n/plugin
org.eclipse.e4.core.commands,
org.eclipse.e4.core.services,
org.eclipse.e4.core.contexts,
+ org.eclipse.equinox.p2.ui,
org.eclipse.nebula.widgets.nattable.core,
org.eclipse.nebula.widgets.nattable.extension.glazedlists,
org.eclipse.nebula.widgets.nattable.extension.e4;bundle-version="1.1.0",
command.name.132 = Move Fact(s) to other Taxon and set Name in Sources if empty\r
command.label.132 = Move Fact(s) to other Taxon and set Name in Sources if empty\r
command.name.12 = Move Fact(s) to other Taxon\r
+command.name.133 = Set as default factual data set\r
category.name.2 = -- New Uses\r
command.name.14 = New Use\r
command.name.15 = New Use Summary\r
command.label.29 = Verschiebe Fakt(en) zu anderem Taxon
command.label.30 = L\u00f6schen
command.label.31 = Speichern
+command.name.133 = Setze Faktendaten-Set als Default
menu.label.2 = Neue Derivate
command.label.32 = Neue Nutzung
command.label.33 = Neue Zusammenfassung
<handlers xmi:id="_tc-7wLy2EeioE565ihOF2g" elementId="eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.CreateDescriptionWithSourceHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.CreateDescriptionWithSourceHandler" command="_Z51sQLy2EeioE565ihOF2g"/>
<handlers xmi:id="_i7ovoL9OEemCian_vXpNsA" elementId="eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.MoveDescriptionToOtherTaxonHandlerSetNameInSource" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.MoveDescriptionToOtherTaxonSetNameInSourceHandlerE5" command="_yknsIL9NEemCian_vXpNsA"/>
<handlers xmi:id="_GakGYL9PEemCian_vXpNsA" elementId="eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.MoveDescriptionElementsHandlerSetNameInSource" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.MoveDescriptionElementsSetNameInSourceHandlerE5" command="__8WFwL9OEemCian_vXpNsA"/>
+ <handlers xmi:id="_BKqkwGQfEe6yp7ON-qKPbg" elementId="eu.etaxonomy.taxeditor.editor.handler.5" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.SetDefaultDescriptionHandler" command="_ZyKbwGQbEe6yp7ON-qKPbg"/>
<menus xsi:type="menu:PopupMenu" xmi:id="_HxxDt4GxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.factualDataView">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_bMfdYIG5EeehlNPrK_b5JA" coreExpressionId="isCdmStoreConnected"/>
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_2t3BgIHWEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.DynamicFeatureMenuE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.DynamicFeatureMenuE4"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_qVkKkL9OEemCian_vXpNsA" elementId="eu.etaxonomy.taxeditor.editor.factualData.moveDescriptionElementSetNameInSource" label="%command.label.132" command="__8WFwL9OEemCian_vXpNsA"/>
<children xsi:type="menu:MenuSeparator" xmi:id="_pOAxAIGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.10"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_rLS9EIGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.factualData.delete" label="%command.label.30" command="_AqgMcIG5EeehlNPrK_b5JA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_HRQIgGQfEe6yp7ON-qKPbg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandname133" label="%command.name.133" command="_ZyKbwGQbEe6yp7ON-qKPbg"/>
</menus>
<toolbar xmi:id="_sfp2sL2jEeeyWfw0n8-ICQ" elementId="eu.etaxonomy.taxeditor.editor.toolbar.0">
<children xsi:type="menu:HandledToolItem" xmi:id="_t7kbEL2jEeeyWfw0n8-ICQ" elementId="eu.etaxonomy.taxeditor.editor.handledtoolitem.factual.showIndividualAssociations" label="%command.name.41" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/link_obj.gif" type="Check" command="_4eDWoIy0EeeQaL4TL8oz7Q"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_KT8rYIZ5EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel44" label="%command.label.44" command="_Ob4xIIZ5EeeOc9DZcjNN7g"/>
</menus>
</elements>
- <elements xsi:type="basic:PartDescriptor" xmi:id="_tLceMIl4Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4" label="%partdescriptor.label.2" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/edit_16x16.gif" tooltip="" allowMultiple="true" category="" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4">
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_tLceMIl4Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor" label="%partdescriptor.label.2" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/edit_16x16.gif" tooltip="" allowMultiple="true" category="" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor">
<tags>View</tags>
<tags>nonRestore</tags>
<handlers xmi:id="_tLceQIl4Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.handler.SaveHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.workbench/eu.etaxonomy.taxeditor.workbench.SaveHandler" command="_majwMEaQEeeXMc6kSYO7Xg"/>
- <handlers xmi:id="_DCv88IvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHeterotypicSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHeterotypicSynonymHandlerE4" command="_ult4EIvOEee7R4eqeQiXZg"/>
- <handlers xmi:id="_OqNIQIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHomotypicSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHomotypicSynonymHandlerE4" command="_KpUFsIvPEee7R4eqeQiXZg"/>
- <handlers xmi:id="_XFc2QIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateSynonymInHomotypicalGroupHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateSynonymInHomotypicalGroupHandlerE4" command="_VPLRIIvPEee7R4eqeQiXZg"/>
- <handlers xmi:id="_ffY8sIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateMisapplicationHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateMisapplicationHandlerE4" command="_c0byUIvPEee7R4eqeQiXZg"/>
- <handlers xmi:id="_qKP84IvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeSynonymToAcceptedTaxonHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeSynonymToAcceptedTaxonHandlerE4" command="_oBnccIvPEee7R4eqeQiXZg"/>
- <handlers xmi:id="_14GrIIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToSynonymHandlerE4" command="_yh49QIvPEee7R4eqeQiXZg"/>
- <handlers xmi:id="_8Lzd0IvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToMisapplicationHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToMisapplicationHandlerE4" command="_56AaUIvPEee7R4eqeQiXZg"/>
- <handlers xmi:id="_GTxMUIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteTaxonBaseHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteTaxonBaseHandlerE4" command="_CoVcYIvQEee7R4eqeQiXZg"/>
- <handlers xmi:id="_OZLNMIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteAllEmptyNamesHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteAllEmptyNamesHandlerE4" command="_L4vQwIvQEee7R4eqeQiXZg"/>
- <handlers xmi:id="_WWqoMIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.SwapSynonymAndAcceptedHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.SwapSynonymAndAcceptedHandlerE4" command="_UFDx8IvQEee7R4eqeQiXZg"/>
- <handlers xmi:id="_edkd4IvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.SetBasionymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.SetBasionymHandlerE4" command="_b2nCsIvQEee7R4eqeQiXZg"/>
- <handlers xmi:id="_lv9GYIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.MoveSynonymToAnotherAcceptedTaxonHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.MoveSynonymToAnotherAcceptedTaxonHandlerE4" command="_jNvBQIvQEee7R4eqeQiXZg"/>
- <handlers xmi:id="_g8QScFgWEeiQk_eTMvMviQ" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateProParteSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateProParteSynonymHandlerE4" command="_HSKdYFgXEeiQk_eTMvMviQ"/>
- <handlers xmi:id="_442rEFj-EeiQk_eTMvMviQ" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToProParteSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToProParteSynonymHandlerE5" command="_BgX6gFj_EeiQk_eTMvMviQ"/>
+ <handlers xmi:id="_DCv88IvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHeterotypicSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHeterotypicSynonymHandler" command="_ult4EIvOEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_OqNIQIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHomotypicSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHomotypicSynonymHandler" command="_KpUFsIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_XFc2QIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateSynonymInHomotypicalGroupHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateSynonymInHomotypicalGroupHandler" command="_VPLRIIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_ffY8sIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateMisapplicationHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateMisapplicationHandler" command="_c0byUIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_qKP84IvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeSynonymToAcceptedTaxonHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeSynonymToAcceptedTaxonHandler" command="_oBnccIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_14GrIIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToSynonymHandler" command="_yh49QIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_8Lzd0IvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToMisapplicationHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToMisapplicationHandler" command="_56AaUIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_GTxMUIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteTaxonBaseHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteTaxonBaseHandler" command="_CoVcYIvQEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_OZLNMIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteAllEmptyNamesHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteAllEmptyNamesHandler" command="_L4vQwIvQEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_WWqoMIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.SwapSynonymAndAcceptedHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.SwapSynonymAndAcceptedHandler" command="_UFDx8IvQEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_edkd4IvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.SetBasionymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.SetBasionymHandler" command="_b2nCsIvQEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_lv9GYIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.MoveSynonymToAnotherAcceptedTaxonHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.MoveSynonymToAnotherAcceptedTaxonHandler" command="_jNvBQIvQEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_g8QScFgWEeiQk_eTMvMviQ" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateProParteSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateProParteSynonymHandler" command="_HSKdYFgXEeiQk_eTMvMviQ"/>
+ <handlers xmi:id="_442rEFj-EeiQk_eTMvMviQ" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToProParteSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToProParteSynonymHandler" command="_BgX6gFj_EeiQk_eTMvMviQ"/>
<handlers xmi:id="_MYvcYL9MEemCian_vXpNsA" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.SwapSynonymAndAcceptedHandlerE4SetNameInSource" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.SwapSynonymAndAcceptedSetNameInSourceHandlerE5" command="_tuB4AL9KEemCian_vXpNsA"/>
<menus xsi:type="menu:PopupMenu" xmi:id="_tLceQYl4Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.nameeditor">
<children xsi:type="menu:Menu" xmi:id="_R6buoIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menu.new" label="%menu.label">
<elements xsi:type="commands:Command" xmi:id="_zCGQ8JN1EeqyUKRuXQ8miw" elementId="eu.etaxonomy.taxeditor.editor.charactermatrix.command.addDescription" commandName="%command.commandname.25"/>
<elements xsi:type="commands:Command" xmi:id="_K2C_oKZAEeq8Gc-K2nsNRg" elementId="eu.etaxonomy.taxeditor.editor.command.aggregation" commandName="%command.commandname.26"/>
<elements xsi:type="commands:Command" xmi:id="_vWxB4KoiEeqBXdGXVmg_xA" elementId="eu.etaxonomy.taxeditor.editor.command.create_key" commandName="%command.commandname.27"/>
+ <elements xsi:type="commands:Command" xmi:id="_ZyKbwGQbEe6yp7ON-qKPbg" elementId="eu.etaxonomy.taxeditor.editor.view.descriptive.e4.command.SetDefaultDescription" commandName="%command.name.133"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_pZmusEalEeeXMc6kSYO7Xg" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:eu.etaxonomy.taxeditor.workbench.menuseparator.navigation">
<elements xsi:type="menu:HandledMenuItem" xmi:id="_FPIHQKNwEeebGZ23ERGMGw" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.conceptGraph" label="%view.name.3" iconURI="" tooltip="%view.name.3" command="_WPjpoDSnEeek0dKsFNy--Q">
<elements xsi:type="commands:Handler" xmi:id="_HN2_oJN2EeqyUKRuXQ8miw" elementId="eu.etaxonomy.taxeditor.editor.handler.addDescription" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.handler.AddDescriptionHandler" command="_gE3lwIGyEeehlNPrK_b5JA"/>
<elements xsi:type="commands:Handler" xmi:id="_EBL2EKY_Eeq8Gc-K2nsNRg" elementId="eu.etaxonomy.taxeditor.editor.handler.aggregate" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.handler.AggregationHandler" command="_K2C_oKZAEeq8Gc-K2nsNRg"/>
<elements xsi:type="commands:Handler" xmi:id="_4HDLwKoiEeqBXdGXVmg_xA" elementId="eu.etaxonomy.taxeditor.editor.handler.create_key" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.handler.GeneratePolytomousKeyHandler" command="_vWxB4KoiEeqBXdGXVmg_xA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_FET3MGQcEe6yp7ON-qKPbg" elementId="eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.SetDefaultDescription" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.SetDefaultDescriptionHandler" command="_ZyKbwGQbEe6yp7ON-qKPbg"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_OyvD8KNOEee5fYT78qEx0A" featurename="children" parentElementId="bulkeditor.menus.openmenu" positionInList="before:eu.etaxonomy.taxeditor.bulkeditor.handledmenuitem.specimen">
<elements xsi:type="menu:HandledMenuItem" xmi:id="_SZZBkKNOEee5fYT78qEx0A" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.specimen_editor" label="%command.label.DERIVATIVE_EDITOR" tooltip="%command.label.DERIVATIVE_EDITOR" command="_PDjFMLsKEeeQJq8FDGEi1g">
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.34.0</version>
+ <version>5.42.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_GROUP_AUTHORITY_E4_CDMAUTHORITYEDITORE4 = "eu.etaxonomy.taxeditor.editor.group.authority.e4.CdmAuthorityEditorE4";
public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_KEY_POLYTOMOUS_E4_POLYTOMOUSKEYGRAPHEDITORE4 = "eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyGraphEditorE4";
public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_KEY_POLYTOMOUS_E4_POLYTOMOUSKEYLISTEDITORE4 = "eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4";
- public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_TAXONNAMEEDITORE4 = "eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_TAXONEDITOR= "eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor";
//public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_CHECKLIST_E4_CHECKLISTEDITORE4 = "eu.etaxonomy.taxeditor.editor.view.checklist.e4.ChecklistEditorE4";
public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_CHECKLIST_E4_DISTRIBUTIONEDITORPART = "eu.etaxonomy.taxeditor.editor.view.checklist.e4.DistributionEditorPart";
public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_CONCEPT_E4_CONCEPTVIEWPARTE4 = "eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4";
import java.util.Set;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.ListDialog;
* @created 19.03.2009
*/
public class ChooseFromMultipleTaxonNodesDialog extends ListDialog {
+ Button okButton;
public static TaxonNode choose(Set<TaxonNode> taxonNodes){
ChooseFromMultipleTaxonNodesDialog dialog = new ChooseFromMultipleTaxonNodesDialog(EditorUtil.getShell());
dialog.setInput(taxonNodes);
+
int result = dialog.open();
- if(result == IStatus.OK){
+ if(result == IStatus.OK ){
Classification selectedClassification = (Classification) dialog.getResult()[0];
-
for(TaxonNode taxonNode : taxonNodes){
if(taxonNode.getClassification().equals(selectedClassification)){
return taxonNode;
}
return null;
}
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ okButton.setEnabled(false);
+ }
public ChooseFromMultipleTaxonNodesDialog(Shell parent) {
super(parent);
setTitle(Messages.ChooseFromMultipleTaxonNodesDialog_CHOOSE_CLASSIFICATION);
setMessage(Messages.ChooseFromMultipleTaxonNodesDialog_CHOOSE_CLASSIFICATION_MESSAGE);
setContentProvider(new ClassificationContentProvider());
- setLabelProvider(new ClassificationLabelProvider());
+ setLabelProvider(new ClassificationLabelProvider());
}
+ @Override
+ public void create() {
+ super.create();
+ this.getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection s = (IStructuredSelection) event.getSelection();
+ Object obj = s.getFirstElement();
+ if (obj != null) {
+ okButton.setEnabled(true);
+ }
+ }
+ });
+ }
+
private class ClassificationLabelProvider extends LabelProvider{
@Override
public String getText(Object element) {
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
+ }
+
}
}
\ No newline at end of file
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditor;
-import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonBulkEditorInput;
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.DescriptiveDataSetEditor;
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.CharacterMatrixPart;
-import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInput;
import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditorInput;
import eu.etaxonomy.taxeditor.editor.group.authority.e4.CdmAuthorityEditorE4;
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.checklist.e4.DistributionEditorPart;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
*/
public class EditorUtil extends AbstractUtility {
- private static final String NAME_EDITOR_ID = "eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4";
+ private static final String NAME_EDITOR_ID = "eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor";
private static boolean factsVisible = true;
}
return partService.showPart(part, PartState.ACTIVATE);
-
}
public static MPart showPart(String partId, EModelService modelService, EPartService partService){
}
public static void openTaxonNodeE4(UUID taxonNodeUuid, EModelService modelService, EPartService partService, MApplication application) {
- TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstance(taxonNodeUuid);
- openNameEditor_internal(input, modelService, partService, application);
+ TaxonEditorInput input = TaxonEditorInput.NewInstance(taxonNodeUuid);
+ openTaxonEditor_internal(input, modelService, partService, application);
}
public static void openTaxonBaseE4(UUID taxonBaseUuid, EModelService modelService, EPartService partService, MApplication application) {
- TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstanceFromTaxonBase(taxonBaseUuid);
- openNameEditor_internal(input, modelService, partService, application);
+ TaxonEditorInput input = TaxonEditorInput.NewInstanceFromTaxonBase(taxonBaseUuid);
+ openTaxonEditor_internal(input, modelService, partService, application);
}
- public static void openTaxonBaseE4(UUID taxonBaseUuid) {
- //FIXME E4 this can probably be removed when fully migrated
- TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstanceFromTaxonBase(taxonBaseUuid);
-
- EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
- EModelService modelService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EModelService.class);
- openNameEditor_internal(input, modelService, partService, null);
- }
-
- private static void openNameEditor_internal(TaxonEditorInputE4 input, EModelService modelService, EPartService partService, MApplication application) {
+ private static void openTaxonEditor_internal(TaxonEditorInput input, EModelService modelService, EPartService partService, MApplication application) {
TaxonBase<?> taxonBase = input.getTaxon();
TaxonNode node = input.getTaxonNode();
- if(taxonBase==null){
+ if(taxonBase == null){
return;
}
boolean hasPermission = false;
// }
if (taxonBase.isOrphaned()) {
if(taxonBase.isInstanceOf(Synonym.class)){
- MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON, TaxonEditorInputE4.class, Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON_MESSAGE);
+ MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON, TaxonEditorInput.class, Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON_MESSAGE);
return;
}
else{
- MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_TAXON, TaxonEditorInputE4.class, Messages.EditorUtil_ORPHAN_TAXON_MESSAGE);
+ MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_TAXON, TaxonEditorInput.class, Messages.EditorUtil_ORPHAN_TAXON_MESSAGE);
return;
}
}
//check if part is already opened
MPart alreadyOpenInOtherClassification = null;
for (MPart part : parts) {
- if(part.getObject() instanceof TaxonNameEditorE4
- && ((TaxonNameEditorE4) part.getObject()).getTaxon()!=null
- && ((TaxonNameEditorE4) part.getObject()).getTaxon().getUuid().equals(input.getTaxon().getUuid())){
+ if(part.getObject() instanceof TaxonEditor
+ && ((TaxonEditor) part.getObject()).getTaxon()!=null
+ && ((TaxonEditor) part.getObject()).getTaxon().getUuid().equals(input.getTaxon().getUuid())){
UUID inputNode = input.getTaxonNode().getUuid();
- UUID editorNode = ((TaxonNameEditorE4) part.getObject()).getTaxonNode().getUuid();
+ UUID editorNode = ((TaxonEditor) part.getObject()).getTaxonNode().getUuid();
if (!inputNode.equals(editorNode)){
alreadyOpenInOtherClassification = part;
}else{
- ((TaxonNameEditorE4) part.getObject()).init(input);
+ ((TaxonEditor) part.getObject()).init(input);
partService.activate(part, true);
return;
}
-
}
}
if (alreadyOpenInOtherClassification != null){
- boolean doSave = forceUserSaveE4Editor(((TaxonNameEditorE4) alreadyOpenInOtherClassification.getObject()), getShell());
+ boolean doSave = forceUserSaveE4Editor(((TaxonEditor) alreadyOpenInOtherClassification.getObject()), getShell());
if (doSave){
- input = TaxonEditorInputE4.NewInstance(input.getTaxonNode().getUuid());
+ input = TaxonEditorInput.NewInstance(input.getTaxonNode().getUuid());
partService.hidePart(alreadyOpenInOtherClassification);
}else {
return;
MPart part = showPart(NAME_EDITOR_ID, modelService, partService, application);
- TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
+ TaxonEditor editor = (TaxonEditor) part.getObject();
// editor.setDisabled();
editor.init(input);
// editor.setEnabled();
editor.setFocus();
- if (factsVisible){
- showFacts(modelService, partService);
- factsVisible = false;
- }
-
- if (mediaVisible){
- showMedia(modelService, partService);
- mediaVisible = false;
- }
}
public static void showMedia(EModelService modelService, EPartService partService) {
String partIdFactualData = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_E4_MEDIAVIEWPARTE4;
showPart(partIdFactualData, modelService, partService);
-
}
public static void showFacts(EModelService modelService, EPartService partService) {
String partIdFactualData = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_FACTUALDATAPARTE4;
showPart(partIdFactualData, modelService, partService);
-
}
public static Collection<MPart> checkForChanges(UUID taxonUUID, EPartService partService ){
Collection<MPart> parts = partService.getParts();
- Collection<MPart> dirtyParts = new HashSet();
+ Collection<MPart> dirtyParts = new HashSet<>();
//check if part is already opened
boolean isDirty = false;
for (MPart part : parts) {
- if(part.getObject() instanceof TaxonNameEditorE4
- && ((TaxonNameEditorE4) part.getObject()).getTaxon()!=null
- && ((TaxonNameEditorE4) part.getObject()).getTaxon().getUuid().equals(taxonUUID)){
+ if(part.getObject() instanceof TaxonEditor
+ && ((TaxonEditor) part.getObject()).getTaxon()!=null
+ && ((TaxonEditor) part.getObject()).getTaxon().getUuid().equals(taxonUUID)){
if (part.isDirty()){
dirtyParts.add(part);
}
Collection<IE4SavablePart> dirtyParts = new HashSet<>();
//check if part is already opened
for (MPart part : parts) {
- if(part.getObject() instanceof TaxonNameEditorE4
- && ((TaxonNameEditorE4) part.getObject()).getTaxon()!=null
- && ((TaxonNameEditorE4) part.getObject()).getTaxon().getUuid().equals(taxonUUID)){
+ if(part.getObject() instanceof TaxonEditor
+ && ((TaxonEditor) part.getObject()).getTaxon()!=null
+ && ((TaxonEditor) part.getObject()).getTaxon().getUuid().equals(taxonUUID)){
if (part.isDirty()){
dirtyParts.add((IE4SavablePart) part);
}
break;
}else if (taxonUUID == null){
- if (part.isDirty() && (part.getObject() instanceof TaxonNameEditorE4 || (part.getObject() instanceof BulkEditor && ((BulkEditor)part.getObject()).getEditorInput() instanceof TaxonEditorInput))){
+ if (part.isDirty() && (part.getObject() instanceof TaxonEditor || (part.getObject() instanceof BulkEditor && ((BulkEditor)part.getObject()).getEditorInput() instanceof TaxonBulkEditorInput))){
dirtyParts.add((IE4SavablePart) part.getObject());
}
}
* a {@link java.util.UUID} object.
*/
public static void openEmptyE4(UUID parentNodeUuid) {
- TaxonEditorInputE4 input = TaxonEditorInputE4
+ TaxonEditorInput input = TaxonEditorInput
.NewEmptyInstance(parentNodeUuid);
EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
MPart part = partService.createPart(NAME_EDITOR_ID);
part = partService.showPart(part, PartState.ACTIVATE);
- TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
+ TaxonEditor editor = (TaxonEditor) part.getObject();
editor.init(input);
}
EditorUtil.mediaVisible = mediaVisible;
}
- /**
- * <p>
- * forceUserSave
- * </p>
- *
- * @param editor
- * a {@link org.eclipse.ui.IEditorPart} object.
- * @param shell
- * a {@link org.eclipse.swt.widgets.Shell} object.
- * @return a boolean.
- */
public static boolean forceUserSave(IEditorPart editor, Shell shell) {
if (editor.isDirty()) {
Collection<MPart> parts = partService.getParts();
for (MPart part : parts) {
Object object = part.getObject();
- if(object instanceof TaxonNameEditorE4){
- TaxonNameEditorE4 taxonEditor = (TaxonNameEditorE4)object;
+ if(object instanceof TaxonEditor){
+ TaxonEditor taxonEditor = (TaxonEditor)object;
TaxonNode node = taxonEditor.getEditorInput().getTaxonNode();
if (node.treeIndex()!= null){
if(node.treeIndex().startsWith(treeIndex)){
Collection<MPart> parts = partService.getParts();
for (MPart part : parts) {
Object object = part.getObject();
- if(object instanceof TaxonNameEditorE4){
- TaxonNameEditorE4 taxonEditor = (TaxonNameEditorE4)object;
+ if(object instanceof TaxonEditor){
+ TaxonEditor taxonEditor = (TaxonEditor)object;
TaxonNode node = taxonEditor.getEditorInput().getTaxonNode();
if (node.treeIndex()!= null){
if(node.treeIndex().startsWith(treeIndex)){
}
}
- public static void updateEditor(TaxonNode taxonNode, TaxonNameEditorE4 editor){
+ public static void updateEditor(TaxonNode taxonNode, TaxonEditor editor){
String treeIndex = taxonNode.treeIndex();
TaxonNode node = editor.getEditorInput().getTaxonNode();
if(node.treeIndex().equals(treeIndex)){
- TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstance(node.getUuid());
+ TaxonEditorInput input = TaxonEditorInput.NewInstance(node.getUuid());
editor.init(input);
}
}
* @since Oct 29, 2018
*
*/
-public class AreasSelectionDialog extends Dialog{
+public class AreasSelectionDialog extends Dialog {
private CheckBoxTreeComposite treeComposite;
private Collection<TermVocabularyDto> areaVocabularies;
-
protected AreasSelectionDialog(Shell parentShell, List<TermDto> selectedAreas) {
super(parentShell);
this.selectedAreas = selectedAreas;
- this.areaVocabularies = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermType(TermType.NamedArea);
+ this.areaVocabularies = CdmStore.getService(IVocabularyService.class)
+ .findVocabularyDtoByTermType(TermType.NamedArea);
}
@Override
protected Control createDialogArea(Composite parent) {
- treeComposite = new CheckBoxTreeComposite(parent, new TermDtoContentProvider(), new TermDtoLabelProvider(), SWT.NONE);
+ treeComposite = new CheckBoxTreeComposite(parent, new TermDtoContentProvider(), new TermDtoLabelProvider(),
+ SWT.NONE);
treeComposite.getViewer().setComparator(new DefinedTermSorter());
treeComposite.getViewer().setInput(areaVocabularies);
- Collections.sort(selectedAreas, (o1, o2)->o1.getOrderIndex()-o2.getOrderIndex());
+ Collections.sort(selectedAreas, (o1, o2) -> o1.getOrderIndex() - o2.getOrderIndex());
treeComposite.setCheckedElements(selectedAreas.toArray());
treeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
return treeComposite;
selectedAreas.clear();
List<Object> checkedElements = Arrays.asList(treeComposite.getViewer().getCheckedElements());
checkedElements = checkedElements.stream()
- .filter(element->element instanceof TermDto && !treeComposite.getViewer().getGrayed(element))
+ .filter(element -> element instanceof TermDto && !treeComposite.getViewer().getGrayed(element))
.collect(Collectors.toList());
selectedAreas = new ArrayList(checkedElements);
super.okPressed();
return true;
}
- public List<TermDto> getSelectedAreas(){
+ public List<TermDto> getSelectedAreas() {
return selectedAreas;
}
}
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IDescriptiveDataSetService;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.api.service.ITermService;
* @since Nov 21, 2017
*
*/
-public class DescriptiveDataSetEditor implements IE4SavablePart, IConversationEnabled,
+public class DescriptiveDataSetEditor implements IE4SavablePart,
ICdmEntitySessionEnabled<DescriptiveDataSet>, IPartContentHasDetails,
IPartContentHasSupplementalData, IDirtyMarkable, IDescriptiveDataSetEditor {
private DescriptiveDataSetComposite composite;
- private ConversationHolder conversation;
-
private ICdmEntitySession cdmEntitySession;
private DescriptiveDataSet descriptiveDataSet;
public void create(Composite parent, IEclipseContext context, @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
EMenuService menuService){
if (CdmStore.isActive()){
- if(conversation == null){
- conversation = CdmStore.createConversation();
- }
if(cdmEntitySession == null){
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
}
@Override
public void save(IProgressMonitor monitor) {
- if (!conversation.isBound()) {
- conversation.bind();
-
- }
- conversation.commit(true);
Collection<TermDto> areas = composite.getAreas();
Object input = composite.getTaxonNodeTree().getInput();
if(input!=null){
@PreDestroy
public void dispose() {
- if (conversation != null) {
- conversation.close();
- conversation = null;
- }
if(cdmEntitySession != null) {
cdmEntitySession.dispose();
cdmEntitySession = null;
if(composite!=null){
composite.setFocus();
}
- if (getConversationHolder() != null) {
- getConversationHolder().bind();
- }
+
if(cdmEntitySession != null) {
cdmEntitySession.bind();
}
return descriptiveDataSet;
}
- @Override
- public void update(CdmDataChangeMap arg0) {
- }
+
@Override
public ICdmEntitySession getCdmEntitySession() {
return null;
}
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
@Override
public void changed(Object element) {
dirty.setDirty(true);
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IMemento;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IDescriptiveDataSetService;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.description.DescriptiveDataSet;
*
*/
public class DescriptiveDataSetNavigator
- implements IConversationEnabled, ICdmEntitySessionEnabled<DescriptiveDataSet>, IContextListener{
+ implements ICdmEntitySessionEnabled<DescriptiveDataSet>, IContextListener{
private ListViewer viewer;
private ISelectionChangedListener selectionChangedListener;
- private ConversationHolder conversation;
-
private ICdmEntitySession cdmEntitySession;
private List<DescriptiveDataSet> descriptiveDataSets;
public void init(){
if (CdmStore.isActive()){
- if(conversation == null) {
- conversation = CdmStore.createConversation();
- }
+// if(conversation == null) {
+// conversation = CdmStore.createConversation();
+// }
if(cdmEntitySession == null){
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
}
refresh();
}
- @Override
- public void update(CdmDataChangeMap arg0) {
- }
+
@Override
public ICdmEntitySession getCdmEntitySession() {
return null;
}
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
public ESelectionService getSelService() {
return selService;
}
@PreDestroy
public void dispose() {
- if (conversation != null) {
- conversation.close();
- conversation = null;
- }
+
if(cdmEntitySession != null) {
cdmEntitySession.dispose();
cdmEntitySession = null;
@Focus
public void setFocus() {
- if (getConversationHolder() != null) {
- getConversationHolder().bind();
- }
+
if(cdmEntitySession != null) {
cdmEntitySession.bind();
}
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.widgets.FormToolkit;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.ITermNodeService;
import eu.etaxonomy.cdm.api.service.ITermTreeService;
import eu.etaxonomy.cdm.api.service.IVocabularyService;
import eu.etaxonomy.cdm.model.term.VocabularyEnum;
import eu.etaxonomy.cdm.persistence.dto.CharacterDto;
import eu.etaxonomy.cdm.persistence.dto.CharacterNodeDto;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.AppModelId;
import eu.etaxonomy.taxeditor.editor.definedterm.TermTreeViewerComparator;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
/**
* Editor for combining structure and property terms to characters.
+ *
* @author pplitzner
* @date 24.05.2017
*/
-public class CharacterEditor implements ICharacterEditor, IConversationEnabled, ISelectionChangedListener,
- ModifyListener, IE4ViewerPart, IPartContentHasDetails, IPartContentHasSupplementalData,
- IDirtyMarkable, IE4SavablePart {
+public class CharacterEditor implements ICharacterEditor, ISelectionChangedListener, ModifyListener, IE4ViewerPart,
+ IPartContentHasDetails, IPartContentHasSupplementalData, IDirtyMarkable, IE4SavablePart {
private TermTreeDtoEditorComposite characterTreeEditorComposite;
private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
@Inject
private MDirtyable dirty;
- private ConversationHolder conversation;
-
private ICdmEntitySession cdmEntitySession;
private TermVocabulary vocabulary;
* Create contents of the view part.
*/
@PostConstruct
- public void createControls(Composite parent, EMenuService menuService ) {
- if (CdmStore.isActive()){
- if(conversation == null){
- conversation = CdmStore.createConversation();
- }
- if(cdmEntitySession==null){
+ public void createControls(Composite parent, EMenuService menuService) {
+ if (CdmStore.isActive()) {
+ // if(conversation == null){
+ // conversation = CdmStore.createConversation();
+ // }
+ if (cdmEntitySession == null) {
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
}
- }
- else{
+ } else {
return;
}
parent.setLayout(new GridLayout(1, false));
@Override
public void widgetSelected(SelectionEvent e) {
- // hard-coded filter for "built-in" vocabularies Feature and Name Feature
+ // hard-coded filter for "built-in" vocabularies Feature and
+ // Name Feature
Set<TermVocabulary> vocabulariesToBeFiltered = new HashSet<>();
- vocabulariesToBeFiltered.add(CdmStore.getService(IVocabularyService.class).load(VocabularyEnum.Feature.getUuid()));
- vocabulariesToBeFiltered.add(CdmStore.getService(IVocabularyService.class).load(VocabularyEnum.NameFeature.getUuid()));
- if(vocabulary!=null){
+ vocabulariesToBeFiltered
+ .add(CdmStore.getService(IVocabularyService.class).load(VocabularyEnum.Feature.getUuid()));
+ vocabulariesToBeFiltered
+ .add(CdmStore.getService(IVocabularyService.class).load(VocabularyEnum.NameFeature.getUuid()));
+ if (vocabulary != null) {
vocabulariesToBeFiltered.add(vocabulary);
}
- vocabulary = TermVocabularySelectionDialog.select("Select vocabulary for characters", btnChooseVoc.getShell(), vocabulariesToBeFiltered, TermType.Character);
- if(vocabulary!=null){
+ vocabulary = TermVocabularySelectionDialog.select("Select vocabulary for characters",
+ btnChooseVoc.getShell(), vocabulariesToBeFiltered, TermType.Character);
+ if (vocabulary != null) {
txtVocabulary.setText(vocabulary.getLabel());
}
}
propertyViewer.addSelectionChangedListener(this);
int ops = DND.DROP_COPY | DND.DROP_MOVE;
- Transfer[] transfers = new Transfer[] {CharacterTransfer.getInstance()};
+ Transfer[] transfers = new Transfer[] { CharacterTransfer.getInstance() };
propertyViewer.addDragSupport(ops, transfers, new CharacterDragListener(structureViewer, propertyViewer));
Composite composite_3 = new Composite(sashForm, SWT.NONE);
btnAddCharacter.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- if(!isVocabularySet()){
+ if (!isVocabularySet()) {
return;
}
- if (confirmSaveDirty()){
+ if (confirmSaveDirty()) {
return;
}
ISelection structureTreeSelection = structureViewer.getSelection();
ISelection propertyTreeSelection = propertyViewer.getSelection();
- if(structureTreeSelection==null || propertyTreeSelection==null || characterTreeEditorComposite.getFeatureTree()==null){
+ if (structureTreeSelection == null || propertyTreeSelection == null
+ || characterTreeEditorComposite.getFeatureTree() == null) {
MessagingUtils.warningDialog(Messages.CharacterEditor_CANNOT_PERFORM_TITLE, CharacterEditor.this,
Messages.CharacterEditor_CANNOT_PERFORM_MESSAGE);
return;
}
- Collection<Character> characters = createCharacters((TreeSelection)structureTreeSelection, (TreeSelection)propertyTreeSelection);
- TermNodeDto parent = characterTreeEditorComposite.getFeatureTree().getRoot();
+ Collection<Character> characters = createCharacters((TreeSelection) structureTreeSelection,
+ (TreeSelection) propertyTreeSelection);
+ TermNodeDto parent = ((TermTreeDto) characterTreeEditorComposite.getFeatureTree()).getRoot();
ISelection sel = characterTreeEditorComposite.getViewer().getSelection();
TermNodeDto parentNode = parent;
- if (sel instanceof TreeSelection){
- TreeSelection treeSel = (TreeSelection)sel;
+ if (sel instanceof TreeSelection) {
+ TreeSelection treeSel = (TreeSelection) sel;
Object o = treeSel.getFirstElement();
- if (o instanceof CharacterNodeDto){
- parentNode = (TermNodeDto)o;
+ if (o instanceof CharacterNodeDto) {
+ parentNode = (TermNodeDto) o;
}
}
for (Character character : characters) {
- //add new Character to feature tree
- CharacterNodeDto nodeDto = new CharacterNodeDto(CharacterDto.fromCharacter(character), parentNode, 0, parent.getTree(), null, null, null);
+ // add new Character to feature tree
+ TermTreeDto tree = (TermTreeDto)getTreeDtoForUuid(parent.getTreeUuid());
+ CharacterNodeDto nodeDto = new CharacterNodeDto(CharacterDto.fromCharacter(character), parentNode,
+ 0, tree, null, 0, null, null);
nodesToSave.put(character, nodeDto);
setDirty();
- // result = CdmStore.getService(ITermNodeService.class).createChildFeatureNode(parent.getUuid(), character, vocabulary.getUuid());
+ // result =
+ // CdmStore.getService(ITermNodeService.class).createChildFeatureNode(parent.getUuid(),
+ // character, vocabulary.getUuid());
}
-
refresh();
}
});
@Override
public void widgetSelected(SelectionEvent e) {
- if (confirmSaveDirty()){
+ if (confirmSaveDirty()) {
return;
}
ISelection structureTreeSelection = structureViewer.getSelection();
ISelection characterSelection = characterTreeEditorComposite.getViewer().getSelection();
- if(structureTreeSelection==null || characterSelection ==null){
+ if (structureTreeSelection == null || characterSelection == null) {
MessagingUtils.warningDialog(Messages.CharacterEditor_CANNOT_PERFORM_TITLE, CharacterEditor.this,
Messages.CharacterEditor_CANNOT_PERFORM_MESSAGE);
return;
}
- CharacterNodeDto character = (CharacterNodeDto)((TreeSelection)characterSelection).getFirstElement();
- TermNode ratioToNode = (TermNode)((TreeSelection)structureTreeSelection).getFirstElement();
- if (character == null){
+ CharacterNodeDto character = (CharacterNodeDto) ((TreeSelection) characterSelection).getFirstElement();
+ TermNode ratioToNode = (TermNode) ((TreeSelection) structureTreeSelection).getFirstElement();
+ if (character == null) {
return;
}
TermDto termDto = character.getTerm();
TermNodeDto property = null;
Representation structureRepresentation = null;
Representation propertyRepresentation = null;
- Representation ratioToRepresentation = ratioToNode.getTerm().getRepresentation(CdmStore.getDefaultLanguage());
- if (termDto instanceof CharacterDto){
- CharacterDto dto = (CharacterDto)termDto;
+ Representation ratioToRepresentation = ratioToNode.getTerm()
+ .getRepresentation(CdmStore.getDefaultLanguage());
+ if (termDto instanceof CharacterDto) {
+ CharacterDto dto = (CharacterDto) termDto;
dto.setRatioTo(TermNodeDto.fromNode(ratioToNode, null));
structure = dto.getStructure();
- structureRepresentation = structure.getTerm().getPreferredRepresentation(CdmStore.getDefaultLanguage());
+ structureRepresentation = structure.getTerm()
+ .getPreferredRepresentation(CdmStore.getDefaultLanguage());
property = dto.getProperty();
- propertyRepresentation = property.getTerm().getPreferredRepresentation(CdmStore.getDefaultLanguage());
+ propertyRepresentation = property.getTerm()
+ .getPreferredRepresentation(CdmStore.getDefaultLanguage());
}
String label = null;
String abbrevLabel = null;
- if(structureRepresentation!=null && propertyRepresentation!=null){
- if(structureRepresentation.getLabel() != null && propertyRepresentation.getLabel() != null && ratioToRepresentation.getLabel() != null){
- label = propertyRepresentation.getLabel() + " ratio " +structureRepresentation.getLabel()+" to " +ratioToRepresentation.getLabel() ;
+ if (structureRepresentation != null && propertyRepresentation != null) {
+ if (structureRepresentation.getLabel() != null && propertyRepresentation.getLabel() != null
+ && ratioToRepresentation.getLabel() != null) {
+ label = propertyRepresentation.getLabel() + " ratio " + structureRepresentation.getLabel()
+ + " to " + ratioToRepresentation.getLabel();
}
- if(structureRepresentation.getAbbreviatedLabel()!=null && propertyRepresentation.getAbbreviatedLabel()!=null && ratioToRepresentation.getAbbreviatedLabel() != null){
- abbrevLabel = propertyRepresentation.getAbbreviatedLabel() + " ratio " +structureRepresentation.getAbbreviatedLabel()+ " to " + ratioToRepresentation.getAbbreviatedLabel();
+ if (structureRepresentation.getAbbreviatedLabel() != null
+ && propertyRepresentation.getAbbreviatedLabel() != null
+ && ratioToRepresentation.getAbbreviatedLabel() != null) {
+ abbrevLabel = propertyRepresentation.getAbbreviatedLabel() + " ratio "
+ + structureRepresentation.getAbbreviatedLabel() + " to "
+ + ratioToRepresentation.getAbbreviatedLabel();
}
}
- if(label==null){
- //default label
- label = property.getTerm().getRepresentation_L10n()+ " ratio " +structure.getTerm().getRepresentation_L10n()+ " to " + ratioToNode.getTerm().getLabel() ;
+ if (label == null) {
+ // default label
+ label = property.getTerm().getRepresentation_L10n() + " ratio "
+ + structure.getTerm().getRepresentation_L10n() + " to " + ratioToNode.getTerm().getLabel();
}
character.getTerm().getRepresentation(CdmStore.getDefaultLanguage()).setLabel(label);
character.getTerm().getRepresentation(CdmStore.getDefaultLanguage()).setAbbreviatedLabel(abbrevLabel);
});
characterTreeEditorComposite = addFeatureTreeEditor(composite_3);
- initFeatureTreeComposite(TermType.Character, characterTreeEditorComposite, new TermNodeDtoDragListener(characterTreeEditorComposite.getViewer()),
- new TermTreeDtoDropAdapter(this, characterTreeEditorComposite.getViewer(), sync),
- null);
+ initFeatureTreeComposite(TermType.Character, characterTreeEditorComposite,
+ new TermNodeDtoDragListener(characterTreeEditorComposite.getViewer()),
+ new TermTreeDtoDropAdapter(this, characterTreeEditorComposite.getViewer(), sync), null);
characterTreeEditorComposite.getLabel_title().setText(Messages.CharacterEditor_CHARACTERS);
- //add context menu to character viewer
+ // add context menu to character viewer
menuService.registerContextMenu(characterTreeEditorComposite.getViewer().getControl(),
AppModelId.POPUPMENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_POPUPMENU_CHARACTEREDITOR);
btnRefresh.setImage(ImageResources.getImage(ImageResources.REFRESH));
btnRefresh.setToolTipText("Refresh");
-
TreeViewer viewer = new TreeViewer(composite);
viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
viewer.setContentProvider(new TermTreeContentProvider());
viewer.setLabelProvider(new TermTreeLabelProvider());
viewer.setComparator(new TermTreeViewerComparator());
viewer.addSelectionChangedListener(this);
- viewer.setInput(CdmStore.getService(ITermTreeService.class).list(termType, null, null, null, TermTreeEditor.TREE_PROPERTY_PATH));
+ viewer.setInput(CdmStore.getService(ITermTreeService.class).list(termType, null, null, null,
+ TermTreeEditor.TREE_PROPERTY_PATH));
btnRefresh.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- viewer.setInput(CdmStore.getService(ITermTreeService.class).list(termType, null, null, null, TermTreeEditor.TREE_PROPERTY_PATH));
+ viewer.setInput(CdmStore.getService(ITermTreeService.class).list(termType, null, null, null,
+ TermTreeEditor.TREE_PROPERTY_PATH));
refresh(viewer);
}
});
return TermTreeEditorComposite;
}
- private void initFeatureTreeComposite(
- TermType termType,
- TermTreeDtoEditorComposite TermTreeEditorComposite,
- TermNodeDtoDragListener featureNodeDragListener,
- TermTreeDtoDropAdapter featureNodeDropAdapter,
+ private void initFeatureTreeComposite(TermType termType, TermTreeDtoEditorComposite TermTreeEditorComposite,
+ TermNodeDtoDragListener featureNodeDragListener, TermTreeDtoDropAdapter featureNodeDropAdapter,
Transfer[] transfers) {
- TermTreeEditorComposite.init(
- featureNodeDragListener,
- featureNodeDropAdapter,
- transfers,
- this,
- new FeatureTreeChooserListener(TermTreeEditorComposite, termType),
- this);
+ TermTreeEditorComposite.init(featureNodeDragListener, featureNodeDropAdapter, transfers, this,
+ new FeatureTreeChooserListener(TermTreeEditorComposite, termType), this);
}
@Focus
- public void focus(){
- if(characterTreeEditorComposite!=null){
+ public void focus() {
+ if (characterTreeEditorComposite != null) {
characterTreeEditorComposite.getViewer().getControl().setFocus();
}
- if(conversation!=null && !conversation.isBound()){
- conversation.bind();
- }
- if(cdmEntitySession != null) {
+ if (cdmEntitySession != null) {
cdmEntitySession.bind();
}
}
- public static Collection<Character> createCharacters(TreeSelection structureTreeSelection, TreeSelection propertyTreeSelection){
+ public static Collection<Character> createCharacters(TreeSelection structureTreeSelection,
+ TreeSelection propertyTreeSelection) {
Set<Character> characters = new HashSet<>();
- //get selected structures and properties
+ // get selected structures and properties
Iterator<TermNode<DefinedTerm>> structureIterator = structureTreeSelection.iterator();
- //create all combinations of structures and properties
- while(structureIterator.hasNext()){
+ // create all combinations of structures and properties
+ while (structureIterator.hasNext()) {
Object o = structureIterator.next();
TermNode<DefinedTerm> structureNode = null;
- if (o instanceof TermNode){
+ if (o instanceof TermNode) {
structureNode = (TermNode<DefinedTerm>) o;
- }else{
+ } else {
return null;
}
Iterator<TermNode<DefinedTerm>> propertiesIterator = propertyTreeSelection.iterator();
- while(propertiesIterator.hasNext()){
+ while (propertiesIterator.hasNext()) {
TermNode<DefinedTerm> propertyNode = propertiesIterator.next();
- Representation structureRepresentation = structureNode.getTerm().getRepresentation(PreferencesUtil.getGlobalLanguage());
- if(structureRepresentation==null){
+ Representation structureRepresentation = structureNode.getTerm()
+ .getRepresentation(PreferencesUtil.getGlobalLanguage());
+ if (structureRepresentation == null) {
structureRepresentation = structureNode.getTerm().getRepresentation(Language.DEFAULT());
}
- Representation propertyRepresentation = propertyNode.getTerm().getRepresentation(PreferencesUtil.getGlobalLanguage());
- if(propertyRepresentation==null){
+ Representation propertyRepresentation = propertyNode.getTerm()
+ .getRepresentation(PreferencesUtil.getGlobalLanguage());
+ if (propertyRepresentation == null) {
propertyRepresentation = propertyNode.getTerm().getRepresentation(Language.DEFAULT());
}
String label = null;
String abbrevLabel = null;
- if(structureRepresentation!=null && propertyRepresentation!=null){
- if(structureRepresentation.getLabel()!=null && propertyRepresentation.getLabel()!=null){
- label = structureRepresentation.getLabel()+" "+propertyRepresentation.getLabel();
+ if (structureRepresentation != null && propertyRepresentation != null) {
+ if (structureRepresentation.getLabel() != null && propertyRepresentation.getLabel() != null) {
+ label = structureRepresentation.getLabel() + " " + propertyRepresentation.getLabel();
}
- if(structureRepresentation.getAbbreviatedLabel()!=null && propertyRepresentation.getAbbreviatedLabel()!=null){
- abbrevLabel = structureRepresentation.getAbbreviatedLabel()+" "+propertyRepresentation.getAbbreviatedLabel();
+ if (structureRepresentation.getAbbreviatedLabel() != null
+ && propertyRepresentation.getAbbreviatedLabel() != null) {
+ abbrevLabel = structureRepresentation.getAbbreviatedLabel() + " "
+ + propertyRepresentation.getAbbreviatedLabel();
}
}
- if(label!=null){
- //default label
- label = structureNode.getTerm().getLabel()+" "+propertyNode.getTerm().getLabel();
+ if (label != null) {
+ // default label
+ label = structureNode.getTerm().getLabel() + " " + propertyNode.getTerm().getLabel();
}
Character character = Character.NewInstance(structureNode, propertyNode, null, label, abbrevLabel);
CharacterLabelBuilder labelBuilder = CharacterLabelBuilder.NewDefaultInstance();
@Override
@Persist
- public void save(IProgressMonitor monitor){
- if (!conversation.isBound()) {
- conversation.bind();
- }
+ public void save(IProgressMonitor monitor) {
+
UpdateResult result = new UpdateResult();
if (nodesToSave != null && this.getVocabulary() != null) {
- result.includeResult(CdmStore.getService(ITermNodeService.class).saveNewCharacterNodeDtoMap(this.nodesToSave, this.getVocabulary().getUuid()));
+ result.includeResult(CdmStore.getService(ITermNodeService.class)
+ .saveNewCharacterNodeDtoMap(this.nodesToSave, this.getVocabulary().getUuid()));
}
nodesToSave.clear();
- TermTreeDto featureTree = characterTreeEditorComposite.getFeatureTree();
- if (operations != null && !operations.isEmpty()){
- for (AbstractPostOperation<TermNode> operation: operations){
+ TermCollectionDto featureTree = characterTreeEditorComposite.getFeatureTree();
+ if (operations != null && !operations.isEmpty()) {
+ for (AbstractPostOperation<TermNode> operation : operations) {
AbstractUtility.executeOperation(operation, sync);
}
operations.clear();
- }
-
-// TODO: implement update method for dto
-
+ }
+
result.includeResult(CdmStore.getService(ITermNodeService.class).saveCharacterNodeDtoList(this.nodesToUpdate));
+
nodesToUpdate.clear();
// commit the conversation and start a new transaction immediately
- conversation.commit(true);
- if (result.getUpdatedObjects() != null && !result.getUpdatedObjects().isEmpty()){
+ // conversation.commit(true);
+ if (result.getUpdatedObjects() != null && !result.getUpdatedObjects().isEmpty()) {
Object o = result.getUpdatedObjects().iterator().next();
- if (o instanceof TermNode){
- TermNode node = (TermNode)o;
- TermTree updateTree = (TermTree)node.getGraph();
- if (updateTree != null){
+ if (o instanceof TermNode) {
+ TermNode node = (TermNode) o;
+ TermTree updateTree = (TermTree) node.getGraph();
+ if (updateTree != null) {
characterTreeEditorComposite.setSelectedTree(updateTree);
}
}
}
-// initializeTrees();
+ // initializeTrees();
dirty.setDirty(false);
}
}
@PreDestroy
- public void dispose(){
- if(conversation!=null){
- conversation.close();
- conversation = null;
- }
- if(cdmEntitySession != null) {
+ public void dispose() {
+
+ if (cdmEntitySession != null) {
cdmEntitySession.dispose();
cdmEntitySession = null;
}
}
public boolean isVocabularySet() {
- if(vocabulary==null){
- MessagingUtils.warningDialog("Character creation not possible", this.getClass(), "Please select a vocabulary for the characters.");
+ if (vocabulary == null) {
+ MessagingUtils.warningDialog("Character creation not possible", this.getClass(),
+ "Please select a vocabulary for the characters.");
}
- return vocabulary!=null;
+ return vocabulary != null;
}
- public boolean confirmSaveDirty(){
+ public boolean confirmSaveDirty() {
return StoreUtil.promptCheckIsDirty(this);
}
@Override
public Map<Object, List<String>> getPropertyPathsMap() {
- List<String> propertyPaths = Arrays.asList(new String[] {
- "children", //$NON-NLS-1$
+ List<String> propertyPaths = Arrays.asList(new String[] { "children", //$NON-NLS-1$
"feature", //$NON-NLS-1$
"featureTree", //$NON-NLS-1$
});
- Map<Object, List<String>> propertyPathMap =
- new HashMap<Object, List<String>>();
- propertyPathMap.put(TermNode.class,propertyPaths);
+ Map<Object, List<String>> propertyPathMap = new HashMap<Object, List<String>>();
+ propertyPathMap.put(TermNode.class, propertyPaths);
return propertyPathMap;
}
@Override
- public List<TermTreeDto> getRootEntities() {
- List<TermTreeDto> root = new ArrayList<>();
+ public List<TermCollectionDto> getRootEntities() {
+ List<TermCollectionDto> root = new ArrayList<>();
root.add(characterTreeEditorComposite.getFeatureTree());
return root;
}
return cdmEntitySession;
}
-
@Focus
public void setFocus() {
- if(conversation!=null && !conversation.isBound()){
- conversation.bind();
- }
+
}
@Override
public void selectionChanged(SelectionChangedEvent event) {
- //propagate selection
+ // propagate selection
selService.setSelection(event.getSelection());
ISelection selStructure = null;
ISelection selProperty = null;
selStructure = structureViewer.getSelection();
selProperty = propertyViewer.getSelection();
- if (selStructure != null && selProperty != null && selStructure instanceof TreeSelection && selProperty instanceof TreeSelection && ((TreeSelection)selStructure).getFirstElement() instanceof TermNode && ((TreeSelection)selProperty).getFirstElement() instanceof TermNode && this.vocabulary != null) {
+ if (selStructure != null && selProperty != null && selStructure instanceof TreeSelection
+ && selProperty instanceof TreeSelection
+ && ((TreeSelection) selStructure).getFirstElement() instanceof TermNode
+ && ((TreeSelection) selProperty).getFirstElement() instanceof TermNode && this.vocabulary != null) {
btnAddCharacter.setEnabled(true);
- }else {
+ } else {
btnAddCharacter.setEnabled(false);
}
ISelection selCharacter = this.characterTreeEditorComposite.getViewer().getSelection();
- if (selStructure != null && selCharacter != null && selStructure instanceof TreeSelection && selCharacter instanceof TreeSelection && ((TreeSelection)selStructure).getFirstElement() instanceof TermNode && ((TreeSelection)selCharacter).getFirstElement() instanceof CharacterNodeDto) {
+ if (selStructure != null && selCharacter != null && selStructure instanceof TreeSelection
+ && selCharacter instanceof TreeSelection
+ && ((TreeSelection) selStructure).getFirstElement() instanceof TermNode
+ && ((TreeSelection) selCharacter).getFirstElement() instanceof CharacterNodeDto) {
btnAddRatioTo.setEnabled(true);
- }else {
+ } else {
btnAddRatioTo.setEnabled(false);
}
}
-
@Override
public void modifyText(ModifyEvent e) {
characterTreeEditorComposite.getFeatureTree().setTitleCache(((Text) e.widget).getText());
setDirty();
}
-
-
@Override
public void setDirty() {
dirty.setDirty(true);
return (IStructuredSelection) characterTreeEditorComposite.getViewer().getSelection();
}
-
@Override
public TermType getTermType() {
return TermType.Character;
}
- public TermTreeDto getCharacterTree(){
+ public TermCollectionDto getCharacterTree() {
return characterTreeEditorComposite.getFeatureTree();
}
-
- public void refresh(TreeViewer viewer){
+ public void refresh(TreeViewer viewer) {
viewer.refresh();
characterTreeEditorComposite.getViewer().setInput(characterTreeEditorComposite.getViewer().getInput());
}
- private class FeatureTreeChooserListener extends SelectionAdapter{
+ private class FeatureTreeChooserListener extends SelectionAdapter {
private TermTreeDtoEditorComposite<Feature> TermTreeEditorComposite;
private TermType termType;
- public FeatureTreeChooserListener(TermTreeDtoEditorComposite<Feature> TermTreeEditorComposite, TermType termType) {
+ public FeatureTreeChooserListener(TermTreeDtoEditorComposite<Feature> TermTreeEditorComposite,
+ TermType termType) {
super();
this.TermTreeEditorComposite = TermTreeEditorComposite;
this.termType = termType;
@Override
public void widgetSelected(SelectionEvent e) {
- TermTree tree = FeatureTreeSelectionDialog.select(TermTreeEditorComposite.getDisplay().getActiveShell(), null, termType);
- if(tree!=null){
+ TermTree tree = FeatureTreeSelectionDialog.select(TermTreeEditorComposite.getDisplay().getActiveShell(),
+ null, termType);
+ if (tree != null) {
cdmEntitySession.load(tree, true);
TermTreeEditorComposite.setSelectedTree(tree);
}
}
}
- @Override
- public void update(CdmDataChangeMap arg0) {
- }
-
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
@Override
public void changed(Object element) {
setDirty();
@Override
public boolean postOperation(Object objectAffectedByOperation) {
characterTreeEditorComposite.getViewer().refresh();
- if(objectAffectedByOperation instanceof TermNode){
+ if (objectAffectedByOperation instanceof TermNode) {
StructuredSelection selection = new StructuredSelection(objectAffectedByOperation);
characterTreeEditorComposite.getViewer().setSelection(selection);
}
}
@Override
- public TermNodeDto getNodeDtoForUuid(UUID nodeUuid){
- return (TermNodeDto)this.characterTreeEditorComposite.getNodeUuidMap().get(nodeUuid);
+ public TermNodeDto getNodeDtoForUuid(UUID nodeUuid) {
+ return (TermNodeDto) this.characterTreeEditorComposite.getNodeUuidMap().get(nodeUuid);
}
@Inject
@Optional
- private void addSaveCandidate(@UIEventTopic(WorkbenchEventConstants.ADD_SAVE_CHARACTER) CharacterNodeDto characterNodeDto) {
+ private void addSaveCandidate(
+ @UIEventTopic(WorkbenchEventConstants.ADD_SAVE_CHARACTER) CharacterNodeDto characterNodeDto) {
- if (characterNodeDto != null){
- if (nodesToUpdate.contains(characterNodeDto)){
+ if (characterNodeDto != null) {
+ if (nodesToUpdate.contains(characterNodeDto)) {
nodesToUpdate.remove(characterNodeDto);
}
nodesToUpdate.add(characterNodeDto);
}
@Override
- public TermTreeDto getTreeDtoForUuid(UUID treeUuid) {
- if (this.characterTreeEditorComposite.getFeatureTree().getUuid().equals(treeUuid)){
+ public TermCollectionDto getTreeDtoForUuid(UUID treeUuid) {
+ if (this.characterTreeEditorComposite.getFeatureTree().getUuid().equals(treeUuid)) {
return this.characterTreeEditorComposite.getFeatureTree();
}
return null;
@Override
public boolean checkDuplicates(UUID termUuid, UUID treeUuid) {
- for (TermDto dto: characterTreeEditorComposite.getFeatureTree().getTerms()){
- if (dto != null && dto.getUuid().equals(termUuid)){
+ for (TermDto dto : characterTreeEditorComposite.getFeatureTree().getTerms()) {
+ if (dto != null && dto.getUuid().equals(termUuid)) {
return true;
}
}
}
-
-
-
}
DescriptiveDataSet descriptiveDataSet = DescriptiveDataSet.NewInstance();
descriptiveDataSet.setLabel(dataSetName);
CdmStore.getService(IDescriptiveDataSetService.class).merge(descriptiveDataSet, true);
- navigator.getConversationHolder().commit();
navigator.addDescriptiveDataSet(descriptiveDataSet);
EditorUtil.openDescriptiveDataSetEditor(descriptiveDataSet.getUuid(), modelService, partService, application);
}
deleteDescriptiveDataSet(((DescriptiveDataSet) next).getUuid(), deleteConfig);
DescriptiveDataSetNavigator navigator = (DescriptiveDataSetNavigator) object;
navigator.removeDescriptiveDataSet((DescriptiveDataSet) next);
- navigator.getConversationHolder().commit();
navigator.getSelService().setSelection(null);
}else{
MessagingUtils.errorDialog(Messages.DeleteDescriptiveDataSetHandler_DELETE_FAILED_TITLE, DeleteDescriptiveDataSetHandler.class, Messages.DeleteDescriptiveDataSetHandler_DELETE_FAILED_MESSAGE, TaxeditorEditorPlugin.PLUGIN_ID, null, false);
import org.apache.commons.math3.stat.Frequency;
import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.cdm.model.description.State;
+import eu.etaxonomy.cdm.model.term.DefinedTermBase;
/**
* @author pplitzner
* @since Jul 12, 2018
- *
*/
public class CategoricalDataHistogram {
private Feature feature;
private Frequency frequency;
- private List<State> states;
+ private List<DefinedTermBase<?>> states;
public CategoricalDataHistogram(Feature feature) {
this.feature = feature;
this.states = new ArrayList<>();
this.frequency = new Frequency();
feature.getSupportedCategoricalEnumerations()
- .forEach(voc->voc.getTerms()
+ .forEach(terms->terms.getDistinctTerms()
.forEach(state->states.add(state)));
}
- public void addState(State state){
+ public void addState(DefinedTermBase<?> state){
frequency.addValue(state.getLabel());
}
- public long getCount(State state){
+ public long getCount(DefinedTermBase<?> state){
return frequency.getCount(state.getLabel());
}
- public List<State> getStates() {
+ public List<DefinedTermBase<?>> getStates() {
return states;
}
public Feature getFeature() {
return feature;
}
-}
+}
\ No newline at end of file
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix;
+
+/*******************************************************************************
+ * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Hannes Erven <hannes@erven.at> - Bug 293841 - [FieldAssist] NumLock keyDown event should not close the proposal popup [with patch]
+ *******************************************************************************/
+
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.jface.bindings.keys.KeyStroke;
+import org.eclipse.jface.dialogs.PopupDialog;
+import org.eclipse.jface.fieldassist.IContentProposal;
+import org.eclipse.jface.fieldassist.IContentProposalListener;
+import org.eclipse.jface.fieldassist.IContentProposalListener2;
+import org.eclipse.jface.fieldassist.IContentProposalProvider;
+import org.eclipse.jface.fieldassist.IControlContentAdapter;
+import org.eclipse.jface.fieldassist.IControlContentAdapter2;
+import org.eclipse.jface.fieldassist.SimpleContentProposalProvider;
+import org.eclipse.jface.preference.JFacePreferences;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.util.Util;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.ScrollBar;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * ContentProposalAdapter can be used to attach content proposal behavior to a
+ * control. This behavior includes obtaining proposals, opening a popup dialog,
+ * managing the content of the control relative to the selections in the popup,
+ * and optionally opening up a secondary popup to further describe proposals.
+ * <p>
+ * A number of configurable options are provided to determine how the control
+ * content is altered when a proposal is chosen, how the content proposal popup
+ * is activated, and whether any filtering should be done on the proposals as
+ * the user types characters.
+ * <p>
+ * This class provides some overridable methods to allow clients to manually
+ * control the popup. However, most of the implementation remains private.
+ *
+ *
+ */
+public class CdmContentProposalAdapter {
+
+ /*
+ * The lightweight popup used to show content proposals for a text field. If
+ * additional information exists for a proposal, then selecting that
+ * proposal will result in the information being displayed in a secondary
+ * popup.
+ */
+ class ContentProposalPopup extends PopupDialog {
+ /*
+ * The listener we install on the popup and related controls to
+ * determine when to close the popup. Some events (move, resize, close,
+ * deactivate) trigger closure as soon as they are received, simply
+ * because one of the registered listeners received them. Other events
+ * depend on additional circumstances.
+ */
+ private final class PopupCloserListener implements Listener {
+ private boolean scrollbarClicked = false;
+
+ @Override
+ public void handleEvent(final Event e) {
+
+ // If focus is leaving an important widget or the field's
+ // shell is deactivating
+ if (e.type == SWT.FocusOut) {
+ scrollbarClicked = false;
+ /*
+ * Ignore this event if it's only happening because focus is
+ * moving between the popup shells, their controls, or a
+ * scrollbar. Do this in an async since the focus is not
+ * actually switched when this event is received.
+ */
+ e.display.asyncExec(() -> {
+ if (isValid()) {
+ if (scrollbarClicked || hasFocus()) {
+ return;
+ }
+ // Workaround a problem on X and Mac, whereby at
+ // this point, the focus control is not known.
+ // This can happen, for example, when resizing
+ // the popup shell on the Mac.
+ // Check the active shell.
+ Shell activeShell = e.display.getActiveShell();
+ if (activeShell == getShell()
+ || (infoPopup != null && infoPopup
+ .getShell() == activeShell)) {
+ return;
+ }
+ /*
+ * System.out.println(e);
+ * System.out.println(e.display.getFocusControl());
+ * System.out.println(e.display.getActiveShell());
+ */
+ close();
+ }
+ });
+ return;
+ }
+
+ // Scroll bar has been clicked. Remember this for focus event
+ // processing.
+ if (e.type == SWT.Selection) {
+ scrollbarClicked = true;
+ return;
+ }
+ // For all other events, merely getting them dictates closure.
+ close();
+ }
+
+ // Install the listeners for events that need to be monitored for
+ // popup closure.
+ void installListeners() {
+ // Listeners on this popup's table and scroll bar
+ proposalTable.addListener(SWT.FocusOut, this);
+ ScrollBar scrollbar = proposalTable.getVerticalBar();
+ if (scrollbar != null) {
+ scrollbar.addListener(SWT.Selection, this);
+ }
+
+ // Listeners on this popup's shell
+ getShell().addListener(SWT.Deactivate, this);
+ getShell().addListener(SWT.Close, this);
+
+ // Listeners on the target control
+ control.addListener(SWT.MouseDoubleClick, this);
+ control.addListener(SWT.MouseDown, this);
+ control.addListener(SWT.Dispose, this);
+ control.addListener(SWT.FocusOut, this);
+ // Listeners on the target control's shell
+ Shell controlShell = control.getShell();
+ controlShell.addListener(SWT.Move, this);
+ controlShell.addListener(SWT.Resize, this);
+
+ }
+
+ // Remove installed listeners
+ void removeListeners() {
+ if (isValid()) {
+ proposalTable.removeListener(SWT.FocusOut, this);
+ ScrollBar scrollbar = proposalTable.getVerticalBar();
+ if (scrollbar != null) {
+ scrollbar.removeListener(SWT.Selection, this);
+ }
+
+ getShell().removeListener(SWT.Deactivate, this);
+ getShell().removeListener(SWT.Close, this);
+ }
+
+ if (control != null && !control.isDisposed()) {
+
+ control.removeListener(SWT.MouseDoubleClick, this);
+ control.removeListener(SWT.MouseDown, this);
+ control.removeListener(SWT.Dispose, this);
+ control.removeListener(SWT.FocusOut, this);
+
+ Shell controlShell = control.getShell();
+ controlShell.removeListener(SWT.Move, this);
+ controlShell.removeListener(SWT.Resize, this);
+ }
+ }
+ }
+
+ /*
+ * The listener we will install on the target control.
+ */
+ private final class TargetControlListener implements Listener {
+ // Key events from the control
+ @Override
+ public void handleEvent(Event e) {
+ if (!isValid()) {
+ return;
+ }
+
+ char key = e.character;
+
+ // Traverse events are handled depending on whether the
+ // event has a character.
+ if (e.type == SWT.Traverse) {
+ // If the traverse event contains a legitimate character,
+ // then we must set doit false so that the widget will
+ // receive the key event. We return immediately so that
+ // the character is handled only in the key event.
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=132101
+ if (key != 0) {
+ e.doit = false;
+ return;
+ }
+ // Traversal does not contain a character. Set doit true
+ // to indicate TRAVERSE_NONE will occur and that no key
+ // event will be triggered. We will check for navigation
+ // keys below.
+ e.detail = SWT.TRAVERSE_NONE;
+ e.doit = true;
+ } else {
+ // Default is to only propagate when configured that way.
+ // Some keys will always set doit to false anyway.
+ e.doit = propagateKeys;
+ }
+
+ // No character. Check for navigation keys.
+
+ if (key == 0) {
+ int newSelection = proposalTable.getSelectionIndex();
+ int visibleRows = (proposalTable.getSize().y / proposalTable
+ .getItemHeight()) - 1;
+ switch (e.keyCode) {
+ case SWT.ARROW_UP:
+ newSelection -= 1;
+ if (newSelection < 0) {
+ newSelection = proposalTable.getItemCount() - 1;
+ }
+ // Not typical - usually we get this as a Traverse and
+ // therefore it never propagates. Added for consistency.
+ if (e.type == SWT.KeyDown) {
+ // don't propagate to control
+ e.doit = false;
+ }
+
+ break;
+
+ case SWT.ARROW_DOWN:
+ newSelection += 1;
+ if (newSelection > proposalTable.getItemCount() - 1) {
+ newSelection = 0;
+ }
+ // Not typical - usually we get this as a Traverse and
+ // therefore it never propagates. Added for consistency.
+ if (e.type == SWT.KeyDown) {
+ // don't propagate to control
+ e.doit = false;
+ }
+
+ break;
+
+ case SWT.PAGE_DOWN:
+ newSelection += visibleRows;
+ if (newSelection >= proposalTable.getItemCount()) {
+ newSelection = proposalTable.getItemCount() - 1;
+ }
+ if (e.type == SWT.KeyDown) {
+ // don't propagate to control
+ e.doit = false;
+ }
+ break;
+
+ case SWT.PAGE_UP:
+ newSelection -= visibleRows;
+ if (newSelection < 0) {
+ newSelection = 0;
+ }
+ if (e.type == SWT.KeyDown) {
+ // don't propagate to control
+ e.doit = false;
+ }
+ break;
+
+ case SWT.HOME:
+ newSelection = 0;
+ if (e.type == SWT.KeyDown) {
+ // don't propagate to control
+ e.doit = false;
+ }
+ break;
+
+ case SWT.END:
+ newSelection = proposalTable.getItemCount() - 1;
+ if (e.type == SWT.KeyDown) {
+ // don't propagate to control
+ e.doit = false;
+ }
+ break;
+
+ // If received as a Traverse, these should propagate
+ // to the control as keydown. If received as a keydown,
+ // proposals should be recomputed since the cursor
+ // position has changed.
+ case SWT.ARROW_LEFT:
+ case SWT.ARROW_RIGHT:
+ if (e.type == SWT.Traverse) {
+ e.doit = false;
+ } else {
+ e.doit = true;
+ String contents = getControlContentAdapter()
+ .getControlContents(getControl());
+ // If there are no contents, changes in cursor
+ // position have no effect. Note also that we do
+ // not affect the filter text on ARROW_LEFT as
+ // we would with BS.
+ if (contents.length() > 0) {
+ asyncRecomputeProposals(filterText);
+ }
+ }
+ break;
+
+ // Any unknown keycodes will cause the popup to close.
+ // Modifier keys are explicitly checked and ignored because
+ // they are not complete yet (no character).
+ default:
+ if (e.keyCode != SWT.CAPS_LOCK && e.keyCode != SWT.NUM_LOCK
+ && e.keyCode != SWT.MOD1
+ && e.keyCode != SWT.MOD2
+ && e.keyCode != SWT.MOD3
+ && e.keyCode != SWT.MOD4) {
+ close();
+ }
+ return;
+ }
+
+ // If any of these navigation events caused a new selection,
+ // then handle that now and return.
+ if (newSelection >= 0) {
+ selectProposal(newSelection);
+ }
+ return;
+ }
+
+ // key != 0
+ // Check for special keys involved in cancelling, accepting, or
+ // filtering the proposals.
+ switch (key) {
+ case SWT.ESC:
+ e.doit = false;
+ close();
+ break;
+
+ case SWT.LF:
+ case SWT.CR:
+ e.doit = false;
+ Object p = getSelectedProposal();
+ if (p != null) {
+ acceptCurrentProposal();
+ } else {
+ close();
+ }
+ break;
+
+ case SWT.TAB:
+ e.doit = false;
+ getShell().setFocus();
+ return;
+
+ case SWT.BS:
+ // Backspace should back out of any stored filter text
+ if (filterStyle != FILTER_NONE) {
+ // We have no filter to back out of, so do nothing
+ if (filterText.length() == 0) {
+ return;
+ }
+ // There is filter to back out of
+ filterText = filterText.substring(0, filterText
+ .length() - 1);
+ asyncRecomputeProposals(filterText);
+ return;
+ }
+ // There is no filtering provided by us, but some
+ // clients provide their own filtering based on content.
+ // Recompute the proposals if the cursor position
+ // will change (is not at 0).
+ int pos = getControlContentAdapter().getCursorPosition(
+ getControl());
+ // We rely on the fact that the contents and pos do not yet
+ // reflect the result of the BS. If the contents were
+ // already empty, then BS should not cause
+ // a recompute.
+ if (pos > 0) {
+ asyncRecomputeProposals(filterText);
+ }
+ break;
+
+ default:
+ // If the key is a defined unicode character, and not one of
+ // the special cases processed above, update the filter text
+ // and filter the proposals.
+ if (Character.isDefined(key)) {
+ if (filterStyle == FILTER_CUMULATIVE) {
+ filterText = filterText + String.valueOf(key);
+ } else if (filterStyle == FILTER_CHARACTER) {
+ filterText = String.valueOf(key);
+ }
+ // Recompute proposals after processing this event.
+ asyncRecomputeProposals(filterText);
+ }
+ break;
+ }
+ }
+ }
+
+ /*
+ * Internal class used to implement the secondary popup.
+ */
+ private class InfoPopupDialog extends PopupDialog {
+
+ /*
+ * The text control that displays the text.
+ */
+ private Text text;
+
+ /*
+ * The String shown in the popup.
+ */
+ private String contents = EMPTY;
+
+ /*
+ * Construct an info-popup with the specified parent.
+ */
+ InfoPopupDialog(Shell parent) {
+ super(parent, PopupDialog.HOVER_SHELLSTYLE, false, false, false,
+ false, false, null, null);
+ }
+
+ /*
+ * Create a text control for showing the info about a proposal.
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP
+ | SWT.NO_FOCUS);
+
+ // Use the compact margins employed by PopupDialog.
+ GridData gd = new GridData(GridData.BEGINNING
+ | GridData.FILL_BOTH);
+ gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING;
+ gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING;
+ text.setLayoutData(gd);
+ text.setText(contents);
+
+ // since SWT.NO_FOCUS is only a hint...
+ text.addFocusListener(new FocusAdapter() {
+ @Override
+ public void focusGained(FocusEvent event) {
+ ContentProposalPopup.this.close();
+ }
+ });
+ return text;
+ }
+
+ /*
+ * Adjust the bounds so that we appear adjacent to our parent shell
+ */
+ @Override
+ protected void adjustBounds() {
+ Rectangle parentBounds = getParentShell().getBounds();
+ Rectangle proposedBounds;
+ // Try placing the info popup to the right
+ Rectangle rightProposedBounds = new Rectangle(parentBounds.x
+ + parentBounds.width
+ + PopupDialog.POPUP_HORIZONTALSPACING, parentBounds.y
+ + PopupDialog.POPUP_VERTICALSPACING,
+ parentBounds.width, parentBounds.height);
+ rightProposedBounds = getConstrainedShellBounds(rightProposedBounds);
+ // If it won't fit on the right, try the left
+ if (rightProposedBounds.intersects(parentBounds)) {
+ Rectangle leftProposedBounds = new Rectangle(parentBounds.x
+ - parentBounds.width - POPUP_HORIZONTALSPACING - 1,
+ parentBounds.y, parentBounds.width,
+ parentBounds.height);
+ leftProposedBounds = getConstrainedShellBounds(leftProposedBounds);
+ // If it won't fit on the left, choose the proposed bounds
+ // that fits the best
+ if (leftProposedBounds.intersects(parentBounds)) {
+ if (rightProposedBounds.x - parentBounds.x >= parentBounds.x
+ - leftProposedBounds.x) {
+ rightProposedBounds.x = parentBounds.x
+ + parentBounds.width
+ + PopupDialog.POPUP_HORIZONTALSPACING;
+ proposedBounds = rightProposedBounds;
+ } else {
+ leftProposedBounds.width = parentBounds.x
+ - POPUP_HORIZONTALSPACING
+ - leftProposedBounds.x;
+ proposedBounds = leftProposedBounds;
+ }
+ } else {
+ // use the proposed bounds on the left
+ proposedBounds = leftProposedBounds;
+ }
+ } else {
+ // use the proposed bounds on the right
+ proposedBounds = rightProposedBounds;
+ }
+ getShell().setBounds(proposedBounds);
+ }
+
+ @Override
+ protected Color getForeground() {
+ return control.getDisplay().
+ getSystemColor(SWT.COLOR_INFO_FOREGROUND);
+ }
+
+ @Override
+ protected Color getBackground() {
+ return control.getDisplay().
+ getSystemColor(SWT.COLOR_INFO_BACKGROUND);
+ }
+
+ /*
+ * Set the text contents of the popup.
+ */
+ void setContents(String newContents) {
+ if (newContents == null) {
+ newContents = EMPTY;
+ }
+ this.contents = newContents;
+ if (text != null && !text.isDisposed()) {
+ text.setText(contents);
+ }
+ }
+
+ /*
+ * Return whether the popup has focus.
+ */
+ boolean hasFocus() {
+ if (text == null || text.isDisposed()) {
+ return false;
+ }
+ return text.getShell().isFocusControl()
+ || text.isFocusControl();
+ }
+ }
+
+ /*
+ * The listener installed on the target control.
+ */
+ private Listener targetControlListener;
+
+ /*
+ * The listener installed in order to close the popup.
+ */
+ private PopupCloserListener popupCloser;
+
+ /*
+ * The table used to show the list of proposals.
+ */
+ private Table proposalTable;
+
+ /*
+ * The proposals to be shown (cached to avoid repeated requests).
+ */
+ private IContentProposal[] proposals;
+
+ /*
+ * Secondary popup used to show detailed information about the selected
+ * proposal..
+ */
+ private InfoPopupDialog infoPopup;
+
+ /*
+ * Flag indicating whether there is a pending secondary popup update.
+ */
+ private boolean pendingDescriptionUpdate = false;
+
+ /*
+ * Filter text - tracked while popup is open, only if we are told to
+ * filter
+ */
+ private String filterText = EMPTY;
+
+ /**
+ * Constructs a new instance of this popup, specifying the control for
+ * which this popup is showing content, and how the proposals should be
+ * obtained and displayed.
+ *
+ * @param infoText
+ * Text to be shown in a lower info area, or
+ * <code>null</code> if there is no info area.
+ */
+ ContentProposalPopup(String infoText, IContentProposal[] proposals) {
+ // IMPORTANT: Use of SWT.ON_TOP is critical here for ensuring
+ // that the target control retains focus on Mac and Linux. Without
+ // it, the focus will disappear, keystrokes will not go to the
+ // popup, and the popup closer will wrongly close the popup.
+ // On platforms where SWT.ON_TOP overrides SWT.RESIZE, we will live
+ // with this.
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=126138
+ super(control.getShell(), SWT.RESIZE | SWT.ON_TOP, false, false, false,
+ false, false, null, infoText);
+ this.proposals = proposals;
+ }
+
+ @Override
+ protected Color getForeground() {
+ return JFaceResources.getColorRegistry().get(
+ JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR);
+ }
+
+ @Override
+ protected Color getBackground() {
+ return JFaceResources.getColorRegistry().get(
+ JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
+ }
+
+ /*
+ * Creates the content area for the proposal popup. This creates a table
+ * and places it inside the composite. The table will contain a list of
+ * all the proposals.
+ *
+ * @param parent The parent composite to contain the dialog area; must
+ * not be <code>null</code>.
+ */
+ @Override
+ protected final Control createDialogArea(final Composite parent) {
+ // Use virtual where appropriate (see flag definition).
+ if (USE_VIRTUAL) {
+ proposalTable = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL
+ | SWT.VIRTUAL);
+
+ Listener listener = event -> handleSetData(event);
+ proposalTable.addListener(SWT.SetData, listener);
+ } else {
+ proposalTable = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL);
+ }
+
+ // set the proposals to force population of the table.
+ setProposals(filterProposals(proposals, filterText));
+
+ proposalTable.setHeaderVisible(false);
+ proposalTable.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ // If a proposal has been selected, show it in the secondary
+ // popup. Otherwise close the popup.
+ if (e.item == null) {
+ if (infoPopup != null) {
+ infoPopup.close();
+ }
+ } else {
+ showProposalDescription();
+ }
+ }
+
+ // Default selection was made. Accept the current proposal.
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ acceptCurrentProposal();
+ }
+ });
+ return proposalTable;
+ }
+
+ @Override
+ protected void adjustBounds() {
+ // Get our control's location in display coordinates.
+ Point location = control.getDisplay().map(control.getParent(), null, control.getLocation());
+ int initialX = location.x + POPUP_OFFSET;
+ int initialY = location.y + control.getSize().y + POPUP_OFFSET;
+ // If we are inserting content, use the cursor position to
+ // position the control.
+ if (getProposalAcceptanceStyle() == PROPOSAL_INSERT) {
+ Rectangle insertionBounds = controlContentAdapter
+ .getInsertionBounds(control);
+ initialX = initialX + insertionBounds.x;
+ initialY = location.y + insertionBounds.y
+ + insertionBounds.height;
+ }
+
+ // If there is no specified size, force it by setting
+ // up a layout on the table.
+ if (popupSize == null) {
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.heightHint = proposalTable.getItemHeight()
+ * POPUP_CHAR_HEIGHT;
+ data.widthHint = Math.max(control.getSize().x,
+ POPUP_MINIMUM_WIDTH);
+ proposalTable.setLayoutData(data);
+ getShell().pack();
+ popupSize = getShell().getSize();
+ }
+
+ // Constrain to the display
+ Rectangle constrainedBounds = getConstrainedShellBounds(new Rectangle(initialX, initialY, popupSize.x, popupSize.y));
+
+ // If there has been an adjustment causing the popup to overlap
+ // with the control, then put the popup above the control.
+ if (constrainedBounds.y < initialY)
+ getShell().setBounds(initialX, location.y - popupSize.y, popupSize.x, popupSize.y);
+ else
+ getShell().setBounds(initialX, initialY, popupSize.x, popupSize.y);
+
+ // Now set up a listener to monitor any changes in size.
+ getShell().addListener(SWT.Resize, e -> {
+ popupSize = getShell().getSize();
+ if (infoPopup != null) {
+ infoPopup.adjustBounds();
+ }
+ });
+ }
+
+ /*
+ * Handle the set data event. Set the item data of the requested item to
+ * the corresponding proposal in the proposal cache.
+ */
+ private void handleSetData(Event event) {
+ TableItem item = (TableItem) event.item;
+ int index = proposalTable.indexOf(item);
+
+ if (0 <= index && index < proposals.length) {
+ IContentProposal current = proposals[index];
+ item.setText(getString(current));
+ item.setImage(getImage(current));
+ item.setData(current);
+ } else {
+ // this should not happen, but does on win32
+ }
+ }
+
+ /*
+ * Caches the specified proposals and repopulates the table if it has
+ * been created.
+ */
+ private void setProposals(IContentProposal[] newProposals) {
+ if (newProposals == null || newProposals.length == 0) {
+ newProposals = getEmptyProposalArray();
+ }
+ this.proposals = newProposals;
+
+ // If there is a table
+ if (isValid()) {
+ final int newSize = newProposals.length;
+ if (USE_VIRTUAL) {
+ // Set and clear the virtual table. Data will be
+ // provided in the SWT.SetData event handler.
+ proposalTable.setItemCount(newSize);
+ proposalTable.clearAll();
+ } else {
+ // Populate the table manually
+ proposalTable.setRedraw(false);
+ proposalTable.setItemCount(newSize);
+ TableItem[] items = proposalTable.getItems();
+ for (int i = 0; i < items.length; i++) {
+ TableItem item = items[i];
+ IContentProposal proposal = newProposals[i];
+ item.setText(getString(proposal));
+ item.setImage(getImage(proposal));
+ item.setData(proposal);
+ }
+ proposalTable.setRedraw(true);
+ }
+ // Default to the first selection if there is content.
+ if (newProposals.length > 0) {
+ selectProposal(0);
+ } else {
+ // No selection, close the secondary popup if it was open
+ if (infoPopup != null) {
+ infoPopup.close();
+ }
+
+ }
+ }
+ }
+
+ /*
+ * Get the string for the specified proposal. Always return a String of
+ * some kind.
+ */
+ private String getString(IContentProposal proposal) {
+ if (proposal == null) {
+ return EMPTY;
+ }
+ if (labelProvider == null) {
+ return proposal.getLabel() == null ? proposal.getContent()
+ : proposal.getLabel();
+ }
+ return labelProvider.getText(proposal);
+ }
+
+ /*
+ * Get the image for the specified proposal. If there is no image
+ * available, return null.
+ */
+ private Image getImage(IContentProposal proposal) {
+ if (proposal == null || labelProvider == null) {
+ return null;
+ }
+ return labelProvider.getImage(proposal);
+ }
+
+ /*
+ * Return an empty array. Used so that something always shows in the
+ * proposal popup, even if no proposal provider was specified.
+ */
+ private IContentProposal[] getEmptyProposalArray() {
+ return new IContentProposal[0];
+ }
+
+ /*
+ * Answer true if the popup is valid, which means the table has been
+ * created and not disposed.
+ */
+ private boolean isValid() {
+ return proposalTable != null && !proposalTable.isDisposed();
+ }
+
+ /*
+ * Return whether the receiver has focus. Since 3.4, this includes a
+ * check for whether the info popup has focus.
+ */
+ private boolean hasFocus() {
+ if (!isValid()) {
+ return false;
+ }
+ if (getShell().isFocusControl() || proposalTable.isFocusControl()) {
+ return true;
+ }
+ if (infoPopup != null && infoPopup.hasFocus()) {
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * Return the current selected proposal.
+ */
+ private IContentProposal getSelectedProposal() {
+ if (isValid()) {
+ int i = proposalTable.getSelectionIndex();
+ if (proposals == null || i < 0 || i >= proposals.length) {
+ return null;
+ }
+ return proposals[i];
+ }
+ return null;
+ }
+
+ /*
+ * Select the proposal at the given index.
+ */
+ private void selectProposal(int index) {
+ Assert
+ .isTrue(index >= 0,
+ "Proposal index should never be negative"); //$NON-NLS-1$
+ if (!isValid() || proposals == null || index >= proposals.length) {
+ return;
+ }
+ proposalTable.setSelection(index);
+ proposalTable.showSelection();
+
+ showProposalDescription();
+ }
+
+ /**
+ * Opens this ContentProposalPopup. This method is extended in order to
+ * add the control listener when the popup is opened and to invoke the
+ * secondary popup if applicable.
+ *
+ * @return the return code
+ *
+ * @see org.eclipse.jface.window.Window#open()
+ */
+ @Override
+ public int open() {
+ int value = super.open();
+ if (popupCloser == null) {
+ popupCloser = new PopupCloserListener();
+ }
+ popupCloser.installListeners();
+ IContentProposal p = getSelectedProposal();
+ if (p != null) {
+ showProposalDescription();
+ }
+ return value;
+ }
+
+ /**
+ * Closes this popup. This method is extended to remove the control
+ * listener.
+ *
+ * @return <code>true</code> if the window is (or was already) closed,
+ * and <code>false</code> if it is still open
+ */
+ @Override
+ public boolean close() {
+ popupCloser.removeListeners();
+ if (infoPopup != null) {
+ infoPopup.close();
+ }
+ boolean ret = super.close();
+ notifyPopupClosed();
+ return ret;
+ }
+
+ /*
+ * Show the currently selected proposal's description in a secondary
+ * popup.
+ */
+ private void showProposalDescription() {
+ // If we do not already have a pending update, then
+ // create a thread now that will show the proposal description
+ if (!pendingDescriptionUpdate) {
+ // Create a thread that will sleep for the specified delay
+ // before creating the popup. We do not use Jobs since this
+ // code must be able to run independently of the Eclipse
+ // runtime.
+ Runnable runnable = () -> {
+ pendingDescriptionUpdate = true;
+ try {
+ Thread.sleep(POPUP_DELAY);
+ } catch (InterruptedException e) {
+ }
+ if (!isValid()) {
+ return;
+ }
+ getShell().getDisplay().syncExec(() -> {
+ // Query the current selection since we have
+ // been delayed
+ IContentProposal p = getSelectedProposal();
+ if (p != null) {
+ String description = p.getDescription();
+ if (description != null) {
+ if (infoPopup == null) {
+ infoPopup = new InfoPopupDialog(
+ getShell());
+ infoPopup.open();
+ infoPopup
+ .getShell()
+ .addDisposeListener(
+ event -> infoPopup = null);
+ }
+ infoPopup.setContents(p
+ .getDescription());
+ } else if (infoPopup != null) {
+ infoPopup.close();
+ }
+ pendingDescriptionUpdate = false;
+
+ }
+ });
+ };
+ Thread t = new Thread(runnable);
+ t.start();
+ }
+ }
+
+ /*
+ * Accept the current proposal.
+ */
+ private void acceptCurrentProposal() {
+ // Close before accepting the proposal. This is important
+ // so that the cursor position can be properly restored at
+ // acceptance, which does not work without focus on some controls.
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=127108
+ IContentProposal proposal = getSelectedProposal();
+ close();
+ proposalAccepted(proposal);
+ }
+
+ /*
+ * Request the proposals from the proposal provider, and recompute any
+ * caches. Repopulate the popup if it is open.
+ */
+ private void recomputeProposals(String filterText) {
+ IContentProposal[] allProposals = getProposals();
+ if (allProposals == null)
+ allProposals = getEmptyProposalArray();
+ // If the non-filtered proposal list is empty, we should
+ // close the popup.
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=147377
+ if (allProposals.length == 0) {
+ proposals = allProposals;
+ close();
+ } else {
+ // Keep the popup open, but filter by any provided filter text
+ setProposals(filterProposals(allProposals, filterText));
+ }
+ }
+
+ /*
+ * In an async block, request the proposals. This is used when clients
+ * are in the middle of processing an event that affects the widget
+ * content. By using an async, we ensure that the widget content is up
+ * to date with the event.
+ */
+ private void asyncRecomputeProposals(final String filterText) {
+ if (isValid()) {
+ control.getDisplay().asyncExec(() -> {
+ recordCursorPosition();
+ recomputeProposals(filterText);
+ });
+ } else {
+ recomputeProposals(filterText);
+ }
+ }
+
+ /*
+ * Filter the provided list of content proposals according to the filter
+ * text.
+ */
+ private IContentProposal[] filterProposals(
+ IContentProposal[] proposals, String filterString) {
+ if (filterString.length() == 0) {
+ return proposals;
+ }
+
+ // Check each string for a match. Use the string displayed to the
+ // user, not the proposal content.
+ ArrayList<IContentProposal> list = new ArrayList<>();
+ for (int i = 0; i < proposals.length; i++) {
+ String string = getString(proposals[i]);
+ if (string.length() >= filterString.length()
+ && string.substring(0, filterString.length())
+ .equalsIgnoreCase(filterString)) {
+ list.add(proposals[i]);
+ }
+
+ }
+ return list.toArray(new IContentProposal[list
+ .size()]);
+ }
+
+ Listener getTargetControlListener() {
+ if (targetControlListener == null) {
+ targetControlListener = new TargetControlListener();
+ }
+ return targetControlListener;
+ }
+ }
+
+ /**
+ * Flag that controls the printing of debug info.
+ */
+ public static final boolean DEBUG = false;
+
+ /**
+ * Indicates that a chosen proposal should be inserted into the field.
+ */
+ public static final int PROPOSAL_INSERT = 1;
+
+ /**
+ * Indicates that a chosen proposal should replace the entire contents of
+ * the field.
+ */
+ public static final int PROPOSAL_REPLACE = 2;
+
+ /**
+ * Indicates that the contents of the control should not be modified when a
+ * proposal is chosen. This is typically used when a client needs more
+ * specialized behavior when a proposal is chosen. In this case, clients
+ * typically register an IContentProposalListener so that they are notified
+ * when a proposal is chosen.
+ */
+ public static final int PROPOSAL_IGNORE = 3;
+
+ /**
+ * Indicates that there should be no filter applied as keys are typed in the
+ * popup.
+ */
+ public static final int FILTER_NONE = 1;
+
+ /**
+ * Indicates that a single character filter applies as keys are typed in the
+ * popup.
+ */
+ public static final int FILTER_CHARACTER = 2;
+
+ /**
+ * Indicates that a cumulative filter applies as keys are typed in the
+ * popup. That is, each character typed will be added to the filter.
+ *
+ * @deprecated As of 3.4, filtering that is sensitive to changes in the
+ * control content should be performed by the supplied
+ * {@link IContentProposalProvider}, such as that performed by
+ * {@link SimpleContentProposalProvider}
+ */
+ @Deprecated
+ public static final int FILTER_CUMULATIVE = 3;
+
+ /*
+ * Set to <code>true</code> to use a Table with SWT.VIRTUAL. This is a
+ * workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=98585#c40
+ * The corresponding SWT bug is
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=90321
+ */
+ private static final boolean USE_VIRTUAL = !Util.isMotif();
+
+ /*
+ * The delay before showing a secondary popup.
+ */
+ private static final int POPUP_DELAY = 750;
+
+ /*
+ * The character height hint for the popup. May be overridden by using
+ * setInitialPopupSize.
+ */
+ private static final int POPUP_CHAR_HEIGHT = 10;
+
+ /*
+ * The minimum pixel width for the popup. May be overridden by using
+ * setInitialPopupSize.
+ */
+ private static final int POPUP_MINIMUM_WIDTH = 300;
+
+ /*
+ * The pixel offset of the popup from the bottom corner of the control.
+ */
+ private static final int POPUP_OFFSET = 3;
+
+ /*
+ * Empty string.
+ */
+ private static final String EMPTY = ""; //$NON-NLS-1$
+
+ /*
+ * The object that provides content proposals.
+ */
+ private IContentProposalProvider proposalProvider;
+
+ /*
+ * A label provider used to display proposals in the popup, and to extract
+ * Strings from non-String proposals.
+ */
+ private ILabelProvider labelProvider;
+
+ /*
+ * The control for which content proposals are provided.
+ */
+ private Control control;
+
+ /*
+ * The adapter used to extract the String contents from an arbitrary
+ * control.
+ */
+ private IControlContentAdapter controlContentAdapter;
+
+ /*
+ * The popup used to show proposals.
+ */
+ private ContentProposalPopup popup;
+
+ /*
+ * The keystroke that signifies content proposals should be shown.
+ */
+ private KeyStroke triggerKeyStroke;
+
+ /*
+ * The String containing characters that auto-activate the popup.
+ */
+ private String autoActivateString;
+
+ /*
+ * Integer that indicates how an accepted proposal should affect the
+ * control. One of PROPOSAL_IGNORE, PROPOSAL_INSERT, or PROPOSAL_REPLACE.
+ * Default value is PROPOSAL_INSERT.
+ */
+ private int proposalAcceptanceStyle = PROPOSAL_INSERT;
+
+ /*
+ * A boolean that indicates whether key events received while the proposal
+ * popup is open should also be propagated to the control. Default value is
+ * true.
+ */
+ private boolean propagateKeys = true;
+
+ /*
+ * Integer that indicates the filtering style. One of FILTER_CHARACTER,
+ * FILTER_CUMULATIVE, FILTER_NONE.
+ */
+ private int filterStyle = FILTER_NONE;
+
+ /*
+ * The listener we install on the control.
+ */
+ private Listener controlListener;
+
+ /*
+ * The list of IContentProposalListener listeners.
+ */
+ private ListenerList proposalListeners = new ListenerList();
+
+ /*
+ * The list of IContentProposalListener2 listeners.
+ */
+ private ListenerList proposalListeners2 = new ListenerList();
+
+ /*
+ * Flag that indicates whether the adapter is enabled. In some cases,
+ * adapters may be installed but depend upon outside state.
+ */
+ private boolean isEnabled = true;
+
+ /*
+ * The delay in milliseconds used when autoactivating the popup.
+ */
+ private int autoActivationDelay = 0;
+
+ /*
+ * A boolean indicating whether a keystroke has been received. Used to see
+ * if an autoactivation delay was interrupted by a keystroke.
+ */
+ private boolean receivedKeyDown;
+
+ /*
+ * The desired size in pixels of the proposal popup.
+ */
+ private Point popupSize;
+
+ /*
+ * The remembered position of the insertion position. Not all controls will
+ * restore the insertion position if the proposal popup gets focus, so we
+ * need to remember it.
+ */
+ private int insertionPos = -1;
+
+ /*
+ * The remembered selection range. Not all controls will restore the
+ * selection position if the proposal popup gets focus, so we need to
+ * remember it.
+ */
+ private Point selectionRange = new Point(-1, -1);
+
+ /*
+ * A flag that indicates that we are watching modify events
+ */
+ private boolean watchModify = false;
+
+ /**
+ * Construct a content proposal adapter that can assist the user with
+ * choosing content for the field.
+ *
+ * @param control
+ * the control for which the adapter is providing content assist.
+ * May not be <code>null</code>.
+ * @param controlContentAdapter
+ * the <code>IControlContentAdapter</code> used to obtain and
+ * update the control's contents as proposals are accepted. May
+ * not be <code>null</code>.
+ * @param proposalProvider
+ * the <code>IContentProposalProvider</code> used to obtain
+ * content proposals for this control, or <code>null</code> if
+ * no content proposal is available.
+ * @param keyStroke
+ * the keystroke that will invoke the content proposal popup. If
+ * this value is <code>null</code>, then proposals will be
+ * activated automatically when any of the auto activation
+ * characters are typed.
+ * @param autoActivationCharacters
+ * An array of characters that trigger auto-activation of content
+ * proposal. If specified, these characters will trigger
+ * auto-activation of the proposal popup, regardless of whether
+ * an explicit invocation keyStroke was specified. If this
+ * parameter is <code>null</code>, then only a specified
+ * keyStroke will invoke content proposal. If this parameter is
+ * <code>null</code> and the keyStroke parameter is
+ * <code>null</code>, then all alphanumeric characters will
+ * auto-activate content proposal.
+ */
+ public CdmContentProposalAdapter(Control control,
+ IControlContentAdapter controlContentAdapter,
+ IContentProposalProvider proposalProvider, KeyStroke keyStroke,
+ char[] autoActivationCharacters) {
+ super();
+ // We always assume the control and content adapter are valid.
+ Assert.isNotNull(control);
+ Assert.isNotNull(controlContentAdapter);
+ this.control = control;
+ this.controlContentAdapter = controlContentAdapter;
+
+ // The rest of these may be null
+ this.proposalProvider = proposalProvider;
+ this.triggerKeyStroke = keyStroke;
+ if (autoActivationCharacters != null) {
+ this.autoActivateString = new String(autoActivationCharacters);
+ }
+ addControlListener(control);
+ }
+
+ /**
+ * Get the control on which the content proposal adapter is installed.
+ *
+ * @return the control on which the proposal adapter is installed.
+ */
+ public Control getControl() {
+ return control;
+ }
+
+ /**
+ * Get the label provider that is used to show proposals.
+ *
+ * @return the {@link ILabelProvider} used to show proposals, or
+ * <code>null</code> if one has not been installed.
+ */
+ public ILabelProvider getLabelProvider() {
+ return labelProvider;
+ }
+
+ /**
+ * Return a boolean indicating whether the receiver is enabled.
+ *
+ * @return <code>true</code> if the adapter is enabled, and
+ * <code>false</code> if it is not.
+ */
+ public boolean isEnabled() {
+ return isEnabled;
+ }
+
+ /**
+ * Set the label provider that is used to show proposals. The lifecycle of
+ * the specified label provider is not managed by this adapter. Clients must
+ * dispose the label provider when it is no longer needed.
+ *
+ * @param labelProvider
+ * the {@link ILabelProvider} used to show proposals.
+ */
+ public void setLabelProvider(ILabelProvider labelProvider) {
+ this.labelProvider = labelProvider;
+ }
+
+ /**
+ * Return the proposal provider that provides content proposals given the
+ * current content of the field. A value of <code>null</code> indicates
+ * that there are no content proposals available for the field.
+ *
+ * @return the {@link IContentProposalProvider} used to show proposals. May
+ * be <code>null</code>.
+ */
+ public IContentProposalProvider getContentProposalProvider() {
+ return proposalProvider;
+ }
+
+ /**
+ * Set the content proposal provider that is used to show proposals.
+ *
+ * @param proposalProvider
+ * the {@link IContentProposalProvider} used to show proposals
+ */
+ public void setContentProposalProvider(
+ IContentProposalProvider proposalProvider) {
+ this.proposalProvider = proposalProvider;
+ }
+
+ /**
+ * Return the array of characters on which the popup is autoactivated.
+ *
+ * @return An array of characters that trigger auto-activation of content
+ * proposal. If specified, these characters will trigger
+ * auto-activation of the proposal popup, regardless of whether an
+ * explicit invocation keyStroke was specified. If this parameter is
+ * <code>null</code>, then only a specified keyStroke will invoke
+ * content proposal. If this value is <code>null</code> and the
+ * keyStroke value is <code>null</code>, then all alphanumeric
+ * characters will auto-activate content proposal.
+ */
+ public char[] getAutoActivationCharacters() {
+ if (autoActivateString == null) {
+ return null;
+ }
+ return autoActivateString.toCharArray();
+ }
+
+ /**
+ * Set the array of characters that will trigger autoactivation of the
+ * popup.
+ *
+ * @param autoActivationCharacters
+ * An array of characters that trigger auto-activation of content
+ * proposal. If specified, these characters will trigger
+ * auto-activation of the proposal popup, regardless of whether
+ * an explicit invocation keyStroke was specified. If this
+ * parameter is <code>null</code>, then only a specified
+ * keyStroke will invoke content proposal. If this parameter is
+ * <code>null</code> and the keyStroke value is
+ * <code>null</code>, then all alphanumeric characters will
+ * auto-activate content proposal.
+ *
+ */
+ public void setAutoActivationCharacters(char[] autoActivationCharacters) {
+ if (autoActivationCharacters == null) {
+ this.autoActivateString = null;
+ } else {
+ this.autoActivateString = new String(autoActivationCharacters);
+ }
+ }
+
+ /**
+ * Set the delay, in milliseconds, used before any autoactivation is
+ * triggered.
+ *
+ * @return the time in milliseconds that will pass before a popup is
+ * automatically opened
+ */
+ public int getAutoActivationDelay() {
+ return autoActivationDelay;
+
+ }
+
+ /**
+ * Set the delay, in milliseconds, used before autoactivation is triggered.
+ *
+ * @param delay
+ * the time in milliseconds that will pass before a popup is
+ * automatically opened
+ */
+ public void setAutoActivationDelay(int delay) {
+ autoActivationDelay = delay;
+
+ }
+
+ /**
+ * Get the integer style that indicates how an accepted proposal affects the
+ * control's content.
+ *
+ * @return a constant indicating how an accepted proposal should affect the
+ * control's content. Should be one of <code>PROPOSAL_INSERT</code>,
+ * <code>PROPOSAL_REPLACE</code>, or <code>PROPOSAL_IGNORE</code>.
+ * (Default is <code>PROPOSAL_INSERT</code>).
+ */
+ public int getProposalAcceptanceStyle() {
+ return proposalAcceptanceStyle;
+ }
+
+ /**
+ * Set the integer style that indicates how an accepted proposal affects the
+ * control's content.
+ *
+ * @param acceptance
+ * a constant indicating how an accepted proposal should affect
+ * the control's content. Should be one of
+ * <code>PROPOSAL_INSERT</code>, <code>PROPOSAL_REPLACE</code>,
+ * or <code>PROPOSAL_IGNORE</code>
+ */
+ public void setProposalAcceptanceStyle(int acceptance) {
+ proposalAcceptanceStyle = acceptance;
+ }
+
+ /**
+ * Return the integer style that indicates how keystrokes affect the content
+ * of the proposal popup while it is open.
+ *
+ * @return a constant indicating how keystrokes in the proposal popup affect
+ * filtering of the proposals shown. <code>FILTER_NONE</code>
+ * specifies that no filtering will occur in the content proposal
+ * list as keys are typed. <code>FILTER_CHARACTER</code> specifies
+ * the content of the popup will be filtered by the most recently
+ * typed character. <code>FILTER_CUMULATIVE</code> is deprecated
+ * and no longer recommended. It specifies that the content of the
+ * popup will be filtered by a string containing all the characters
+ * typed since the popup has been open. The default is
+ * <code>FILTER_NONE</code>.
+ */
+ public int getFilterStyle() {
+ return filterStyle;
+ }
+
+ /**
+ * Set the integer style that indicates how keystrokes affect the content of
+ * the proposal popup while it is open. Popup-based filtering is useful for
+ * narrowing and navigating the list of proposals provided once the popup is
+ * open. Filtering of the proposals will occur even when the control content
+ * is not affected by user typing. Note that automatic filtering is not used
+ * to achieve content-sensitive filtering such as auto-completion. Filtering
+ * that is sensitive to changes in the control content should be performed
+ * by the supplied {@link IContentProposalProvider}.
+ *
+ * @param filterStyle
+ * a constant indicating how keystrokes received in the proposal
+ * popup affect filtering of the proposals shown.
+ * <code>FILTER_NONE</code> specifies that no automatic
+ * filtering of the content proposal list will occur as keys are
+ * typed in the popup. <code>FILTER_CHARACTER</code> specifies
+ * that the content of the popup will be filtered by the most
+ * recently typed character. <code>FILTER_CUMULATIVE</code> is
+ * deprecated and no longer recommended. It specifies that the
+ * content of the popup will be filtered by a string containing
+ * all the characters typed since the popup has been open.
+ */
+ public void setFilterStyle(int filterStyle) {
+ this.filterStyle = filterStyle;
+ }
+
+ /**
+ * Return the size, in pixels, of the content proposal popup.
+ *
+ * @return a Point specifying the last width and height, in pixels, of the
+ * content proposal popup.
+ */
+ public Point getPopupSize() {
+ return popupSize;
+ }
+
+ /**
+ * Set the size, in pixels, of the content proposal popup. This size will be
+ * used the next time the content proposal popup is opened.
+ *
+ * @param size
+ * a Point specifying the desired width and height, in pixels, of
+ * the content proposal popup.
+ */
+ public void setPopupSize(Point size) {
+ popupSize = size;
+ }
+
+ /**
+ * Get the boolean that indicates whether key events (including
+ * auto-activation characters) received by the content proposal popup should
+ * also be propagated to the adapted control when the proposal popup is
+ * open.
+ *
+ * @return a boolean that indicates whether key events (including
+ * auto-activation characters) should be propagated to the adapted
+ * control when the proposal popup is open. Default value is
+ * <code>true</code>.
+ */
+ public boolean getPropagateKeys() {
+ return propagateKeys;
+ }
+
+ /**
+ * Set the boolean that indicates whether key events (including
+ * auto-activation characters) received by the content proposal popup should
+ * also be propagated to the adapted control when the proposal popup is
+ * open.
+ *
+ * @param propagateKeys
+ * a boolean that indicates whether key events (including
+ * auto-activation characters) should be propagated to the
+ * adapted control when the proposal popup is open.
+ */
+ public void setPropagateKeys(boolean propagateKeys) {
+ this.propagateKeys = propagateKeys;
+ }
+
+ /**
+ * Return the content adapter that can get or retrieve the text contents
+ * from the adapter's control. This method is used when a client, such as a
+ * content proposal listener, needs to update the control's contents
+ * manually.
+ *
+ * @return the {@link IControlContentAdapter} which can update the control
+ * text.
+ */
+ public IControlContentAdapter getControlContentAdapter() {
+ return controlContentAdapter;
+ }
+
+ /**
+ * Set the boolean flag that determines whether the adapter is enabled.
+ *
+ * @param enabled
+ * <code>true</code> if the adapter is enabled and responding
+ * to user input, <code>false</code> if it is ignoring user
+ * input.
+ *
+ */
+ public void setEnabled(boolean enabled) {
+ // If we are disabling it while it's proposing content, close the
+ // content proposal popup.
+ if (isEnabled && !enabled) {
+ if (popup != null) {
+ popup.close();
+ }
+ }
+ isEnabled = enabled;
+ }
+
+ /**
+ * Add the specified listener to the list of content proposal listeners that
+ * are notified when content proposals are chosen.
+ * </p>
+ *
+ * @param listener
+ * the IContentProposalListener to be added as a listener. Must
+ * not be <code>null</code>. If an attempt is made to register
+ * an instance which is already registered with this instance,
+ * this method has no effect.
+ *
+ * @see org.eclipse.jface.fieldassist.IContentProposalListener
+ */
+ public void addContentProposalListener(IContentProposalListener listener) {
+ proposalListeners.add(listener);
+ }
+
+ /**
+ * Removes the specified listener from the list of content proposal
+ * listeners that are notified when content proposals are chosen.
+ * </p>
+ *
+ * @param listener
+ * the IContentProposalListener to be removed as a listener. Must
+ * not be <code>null</code>. If the listener has not already
+ * been registered, this method has no effect.
+ *
+ * @since 3.3
+ * @see org.eclipse.jface.fieldassist.IContentProposalListener
+ */
+ public void removeContentProposalListener(IContentProposalListener listener) {
+ proposalListeners.remove(listener);
+ }
+
+ /**
+ * Add the specified listener to the list of content proposal listeners that
+ * are notified when a content proposal popup is opened or closed.
+ * </p>
+ *
+ * @param listener
+ * the IContentProposalListener2 to be added as a listener. Must
+ * not be <code>null</code>. If an attempt is made to register
+ * an instance which is already registered with this instance,
+ * this method has no effect.
+ *
+ * @since 3.3
+ * @see org.eclipse.jface.fieldassist.IContentProposalListener2
+ */
+ public void addContentProposalListener(IContentProposalListener2 listener) {
+ proposalListeners2.add(listener);
+ }
+
+ /**
+ * Remove the specified listener from the list of content proposal listeners
+ * that are notified when a content proposal popup is opened or closed.
+ * </p>
+ *
+ * @param listener
+ * the IContentProposalListener2 to be removed as a listener.
+ * Must not be <code>null</code>. If the listener has not
+ * already been registered, this method has no effect.
+ *
+ * @since 3.3
+ * @see org.eclipse.jface.fieldassist.IContentProposalListener2
+ */
+ public void removeContentProposalListener(IContentProposalListener2 listener) {
+ proposalListeners2.remove(listener);
+ }
+
+ /*
+ * Add our listener to the control. Debug information to be left in until
+ * this support is stable on all platforms.
+ */
+ private void addControlListener(Control control) {
+ if (DEBUG) {
+ System.out
+ .println("ContentProposalListener#installControlListener()"); //$NON-NLS-1$
+ }
+
+ if (controlListener != null) {
+ return;
+ }
+ controlListener = new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ if (!isEnabled) {
+ return;
+ }
+
+ switch (e.type) {
+ case SWT.Traverse:
+ case SWT.KeyDown:
+ if (DEBUG) {
+ StringBuffer sb;
+ if (e.type == SWT.Traverse) {
+ sb = new StringBuffer("Traverse"); //$NON-NLS-1$
+ } else {
+ sb = new StringBuffer("KeyDown"); //$NON-NLS-1$
+ }
+ sb.append(" received by adapter"); //$NON-NLS-1$
+ dump(sb.toString(), e);
+ }
+ // If the popup is open, it gets first shot at the
+ // keystroke and should set the doit flags appropriately.
+ if (popup != null) {
+ popup.getTargetControlListener().handleEvent(e);
+ if (DEBUG) {
+ StringBuffer sb;
+ if (e.type == SWT.Traverse) {
+ sb = new StringBuffer("Traverse"); //$NON-NLS-1$
+ } else {
+ sb = new StringBuffer("KeyDown"); //$NON-NLS-1$
+ }
+ sb.append(" after being handled by popup"); //$NON-NLS-1$
+ dump(sb.toString(), e);
+ }
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=192633
+ // If the popup is open and this is a valid character, we
+ // want to watch for the modified text.
+ if (propagateKeys && e.character != 0)
+ watchModify = true;
+
+ return;
+ }
+
+ // We were only listening to traverse events for the popup
+ if (e.type == SWT.Traverse) {
+ return;
+ }
+
+ // The popup is not open. We are looking at keydown events
+ // for a trigger to open the popup.
+ if (triggerKeyStroke != null) {
+ // Either there are no modifiers for the trigger and we
+ // check the character field...
+ if ((triggerKeyStroke.getModifierKeys() == KeyStroke.NO_KEY && triggerKeyStroke
+ .getNaturalKey() == e.character)
+ ||
+ // ...or there are modifiers, in which case the
+ // keycode and state must match
+ (triggerKeyStroke.getNaturalKey() == e.keyCode && ((triggerKeyStroke
+ .getModifierKeys() & e.stateMask) == triggerKeyStroke
+ .getModifierKeys()))) {
+ // We never propagate the keystroke for an explicit
+ // keystroke invocation of the popup
+ e.doit = false;
+ openProposalPopup(false);
+ return;
+ }
+ }
+ /*
+ * The triggering keystroke was not invoked. If a character
+ * was typed, compare it to the autoactivation characters.
+ */
+ if (e.character != 0) {
+ if (autoActivateString != null) {
+ if (autoActivateString.indexOf(e.character) >= 0) {
+ autoActivate();
+ } else {
+ // No autoactivation occurred, so record the key
+ // down as a means to interrupt any
+ // autoactivation that is pending due to
+ // autoactivation delay.
+ receivedKeyDown = true;
+ // watch the modify so we can close the popup in
+ // cases where there is no longer a trigger
+ // character in the content
+ watchModify = true;
+ }
+ } else {
+ // The autoactivate string is null. If the trigger
+ // is also null, we want to act on any modification
+ // to the content. Set a flag so we'll catch this
+ // in the modify event.
+ if (triggerKeyStroke == null) {
+ watchModify = true;
+ }
+ }
+ } else {
+ // A non-character key has been pressed. Interrupt any
+ // autoactivation that is pending due to autoactivation delay.
+ receivedKeyDown = true;
+ }
+ break;
+
+
+ // There are times when we want to monitor content changes
+ // rather than individual keystrokes to determine whether
+ // the popup should be closed or opened based on the entire
+ // content of the control.
+ // The watchModify flag ensures that we don't autoactivate if
+ // the content change was caused by something other than typing.
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=183650
+ case SWT.Modify:
+ if (allowsAutoActivate() && watchModify) {
+ if (DEBUG) {
+ dump("Modify event triggers popup open or close", e); //$NON-NLS-1$
+ }
+ watchModify = false;
+ // We are in autoactivation mode, either for specific
+ // characters or for all characters. In either case,
+ // we should close the proposal popup when there is no
+ // content in the control.
+ if (isControlContentEmpty()) {
+ // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=192633
+ closeProposalPopup();
+ } else {
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=147377
+ // Given that we will close the popup when there are
+ // no valid proposals, we must consider reopening it on any
+ // content change when there are no particular autoActivation
+ // characters
+ if (autoActivateString == null) {
+ autoActivate();
+ } else {
+ // Autoactivation characters are defined, but this
+ // modify event does not involve one of them. See
+ // if any of the autoactivation characters are left
+ // in the content and close the popup if none remain.
+ if (!shouldPopupRemainOpen())
+ closeProposalPopup();
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * Dump the given events to "standard" output.
+ *
+ * @param who
+ * who is dumping the event
+ * @param e
+ * the event
+ */
+ private void dump(String who, Event e) {
+ StringBuffer sb = new StringBuffer(
+ "--- [ContentProposalAdapter]\n"); //$NON-NLS-1$
+ sb.append(who);
+ sb.append(" - e: keyCode=" + e.keyCode + hex(e.keyCode)); //$NON-NLS-1$
+ sb.append("; character=" + e.character + hex(e.character)); //$NON-NLS-1$
+ sb.append("; stateMask=" + e.stateMask + hex(e.stateMask)); //$NON-NLS-1$
+ sb.append("; doit=" + e.doit); //$NON-NLS-1$
+ sb.append("; detail=" + e.detail + hex(e.detail)); //$NON-NLS-1$
+ sb.append("; widget=" + e.widget); //$NON-NLS-1$
+ System.out.println(sb);
+ }
+
+ private String hex(int i) {
+ return "[0x" + Integer.toHexString(i) + ']'; //$NON-NLS-1$
+ }
+ };
+ control.addListener(SWT.KeyDown, controlListener);
+ control.addListener(SWT.Traverse, controlListener);
+ control.addListener(SWT.Modify, controlListener);
+
+ if (DEBUG) {
+ System.out
+ .println("ContentProposalAdapter#installControlListener() - installed"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Open the proposal popup and display the proposals provided by the
+ * proposal provider. If there are no proposals to be shown, do not show the
+ * popup. This method returns immediately. That is, it does not wait for the
+ * popup to open or a proposal to be selected.
+ *
+ * @param autoActivated
+ * a boolean indicating whether the popup was autoactivated. If
+ * false, a beep will sound when no proposals can be shown.
+ */
+ private void openProposalPopup(boolean autoActivated) {
+ if (isValid()) {
+ if (popup == null) {
+ // Check whether there are any proposals to be shown.
+ recordCursorPosition(); // must be done before getting proposals
+ IContentProposal[] proposals = getProposals();
+ if (proposals == null)
+ return;
+ if (proposals.length > 0) {
+ if (DEBUG) {
+ System.out.println("POPUP OPENED BY PRECEDING EVENT"); //$NON-NLS-1$
+ }
+ recordCursorPosition();
+ popup = new ContentProposalPopup(null, proposals);
+ popup.open();
+ popup.getShell().addDisposeListener(event -> popup = null);
+ internalPopupOpened();
+ notifyPopupOpened();
+ } else if (!autoActivated) {
+ getControl().getDisplay().beep();
+ }
+ }
+ }
+ }
+
+ /**
+ * Open the proposal popup and display the proposals provided by the
+ * proposal provider. This method returns immediately. That is, it does not
+ * wait for a proposal to be selected. This method is used by subclasses to
+ * explicitly invoke the opening of the popup. If there are no proposals to
+ * show, the popup will not open and a beep will be sounded.
+ */
+ protected void openProposalPopup() {
+ openProposalPopup(false);
+ }
+
+ /**
+ * Close the proposal popup without accepting a proposal. This method
+ * returns immediately, and has no effect if the proposal popup was not
+ * open. This method is used by subclasses to explicitly close the popup
+ * based on additional logic.
+ *
+ * @since 3.3
+ */
+ protected void closeProposalPopup() {
+ if (popup != null) {
+ popup.close();
+ }
+ }
+
+ /*
+ * A content proposal has been accepted. Update the control contents
+ * accordingly and notify any listeners.
+ *
+ * @param proposal the accepted proposal
+ */
+ private void proposalAccepted(IContentProposal proposal) {
+ switch (proposalAcceptanceStyle) {
+ case (PROPOSAL_REPLACE):
+ setControlContent(proposal.getContent(), proposal
+ .getCursorPosition());
+ break;
+ case (PROPOSAL_INSERT):
+ insertControlContent(proposal.getContent(), proposal
+ .getCursorPosition());
+ break;
+ default:
+ // do nothing. Typically a listener is installed to handle this in
+ // a custom way.
+ break;
+ }
+
+ // In all cases, notify listeners of an accepted proposal.
+ notifyProposalAccepted(proposal);
+ }
+
+ /*
+ * Set the text content of the control to the specified text, setting the
+ * cursorPosition at the desired location within the new contents.
+ */
+ private void setControlContent(String text, int cursorPosition) {
+ if (isValid()) {
+ // should already be false, but just in case.
+ watchModify = false;
+ controlContentAdapter.setControlContents(control, text,
+ cursorPosition);
+ }
+ }
+
+ /*
+ * Insert the specified text into the control content, setting the
+ * cursorPosition at the desired location within the new contents.
+ */
+ private void insertControlContent(String text, int cursorPosition) {
+ if (isValid()) {
+ // should already be false, but just in case.
+ watchModify = false;
+ // Not all controls preserve their selection index when they lose
+ // focus, so we must set it explicitly here to what it was before
+ // the popup opened.
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=127108
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=139063
+ if (controlContentAdapter instanceof IControlContentAdapter2
+ && selectionRange.x != -1) {
+ ((IControlContentAdapter2) controlContentAdapter).setSelection(
+ control, selectionRange);
+ } else if (insertionPos != -1) {
+ controlContentAdapter.setCursorPosition(control, insertionPos);
+ }
+ controlContentAdapter.insertControlContents(control, text,
+ cursorPosition);
+ }
+ }
+
+ /*
+ * Check that the control and content adapter are valid.
+ */
+ private boolean isValid() {
+ return control != null && !control.isDisposed()
+ && controlContentAdapter != null;
+ }
+
+ /*
+ * Record the control's cursor position.
+ */
+ private void recordCursorPosition() {
+ if (isValid()) {
+ IControlContentAdapter adapter = getControlContentAdapter();
+ insertionPos = adapter.getCursorPosition(control);
+ // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=139063
+ if (adapter instanceof IControlContentAdapter2) {
+ selectionRange = ((IControlContentAdapter2) adapter)
+ .getSelection(control);
+ }
+
+ }
+ }
+
+ /*
+ * Get the proposals from the proposal provider. Gets all of the proposals
+ * without doing any filtering.
+ */
+ private IContentProposal[] getProposals() {
+ if (proposalProvider == null || !isValid()) {
+ return null;
+ }
+ if (DEBUG) {
+ System.out.println(">>> obtaining proposals from provider"); //$NON-NLS-1$
+ }
+ int position = insertionPos;
+ if (position == -1) {
+ position = getControlContentAdapter().getCursorPosition(
+ getControl());
+ }
+ String contents = getControlContentAdapter().getControlContents(
+ getControl());
+ IContentProposal[] proposals = proposalProvider.getProposals(contents,
+ position);
+ return proposals;
+ }
+
+ /**
+ * Autoactivation has been triggered. Open the popup using any specified
+ * delay.
+ */
+ private void autoActivate() {
+ if (autoActivationDelay > 0) {
+ Runnable runnable = () -> {
+ receivedKeyDown = false;
+ try {
+ Thread.sleep(autoActivationDelay);
+ } catch (InterruptedException e) {
+ }
+ if (!isValid() || receivedKeyDown) {
+ return;
+ }
+ getControl().getDisplay().syncExec(() -> openProposalPopup(true));
+ };
+ Thread t = new Thread(runnable);
+ t.start();
+ } else {
+ // Since we do not sleep, we must open the popup
+ // in an async exec. This is necessary because
+ // this method may be called in the middle of handling
+ // some event that will cause the cursor position or
+ // other important info to change as a result of this
+ // event occurring.
+ getControl().getDisplay().asyncExec(() -> {
+ if (isValid()) {
+ openProposalPopup(true);
+ }
+ });
+ }
+ }
+
+ public void activate() {
+ getControl().getDisplay().asyncExec(() -> {
+ if (isValid()) {
+ openProposalPopup(true);
+ }
+ });
+ }
+
+ /*
+ * A proposal has been accepted. Notify interested listeners.
+ */
+ private void notifyProposalAccepted(IContentProposal proposal) {
+ if (DEBUG) {
+ System.out.println("Notify listeners - proposal accepted."); //$NON-NLS-1$
+ }
+ final Object[] listenerArray = proposalListeners.getListeners();
+ for (int i = 0; i < listenerArray.length; i++) {
+ ((IContentProposalListener) listenerArray[i])
+ .proposalAccepted(proposal);
+ }
+ }
+
+ /*
+ * The proposal popup has opened. Notify interested listeners.
+ */
+ private void notifyPopupOpened() {
+ if (DEBUG) {
+ System.out.println("Notify listeners - popup opened."); //$NON-NLS-1$
+ }
+ final Object[] listenerArray = proposalListeners2.getListeners();
+// for (int i = 0; i < listenerArray.length; i++) {
+// ((IContentProposalListener2) listenerArray[i])
+// .proposalPopupOpened(this);
+// }
+ }
+
+ /*
+ * The proposal popup has closed. Notify interested listeners.
+ */
+ private void notifyPopupClosed() {
+ if (DEBUG) {
+ System.out.println("Notify listeners - popup closed."); //$NON-NLS-1$
+ }
+ final Object[] listenerArray = proposalListeners2.getListeners();
+// for (int i = 0; i < listenerArray.length; i++) {
+// ((IContentProposalListener2) listenerArray[i])
+// .proposalPopupClosed(this);
+// }
+ }
+
+ /**
+ * Returns whether the content proposal popup has the focus. This includes
+ * both the primary popup and any secondary info popup that may have focus.
+ *
+ * @return <code>true</code> if the proposal popup or its secondary info
+ * popup has the focus
+ * @since 3.4
+ */
+ public boolean hasProposalPopupFocus() {
+ return popup != null && popup.hasFocus();
+ }
+
+ /*
+ * Return whether the control content is empty
+ */
+ private boolean isControlContentEmpty() {
+ return getControlContentAdapter().getControlContents(getControl())
+ .length() == 0;
+ }
+
+ /*
+ * The popup has just opened, but listeners have not yet
+ * been notified. Perform any cleanup that is needed.
+ */
+ private void internalPopupOpened() {
+ // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=243612
+ if (control instanceof Combo) {
+ ((Combo)control).setListVisible(false);
+ }
+ }
+
+ /*
+ * Return whether a proposal popup should remain open.
+ * If it was autoactivated by specific characters, and
+ * none of those characters remain, then it should not remain
+ * open. This method should not be used to determine
+ * whether autoactivation has occurred or should occur, only whether
+ * the circumstances would dictate that a popup remain open.
+ */
+ private boolean shouldPopupRemainOpen() {
+ // If we always autoactivate or never autoactivate, it should remain open
+ if (autoActivateString == null || autoActivateString.length() == 0)
+ return true;
+ String content = getControlContentAdapter().getControlContents(getControl());
+ for (int i=0; i<autoActivateString.length(); i++) {
+ if (content.indexOf(autoActivateString.charAt(i)) >= 0)
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * Return whether this adapter is configured for autoactivation, by
+ * specific characters or by any characters.
+ */
+ private boolean allowsAutoActivate() {
+ return (autoActivateString != null && autoActivateString.length() > 0) // there are specific autoactivation chars supplied
+ || (autoActivateString == null && triggerKeyStroke == null); // we autoactivate on everything
+ }
+
+ /**
+ * Sets focus to the proposal popup. If the proposal popup is not opened,
+ * this method is ignored. If the secondary popup has focus, focus is
+ * returned to the main proposal popup.
+ *
+ * @since 3.6
+ */
+ public void setProposalPopupFocus() {
+ if (isValid() && popup != null)
+ popup.getShell().setFocus();
+ }
+
+ /**
+ * Answers a boolean indicating whether the main proposal popup is open.
+ *
+ * @return <code>true</code> if the proposal popup is open, and
+ * <code>false</code> if it is not.
+ *
+ * @since 3.6
+ */
+ public boolean isProposalPopupOpen() {
+ if (isValid() && popup != null)
+ return true;
+ return false;
+ }
+
+}
import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration;
import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.config.EditableRule;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.config.IEditableRule;
-import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.gui.ICellEditDialog;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.swt.graphics.Point;
-import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.categorical.CategoricalComboBoxDataProvider;
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.categorical.CategoricalDataCellEditor;
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.categorical.CategoricalDataDisplayConverter;
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.quantitative.QuantitativeDataDialogEditor;
);
//register categorical editor
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR,
- new CategoricalDataCellEditor(matrix, new CategoricalComboBoxDataProvider(matrix)),
+ new CategoricalDataCellEditor(matrix),
DisplayMode.EDIT,
CharacterMatrixConfigLabelAccumulator.CATEGORICAL_EDITABLE
);
new QuantitativeDataDialogEditor(matrix),
DisplayMode.EDIT,
CharacterMatrixConfigLabelAccumulator.QUANTITATIVE_EDITABLE);
+ configRegistry.registerConfigAttribute(
+ EditConfigAttributes.OPEN_IN_DIALOG,
+ Boolean.TRUE,
+ DisplayMode.EDIT,
+ CharacterMatrixConfigLabelAccumulator.CATEGORICAL_EDITABLE);
+ //register categorical editor
+ configRegistry.registerConfigAttribute(
+ EditConfigAttributes.CELL_EDITOR,
+ new CategoricalDataCellEditor(matrix),
+ DisplayMode.EDIT,
+ CharacterMatrixConfigLabelAccumulator.CATEGORICAL_EDITABLE);
+
// configure custom dialog settings
Map<String, Object> editDialogSettings = new HashMap<>();
editDialogSettings.put(ICellEditDialog.DIALOG_SHELL_TITLE, "Quantitative Data");
import org.eclipse.nebula.widgets.nattable.selection.event.CellSelectionEvent;
import org.eclipse.nebula.widgets.nattable.selection.event.RowSelectionEvent;
-import eu.etaxonomy.cdm.api.service.dto.DescriptionBaseDto;
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
+import eu.etaxonomy.cdm.persistence.dto.DescriptionBaseDto;
/**
* @author pplitzner
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
import eu.etaxonomy.cdm.api.service.dto.SpecimenRowWrapperDTO;
import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO;
+import eu.etaxonomy.cdm.api.service.l10n.TermRepresentation_L10n;
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptiveDataSet;
import eu.etaxonomy.cdm.model.description.SpecimenDescription;
import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
import eu.etaxonomy.cdm.persistence.dto.SpecimenNodeWrapper;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.IFeedbackGenerator;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
/**
* Character matrix editor for editing specimen/taxon descriptions in a table
+ *
* @author pplitzner
* @since Nov 26, 2017
*/
private Map<UUID, Integer> featureToIndexMap = new HashMap<>();
private Map<UUID, List<TermDto>> categoricalFeatureToStateMap = new HashMap<>();
+
+ private Map<UUID, List<TermDto>> categoricalFeatureToModifierMap = new HashMap<>();
private LinkedMap<String, String> propertyToLabelMap = new LinkedMap<>();
natTable = new NatTable(this, false);
}
- private void createToolBar(){
+ private void createToolBar() {
toolbar = new CharacterMatrixToolbar(this, SWT.NONE);
}
- private void applyStyles(){
+ private void applyStyles() {
ModernNatTableThemeConfiguration configuration = new ModernNatTableThemeConfiguration();
// NOTE: Getting the colors and fonts from the GUIHelper ensures that
// they are disposed properly (required by SWT)
natTable.addConfiguration(configuration);
}
- void toggleTreeFlat(boolean isTree, Button btnToggleFlat, Button btnToggleTree, Button btnCollapseAll, Button btnExpandAll, Button btnFreezeSuppInfo) {
+ void toggleTreeFlat(boolean isTree, Button btnToggleFlat, Button btnToggleTree, Button btnCollapseAll,
+ Button btnExpandAll, Button btnFreezeSuppInfo) {
isTreeView = isTree;
createTable(isTree, freezeLayer.isFrozen(), true);
btnToggleFlat.setEnabled(isTree);
return isTreeView;
}
- public void createTable(boolean treeView, boolean freezeSupplementalColumns, boolean isInitialExpandToDeepestTaxonLevel){
+ public void createTable(boolean treeView, boolean freezeSupplementalColumns,
+ boolean isInitialExpandToDeepestTaxonLevel) {
/**
* layers
*/
*/
registerHandlersAndListeners();
- //grab all space
+ // grab all space
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
- //update label to current dataset
+ // update label to current dataset
toolbar.getWsLabel().setText(getDescriptiveDataSet().getTitleCache());
toolbar.getWsLabel().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
toolbar.getWsLabel().getParent().layout();
- //initial freeze of supplemental columns
+ // initial freeze of supplemental columns
freezeSupplementalColumns(freezeSupplementalColumns);
-
- //add tooltip to table
-// new CategoricalChartTooltip(this);
-// new QuantitativeChartTooltip(this);
-
+ // add tooltip to table
+ // new CategoricalChartTooltip(this);
+ // new QuantitativeChartTooltip(this);
this.layout();
natTable.doCommand(new ClientAreaResizeCommand(natTable));
// expand all taxa
- if(isInitialExpandToDeepestTaxonLevel){
+ if (isInitialExpandToDeepestTaxonLevel) {
Integer deepestTaxonLevel = treeFormat.getDeepestTaxonLevel();
- if(deepestTaxonLevel!=null){
- natTable.doCommand(new TreeExpandToLevelCommand(deepestTaxonLevel-2));
+ if (deepestTaxonLevel != null) {
+ natTable.doCommand(new TreeExpandToLevelCommand(deepestTaxonLevel - 2));
}
}
new NatTableContentTooltip(natTable, GridRegion.BODY) {
- protected String getText(Event event) {
- int col = this.natTable.getColumnPositionByX(event.x);
- int row = this.natTable.getRowPositionByY(event.y);
-
- ILayerCell cell = this.natTable.getCellByPosition(col, row);
- if (cell.getConfigLabels().getLabels().contains(CharacterMatrixConfigLabelAccumulator.NOT_EDITABLE)){
- Object o = bodyDataProvider.getRowObject(row);
- String object = "";
- if (o instanceof TaxonNodeDto || o instanceof TaxonRowWrapperDTO){
- object = "taxon";
- }else {
- object = "specimen";
- }
-
- return "Multiple data exist. Editing only possible in factual data view of " + object;
- }
- if (cell.getConfigLabels().getLabels().contains(CharacterMatrixConfigLabelAccumulator.NOT_APPLICABLE)){
- return "This character is not applicable because of the state of a parent feature." ;
- }
- return null;
- }
- };
-
+ @Override
+ protected String getText(Event event) {
+ int col = this.natTable.getColumnPositionByX(event.x);
+ int row = this.natTable.getRowPositionByY(event.y);
+
+ ILayerCell cell = this.natTable.getCellByPosition(col, row);
+ int i = cell.getRowIndex();
+ if (!cell.getConfigLabels().getLabels().contains("TAXON_AGGREGATED_DESCRIPTION") && cell.getConfigLabels().getLabels().contains(CharacterMatrixConfigLabelAccumulator.NOT_EDITABLE)) {
+ Object o = bodyDataProvider.getRowObject(cell.getRowIndex());
+ String object = "";
+ if (o instanceof TaxonNodeDto || o instanceof TaxonRowWrapperDTO) {
+ object = "taxon";
+ } else {
+ object = "specimen";
+ }
+
+ return "Multiple data exist. Editing only possible in factual data view of " + object;
+ }
+ if (cell.getConfigLabels().getLabels().contains("TAXON_AGGREGATED_DESCRIPTION") && cell.getConfigLabels().getLabels().contains(CharacterMatrixConfigLabelAccumulator.NOT_EDITABLE)) {
+
+ return "Aggregated data are not editable.";
+ }
+ if (cell.getConfigLabels().getLabels().contains(CharacterMatrixConfigLabelAccumulator.NOT_APPLICABLE)) {
+ return "This character is not applicable because of the state of a parent feature.";
+ }
+ return null;
+ }
+ };
// clean up table state
getNatTableState().remove(NatTable.INITIAL_PAINT_COMPLETE_FLAG);
getNatTableState().remove(PersistenceDialog.ACTIVE_VIEW_CONFIGURATION_KEY);
}
- private List<FeatureDto> initFeatureList(TermNodeDto node){
+ private List<FeatureDto> initFeatureList(TermNodeDto node) {
List<FeatureDto> features = new ArrayList<>();
List<TermNodeDto> childNodes = node.getChildren();
for (TermNodeDto childNode : childNodes) {
- if (childNode != null){
+ if (childNode != null) {
features.add((FeatureDto) childNode.getTerm());
features.addAll(initFeatureList(childNode));
}
return features;
}
- public void initDescriptiveDataSet(){
- //get features/columns stored in descriptive dataset
- TermTreeDto tree = getDescriptiveDataSet().getDescriptiveSystem();
- features = initFeatureList(tree.getRoot());
+ public void initDescriptiveDataSet() {
+ // get features/columns stored in descriptive dataset
+ TermCollectionDto tree = getDescriptiveDataSet().getDescriptiveSystem();
+ features = initFeatureList(((TermTreeDto) tree).getRoot());
- Set<FeatureDto> duplicateFeatures = features.stream().filter(i -> Collections.frequency(features, i) >1)
- .collect(Collectors.toSet());
+ Set<FeatureDto> duplicateFeatures = features.stream().filter(i -> Collections.frequency(features, i) > 1)
+ .collect(Collectors.toSet());
if (!duplicateFeatures.isEmpty()) {
- throw new IllegalArgumentException("Duplicate features found: "
- + duplicateFeatures.stream().map(feature -> feature.getRepresentation_L10n()).collect(Collectors.joining(",")));
+ throw new IllegalArgumentException("Duplicate features found: " + duplicateFeatures.stream()
+ .map(feature -> feature.getRepresentation_L10n()).collect(Collectors.joining(",")));
}
- //init state data for categorical features
-// features.forEach(feature->fetchSupportedStates(feature));
+ // init state data for categorical features
+ // features.forEach(feature->fetchSupportedStates(feature));
fetchSupportedStates(features);
+ fetchSupportedModifiers(features);
descriptions = new BasicEventList<>();
private void fetchSupportedStates(List<FeatureDto> features) {
Set<UUID> featureUuids = new HashSet<>();
- features.forEach(i->featureUuids.add(i.getUuid()));
- categoricalFeatureToStateMap = CdmStore.getService(IDescriptiveDataSetService.class).getSupportedStatesForFeature(featureUuids);
+ features.forEach(i -> featureUuids.add(i.getUuid()));
+ categoricalFeatureToStateMap = CdmStore.getService(IDescriptiveDataSetService.class)
+ .getSupportedStatesForFeature(featureUuids);
}
+
+ private void fetchSupportedModifiers(List<FeatureDto> features) {
+ Set<UUID> featureUuids = new HashSet<>();
+ features.forEach(i -> featureUuids.add(i.getUuid()));
+ categoricalFeatureToModifierMap = CdmStore.getService(IDescriptiveDataSetService.class)
+ .getRecommendedModifiersForFeature(featureUuids);
-
+ }
private void createLayers(boolean treeView) {
@SuppressWarnings("unchecked")
TreeList<Object> treeList = new TreeList<Object>(sortedList, treeFormat, TreeList.NODES_START_COLLAPSED);
// wrap the SortedList with the TreeList
-// treeFormat = new DescriptionTreeFormat(getDescriptiveDataSet());
+ // treeFormat = new DescriptionTreeFormat(getDescriptiveDataSet());
/**
* data provider
*/
SpecimenColumnPropertyAccessor columnPropertyAccessor = new SpecimenColumnPropertyAccessor(this);
- bodyDataProvider = treeView?new ListDataProvider<>(treeList, columnPropertyAccessor):new ListDataProvider<>(sortedList, columnPropertyAccessor);
+// bodyDataProvider = treeView ? new CharacterMatrixListDataProvider<>(treeList, columnPropertyAccessor)
+// : new CharacterMatrixListDataProvider<>(sortedList, columnPropertyAccessor);
+ bodyDataProvider = treeView ? new ListDataProvider<>(treeList, columnPropertyAccessor)
+ : new ListDataProvider<>(sortedList, columnPropertyAccessor);
DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
bodyDataLayer.registerCommandHandler(new CopyPasteUpdateDataCommandHandler(bodyDataLayer));
-
/**
* BODY layer
*
*
-
- ViewportLayer
-
- ^
- TreeLayer (default visible)
-
- ^
- CompositeFreezeLayer
- - viewportLayer
- - selectionLayer
- - freezeLayer
-
- ^
- FreezeLayer
-
- ^
- SelectionLayer
-
- ^
- ColumnHideShowLayer
-
- ^
- DataLayer
-
+ *
+ * ViewportLayer
+ *
+ * ^ TreeLayer (default visible)
+ *
+ * ^ CompositeFreezeLayer - viewportLayer - selectionLayer - freezeLayer
+ *
+ * ^ FreezeLayer
+ *
+ * ^ SelectionLayer
+ *
+ * ^ ColumnHideShowLayer
+ *
+ * ^ DataLayer
*
-
+ *
+ *
*/
configRegistry = new ConfigRegistry();
- //register labels
+ // register labels
CharacterMatrixConfigLabelAccumulator labelAccumulator = new CharacterMatrixConfigLabelAccumulator(this);
bodyDataLayer.setConfigLabelAccumulator(labelAccumulator);
-
propertyToLabelMap.put(TAXON_COLUMN, Messages.CharacterMatrix_TAXON);
propertyToLabelMap.put(COLLECTOR_COLUMN, Messages.CharacterMatrix_COLLECTOR_NO);
propertyToLabelMap.put(IDENTIFIER_COLUMN, Messages.CharacterMatrix_IDENTIFIER);
propertyToLabelMap.put(COUNTRY_COLUMN, Messages.CharacterMatrix_COUNTRY);
- for(int i=0;i<features.size();i++){
+ for (int i = 0; i < features.size(); i++) {
FeatureDto feature = features.get(i);
initLabels(i, feature);
}
// layer for event handling of GlazedLists and PropertyChanges
- GlazedListsEventLayer<Object> eventLayer = new GlazedListsEventLayer<>(bodyDataLayer, (EventList<Object>)bodyDataProvider.getList());
+ GlazedListsEventLayer<Object> eventLayer = new GlazedListsEventLayer<>(bodyDataLayer,
+ (EventList<Object>) bodyDataProvider.getList());
GlazedListTreeData<?> treeData = new GlazedListTreeData<>(treeList);
ITreeRowModel<?> treeRowModel = new GlazedListTreeRowModel<>(treeData);
// assemble the column groups
LinkedList<ColumnGroupWrapper> columnGroups = new LinkedList<>();
- List<TermNodeDto> rootChildren = getDescriptiveDataSet().getDescriptiveSystem().getRoot().getChildren();
+ List<TermNodeDto> rootChildren = ((TermTreeDto) getDescriptiveDataSet().getDescriptiveSystem()).getRoot()
+ .getChildren();
buildHeader(rootChildren, columnGroups);
bodyLayer = new MatrixBodyLayerStack(eventLayer, columnGroups);
selectionLayer = bodyLayer.getSelectionLayer();
freezeLayer = new FreezeLayer(selectionLayer);
- final CompositeFreezeLayer compositeFreezeLayer = new CompositeFreezeLayer(
- freezeLayer, bodyLayer.getViewportLayer(), selectionLayer);
+ final CompositeFreezeLayer compositeFreezeLayer = new CompositeFreezeLayer(freezeLayer,
+ bodyLayer.getViewportLayer(), selectionLayer);
TreeLayer treeLayer = null;
- if (treeView){
+ if (treeView) {
treeLayer = new TreeLayer(compositeFreezeLayer, treeRowModel);
}
- topMostLayer = treeView?treeLayer:compositeFreezeLayer;
-
+ topMostLayer = treeView ? treeLayer : compositeFreezeLayer;
/**
* column header layer
IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
propertyToLabelMap.values().toArray(new String[] {}), propertyToLabelMap);
DataLayer columnHeaderDataLayer = new DataLayer(columnHeaderDataProvider);
- ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, topMostLayer, selectionLayer);
+ ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, topMostLayer,
+ selectionLayer);
ILayer topHeaderLayer = columnHeaderLayer;
- if(!columnGroups.isEmpty()){
+ if (!columnGroups.isEmpty()) {
// first group level
ColumnGroupWrapper groupLevel1 = columnGroups.get(0);
ColumnGroupHeaderLayer groupLayerLevel1 = null;
ColumnGroupGroupHeaderLayer groupLayerLevel2 = null;
groupLayerLevel1 = new ColumnGroupHeaderLayer(columnHeaderLayer, selectionLayer, groupLevel1.getModel());
- for (Entry<TermNodeDto, TreeSet<Integer>> entry: groupLevel1.getColumnGroupToIndexMap().entrySet()) {
+ for (Entry<TermNodeDto, TreeSet<Integer>> entry : groupLevel1.getColumnGroupToIndexMap().entrySet()) {
TermNodeDto group = entry.getKey();
TreeSet<Integer> indexList = entry.getValue();
int[] intArray = indexList.stream().mapToInt(Integer::intValue).toArray();
- groupLayerLevel1.addColumnsIndexesToGroup(group.getTerm().getTitleCache(), intArray);
+ groupLayerLevel1.addColumnsIndexesToGroup(group.getTerm().getRepresentation_L10n(), intArray);
groupLayerLevel1.setGroupUnbreakable(indexList.iterator().next());
}
topHeaderLayer = groupLayerLevel1;
// second group level
- if(columnGroups.size()>1){
+ if (columnGroups.size() > 1) {
ColumnGroupWrapper groupLevel2 = columnGroups.get(1);
- groupLayerLevel2 = new ColumnGroupGroupHeaderLayer(groupLayerLevel1, selectionLayer, groupLevel2.getModel());
- for (Entry<TermNodeDto, TreeSet<Integer>> entry: groupLevel2.getColumnGroupToIndexMap().entrySet()) {
+ groupLayerLevel2 = new ColumnGroupGroupHeaderLayer(groupLayerLevel1, selectionLayer,
+ groupLevel2.getModel());
+ for (Entry<TermNodeDto, TreeSet<Integer>> entry : groupLevel2.getColumnGroupToIndexMap().entrySet()) {
TermNodeDto group = entry.getKey();
TreeSet<Integer> indexList = entry.getValue();
int[] intArray = indexList.stream().mapToInt(Integer::intValue).toArray();
- groupLayerLevel2.addColumnsIndexesToGroup(group.getTerm().getTitleCache(), intArray);
+ groupLayerLevel2.addColumnsIndexesToGroup(group.getTerm().getRepresentation_L10n(), intArray);
groupLayerLevel2.setGroupUnbreakable(indexList.iterator().next());
}
topHeaderLayer = groupLayerLevel2;
// add the SortHeaderLayer to the column header layer stack
// as we use GlazedLists, we use the GlazedListsSortModel which
// delegates the sorting to the SortedList
- final SortHeaderLayer<DescriptionBase<?>> sortHeaderLayer = new SortHeaderLayer<>(
- topHeaderLayer,
- new GlazedListsSortModel<>(
- sortedList,
- columnPropertyAccessor,
- configRegistry,
- columnHeaderDataLayer));
+ final SortHeaderLayer<DescriptionBase<?>> sortHeaderLayer = new SortHeaderLayer<>(topHeaderLayer,
+ new GlazedListsSortModel<>(sortedList, columnPropertyAccessor, configRegistry, columnHeaderDataLayer));
/**
* row header layer
*/
IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyDataProvider);
DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
- RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
- topMostLayer, selectionLayer);
+ RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, topMostLayer, selectionLayer);
/**
* corner layer
natTable.setLayer(gridLayer);
}
- private TreeSet<Integer> recurseChildIndexes(TermNodeDto node){
+ private TreeSet<Integer> recurseChildIndexes(TermNodeDto node) {
TreeSet<Integer> childIndexes = new TreeSet<>();
- if(node.getChildren().size() >0){
+ if (node.getChildren().size() > 0) {
List<TermNodeDto> childNodes = node.getChildren();
- for (TermNodeDto childNode: childNodes) {
- if (childNode != null){
+ for (TermNodeDto childNode : childNodes) {
+ if (childNode != null) {
childIndexes.addAll(recurseChildIndexes(childNode));
}
}
}
- childIndexes.add(features.indexOf(node.getTerm())+LEADING_COLUMN_COUNT);
+ childIndexes.add(features.indexOf(node.getTerm()) + LEADING_COLUMN_COUNT);
return childIndexes;
}
- private void buildHeader(List<TermNodeDto> nodes, LinkedList<ColumnGroupWrapper> columnGroups){
+ private void buildHeader(List<TermNodeDto> nodes, LinkedList<ColumnGroupWrapper> columnGroups) {
Map<TermNodeDto, TreeSet<Integer>> columnGroupToIndexMap = new HashMap<>();
List<TermNodeDto> childNodes = new ArrayList<>();
for (TermNodeDto node : nodes) {
- if (node != null){
+ if (node != null) {
TreeSet<Integer> childIndexes = recurseChildIndexes(node);
- if(childIndexes.size()>1){
+ if (childIndexes.size() > 1) {
// filter out groups that only have one member
columnGroupToIndexMap.put(node, childIndexes);
}
childNodes.addAll(node.getChildren());
}
}
- if(!columnGroupToIndexMap.isEmpty()){
+ if (!columnGroupToIndexMap.isEmpty()) {
columnGroups.addFirst(new ColumnGroupWrapper(new ColumnGroupModel(), columnGroupToIndexMap));
}
- if(!childNodes.isEmpty()){
+ if (!childNodes.isEmpty()) {
buildHeader(childNodes, columnGroups);
}
}
private void registerHandlersAndListeners() {
natTable.registerCommandHandler(new ExportCommandHandler(natTable));
- //selection listener
+ // selection listener
E4SelectionListener<Object> selectionListener = new CellSelectionListener(part.getSelectionService(),
bodyLayer.getSelectionLayer(), bodyDataProvider, part);
bodyLayer.getSelectionLayer().addLayerListener(selectionListener);
selectionListener.setFullySelectedRowsOnly(false);
- //register handler for view configuration menu
+ // register handler for view configuration menu
natTable.registerCommandHandler(toolbar.getDisplayPersistenceDialogCommandHandler());
- //register handlers for copy&paste
- natTable.registerCommandHandler(
- new InternalPasteDataCommandHandler(bodyLayer.getSelectionLayer(), natTable.getInternalCellClipboard()));
+ // register handlers for copy&paste
+ natTable.registerCommandHandler(new InternalPasteDataCommandHandler(bodyLayer.getSelectionLayer(),
+ natTable.getInternalCellClipboard()));
natTable.registerCommandHandler(
new InternalCopyDataCommandHandler(bodyLayer.getSelectionLayer(), natTable.getInternalCellClipboard()));
}
- private void configureNatTable(boolean treeView,
- ConfigRegistry configRegistry,
- AbstractLayer topMostLayer) {
+ private void configureNatTable(boolean treeView, ConfigRegistry configRegistry, AbstractLayer topMostLayer) {
/**
* CONFIGURATION
*/
- //+++CONTEXT MENU+++
+ // +++CONTEXT MENU+++
menuService.registerContextMenu(natTable, "eu.etaxonomy.taxeditor.editor.popupmenu.charactermatrix"); //$NON-NLS-1$
// get the menu registered by EMenuService
final Menu e4Menu = natTable.getMenu();
applyStyles();
- //add default configuration because autoconfigure is set to false in constructor
+ // add default configuration because autoconfigure is set to false in
+ // constructor
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
// this is for DEBUG ONLY
-// natTable.addConfiguration(new DebugMenuConfiguration(natTable));
+ // natTable.addConfiguration(new DebugMenuConfiguration(natTable));
// override the default sort configuration and change the mouse bindings
// to sort on a single click
- if(!treeView){
+ if (!treeView) {
natTable.addConfiguration(new SingleClickSortConfiguration());
}
// add the header menu configuration for adding the column header menu
// with hide/show actions
-// natTable.addConfiguration(new CharacterMatrixHeaderMenuConfiguration(natTable));
+ // natTable.addConfiguration(new
+ // CharacterMatrixHeaderMenuConfiguration(natTable));
- // add custom configuration for data conversion and add column labels to viewport layer
+ // add custom configuration for data conversion and add column labels to
+ // viewport layer
topMostLayer.addConfiguration(new CellEditorDataConversionConfiguration(this));
- //copy&paste configuration
- natTable.addConfiguration(new CopyPasteEditBindings(bodyLayer.getSelectionLayer(), natTable.getInternalCellClipboard()));
-
+ // copy&paste configuration
+ natTable.addConfiguration(
+ new CopyPasteEditBindings(bodyLayer.getSelectionLayer(), natTable.getInternalCellClipboard()));
// remove the menu reference from NatTable instance
natTable.setMenu(null);
-
-// natTable.addConfiguration(new CharacterMatrixHeaderMenuConfiguration(natTable));
-
+ // natTable.addConfiguration(new
+ // CharacterMatrixHeaderMenuConfiguration(natTable));
natTable.configure();
-
- natTable.addConfiguration(
- new AbstractUiBindingConfiguration() {
- @Override
- public void configureUiBindings(
- UiBindingRegistry uiBindingRegistry) {
- // add e4 menu to NatTable
- uiBindingRegistry.unregisterMouseDownBinding(mouseEventMatcher);
- if (isFirstCall){
- new PopupMenuBuilder(natTable, e4Menu)
- .withHideColumnMenuItem()
- .withShowAllColumnsMenuItem()
- .build();
- isFirstCall = false;
- }else{
- new PopupMenuBuilder(natTable, e4Menu)
- .build();
- }
- // register the UI binding for header, corner and body region
- mouseEventMatcher = new MouseEventMatcher(
- SWT.NONE,
- null,
- MouseEventMatcher.RIGHT_BUTTON);
- uiBindingRegistry.registerMouseDownBinding(mouseEventMatcher,
- new PopupMenuAction(e4Menu));
+ natTable.addConfiguration(new AbstractUiBindingConfiguration() {
+ @Override
+ public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
+ // add e4 menu to NatTable
+ uiBindingRegistry.unregisterMouseDownBinding(mouseEventMatcher);
+ if (isFirstCall) {
+ new PopupMenuBuilder(natTable, e4Menu).withHideColumnMenuItem().withShowAllColumnsMenuItem()
+ .build();
+ isFirstCall = false;
+ } else {
+ new PopupMenuBuilder(natTable, e4Menu).build();
}
- });
+ // register the UI binding for header, corner and body region
+ mouseEventMatcher = new MouseEventMatcher(SWT.NONE, null, MouseEventMatcher.RIGHT_BUTTON);
+ uiBindingRegistry.registerMouseDownBinding(mouseEventMatcher, new PopupMenuAction(e4Menu));
+ }
+ });
}
- void freezeSupplementalColumns(boolean freeze){
- int rightMostFreezeColumIndex = LEADING_COLUMN_COUNT-1;
+ void freezeSupplementalColumns(boolean freeze) {
+ int rightMostFreezeColumIndex = LEADING_COLUMN_COUNT - 1;
Collection<Integer> hiddenColumnIndexes = bodyLayer.getColumnHideShowLayer().getHiddenColumnIndexes();
for (Integer integer : hiddenColumnIndexes) {
- if(integer<LEADING_COLUMN_COUNT){
+ if (integer < LEADING_COLUMN_COUNT) {
rightMostFreezeColumIndex--;
}
}
- if(freeze){
+ if (freeze) {
FreezeHelper.freeze(freezeLayer, bodyLayer.getViewportLayer(),
new PositionCoordinate(bodyLayer.getViewportLayer(), 0, 0),
new PositionCoordinate(bodyLayer.getViewportLayer(), rightMostFreezeColumIndex, -1));
- }
- else{
+ } else {
FreezeHelper.unfreeze(freezeLayer, bodyLayer.getViewportLayer());
}
}
private void initLabels(int index, FeatureDto feature) {
- indexToFeatureMap.put(index+LEADING_COLUMN_COUNT, feature);
- featureToIndexMap.put(feature.getUuid(), index+LEADING_COLUMN_COUNT);
- String label = feature.getTitleCache();
+ indexToFeatureMap.put(index + LEADING_COLUMN_COUNT, feature);
+ featureToIndexMap.put(feature.getUuid(), index + LEADING_COLUMN_COUNT);
+ List<Language> languages = new ArrayList<>();
+ languages.add(PreferencesUtil.getGlobalLanguage());
+ feature.localize(new TermRepresentation_L10n(), languages);
+ String label = feature.getRepresentation_L10n();
String property = feature.getUuid().toString();
- //show unit for quantitative data
- if(feature.isSupportsQuantitativeData()){
+ // show unit for quantitative data
+ if (feature.isSupportsQuantitativeData()) {
Set<TermDto> recommendedMeasurementUnits = feature.getRecommendedMeasurementUnits();
-// if(recommendedMeasurementUnits.size()>1){
-// MessagingUtils.warningDialog(Messages.CharacterMatrix_INIT_PROBLEM, CharacterMatrix.class,
-// String.format(Messages.CharacterMatrix_INIT_PROBLEM_MESSAGE, feature.getLabel()));
-// }
- if(recommendedMeasurementUnits.size()==1){
+ // if(recommendedMeasurementUnits.size()>1){
+ // MessagingUtils.warningDialog(Messages.CharacterMatrix_INIT_PROBLEM,
+ // CharacterMatrix.class,
+ // String.format(Messages.CharacterMatrix_INIT_PROBLEM_MESSAGE,
+ // feature.getLabel()));
+ // }
+ if (recommendedMeasurementUnits.size() == 1) {
TermDto unit = recommendedMeasurementUnits.iterator().next();
- label += " ["+unit.getIdInVocabulary()+"]"; //$NON-NLS-1$ //$NON-NLS-2$
+ label += " [" + unit.getIdInVocabulary() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
propertyToLabelMap.put(property, label);
}
public void loadDescriptions(boolean isInitialExpandToDeepestTaxonLevel, boolean initialLoading) {
-
- UUID monitorUuid = CdmApplicationState.getLongRunningTasksService().monitGetRowWrapper(this.getDescriptiveDataSet().getUuid());
+
+ UUID monitorUuid = CdmApplicationState.getLongRunningTasksService()
+ .monitGetRowWrapper(this.getDescriptiveDataSet().getUuid(), PreferencesUtil.getGlobalLanguage());
final Collection<RowWrapperDTO<?>> wrappers = new ArrayList<>();
String jobLabel = Messages.CharacterMatrix_LOAD_CHARACTER_DATA;
subMonitor.beginTask(jobLabel, IProgressMonitor.UNKNOWN);
IRemotingProgressMonitor remotingMonitor;
try {
- remotingMonitor = CdmStore.getProgressMonitorClientManager()
- .pollMonitor(jobLabel,
- monitorUuid,
- 50,
- null,
- (List<IFeedbackGenerator>)null,
- subMonitor);
+ remotingMonitor = CdmStore.getProgressMonitorClientManager().pollMonitor(jobLabel, monitorUuid, 50,
+ null, (List<IFeedbackGenerator>) null, subMonitor);
} catch (InterruptedException e) {
MessagingUtils.informationDialog(Messages.CharacterMatrix_LOADING_FAILED_TITLE,
Messages.CharacterMatrix_LOADING_FAILED_MESSAGE);
return;
}
Object result = remotingMonitor.getResult();
- if(result instanceof Collection){
+ if (result instanceof Collection) {
wrappers.addAll((Collection<RowWrapperDTO<?>>) result);
}
- if(result instanceof Exception){
- MessagingUtils.errorDialog("Exception during description loading", this.getClass(), "An exception occured during loading", TaxeditorEditorPlugin.PLUGIN_ID, (Throwable) result, true);
- }
- else if(wrappers.isEmpty()){
+ if (result instanceof Exception) {
+ MessagingUtils.errorDialog("Exception during description loading", this.getClass(),
+ "An exception occured during loading", TaxeditorEditorPlugin.PLUGIN_ID, (Throwable) result,
+ true);
+ } else if (wrappers.isEmpty()) {
MessagingUtils.informationDialog(Messages.CharacterMatrix_NO_DESCRIPTION_TITLE,
Messages.CharacterMatrix_NO_DESCRIPTION_MESSAGE);
}
monitor.done();
});
- job.addJobChangeListener(new JobChangeAdapter(){
+ job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
- sync.syncExec(()->{
- List<RowWrapperDTO> rowsWithoutTaxonNode = wrappers.stream().filter(row->row.getTaxonNode()==null).collect(Collectors.toList());
- if(!rowsWithoutTaxonNode.isEmpty()){
- String collect = rowsWithoutTaxonNode.stream().
- map(row->row.getDescription().toString())
- .collect(Collectors.joining("\n\n - ")); //$NON-NLS-1$
- MessagingUtils.warningDialog(
- Messages.CharacterMatrix_NO_NODE_FOUND_TITLE,
- this.getClass(),
- String.format(Messages.CharacterMatrix_NO_NODE_FOUND_MESSAGE, collect)
- );
+ sync.syncExec(() -> {
+ List<RowWrapperDTO> rowsWithoutTaxonNode = wrappers.stream()
+ .filter(row -> row.getTaxonNode() == null).collect(Collectors.toList());
+ if (!rowsWithoutTaxonNode.isEmpty()) {
+ String collect = rowsWithoutTaxonNode.stream().map(row -> row.getDescription().toString())
+ .collect(Collectors.joining("\n\n - ")); //$NON-NLS-1$
+ MessagingUtils.warningDialog(Messages.CharacterMatrix_NO_NODE_FOUND_TITLE, this.getClass(),
+ String.format(Messages.CharacterMatrix_NO_NODE_FOUND_MESSAGE, collect));
}
descriptions.clear();
-// part.setDescriptiveDataSet(CdmStore.getService(IDescriptiveDataSetService.class).getDescriptiveDataSetDtoByUuid(part.getDescriptiveDataSet().getUuid()));
- wrappers.stream().filter(row->row.getTaxonNode()!=null).forEach(wrapper->CharacterMatrix.this.descriptions.add(wrapper));
- if(initialLoading){
+ // part.setDescriptiveDataSet(CdmStore.getService(IDescriptiveDataSetService.class).getDescriptiveDataSetDtoByUuid(part.getDescriptiveDataSet().getUuid()));
+ wrappers.stream().filter(row -> row.getTaxonNode() != null)
+ .forEach(wrapper -> CharacterMatrix.this.descriptions.add(wrapper));
+ if (initialLoading) {
loadingDone(isInitialExpandToDeepestTaxonLevel);
}
});
job.schedule();
}
- public IStructuredSelection getSelection(){
+ public IStructuredSelection getSelection() {
Set<Range> selectedRowPositions = bodyLayer.getSelectionLayer().getSelectedRowPositions();
List<Object> selectedObjects = new ArrayList<>();
for (Range range : selectedRowPositions) {
- for(int i=range.start;i<range.end;i++){
+ for (int i = range.start; i < range.end; i++) {
selectedObjects.add(bodyDataProvider.getRowObject(i));
}
}
}
- public List<TermDto> getSupportedStatesForCategoricalFeature(UUID featureUuid){
+ public List<TermDto> getSupportedStatesForCategoricalFeature(UUID featureUuid) {
return categoricalFeatureToStateMap.get(featureUuid);
}
+
+ public List<TermDto> getRecommendModifiersForCategoricalFeature(UUID featureUuid) {
+ return categoricalFeatureToModifierMap.get(featureUuid);
+ }
public Set<DescriptionBase<?>> getDescriptionsToSave() {
return descriptionsToSave;
}
public Map<UUID, Integer> getFeatureToIndexMap() {
- return featureToIndexMap;
- }
+ return featureToIndexMap;
+ }
- public void setFeatureToIndexMap(Map<UUID, Integer> featureToIndexMap) {
- this.featureToIndexMap = featureToIndexMap;
- }
+ public void setFeatureToIndexMap(Map<UUID, Integer> featureToIndexMap) {
+ this.featureToIndexMap = featureToIndexMap;
+ }
- public LinkedMap<String, String> getPropertyToLabelMap() {
+ public LinkedMap<String, String> getPropertyToLabelMap() {
return propertyToLabelMap;
}
return descriptionUuidsToDelete;
}
- public void addDescriptionToDelete(UUID descriptionToDelete, RemoveDescriptionsFromDescriptiveDataSetConfigurator config) {
- if (descriptionUuidsToDelete == null){
+ public void addDescriptionToDelete(UUID descriptionToDelete,
+ RemoveDescriptionsFromDescriptiveDataSetConfigurator config) {
+ if (descriptionUuidsToDelete == null) {
descriptionUuidsToDelete = new HashMap<>();
}
- if (descriptionUuidsToDelete.get(config) != null){
+ if (descriptionUuidsToDelete.get(config) != null) {
descriptionUuidsToDelete.get(config).add(descriptionToDelete);
- }else{
+ } else {
List<UUID> uuidList = new ArrayList<>();
uuidList.add(descriptionToDelete);
this.descriptionUuidsToDelete.put(config, uuidList);
}
-
}
public List<SpecimenRowWrapperDTO> getSpecimenToAdd() {
}
public void addSpecimenToAdd(Collection<SpecimenRowWrapperDTO> specimenToAdd) {
- if (this.specimenToAdd == null){
+ if (this.specimenToAdd == null) {
this.specimenToAdd = new ArrayList<>();
}
this.specimenToAdd.addAll(specimenToAdd);
this.specimenCache.removeAll(specimenToAdd);
}
+
public void addSpecimenToAdd(SpecimenRowWrapperDTO specimenToAdd) {
- if (this.specimenToAdd == null){
+ if (this.specimenToAdd == null) {
this.specimenToAdd = new ArrayList<>();
}
}
public Collection<SpecimenNodeWrapper> getSpecimenCache() {
- return specimenCache;
+ return specimenCache;
}
public void setSpecimenCache(Collection<SpecimenNodeWrapper> specimenCache) {
- this.specimenCache = specimenCache.stream()
- .filter(wrapper ->
- //map descriptions on a list of uuids of the described specimen
- !this.descriptions.stream()
- .filter(rowWrapper->rowWrapper instanceof SpecimenRowWrapperDTO)
- .map(specimenRowWrapper->((SpecimenRowWrapperDTO) specimenRowWrapper).getSpecimenDto().getUuid())
- .collect(Collectors.toList())
- //and check if the specimen to add is already contained
- .contains(wrapper.getUuidAndTitleCache().getUuid())
- )
- .collect(Collectors.toList());
+ this.specimenCache = specimenCache.stream().filter(wrapper ->
+ // map descriptions on a list of uuids of the described specimen
+ !this.descriptions.stream().filter(rowWrapper -> rowWrapper instanceof SpecimenRowWrapperDTO)
+ .map(specimenRowWrapper -> ((SpecimenRowWrapperDTO) specimenRowWrapper).getSpecimenDto().getUuid())
+ .collect(Collectors.toList())
+ // and check if the specimen to add is already contained
+ .contains(wrapper.getUuidAndTitleCache().getUuid())).collect(Collectors.toList());
}
-// public void addRowToSave(RowWrapperDTO<?> row){
-// rowsToMerge.put(row.getDescription().getDescription().getUuid(), row);
-// }
-//
-// public HashMap<UUID,RowWrapperDTO<?>> getRowsToSave() {
-// return rowsToMerge;
-// }
+ // public void addRowToSave(RowWrapperDTO<?> row){
+ // rowsToMerge.put(row.getDescription().getDescription().getUuid(), row);
+ // }
+ //
+ // public HashMap<UUID,RowWrapperDTO<?>> getRowsToSave() {
+ // return rowsToMerge;
+ // }
public HashMap<UUID, RowWrapperDTO<?>> getRowsToMerge() {
return rowsToMerge;
}
public void putRowToMerge(RowWrapperDTO<?> rowToMerge) {
- if (this.rowsToMerge == null){
+ if (this.rowsToMerge == null) {
this.rowsToMerge = new HashMap<>();
}
this.rowsToMerge.put(rowToMerge.getDescription().getDescriptionUuid(), rowToMerge);
}
+// /**
+// * @return the actualSelection
+// */
+// @Override
+// public DescriptionElementDto getActualSelection() {
+// return actualSelection;
+// }
+//
+// /**
+// * @param actualSelection
+// * the actualSelection to set
+// */
+// public void setActualSelection(DescriptionElementDto actualSelection) {
+// this.actualSelection = actualSelection;
+// }
+
public Properties getNatTableState() {
return toolbar.getNatTableState();
}
return featureToHistogramMap;
}
-
-
- public ICdmEntitySession getCdmEntitySession(){
+ public ICdmEntitySession getCdmEntitySession() {
return part.getCdmEntitySession();
}
@Inject
@Optional
- private void updateSpecimenList(@UIEventTopic(WorkbenchEventConstants.REFRESH_DESCRIPTIVE_DATASET)UUID uuid){
- if(uuid!= null && uuid.equals(part.getDescriptiveDataSet().getUuid())){
- this.specimenCache = null;
+ private void updateSpecimenList(@UIEventTopic(WorkbenchEventConstants.REFRESH_DESCRIPTIVE_DATASET) UUID uuid) {
+ if (uuid != null && uuid.equals(part.getDescriptiveDataSet().getUuid())) {
+ this.specimenCache = null;
}
}
-
+
@Inject
@Optional
- private void updateMatrix(@UIEventTopic(WorkbenchEventConstants.REFRESH_MATRIX)UUID uuid){
- if(uuid!= null && uuid.equals(part.getDescriptiveDataSet().getUuid())){
- this.specimenCache = null;
+ private void updateMatrix(@UIEventTopic(WorkbenchEventConstants.REFRESH_MATRIX) UUID uuid) {
+ if (uuid != null && uuid.equals(part.getDescriptiveDataSet().getUuid())) {
+ this.specimenCache = null;
}
}
- public void addRowsToMatrix(Collection<SpecimenNodeWrapper> wrappers){
+ public void addRowsToMatrix(Collection<SpecimenNodeWrapper> wrappers) {
List<UUID> specimenUuids = new ArrayList<>();
wrappers.forEach(wrapper -> specimenUuids.add(wrapper.getUuidAndTitleCache().getUuid()));
-// List<SpecimenOrObservationBase> specimens = CdmStore.getService(IOccurrenceService.class).load(specimenUuids, null);
+ // List<SpecimenOrObservationBase> specimens =
+ // CdmStore.getService(IOccurrenceService.class).load(specimenUuids,
+ // null);
Map<UUID, UuidAndTitleCache<FieldUnit>> specimenMap = new HashMap<>();
- for (UUID specimenUuid: specimenUuids ){
- try{
- FieldUnitDTO fieldUnitDto = CdmStore.getService(IOccurrenceService.class).loadFieldUnitDTO(specimenUuid);
- if (fieldUnitDto != null){
- UuidAndTitleCache<FieldUnit> fieldUnit = new UuidAndTitleCache<>(FieldUnit.class, fieldUnitDto.getUuid(), null, fieldUnitDto.getLabel());
+ for (UUID specimenUuid : specimenUuids) {
+ try {
+ FieldUnitDTO fieldUnitDto = CdmStore.getService(IOccurrenceService.class)
+ .loadFieldUnitDTO(specimenUuid);
+ if (fieldUnitDto != null) {
+ UuidAndTitleCache<FieldUnit> fieldUnit = new UuidAndTitleCache<>(FieldUnit.class,
+ fieldUnitDto.getUuid(), null, fieldUnitDto.getLabel());
specimenMap.put(specimenUuid, fieldUnit);
}
- }catch(Exception e){
+ } catch (Exception e) {
e.printStackTrace();
}
}
- for (SpecimenNodeWrapper wrapper: wrappers){
- SpecimenRowWrapperDTO rowWrapper = CdmStore.getService(IDescriptiveDataSetService.class).createSpecimenRowWrapper(wrapper.getUuidAndTitleCache().getUuid(), wrapper.getTaxonNode().getUuid(), getDescriptiveDataSet().getUuid());
+ for (SpecimenNodeWrapper wrapper : wrappers) {
+ SpecimenRowWrapperDTO rowWrapper = CdmStore.getService(IDescriptiveDataSetService.class)
+ .createSpecimenRowWrapper(wrapper.getUuidAndTitleCache().getUuid(),
+ wrapper.getTaxonNode().getUuid(), getDescriptiveDataSet().getUuid(), PreferencesUtil.getGlobalLanguage());
addSpecimenToAdd(rowWrapper);
-// SpecimenRowWrapperDTO rowWrapper = new SpecimenRowWrapperDTO(wrapper.getUuidAndTitleCache(), wrapper.getType(), wrapper.getTaxonNode(), specimenMap.get(wrapper.getUuidAndTitleCache().getUuid()), null, null);
+ // SpecimenRowWrapperDTO rowWrapper = new
+ // SpecimenRowWrapperDTO(wrapper.getUuidAndTitleCache(),
+ // wrapper.getType(), wrapper.getTaxonNode(),
+ // specimenMap.get(wrapper.getUuidAndTitleCache().getUuid()), null,
+ // null);
descriptions.add(rowWrapper);
}
-
setDirty();
}
- public HashMap<UUID, DescriptionBase<?>> addSpecimensToDescriptiveDataSet(){
- if (specimenToAdd == null || specimenToAdd.isEmpty()){
+ public HashMap<UUID, DescriptionBase<?>> addSpecimensToDescriptiveDataSet() {
+ if (specimenToAdd == null || specimenToAdd.isEmpty()) {
return new HashMap<>();
}
- UpdateResult result = CdmStore.getService(IDescriptiveDataSetService.class).addRowWrapperToDataset(specimenToAdd, getDescriptiveDataSet().getUuid(), true);
- if(!result.getExceptions().isEmpty()){
+ UpdateResult result = CdmStore.getService(IDescriptiveDataSetService.class)
+ .addRowWrapperToDataset(specimenToAdd, getDescriptiveDataSet().getUuid(), true);
+ if (!result.getExceptions().isEmpty()) {
MessagingUtils.warningDialog(Messages.CharacterMatrixBottomToolbar_ERROR_ROW_CREATION_TITLE, this,
- String.format(Messages.CharacterMatrixBottomToolbar_ERROR_ROW_CREATION_MESSAGE, result.getExceptions()
- .stream().map(ex->ex.toString())
- .collect(Collectors.joining("\n"))));
+ String.format(Messages.CharacterMatrixBottomToolbar_ERROR_ROW_CREATION_MESSAGE, result
+ .getExceptions().stream().map(ex -> ex.toString()).collect(Collectors.joining("\n"))));
}
DescriptiveDataSet dataSet = (DescriptiveDataSet) result.getCdmEntity();
HashMap<UUID, DescriptionBase<?>> resultMap = new HashMap<>();
- for (CdmBase updated: result.getUpdatedObjects()){
- if (updated instanceof SpecimenDescription){
- resultMap.put(updated.getUuid(), (DescriptionBase<?>)updated);
+ for (CdmBase updated : result.getUpdatedObjects()) {
+ if (updated instanceof SpecimenDescription) {
+ resultMap.put(updated.getUuid(), (DescriptionBase<?>) updated);
}
-
}
dataSet = this.getCdmEntitySession().load(dataSet, true);
// update local dataset
DescriptiveDataSetBaseDto dto = DescriptiveDataSetBaseDto.fromDescriptiveDataSet(dataSet);
this.setDescriptiveDataSet(dto);
- //these descriptions are already updated
- for (SpecimenRowWrapperDTO row: specimenToAdd){
+ // these descriptions are already updated
+ for (SpecimenRowWrapperDTO row : specimenToAdd) {
this.rowsToMerge.remove(row.getDescription().getDescriptionUuid());
}
specimenToAdd.clear();
return resultMap;
}
- public void setSelectedObject(Object selectedObject){
- int rowIndex = ((IRowDataProvider<Object>)bodyDataProvider).indexOfRowObject(selectedObject);
- int rowPosition = selectionLayer.getRowPositionByIndex(rowIndex);
- natTable.doCommand( new SelectRowsCommand(natTable, 1, rowPosition, false, false));
+ public void setSelectedObject(Object selectedObject) {
+
+ int rowIndex = ((IRowDataProvider<Object>) bodyDataProvider).indexOfRowObject(selectedObject);
+ int rowPosition = selectionLayer.getRowPositionByIndex(rowIndex);
+ natTable.doCommand(new SelectRowsCommand(natTable, 1, rowPosition, false, false));
}
- public TreeList<Object> updateDescriptions(boolean treeView){
- SortedList<Object> sortedList = new SortedList<>(descriptions, new MatrixRowComparator());
+ public TreeList<Object> updateDescriptions(boolean treeView) {
+ SortedList<Object> sortedList = new SortedList<>(descriptions, new MatrixRowComparator());
// wrap the SortedList with the TreeList
treeFormat = new DescriptionTreeFormat(getDescriptiveDataSet());
TreeList<Object> treeList = new TreeList<Object>(sortedList, treeFormat, TreeList.NODES_START_COLLAPSED);
// wrap the SortedList with the TreeList
-// treeFormat = new DescriptionTreeFormat(getDescriptiveDataSet());
+ // treeFormat = new DescriptionTreeFormat(getDescriptiveDataSet());
/**
* data provider
*/
SpecimenColumnPropertyAccessor columnPropertyAccessor = new SpecimenColumnPropertyAccessor(this);
- bodyDataProvider = treeView?new ListDataProvider<>(treeList, columnPropertyAccessor):new ListDataProvider<>(sortedList, columnPropertyAccessor);
+ bodyDataProvider = treeView ? new ListDataProvider<>(treeList, columnPropertyAccessor)
+ : new ListDataProvider<>(sortedList, columnPropertyAccessor);
return treeList;
}
@Override
- public void dispose () {
+ public void dispose() {
super.dispose();
- if (descriptions != null){
- descriptions.dispose();
+ if (descriptions != null) {
+ descriptions.dispose();
}
descriptions = null;
this.natTable.dispose();
*/
package eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix;
-import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
import org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator;
-import eu.etaxonomy.cdm.api.service.dto.CategoricalDataDto;
-import eu.etaxonomy.cdm.api.service.dto.DescriptionBaseDto;
-import eu.etaxonomy.cdm.api.service.dto.DescriptionElementDto;
-import eu.etaxonomy.cdm.api.service.dto.QuantitativeDataDto;
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
import eu.etaxonomy.cdm.api.service.dto.SpecimenRowWrapperDTO;
-import eu.etaxonomy.cdm.api.service.dto.StateDataDto;
import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO;
+import eu.etaxonomy.cdm.persistence.dto.CategoricalDataDto;
+import eu.etaxonomy.cdm.persistence.dto.DescriptionBaseDto;
+import eu.etaxonomy.cdm.persistence.dto.DescriptionElementDto;
import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
import eu.etaxonomy.cdm.persistence.dto.FeatureStateDto;
+import eu.etaxonomy.cdm.persistence.dto.QuantitativeDataDto;
+import eu.etaxonomy.cdm.persistence.dto.StateDataDto;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
public static final String DEFAULT_OVERRIDDEN = "DEFAULT_OVERRIDDEN";
public static final String QUANTITATIVE = "QUANTITATIVE";
public static final String CATEGORICAL = "CATEGORICAL";
- public static final String CATEGORICAL_EDITABLE = CATEGORICAL+"_EDITABLE";
- public static final String QUANTITATIVE_EDITABLE = QUANTITATIVE+"_EDITABLE";
+ public static final String CATEGORICAL_EDITABLE = CATEGORICAL + "_EDITABLE";
+ public static final String QUANTITATIVE_EDITABLE = QUANTITATIVE + "_EDITABLE";
public static final String NOT_EDITABLE = "NOT_EDITABLE";
public static final String NOT_APPLICABLE = "NOT APPLICABLE";
boolean isApplicable = true;
Object rowObject = matrix.getBodyDataProvider().getRowObject(rowPosition);
- if(rowObject instanceof TaxonNodeDto){
+ if (rowObject instanceof TaxonNodeDto) {
configLabels.addLabel(CharacterMatrix.LABEL_TAXON_ROW);
- }
- else if(rowObject instanceof TaxonRowWrapperDTO){
+ } else if (rowObject instanceof TaxonRowWrapperDTO) {
TaxonRowWrapperDTO taxonRowWrapper = (TaxonRowWrapperDTO) rowObject;
- if(MatrixUtility.isAggregatedTaxonDescription(taxonRowWrapper)){
+ if (MatrixUtility.isAggregatedTaxonDescription(taxonRowWrapper)) {
configLabels.addLabel(CharacterMatrix.LABEL_TAXON_AGGREGATED_DESCRIPTION);
isEditable = false;
- if(columnPosition==0){
+ if (columnPosition == 0) {
configLabels.addLabel(CharacterMatrix.LABEL_TAXON_AGGREGATED_DESCRIPTION_ICON);
}
- }
- else if(MatrixUtility.isDefaultTaxonDescription(taxonRowWrapper)){
+ } else if (MatrixUtility.isDefaultTaxonDescription(taxonRowWrapper)) {
configLabels.addLabel(CharacterMatrix.LABEL_TAXON_DEFAULT_DESCRIPTION);
- if(columnPosition==0){
+ if (columnPosition == 0) {
configLabels.addLabel(CharacterMatrix.LABEL_TAXON_DEFAULT_DESCRIPTION_ICON);
}
- }
- else if(MatrixUtility.isLiteratureTaxonDescription(taxonRowWrapper)){
+ } else if (MatrixUtility.isLiteratureTaxonDescription(taxonRowWrapper)) {
configLabels.addLabel(CharacterMatrix.LABEL_TAXON_LITERATURE_DESCRIPTION);
- if(columnPosition==0){
+ if (columnPosition == 0) {
configLabels.addLabel(CharacterMatrix.LABEL_TAXON_LITERATURE_DESCRIPTION_ICON);
}
// check for existing default values
- if(columnPosition>=CharacterMatrix.LEADING_COLUMN_COUNT){
- FeatureDto feature = matrix.getFeatures().get(columnPosition-CharacterMatrix.LEADING_COLUMN_COUNT);
- if(hasDefaultValue(feature, taxonRowWrapper)){
+ if (columnPosition >= CharacterMatrix.LEADING_COLUMN_COUNT) {
+ FeatureDto feature = matrix.getFeatures()
+ .get(columnPosition - CharacterMatrix.LEADING_COLUMN_COUNT);
+ if (hasDefaultValue(feature, taxonRowWrapper)) {
configLabels.addLabel(HAS_DEFAULT);
- if(hasDefaultOverriddenValue(feature, taxonRowWrapper)){
+ if (hasDefaultOverriddenValue(feature, taxonRowWrapper)) {
configLabels.removeLabel(HAS_DEFAULT);
configLabels.addLabel(DEFAULT_OVERRIDDEN);
}
}
}
}
- //check for supplemental data TODO: add supplemental data to DTO
-// if(!taxonRowWrapper.getDescription().getSources().isEmpty() && columnPosition==0){
-// configLabels.addLabel(CharacterMatrix.LABEL_DESCRIPTION_HAS_SUPPLEMENTAL_DATA);
-// }
+ // check for supplemental data TODO: add supplemental data to DTO
+ // if(!taxonRowWrapper.getDescription().getSources().isEmpty() &&
+ // columnPosition==0){
+ // configLabels.addLabel(CharacterMatrix.LABEL_DESCRIPTION_HAS_SUPPLEMENTAL_DATA);
+ // }
configLabels.addLabel(CharacterMatrix.LABEL_TAXON_DESCRIPTION);
}
- if(columnPosition==0){
+ if (columnPosition == 0) {
configLabels.addLabel(CharacterMatrix.TAXON_COLUMN);
- }
- else if(columnPosition==1){
+ } else if (columnPosition == 1) {
configLabels.addLabel(CharacterMatrix.COLLECTOR_COLUMN);
- }
- else if(columnPosition==2){
+ } else if (columnPosition == 2) {
configLabels.addLabel(CharacterMatrix.IDENTIFIER_COLUMN);
- }
- else if(columnPosition==3){
+ } else if (columnPosition == 3) {
configLabels.addLabel(CharacterMatrix.COUNTRY_COLUMN);
- }
- else{
- FeatureDto feature = matrix.getFeatures().get(columnPosition-CharacterMatrix.LEADING_COLUMN_COUNT);
+ } else {
+ FeatureDto feature = matrix.getFeatures().get(columnPosition - CharacterMatrix.LEADING_COLUMN_COUNT);
configLabels.addLabel(MatrixUtility.getProperty(feature));
// check for default values
- if(rowObject instanceof SpecimenRowWrapperDTO){
- SpecimenRowWrapperDTO specimenRowWrapper = (SpecimenRowWrapperDTO)rowObject;
- if(hasDefaultValue(feature, specimenRowWrapper)){
+ if (rowObject instanceof SpecimenRowWrapperDTO) {
+ SpecimenRowWrapperDTO specimenRowWrapper = (SpecimenRowWrapperDTO) rowObject;
+ if (hasDefaultValue(feature, specimenRowWrapper)) {
configLabels.addLabel(HAS_DEFAULT);
- if(hasDefaultOverriddenValue(feature, specimenRowWrapper)){
+ if (hasDefaultOverriddenValue(feature, specimenRowWrapper)) {
configLabels.removeLabel(HAS_DEFAULT);
configLabels.addLabel(DEFAULT_OVERRIDDEN);
}
}
-
+
}
- if (rowObject instanceof RowWrapperDTO){
- if (hasMoreThanOneValue(feature, (RowWrapperDTO)rowObject)){
- isEditable = false;
- }
- if (!isApplicableCheck(feature, (RowWrapperDTO)rowObject)){
- isApplicable = false;
- }
+ if (rowObject instanceof RowWrapperDTO) {
+ if (hasMoreThanOneValue(feature, (RowWrapperDTO) rowObject)) {
+ isEditable = false;
+ }
+ if (!isApplicableCheck(feature, (RowWrapperDTO) rowObject)) {
+ isApplicable = false;
+ }
}
- if(feature.isSupportsCategoricalData()){
-
+ if (feature.isSupportsCategoricalData()) {
+
configLabels.addLabel(CATEGORICAL);
- if(isEditable && isApplicable){
+ if (isEditable && isApplicable) {
configLabels.addLabel(CATEGORICAL_EDITABLE);
- }else if (!isEditable && isApplicable){
- configLabels.addLabel(NOT_EDITABLE);
+ } else if (!isEditable && isApplicable) {
+ configLabels.addLabel(NOT_EDITABLE);
}
-
- }
- else if(feature.isSupportsQuantitativeData()){
+
+ } else if (feature.isSupportsQuantitativeData()) {
configLabels.addLabel(QUANTITATIVE);
- if(isEditable && isApplicable){
+ if (isEditable && isApplicable) {
configLabels.addLabel(QUANTITATIVE_EDITABLE);
- }else if (!isEditable && isApplicable){
- configLabels.addLabel(NOT_EDITABLE);
+ } else if (!isEditable && isApplicable) {
+ configLabels.addLabel(NOT_EDITABLE);
}
}
- if (!isApplicable){
- configLabels.addLabel(NOT_APPLICABLE);
-
+ if (!isApplicable) {
+ configLabels.addLabel(NOT_APPLICABLE);
+
}
}
}
private boolean hasDefaultOverriddenValue(FeatureDto feature, RowWrapperDTO<?> rowWrapper) {
Set<DescriptionElementDto> dataValueForFeature = rowWrapper.getDataValueForFeature(feature.getUuid());
- if(dataValueForFeature!=null){
- for (DescriptionElementDto dto:dataValueForFeature){
- if(dto instanceof CategoricalDataDto && !((CategoricalDataDto) dto).getStates().isEmpty()){
- return true;
- }
- else if(dto instanceof QuantitativeDataDto && !((QuantitativeDataDto) dto).getValues().isEmpty()){
- return true;
- }
- }
+ if (dataValueForFeature != null) {
+ for (DescriptionElementDto dto : dataValueForFeature) {
+ if (dto instanceof CategoricalDataDto && !((CategoricalDataDto) dto).getStates().isEmpty()) {
+ return true;
+ } else if (dto instanceof QuantitativeDataDto && !((QuantitativeDataDto) dto).getValues().isEmpty()) {
+ return true;
+ }
+ }
}
return false;
}
private boolean hasDefaultValue(FeatureDto feature, RowWrapperDTO<?> rowWrapperDTO) {
- if(rowWrapperDTO instanceof SpecimenRowWrapperDTO
- && ((SpecimenRowWrapperDTO) rowWrapperDTO).getDefaultDescription()!=null){
- DescriptionBaseDto taxDescription = ((SpecimenRowWrapperDTO)rowWrapperDTO).getDefaultDescription().getDescription();
+ if (rowWrapperDTO instanceof SpecimenRowWrapperDTO
+ && ((SpecimenRowWrapperDTO) rowWrapperDTO).getDefaultDescription() != null) {
+ DescriptionBaseDto taxDescription = ((SpecimenRowWrapperDTO) rowWrapperDTO).getDefaultDescription()
+ .getDescription();
return hasDefaultValue(feature, taxDescription);
- }
- else if(rowWrapperDTO instanceof TaxonRowWrapperDTO){
- TaxonRowWrapperDTO taxonRowWrapper = (TaxonRowWrapperDTO)rowWrapperDTO;
+ } else if (rowWrapperDTO instanceof TaxonRowWrapperDTO) {
+ TaxonRowWrapperDTO taxonRowWrapper = (TaxonRowWrapperDTO) rowWrapperDTO;
Set<DescriptionBaseDto> descriptions = taxonRowWrapper.getTaxonDescriptions();
for (DescriptionBaseDto taxonDescription : descriptions) {
-// if(matrix.getDescriptiveDataSet().getDescriptions().contains(taxonDescription)
-// && taxonDescription.getTypes().contains(DescriptionType.DEFAULT_VALUES_FOR_AGGREGATION)){
-// return hasDefaultValue(feature, taxonDescription);
-// }
- //TODO: correct implementation
+ // if(matrix.getDescriptiveDataSet().getDescriptions().contains(taxonDescription)
+ // &&
+ // taxonDescription.getTypes().contains(DescriptionType.DEFAULT_VALUES_FOR_AGGREGATION)){
+ // return hasDefaultValue(feature, taxonDescription);
+ // }
+ // TODO: correct implementation
return false;
}
}
return false;
}
+
private boolean hasMoreThanOneValue(FeatureDto feature, RowWrapperDTO<?> rowWrapperDTO) {
-
- Set<DescriptionElementDto> elements = rowWrapperDTO.getDataValueForFeature(feature.getUuid());
- return elements != null && elements.size()>1;
-
-
+
+ Set<DescriptionElementDto> elements = rowWrapperDTO.getDataValueForFeature(feature.getUuid());
+ return elements != null && elements.size() > 1;
+
}
-
+
private boolean isApplicableCheck(FeatureDto feature, RowWrapperDTO<?> rowWrapperDTO) {
- TermTreeDto tree = matrix.getDescriptiveDataSet().getDescriptiveSystem();
+ TermTreeDto tree = (TermTreeDto) matrix.getDescriptiveDataSet().getDescriptiveSystem();
boolean isApplicableCheck = true;
- if (tree.getOnlyApplicable().containsKey(feature.getUuid())){
-
- for (FeatureStateDto featureStateDto:tree.getOnlyApplicable().get(feature.getUuid())){
- isApplicableCheck = false;
- FeatureDto dto = featureStateDto.getFeature();
- TermDto stateDto = featureStateDto.getState();
- Set<DescriptionElementDto> descEls = rowWrapperDTO.getDataValueForFeature(dto.getUuid());
- if (descEls != null){
- for (DescriptionElementDto el:descEls){
- if (el instanceof CategoricalDataDto){
- for (StateDataDto stateData:((CategoricalDataDto) el).getStates()){
- isApplicableCheck |= stateData.getState().getUuid().equals(stateDto.getUuid());
- }
- }
- }
- }
- }
+ if (tree.getOnlyApplicable().containsKey(feature.getUuid())) {
+
+ for (FeatureStateDto featureStateDto : tree.getOnlyApplicable().get(feature.getUuid())) {
+ isApplicableCheck = false;
+ FeatureDto dto = featureStateDto.getFeature();
+ TermDto stateDto = featureStateDto.getState();
+ Set<DescriptionElementDto> descEls = rowWrapperDTO.getDataValueForFeature(dto.getUuid());
+ if (descEls != null) {
+ for (DescriptionElementDto el : descEls) {
+ if (el instanceof CategoricalDataDto) {
+ for (StateDataDto stateData : ((CategoricalDataDto) el).getStates()) {
+ isApplicableCheck |= stateData.getState().getUuid().equals(stateDto.getUuid());
+ }
+ }
+ }
+ }
+ }
}
- if (tree.getInapplicableMap().containsKey(feature.getUuid())){
- for (FeatureStateDto featureStateDto:tree.getInapplicableMap().get(feature.getUuid())){
- FeatureDto dto = featureStateDto.getFeature();
- TermDto stateDto = featureStateDto.getState();
- Set<DescriptionElementDto> descEls = rowWrapperDTO.getDataValueForFeature(dto.getUuid());
- if (descEls != null){
- for (DescriptionElementDto el:descEls){
- if (el instanceof CategoricalDataDto){
- for (StateDataDto stateData:((CategoricalDataDto) el).getStates()){
- isApplicableCheck &= !stateData.getState().getUuid().equals(stateDto.getUuid());
- }
- }
- }
- }
- }
+ if (tree.getInapplicableMap().containsKey(feature.getUuid())) {
+ for (FeatureStateDto featureStateDto : tree.getInapplicableMap().get(feature.getUuid())) {
+ FeatureDto dto = featureStateDto.getFeature();
+ TermDto stateDto = featureStateDto.getState();
+ Set<DescriptionElementDto> descEls = rowWrapperDTO.getDataValueForFeature(dto.getUuid());
+ if (descEls != null) {
+ for (DescriptionElementDto el : descEls) {
+ if (el instanceof CategoricalDataDto) {
+ for (StateDataDto stateData : ((CategoricalDataDto) el).getStates()) {
+ isApplicableCheck &= !stateData.getState().getUuid().equals(stateDto.getUuid());
+ }
+ }
+ }
+ }
+ }
}
- if (!isApplicableCheck){
-
+ if (!isApplicableCheck) {
+
}
- return isApplicableCheck;
+ return isApplicableCheck;
}
-
private boolean hasDefaultValue(FeatureDto feature, DescriptionBaseDto defaultDescription) {
- if(defaultDescription!=null){
+ if (defaultDescription != null) {
Optional<DescriptionElementDto> descriptionElement = defaultDescription.getElements().stream()
- .filter(element->element.getFeatureUuid().equals(feature.getUuid()))
- .findAny();
- if(descriptionElement.isPresent() && descriptionElement.get() instanceof CategoricalDataDto){
+ .filter(element -> element.getFeatureUuid().equals(feature.getUuid())).findAny();
+ if (descriptionElement.isPresent() && descriptionElement.get() instanceof CategoricalDataDto) {
return !((CategoricalDataDto) descriptionElement.get()).getStates().isEmpty();
- }
- else if(descriptionElement.isPresent() && descriptionElement.get() instanceof QuantitativeDataDto){
+ } else if (descriptionElement.isPresent() && descriptionElement.get() instanceof QuantitativeDataDto) {
return !((QuantitativeDataDto) descriptionElement.get()).getValues().isEmpty();
}
--- /dev/null
+/**
+* Copyright (C) 2023 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.editor.descriptiveDataSet.matrix;
+
+import java.util.List;
+
+import org.eclipse.nebula.widgets.nattable.data.IColumnAccessor;
+import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
+
+/**
+ * @author katjaluther
+ * @since 16.08.2023
+ */
+public class CharacterMatrixListDataProvider<T> extends ListDataProvider<T> {
+
+ public CharacterMatrixListDataProvider(List<T> list, IColumnAccessor<T> columnAccessor) {
+ super(list, columnAccessor);
+ }
+
+ public IColumnAccessor<T> getColumnAccessor() {
+ return this.columnAccessor;
+ }
+}
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.IDescriptionService;
import eu.etaxonomy.cdm.api.service.IDescriptiveDataSetService;
import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.api.service.config.RemoveDescriptionsFromDescriptiveDataSetConfigurator;
-import eu.etaxonomy.cdm.api.service.dto.DescriptionBaseDto;
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
import eu.etaxonomy.cdm.api.service.dto.SpecimenRowWrapperDTO;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.description.DescriptiveDataSet;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.persistence.dto.DescriptionBaseDto;
+import eu.etaxonomy.cdm.persistence.dto.DescriptionElementDto;
import eu.etaxonomy.cdm.persistence.dto.DescriptiveDataSetBaseDto;
+import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
import eu.etaxonomy.cdm.persistence.dto.MergeResult;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.ICharacterMatrix;
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
/**
* Character matrix editor for editing specimen/taxon descriptions in a table
+ *
* @author pplitzner
* @since Nov 26, 2017
*/
-public class CharacterMatrixPart implements IE4SavablePart, IConversationEnabled, IDirtyMarkable,
- ICdmEntitySessionEnabled<DescriptiveDataSet>, IPartContentHasSupplementalData,
- IPartContentHasDetails {
+public class CharacterMatrixPart
+ implements IE4SavablePart, IDirtyMarkable, ICdmEntitySessionEnabled<DescriptiveDataSet>,
+ IPartContentHasSupplementalData, IPartContentHasDetails, ICharacterMatrix {
- private static final List<String> WS_PROPERTY_PATH = Arrays.asList(new String[] {
- "descriptions", //$NON-NLS-1$
+ private static final List<String> WS_PROPERTY_PATH = Arrays.asList(new String[] { "descriptions", //$NON-NLS-1$
"descriptions.describedSpecimenOrObservation", //$NON-NLS-1$
"descriptions.describedSpecimenOrObservation.gatheringEvent", //$NON-NLS-1$
"descriptions.describedSpecimenOrObservation.gatheringEvent.actor", //$NON-NLS-1$
private DescriptiveDataSetBaseDto descriptiveDataSet;
- private ConversationHolder conversation;
-
private ICdmEntitySession cdmEntitySession;
@Inject
@PostConstruct
public void create(Composite parent, IEclipseContext context) {
- if(CdmStore.isActive() && conversation==null){
- conversation = CdmStore.createConversation();
- }
- if(cdmEntitySession == null){
+ if (cdmEntitySession == null) {
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
cdmEntitySession.bind();
- }
- else{
+ } else {
return;
}
stackLayout = new StackLayout();
}
public void init(UUID descriptiveDataSetUuid, boolean treeView) {
-// this.descriptiveDataSet = CdmStore.getService(IDescriptiveDataSetService.class).load(descriptiveDataSetUuid, WS_PROPERTY_PATH);
- this.descriptiveDataSet = CdmStore.getService(IDescriptiveDataSetService.class).getDescriptiveDataSetDtoByUuid(descriptiveDataSetUuid);
- if(descriptiveDataSet!=null){
- if(descriptiveDataSet.getDescriptiveSystem()==null
- || descriptiveDataSet.getDescriptiveSystem().getTermType()==null
- || !descriptiveDataSet.getDescriptiveSystem().getTermType().equals(TermType.Character)){
- MessagingUtils.informationDialog(Messages.CharacterMatrixPart_COULD_NOT_OPEN, Messages.CharacterMatrixPart_COULD_NOT_OPEN_MESSAGE);
+ // this.descriptiveDataSet =
+ // CdmStore.getService(IDescriptiveDataSetService.class).load(descriptiveDataSetUuid,
+ // WS_PROPERTY_PATH);
+ this.descriptiveDataSet = CdmStore.getService(IDescriptiveDataSetService.class)
+ .getDescriptiveDataSetDtoByUuid(descriptiveDataSetUuid);
+ if (descriptiveDataSet != null) {
+ if (descriptiveDataSet.getDescriptiveSystem() == null
+ || descriptiveDataSet.getDescriptiveSystem().getTermType() == null
+ || !descriptiveDataSet.getDescriptiveSystem().getTermType().equals(TermType.Character)) {
+ MessagingUtils.informationDialog(Messages.CharacterMatrixPart_COULD_NOT_OPEN,
+ Messages.CharacterMatrixPart_COULD_NOT_OPEN_MESSAGE);
loadingFailed();
return;
}
try {
matrix.initDescriptiveDataSet();
} catch (IllegalArgumentException e) {
- MessagingUtils.errorDialog("Error during initilization", this, "Could not load matrix", TaxeditorEditorPlugin.PLUGIN_ID, e, false);
+ MessagingUtils.errorDialog("Error during initilization", this, "Could not load matrix",
+ TaxeditorEditorPlugin.PLUGIN_ID, e, false);
loadingFailed();
return;
}
matrix.createTable(treeView, true, true);
thisPart.setLabel(descriptiveDataSet.getTitleCache());
- matrix.loadDescriptions( true, true);
+ matrix.loadDescriptions(true, true);
}
}
- public IStructuredSelection getSelection(){
+ public IStructuredSelection getSelection() {
return matrix.getSelection();
}
public void save(IProgressMonitor monitor) {
HashMap<UUID, DescriptionBase<?>> descriptionResults = matrix.addSpecimensToDescriptiveDataSet();
- //newly added descriptions should not be saved again.
-// descriptions.removeAll(matrix.getRowsToSave().values());
+ // newly added descriptions should not be saved again.
+ // descriptions.removeAll(matrix.getRowsToSave().values());
// save edited descriptions
List<DescriptionBaseDto> descriptionsToMerge = matrix.getRowsToMerge().values().stream()
- .map(row->row.getDescription())
- .collect(Collectors.toList());
+ .map(row -> row.getDescription()).collect(Collectors.toList());
- if (matrix.getDescriptionsToDelete() != null && !matrix.getDescriptionsToDelete().isEmpty()){
+ if (matrix.getDescriptionsToDelete() != null && !matrix.getDescriptionsToDelete().isEmpty()) {
DeleteResult result = new DeleteResult();
- for (RemoveDescriptionsFromDescriptiveDataSetConfigurator config: matrix.getDescriptionsToDelete().keySet()){
- result.includeResult(CdmStore.getService(IDescriptiveDataSetService.class).removeDescriptions(matrix.getDescriptionsToDelete().get(config), matrix.getDescriptiveDataSet().getUuid(), config));
+ for (RemoveDescriptionsFromDescriptiveDataSetConfigurator config : matrix.getDescriptionsToDelete()
+ .keySet()) {
+ result.includeResult(CdmStore.getService(IDescriptiveDataSetService.class).removeDescriptions(
+ matrix.getDescriptionsToDelete().get(config), matrix.getDescriptiveDataSet().getUuid(),
+ config));
}
matrix.getDescriptionsToDelete().clear();
}
- List<MergeResult<DescriptionBase>> resultsFromSave = CdmStore.getService(IDescriptionService.class).merge(new ArrayList<>(matrix.getDescriptionsToSave()), true);
- for (MergeResult<DescriptionBase> result: resultsFromSave){
+ List<MergeResult<DescriptionBase>> resultsFromSave = CdmStore.getService(IDescriptionService.class)
+ .merge(new ArrayList<>(matrix.getDescriptionsToSave()), true);
+ for (MergeResult<DescriptionBase> result : resultsFromSave) {
Set<DescriptionBase> newEntities = result.getNewEntities();
- for(DescriptionBase<?> newEntity: newEntities){
+ for (DescriptionBase<?> newEntity : newEntities) {
descriptionResults.put(newEntity.getUuid(), newEntity);
}
descriptionResults.put(result.getMergedEntity().getUuid(), result.getMergedEntity());
}
matrix.getDescriptionsToSave().clear();
- UpdateResult results = CdmStore.getService(IDescriptionService.class).mergeDescriptions(descriptionsToMerge, matrix.getDescriptiveDataSet().getUuid());
+ UpdateResult results = CdmStore.getService(IDescriptionService.class).mergeDescriptions(descriptionsToMerge,
+ matrix.getDescriptiveDataSet().getUuid());
matrix.getRowsToMerge().clear();
-// conversation.commit();
+ // conversation.commit();
- for (CdmBase result: results.getUpdatedObjects()){
- if (result instanceof DescriptionBase){
- descriptionResults.put(result.getUuid(), (DescriptionBase<?>)result);
+ for (CdmBase result : results.getUpdatedObjects()) {
+ if (result instanceof DescriptionBase) {
+ descriptionResults.put(result.getUuid(), (DescriptionBase<?>) result);
}
}
- List<Object> updateRows = matrix.getDescriptions().stream().filter(row->descriptionResults.keySet().contains(((RowWrapperDTO<?>)row).getDescription().getDescriptionUuid())).collect(Collectors.toList());
- for (Object updateRow: updateRows){
- if (updateRow instanceof SpecimenRowWrapperDTO){
- SpecimenRowWrapperDTO dto = (SpecimenRowWrapperDTO)updateRow;
- DescriptionBaseDto desc = DescriptionBaseDto.fromDescription(descriptionResults.get(((SpecimenRowWrapperDTO) updateRow).getDescription().getDescriptionUuid()));
- dto.setDescription(desc);
+ List<Object> updateRows = matrix.getDescriptions().stream()
+ .filter(row -> descriptionResults.keySet()
+ .contains(((RowWrapperDTO<?>) row).getDescription().getDescriptionUuid()))
+ .collect(Collectors.toList());
+
+ Set<UUID> uuids = new HashSet<>();
+ for (UUID uuid: descriptionResults.keySet()) {
+ uuids.add(uuid);
+ }
+
+ List<DescriptionBaseDto> dtos = CdmStore.getService(IDescriptionService.class).loadDtos(uuids);
+ Map<UUID, DescriptionBaseDto> dtoMap = new HashMap<>();
+ dtos.forEach(s->dtoMap.put(s.getDescriptionUuid(), s));
+ for (Object updateRow : updateRows) {
+ if (updateRow instanceof SpecimenRowWrapperDTO) {
+ SpecimenRowWrapperDTO dto = (SpecimenRowWrapperDTO) updateRow;
+
+// DescriptionBaseDto desc = DescriptionBaseDto.fromDescription(descriptionResults
+// .get(((SpecimenRowWrapperDTO) updateRow).getDescription().getDescriptionUuid()));
+ dto.setDescription(dtoMap.get(dto.getDescription().getDescriptionUuid()));
}
}
-// matrix.loadDescriptions(getDescriptiveDataSet().getUuid(), false);
+ // matrix.loadDescriptions(getDescriptiveDataSet().getUuid(), false);
eventBroker.post(WorkbenchEventConstants.CURRENT_ACTIVE_EDITOR, null);
dirty.setDirty(false);
}
}
@Focus
- public void setFocus(){
- if(conversation!=null){
- conversation.bind();
- }
- if(cdmEntitySession != null) {
+ public void setFocus() {
+ if (cdmEntitySession != null) {
cdmEntitySession.bind();
}
}
@PreDestroy
- public void dispose(){
- if (conversation != null) {
- conversation.close();
- conversation = null;
- }
- if(cdmEntitySession != null) {
+ public void dispose() {
+ if (cdmEntitySession != null) {
cdmEntitySession.dispose();
cdmEntitySession = null;
}
dirty.setDirty(false);
}
- @Override
- public void update(CdmDataChangeMap arg0) {
- }
-
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
@Override
public void changed(Object element) {
setDirty();
matrix.getNatTable().refresh();
- if (element instanceof DescriptionBase){
- if (!matrix.getRowsToMerge().containsKey(((DescriptionBase<?>)element).getUuid())){
- matrix.addDescriptionToSave((DescriptionBase<?>)element);
+ if (element instanceof DescriptionBase) {
+ if (!matrix.getRowsToMerge().containsKey(((DescriptionBase<?>) element).getUuid())) {
+ matrix.addDescriptionToSave((DescriptionBase<?>) element);
+ }
+ }else if (element instanceof DescriptionElementDto) {
+
+ if (!matrix.getRowsToMerge().containsKey(((DescriptionElementDto) element).getElementUuid())) {
+ // matrix.putRowToMerge(rowWrapper);
}
}
}
@Override
public Collection<DescriptiveDataSet> getRootEntities() {
- //no dataset entity only dto
+ // no dataset entity only dto
return null;
}
@Override
public Map<Object, List<String>> getPropertyPathsMap() {
Map<Object, List<String>> propertyMap = new HashMap<>();
- propertyMap.put(SpecimenOrObservationBase.class,WS_PROPERTY_PATH);
+ propertyMap.put(SpecimenOrObservationBase.class, WS_PROPERTY_PATH);
return propertyMap;
}
stackLayout.topControl = matrix;
matrix.getParent().layout();
}
+
+
+ @Override
+ public IStructuredSelection getActualSelection() {
+
+ return matrix.getSelection();
+ }
+
+ @Override
+ public FeatureDto getActualFeature(int columnPosition) {
+ return matrix.getFeatures().get(columnPosition - CharacterMatrix.LEADING_COLUMN_COUNT);
+ }
}
--- /dev/null
+/**
+* Copyright (C) 2023 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.editor.descriptiveDataSet.matrix;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.equinox.internal.p2.ui.misc.StringMatcher;
+import org.eclipse.jface.fieldassist.ComboContentAdapter;
+import org.eclipse.jface.fieldassist.ContentProposalAdapter;
+import org.eclipse.jface.fieldassist.IContentProposal;
+import org.eclipse.jface.fieldassist.IContentProposalListener;
+import org.eclipse.jface.fieldassist.IContentProposalProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Listener;
+
+import eu.etaxonomy.cdm.persistence.dto.StateDataDto;
+import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+
+/**
+ * @author katjaluther
+ * @since 26.09.2023
+ */
+public class DataComboElement {
+
+ private Combo valueCombo;
+
+
+ private CdmContentProposalAdapter adapter ;
+
+
+ public DataComboElement(Composite valuesComposite, String value, StateDataDto selectedState, List<TermDto> dataValues, boolean modifier, int style) {
+
+ valueCombo = new Combo(valuesComposite, SWT.BORDER);
+ int index = 0;
+ int selectedIndex = 0;
+ valueCombo.add("", index);
+ index++;
+ for (TermDto term : dataValues) {
+ valueCombo.add(term.getPreferredRepresentation(PreferencesUtil.getGlobalLanguage()).getLabel(), index);
+ valueCombo.setData(term.getPreferredRepresentation(PreferencesUtil.getGlobalLanguage()).getLabel(), term);
+
+ try {
+ if (selectedState != null && ((!modifier && selectedState.getState() != null && term.getUuid().equals(selectedState.getState().getUuid())) || (modifier && selectedState.getModifiers() != null && !selectedState.getModifiers().isEmpty() && term.getUuid().equals(selectedState.getModifiers().iterator().next().getUuid()))) ){
+ selectedIndex = index;
+ }
+ }catch(NullPointerException e) {
+ System.err.println(e.getMessage());
+ }
+ index++;
+ }
+// if (selectedIndex != 0) {
+// valueCombo.select(selectedIndex);
+// }else {
+// if (value != null && !value.equals("null")) {
+// valueCombo.setText(value);
+//
+// }
+// }
+//
+ valueCombo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ int index = valueCombo.getSelectionIndex();
+ if (index >-1) {
+ TermDto state = (TermDto)valueCombo.getData(valueCombo.getItem(index));
+ if (selectedState == null) {
+ return;
+ }
+ if (modifier) {
+ if (selectedState.getModifiers() == null) {
+ selectedState.setModifiers(new ArrayList<TermDto>());
+ }else {
+ selectedState.getModifiers().clear();
+ }
+ if (state != null) {
+ selectedState.addModifier(state);
+ }
+ }else {
+ selectedState.setState(state);
+ }
+ }
+ }
+ });
+
+// ContentProposalAdapter adapter;
+
+ adapter = new CdmContentProposalAdapter(valueCombo, new ComboContentAdapter(), getProposalProvider(), null, null);
+ adapter.setPropagateKeys(true);
+ adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_INSERT);
+ adapter.addContentProposalListener(new IContentProposalListener() {
+ @SuppressWarnings("unchecked")
+ @Override
+ public void proposalAccepted(IContentProposal proposal) {
+ Listener[] listeners = valueCombo.getListeners(SWT.Selection);
+
+ for (Listener listener : listeners) {
+ valueCombo.removeListener(SWT.Selection, listener);
+ }
+ int selectedIndex = 0;
+ if (proposal.getContent() == null) {
+ // set selection to the emptyElement
+ selectedIndex = 0;
+ } else {
+ int index = 1;
+ if (proposal.getContent() != null) {
+ for (TermDto value: dataValues) {
+ if (value.getPreferredRepresentation(PreferencesUtil.getGlobalLanguage()).getLabel().equals(proposal.getContent())) {
+ selectedIndex = index++;
+ break;
+ }
+ index++;
+
+ }
+ }
+
+ }
+
+ for (Listener listener : listeners) {
+ valueCombo.addListener(SWT.Selection, listener);
+ }
+ valueCombo.select(selectedIndex);
+ TermDto state = (TermDto)valueCombo.getData(valueCombo.getItem(selectedIndex));
+
+ if (selectedState == null) {
+ return;
+ }
+ if (modifier) {
+ if (selectedState.getModifiers()== null) {
+ selectedState.setModifiers(new ArrayList<TermDto>());
+ }else {
+ selectedState.getModifiers().clear();
+ }
+ if (state != null) {
+ selectedState.addModifier(state);
+ }
+ }else {
+ selectedState.setState(state);
+ }
+ }
+ });
+
+ if (selectedIndex != 0) {
+ valueCombo.select(selectedIndex);
+ }else {
+ if (value != null && !value.equals("null")) {
+ valueCombo.setText(value);
+ valueCombo.setFocus();
+ }
+ }
+
+
+ }
+
+
+ IContentProposalProvider getProposalProvider() {
+ return new IContentProposalProvider() {
+
+ @Override
+ public IContentProposal[] getProposals(String contents, int position) {
+ String[] items = valueCombo.getItems();
+ if (contents.length() == 0 || items.length == 0) {
+ return new IContentProposal[0];
+ }
+ StringMatcher matcher = new StringMatcher("*" + contents + "*", true, false); //$NON-NLS-1$ //$NON-NLS-2$
+ ArrayList<String> matches = new ArrayList<>();
+ for (int i = 0; i < items.length; i++) {
+ if (matcher.match(items[i])) {
+ matches.add(items[i]);
+ }
+ }
+ if (matches.size() == 0) {
+ for (int i = 0; i < items.length; i++) {
+ matches.add(items[i]);
+ }
+ }
+ Collections.sort(matches);
+
+ // We don't want to autoactivate if the only proposal exactly matches
+ // what is in the combo. This prevents the popup from
+ // opening when the user is merely scrolling through the combo values or
+ // has accepted a combo value.
+ if (matches.size() == 1 && matches.get(0).equals(valueCombo.getText())) {
+ return new IContentProposal[0];
+ }
+
+ if (matches.isEmpty()) {
+ return new IContentProposal[0];
+ }
+
+ // Make the proposals
+ IContentProposal[] proposals = new IContentProposal[matches.size()];
+ for (int i = 0; i < matches.size(); i++) {
+ final String proposal = matches.get(i);
+ proposals[i] = new IContentProposal() {
+
+ @Override
+ public String getContent() {
+ return proposal;
+ }
+
+ @Override
+ public int getCursorPosition() {
+ return proposal.length();
+ }
+
+ @Override
+ public String getDescription() {
+ return null;
+ }
+
+ @Override
+ public String getLabel() {
+ return null;
+ }
+ };
+ }
+
+ return proposals;
+ }
+ };
+ }
+
+
+ /**
+ * @return the valueCombo
+ */
+ public Combo getValueCombo() {
+ return valueCombo;
+ }
+
+
+ /**
+ * @param valueCombo the valueCombo to set
+ */
+ public void setValueCombo(Combo valueCombo) {
+ this.valueCombo = valueCombo;
+ }
+
+ public void setListVisible(boolean isSet) {
+ this.valueCombo.setListVisible(isSet);
+ }
+
+
+ /**
+ * @return the adapter
+ */
+ public CdmContentProposalAdapter getAdapter() {
+ return adapter;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2023 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.editor.descriptiveDataSet.matrix;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+import eu.etaxonomy.cdm.model.description.NoDescriptiveDataStatus;
+import eu.etaxonomy.cdm.persistence.dto.DescriptionElementDto;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author katjaluther
+ * @since 19.09.2023
+ */
+public abstract class DataDialogComposite extends Composite {
+ protected Combo noDataCombo;
+ protected Composite valuesComposite;
+ protected Composite headComposite;
+ protected CharacterMatrix matrix;
+ protected DescriptionElementDto editorValue;
+
+ public DataDialogComposite(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ public NoDescriptiveDataStatus getNoDataValue(){
+ int selectIndex = noDataCombo.getSelectionIndex();
+ if (selectIndex > -1) {
+ String item = noDataCombo.getItem(selectIndex);
+ NoDescriptiveDataStatus status = (NoDescriptiveDataStatus)noDataCombo.getData(item);
+ return status;
+ }
+ return null;
+ }
+
+ protected void createNoDataCombo(Composite composite) {
+
+ Composite noDataComposite = new Composite(this, SWT.NONE);
+ noDataComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+
+ noDataComposite.setLayout(new GridLayout(2, false));
+
+ Label lblNoDataLabel = new Label(noDataComposite, SWT.NONE);
+ lblNoDataLabel.setText("No Data Available");
+ noDataCombo = new Combo(noDataComposite, SWT.NONE | SWT.READ_ONLY);
+ noDataCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ int index = 1;
+ noDataCombo.add("", 0);
+ List<NoDescriptiveDataStatus> valueList = new ArrayList<>();
+ Collections.addAll(valueList, NoDescriptiveDataStatus.values());
+ Collections.sort(valueList, new Comparator<NoDescriptiveDataStatus>() {
+ @Override
+ public int compare(NoDescriptiveDataStatus o1, NoDescriptiveDataStatus o2) {
+ return o1.getLabel(CdmStore.getDefaultLanguage()).compareTo(o2.getLabel(CdmStore.getDefaultLanguage()));
+ }
+ });
+ for (NoDescriptiveDataStatus status : valueList) {
+ noDataCombo.add(status.getLabel(), index);
+ noDataCombo.setData(status.getLabel(), status);
+ if (editorValue != null && editorValue.getNoDataStatus() != null && editorValue.getNoDataStatus().equals(status)) {
+ noDataCombo.select(index);
+ }
+ index++;
+
+ }
+
+ noDataCombo.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String name = noDataCombo.getText();
+ editorValue.setNoDataStatus((NoDescriptiveDataStatus)noDataCombo.getData(name));
+ if (StringUtils.isNotBlank(name)) {
+ valuesComposite.setEnabled(false);
+ for(Control c: valuesComposite.getChildren()) {
+ c.setVisible(false);
+ }
+ if (headComposite != null) {
+ headComposite.setEnabled(false);
+ for(Control c: headComposite.getChildren()) {
+ c.setVisible(false);
+ }
+ }
+ // valuesComposite.dispose();
+ }else {
+ valuesComposite.setEnabled(true);
+ for(Control c: valuesComposite.getChildren()) {
+ c.setVisible(true);
+ }
+ if (headComposite != null) {
+ headComposite.setEnabled(true);
+ for(Control c: headComposite.getChildren()) {
+ c.setVisible(true);
+ }
+ }
+ }
+
+ }
+
+ });
+ }
+
+ protected void refresh() {
+ this.getShell().redraw();
+ this.getShell().pack();
+ }
+
+
+
+
+}
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.service.dto.DescriptionBaseDto;
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
import eu.etaxonomy.cdm.model.description.DescriptionType;
+import eu.etaxonomy.cdm.persistence.dto.DescriptionBaseDto;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDtoByNameComparator;
import org.eclipse.swt.graphics.Image;
-import eu.etaxonomy.cdm.api.service.dto.CategoricalDataDto;
-import eu.etaxonomy.cdm.api.service.dto.DescriptionElementDto;
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
-import eu.etaxonomy.cdm.api.service.dto.StateDataDto;
import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO;
import eu.etaxonomy.cdm.model.description.DescriptionType;
import eu.etaxonomy.cdm.model.description.DescriptiveDataSet;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.persistence.dto.CategoricalDataDto;
+import eu.etaxonomy.cdm.persistence.dto.DescriptionElementDto;
import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
import eu.etaxonomy.cdm.persistence.dto.FeatureStateDto;
+import eu.etaxonomy.cdm.persistence.dto.StateDataDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
import eu.etaxonomy.taxeditor.model.ImageResources;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Set;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
import eu.etaxonomy.cdm.api.service.dto.SpecimenRowWrapperDTO;
import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO;
+import eu.etaxonomy.cdm.persistence.dto.DescriptionElementDto;
import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
/**
* Property accessor class which maps setting and getting data for
* each row in the character matrix
+ *
* @author pplitzner
* @since Nov 26, 2017
*
}
return taxonWrapper.getDisplayDataForFeature(feature.getUuid());
+ } else if (columnIndex == 0) {
+ return rowObject;
}
- else if (columnIndex == 0) {
+ return null;
+ }
+
+ public Object getData(Object rowObject, int columnIndex) {
+ if (rowObject instanceof SpecimenRowWrapperDTO) {
+ SpecimenRowWrapperDTO rowWrapper = (SpecimenRowWrapperDTO) rowObject;
+ switch (columnIndex) {
+ case 0:
+ if (matrix.isTreeView()) {
+ return "#" + rowWrapper.getSpecimenDto().getId();
+ } else {
+ return rowWrapper.getTaxonNode();
+ }
+ case 1:
+ if (rowWrapper.getSpecimenDto() != null) {
+ if (StringUtils.isBlank(rowWrapper.getSpecimenDto().getCollectorsString())) {
+ if (rowWrapper.getFieldUnit() != null) {
+ return rowWrapper.getFieldUnit().getTitleCache();
+ } else {
+ return "no information";
+ }
+ }
+ return rowWrapper.getSpecimenDto().getCollectorsString();
+ } else if (rowWrapper.getFieldUnit() != null) {
+ return rowWrapper.getFieldUnit().getTitleCache();
+ } else {
+ return "no information";
+ }
+ case 2:
+ return rowWrapper.getIdentifier();
+ case 3:
+ return rowWrapper.getCountry();
+
+ default:
+ break;
+ }
+ FeatureDto feature = matrix.getIndexToFeatureMap().get(columnIndex);
+ Set<DescriptionElementDto> data = rowWrapper.getDataValueForFeature(feature.getUuid());
+ DescriptionElementDto result = null;
+ if (data != null && !data.isEmpty()) {
+ result = data.iterator().next();
+ }
+ return result;
+ } else if (rowObject instanceof TaxonRowWrapperDTO) {
+ TaxonRowWrapperDTO taxonWrapper = (TaxonRowWrapperDTO) rowObject;
+ if (columnIndex == 0) {
+ return taxonWrapper.getDescription();
+ }
+ FeatureDto feature = matrix.getIndexToFeatureMap().get(columnIndex);
+ if (feature == null) {
+ return null;
+ }
+ return taxonWrapper.getDataValueForFeature(feature.getUuid());
+
+ } else if (columnIndex == 0) {
return rowObject;
}
return null;
@Override
public void setDataValue(Object rowObject, int columnIndex, Object newValue) {
- if(rowObject instanceof RowWrapperDTO){
- RowWrapperDTO rowWrapper = (RowWrapperDTO)rowObject;
+ if (rowObject instanceof RowWrapperDTO) {
+ RowWrapperDTO rowWrapper = (RowWrapperDTO) rowObject;
FeatureDto feature = matrix.getIndexToFeatureMap().get(columnIndex);
if(feature.isSupportsCategoricalData()
&& newValue instanceof Collection){
-
- List<TermDto> dtos = new ArrayList<>();
- if (((Collection) newValue).stream().allMatch(o->o instanceof TermDto) ){
- dtos = (List<TermDto>)newValue;
- }
- rowWrapper.setDataValueForCategoricalData(feature.getUuid(), dtos);
+ List<Object> dtos = new ArrayList<>();
+
+ //TODO:This needs to be adapted because already added modifiers will be deleted!!!!!
+ if (((Collection) newValue).stream().allMatch(o -> o instanceof TermDto)) {
+ dtos = (List<Object>) newValue;
+ }
+
+ rowWrapper.setDataValueForCategoricalData(feature.getUuid(), dtos, PreferencesUtil.getGlobalLanguage());
matrix.putRowToMerge(rowWrapper);
}
}
*/
package eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.categorical;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider;
@Override
public List<?> getValues(int columnIndex, int rowIndex) {
FeatureDto feature = matrix.getIndexToFeatureMap().get(columnIndex);
- List<TermDto> supportedStatesForCategoricalFeature = matrix.getSupportedStatesForCategoricalFeature(feature.getUuid());
- return supportedStatesForCategoricalFeature;
+ List<TermDto> supportedStatesForCategoricalFeature = matrix
+ .getSupportedStatesForCategoricalFeature(feature.getUuid());
+ List<Object> objectsList = new ArrayList<>();
+
+ int index = 0;
+// for (NoDescriptiveDataStatus status : NoDescriptiveDataStatus.values()) {
+// objectsList.add(index, status);
+// index++;
+// }
+ for (TermDto term : supportedStatesForCategoricalFeature) {
+ objectsList.add(index, term);
+ index++;
+ }
+ return objectsList;
}
}
*/
package eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.categorical;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
+import java.util.Iterator;
+import java.util.Map;
import java.util.Set;
-import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
-import org.eclipse.nebula.widgets.nattable.widget.NatCombo;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.jface.window.Window;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.edit.ICellEditHandler;
+import org.eclipse.nebula.widgets.nattable.edit.gui.AbstractDialogCellEditor;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+import org.eclipse.nebula.widgets.nattable.widget.EditModeEnum;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import eu.etaxonomy.cdm.api.service.dto.DescriptionElementDto;
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
+import eu.etaxonomy.cdm.persistence.dto.CategoricalDataDto;
+import eu.etaxonomy.cdm.persistence.dto.DescriptionElementDto;
import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.CharacterMatrix;
-import eu.etaxonomy.taxeditor.event.EventUtility;
-import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
/**
* Cell editor for CategoricalData
+ *
* @author pplitzner
* @since Dec 7, 2017
*
*/
-public class CategoricalDataCellEditor extends ComboBoxCellEditor{
+public class CategoricalDataCellEditor extends AbstractDialogCellEditor {
+ private CategoricalDataDto editorValue;
+ private RowWrapperDTO<?> rowWrapperDTO;
+ private boolean closed;
private CharacterMatrix matrix;
+ private Character initialInput;
+
- public CategoricalDataCellEditor(CharacterMatrix matrix, CategoricalComboBoxDataProvider categoricalComboBoxDataProvider) {
- super(categoricalComboBoxDataProvider, 10);
+ public CategoricalDataCellEditor(CharacterMatrix matrix) {
+ super();
this.matrix = matrix;
- setUseCheckbox(true);
- setMultiselect(true);
- setShowDropdownFilter(true);
}
@Override
- public void setCanonicalValue(Object canonicalValue) {
- List canonicalValueList = new ArrayList<>();
-
- if (canonicalValue instanceof String[]){
- String[] stringArray = (String[])canonicalValue;
- for (int i = 0; i<stringArray.length; i++){
- canonicalValueList.add(stringArray[i]);
- }
- }else if (canonicalValue instanceof List){
- canonicalValueList = (List<String>)canonicalValue;
- }else if (canonicalValue instanceof String){
- canonicalValueList.add((String)canonicalValue);
- }else if (canonicalValue instanceof HashSet){
- canonicalValueList = new ArrayList(((HashSet)canonicalValue));
+ public int open() {
+ Object rowObject = matrix.getBodyDataProvider().getRowObject(getRowIndex());
+ if(rowObject instanceof RowWrapperDTO){
+ this.closed = false;
+ return getDialogInstance().open();
}
- super.setCanonicalValue(canonicalValueList);
+ return Window.CANCEL;
}
@Override
- protected Control activateCell(Composite parent, Object originalCanonicalValue) {
-
- if(matrix.getBodyDataProvider().getRowObject(this.getRowIndex()) instanceof RowWrapperDTO){
- NatCombo natCombo = (NatCombo) super.activateCell(parent, originalCanonicalValue);
- natCombo.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- matrix.setDirty();
- }
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
+ public CategoricalDataDialog createDialogInstance() {
+ return new CategoricalDataDialog(this.initialInput, matrix, this.parent.getShell(), getCanonicalValue(), this.layerCell, this, this.configRegistry);
+ }
+
+ @Override
+ public CategoricalDataDialog getDialogInstance() {
+ return (CategoricalDataDialog) this.dialog;
+ }
+
+ @Override
+ public Object getEditorValue() {
+ return this.editorValue;
+ }
+
+ @Override
+ public void setEditorValue(Object value) {
+ ((CategoricalDataDialog)this.dialog).setEditorValue((CategoricalDataDto) value);
+ ((CategoricalDataDialog)this.dialog).setRowWrapper(rowWrapperDTO);
+ this.editorValue = (CategoricalDataDto) value;
+ }
+
+ @Override
+ public void close() {
+ this.closed = true;
+ this.dialog = null;
+ this.editorValue = null;
+ }
+
+ @Override
+ public boolean isClosed() {
+ return closed;
+ }
+
+ @Override
+ public Control activateCell(Composite parent, Object originalCanonicalValue, EditModeEnum editMode,
+ ICellEditHandler editHandler, ILayerCell cell, IConfigRegistry configRegistry) {
+ this.initialInput = null;
+ Object rowObject = matrix.getBodyDataProvider().getRowObject(cell.getRowIndex());
+ FeatureDto feature = matrix.getIndexToFeatureMap().get(cell.getColumnIndex());
+ if(feature.getSupportedCategoricalEnumerations().isEmpty()) {
+ return null;
+ }
+ CategoricalDataDto categoricalDataDto = null;
+ if(rowObject instanceof RowWrapperDTO){
+ rowWrapperDTO = (RowWrapperDTO<?>) rowObject;
+ Set<DescriptionElementDto> dataValueForFeature = rowWrapperDTO.getDataValueForFeature(feature.getUuid());
+ if (dataValueForFeature != null && dataValueForFeature.size() > 1){
+ return null;
+ }
+
+ DescriptionElementDto dto = null;
+ if (dataValueForFeature != null){
+ Iterator<DescriptionElementDto> it = dataValueForFeature.iterator();
+ if(it.hasNext() ){
+ dto = it.next();
}
- });
- return natCombo;
+ }
+ if(dto instanceof CategoricalDataDto){
+ categoricalDataDto = (CategoricalDataDto) dto;
+ categoricalDataDto.setFeatureDto(feature);
+ }
+ //create new Quantitative Data
+ if (categoricalDataDto == null) {
+ categoricalDataDto = ((RowWrapperDTO) rowObject).addCategoricalData(feature);
+ }
+ /**
+ * when opening the the dialog by a key stroke, store the key pressed
+ * and pass it to the dialog. This is common behavior but by overriding
+ * this method we always pass the QuantitativeData object to the dialog
+ * so we need to buffer the key stroke
+ */
+ if(originalCanonicalValue instanceof Character){
+ this.initialInput = (Character) originalCanonicalValue;
+ }
}
- return null;
+ return super.activateCell(parent, categoricalDataDto, editMode, editHandler, cell, configRegistry);
+ }
+
+ @Override
+ public void setDialogSettings(Map<String, Object> editDialogSettings) {
+ //pass through dialog setting to wrapped dialog
+ ((CategoricalDataDialog)this.dialog).setDialogSettings(editDialogSettings);
}
+
+
}
--- /dev/null
+/**
+* Copyright (C) 2018 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.editor.descriptiveDataSet.matrix.categorical;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.jface.window.Window;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
+import org.eclipse.nebula.widgets.nattable.edit.gui.CellEditDialog;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
+import eu.etaxonomy.cdm.persistence.dto.CategoricalDataDto;
+import eu.etaxonomy.cdm.persistence.dto.StateDataDto;
+import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.CharacterMatrix;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+
+/**
+ * @author pplitzner
+ * @since Jul 19, 2018
+ *
+ */
+public class CategoricalDataDialog extends CellEditDialog {
+
+ private Character initialInput;
+
+ private CharacterMatrix matrix;
+
+ public CategoricalDataDialog(Character initialInput, CharacterMatrix matrix, Shell parentShell, Object originalCanonicalValue, ILayerCell cell,
+ ICellEditor cellEditor, IConfigRegistry configRegistry) {
+ super(parentShell, originalCanonicalValue, cell, cellEditor, configRegistry);
+ this.initialInput = initialInput;
+ this.matrix = matrix;
+
+
+ }
+
+ private CategoricalDataDto editorValue;
+ private RowWrapperDTO<?> rowWrapperDTO;
+
+ private CategoricalDataDialogComposite composite;
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Collection<String> displayStrings = rowWrapperDTO.getDisplayDataForFeature(editorValue.getFeatureUuid());
+ String initialDisplay = null;
+ StringBuffer sb = new StringBuffer();
+ boolean first = true;
+ if (displayStrings != null) {
+ for (String o : displayStrings) {
+ sb.append(first? o : ", " + o);
+ first = false;
+
+ }
+ }
+ initialDisplay = (sb.length() > 0)? sb.toString() : "-";
+
+ composite = new CategoricalDataDialogComposite(initialDisplay, this.initialInput, editorValue , parent, matrix,SWT.NONE);
+ return composite;
+ }
+
+ void setEditorValue(CategoricalDataDto editorValue) {
+ this.editorValue = editorValue;
+ }
+
+ void setRowWrapper(RowWrapperDTO<?> rowWrapperDTO) {
+ this.rowWrapperDTO = rowWrapperDTO;
+ }
+
+ @Override
+ public boolean close() {
+ if(getReturnCode()==Window.OK){
+ //clear values
+ //editorValue.getValues().clear();
+ //add back all values from text fields
+
+ if (composite.getNoDataValue() == null) {
+ Set<StateDataDto> selectedStates= composite.getSelectedStates();
+ Set<StateDataDto> statesToRemove = new HashSet<>();
+ for (StateDataDto state: selectedStates) {
+ if (state.getState() == null) {
+ statesToRemove.add(state);
+ }
+ }
+ selectedStates.removeAll(statesToRemove);
+ rowWrapperDTO.setDataValueForCategoricalData(editorValue.getFeatureDto().getUuid(), new ArrayList<StateDataDto>(selectedStates), PreferencesUtil.getGlobalLanguage());
+ }else {
+ rowWrapperDTO.getDataValueForFeature(editorValue.getFeatureDto().getUuid()).clear();
+ CategoricalDataDto element = rowWrapperDTO.addCategoricalData(editorValue.getFeatureDto());
+ element.setNoDataStatus(composite.getNoDataValue());
+
+ rowWrapperDTO.generateNewDisplayString(editorValue.getFeatureUuid(), element, PreferencesUtil.getGlobalLanguage());
+ }
+
+
+ matrix.putRowToMerge(rowWrapperDTO);
+
+ matrix.setDirty();
+ }
+ return super.close();
+ }
+
+ @Override
+ protected boolean isResizable() {
+ return true;
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2018 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.editor.descriptiveDataSet.matrix.categorical;
+
+
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+import eu.etaxonomy.cdm.persistence.dto.CategoricalDataDto;
+import eu.etaxonomy.cdm.persistence.dto.DescriptionElementDto;
+import eu.etaxonomy.cdm.persistence.dto.StateDataDto;
+import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.CharacterMatrix;
+import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.DataComboElement;
+import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.DataDialogComposite;
+import eu.etaxonomy.taxeditor.model.ImageResources;
+
+/**
+ * @author k.luther
+ * @date 16.09.2023
+ *
+ */
+public class CategoricalDataDialogComposite extends DataDialogComposite {
+
+
+// Combo noDataCombo;
+
+ String initialString;
+ private Set<StateDataDto> stateList;
+
+
+
+
+ public CategoricalDataDialogComposite(String initialInput, Character c, CategoricalDataDto editorVal, Composite parent, CharacterMatrix matrix,
+ int style) {
+ super(parent, style);
+ this.matrix = matrix;
+ this.editorValue = editorVal;
+ initialString = initialInput;
+
+
+ setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ ((GridData)getLayoutData()).minimumWidth= 300;
+
+ setLayout(new GridLayout(1, false));
+
+ createNoDataCombo(this);
+ headComposite = new Composite(this, SWT.NONE);
+ headComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+
+ headComposite.setLayout(new GridLayout(2, false));
+ Label lblNewLabel = new Label(headComposite, SWT.NONE);
+ if (getModifiers() != null && !getModifiers().isEmpty()) {
+ lblNewLabel.setText("Modifier and State");
+ }else {
+ lblNewLabel.setText("State");
+ }
+
+ Button addNewState = new Button(headComposite, SWT.NONE);
+ addNewState.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, true, 1,1));
+
+ addNewState.setImage(ImageResources.getImage(ImageResources.ADD_ICON));
+ //new Label(composite_2, SWT.NONE);
+ addNewState.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ DataComboElement emptyTextField = addState(valuesComposite,
+ initialString == null ? null : c, new StateDataDto());
+ emptyTextField.getValueCombo().setFocus();
+ emptyTextField.setListVisible(true);
+
+ refresh();
+ }
+ });
+
+ valuesComposite = new Composite(this, SWT.NONE);
+ valuesComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+
+ valuesComposite.setLayout(new GridLayout(1, false));
+
+ List<TermDto> selectedTerms = new ArrayList<>();
+ if (editorVal != null) {
+ editorVal.getStates().removeIf(s->s == null);
+ editorVal.getStates().forEach(s -> selectedTerms.add(s.getState()));
+ }
+
+
+ // add empty text field for new state
+ DataComboElement emptyDataElement = addState(valuesComposite,
+ initialString == null ? null : c, new StateDataDto());
+
+ // add existing states
+ ((CategoricalDataDto)editorValue).getStates().stream()
+ .forEach(state -> addState(valuesComposite, null, state));
+
+ if (editorValue.getNoDataStatus()!= null) {
+ headComposite.setEnabled(false);
+ valuesComposite.setEnabled(false);
+ for(Control control: valuesComposite.getChildren()) {
+ control.setVisible(false);
+ }
+ for(Control control: headComposite.getChildren()) {
+ control.setVisible(false);
+ }
+ }
+ emptyDataElement.getAdapter().activate();
+ }
+
+ public DescriptionElementDto getEditorValue() {
+ return editorValue;
+ }
+
+ private List<TermDto> getCategoricalValues(){
+ List<TermDto> supportedStatesForCategoricalFeature = matrix
+ .getSupportedStatesForCategoricalFeature(editorValue.getFeatureUuid());
+
+ return supportedStatesForCategoricalFeature;
+ }
+
+
+ private List<TermDto> getModifiers(){
+ List<TermDto> recommendedModifiersForCategoricalFeature = matrix
+ .getRecommendModifiersForCategoricalFeature(editorValue.getFeatureUuid());
+
+ return recommendedModifiersForCategoricalFeature;
+ }
+
+ public Set<StateDataDto> getSelectedStates(){
+// String[] selected = valueCombo.getSelections();
+// List<TermDto> selectedStates = new ArrayList<>();
+// for (String value: selected) {
+// selectedStates.add((TermDto)valueCombo.getData(value));
+// }
+ return stateList;
+ }
+
+ private DataComboElement addState(Composite valuesComposite, Character value, StateDataDto selectedState) {
+
+ Composite composite_2 = new Composite(valuesComposite, SWT.NONE);
+
+ composite_2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
+ int numColumns = 2;
+ if (getModifiers() != null && !getModifiers().isEmpty()) {
+ numColumns = 3;
+ }
+ GridLayout gl_composite_2 = new GridLayout(numColumns, false);
+ gl_composite_2.marginHeight = 0;
+ gl_composite_2.marginWidth = 0;
+ gl_composite_2.verticalSpacing = 0;
+ gl_composite_2.horizontalSpacing = 1;
+ composite_2.setLayout(gl_composite_2);
+
+ Composite composite_3 = new Composite(composite_2, SWT.NONE);
+ composite_3.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, numColumns, 2));
+ GridLayout gl_composite_3 = new GridLayout(1, false);
+ gl_composite_3.marginHeight = 0;
+ gl_composite_3.marginWidth = 0;
+ gl_composite_3.verticalSpacing = 0;
+ gl_composite_3.horizontalSpacing = 1;
+ composite_3.setLayout(gl_composite_3);
+
+ if (getModifiers() != null && !getModifiers().isEmpty()) {
+ DataComboElement modifierCombo = new DataComboElement(composite_2, null, selectedState, getModifiers(), true, getStyle());
+ }
+ DataComboElement element = new DataComboElement(composite_2, String.valueOf(value), selectedState, getCategoricalValues(), false, getStyle());
+
+ if (stateList == null) {
+ stateList = new HashSet<>();
+ }
+ if (selectedState != null) {
+ stateList.add(selectedState);
+ }
+
+ Button btnRemove = new Button(composite_2, SWT.NONE);
+ btnRemove.setImage(ImageResources.getImage(ImageResources.TRASH_ICON));
+ //new Label(composite_2, SWT.NONE);
+ btnRemove.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ composite_2.dispose();
+ stateList.remove(selectedState);
+ valuesComposite.getShell().redraw();
+ valuesComposite.getShell().pack();
+ }
+ });
+
+ return element;
+ }
+}
\ No newline at end of file
package eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.categorical;
import java.util.Collection;
-import java.util.Iterator;
import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
import eu.etaxonomy.cdm.api.service.l10n.TermRepresentation_L10n;
+import eu.etaxonomy.cdm.persistence.dto.CategoricalDataDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
/**
@Override
public Object canonicalToDisplayValue(Object canonicalValue) {
- if(canonicalValue instanceof TermDto){
+ if(canonicalValue instanceof CategoricalDataDto){
+ return canonicalValue;
+ }
+ if (canonicalValue instanceof TermDto) {
((TermDto) canonicalValue).localize(new TermRepresentation_L10n());
return ((TermDto) canonicalValue).getTitleCache();
- }
- else if (canonicalValue instanceof Collection) {
+ } else if (canonicalValue instanceof Collection) {
// Collection.toString() will add [ and ] around
// the values in the Collection
// So by removing the leading and ending
// character, we remove the brackets
-
+
String result = canonicalValue.toString();
result = result.substring(1, result.length() - 1);
return result;
- }
- else if(canonicalValue!=null){
+ } else if (canonicalValue != null) {
return canonicalValue.toString();
}
return null;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.IFeedbackGenerator;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.dialog.configurator.StructuredAggregationConfigurationWizard;
Set<TaxonRowWrapperDTO> dtos = new HashSet<>();
DescriptiveDataSet dataSet = (DescriptiveDataSet) result.getCdmEntity();
for (UUID updatedObj: updatedObjects){
- TaxonRowWrapperDTO rowWrapper = CdmStore.getService(IDescriptiveDataSetService.class).createTaxonRowWrapper(updatedObj, matrix.getDescriptiveDataSet().getUuid());
+ TaxonRowWrapperDTO rowWrapper = CdmStore.getService(IDescriptiveDataSetService.class).createTaxonRowWrapper(updatedObj, matrix.getDescriptiveDataSet().getUuid(), PreferencesUtil.getGlobalLanguage());
boolean isRemoved = matrixPart.getMatrix().getDescriptions().remove(rowWrapper);
matrixPart.getMatrix().getDescriptions().add(rowWrapper);
}
import org.eclipse.jface.viewers.IStructuredSelection;
import eu.etaxonomy.cdm.api.service.IDescriptiveDataSetService;
-import eu.etaxonomy.cdm.api.service.dto.DescriptionBaseDto;
import eu.etaxonomy.cdm.model.description.DescriptionType;
-import eu.etaxonomy.cdm.model.description.TaxonDescription;
+import eu.etaxonomy.cdm.persistence.dto.DescriptionBaseDto;
import eu.etaxonomy.cdm.persistence.dto.DescriptiveDataSetBaseDto;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.CharacterMatrixPart;
import eu.etaxonomy.cdm.persistence.dto.DescriptiveDataSetBaseDto;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.CharacterMatrixPart;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.StoreUtil;
DescriptiveDataSetBaseDto descriptiveDataSet = matrixPart.getDescriptiveDataSet();
TaxonNodeDto node = (TaxonNodeDto) matrixPart.getSelection().getFirstElement();
TaxonRowWrapperDTO taxonRowWrapperDTO = CdmStore.getService(IDescriptiveDataSetService.class)
- .createTaxonDescription(descriptiveDataSet.getUuid(), node.getUuid(), getDescriptionType());
+ .createTaxonDescription(descriptiveDataSet.getUuid(), node.getUuid(), getDescriptionType(), PreferencesUtil.getGlobalLanguage());
// matrixPart.getMatrix().getCdmEntitySession().load(taxonRowWrapperDTO.getDescription(), true);
matrixPart.getMatrix().getDescriptions().add(taxonRowWrapperDTO);
matrixPart.getMatrix().layout();
import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.service.config.RemoveDescriptionsFromDescriptiveDataSetConfigurator;
-import eu.etaxonomy.cdm.api.service.dto.DescriptionBaseDto;
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
import eu.etaxonomy.cdm.api.service.dto.SpecimenRowWrapperDTO;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.persistence.dto.DescriptionBaseDto;
import eu.etaxonomy.cdm.persistence.dto.DescriptiveDataSetBaseDto;
import eu.etaxonomy.cdm.persistence.dto.SpecimenNodeWrapper;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import eu.etaxonomy.cdm.api.service.dto.QuantitativeDataDto;
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
+import eu.etaxonomy.cdm.persistence.dto.QuantitativeDataDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.CharacterMatrix;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
/**
* @author pplitzner
.collect(Collectors.toList());
measureToValueMap.put(statisticalMeasure, values);
}
- rowWrapperDTO.setDataValueForQuantitativeData(editorValue.getFeatureDto().getUuid(), measureToValueMap, composite.getEditorValue().getMeasurementUnit());
+ rowWrapperDTO.setDataValueForQuantitativeData(editorValue.getFeatureDto().getUuid(), measureToValueMap, composite.getEditorValue().getMeasurementUnit(), composite.getNoDataValue(), PreferencesUtil.getGlobalLanguage());
if (composite.getEditorValue().getMeasurementUnit() == null && (composite.getEditorValue().getFeatureDto().getRecommendedMeasurementUnits() != null && composite.getEditorValue().getFeatureDto().getRecommendedMeasurementUnits().size() == 1)){
editorValue.setMeasurementUnit(editorValue.getFeatureDto().getRecommendedMeasurementUnits().iterator().next());
}
// ((QuantitativeDataDto)rowWrapperDTO.getDataValueForFeature(editorValue.getFeatureDto().getUuid())).setMeasurementUnit(editorValue.getMeasurementUnit());
matrix.putRowToMerge(rowWrapperDTO);
+// DescriptionElementDto actualSelection = null;
+// if (rowWrapperDTO.getDataValueForFeature(editorValue.getFeatureDto().getUuid()).iterator().hasNext()) {
+// actualSelection = rowWrapperDTO.getDataValueForFeature(editorValue.getFeatureDto().getUuid()).iterator()
+// .next();
+// }
+//
+// matrix.setActualSelection(actualSelection);
matrix.setDirty();
}
return super.close();
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import eu.etaxonomy.cdm.api.service.dto.QuantitativeDataDto;
-import eu.etaxonomy.cdm.api.service.dto.StatisticalMeasurementValueDto;
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
+import eu.etaxonomy.cdm.persistence.dto.QuantitativeDataDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.DataDialogComposite;
import eu.etaxonomy.taxeditor.model.ImageResources;
/**
* @date 16.07.2018
*
*/
-public class QuantitativeDataDialogComposite extends Composite {
+public class QuantitativeDataDialogComposite extends DataDialogComposite {
private Map<TermDto, List<Text>> textFieldMap = new HashMap<>();
- QuantitativeDataDto editorValue;
Combo unitCombo;
+
Map<TermDto, Integer> unitMap = null;
TermDto exactValueDto = TermDto.fromTerm(StatisticalMeasure.EXACT_VALUE());
- public QuantitativeDataDialogComposite(Character initialInput, QuantitativeDataDto editorVal, Composite parent, int style) {
+
+
+ public QuantitativeDataDialogComposite(Character initialInput, QuantitativeDataDto editorVal, Composite parent,
+ int style) {
super(parent, style);
this.editorValue = editorVal;
- if (editorValue.getFeatureDto().getRecommendedMeasurementUnits() != null && editorValue.getFeatureDto().getRecommendedMeasurementUnits().size()>0){
+ if (editorValue.getFeatureDto().getRecommendedMeasurementUnits() != null
+ && editorValue.getFeatureDto().getRecommendedMeasurementUnits().size() > 0) {
unitMap = new HashMap<>();
- Integer i = editorValue.getFeatureDto().getRecommendedMeasurementUnits().size() -1;
- for (TermDto unit: editorValue.getFeatureDto().getRecommendedMeasurementUnits()){
+ Integer i = editorValue.getFeatureDto().getRecommendedMeasurementUnits().size() - 1;
+ for (TermDto unit : editorValue.getFeatureDto().getRecommendedMeasurementUnits()) {
unitMap.put(unit, i);
i--;
}
setLayout(new GridLayout(1, false));
+
+ createNoDataCombo(this);
+
+
+// Label lblNoDataLabel = new Label(this, SWT.NONE);
+// lblNoDataLabel.setText("No Data available");
+// lblNoDataLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+//
+// noDataCombo = new Combo(this, SWT.NONE | SWT.READ_ONLY);
+// noDataCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+// int index = 1;
+// noDataCombo.add("", 0);
+// for (NoDescriptiveDataStatus status : NoDescriptiveDataStatus.values()) {
+// noDataCombo.add(status.getLabel(), index);
+// noDataCombo.setData(status.getLabel(), status);
+// index++;
+//
+// }
+
+// noDataCombo.addSelectionListener(new SelectionAdapter() {
+//
+// @Override
+// public void widgetSelected(SelectionEvent e) {
+// String name = noDataCombo.getText();
+// editorValue.setNoDataStatus((NoDescriptiveDataStatus)noDataCombo.getData(name));
+// if (StringUtils.isNotBlank(name)) {
+// valuesComposite.setEnabled(false);
+// }else {
+// valuesComposite.setEnabled(true);
+// }
+// }
+//
+// });
+
ScrolledComposite scrolledComposite_1 = new ScrolledComposite(this, SWT.BORDER | SWT.V_SCROLL);
scrolledComposite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
scrolledComposite_1.setExpandHorizontal(true);
scrolledComposite_1.setExpandVertical(true);
-
- Composite valuesComposite = new Composite(scrolledComposite_1, SWT.NONE);
+ valuesComposite = new Composite(scrolledComposite_1, SWT.NONE);
GridLayout gl_valuesComposite = new GridLayout();
gl_valuesComposite.marginWidth = 0;
gl_valuesComposite.marginHeight = 0;
valuesComposite.setLayout(gl_valuesComposite);
- Composite composite_2 = new Composite(valuesComposite, SWT.NONE);
- composite_2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
- GridLayout gl_composite_2 = new GridLayout(2, false);
- gl_composite_2.marginHeight = 0;
- gl_composite_2.marginWidth = 0;
- gl_composite_2.verticalSpacing = 0;
- gl_composite_2.horizontalSpacing = 2;
- composite_2.setLayout(gl_composite_2);
-
- Label lblNewLabel = new Label(composite_2, SWT.NONE);
+ Label lblNewLabel = new Label(valuesComposite, SWT.NONE);
lblNewLabel.setText("Measurement Unit");
lblNewLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
- if (editorValue.getFeatureDto().getRecommendedMeasurementUnits() != null && editorValue.getFeatureDto().getRecommendedMeasurementUnits().size() == 1){
- Label lblUnit = new Label(composite_2, SWT.BORDER);
- lblUnit.setText(editorValue.getFeatureDto().getRecommendedMeasurementUnits().iterator().next().getIdInVocabulary());
+ if (editorValue.getFeatureDto().getRecommendedMeasurementUnits() != null
+ && editorValue.getFeatureDto().getRecommendedMeasurementUnits().size() == 1) {
+ Label lblUnit = new Label(valuesComposite, SWT.BORDER);
+ lblUnit.setText(
+ editorValue.getFeatureDto().getRecommendedMeasurementUnits().iterator().next().getIdInVocabulary());
lblUnit.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
- editorValue.setMeasurementUnit(editorValue.getFeatureDto().getRecommendedMeasurementUnits().iterator().next());
- }else if (editorValue.getFeatureDto().getRecommendedMeasurementUnits() != null && editorValue.getFeatureDto().getRecommendedMeasurementUnits().size() > 1){
- unitCombo = new Combo(composite_2, SWT.NONE | SWT.READ_ONLY);
+ ((QuantitativeDataDto)editorValue)
+ .setMeasurementUnit(editorValue.getFeatureDto().getRecommendedMeasurementUnits().iterator().next());
+ } else if (editorValue.getFeatureDto().getRecommendedMeasurementUnits() != null
+ && editorValue.getFeatureDto().getRecommendedMeasurementUnits().size() > 1) {
+ unitCombo = new Combo(valuesComposite, SWT.NONE | SWT.READ_ONLY);
unitCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
Set<Entry<TermDto, Integer>> entries = unitMap.entrySet();
TermDto[] terms = new TermDto[entries.size()];
- for (Entry<TermDto, Integer> unit: unitMap.entrySet()){
- if (unit.getValue() != null){
+ for (Entry<TermDto, Integer> unit : unitMap.entrySet()) {
+ if (unit.getValue() != null) {
terms[unit.getValue()] = unit.getKey();
}
}
int index = 0;
- for (TermDto term: terms){
+ for (TermDto term : terms) {
unitCombo.add(term.getTitleCache(), index);
unitCombo.setData(term.getTitleCache(), term);
- index ++;
+ index++;
}
- if (editorValue.getMeasurementUnit()!= null){
- unitCombo.select(unitMap.get(editorValue.getMeasurementUnit()));
- }else{
+ if (((QuantitativeDataDto)editorValue).getMeasurementUnit() != null) {
+ unitCombo.select(unitMap.get(((QuantitativeDataDto)editorValue).getMeasurementUnit()));
+ } else {
unitCombo.select(0);
String name = unitCombo.getText();
- editorValue.setMeasurementUnit((TermDto)unitCombo.getData(name));
+ ((QuantitativeDataDto)editorValue).setMeasurementUnit((TermDto) unitCombo.getData(name));
}
- unitCombo.addSelectionListener(new SelectionAdapter(){
+ unitCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String name = unitCombo.getText();
- editorValue.setMeasurementUnit((TermDto)unitCombo.getData(name));
+ ((QuantitativeDataDto)editorValue).setMeasurementUnit((TermDto) unitCombo.getData(name));
}
});
}
- //add empty text field for exact value
- Text emptyTextField = addText(valuesComposite, exactValueDto, initialInput==null?null:initialInput.toString());
+ // add empty text field for exact value
+ Text emptyTextField = addText(valuesComposite, exactValueDto,
+ initialInput == null ? null : initialInput.toString());
emptyTextField.setFocus();
emptyTextField.setSelection(emptyTextField.getText().length());
- //add existing exact values
- editorValue.getValues().stream()
- .filter(measure->measure.getType().getUuid().equals(StatisticalMeasure.EXACT_VALUE().getUuid()))
- .forEach(exact->addText(valuesComposite, exact.getType(), exact.getValue().toString()));
-
-//
-
-
- //add aggregation values
- if (editorValue.getFeatureDto().getRecommendedStatisticalMeasures() != null){
- List<TermDto> orderedStatisticalMeasures = new ArrayList<>();
- orderedStatisticalMeasures.addAll(editorValue.getFeatureDto().getRecommendedStatisticalMeasures());
- Collections.sort(orderedStatisticalMeasures, new Comparator<TermDto>() {
- @Override
- public int compare(TermDto o1, TermDto o2) {
- if (o1.getUuid().equals(o2.getUuid())){
- return 0;
- }
- if (o1.getUuid().equals(StatisticalMeasure.MIN().getUuid())){
- return -1;
- }
- if (o2.getUuid().equals(StatisticalMeasure.MIN().getUuid())){
- return 1;
- }
- if (o1.getUuid().equals(StatisticalMeasure.MAX().getUuid())){
- return 1;
- }
- if (o2.getUuid().equals(StatisticalMeasure.MAX().getUuid())){
- return -1;
- }
- if (o1.getUuid().equals(StatisticalMeasure.TYPICAL_LOWER_BOUNDARY().getUuid()) && o2.getUuid().equals(StatisticalMeasure.TYPICAL_UPPER_BOUNDARY().getUuid())){
- return -1;
- }
- if (o2.getUuid().equals(StatisticalMeasure.TYPICAL_LOWER_BOUNDARY().getUuid()) && o1.getUuid().equals(StatisticalMeasure.TYPICAL_UPPER_BOUNDARY().getUuid())){
- return -1;
- }
- return o1.compareTo(o2);
- }
- });
-
- orderedStatisticalMeasures
- .stream()
- .filter(sm->!sm.equals(exactValueDto))
- .forEach(measure->{
- BigDecimal specificStatisticalValue = editorValue.getSpecificStatisticalValue(measure.getUuid());
- addText(valuesComposite, measure, specificStatisticalValue!=null?specificStatisticalValue.toString():null);
- });
+ // add existing exact values
+ ((QuantitativeDataDto)editorValue).getValues().stream()
+ .filter(measure -> measure.getType().getUuid().equals(StatisticalMeasure.EXACT_VALUE().getUuid()))
+ .forEach(exact -> addText(valuesComposite, exact.getType(), exact.getValue().toString()));
+
+ //
+
+ // add aggregation values
+ if (editorValue.getFeatureDto().getRecommendedStatisticalMeasures() != null) {
+ List<TermDto> orderedStatisticalMeasures = new ArrayList<>();
+ orderedStatisticalMeasures.addAll(editorValue.getFeatureDto().getRecommendedStatisticalMeasures());
+ Collections.sort(orderedStatisticalMeasures, new Comparator<TermDto>() {
+ @Override
+ public int compare(TermDto o1, TermDto o2) {
+ if (o1.getUuid().equals(o2.getUuid())) {
+ return 0;
+ }
+ if (o1.getUuid().equals(StatisticalMeasure.MIN().getUuid())) {
+ return -1;
+ }
+ if (o2.getUuid().equals(StatisticalMeasure.MIN().getUuid())) {
+ return 1;
+ }
+ if (o1.getUuid().equals(StatisticalMeasure.MAX().getUuid())) {
+ return 1;
+ }
+ if (o2.getUuid().equals(StatisticalMeasure.MAX().getUuid())) {
+ return -1;
+ }
+ if (o1.getUuid().equals(StatisticalMeasure.TYPICAL_LOWER_BOUNDARY().getUuid())
+ && o2.getUuid().equals(StatisticalMeasure.TYPICAL_UPPER_BOUNDARY().getUuid())) {
+ return -1;
+ }
+ if (o2.getUuid().equals(StatisticalMeasure.TYPICAL_LOWER_BOUNDARY().getUuid())
+ && o1.getUuid().equals(StatisticalMeasure.TYPICAL_UPPER_BOUNDARY().getUuid())) {
+ return -1;
+ }
+ return o1.compareTo(o2);
+ }
+ });
+
+ orderedStatisticalMeasures.stream().filter(sm -> !sm.equals(exactValueDto)).forEach(measure -> {
+ BigDecimal specificStatisticalValue = ((QuantitativeDataDto)editorValue).getSpecificStatisticalValue(measure.getUuid());
+ addText(valuesComposite, measure,
+ specificStatisticalValue != null ? specificStatisticalValue.toString() : null);
+ });
}
scrolledComposite_1.setContent(valuesComposite);
scrolledComposite_1.setMinSize(valuesComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-// if(initialInput!=null){
- boolean hasExactValues = textFieldMap.entrySet().stream()
- .filter(entry->entry.getKey().equals(exactValueDto))
- .anyMatch(exactEntry->exactEntry.getValue().stream().anyMatch(exactText->CdmUtils.isNotBlank(exactText.getText()))
- );
-
- boolean hasAggregatedValues = textFieldMap.entrySet().stream()
- .filter(entry->!entry.getKey().equals(exactValueDto))
- .anyMatch(exactEntry->exactEntry.getValue().stream().anyMatch(exactText->CdmUtils.isNotBlank(exactText.getText()))
- );
- enableAggregationFields(hasExactValues, hasAggregatedValues);
-// }
+ // if(initialInput!=null){
+ boolean hasExactValues = textFieldMap.entrySet().stream().filter(entry -> entry.getKey().equals(exactValueDto))
+ .anyMatch(exactEntry -> exactEntry.getValue().stream()
+ .anyMatch(exactText -> CdmUtils.isNotBlank(exactText.getText())));
+
+ boolean hasAggregatedValues = textFieldMap.entrySet().stream()
+ .filter(entry -> !entry.getKey().equals(exactValueDto)).anyMatch(exactEntry -> exactEntry.getValue()
+ .stream().anyMatch(exactText -> CdmUtils.isNotBlank(exactText.getText())));
+ enableAggregationFields(hasExactValues, hasAggregatedValues);
+ // }
}
- private Text addText(Composite valuesComposite, TermDto type, String value){
+ private Text addText(Composite valuesComposite, TermDto type, String value) {
Composite composite_2 = new Composite(valuesComposite, SWT.NONE);
composite_2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
GridLayout gl_composite_2 = new GridLayout(4, false);
GridData gd_text = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
gd_text.widthHint = 15;
text.setLayoutData(gd_text);
- if(value!=null){
+ if (value != null) {
text.setText(value);
}
List<Text> list = textFieldMap.get(type);
- if(list==null){
+ if (list == null) {
list = new ArrayList<>();
}
textFieldMap.put(type, list);
public void widgetSelected(SelectionEvent e) {
text.setText("");
boolean hasExactValues = textFieldMap.entrySet().stream()
- .filter(entry->entry.getKey().equals(exactValueDto))
- .anyMatch(exactEntry->exactEntry.getValue().stream().anyMatch(exactText->CdmUtils.isNotBlank(exactText.getText()))
- );
-
+ .filter(entry -> entry.getKey().equals(exactValueDto)).anyMatch(exactEntry -> exactEntry
+ .getValue().stream().anyMatch(exactText -> CdmUtils.isNotBlank(exactText.getText())));
+
boolean hasAggregatedValues = textFieldMap.entrySet().stream()
- .filter(entry->!entry.getKey().equals(exactValueDto))
- .anyMatch(exactEntry->exactEntry.getValue().stream().anyMatch(exactText->CdmUtils.isNotBlank(exactText.getText()))
- );
+ .filter(entry -> !entry.getKey().equals(exactValueDto)).anyMatch(exactEntry -> exactEntry
+ .getValue().stream().anyMatch(exactText -> CdmUtils.isNotBlank(exactText.getText())));
enableAggregationFields(hasExactValues, hasAggregatedValues);
}
});
- text.addModifyListener(e->{
+ text.addModifyListener(e -> {
boolean hasExactValues = textFieldMap.entrySet().stream()
- .filter(entry->entry.getKey().equals(exactValueDto))
- .anyMatch(exactEntry->exactEntry.getValue().stream().anyMatch(exactText->CdmUtils.isNotBlank(exactText.getText()))
- );
-
+ .filter(entry -> entry.getKey().equals(exactValueDto)).anyMatch(exactEntry -> exactEntry.getValue()
+ .stream().anyMatch(exactText -> CdmUtils.isNotBlank(exactText.getText())));
+
boolean hasAggregatedValues = textFieldMap.entrySet().stream()
- .filter(entry->!entry.getKey().equals(exactValueDto))
- .anyMatch(exactEntry->exactEntry.getValue().stream().anyMatch(exactText->CdmUtils.isNotBlank(exactText.getText()))
- );
+ .filter(entry -> !entry.getKey().equals(exactValueDto)).anyMatch(exactEntry -> exactEntry.getValue()
+ .stream().anyMatch(exactText -> CdmUtils.isNotBlank(exactText.getText())));
enableAggregationFields(hasExactValues, hasAggregatedValues);
-// if(hasExactValues){
-// enableAggregationFields(false);
-// }
-// else{
-// enableAggregationFields(true);
-// }
+ // if(hasExactValues){
+ // enableAggregationFields(false);
+ // }
+ // else{
+ // enableAggregationFields(true);
+ // }
});
return text;
}
- private void enableAggregationFields(boolean hasExactValues, boolean hasAggregatedValues){
- boolean enableAggregatedValues = hasAggregatedValues ==( hasAggregatedValues != hasExactValues);
- textFieldMap.entrySet().stream()
- .filter(entry->!entry.getKey().equals(exactValueDto))
- .forEach(aggEntry->aggEntry.getValue().forEach(aggText->aggText.setEnabled(enableAggregatedValues)));
- boolean enableExactValues = hasExactValues ==( hasAggregatedValues != hasExactValues);
- textFieldMap.entrySet().stream()
- .filter(entry->entry.getKey().equals(exactValueDto))
- .forEach(aggEntry->aggEntry.getValue().forEach(aggText->aggText.setEnabled(enableExactValues)));
+ private void enableAggregationFields(boolean hasExactValues, boolean hasAggregatedValues) {
+ boolean enableAggregatedValues = hasAggregatedValues == (hasAggregatedValues != hasExactValues);
+ textFieldMap.entrySet().stream().filter(entry -> !entry.getKey().equals(exactValueDto)).forEach(
+ aggEntry -> aggEntry.getValue().forEach(aggText -> aggText.setEnabled(enableAggregatedValues)));
+ boolean enableExactValues = hasExactValues == (hasAggregatedValues != hasExactValues);
+ textFieldMap.entrySet().stream().filter(entry -> entry.getKey().equals(exactValueDto))
+ .forEach(aggEntry -> aggEntry.getValue().forEach(aggText -> aggText.setEnabled(enableExactValues)));
}
public Map<TermDto, List<Text>> getTextFields() {
}
public QuantitativeDataDto getEditorValue() {
- return editorValue;
+ return ((QuantitativeDataDto)editorValue);
}
-
+
+
}
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import eu.etaxonomy.cdm.api.service.dto.DescriptionElementDto;
-import eu.etaxonomy.cdm.api.service.dto.QuantitativeDataDto;
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
+import eu.etaxonomy.cdm.persistence.dto.DescriptionElementDto;
import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
+import eu.etaxonomy.cdm.persistence.dto.QuantitativeDataDto;
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.CharacterMatrix;
/**
this.initialInput = null;
Object rowObject = matrix.getBodyDataProvider().getRowObject(cell.getRowIndex());
FeatureDto feature = matrix.getIndexToFeatureMap().get(cell.getColumnIndex());
+
QuantitativeDataDto quantitativeData = null;
if(rowObject instanceof RowWrapperDTO){
rowWrapperDTO = (RowWrapperDTO<?>) rowObject;
import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
-import eu.etaxonomy.cdm.api.service.dto.QuantitativeDataDto;
+import eu.etaxonomy.cdm.persistence.dto.QuantitativeDataDto;
+
/**
* Converts QuantitativeData of one cell of the character matrix to a String.
import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
-import eu.etaxonomy.cdm.api.service.dto.DescriptionBaseDto;
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
import eu.etaxonomy.cdm.model.occurrence.GatheringEvent;
+import eu.etaxonomy.cdm.persistence.dto.DescriptionBaseDto;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
/**
import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.api.service.INameService;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
import eu.etaxonomy.taxeditor.editor.ChooseFromMultipleAcceptedTaxaDialog;
import eu.etaxonomy.taxeditor.editor.ChooseFromMultipleTaxonNodesDialog;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.DataChangeBridge;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
* @author pplitzner
* @date Aug 24, 2017
*/
-public class TaxonEditorInputE4 extends CdmEntitySessionInput<TaxonNode>
- implements IConversationEnabled {
+public class TaxonEditorInput extends CdmEntitySessionInput<TaxonNode>{
private static final String INCORRECT_STATE = Messages.TaxonEditorInput_INCORRECT_STATE;
- private final ConversationHolder conversation;
-
private TaxonNode taxonNode;
private Map<TaxonBase, TaxonBaseDeletionConfigurator> toDeletes = new HashMap<>();
private Set<AbstractPostOperation> operations = new HashSet<>();
- private TaxonEditorInputDataChangeBehaviourE4 dataChangeBehavior;
+// private TaxonEditorInputDataChangeBehaviourE4 dataChangeBehavior;
private TaxonBase<?> initiallySelectedTaxonBase;
PARENT_TAXON_NODE
}
- private TaxonEditorInputE4(UUID uuid, CdmType type) {
+ private TaxonEditorInput(UUID uuid, CdmType type) {
super(true);
- this.conversation = CdmStore.createConversation();
- switch(type) {
+ switch(type) {
case PARENT_TAXON_NODE:
initForParentTaxonNode(uuid);
break;
case TAXON_NODE:
initForTaxonNode(uuid);
break;
+ default:
+ throw new RuntimeException("Type not supported yet for TaxonEditorInput: " + type);
}
}
TaxonNode taxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNodeUuid, getTaxonNodePropertyPaths());
// TaxonNode taxonNode = getCdmEntitySession().remoteLoad(CdmStore.getService(ITaxonNodeService.class), taxonNodeUuid, getTaxonNodePropertyPaths());
if(taxonNode == null){
- MessagingUtils.warningDialog(Messages.TaxonEditorInput_NOT_IMPLEMENTED, TaxonEditorInputE4.class, Messages.TaxonEditorInput_NOT_IMPLEMENTED_MESSAGE);
+ MessagingUtils.warningDialog(Messages.TaxonEditorInput_NOT_IMPLEMENTED, TaxonEditorInput.class, Messages.TaxonEditorInput_NOT_IMPLEMENTED_MESSAGE);
}
init(taxonNode);
setInitiallySelectedTaxonBase(getTaxon());
-
}
private void initForTaxonBase(UUID taxonBaseUuid) {
if (taxon.getTaxonNodes().size() > 0){
acceptedTaxa.add(taxon);
}
- setInputForRelatedTaxa(conversation, acceptedTaxa);
+ setInputForRelatedTaxa(acceptedTaxa);
}else{
- setInputForMultipleNodes(conversation, taxon.getTaxonNodes());
+ setInputForMultipleNodes(taxon.getTaxonNodes());
}
}else if(taxonBase instanceof Synonym){
Synonym synonym = (Synonym) taxonBase;
if (taxon != null){
taxa.add(taxon);
}
- setInputForMultipleTaxa(conversation, taxa);
+ setInputForMultipleTaxa(taxa);
setInitiallySelectedTaxonBase(synonym);
}
}
}
-
private void initForParentTaxonNode(UUID parentNodeUuid){
this.getCdmEntitySession().bind();
TaxonName name = PreferencesUtil.getPreferredNomenclaturalCode().getNewTaxonNameInstance(null);
initForTaxonNode(newTaxonNodeUuid);
}
- private void setInputForMultipleNodes(ConversationHolder conversation, Set<TaxonNode> taxonNodes){
+ private void setInputForMultipleNodes(Set<TaxonNode> taxonNodes){
if(taxonNodes.size() == 1){
TaxonNode taxonNode = taxonNodes.iterator().next();
taxonNode = getCdmEntitySession().remoteLoad(CdmStore.getService(ITaxonNodeService.class), taxonNode.getUuid(), getTaxonNodePropertyPaths());
}
} else if (taxonNodes.size() == 0) {
// this is an undesired state
- MessagingUtils.warningDialog(INCORRECT_STATE,TaxonEditorInputE4.class,Messages.TaxonEditorInput_TAXON_NOT_IN_CLASSIFICATION);
+ MessagingUtils.warningDialog(INCORRECT_STATE,TaxonEditorInput.class,Messages.TaxonEditorInput_TAXON_NOT_IN_CLASSIFICATION);
}
}
- private void setInputForMultipleTaxa(ConversationHolder conversation, Set<Taxon> taxa){
+ private void setInputForMultipleTaxa(Set<Taxon> taxa){
if(taxa.size() == 1){
Taxon taxon = taxa.iterator().next();
Set<TaxonNode> nodes = taxon.getTaxonNodes();
- setInputForMultipleNodes(conversation, nodes);
+ setInputForMultipleNodes(nodes);
}else if(taxa.size() > 1){
Set<TaxonNode> taxonNodes = new HashSet<TaxonNode>();
for ( Taxon taxon : taxa ){
taxonNodes.addAll(taxon.getTaxonNodes());
}
- setInputForMultipleNodes(conversation, taxonNodes);
+ setInputForMultipleNodes(taxonNodes);
}else if(taxa.size() == 0){
// this is an undesired state
- MessagingUtils.warningDialog(INCORRECT_STATE, TaxonEditorInputE4.class, Messages.TaxonEditorInput_NO_ACCEPTED_TAXON_PRESENT);
+ MessagingUtils.warningDialog(INCORRECT_STATE, TaxonEditorInput.class, Messages.TaxonEditorInput_NO_ACCEPTED_TAXON_PRESENT);
}
}
- private void setInputForRelatedTaxa(ConversationHolder conversation, Set<Taxon> taxa){
+ private void setInputForRelatedTaxa(Set<Taxon> taxa){
if(taxa.size() == 1){
Taxon taxon = taxa.iterator().next();
Set<TaxonNode> nodes = taxon.getTaxonNodes();
}else if (nodes.size()==1){
taxonNode = nodes.iterator().next();
}else{
- MessagingUtils.warningDialog(INCORRECT_STATE,TaxonEditorInputE4.class,Messages.TaxonEditorInput_TAXON_NOT_IN_CLASSIFICATION);
+ MessagingUtils.warningDialog(INCORRECT_STATE,TaxonEditorInput.class,Messages.TaxonEditorInput_TAXON_NOT_IN_CLASSIFICATION);
}
init(taxonNode);
}else if(taxa.size() > 1){
}
} else if (taxa.size() == 0) {
// this is an undesired state
- MessagingUtils.warningDialog(INCORRECT_STATE,TaxonEditorInputE4.class,Messages.TaxonEditorInput_TAXON_NOT_IN_CLASSIFICATION);
+ MessagingUtils.warningDialog(INCORRECT_STATE,TaxonEditorInput.class,Messages.TaxonEditorInput_TAXON_NOT_IN_CLASSIFICATION);
}
}
- public static TaxonEditorInputE4 NewInstance(UUID taxonNodeUuid) {
- return new TaxonEditorInputE4(taxonNodeUuid, CdmType.TAXON_NODE);
-
+ public static TaxonEditorInput NewInstance(UUID taxonNodeUuid) {
+ return new TaxonEditorInput(taxonNodeUuid, CdmType.TAXON_NODE);
}
- public static TaxonEditorInputE4 NewInstanceFromTaxonBase(UUID taxonBaseUuid){
- return new TaxonEditorInputE4(taxonBaseUuid, CdmType.TAXON_BASE);
+ public static TaxonEditorInput NewInstanceFromTaxonBase(UUID taxonBaseUuid){
+ return new TaxonEditorInput(taxonBaseUuid, CdmType.TAXON_BASE);
}
- public static TaxonEditorInputE4 NewEmptyInstance(UUID parentNodeUuid){
- return new TaxonEditorInputE4(parentNodeUuid, CdmType.PARENT_TAXON_NODE);
+ public static TaxonEditorInput NewEmptyInstance(UUID parentNodeUuid){
+ return new TaxonEditorInput(parentNodeUuid, CdmType.PARENT_TAXON_NODE);
}
public Object getAdapter(Class adapter) {
*/
@Override
public boolean equals(Object obj) {
- if (TaxonEditorInputE4.class.equals(obj.getClass())
+ if (TaxonEditorInput.class.equals(obj.getClass())
&& getTaxon() != null
- && getTaxon().equals(((TaxonEditorInputE4) obj).getTaxon())) {
- if (((TaxonEditorInputE4) obj).getInitiallySelectedTaxonBase() != null){
- setInitiallySelectedTaxonBase(((TaxonEditorInputE4) obj).getInitiallySelectedTaxonBase());
+ && getTaxon().equals(((TaxonEditorInput) obj).getTaxon())) {
+ if (((TaxonEditorInput) obj).getInitiallySelectedTaxonBase() != null){
+ setInitiallySelectedTaxonBase(((TaxonEditorInput) obj).getInitiallySelectedTaxonBase());
}
return true;
}
public Taxon getTaxon(){
if(taxonNode!=null){
- Taxon taxon = CdmBase.deproxy(taxonNode.getTaxon(), Taxon.class);
+ Taxon taxon = CdmBase.deproxy(taxonNode.getTaxon());
return taxon;
}
return null;
return taxonNode;
}
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
- @Override
- public void update(CdmDataChangeMap events) {
- if(dataChangeBehavior == null){
- dataChangeBehavior = new TaxonEditorInputDataChangeBehaviourE4(this);
- }
-
- DataChangeBridge.handleDataChange(events, dataChangeBehavior);
- }
-
public void setInitiallySelectedTaxonBase(TaxonBase taxonBase) {
this.initiallySelectedTaxonBase = taxonBase;
}
}
}
}
-// for (TaxonName name:toSaveNewNames){
-// name.get
-// }
+
if (!toSaveNewNames.isEmpty()){
List<TaxonName> listNames = new ArrayList(toSaveNewNames);
+++ /dev/null
-/**
-* 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.editor.e4;
-
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour;
-
-/**
- * @author pplitzner
- * @date Aug 24, 2017
- */
-public class TaxonEditorInputDataChangeBehaviourE4 extends
- AbstractDataChangeBehaviour {
-
- private TaxonEditorInputE4 source;
-
- public TaxonEditorInputDataChangeBehaviourE4(TaxonEditorInputE4 taxonEditorInput) {
- source = taxonEditorInput;
- }
-
- @Override
- public void reactOnDataChange(CdmDataChangeMap events) {
- source.update(events);
-
- }
-}
import java.util.UUID;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IGroupService;
import eu.etaxonomy.cdm.model.permission.Group;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @created Mar 28, 2013
*/
public class CdmAuthorityEditorInput
- extends CdmEntitySessionInput<Group>
- implements IConversationEnabled {
+ extends CdmEntitySessionInput<Group> {
- private ConversationHolder conversation;
private Group group;
- protected CdmAuthorityEditorInput(ConversationHolder conversation, Group group) {
+ protected CdmAuthorityEditorInput(Group group) {
super(true);
- this.conversation = conversation;
this.group = CdmApplicationState.getCurrentAppConfig().getGroupService().load(group.getUuid());
}
* @throws Exception
*/
public static CdmAuthorityEditorInput NewInstance(UUID groupUuid) throws Exception{
- ConversationHolder conversation = CdmStore.createConversation();
Group group = CdmStore.getService(IGroupService.class).load(groupUuid, null);
- return new CdmAuthorityEditorInput(conversation, group);
+ return new CdmAuthorityEditorInput( group);
}
public Object getAdapter(Class adapter) {
return null;
}
- @Override
- public void update(CdmDataChangeMap changeEvents) {
- // TODO Auto-generated method stub
- }
-
- @Override
- public ConversationHolder getConversationHolder() {
- return this.conversation;
- }
-
public String getName() {
return group.getName();
}
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.permission.Group;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditorInput;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
*
* @author cmathew
* @created Mar 28, 2013
- *
*/
-public class CdmAuthorityEditorE4 implements IConversationEnabled, IDirtyMarkable {
+public class CdmAuthorityEditorE4 implements IDirtyMarkable {
public static final String ID = "eu.etaxonomy.taxeditor.editor.group.authority"; //$NON-NLS-1$
@Inject
private MDirtyable dirty;
- private ConversationHolder conversation;
private CdmAuthorityCompositeViewer viewer;
private CdmAuthorityEditorInput input;
@Inject
public CdmAuthorityEditorE4() {
-
}
/**
* Create contents of the editor part.
- * @param parent
*/
@PostConstruct
public void createPartControl(Composite parent) {
container = new Composite(parent, SWT.NONE);
container.setLayout(new FillLayout(SWT.HORIZONTAL));
-
}
@Focus
public void doSave(IProgressMonitor monitor) {
try {
monitor.beginTask(Messages.CdmAuthorityEditor_SAVING_AUTHORITY_EDITOR, 1);
- getConversationHolder().commit(true);
input.merge();
dirty.setDirty(false);
monitor.worked(1);
public void init(CdmAuthorityEditorInput input) {
this.input = input;
-
- conversation = input.getConversationHolder();
-
this.viewer = new CdmAuthorityCompositeViewer(container, this,input.getGroup());
thisPart.setLabel(input.getName());
return input;
}
- @Override
- public void update(CdmDataChangeMap changeEvents) {
- }
-
@Override
public void changed(Object element) {
//FIXME : should be optimised to split changes into adding / removing authorities
//FIXME E4 migrate/delete
// getSite().getPage().activate(this);
}
-
}
@Override
changed(null);
}
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
@PreDestroy
public void dispose() {
- if(conversation!=null){
- conversation.unregisterForDataStoreChanges(this);
- conversation.close();
- conversation = null;
- }
if(input!=null){
input.getCdmEntitySession().dispose();
}
@Override
protected String getPartId() {
- return AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_TAXONNAMEEDITORE4;
+ return AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_TAXONEDITOR;
}
}
\ No newline at end of file
@Override
protected String getPartId() {
- return AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_TAXONNAMEEDITORE4;
+ return AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_TAXONEDITOR;
}
}
\ No newline at end of file
*/
package eu.etaxonomy.taxeditor.editor.key;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.description.IIdentificationKey;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
/**
* @author n.hoffmann
*/
public abstract class AbstractIdentificationEditorInput<T extends IIdentificationKey>
- extends CdmEntitySessionInput implements IConversationEnabled {
+ extends CdmEntitySessionInput {
- private final ConversationHolder conversation;
-
- protected AbstractIdentificationEditorInput(ConversationHolder conversation) {
+ protected AbstractIdentificationEditorInput() {
super(true);
- this.conversation = conversation;
- }
-
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
}
+
public abstract T getKey();
- @Override
- public void update(CdmDataChangeMap changeEvents) {
- }
-
@Override
public boolean equals(Object obj) {
// TODO Auto-generated method stub
/**
- *
- */
+* 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.editor.key.e4;
import javax.inject.Inject;
import org.eclipse.zest.layouts.LayoutStyles;
import org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.description.IIdentificationKey;
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
/**
- *
* @author pplitzner
* @since Sep 28, 2017
*
* @param <T>
*/
-public abstract class AbstractGraphKeyEditorE4<T extends IIdentificationKey>
-implements IConversationEnabled, IE4SavablePart,
- IZoomableWorkbenchPart, IPostOperationEnabled,
+public abstract class AbstractGraphKeyEditor<T extends IIdentificationKey>
+implements IE4SavablePart, IZoomableWorkbenchPart, IPostOperationEnabled,
IDirtyMarkable {
protected CdmFormFactory formFactory;
@Override
@Persist
public void save(IProgressMonitor monitor) {
- getConversationHolder().commit(true);
setDirty(false);
viewer.refresh();
}
viewer.refresh();
}
- @Override
- public void update(CdmDataChangeMap changeEvents) {
-
- }
-
@Override
public AbstractZoomableViewer getZoomableViewer() {
return viewer;
+++ /dev/null
-/**
-* 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.editor.key.e4;
-
-import java.util.Vector;
-
-import eu.etaxonomy.cdm.model.description.PolytomousKey;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
-import eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4;
-import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour;
-
-/**
- * @author n.hoffmann
- * @created May 5, 2011
- */
-public class KeyEditorDataChangeBehaviourE4 extends AbstractDataChangeBehaviour {
-
- private final PolytomousKeyListEditorE4 source;
- private PolytomousKeyEditorInput input;
-
- public KeyEditorDataChangeBehaviourE4(PolytomousKeyListEditorE4 keyEditor) {
- source = keyEditor;
- }
-
- @Override
- public void reactOnDataChange(CdmDataChangeMap changeEvents) {
- input = source.getEditorInput();
-
- if(changeEvents.sizeByEventType(EventType.UPDATE) > 0){
- reactOnUpdate(changeEvents.getEvents(EventType.UPDATE));
- }
- }
-
- @Override
- public void reactOnUpdate(Vector<CdmDataChangeEvent> events){
-
- for(CdmDataChangeEvent event : events){
-
- // update editor title
- if(event.getEntity() instanceof PolytomousKey){
- if(input.getKey().equals(event.getEntity())){
- // set the name of the editor window
- source.setPartName();
- }
- }
- }
- }
-}
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.services.IServiceConstants;
-import eu.etaxonomy.taxeditor.editor.key.e4.AbstractGraphKeyEditorE4;
+import eu.etaxonomy.taxeditor.editor.key.e4.AbstractGraphKeyEditor;
/**
* @author n.hoffmann
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
- AbstractGraphKeyEditorE4 graphKeyEditorE4 = (AbstractGraphKeyEditorE4) activePart.getObject();
+ AbstractGraphKeyEditor graphKeyEditorE4 = (AbstractGraphKeyEditor) activePart.getObject();
graphKeyEditorE4.applyLayout();
}
import java.util.Map;
import java.util.UUID;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.taxeditor.editor.key.AbstractIdentificationEditorInput;
private PolytomousKey key;
- protected PolytomousKeyEditorInput(ConversationHolder conversation,
- UUID polytomousKeyUuid) {
- super(conversation);
+ protected PolytomousKeyEditorInput(UUID polytomousKeyUuid) {
+ super();
List<String> propertyPath = new ArrayList<>();
propertyPath.add("root");
propertyPath.add("root.*");
public static PolytomousKeyEditorInput NewInstance(UUID polytomousKeyUuid) throws Exception{
try{
- ConversationHolder conversation = CdmStore.createConversation();
- return new PolytomousKeyEditorInput(conversation, polytomousKeyUuid);
+ return new PolytomousKeyEditorInput( polytomousKeyUuid);
}catch(Exception e){
throw e;
}
/**
+ * 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.editor.key.polytomous.e4;
import org.eclipse.zest.core.viewers.GraphViewer;
import org.eclipse.zest.core.widgets.ZestStyles;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
-import eu.etaxonomy.taxeditor.editor.key.e4.AbstractGraphKeyEditorE4;
+import eu.etaxonomy.taxeditor.editor.key.e4.AbstractGraphKeyEditor;
import eu.etaxonomy.taxeditor.editor.key.polytomous.IPolytomousKeyEditorPage;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyGraphContentProvider;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyLabelProvider;
/**
* @author n.hoffmann
- *
*/
-public class PolytomousKeyGraphEditorE4 extends
- AbstractGraphKeyEditorE4<PolytomousKey> implements
- IPolytomousKeyEditorPage, IPartContentHasDetails {
+public class PolytomousKeyGraphEditorE4
+ extends AbstractGraphKeyEditor<PolytomousKey>
+ implements IPolytomousKeyEditorPage, IPartContentHasDetails {
public static final String ID = "eu.etaxonomy.taxeditor.editor.key.polytomous.graph"; //$NON-NLS-1$
});
}
- @Override
- public ConversationHolder getConversationHolder() {
- return getEditorInput()
- .getConversationHolder();
- }
@Override
public PolytomousKey getKey() {
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
-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.description.PolytomousKey;
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.key.e4.KeyEditorDataChangeBehaviourE4;
import eu.etaxonomy.taxeditor.editor.key.polytomous.IPolytomousKeyEditorPage;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListContentProvider;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListLabelProvider;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.model.DataChangeBridge;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
* @since Sep 28, 2017
*/
public class PolytomousKeyListEditorE4 implements
- IConversationEnabled, IDirtyMarkable, IPartContentHasDetails, IPartContentHasSupplementalData,
+ IDirtyMarkable, IPartContentHasDetails, IPartContentHasSupplementalData,
IPolytomousKeyEditorPage, IE4SavablePart{
private class LinkListener extends MouseAdapter {
private TableViewer viewer;
- private KeyEditorDataChangeBehaviourE4 dataChangeBehavior;
-
- private PolytomousKeyEditorInput input;
+ private PolytomousKeyEditorInput input;
@Inject
private ESelectionService selService;
@Inject
public PolytomousKeyListEditorE4() {
}
-
- @Override
- public void update(CdmDataChangeMap map) {
- if(dataChangeBehavior == null){
- dataChangeBehavior = new KeyEditorDataChangeBehaviourE4(this);
- }
- DataChangeBridge.handleDataChange(map, dataChangeBehavior);
- }
-
- @Override
- public ConversationHolder getConversationHolder() {
- return input.getConversationHolder();
- }
-
+
@Override
@Persist
public void save(IProgressMonitor monitor) {
try {
monitor.beginTask(Messages.KeyEditor_SAVING, 1);
- getConversationHolder().bind();
- getConversationHolder().commit(true);
input.merge();
dirty.setDirty(false);
monitor.worked(1);
public void dispose() {
if(input!=null){
input.dispose();
- input.getConversationHolder().close();
}
}
DeleteTaxonBaseHandler_CONFIRM_DELETION=Confirm Deletion
DeleteTaxonBaseHandler_ELEMENT_MUST_BE_SYNONYM_MISAPP_CONCEPT=Element has to be Synonym, Misapplication or Concept
DeleteTaxonBaseHandler_REALLY_DELETE_TAXON=Are you sure you want to delete the selected taxon?
-DeleteTaxonBaseHandler_REALLY_DELETE_SYNONYM=Are you sure you want to delete the selected synoym?
-DeleteTaxonBaseHandler_DELETE_SYNONYM_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS=The Synonym could be deleted, but related object(s) could not be deleted
-DeleteTaxonBaseHandler_DELETE_MISAPPLIEDNAME_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS=The misapplied name could be deleted, but related object(s) could not be deleted
+DeleteTaxonBaseHandler_REALLY_DELETE_SYNONYM=Are you sure you want to delete the selected synonym?
+DeleteTaxonBaseHandler_DELETE_SYNONYM_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS=The synonym could be deleted but related object(s) could not be deleted
+DeleteTaxonBaseHandler_DELETE_MISAPPLIEDNAME_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS=The misapplied name could be deleted but related object(s) could not be deleted
DeleteTaxonBaseHandler_REALLY_DELETE_MISAPPLICATION=Are you sure you want to delete the selected misapplication, this is irreversible?
DescriptionElementDropAdapter_MOVE_DESC=Move Descriptions
DescriptionElementDropAdapter_NOT_SUPPORTED=Operation not supported yet
SpecimenSelectionDialog_REMOVE_FILTER=Remove filter
TaxonEditorInput_INCORRECT_STATE=Incorrect state
TaxonEditorInput_NEW_TAXON=New taxon
-TaxonEditorInput_NO_ACCEPTED_TAXON_PRESENT=Trying to open accepted taxon for a synonym or misapplication but misapplication but the accepted taxon is not present in any classification and can\u2019t be opened in taxon editor.
+TaxonEditorInput_NO_ACCEPTED_TAXON_PRESENT=Trying to open accepted taxon for a synonym or misapplication but the accepted taxon is not present in any classification and can\u2019t be opened in taxon editor.
TaxonEditorInput_NOT_IMPLEMENTED=Not yet implemented
TaxonEditorInput_NOT_IMPLEMENTED_MESSAGE=Selected Taxonnode does not exist, probably it is deleted or moved.
TaxonEditorInput_OPEN_MISSAPPLIED_NAME=trying to open Mispplied Name
FactualDataView_Lable=Factual Data
NameFactsDataView_Lable=Name Facts
TaxaFactsDataView_Lable=Taxon Facts
-OccurrenceFactsDataView_Lable=Name Facts
+OccurrenceFactsDataView_Lable=Specimen Facts
DeleteDescriptiveDatasetHandler_Exception_Message=Descriptive Dataset could not be deleted.
DeleteDescriptiveDatasetHandler_Warning_Message=Deletion was successful but with warnings.
ChangeSynonymToAcceptedHandler_Select_Sec_Reference_Handling_title=Select secundum reference
* @date Aug 24, 2017
*
*/
-public interface IDropTargetableE4 extends IPostOperationEnabled {
+public interface IDropTargetable extends IPostOperationEnabled {
public Composite getControl();
- public TaxonNameEditorE4 getEditor();
+ public TaxonEditor getEditor();
public void dragEntered();
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.CdmDataTransfer;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.ISecuredEditor;
import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
-import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInput;
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupE4;
-import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupedContainerE4;
-import eu.etaxonomy.taxeditor.editor.name.e4.container.AcceptedGroupE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroup;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupedContainer;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.AcceptedGroup;
import eu.etaxonomy.taxeditor.editor.name.e4.container.AcceptedNameContainerE4;
-import eu.etaxonomy.taxeditor.editor.name.e4.container.ConceptContainerE4;
-import eu.etaxonomy.taxeditor.editor.name.e4.container.ContainerFactoryE4;
-import eu.etaxonomy.taxeditor.editor.name.e4.container.HomotypicalSynonymGroupE4;
-import eu.etaxonomy.taxeditor.editor.name.e4.container.MisappliedGroupE4;
-import eu.etaxonomy.taxeditor.editor.name.e4.dnd.NameEditorDropTargetListenerE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.ConceptContainer;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.ContainerFactory;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.HomotypicalSynonymGroup;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.MisappliedGroup;
+import eu.etaxonomy.taxeditor.editor.name.e4.dnd.NameEditorDropTargetListener;
import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
* @author pplitzner
* @date Aug 24, 2017
*/
-public class TaxonNameEditorE4 implements IConversationEnabled, IDirtyMarkable, IPartContentHasDetails,
- IPartContentHasSupplementalData, IPartContentHasMedia, IPartContentHasFactualData, IPartChangeListener,
- ISelectionListener, ISecuredEditor, IE4SavablePart, ITaxonEditor, IDropTargetableE4 {
+public class TaxonEditor
+ implements IDirtyMarkable, IPartContentHasDetails,
+ IPartContentHasSupplementalData, IPartContentHasMedia, IPartContentHasFactualData, IPartChangeListener,
+ ISelectionListener, ISecuredEditor, IE4SavablePart, ITaxonEditor, IDropTargetable {
private Taxon taxon;
private EPartService partService;
private TaxonBase<?> selection;
- private ConversationHolder conversation;
-
- private AcceptedGroupE4 acceptedGroup;
- private List<HomotypicalSynonymGroupE4> heterotypicSynonymGroups = new ArrayList<>();
- private MisappliedGroupE4 misappliedGroup;
+ private AcceptedGroup acceptedGroup;
+ private List<HomotypicalSynonymGroup> heterotypicSynonymGroups = new ArrayList<>();
+ private MisappliedGroup misappliedGroup;
private DropTarget target;
@Inject
- UISynchronize sync;
+ private UISynchronize sync;
private TaxonBase<?> objectAffectedByLastOperation;
private MPart thisPart;
- private TaxonEditorInputE4 input;
+ private TaxonEditorInput input;
private UndoContext undoContext;
private IEventBroker eventBroker;
@Inject
- public TaxonNameEditorE4() {
+ public TaxonEditor() {
undoContext = new UndoContext();
}
@Override
public boolean setInput(Object input) {
- if (input instanceof AbstractGroupedContainerE4) {
- TaxonBase<?> newSelection = ((AbstractGroupedContainerE4<?>) input).getData();
- if (selection != newSelection || TaxonNameEditorE4.this.isDirty()) {
+ if (input instanceof AbstractGroupedContainer) {
+ TaxonBase<?> newSelection = ((AbstractGroupedContainer<?>) input).getData();
+ if (selection != newSelection || TaxonEditor.this.isDirty()) {
selection = newSelection;
selService.setSelection(new StructuredSelection(selection));
public void createOrUpdateNameComposites(boolean accepted, boolean heterotypicGroups, boolean misappliedNames) {
if (accepted) {
- ContainerFactoryE4.createOrUpdateAcceptedTaxonsHomotypicGroup(this);
+ ContainerFactory.createOrUpdateAcceptedTaxonsHomotypicGroup(this);
}
if (heterotypicGroups) {
- ContainerFactoryE4.createOrUpdateHeterotypicSynonymyGroups(this);
+ ContainerFactory.createOrUpdateHeterotypicSynonymyGroups(this);
}
if (misappliedNames) {
- ContainerFactoryE4.createOrUpdateMisapplicationsGroup(this);
+ ContainerFactory.createOrUpdateMisapplicationsGroup(this);
}
- ContainerFactoryE4.setMenuToAllContainers(this);
+ ContainerFactory.setMenuToAllContainers(this);
// Redraw composite
parent.pack();
public void setFocus() {
// make sure to bind again if maybe in another view the conversation was
// unbound
+
eventBroker.post(WorkbenchEventConstants.CURRENT_ACTIVE_EDITOR, this);
- if (conversation != null && !conversation.isBound()) {
- conversation.bind();
- }
+
if (EditorUtil.isFactsVisible()){
EditorUtil.showFacts(modelService, partService);
+ EditorUtil.setFactsVisible(false);
}
if (EditorUtil.isMediaVisible()){
EditorUtil.showMedia(modelService, partService);
+ EditorUtil.setMediaVisible(false);
}
if (input != null) {
if (getSelectedContainer() == null) {
throw new IllegalStateException(Messages.TaxonNameEditor_THERE_SHOULD_ALWAYS_BE);
}
- getSelectedContainer().setSelected();
if (input.getCdmEntitySession() != null && !input.getCdmEntitySession().isActive()) {
input.bind();
}
+
}
-// if(selection!=null){
-// selService.setSelection(new StructuredSelection(selection));
-// }
+
// check permissions
boolean doEnable = permissionsSatisfied();
managedForm.getForm().setEnabled(doEnable);
return doEnable;
}
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
- @Override
- public void update(CdmDataChangeMap events) {
- // redraw();
- }
-
/**
* Redraws this editor return true on success
*
* @return true if there are empty names
*/
public boolean checkForEmptyNames() {
- for (AbstractGroupedContainerE4<?> container : getGroupedContainers()) {
+ for (AbstractGroupedContainer<?> container : getGroupedContainers()) {
if (container != null
&& (container.getName() == null || StringUtils.isEmpty(container.getName().getTitleCache()))) {
return true;
return false;
}
- public Set<AbstractGroupedContainerE4> getEmptyContainers() {
- Set<AbstractGroupedContainerE4> containersWithEmptyNames = new HashSet<>();
+ public Set<AbstractGroupedContainer> getEmptyContainers() {
+ Set<AbstractGroupedContainer> containersWithEmptyNames = new HashSet<>();
- for (AbstractGroupedContainerE4<?> container : getGroupedContainers()) {
+ for (AbstractGroupedContainer<?> container : getGroupedContainers()) {
if (container.getName() == null || StringUtils.isEmpty(container.getName().getTitleCache())) {
containersWithEmptyNames.add(container);
}
public void save(IProgressMonitor monitor) {
monitor.beginTask(Messages.TaxonNameEditor_SAVING_NAMES, getGroupedContainers().size());
- if (!conversation.isBound()) {
- conversation.bind();
-
- }
- conversation.commit(true);
monitor.worked(1);
-
+ this.getEditorInput().getCdmEntitySession().load(this.taxon, true);
+ //this.getDirtyNames().forEach(container -> container.refresh());
// check for empty names
if (checkForEmptyNames()) {
MessageDialog.openWarning(AbstractUtility.getShell(), Messages.MultiPageTaxonEditor_NO_NAME_SPECIFIED,
Messages.MultiPageTaxonEditor_NO_NAME_SPECIFIED_MESSAGE);
return;
}
- for (AbstractGroupedContainerE4<?> container : getGroupedContainers()) {
+ for (AbstractGroupedContainer<?> container : getGroupedContainers()) {
monitor.subTask(Messages.TaxonNameEditor_SAVING_COMPOSITES + container.getTaxonBase().getTitleCache());
container.persistName();
// because of missing cascading the concepts need to be saved
// separately
- if (container instanceof ConceptContainerE4) {
+ if (container instanceof ConceptContainer) {
input.addToSaveConcept((Taxon) container.getData());
}
// In case the progress monitor was canceled throw an exception.
// Otherwise declare this step as done.
monitor.worked(1);
}
+
input.setSync(sync);
input.merge();
- // commit the conversation and start a new transaction immediately
- conversation.commit(true);
dirty.setDirty(false);
- EventUtility.postEvent(WorkbenchEventConstants.REFRESH_NAVIGATOR, new TaxonNodeDto(input.getTaxonNode().getParent()));
+
+ if (input.getTaxonNode().getParent() != null) {
+ EventUtility.postEvent(WorkbenchEventConstants.REFRESH_NAVIGATOR, new TaxonNodeDto(input.getTaxonNode().getParent()));
+ }else {
+ EventUtility.postEvent(WorkbenchEventConstants.REFRESH_NAVIGATOR, new TaxonNodeDto(input.getTaxonNode()));
+ }
EventUtility.postEvent(WorkbenchEventConstants.SAVE_TAXON, true);
+ EventUtility.postAsyncEvent(WorkbenchEventConstants.REFRESH_DETAILS, true);
+// EventUtility.postAsyncEvent(WorkbenchEventConstants.NEED_REFRESH_DETAILS, false);
// Stop the progress monitor.
monitor.done();
}
- public void init(TaxonEditorInputE4 input) {
+ public void init(TaxonEditorInput input) {
if (this.input != null) {
this.input.dispose();
// this.acceptedGroup = null;
}
this.input = input;
- conversation = input.getConversationHolder();
-
createOrUpdateNameComposites(true, true, true);
createDragSupport();
setPartName();
-// this.setFocus();
// set initial selection
TaxonBase<?> initiallySelectedTaxonBase = input.getInitiallySelectedTaxonBase();
if (initiallySelectedTaxonBase != null) {
selService.setSelection(new StructuredSelection(initiallySelectedTaxonBase));
- getContainer(initiallySelectedTaxonBase).setSelected();
+ sync.asyncExec(()->{
+ if (getContainer(initiallySelectedTaxonBase)!= null) {
+ getContainer(initiallySelectedTaxonBase).setSelected();
+ }
+ });
}
}
if (target == null) {
target = new DropTarget(parent, operations);
target.setTransfer(types);
- target.addDropListener(new NameEditorDropTargetListenerE4(this));
+ target.addDropListener(new NameEditorDropTargetListener(this));
}
}
return getAcceptedGroup().getAcceptedNameContainer();
}
- public HomotypicalSynonymGroupE4 getHomotypicalGroupContainer(HomotypicalGroup homotypicalGroup) {
- for (HomotypicalSynonymGroupE4 group : getHeterotypicSynonymGroups()) {
+ public HomotypicalSynonymGroup getHomotypicalGroupContainer(HomotypicalGroup homotypicalGroup) {
+ for (HomotypicalSynonymGroup group : getHeterotypicSynonymGroups()) {
if (group.getGroup().equals(homotypicalGroup)) {
return group;
}
*
* @return a Set containing all composites that have been edited
*/
- public Set<AbstractGroupedContainerE4> getDirtyNames() {
- Set<AbstractGroupedContainerE4> dirtyNames = new HashSet<>();
+ public Set<AbstractGroupedContainer> getDirtyNames() {
+ Set<AbstractGroupedContainer> dirtyNames = new HashSet<>();
- for (AbstractGroupedContainerE4<?> composite : getGroupedContainers()) {
+ for (AbstractGroupedContainer<?> composite : getGroupedContainers()) {
if (composite.isDirty()) {
dirtyNames.add(composite);
}
return dirtyNames;
}
- public List<AbstractGroupedContainerE4> getGroupedContainers() {
- List<AbstractGroupedContainerE4> groupedComposites = new ArrayList<>();
+ public List<AbstractGroupedContainer> getGroupedContainers() {
+ List<AbstractGroupedContainer> groupedComposites = new ArrayList<>();
- for (AbstractGroupE4 group : getAllGroups()) {
+ for (AbstractGroup group : getAllGroups()) {
if (group != null) {
groupedComposites.addAll(group.getGroupedContainers());
}
return groupedComposites;
}
- public List<AbstractGroupE4> getAllGroups() {
- List<AbstractGroupE4> allGroups = new ArrayList<>();
+ public List<AbstractGroup> getAllGroups() {
+ List<AbstractGroup> allGroups = new ArrayList<>();
allGroups.add(getAcceptedGroup());
@PreDestroy
public void dispose() {
- if (conversation != null) {
- conversation.unregisterForDataStoreChanges(this);
- conversation.close();
- }
if (input != null) {
input.dispose();
}
}
- public AbstractGroupedContainerE4 getSelectedContainer() {
+ public AbstractGroupedContainer getSelectedContainer() {
if (selection == null && input != null){
selection = this.input.getTaxon();
}
getControl().setBackground(AbstractUtility.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
}
- public void setMisapplicationsGroup(MisappliedGroupE4 misappliedGroup) {
+ public void setMisapplicationsGroup(MisappliedGroup misappliedGroup) {
this.misappliedGroup = misappliedGroup;
}
return managedForm.getToolkit();
}
- public List<HomotypicalSynonymGroupE4> getHeterotypicSynonymGroups() {
+ public List<HomotypicalSynonymGroup> getHeterotypicSynonymGroups() {
return heterotypicSynonymGroups;
}
- public void addHeterotypicSynonymGroup(HomotypicalSynonymGroupE4 group) {
+ public void addHeterotypicSynonymGroup(HomotypicalSynonymGroup group) {
heterotypicSynonymGroups.add(group);
}
- public AcceptedGroupE4 getAcceptedGroup() {
+ public AcceptedGroup getAcceptedGroup() {
return acceptedGroup;
}
- public void setAcceptedGroup(AcceptedGroupE4 acceptedGroup) {
+ public void setAcceptedGroup(AcceptedGroup acceptedGroup) {
this.acceptedGroup = acceptedGroup;
}
- public MisappliedGroupE4 getMisappliedGroup() {
+ public MisappliedGroup getMisappliedGroup() {
return misappliedGroup;
}
@Override
public boolean onComplete() {
- getContainer(objectAffectedByLastOperation).setSelected();
+ if (objectAffectedByLastOperation != null && getContainer(objectAffectedByLastOperation) != null) {
+ getContainer(objectAffectedByLastOperation).setSelected();
+ }
return true;
}
}
}
- public void removeGroup(AbstractGroupE4 group) {
+ public void removeGroup(AbstractGroup group) {
if (group != null) {
group.dispose();
}
}
- public AbstractGroupedContainerE4 getContainer(TaxonBase taxonBase) {
+ public AbstractGroupedContainer<?> getContainer(TaxonBase taxonBase) {
@SuppressWarnings("rawtypes")
- List<AbstractGroupedContainerE4> groupedContainers = getGroupedContainers();
- for (AbstractGroupedContainerE4<?> container : groupedContainers) {
+ List<AbstractGroupedContainer> groupedContainers = getGroupedContainers();
+ for (AbstractGroupedContainer<?> container : groupedContainers) {
if (container.getData().equals(taxonBase) && container.getNameViewer().getTextWidget() != null) {
return container;
}
protected void setEnabled(boolean enabled, Color background) {
- for (AbstractGroupedContainerE4<?> groupedContainer : getGroupedContainers()) {
+ for (AbstractGroupedContainer<?> groupedContainer : getGroupedContainers()) {
groupedContainer.setEnabled(enabled);
}
if (!enabled) {
getManagedForm().setInput(null);
- for (AbstractGroupedContainerE4<?> groupedContainer : getGroupedContainers()) {
+ for (AbstractGroupedContainer<?> groupedContainer : getGroupedContainers()) {
groupedContainer.setBackground(background);
}
}
}
if (element instanceof TaxonBase) {
- AbstractGroupedContainerE4<?> container = getContainer((TaxonBase<?>) element);
+ AbstractGroupedContainer<?> container = getContainer((TaxonBase<?>) element);
if (container != null) {
container.refresh();
+ container.setDirty(false);
}
}
if (element instanceof TaxonRelationship) {
- AbstractGroupedContainerE4 container = getContainer(((TaxonRelationship) element).getFromTaxon());
+ AbstractGroupedContainer container = getContainer(((TaxonRelationship) element).getFromTaxon());
if (container != null) {
container.refresh();
+ container.setDirty(false);
}
}
}
return true;
}
- public TaxonEditorInputE4 getEditorInput() {
+ public TaxonEditorInput getEditorInput() {
return input;
}
@Override
- public TaxonNameEditorE4 getEditor() {
+ public TaxonEditor getEditor() {
return this;
}
@Optional
private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_NAME_EDITOR) UUID cdmbaseUuid) {
if (this.taxon.getUuid().equals(cdmbaseUuid)) {
- TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstanceFromTaxonBase(cdmbaseUuid);
+ TaxonEditorInput input = TaxonEditorInput.NewInstanceFromTaxonBase(cdmbaseUuid);
init(input);
}
}
public TaxonNode getTaxonNode() {
return input.getTaxonNode();
}
+
+
}
\ No newline at end of file
import org.eclipse.ui.forms.widgets.TableWrapLayout;
import eu.etaxonomy.taxeditor.editor.CdmDataTransfer;
-import eu.etaxonomy.taxeditor.editor.name.e4.IDropTargetableE4;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.IDropTargetable;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.name.e4.dnd.NameEditorDropTargetEffect;
-import eu.etaxonomy.taxeditor.editor.name.e4.dnd.NameEditorDropTargetListenerE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.dnd.NameEditorDropTargetListener;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.preference.Resources;
* @author pplitzner
* @date Aug 24, 2017
*/
-public abstract class AbstractGroupE4 implements IDropTargetableE4{
+public abstract class AbstractGroup implements IDropTargetable{
private Composite control;
private IEclipseContext context;
- private final List<AbstractGroupedContainerE4> groupedContainers = new ArrayList<>();
+ private final List<AbstractGroupedContainer> groupedContainers = new ArrayList<>();
- protected TaxonNameEditorE4 editor;
+ protected TaxonEditor editor;
private DropTarget target;
private DropTargetListener dropListener;
- public AbstractGroupE4(TaxonNameEditorE4 editor){
+ public AbstractGroup(TaxonEditor editor){
this.editor = editor;
this.context = editor.getContext();
}
control.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));
}
- public void add(AbstractGroupedContainerE4 groupedContainer){
+ public void add(AbstractGroupedContainer groupedContainer){
groupedContainers.add(groupedContainer);
}
- public void remove(AbstractGroupedContainerE4 groupedContainer){
+ public void remove(AbstractGroupedContainer groupedContainer){
groupedContainer.dispose();
groupedContainers.remove(groupedContainer);
- if(!(this instanceof AcceptedGroupE4) && groupedContainers.isEmpty()){
+ if(!(this instanceof AcceptedGroup) && groupedContainers.isEmpty()){
getEditor().removeGroup(this);
}
}
- public List<AbstractGroupedContainerE4> getGroupedContainers(){
+ public List<AbstractGroupedContainer> getGroupedContainers(){
return groupedContainers;
}
int operations = DND.DROP_MOVE;
target = new DropTarget(control, operations);
target.setTransfer(types);
- dropListener = new NameEditorDropTargetListenerE4(this);
+ dropListener = new NameEditorDropTargetListener(this);
target.addDropListener(dropListener);
target.setDropTargetEffect(new NameEditorDropTargetEffect(control));
}
@Override
- public TaxonNameEditorE4 getEditor() {
+ public TaxonEditor getEditor() {
return editor;
}
public void dragEntered() {
Color color = AbstractUtility.getColor(Resources.COLOR_DRAG_ENTER);
- for(AbstractGroupedContainerE4<?> container : groupedContainers){
+ for(AbstractGroupedContainer<?> container : groupedContainers){
container.setBackground(color);
}
}
@Override
public void dragLeft() {
- for(AbstractGroupedContainerE4<?> container : groupedContainers){
+ for(AbstractGroupedContainer<?> container : groupedContainers){
container.restoreColor();
}
}
public void dispose(){
if(getControl() != null){
getControl().setMenu(null);
- for(AbstractGroupedContainerE4<?> container : getGroupedContainers()){
+ for(AbstractGroupedContainer<?> container : getGroupedContainers()){
container.dispose();
}
getControl().dispose();
}
protected void emptyGroup(){
- for(AbstractGroupedContainerE4<?> container : groupedContainers){
+ for(AbstractGroupedContainer<?> container : groupedContainers){
container.getControl().setMenu(null);
container.dispose();
}
}
protected void setMenuToGroup(){
- for(AbstractGroupedContainerE4<?> container : groupedContainers){
+ for(AbstractGroupedContainer<?> container : groupedContainers){
container.setMenu();
}
* 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.editor.name.e4.container;
import java.util.Iterator;
import eu.etaxonomy.taxeditor.editor.name.container.IContainerConstants;
import eu.etaxonomy.taxeditor.editor.name.container.LineBreakListener;
import eu.etaxonomy.taxeditor.editor.name.container.LineWrapSupport;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.name.e4.dnd.NameEditorDragListenerE4;
import eu.etaxonomy.taxeditor.editor.name.e4.dnd.NameEditorDragSourceEffect;
import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInNewGroupOperation;
+import eu.etaxonomy.taxeditor.event.EventUtility;
+import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.IElementHasDetails;
import eu.etaxonomy.taxeditor.model.NameHelper;
* in its own <code>getData()</code>.
* </p>
* <p>
- * The <code>IManagedForm</code> can also used for drawing borders by calling
+ * The <code>IManagedForm</code> can also be used for drawing borders by calling
* the method <code>createBorderSupport()</code>.
* </p>
* @author pplitzner
*
* @param <T>
*/
-abstract public class AbstractGroupedContainerE4<T extends TaxonBase> implements
+abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
IFormPart, IContainerConstants, IElementHasDetails {
protected ParseHandler parseHandler;
private FocusListener nameCompositeFocusListener;
private ModifyListener nameCompositeModifyListener;
- protected NameViewerE4 nameViewer;
+ protected NameViewer nameViewer;
- private AbstractGroupE4 group;
+ private AbstractGroup group;
private Label nonEditableInfoLabel;
private DefaultToolTip nonEditableInfoHover;
- private static AbstractGroupedContainerE4<?> selection;
+ private static AbstractGroupedContainer<?> selection;
private FocusListener focusListener;
private LineBreakListener lineBreakListener;
private int cursorPosition;
+ private long lastEventTime;
+
protected Composite control;
private Color backgroundColor;
private boolean isDirty;
- public AbstractGroupedContainerE4(AbstractGroupE4 group, T taxonBase) {
+ public AbstractGroupedContainer(AbstractGroup group, T taxonBase) {
setData(taxonBase);
this.group = group;
parseHandler = ParseHandler.NewInstance(taxonBase.getName());
nameCompositeModifyListener = (ModifyEvent e)->{
// mark the composite dirty
setDirty(true);
+ lastEventTime = System.currentTimeMillis();
// parse the text
String text = nameViewer.getTextWidget().getText();
getTaxonBase().setName(name);
getTaxonBase().setTitleCache((getTaxonBase().generateTitle()));
+
// show errors resulting from parsing
calculateAnnotations();
// store the position of the cursor
storeCursor();
// notify selection listener
setDelayedSelection();
+ EventUtility.postAsyncEvent(WorkbenchEventConstants.NEED_REFRESH_DETAILS, false);
+
};
nameCompositeFocusListener = new FocusAdapter() {
super.focusLost(e);
persistName();
}
+
};
addListener();
}
}
- public AbstractGroupE4 getGroup() {
+ public AbstractGroup getGroup() {
if (group == null) {
throw new IllegalStateException("Group shall not be null."); //$NON-NLS-1$
}
}
- protected TaxonNameEditorE4 getEditor() {
+ protected TaxonEditor getEditor() {
return getGroup().getEditor();
}
return control;
}
- protected void createLineWrapSupport() {
+ @SuppressWarnings("unused")
+ protected void createLineWrapSupport() {
new LineWrapSupport(getNameViewer(), getEditor().getManagedForm());
}
protected void createTextViewer() {
- nameViewer = new NameViewerE4(control);
+ nameViewer = new NameViewer(control);
focusListener = new FocusAdapter() {
@Override
return;
}
- for (AbstractGroupedContainerE4<?> container : getEditor()
+ for (AbstractGroupedContainer<?> container : getEditor()
.getGroupedContainers()) {
container.colorSelected(NOT_SELECTED);
}
getEditor().getManagedForm().setInput(
- AbstractGroupedContainerE4.this);
+ AbstractGroupedContainer.this);
placeCursor();
colorSelected(SELECTED_FOCUS);
}
}
public void setSelected() {
- getNameViewer().getTextWidget().setFocus();
+ if (getNameViewer() != null && getNameViewer().getTextWidget() != null) {
+ getNameViewer().getTextWidget().setFocus();
+ }
}
public boolean isSelected() {
private volatile boolean stop = false;
private Display display;
- public Delay(Display display) {
+ private Delay(Display display) {
this.display = display;
}
+
@Override
public void run() {
delay.requestStop();
delay = new Delay(display);
delay.start();
-
}
public void setBackground(Color color) {
getNameViewer().getTextWidget().setFont(font);
}
- public NameViewerE4 getNameViewer() {
+ public NameViewer getNameViewer() {
if (nameViewer == null) {
throw new RuntimeException(
"The Name Viewer is corrupt for Name Container: " //$NON-NLS-1$
// Set indent to viewer ruler's width
if (getNameViewer().getRulerControl() != null) {
// TODO right justify
- layoutData.indent = NameViewerE4.RULER_WIDTH;
+ layoutData.indent = NameViewer.RULER_WIDTH;
}
nonEditableInfoLabel.setLayoutData(layoutData);
lineBreakListener = new LineBreakListener() {
@Override
public void handleSplitText(String text) {
- AbstractGroupedContainerE4.this.handleSplitText(text);
+ AbstractGroupedContainer.this.handleSplitText(text);
}
};
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
/**
*
* @date Aug 24, 2017
*
*/
-public abstract class AbstractHomotypicalGroupContainerE4 extends AbstractGroupE4 {
+public abstract class AbstractHomotypicalGroupContainer extends AbstractGroup {
private HomotypicalGroup group;
- public AbstractHomotypicalGroupContainerE4(TaxonNameEditorE4 editor, HomotypicalGroup group) {
+ public AbstractHomotypicalGroupContainer(TaxonEditor editor, HomotypicalGroup group) {
super(editor);
this.group = group;
List<Synonym> synonyms = taxon.getSynonymsInGroup(homotypicalGroup);
List<Synonym> presentSynonyms = new ArrayList<Synonym>();
- List<AbstractGroupedContainerE4> containers = getGroupedContainers();
+ List<AbstractGroupedContainer> containers = getGroupedContainers();
if (containers == null || containers.isEmpty() || (containers.get(0) == null && containers.size() == 1)){
return true;
}
- for(AbstractGroupedContainerE4 container : getGroupedContainers()){
+ for(AbstractGroupedContainer container : getGroupedContainers()){
if(container.getData() instanceof Synonym){
presentSynonyms.add((Synonym) container.getData());
}
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
import eu.etaxonomy.cdm.model.taxon.Synonym;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.preference.Resources;
* @date Aug 24, 2017
*
*/
-public class AcceptedGroupE4 extends AbstractHomotypicalGroupContainerE4 {
+public class AcceptedGroup extends AbstractHomotypicalGroupContainer {
private AcceptedNameContainerE4 acceptedContainer;
- public AcceptedGroupE4(TaxonNameEditorE4 editor, HomotypicalGroup group) {
+ public AcceptedGroup(TaxonEditor editor, HomotypicalGroup group) {
super(editor, group);
}
}
@Override
- public List<AbstractGroupedContainerE4> getGroupedContainers() {
- List<AbstractGroupedContainerE4> containers = new ArrayList<>();
+ public List<AbstractGroupedContainer> getGroupedContainers() {
+ List<AbstractGroupedContainer> containers = new ArrayList<>();
containers.add(getAcceptedNameContainer());
containers.addAll(super.getGroupedContainers());
return containers;
* @author pplitzner
* @date 24-08-2017
*/
-public class AcceptedNameContainerE4 extends AbstractGroupedContainerE4<Taxon> {
+public class AcceptedNameContainerE4 extends AbstractGroupedContainer<Taxon> {
- public AcceptedNameContainerE4(AcceptedGroupE4 group, Taxon taxon) {
+ public AcceptedNameContainerE4(AcceptedGroup group, Taxon taxon) {
super(group, taxon);
}
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.cdm.strategy.cache.TaggedCacheHelper;
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
-import eu.etaxonomy.taxeditor.editor.name.e4.container.MisappliedGroupE4.ConceptType;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.MisappliedGroup.ConceptType;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.NameHelper;
import eu.etaxonomy.taxeditor.preference.Resources;
* @author pplitzner
* @date Aug 24, 2017
*/
-public class ConceptContainerE4 extends AbstractGroupedContainerE4<Taxon> {
+public class ConceptContainer extends AbstractGroupedContainer<Taxon> {
private TaxonRelationship relationship;
private TaxonRelationshipFormatter misappliedFormatter;
private ConceptType conceptType;
- public ConceptContainerE4(AbstractGroupE4 group, Taxon misappliedName, ConceptType conceptType) {
+ public ConceptContainer(AbstractGroup group, Taxon misappliedName, ConceptType conceptType) {
super(group, misappliedName);
this.conceptType = conceptType;
misappliedFormatter = TaxonRelationshipFormatter.INSTANCE();
protected void initializeComposite() {
setIsDraggable(true);
setFont(getViewerFont());
- TaxonNameEditorE4 editor = getEditor();
+ TaxonEditor editor = getEditor();
Taxon taxon = editor.getTaxon();
for (TaxonRelationship rel: taxon.getTaxonRelations(getMisappliedName())){
if (rel.getType().isAnyMisappliedName() && this.conceptType.equals(ConceptType.Misapplication)){
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.editor.name.e4.container;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
+
+/**
+ *
+ * @author pplitzner
+ * @date Aug 24, 2017
+ *
+ */
+public class ContainerFactory {
+
+ public static void createOrUpdateAcceptedTaxonsHomotypicGroup(
+ TaxonEditor taxonEditor) {
+
+ if(taxonEditor.getAcceptedGroup() == null){
+ taxonEditor.setAcceptedGroup(new AcceptedGroup(taxonEditor, taxonEditor.getTaxon().getHomotypicGroup()));
+ }
+ else{
+ taxonEditor.getAcceptedGroup().redraw(taxonEditor.getTaxon().getHomotypicGroup());
+ }
+
+ }
+
+ public static void createOrUpdateHeterotypicSynonymyGroups(
+ TaxonEditor taxonEditor) {
+ List<HomotypicalSynonymGroup> retainedGroups = new ArrayList<>();
+
+ List<HomotypicalSynonymGroup> heterotypicSynonymGroups = taxonEditor.getHeterotypicSynonymGroups();
+
+ if (heterotypicSynonymGroups != null) {
+
+ for(HomotypicalSynonymGroup group : heterotypicSynonymGroups){
+ retainedGroups.add(group);
+ }
+ }
+
+ for(HomotypicalGroup homotypicalGroup : taxonEditor.getTaxon().getHeterotypicSynonymyGroups()){
+ homotypicalGroup = HibernateProxyHelper.deproxy(homotypicalGroup, HomotypicalGroup.class);
+ HomotypicalSynonymGroup group = createOrUpdateHeterotypicSynonymyGroup(taxonEditor, homotypicalGroup);
+
+ retainedGroups.remove(group);
+ }
+
+ for(HomotypicalSynonymGroup retainedGroup : retainedGroups){
+ taxonEditor.removeGroup(retainedGroup);
+ }
+ }
+
+
+ public static HomotypicalSynonymGroup createOrUpdateHeterotypicSynonymyGroup(
+ TaxonEditor taxonEditor, HomotypicalGroup homotypicalGroup){
+ HomotypicalSynonymGroup group = null;
+ if(taxonEditor.getHomotypicalGroupContainer(homotypicalGroup) == null){
+ group = new HomotypicalSynonymGroup(taxonEditor, homotypicalGroup);
+ taxonEditor.addHeterotypicSynonymGroup(group);
+ if(taxonEditor.getMisappliedGroup() != null){
+ group.getControl().moveAbove(taxonEditor.getMisappliedGroup().getControl());
+ }
+ }
+ else{
+ group = taxonEditor.getHomotypicalGroupContainer(homotypicalGroup);
+ group.redraw(homotypicalGroup);
+ }
+
+ return group;
+ }
+
+ public static void createOrUpdateMisapplicationsGroup(
+ TaxonEditor taxonEditor) {
+ MisappliedGroup group = taxonEditor.getMisappliedGroup();
+ Taxon taxon = HibernateProxyHelper.deproxy(taxonEditor.getTaxon(), Taxon.class);
+
+ if(taxon.getMisappliedNames(true).isEmpty() && taxon.getProParteAndPartialSynonyms().isEmpty()){
+ taxonEditor.removeGroup(group);
+ taxonEditor.setMisapplicationsGroup(null);
+ }else{
+ if(group == null){
+ taxonEditor.setMisapplicationsGroup(new MisappliedGroup(taxonEditor));
+ }else{
+ group.redraw();
+ }
+ }
+
+ }
+
+ public static void setMenuToAllContainers(TaxonEditor taxonEditor){
+ if (taxonEditor == null) {
+ return;
+ }
+ if (taxonEditor.getAcceptedGroup() != null){
+ taxonEditor.getAcceptedGroup().setMenuToGroup();
+ }
+ if (taxonEditor.getTaxon() != null){
+ for(HomotypicalGroup homotypicalGroup : taxonEditor.getTaxon().getHeterotypicSynonymyGroups()){
+ homotypicalGroup = HibernateProxyHelper.deproxy(homotypicalGroup, HomotypicalGroup.class);
+ HomotypicalSynonymGroup group = taxonEditor.getHomotypicalGroupContainer(homotypicalGroup);
+ if (group != null){
+ group.setMenuToGroup();
+ }
+ }
+ if (taxonEditor.getMisappliedGroup() != null){
+ taxonEditor.getMisappliedGroup().setMenuToGroup();
+ }
+ }
+ }
+
+}
+++ /dev/null
-/**
- *
- */
-package eu.etaxonomy.taxeditor.editor.name.e4.container;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
-
-/**
- *
- * @author pplitzner
- * @date Aug 24, 2017
- *
- */
-public class ContainerFactoryE4 {
-
- public static void createOrUpdateAcceptedTaxonsHomotypicGroup(
- TaxonNameEditorE4 taxonNameEditor) {
-
- if(taxonNameEditor.getAcceptedGroup() == null){
- taxonNameEditor.setAcceptedGroup(new AcceptedGroupE4(taxonNameEditor, taxonNameEditor.getTaxon().getHomotypicGroup()));
- }
- else{
- taxonNameEditor.getAcceptedGroup().redraw(taxonNameEditor.getTaxon().getHomotypicGroup());
- }
-
- }
-
- public static void createOrUpdateHeterotypicSynonymyGroups(
- TaxonNameEditorE4 taxonNameEditor) {
- List<HomotypicalSynonymGroupE4> retainedGroups = new ArrayList<>();
-
- List<HomotypicalSynonymGroupE4> heterotypicSynonymGroups = taxonNameEditor.getHeterotypicSynonymGroups();
-
- if (heterotypicSynonymGroups != null) {
-
- for(HomotypicalSynonymGroupE4 group : heterotypicSynonymGroups){
- retainedGroups.add(group);
- }
- }
-
- for(HomotypicalGroup homotypicalGroup : taxonNameEditor.getTaxon().getHeterotypicSynonymyGroups()){
- homotypicalGroup = HibernateProxyHelper.deproxy(homotypicalGroup, HomotypicalGroup.class);
- HomotypicalSynonymGroupE4 group = createOrUpdateHeterotypicSynonymyGroup(taxonNameEditor, homotypicalGroup);
-
- retainedGroups.remove(group);
- }
-
- for(HomotypicalSynonymGroupE4 retainedGroup : retainedGroups){
- taxonNameEditor.removeGroup(retainedGroup);
- }
- }
-
-
- public static HomotypicalSynonymGroupE4 createOrUpdateHeterotypicSynonymyGroup(
- TaxonNameEditorE4 taxonNameEditor, HomotypicalGroup homotypicalGroup){
- HomotypicalSynonymGroupE4 group = null;
- if(taxonNameEditor.getHomotypicalGroupContainer(homotypicalGroup) == null){
- group = new HomotypicalSynonymGroupE4(taxonNameEditor, homotypicalGroup);
- taxonNameEditor.addHeterotypicSynonymGroup(group);
- if(taxonNameEditor.getMisappliedGroup() != null){
- group.getControl().moveAbove(taxonNameEditor.getMisappliedGroup().getControl());
- }
- }
- else{
- group = taxonNameEditor.getHomotypicalGroupContainer(homotypicalGroup);
- group.redraw(homotypicalGroup);
- }
-
- return group;
- }
-
- public static void createOrUpdateMisapplicationsGroup(
- TaxonNameEditorE4 taxonNameEditor) {
- MisappliedGroupE4 group = taxonNameEditor.getMisappliedGroup();
- Taxon taxon = HibernateProxyHelper.deproxy(taxonNameEditor.getTaxon(), Taxon.class);
-
- if(taxon.getMisappliedNames(true).isEmpty() && taxon.getProParteAndPartialSynonyms().isEmpty()){
- taxonNameEditor.removeGroup(group);
- taxonNameEditor.setMisapplicationsGroup(null);
- }else{
- if(group == null){
- taxonNameEditor.setMisapplicationsGroup(new MisappliedGroupE4(taxonNameEditor));
- }else{
- group.redraw();
- }
- }
-
- }
-
- public static void setMenuToAllContainers(TaxonNameEditorE4 taxonNameEditor){
- if (taxonNameEditor == null) {
- return;
- }
- if (taxonNameEditor.getAcceptedGroup() != null){
- taxonNameEditor.getAcceptedGroup().setMenuToGroup();
- }
- if (taxonNameEditor.getTaxon() != null){
- for(HomotypicalGroup homotypicalGroup : taxonNameEditor.getTaxon().getHeterotypicSynonymyGroups()){
- homotypicalGroup = HibernateProxyHelper.deproxy(homotypicalGroup, HomotypicalGroup.class);
- HomotypicalSynonymGroupE4 group = taxonNameEditor.getHomotypicalGroupContainer(homotypicalGroup);
- if (group != null){
- group.setMenuToGroup();
- }
- }
- if (taxonNameEditor.getMisappliedGroup() != null){
- taxonNameEditor.getMisappliedGroup().setMenuToGroup();
- }
- }
- }
-
-}
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.taxeditor.editor.name.container.IContainerConstants;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
/**
*
* @date Aug 24, 2017
*
*/
-public class HomotypicalSynonymGroupE4 extends AbstractHomotypicalGroupContainerE4 {
+public class HomotypicalSynonymGroup extends AbstractHomotypicalGroupContainer {
- public HomotypicalSynonymGroupE4(TaxonNameEditorE4 editor, HomotypicalGroup group) {
+ public HomotypicalSynonymGroup(TaxonEditor editor, HomotypicalGroup group) {
super(editor, group);
}
import java.util.Set;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
/**
* @author pplitzner
* @date Aug 24, 2017
*/
-public class MisappliedGroupE4 extends AbstractGroupE4{
+public class MisappliedGroup extends AbstractGroup{
protected enum ConceptType {
Misapplication,
}
- public MisappliedGroupE4(TaxonNameEditorE4 editor) {
+ public MisappliedGroup(TaxonEditor editor) {
super(editor);
createContent();
protected void createContainers() {
for(Taxon proParteSynonym : getEditor().getTaxon().getAllProParteSynonyms()){
- ConceptContainerE4 container = new ConceptContainerE4(this, proParteSynonym, ConceptType.Synonym);
+ ConceptContainer container = new ConceptContainer(this, proParteSynonym, ConceptType.Synonym);
this.add(container);
container.createContent();
}
for(Taxon misapplication : getEditor().getTaxon().getAllMisappliedNames()){
- ConceptContainerE4 container = new ConceptContainerE4(this, misapplication, ConceptType.Misapplication);
+ ConceptContainer container = new ConceptContainer(this, misapplication, ConceptType.Misapplication);
this.add(container);
container.createContent();
}
Set<Taxon> presentConcepts = new HashSet<>();
- for (AbstractGroupedContainerE4<Taxon> container : getGroupedContainers()){
+ for (AbstractGroupedContainer<Taxon> container : getGroupedContainers()){
presentConcepts.add(container.getData());
}
return ! (presentConcepts.containsAll(concepts) && concepts.containsAll(presentConcepts));
* @since Aug 25, 2017
*
*/
-public class NameViewerE4 extends SourceViewer {
+public class NameViewer extends SourceViewer {
public static final int RULER_WIDTH = 16;
private final IVerticalRuler ruler;
private final AnnotationModel annotationModel;
- public NameViewerE4(Composite parent) {
+ public NameViewer(Composite parent) {
super(parent, new RulerWithIcon(RULER_WIDTH), SWT.WRAP | SWT.MULTI | SWT.RESIZE);
this.ruler = getVerticalRuler();
* @author p.ciardelli
* @created 13.01.2009
*/
-public class SynonymContainerE4 extends AbstractGroupedContainerE4<Synonym> {
+public class SynonymContainerE4 extends AbstractGroupedContainer<Synonym> {
private int indent = SYNONYM_INDENT;
private Image icon = HETEROTYPIC_SYNONYM_ICON;
/**
* <p>Constructor for SynonymContainer.</p>
*
- * @param editor a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
+ * @param editor a {@link eu.etaxonomy.taxeditor.editor.name.TaxonEditor} object.
* @param group a {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup} object.
* @param synonym a {@link eu.etaxonomy.cdm.model.taxon.Synonym} object.
*/
- public SynonymContainerE4(AbstractHomotypicalGroupContainerE4 group, Synonym synonym) {
+ public SynonymContainerE4(AbstractHomotypicalGroupContainer group, Synonym synonym) {
super(group, synonym);
}
- public SynonymContainerE4(AbstractHomotypicalGroupContainerE4 group, Synonym synonym, int indent, Image icon){
+ public SynonymContainerE4(AbstractHomotypicalGroupContainer group, Synonym synonym, int indent, Image icon){
super(group, synonym);
this.indent = indent;
this.icon = icon;
import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.taxeditor.editor.CdmDataTransfer;
-import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupedContainerE4;
-import eu.etaxonomy.taxeditor.editor.name.e4.container.ConceptContainerE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupedContainer;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.ConceptContainer;
/**
* @author pplitzner
*/
public class NameEditorDragListenerE4 extends DragSourceAdapter {
- private AbstractGroupedContainerE4<?> container;
+ private AbstractGroupedContainer<?> container;
- public NameEditorDragListenerE4(AbstractGroupedContainerE4 container){
+ public NameEditorDragListenerE4(AbstractGroupedContainer container){
this.container = container;
}
@Override
public void dragStart(DragSourceEvent event) {
- event.doit = (container.getData() != null) && !(container instanceof ConceptContainerE4);
+ event.doit = (container.getData() != null) && !(container instanceof ConceptContainer);
}
}
import org.eclipse.swt.widgets.Control;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.name.e4.IDropTargetableE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.IDropTargetable;
import eu.etaxonomy.taxeditor.preference.Resources;
/**
@Override
public void dragEnter(DropTargetEvent dropTargetEvent) {
- if(dropTargetEvent.widget instanceof IDropTargetableE4){
- ((IDropTargetableE4) dropTargetEvent.widget).dragEntered();
+ if(dropTargetEvent.widget instanceof IDropTargetable){
+ ((IDropTargetable) dropTargetEvent.widget).dragEntered();
}
}
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.IDropTargetableE4;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
-import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractHomotypicalGroupContainerE4;
-import eu.etaxonomy.taxeditor.editor.name.e4.container.MisappliedGroupE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.IDropTargetable;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractHomotypicalGroupContainer;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.MisappliedGroup;
import eu.etaxonomy.taxeditor.editor.name.e4.operation.MoveSynonymToAnotherAcceptedTaxonOperationE4;
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptRelationshipTypeOperation;
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptToSynonymOperation;
* @author pplitzner
* @date Aug 24, 2017
*/
-public class NameEditorDropTargetListenerE4 extends DropTargetAdapter {
+public class NameEditorDropTargetListener extends DropTargetAdapter {
- private IDropTargetableE4 target;
+ private IDropTargetable target;
- public NameEditorDropTargetListenerE4(IDropTargetableE4 target){
+ public NameEditorDropTargetListener(IDropTargetable target){
this.target = target;
}
return;
}
- if (target instanceof MisappliedGroupE4){
+ if (target instanceof MisappliedGroup){
dropTargetEvent.detail = DND.DROP_NONE;
return;
}
if(taxonBase instanceof Synonym){
Synonym synonym = (Synonym) taxonBase;
- if(target instanceof AbstractHomotypicalGroupContainerE4){
- HomotypicalGroup homotypicalGroup = ((AbstractHomotypicalGroupContainerE4) target).getGroup();
- if (((AbstractHomotypicalGroupContainerE4) target).getEditor().getTaxon().equals(synonym.getAcceptedTaxon())){
+ if(target instanceof AbstractHomotypicalGroupContainer){
+ HomotypicalGroup homotypicalGroup = ((AbstractHomotypicalGroupContainer) target).getGroup();
+ if (((AbstractHomotypicalGroupContainer) target).getEditor().getTaxon().equals(synonym.getAcceptedTaxon())){
//the actual accepted taxon is the same as the taxon of the target editor
try{
return new ChangeHomotypicGroupOperation(Messages.NameEditorDropTargetListener_CHANGE_HOMOTYPICAL_GROUP, getEditor().getUndoContext(),
- ((AbstractHomotypicalGroupContainerE4) target).getEditor().getTaxon(), synonym, homotypicalGroup, target);
+ ((AbstractHomotypicalGroupContainer) target).getEditor().getTaxon(), synonym, homotypicalGroup, target);
}catch (NullPointerException e){
return null;
}
} else{
- getEditor().getConversationHolder().commit();
- ((TaxonNameEditorE4) target).getConversationHolder().commit();
- UUID newSecUuid = null;
- try{
- newSecUuid = getNewSecRef(synonym);
- }catch (Exception e){
- return null;
- }
- return new MoveSynonymToAnotherAcceptedTaxonOperationE4(Messages.NameEditorDropTargetListener_CHANGE_ACC_TAXON, getEditor().getUndoContext(), synonym.getUuid(), ((TaxonNameEditorE4) target).getTaxon(), newSecUuid, (TaxonNameEditorE4) target, (TaxonNameEditorE4) target);
+ UUID newSecUuid = null;
+ try{
+ newSecUuid = getNewSecRef(synonym);
+ }catch (Exception e){
+ return null;
+ }
+ return new MoveSynonymToAnotherAcceptedTaxonOperationE4(Messages.NameEditorDropTargetListener_CHANGE_ACC_TAXON, getEditor().getUndoContext(), synonym.getUuid(), ((TaxonEditor) target).getTaxon(), newSecUuid, (TaxonEditor) target);
}
}
- else if(target instanceof MisappliedGroupE4){
+ else if(target instanceof MisappliedGroup){
return new ChangeSynonymToMisapplicationOperation(Messages.NameEditorDropTargetListener_CHANGE_SYNONYM_TO_MISAPP, getEditor().getUndoContext(),
getEditor().getTaxon(), synonym, target);
}
- else if(target instanceof TaxonNameEditorE4){
- if (((TaxonNameEditorE4) target).getTaxon().equals(synonym.getAcceptedTaxon())){
+ else if(target instanceof TaxonEditor){
+ if (((TaxonEditor) target).getTaxon().equals(synonym.getAcceptedTaxon())){
return new ChangeHomotypicGroupOperation(Messages.NameEditorDropTargetListener_CHANGE_HOMOTYPICAL_GROUP, getEditor().getUndoContext(),
- ((TaxonNameEditorE4) target).getTaxon(), synonym, null, target);
+ ((TaxonEditor) target).getTaxon(), synonym, null, target);
} else{
- getEditor().getConversationHolder().commit();
- ((TaxonNameEditorE4) target).getConversationHolder().commit();
UUID newSecUuid = null;
try{
newSecUuid = getNewSecRef(synonym);
}catch (Exception e){
return null;
}
- return new MoveSynonymToAnotherAcceptedTaxonOperationE4(Messages.NameEditorDropTargetListener_CHANGE_ACC_TAXON, getEditor().getUndoContext(), synonym.getUuid(), ((TaxonNameEditorE4) target).getTaxon(), newSecUuid, (TaxonNameEditorE4) target, (TaxonNameEditorE4) target);
+ return new MoveSynonymToAnotherAcceptedTaxonOperationE4(Messages.NameEditorDropTargetListener_CHANGE_ACC_TAXON, getEditor().getUndoContext(), synonym.getUuid(), ((TaxonEditor) target).getTaxon(), newSecUuid, (TaxonEditor) target);
}
}
}else if(taxonBase instanceof Taxon){
Taxon concept = (Taxon) taxonBase;
- if(target instanceof AbstractHomotypicalGroupContainerE4){
- HomotypicalGroup homotypicalGroup = ((AbstractHomotypicalGroupContainerE4) target).getGroup();
+ if(target instanceof AbstractHomotypicalGroupContainer){
+ HomotypicalGroup homotypicalGroup = ((AbstractHomotypicalGroupContainer) target).getGroup();
return new ChangeConceptToSynonymOperation(Messages.NameEditorDropTargetListener_CHANGE_SYNONYM, getEditor().getUndoContext(),
getEditor().getTaxon(), concept, homotypicalGroup, target);
}
- else if(target instanceof MisappliedGroupE4){
+ else if(target instanceof MisappliedGroup){
return new ChangeConceptRelationshipTypeOperation(Messages.NameEditorDropTargetListener_CHANGE, getEditor().getUndoContext(),
getEditor().getTaxon(), concept, TaxonRelationshipType.MISAPPLIED_NAME_FOR(), target);
}
Reference synSecRef = synonym.getSec();
UUID newSecUuid = null;
SecReferenceHandlingEnum secHandling = PreferencesUtil.getSecReferenceHandlingPreference();
- Reference parentSecRef = ((AbstractHomotypicalGroupContainerE4) target).getEditor().getTaxon() != null? ((AbstractHomotypicalGroupContainerE4) target).getEditor().getTaxon().getSec():null;
+ Reference parentSecRef = ((AbstractHomotypicalGroupContainer) target).getEditor().getTaxon() != null? ((AbstractHomotypicalGroupContainer) target).getEditor().getTaxon().getSec():null;
if ((synSecRef != parentSecRef && secHandling.equals(SecReferenceHandlingEnum.KeepOrWarn) )|| secHandling.equals(SecReferenceHandlingEnum.KeepOrSelect)){
if ((parentSecRef != synSecRef && secHandling.equals(SecReferenceHandlingEnum.KeepOrWarn) )|| secHandling.equals(SecReferenceHandlingEnum.KeepOrSelect)){
}
private HomotypicalGroup getHomotypicalGroup() {
- if(target instanceof AbstractHomotypicalGroupContainerE4){
- return ((AbstractHomotypicalGroupContainerE4) target).getGroup();
+ if(target instanceof AbstractHomotypicalGroupContainer){
+ return ((AbstractHomotypicalGroupContainer) target).getGroup();
}
return null;
}
return null;
}
- private TaxonNameEditorE4 getEditor() {
- return (TaxonNameEditorE4) EventUtility.getTaxonEditor();
+ private TaxonEditor getEditor() {
+ return (TaxonEditor) EventUtility.getTaxonEditor();
}
}
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInput;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToAcceptedTaxonOperation;
import eu.etaxonomy.taxeditor.event.EventUtility;
* @author pplitzner
* @since Aug 28, 2017
*/
-public class ChangeSynonymToAcceptedTaxonHandlerE4 implements IPostOperationEnabled {
+public class ChangeSynonymToAcceptedTaxonHandler implements IPostOperationEnabled {
- private static final Logger logger = LogManager.getLogger(ChangeSynonymToAcceptedTaxonHandlerE4.class);
+ private static final Logger logger = LogManager.getLogger(ChangeSynonymToAcceptedTaxonHandler.class);
- private TaxonNameEditorE4 editor;
+ private TaxonEditor editor;
private EPartService partService;
private MApplication application;
private EModelService modelService;
this.application = application;
this.partService = partService;
- editor = (TaxonNameEditorE4) activePart.getObject();
+ editor = (TaxonEditor) activePart.getObject();
- TaxonEditorInputE4 input = editor.getEditorInput();
+ TaxonEditorInput input = editor.getEditorInput();
// Get synonym from selection
if (!(selection.getFirstElement() instanceof Synonym)) {
// Get taxon
Taxon taxon = input.getTaxon();
- TaxonNode newParentNode = TaxonNodeSelectionDialog.select(shell,// editor.getConversationHolder(),
- Messages.ChangeSynonymToAcceptedTaxonHandler_SELECT_PARENT, null, null, input.getTaxonNode().getClassification().getUuid(), true);
+ TaxonNode newParentNode = TaxonNodeSelectionDialog.select(shell, Messages.ChangeSynonymToAcceptedTaxonHandler_SELECT_PARENT, null, null, input.getTaxonNode().getClassification().getUuid(), true);
if(newParentNode != null){
Reference parentSecRef = newParentNode.getTaxon() != null? newParentNode.getTaxon().getSec(): null;
ChangeSynonymToAcceptedTaxonOperation operation = new ChangeSynonymToAcceptedTaxonOperation(Messages.ChangeSynonymToAcceptedTaxonHandler_CHANGE_SYN_TO_ACC_TAXON, EditorUtil.getUndoContext(),
taxon, newParentNode, synonym,
newSecUuid, secHandling,
- this, editor, editor.getEditorInput()); //$NON-NLS-1$
+ this, editor.getEditorInput()); //$NON-NLS-1$
AbstractUtility.executeOperation(operation, sync);
}
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptRelationshipTypeOperation;
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToMisapplicationOperation;
* @since Aug 28, 2017
*
*/
-public class ChangeToMisapplicationHandlerE4 {
+public class ChangeToMisapplicationHandler {
- private TaxonNameEditorE4 editor;
+ private TaxonEditor editor;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
MHandledMenuItem menuItem,
UISynchronize sync) {
- editor = (TaxonNameEditorE4) activePart.getObject();
+ editor = (TaxonEditor) activePart.getObject();
if (!EditorUtil.forceUserSaveE4Editor(editor, shell)){
return ;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptRelationshipTypeOperation;
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToConceptOperation;
* @since Aug 28, 2017
*
*/
-public class ChangeToProParteSynonymHandlerE5 {
+public class ChangeToProParteSynonymHandler {
- private TaxonNameEditorE4 editor;
+ private TaxonEditor editor;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
MHandledMenuItem menuItem,
UISynchronize sync) {
- editor = (TaxonNameEditorE4) activePart.getObject();
+ editor = (TaxonEditor) activePart.getObject();
if (!EditorUtil.forceUserSaveE4Editor(editor, shell)){
return ;
import org.eclipse.jface.viewers.IStructuredSelection;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptToSynonymOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
* @since Aug 28, 2017
*
*/
-public class ChangeToSynonymHandlerE4 {
+public class ChangeToSynonymHandler {
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
MHandledMenuItem menuItem,
UISynchronize sync) {
- TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+ TaxonEditor editor = (TaxonEditor) activePart.getObject();
Taxon concept = (Taxon) selection.getFirstElement();
import org.eclipse.jface.viewers.IStructuredSelection;
import eu.etaxonomy.cdm.model.name.TaxonName;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInNewGroupOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
* @since Aug 28, 2017
*
*/
-public class CreateHeterotypicSynonymHandlerE4 {
+public class CreateHeterotypicSynonymHandler {
@Execute
MHandledMenuItem menuItem,
UISynchronize sync) {
- TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+ TaxonEditor editor = (TaxonEditor) activePart.getObject();
TaxonName newSynonymName = ParseHandler.createEmptyName();
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
* @since Aug 28, 2017
*
*/
-public class CreateHomotypicSynonymHandlerE4 {
+public class CreateHomotypicSynonymHandler {
@Execute
MHandledMenuItem menuItem,
UISynchronize sync) {
- TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+ TaxonEditor editor = (TaxonEditor) activePart.getObject();
Taxon taxon = editor.getTaxon();
HomotypicalGroup group = taxon.getHomotypicGroup();
TaxonName newSynonymName = ParseHandler.createEmptyName();
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.concept.operation.CreateConceptRelationOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
* @since Aug 28, 2017
*
*/
-public class CreateMisapplicationHandlerE4 {
+public class CreateMisapplicationHandler {
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
MHandledMenuItem menuItem,
UISynchronize sync) {
- TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+ TaxonEditor editor = (TaxonEditor) activePart.getObject();
TaxonName conceptName = ParseHandler.createEmptyName();
Taxon concept = Taxon.NewInstance(conceptName, null);
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.concept.operation.CreateConceptRelationOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
* @since 15.05.2018
*
*/
-public class CreateProParteSynonymHandlerE4 {
+public class CreateProParteSynonymHandler {
@Execute
MHandledMenuItem menuItem,
UISynchronize sync) {
- TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+ TaxonEditor editor = (TaxonEditor) activePart.getObject();
TaxonName conceptName = ParseHandler.createEmptyName();
Taxon concept = Taxon.NewInstance(conceptName, null);
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.taxon.Synonym;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
* @author pplitzner
* @since Aug 28, 2017
*/
-public class CreateSynonymInHomotypicalGroupHandlerE4 {
+public class CreateSynonymInHomotypicalGroupHandler {
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
MHandledMenuItem menuItem,
UISynchronize sync) {
- TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+ TaxonEditor editor = (TaxonEditor) activePart.getObject();
Object selectedObject = selection.getFirstElement();
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
-import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupedContainerE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupedContainer;
/**
*
* @since Aug 28, 2017
*
*/
-public class DeleteAllEmptyNamesHandlerE4 extends DeleteTaxonBaseHandlerE4 {
+public class DeleteAllEmptyNamesHandler extends DeleteTaxonBaseHandler {
@Override
@Execute
MHandledMenuItem menuItem,
UISynchronize sync) {
- editor = (TaxonNameEditorE4) activePart.getObject();
+ editor = (TaxonEditor) activePart.getObject();
- for(AbstractGroupedContainerE4 containerWithEmptyName : editor.getEmptyContainers()){
+ for(AbstractGroupedContainer containerWithEmptyName : editor.getEmptyContainers()){
editor.removeGroup(containerWithEmptyName.getGroup());
doExecute(menuItem.getLocalizedLabel(), shell, editor, containerWithEmptyName.getData(), sync);
}
@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
MHandledMenuItem menuItem){
- editor = (TaxonNameEditorE4) activePart.getObject();
+ editor = (TaxonEditor) activePart.getObject();
boolean canExecute = false;
canExecute = editor.checkForEmptyNames();
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
* @since Aug 28, 2017
*
*/
-public class DeleteTaxonBaseHandlerE4 implements IPostOperationEnabled {
+public class DeleteTaxonBaseHandler implements IPostOperationEnabled {
- protected TaxonNameEditorE4 editor;
+ protected TaxonEditor editor;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
MHandledMenuItem menuItem,
UISynchronize sync) {
- editor = (TaxonNameEditorE4) activePart.getObject();
+ editor = (TaxonEditor) activePart.getObject();
doExecute(menuItem.getLocalizedLabel(), shell, editor, selection.getFirstElement(), sync);
}
- protected void doExecute(String commandName, Shell shell, TaxonNameEditorE4 editor, Object selectedElement,
+ protected void doExecute(String commandName, Shell shell, TaxonEditor editor, Object selectedElement,
UISynchronize sync) {
AbstractPostOperation operation = null;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInput;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.name.e4.operation.MoveSynonymToAnotherAcceptedTaxonOperationE4;
import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.ui.dialog.selection.ReferenceSelectionDialog;
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
-public class MoveSynonymToAnotherAcceptedTaxonHandlerE4 implements IPostOperationEnabled{
+public class MoveSynonymToAnotherAcceptedTaxonHandler implements IPostOperationEnabled{
- private static final Logger logger = LogManager.getLogger(MoveSynonymToAnotherAcceptedTaxonHandlerE4.class);
+ private static final Logger logger = LogManager.getLogger(MoveSynonymToAnotherAcceptedTaxonHandler.class);
- private TaxonNameEditorE4 editor;
+ private TaxonEditor editor;
private TaxonNode newParentNode;
this.activePart = activePart;
this.partService = partService;
- editor = (TaxonNameEditorE4) activePart.getObject();
+ editor = (TaxonEditor) activePart.getObject();
- TaxonEditorInputE4 input = editor.getEditorInput();
+ TaxonEditorInput input = editor.getEditorInput();
if (!EditorUtil.forceUserSaveE4Editor(editor, shell)) {
return ;
}
if(newParentNode!=null){
MoveSynonymToAnotherAcceptedTaxonOperationE4 operation = new MoveSynonymToAnotherAcceptedTaxonOperationE4(Messages.MoveSynonymToAnotherAcceptedTaxonHandler_CHANGE_ACC_TAXON, EditorUtil.getUndoContext(),
- synonym.getUuid(), newParentNode.getTaxon(),newSecUuid, this, editor);
+ synonym.getUuid(), newParentNode.getTaxon(),newSecUuid, this);
AbstractUtility.executeOperation(operation, sync);
}
import org.eclipse.jface.viewers.IStructuredSelection;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeHomotypicalGroupBasionymOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
* @since Aug 28, 2017
*
*/
-public class SetBasionymHandlerE4 {
+public class SetBasionymHandler {
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
MHandledMenuItem menuItem,
UISynchronize sync) {
- TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+ TaxonEditor editor = (TaxonEditor) activePart.getObject();
TaxonBase selectedTaxonBase = (TaxonBase) selection.getFirstElement();
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
import eu.etaxonomy.taxeditor.editor.name.operation.SwapSynonymAndAcceptedOperation;
import eu.etaxonomy.taxeditor.event.EventUtility;
* @author pplitzner
* @since Aug 28, 2017
*/
-public class SwapSynonymAndAcceptedHandlerE4 implements IPostOperationEnabled {
+public class SwapSynonymAndAcceptedHandler implements IPostOperationEnabled {
- protected TaxonNameEditorE4 editor;
+ protected TaxonEditor editor;
protected Taxon taxon;
protected EPartService partService;
protected MPart activePart;
this.application = application;
this.partService = partService;
- editor = (TaxonNameEditorE4) activePart.getObject();
+ editor = (TaxonEditor) activePart.getObject();
Synonym synonym = (Synonym) selection.getFirstElement();
* @since Aug 28, 2017
*
*/
-public class SwapSynonymAndAcceptedSetNameInSourceHandlerE5 extends SwapSynonymAndAcceptedHandlerE4 implements IPostOperationEnabled {
+public class SwapSynonymAndAcceptedSetNameInSourceHandlerE5 extends SwapSynonymAndAcceptedHandler implements IPostOperationEnabled {
// this.application = application;
// this.partService = partService;
//
-// editor = (TaxonNameEditorE4) activePart.getObject();
+// editor = (TaxonEditor) activePart.getObject();
//
// Synonym synonym = (Synonym) selection.getFirstElement();
//
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.ITaxonService;
import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.api.service.exception.HomotypicalGroupChangeException;
* The synonym to be moved.
*/
private final Synonym synonym;
- private IConversationEnabled conversationEnabled;
private UUID newSecUuid;
public MoveSynonymToAnotherAcceptedTaxonOperationE4(String label, IUndoContext undoContext, UUID synonymUUID,
- Taxon taxon, UUID newSecRefUuid, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {
+ Taxon taxon, UUID newSecRefUuid, IPostOperationEnabled postOperationEnabled) {
super(label, undoContext, taxon, postOperationEnabled);
List<String> propertyPaths = new ArrayList<String>();
propertyPaths.add("synonymRelations"); //$NON-NLS-1$
- this.conversationEnabled = conversationEnabled;
+
this.element = (Taxon) CdmStore.getService(ITaxonService.class).load(taxon.getUuid(),propertyPaths);
this.synonym = (Synonym) CdmStore.getService(ITaxonService.class).load(synonymUUID);
this.newSecUuid = newSecRefUuid;
monitor.beginTask("Move synonym to another taxon", 40);
Taxon oldAccepted = synonym.getAcceptedTaxon();
// Reference secRef = CdmStore.getService(IReferenceService.class).load(newSecUuid);
- conversationEnabled.getConversationHolder().commit();
-
UpdateResult result = null;
try {
result = CdmStore.getService(ITaxonService.class).moveSynonymToAnotherTaxon(synonym,
// TODO Auto-generated catch block
e.printStackTrace();
}
-// conversationEnabled.getConversationHolder().commit();
-
monitor.worked(40);
// Redraw editor if it exists
Set<Taxon> taxa = new HashSet<>();
taxa.add(oldAccepted);
EditorUtil.updateNameEditors(taxa);
-// ((TaxonNameEditorE4)EventUtility.getTaxonEditor()).getConversationHolder().commit();
-
return postExecute(null);
}
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @return
*/
public static boolean hasEmptyNames(Object receiver) {
- TaxonNameEditorE4 editor = (TaxonNameEditorE4) EventUtility.getTaxonEditor();
+ TaxonEditor editor = (TaxonEditor) EventUtility.getTaxonEditor();
return editor == null ? false : editor.checkForEmptyNames();
}
public static boolean isRelatedConcept(Object selectedElement) {
- if(selectedElement instanceof Taxon && ((Taxon) selectedElement).isRelatedConcept() && !((TaxonNameEditorE4) EventUtility.getTaxonEditor()).getTaxon().equals(selectedElement)){
+ if(selectedElement instanceof Taxon && ((Taxon) selectedElement).isRelatedConcept() && !((TaxonEditor) EventUtility.getTaxonEditor()).getTaxon().equals(selectedElement)){
return true;
}
return false;
}
public static boolean isMisapplication(Object selectedElement) {
- if(selectedElement instanceof Taxon && ((Taxon) selectedElement).isMisapplication() && !((TaxonNameEditorE4) EventUtility.getTaxonEditor()).getTaxon().equals(selectedElement)){
+ if(selectedElement instanceof Taxon && ((Taxon) selectedElement).isMisapplication() && !((TaxonEditor) EventUtility.getTaxonEditor()).getTaxon().equals(selectedElement)){
return true;
}
return false;
}
public static boolean isProparteSynonym(Object selectedElement) {
- if(selectedElement instanceof Taxon && ((Taxon) selectedElement).isProparteSynonym() && !((TaxonNameEditorE4) EventUtility.getTaxonEditor()).getTaxon().equals(selectedElement)){
+ if(selectedElement instanceof Taxon && ((Taxon) selectedElement).isProparteSynonym() && !((TaxonEditor) EventUtility.getTaxonEditor()).getTaxon().equals(selectedElement)){
return true;
}
return false;
if (selectedElement instanceof Synonym){
return true;
}
- if(((Taxon) selectedElement).isProparteSynonym() && !((TaxonNameEditorE4) EventUtility.getTaxonEditor()).getTaxon().equals(selectedElement)){
+ if(((Taxon) selectedElement).isProparteSynonym() && !((TaxonEditor) EventUtility.getTaxonEditor()).getTaxon().equals(selectedElement)){
return false;
}
return true;
}
public static boolean isAccepted(Object selectedElement) {
- TaxonNameEditorE4 editor = (TaxonNameEditorE4) EventUtility.getTaxonEditor();
+ TaxonEditor editor = (TaxonEditor) EventUtility.getTaxonEditor();
Taxon accepted = editor.getTaxon();
return (selectedElement instanceof Taxon && accepted.equals(selectedElement)) ? true : false;
}
newHomotypicalGroup = HibernateProxyHelper.deproxy(newHomotypicalGroup, HomotypicalGroup.class);
newHomotypicalGroup.addTypifiedName(synonymName);
-
- SynonymType type = SynonymType.HETEROTYPIC_SYNONYM_OF();
+
+ SynonymType type = SynonymType.HETEROTYPIC_SYNONYM_OF;
if(newHomotypicalGroup.getTypifiedNames().contains(element.getName())){
- type = SynonymType.HOMOTYPIC_SYNONYM_OF();
+ type = SynonymType.HOMOTYPIC_SYNONYM_OF;
}
element.addSynonym(synonym, type);
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.ITaxonService;
import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.api.service.exception.HomotypicalGroupChangeException;
* @param synonym a {@link eu.etaxonomy.cdm.model.taxon.Synonym} object.
* @param synonymsInHomotypicalGroup an array of {@link eu.etaxonomy.cdm.model.taxon.Synonym} objects.
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
*/
public ChangeSynonymToAcceptedTaxonOperation(String label,
IUndoContext undoContext,
Synonym synonym,
UUID newSecUuid,
SecReferenceHandlingEnum secHandling,
- IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled,
+ IPostOperationEnabled postOperationEnabled,
ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
+ super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
this.element = taxon;
this.parentNode = parentNode;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>ChangeSynonymToMisapplicationOperation class.</p>
- *
* @author p.ciardelli
* @author n.hoffmann
* @created 14.01.2009
private Taxon misapplication;
private Set<SynonymType> synonymTypes;
- /**
- * <p>Constructor for ChangeSynonymToMisapplicationOperation.</p>
- *
- * @param label a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
- * @param synonym a {@link eu.etaxonomy.cdm.model.taxon.Synonym} object.
- * @param editor a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- */
public ChangeSynonymToMisapplicationOperation(String label,
IUndoContext undoContext, Taxon taxon, Synonym synonym, IPostOperationEnabled editor) {
super(label, undoContext, taxon, editor);
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
}
protected void addToSaveList(CdmBase newCdmBase) {
- TaxonNameEditorE4 editor = null;
+ TaxonEditor editor = null;
Object activePart = AbstractUtility.getActivePart();
- if (activePart instanceof TaxonNameEditorE4){
- editor = (TaxonNameEditorE4) activePart;
+ if (activePart instanceof TaxonEditor){
+ editor = (TaxonEditor) activePart;
if (newCdmBase instanceof Synonym){
editor.getEditorInput().addToSaveNewSynonym((Synonym)newCdmBase);
}else if (newCdmBase instanceof Taxon ){
// Add name to given homotypic group
-// HomotypicalSynonymGroupE4 groupContainer = ((TaxonNameEditorE4)postOperationEnabled).getHomotypicalGroupContainer(group);
+// HomotypicalSynonymGroupE4 groupContainer = ((TaxonEditor)postOperationEnabled).getHomotypicalGroupContainer(group);
group.addTypifiedName(newSynonymName);
// groupContainer.add(groupedContainer);
monitor.worked(20);
synonym = element.addHeterotypicSynonymName(newSynonymName);
}
for (HybridRelationship rel : newSynonymName.getHybridChildRelations()){
- if (!rel.getHybridName().isPersited()) {
+ if (!rel.getHybridName().isPersisted()) {
addToSaveList(rel.getHybridName());
}
- if (!rel.getParentName().isPersited()) {
+ if (!rel.getParentName().isPersisted()) {
addToSaveList(rel.getParentName());
}
}
HibernateProxyHelper.deproxy(element);
newSynonym = element.addHeterotypicSynonymName(newSynonymName);
for (HybridRelationship rel : newSynonymName.getHybridChildRelations()){
- if (!rel.getHybridName().isPersited()) {
+ if (!rel.getHybridName().isPersisted()) {
addToSaveList(rel.getHybridName());
}
- if (!rel.getParentName().isPersited()) {
+ if (!rel.getParentName().isPersisted()) {
addToSaveList(rel.getParentName());
}
}
import org.eclipse.core.runtime.IStatus;
import eu.etaxonomy.cdm.api.application.ICdmRepository;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator;
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
*/
public DeleteMisapplicationOperation(String label, IUndoContext undoContext, TaxonBaseDeletionConfigurator configurator,
- Taxon taxon, Taxon misapplication, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled,ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
- //super(label, undoContext, taxon, postOperationEnabled);
- super(label, undoContext, configurator, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
+ Taxon taxon, Taxon misapplication, IPostOperationEnabled postOperationEnabled, ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+
+ super(label, undoContext, configurator, postOperationEnabled, cdmEntitySessionEnabled);
this.misapplication = misapplication;
this.element = taxon;
}
import org.eclipse.core.runtime.Status;
import eu.etaxonomy.cdm.api.application.ICdmRepository;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator;
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
*/
public DeleteSynonymOperation(String label, IUndoContext undoContext, TaxonBaseDeletionConfigurator configurator,
- Taxon taxon, Synonym synonym, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled,ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
- super(label, undoContext, configurator, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
+ Taxon taxon, Synonym synonym, IPostOperationEnabled postOperationEnabled, ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, configurator, postOperationEnabled, cdmEntitySessionEnabled);
this.synonym = synonym;
this.element = taxon;
}
import org.eclipse.core.runtime.IProgressMonitor;\r
import org.eclipse.core.runtime.IStatus;\r
\r
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;\r
import eu.etaxonomy.cdm.api.service.DeleteResult;\r
import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator;\r
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;\r
IUndoContext undoContext,\r
TaxonBaseDeletionConfigurator configurator,\r
IPostOperationEnabled postOperationEnabled,\r
- IConversationEnabled conversationEnabled,\r
ICdmEntitySessionEnabled cdmEntitySessionEnabled) {\r
- super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);\r
+ super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);\r
this.configurator = configurator;\r
\r
}\r
+++ /dev/null
-/**
-* 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.editor.view.checklist;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-
-/**
- * @author a.oppermann
- * @created 30.04.2014
- */
-public class ChecklistEditorComparator extends ViewerComparator {
-
- private int propertyIndex;
- private static final int ASCENDING = 0;
- private static final int DESCENDING = 1;
- private int direction = ASCENDING;
-
- public ChecklistEditorComparator() {
- this.propertyIndex = 1;
- direction = ASCENDING;
- }
-
- public void setColumn(int column) {
- if (column == this.propertyIndex) {
- // Same column as last sort; toggle the direction
- direction = 1 - direction;
- } else {
- // New column; do an ascending sort
- this.propertyIndex = column;
- direction = DESCENDING;
- }
- }
-
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- Taxon d1 = (Taxon) e1;
- Taxon d2 = (Taxon) e2;
-
- int result = 0;
-
- switch (propertyIndex) {
-
- default:
- result = d1.getTitleCache().compareTo(d2.getTitleCache());
- }
-
- // If descending order, flip the direction
- if (direction == DESCENDING) {
- result = -result;
- }
- return result;
- }
-}
\ No newline at end of file
+++ /dev/null
-/**
-* Copyright (C) 2013 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.editor.view.checklist;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
-
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPersistable;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
-import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * @author a.oppermann
- * @date 25.04.2014
- */
-public class ChecklistEditorInput extends CdmEntitySessionInput<TaxonNode> implements IPersistable {
-
- /**
- * The selected classification
- */
- private TaxonNode taxonNode = null;
-
- private List<TaxonBase> taxa = new ArrayList<>();
-
- private Classification classification = null;
-
- private final ConversationHolder conversation;
-
- private List<TaxonBase> taxaToSave = new ArrayList<>();
-
-
- /**
- * Creates an editor input for the {@link ChecklistView} with the currently selected TaxonNode
- * and its childNodes.
- * @param taxonNode
- */
- public ChecklistEditorInput(TaxonNode taxonNode){
- super(false);
- this.conversation = CdmStore.createConversation();
- initSession();
- this.taxonNode =CdmStore.getService(ITaxonNodeService.class).load(taxonNode.getUuid(), getTaxonNodePropertyPaths());
- getChildTaxa(taxonNode);
- classification = taxonNode.getClassification();
-
- }
-
- private void getChildTaxa(TaxonNode taxonNode2) {
-// taxonNode2.removeNullValueFromChildren();
- if (taxonNode2.hasChildNodes()){
- for (TaxonNode node: taxonNode2.getChildNodes()){
- node = CdmStore.getService(ITaxonNodeService.class).load(node.getUuid(), getTaxonNodePropertyPaths());
- taxa.add(HibernateProxyHelper.deproxy(node.getTaxon(), Taxon.class));
- getChildTaxa(node);
- }
- }
- }
-
- /**
- * Creates an editor input for the {@link ChecklistView} with the currently selected classification.
- * @param classificationUuid
- */
- public ChecklistEditorInput(Classification classification) {
- super(true);
- this.conversation = CdmStore.createConversation();
- initSession();
- this.classification = CdmStore.getCurrentApplicationConfiguration().getClassificationService().load(classification.getUuid());
- getChildTaxa(classification.getRootNode());
-
- }
-
- public List<TaxonBase> getTaxa() {
- return taxa;
- }
-
- public String getName() {
- if(taxonNode != null && taxonNode.getTaxon()!=null){
- return taxonNode.getTaxon().getName().getTitleCache();
- }else{
- return classification.getTitleCache();
- }
- }
-
- public TaxonNode getTaxonNode() {
- return taxonNode;
- }
-
- public Classification getClassification(){
- return classification;
- }
-
-// public ConversationHolder getConversationHolder() {
-// return conversationHolder;
-// }
-
-// @Override
-// public int hashCode() {
-// final int prime = 31;
-// int result = 1;
-// result = prime * result + ((classification == null) ? 0 : classification.hashCode());
-// result = prime * result + ((taxonNode == null) ? 0 : taxonNode.hashCode());
-// return result;
-// }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ChecklistEditorInput other = (ChecklistEditorInput) obj;
- if (classification == null) {
- if (other.classification != null) {
- return false;
- }
- } else if (!classification.equals(other.classification)) {
- return false;
- }
- if (taxonNode == null) {
- if (other.taxonNode != null) {
- return false;
- }
- } else if (!taxonNode.equals(other.taxonNode)) {
- return false;
- }
- return true;
- }
-
- @Override
- public void saveState(IMemento memento) {
- UUID uuid = classification.getUuid();
- }
-
- @Override
- public void merge() {
- if (!getCdmEntitySession().isActive()){
- getCdmEntitySession().bind();
- }
- CdmStore.getService(ITaxonService.class).merge(taxaToSave, true);
- }
-
- @Override
- public List<TaxonNode> getRootEntities() {
- return Arrays.asList(taxonNode);
- }
-
- public ConversationHolder getConversation() {
- return conversation;
- }
-
- private List<String> getTaxonNodePropertyPaths() {
- List<String> taxonNodePropertyPaths = new ArrayList<String>();
- for(String propertyPath : getTaxonBasePropertyPaths()) {
- taxonNodePropertyPaths.add("taxon." + propertyPath); //$NON-NLS-1$
- }
- return taxonNodePropertyPaths;
- }
-
- private List<String> getTaxonBasePropertyPaths() {
- List<String> taxonBasePropertyPaths = Arrays.asList(new String[] {
- "sec", //$NON-NLS-1$
- "rights", //$NON-NLS-1$
- "sources", //$NON-NLS-1$
- "descriptions", //$NON-NLS-1$
- "descriptions.descriptionElements.feature", //$NON-NLS-1$
- "descriptions.descriptionElements.area", //$NON-NLS-1$
- "descriptions.descriptionElements.status", //$NON-NLS-1$
- "descriptions.markers", //$NON-NLS-1$
-
- });
-
- return taxonBasePropertyPaths;
- }
-
- public void setTaxa(List<TaxonBase> taxonList) {
- this.taxa = taxonList;
-
- }
-
- /**
- * @param element
- */
- public void addTaxonToSave(Taxon element) {
- this.taxaToSave.add(element);
-
- }
-
-// @Override
-// public void dispose(){
-// conversation.unbind();
-// conversation.close();
-// getCdmEntitySession().dispose();
-// super.dispose();
-// }
-
-}
\ No newline at end of file
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import eu.etaxonomy.cdm.model.description.Distribution;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.cdm.model.metadata.DistributionDescription;
import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
/**
* @author k.luther
}
dist = Distribution.NewInstance(area, ((StatusHelper)newValue).term);
Set<TaxonDescription> descs = taxonWrapper.getDescriptionsWrapper().getDescriptions();
- TaxonDescription desc;
+ TaxonDescription desc = null;
if (descs.size() >= 1){
- desc = descs.iterator().next();
+ Iterator<TaxonDescription> itDesc = descs.iterator();
+ while(itDesc.hasNext()) {
+ TaxonDescription next = itDesc.next();
+ if (next.isDefault()) {
+ desc = next;
+ break;
+ }
+ }
+
+ if (desc == null) {
+ if (PreferencesUtil.getDescriptionForChecklistEditor().equals(DistributionDescription.AlwaysDefault)){
+ desc = TaxonDescription.NewInstance();
+ desc.setDefault(true);
+ taxonWrapper.getDescriptionsWrapper().getDescriptions().add(desc);
+ }else {
+ desc = descs.iterator().next();
+ }
+ }
}else {
desc = TaxonDescription.NewInstance();
+ desc.setDefault(true);
+
taxonWrapper.getDescriptionsWrapper().getDescriptions().add(desc);
}
if (editor.getDefaultSource() != null){
dist.addSource(DescriptionElementSource.NewPrimarySourceInstance(editor.getDefaultSource(), null));
}
desc.addElement(dist);
- if(desc.isPersited()){
+ if(desc.isPersisted()){
editor.part.getCdmEntitySession().load(desc, true);
}
distributions.add(dist);
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.UUID;
+import java.util.stream.Collectors;
import org.apache.commons.collections4.map.LinkedMap;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.wizard.WizardDialog;
import ca.odell.glazedlists.BasicEventList;
import ca.odell.glazedlists.EventList;
-import eu.etaxonomy.cdm.api.service.IVocabularyService;
+import eu.etaxonomy.cdm.api.service.ITermCollectionService;
+import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.api.service.dto.TaxonDescriptionDTO;
import eu.etaxonomy.cdm.api.service.dto.TaxonDistributionDTO;
import eu.etaxonomy.cdm.compare.term.OrderedTermComparator;
import eu.etaxonomy.cdm.model.metadata.TermOrder;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
-import eu.etaxonomy.cdm.model.term.OrderedTermBase;
import eu.etaxonomy.cdm.model.term.Representation;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.model.term.TermVocabulary;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
+import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.taxeditor.editor.IDistributionEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
* @author k.luther
* @since 27.11.2018
*/
-public class DistributionEditor extends Composite implements IDistributionEditor{
+public class DistributionEditor extends Composite implements IDistributionEditor {
@SuppressWarnings("unused")
- private static final Logger logger = LogManager.getLogger(DistributionEditor.class);
+ private static final Logger logger = LogManager.getLogger();
private static final String DISTRIBUTION_EDITOR = "Distribution Editor"; //$NON-NLS-1$
private static final String LOADING_TAXA = Messages.ChecklistEditor_LOAD_TAXA;
static final String RANK_COLUMN = "collector_column";//$NON-NLS-1$
static final String SYNONYM_COLUMN = "synonym_column";//$NON-NLS-1$
-
private NatTable natTable;
private Label statusLabel;
private Label statusLabelSourceReference;
private Reference defaultSource;
- private Map<Integer, NamedArea> areaToColumnIndexMap= new HashMap<>();
+ private Map<Integer, NamedArea> areaToColumnIndexMap = new HashMap<>();
private int firstDataColumnIndex;
private ListDataProvider<TaxonDistributionDTO> bodyDataProvider;
protected EventList<TaxonDistributionDTO> taxonList;
private String actualNameCache;
- protected Map<UUID,Map<NamedArea,Set<DescriptionElementBase>>> taxonDistributionMap = new HashMap<>();
+ protected Map<UUID, Map<NamedArea, Set<DescriptionElementBase>>> taxonDistributionMap = new HashMap<>();
protected List<TaxonDistributionDTO> descriptionsToSave = new ArrayList<>();
composite.setLayoutData(gridData);
composite.setLayout(gridLayout);
-
gridData = new GridData();
gridData.horizontalSpan = 1;
gridData.grabExcessHorizontalSpace = true;
statusLabelSourceReference.setLayoutData(gridData);
- if (defaultSource != null){
- statusLabelSourceReference.setText(Messages.DistributionEditor_defaultSource + (defaultSource.getAbbrevTitle() != null? defaultSource.getAbbrevTitle() : defaultSource.getAbbrevTitleCache()));
+ if (defaultSource != null) {
+ statusLabelSourceReference.setText(Messages.DistributionEditor_defaultSource
+ + (defaultSource.getAbbrevTitle() != null ? defaultSource.getAbbrevTitle()
+ : defaultSource.getAbbrevTitleCache()));
}
- button3 = new Button(composite, SWT.PUSH );
+ button3 = new Button(composite, SWT.PUSH);
button3.setEnabled(false);
GridData gridData3 = new GridData();
gridData3.horizontalAlignment = SWT.RIGHT;
button3.setLayoutData(gridData3);
- //button3.setText(Messages.ChecklistEditor_REMOVE_DEFAULT_SOURCE);
+ // button3.setText(Messages.ChecklistEditor_REMOVE_DEFAULT_SOURCE);
button3.setImage(ImageResources.getImage(ImageResources.TRASH_ICON));
button3.setToolTipText(Messages.ChecklistEditor_REMOVE_DEFAULT_SOURCE_TOOLTIP);
button3.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
defaultSource = null;
- String defaultSourceStr = (defaultSource == null) ? "" : Messages.DistributionEditor_defaultSource + defaultSource.getTitleCache(); //$NON-NLS-1$
- if (defaultSourceStr.length()> 100){
+ String defaultSourceStr = (defaultSource == null) ? "" //$NON-NLS-1$
+ : Messages.DistributionEditor_defaultSource + defaultSource.getTitleCache();
+ if (defaultSourceStr.length() > 100) {
defaultSourceStr = defaultSourceStr.substring(0, 98) + "..."; //$NON-NLS-1$
}
statusLabelSourceReference.setText(defaultSourceStr);
});
}
- private void applyStyles(){
+ private void applyStyles() {
CdmModernNatTableThemeConfiguration configuration = new CdmModernNatTableThemeConfiguration();
-// configuration.summaryRowHAlign = HorizontalAlignmentEnum.CENTER;
+ // configuration.summaryRowHAlign = HorizontalAlignmentEnum.CENTER;
// NOTE: Getting the colors and fonts from the GUIHelper ensures that
// they are disposed properly (required by SWT)
configuration.cHeaderBgColor = GUIHelper.getColor(211, 211, 211);
natTable.addConfiguration(configuration);
}
- private void configureNatTable(ConfigRegistry configRegistry,
- AbstractLayer topMostLayer) {
+ private void configureNatTable(ConfigRegistry configRegistry, AbstractLayer topMostLayer) {
/**
* CONFIGURATION
*/
natTable.setConfigRegistry(configRegistry);
- //add default configuration because autoconfigure is set to false in constructor
+ // add default configuration because autoconfigure is set to false in
+ // constructor
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
-
natTable.addConfiguration(new DefaultColumnHeaderStyleConfiguration() {
{
TextPainter painter = new TextPainter();
}
});
-// applyStyles();
+ // applyStyles();
// override the default sort configuration and change the mouse bindings
// to sort on a single click
// with hide/show actions
natTable.addConfiguration(new DistributionEditorHeaderMenuConfiguration(natTable));
- // add custom configuration for data conversion and add column labels to viewport layer
+ // add custom configuration for data conversion and add column labels to
+ // viewport layer
topMostLayer.addConfiguration(new DistributionCellEditorDataConversionConfiguration(this));
applyStyles();
natTable.configure();
}
- public void createTable(){
+ public void createTable() {
/**
* layers
*/
/**
* configuration
*/
- configureNatTable( configRegistry, topMostLayer);
+ configureNatTable(configRegistry, topMostLayer);
/**
* handlers and listeners
FreezeHelper.freeze(freezeLayer, bodyLayerStack.getViewPortLayer(),
new PositionCoordinate(bodyLayerStack.getViewPortLayer(), 0, 0),
new PositionCoordinate(bodyLayerStack.getViewPortLayer(), 0, -1));
- //grab all space
+ // grab all space
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
this.layout();
natTable.doCommand(new ClientAreaResizeCommand(natTable));
- // boolean ok = natTable.doCommand(new ClientAreaResizeCommand(natTable));
+ // boolean ok = natTable.doCommand(new
+ // ClientAreaResizeCommand(natTable));
}
private void createLayers() {
DistributionColumnAccessor columnPropertyAccessor = new DistributionColumnAccessor(this);
DistributionEditorConfigLabelAccumulator labelAccumulator = new DistributionEditorConfigLabelAccumulator(this);
-// bodyLayerStack = new BodyLayerStack<>(taxonList, columnPropertyAccessor, new TaxonDistributionDtoComparator(), labelAccumulator);
+ // bodyLayerStack = new BodyLayerStack<>(taxonList,
+ // columnPropertyAccessor, new TaxonDistributionDtoComparator(),
+ // labelAccumulator);
bodyLayerStack = new BodyLayerStack<>(taxonList, columnPropertyAccessor, null, labelAccumulator);
bodyDataProvider = bodyLayerStack.getBodyDataProvider();
propertyToLabelMap.put(TAXON_COLUMN, Messages.ChecklistEditor_TAXON);
- if (isShowRank){
+ if (isShowRank) {
propertyToLabelMap.put(RANK_COLUMN, Messages.ChecklistEditor_RANK);
propertyToLabelMap.put(SYNONYM_COLUMN, Messages.ChecklistEditor_SYNONYMS);
- }else{
+ } else {
propertyToLabelMap.put(SYNONYM_COLUMN, Messages.ChecklistEditor_SYNONYMS);
}
configRegistry = new ConfigRegistry();
this.selectionLayer = bodyLayerStack.getSelectionLayer();
freezeLayer = new FreezeLayer(selectionLayer);
- final CompositeFreezeLayer compositeFreezeLayer = new CompositeFreezeLayer(
- freezeLayer, bodyLayerStack.getViewPortLayer(), selectionLayer);
+ final CompositeFreezeLayer compositeFreezeLayer = new CompositeFreezeLayer(freezeLayer,
+ bodyLayerStack.getViewPortLayer(), selectionLayer);
// as the selection mouse bindings are registered for the region label
// GridRegion.BODY
- // we need to set that region label to the viewport so the selection via mouse
+ // we need to set that region label to the viewport so the selection via
+ // mouse
// is working correctly
compositeFreezeLayer.setRegionName(GridRegion.BODY);
- IDataProvider columnHeaderDataProvider =
- new DefaultColumnHeaderDataProvider(propertyToLabelMap.values().toArray(new String[] {}), propertyToLabelMap);
+ IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(
+ propertyToLabelMap.values().toArray(new String[] {}), propertyToLabelMap);
DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
- ILayer columnHeaderLayer = new ColumnHeaderLayer(
- columnHeaderDataLayer,
- compositeFreezeLayer,
- selectionLayer);
-
- FilterRowHeaderComposite<TaxonDistributionDTO> filterRowHeaderLayer =
- new FilterRowHeaderComposite<>(
- new DefaultGlazedListsFilterStrategy<>(
- bodyLayerStack.getFilterList(),
- columnPropertyAccessor,
- configRegistry),
- columnHeaderLayer,
- columnHeaderDataLayer.getDataProvider(),
- configRegistry);
-
- // build the row header layer stack
+ ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, compositeFreezeLayer, selectionLayer);
+
+ FilterRowHeaderComposite<TaxonDistributionDTO> filterRowHeaderLayer = new FilterRowHeaderComposite<>(
+ new DefaultGlazedListsFilterStrategy<>(bodyLayerStack.getFilterList(), columnPropertyAccessor,
+ configRegistry),
+ columnHeaderLayer, columnHeaderDataLayer.getDataProvider(), configRegistry);
+
+ // build the row header layer stack
IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyDataProvider);
DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
- ILayer rowHeaderLayer = new RowHeaderLayer(
- rowHeaderDataLayer,
- compositeFreezeLayer,
- selectionLayer);
-
- IDataProvider cornerDataProvider =
- new DefaultCornerDataProvider(
- columnHeaderDataProvider,
- rowHeaderDataProvider);
+ ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, compositeFreezeLayer, selectionLayer);
+
+ IDataProvider cornerDataProvider = new DefaultCornerDataProvider(columnHeaderDataProvider,
+ rowHeaderDataProvider);
DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
- ILayer cornerLayer = new CornerLayer(
- cornerDataLayer,
- rowHeaderLayer,
- filterRowHeaderLayer);
+ ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer, filterRowHeaderLayer);
- GridLayer gridLayer = new GridLayer(
- compositeFreezeLayer,
- filterRowHeaderLayer,
- rowHeaderLayer,
- cornerLayer);
+ GridLayer gridLayer = new GridLayer(compositeFreezeLayer, filterRowHeaderLayer, rowHeaderLayer, cornerLayer);
natTable.setLayer(gridLayer);
topMostLayer = compositeFreezeLayer;
private Text createSearchBar(Composite parent) {
- Button button1 = new Button(parent, SWT.PUSH );
+ Button button1 = new Button(parent, SWT.PUSH);
GridData gridData2 = new GridData();
gridData2.horizontalSpan = 1;
gridData2.horizontalAlignment = SWT.RIGHT;
@Override
public void widgetSelected(SelectionEvent event) {
AvailableDistributionWizard availableDistributionWizard = new AvailableDistributionWizard();
- WizardDialog dialog = new WizardDialog(AbstractUtility.getShell(),
- availableDistributionWizard);
+ WizardDialog dialog = new WizardDialog(AbstractUtility.getShell(), availableDistributionWizard);
int open = dialog.open();
- if(open == 0){
+ if (open == 0) {
reload();
}
}
});
- button2 = new Button(parent, SWT.PUSH );
+ button2 = new Button(parent, SWT.PUSH);
GridData gridData3 = new GridData();
gridData3.horizontalAlignment = SWT.RIGHT;
public void widgetSelected(SelectionEvent event) {
defaultSource = ReferenceSelectionDialog.select(AbstractUtility.getShell(), null);
- String defaultSourceStr = (defaultSource == null) ? "" : Messages.DistributionEditor_defaultSource + defaultSource.getTitleCache(); //$NON-NLS-1$
- if (defaultSourceStr.length()> 100){
+ String defaultSourceStr = (defaultSource == null) ? "" //$NON-NLS-1$
+ : Messages.DistributionEditor_defaultSource + defaultSource.getTitleCache();
+ if (defaultSourceStr.length() > 100) {
defaultSourceStr = defaultSourceStr.substring(0, 98) + "..."; //$NON-NLS-1$
}
statusLabelSourceReference.setText(defaultSourceStr);
button2.setBackground(AbstractUtility.getColor(Resources.COLOR_CONTROL_SELECTED));
-// EventUtility.postEvent(WorkbenchEventConstants.REFRESH_DETAILS, true);
+ // EventUtility.postEvent(WorkbenchEventConstants.REFRESH_DETAILS,
+ // true);
button3.setEnabled(true);
button2.setText(Messages.ChecklistEditor_SWITCH_DEFAULT_SOURCE);
}
parent.pack();
return searchText;
}
+
/**
- * This method should only be called for adding new Distribution columns and reloading the table.<br>
- * It will hide the old distribution column and load the newly added columns.<br>
- * <p>
- * <b>Notice:</b> for data update please use <b>refresh()</b>
- *
- */
- public void reload(){
- this.areaToColumnIndexMap.clear();
- this.areas.clear();
- this.propertyToLabelMap.clear();
- createTable();
- natTable.redraw();
+ * This method should only be called for adding new Distribution columns and
+ * reloading the table.<br>
+ * It will hide the old distribution column and load the newly added
+ * columns.<br>
+ * <p>
+ * <b>Notice:</b> for data update please use <b>refresh()</b>
+ *
+ */
+ public void reload() {
+ this.areaToColumnIndexMap.clear();
+ this.areas.clear();
+ this.propertyToLabelMap.clear();
+ createTable();
+ natTable.redraw();
}
private void createTopComposite(Composite parent) {
parent.setLayout(gridLayout);
searchText = createSearchBar(parent);
-
}
+
public void loadDistributions(List<TaxonDistributionDTO> taxonList) {
- if (this.taxonList == null){
+ if (this.taxonList == null) {
this.taxonList = new BasicEventList<>();
}
- taxonList.stream().forEach(wrapper->DistributionEditor.this.taxonList.add(wrapper));
- statusLabel.setText(ELEMENT_COUNT + taxonList.size());
- createTaxonDistributionMap();
+ taxonList.stream().forEach(wrapper -> DistributionEditor.this.taxonList.add(wrapper));
+ statusLabel.setText(ELEMENT_COUNT + taxonList.size());
+ createTaxonDistributionMap();
}
protected void createTaxonDistributionMap() {
Iterator<TaxonDistributionDTO> iterator = this.taxonList.iterator();
- while (iterator.hasNext()){
+ while (iterator.hasNext()) {
TaxonDistributionDTO dto = iterator.next();
TaxonDescriptionDTO descriptionDto = dto.getDescriptionsWrapper();
- for (TaxonDescription desc: descriptionDto.getDescriptions()){
- if(this.part.getCdmEntitySession()!=null){
+ for (TaxonDescription desc : descriptionDto.getDescriptions()) {
+ if (this.part.getCdmEntitySession() != null) {
this.part.getCdmEntitySession().load(desc, true);
}
- for (DescriptionElementBase descElement: desc.getElements()){
- if (descElement instanceof Distribution){
- Map<NamedArea, Set<DescriptionElementBase>> distributionsMap = taxonDistributionMap.get(dto.getTaxonUuid());
+ for (DescriptionElementBase descElement : desc.getElements()) {
+ if (descElement instanceof Distribution) {
+ Map<NamedArea, Set<DescriptionElementBase>> distributionsMap = taxonDistributionMap
+ .get(dto.getTaxonUuid());
- if (distributionsMap == null){
+ if (distributionsMap == null) {
distributionsMap = new HashMap<>();
taxonDistributionMap.put(dto.getTaxonUuid(), distributionsMap);
}
- Set<DescriptionElementBase> distributions = distributionsMap.get(((Distribution) descElement).getArea());
- if (distributions == null){
+ Set<DescriptionElementBase> distributions = distributionsMap
+ .get(((Distribution) descElement).getArea());
+ if (distributions == null) {
distributions = new HashSet<>();
- distributionsMap.put(((Distribution)descElement).getArea(), distributions);
+ distributionsMap.put(((Distribution) descElement).getArea(), distributions);
}
distributions.add(descElement);
}
private void initLabels() {
int index = 2;
- if (isShowRank){
+ if (isShowRank) {
index++;
}
loadNamedAreas();
- if (areas == null){
+ if (areas == null) {
areas = new TreeSet<>();
}
- for (DefinedTermBase<?> area: areas) {
- this.areaToColumnIndexMap.put(index++, (NamedArea)area);
+ for (DefinedTermBase<?> area : areas) {
+ this.areaToColumnIndexMap.put(index++, (NamedArea) area);
String areaLabel;
- //TODO: adapt to preference
+ // TODO: adapt to preference
Representation rep = area.getPreferredRepresentation(CdmStore.getDefaultLanguage());
String label = rep.getLabel();
- if (label == null){
+ if (label == null) {
label = area.getTitleCache();
}
- if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){
- if (area.getIdInVocabulary() != null){
+ if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()) {
+ if (area.getIdInVocabulary() != null) {
areaLabel = area.getIdInVocabulary();
- } else{
+ } else {
areaLabel = label;
}
- }else if (PreferencesUtil.isShowSymbol1InChecklistEditor()){
- if (area.getSymbol() != null){
+ } else if (PreferencesUtil.isShowSymbol1InChecklistEditor()) {
+ if (area.getSymbol() != null) {
areaLabel = area.getSymbol();
- } else{
+ } else {
areaLabel = label;
}
- }else if (PreferencesUtil.isShowSymbol2InChecklistEditor()){
- if (area.getSymbol2() != null){
+ } else if (PreferencesUtil.isShowSymbol2InChecklistEditor()) {
+ if (area.getSymbol2() != null) {
areaLabel = area.getSymbol2();
- } else{
+ } else {
areaLabel = label;
}
- }else{
+ } else {
areaLabel = label;
}
- //String areaLabel = area.getLabel();
+ // String areaLabel = area.getLabel();
String property = area.getUuid().toString();
propertyToLabelMap.put(property, areaLabel);
}
}
private SortedSet<NamedArea> loadNamedAreas() {
- //IPreferenceStore preferenceStore = PreferencesUtil.getPreferenceStore();
-
- String valuesAreas = PreferencesUtil.getStringValue(PreferencePredicate.AvailableDistributionAreaTerms.getKey(), true);
- String values = PreferencesUtil.getStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey());
- Set<UUID> uuidList = new HashSet<UUID>();
+ // IPreferenceStore preferenceStore =
+ // PreferencesUtil.getPreferenceStore();
+
+ String valuesAreas = PreferencesUtil.getStringValue(PreferencePredicate.AvailableDistributionAreaTerms.getKey(),
+ true);
+ String values = PreferencesUtil
+ .getStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey());
+ List<UUID> uuidList = new ArrayList<UUID>();
String[] split;
List<String> listValue;
List<NamedArea> termlist = new ArrayList<>();
listValue = Arrays.asList(split);
UUID uuid;
- for(String s : listValue){
+ for (String s : listValue) {
uuid = UUID.fromString(s);
uuidList.add(uuid);
}
}
- List<TermVocabulary<NamedArea>> vocs = new ArrayList<>();
- IVocabularyService service = CdmStore.getService(IVocabularyService.class);
- if (uuidList.isEmpty()){
- List<TermVocabulary<NamedArea>> vocList = CdmStore.getService(IVocabularyService.class).findByTermType(TermType.NamedArea, null);
+ List<TermCollectionDto> vocs = new ArrayList<>();
+ ITermCollectionService service = CdmStore.getService(ITermCollectionService.class);
+ if (uuidList.isEmpty()) {
+ List<TermCollectionDto> vocList = service.findCollectionDtoByTermType(TermType.NamedArea);
vocs.addAll(vocList);
- }else{
- vocs= (List)service.find(uuidList);
+ } else {
+ vocs = service.findTermCollectionDtoByUuids(uuidList);
}
- for (TermVocabulary<NamedArea> voc: vocs){
- termlist.addAll((List)service.getTerms(voc, null, null, null, null).getRecords());
+ Set<UUID> termUuids = new HashSet<UUID>();
+
+ ITermService termService = CdmStore.getService(ITermService.class);
+ for (TermCollectionDto voc : vocs) {
+ termUuids.addAll(voc.getTerms().stream().map(TermDto::getUuid).collect(Collectors.toList()));
}
+ termlist.addAll((List) termService.find(termUuids));
List<NamedArea> filteredList = new ArrayList<>();
if (valuesAreas != null && valuesAreas != "") {
split = valuesAreas.split(";"); //$NON-NLS-1$
listValue = Arrays.asList(split);
- for (NamedArea area: termlist){
+ for (NamedArea area : termlist) {
if (listValue.contains(area.getUuid().toString())) {
filteredList.add(area);
}
}
- }else{
+ } else {
filteredList.addAll(termlist);
}
TermOrder sortOrder = PreferencesUtil.getSortNamedAreasInDistributionEditor();
- if (sortOrder.equals(TermOrder.Natural)){
- areas = getTermsOrderedByVocabularyOrder(filteredList);
- } else if (sortOrder.equals(TermOrder.IdInVoc)){
+ if (sortOrder.equals(TermOrder.Natural)) {
+ areas = getTermsOrderedByVocabularyOrder(filteredList);
+ } else if (sortOrder.equals(TermOrder.IdInVoc)) {
areas = getTermsOrderedByIdInVocabulary(filteredList);
- }else{
- areas = getTermsOrderedByLabels(filteredList, CdmStore.getDefaultLanguage());
+ } else {
+ areas = getTermsOrderedByLabels(filteredList, CdmStore.getDefaultLanguage());
}
return null;
}
- public <T extends DefinedTermBase<T>> SortedSet<T> getTermsOrderedByLabels(List<T> listTerm,Language language){
+ public <T extends DefinedTermBase<T>> SortedSet<T> getTermsOrderedByLabels(List<T> listTerm, Language language) {
TermLanguageComparator<T> comp = new TermLanguageComparator<>(Language.DEFAULT(), language);
SortedSet<T> result = new TreeSet<>(comp);
- if(listTerm != null){
+ if (listTerm != null) {
result.addAll(listTerm);
}
TermIdInVocabularyComparator<T> comp = new TermIdInVocabularyComparator<>();
SortedSet<T> result = new TreeSet<>(comp);
- if(namedAreas != null){
+ if (namedAreas != null) {
result.addAll(namedAreas);
}
return result;
TermSymbol1Comparator<T> comp = new TermSymbol1Comparator<>();
SortedSet<T> result = new TreeSet<>(comp);
- if(namedAreas != null){
+ if (namedAreas != null) {
result.addAll(namedAreas);
}
return result;
TermSymbol2Comparator<T> comp = new TermSymbol2Comparator<>();
SortedSet<T> result = new TreeSet<>(comp);
- if(namedAreas != null){
+ if (namedAreas != null) {
result.addAll(namedAreas);
}
return result;
}
- public <T extends DefinedTermBase<T>> SortedSet<T> getTermsOrderedByVocabularyOrder(List<T> listAreas){
+ public <T extends DefinedTermBase<T>> SortedSet<T> getTermsOrderedByVocabularyOrder(List<T> listAreas) {
OrderedTermComparator<T> comp = new OrderedTermComparator<>();
boolean allOrderedTerms = true;
List<TermVocabulary<T>> alreadyOrderIndexNull = new ArrayList<>();
- for (T term: listAreas){
- if (!(term instanceof OrderedTermBase)){
+ for (T term : listAreas) {
+ if (!(term.isOrderRelevant())) {
allOrderedTerms = false;
break;
- }else if (((OrderedTermBase<?>)term).getOrderIndex() == 0){
- if(alreadyOrderIndexNull.contains(term.getVocabulary())) {
+ } else if (term.getOrderIndex() == 0) {
+ // Note by AM: when does orderIndex == 0 happen?
+ if (alreadyOrderIndexNull.contains(term.getVocabulary())) {
allOrderedTerms = false;
break;
- }else{
+ } else {
alreadyOrderIndexNull.add(term.getVocabulary());
}
}
}
- if (allOrderedTerms){
+ if (allOrderedTerms) {
SortedSet<T> result = new TreeSet<>(comp);
result.addAll(listAreas);
return result;
- }else{
+ } else {
return getTermsOrderedByLabels(listAreas, PreferencesUtil.getGlobalLanguage());
}
}
private void registerHandlersAndListeners(AbstractLayer topMostLayer) {
- //selection listener
+ // selection listener
E4SelectionListener<?> selectionListener = new DistributionCellSelectionListener(part.getSelectionService(),
selectionLayer, bodyDataProvider, part);
selectionLayer.addLayerListener(selectionListener);
selectionListener.setFullySelectedRowsOnly(false);
- //register handler for view configuration menu
- // natTable.registerCommandHandler(toolbar.getDisplayPersistenceDialogCommandHandler());
+ // register handler for view configuration menu
+ // natTable.registerCommandHandler(toolbar.getDisplayPersistenceDialogCommandHandler());
}
public IRowDataProvider<TaxonDistributionDTO> getBodyDataProvider() {
}
@Override
- public Reference getDefaultSource(){
+ public Reference getDefaultSource() {
return defaultSource;
}
-// /**
-// * @param result
-// */
-// public void reloadDistributions() {
-// loadDistributions(taxonList);
-//
-// }
+ // /**
+ // * @param result
+ // */
+ // public void reloadDistributions() {
+ // loadDistributions(taxonList);
+ //
+ // }
}
\ No newline at end of file
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.widgets.Composite;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IDescriptionService;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.persistence.dto.MergeResult;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.IDistributionEditorPart;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
* @since 28.11.2018
*/
public class DistributionEditorPart
- implements IE4SavablePart, IConversationEnabled, IDirtyMarkable,
+ implements IE4SavablePart, IDirtyMarkable,
ICdmEntitySessionEnabled<DescriptionBase>, IPartContentHasSupplementalData,
IPartContentHasDetails, IDistributionEditorPart {
private Collection<Taxon> rootEntities;
- private ConversationHolder conversation;
-
private ICdmEntitySession cdmEntitySession;
@Inject
@PostConstruct
public void create(Composite parent, IEclipseContext context) {
- if(CdmStore.isActive() && conversation==null){
- conversation = CdmStore.createConversation();
- }
if(cdmEntitySession == null){
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
}
}else {
sortMode = TaxonNodeSortMode.RankAndAlphabeticalOrder;
}
- this.taxonList = CdmStore.getService(ITaxonNodeService.class).getTaxonDistributionDTO(nodeUuids, TAXONNODE_PROPERTY_PATH,null, true, sortMode);
+ this.taxonList = CdmStore.getService(ITaxonNodeService.class).getTaxonDistributionDTO(nodeUuids, TAXONNODE_PROPERTY_PATH,null, true, sortMode, PreferencesUtil.getDescriptionForChecklistEditor());
// taxonList.stream().filter(taxonDistribution -> CdmStore.currentAuthentiationHasPermission(taxonDistribution.getTaxonUuid(), RequiredPermissions.TAXONNODE_EDIT));
if(taxonList!=null){
@Focus
public void setFocus(){
- if(conversation!=null){
- conversation.bind();
- }
if(cdmEntitySession != null) {
cdmEntitySession.bind();
}
return editor;
}
- @Override
- public void update(CdmDataChangeMap changeEvents) {
- // TODO Auto-generated method stub
- }
+
@PreDestroy
public void dispose(){
- if (conversation != null) {
- conversation.close();
- conversation = null;
- }
if(cdmEntitySession != null) {
cdmEntitySession.dispose();
cdmEntitySession = null;
public void forceDirty() {
// TODO Auto-generated method stub
}
-
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
+
@Persist
@Override
public void save(IProgressMonitor monitor) {
taxon = (Taxon)CdmStore.getService(ITaxonService.class).load(dto.getTaxonUuid());
}
taxon.addDescription(desc);
+ removeList.add(dto);
}
if (taxon != null){
MergeResult result = CdmStore.getService(ITaxonService.class).merge(taxon, true);
cdmEntitySession.load(editor.getDefaultSource(), true);
}
editor.createTaxonDistributionMap();
- conversation.commit();
+
this.dirty.setDirty(false);
editor.getDescriptionsToSave().clear();
}
+++ /dev/null
-/**
-* Copyright (C) 2014 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.editor.view.checklist.listener;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Text;
-
-import eu.etaxonomy.taxeditor.editor.view.checklist.filter.ChecklistEditorFilter;
-
-/**
- * @author alex
- * @date 27.06.2014
- *
- */
-public class ChecklistModifyListener implements ModifyListener {
-
- private final Text searchText;
- private final Viewer editor;
- private final ChecklistEditorFilter filter;
-
- /**
- *
- */
- public ChecklistModifyListener(Viewer editor, ChecklistEditorFilter filter, Text searchText) {
- this.editor = editor;
- this.filter = filter;
- this.searchText = searchText;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- @Override
- public void modifyText(ModifyEvent e) {
- filter.setSearchText(searchText.getText());
-
- }
-
-}
--- /dev/null
+/**
+* Copyright (C) 2022 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.editor.view.concept.e4;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Composite;
+
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
+
+class ConceptRelationViewer extends ListViewer {
+
+ public ConceptRelationViewer(Composite parent) {
+ super(parent);
+ }
+
+ @Override
+ public ISelection getSelection() {
+ ISelection selection = super.getSelection();
+ List<TaxonRelationship> relationships = new ArrayList<>();
+ if(selection instanceof IStructuredSelection && !selection.isEmpty()){
+ for(Iterator<?> iter = ((IStructuredSelection) selection).iterator();iter.hasNext();){
+ Object object = iter.next();
+ relationships.add(((Entry<TaxonRelationship, Taxon>)object).getKey());
+ }
+ return new StructuredSelection(relationships);
+ }
+ return selection;
+ }
+
+ @Override
+ public void setSelection(ISelection selection) {
+ super.setSelection(selection);
+ }
+}
\ No newline at end of file
* 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.editor.view.concept.e4;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map.Entry;
-
import javax.annotation.PostConstruct;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.services.EMenuService;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.swt.widgets.Composite;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
-import eu.etaxonomy.taxeditor.editor.key.e4.AbstractGraphKeyEditorE4;
+import eu.etaxonomy.taxeditor.editor.key.e4.AbstractGraphKeyEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
import eu.etaxonomy.taxeditor.editor.view.concept.ConceptContentProvider;
import eu.etaxonomy.taxeditor.editor.view.concept.ConceptLabelProvider;
import eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
-import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPartE4;
+import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPart;
import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
import eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4;
/**
- *
* @author pplitzner
* @date 21.08.2017
- *
*/
-public class ConceptViewPartE4 extends AbstractCdmEditorPartE4
-implements IPartContentHasDetails, IPartContentHasSupplementalData{
+public class ConceptViewPartE4 extends AbstractCdmEditorPart<ConceptRelationViewer>
+ implements IPartContentHasDetails, IPartContentHasSupplementalData{
@Override
public void selectionChanged_internal(Object selection, MPart activePart, MPart thisPart) {
if (!viewer.getControl().isDisposed()){
viewer.getControl().setEnabled(true);
}
- Object partObject = createPartObject(activePart);
+ Object partObject = getPartObject(activePart);
IStructuredSelection structuredSelection = createSelection(selection);
if (partObject instanceof DetailsPartE4 || partObject instanceof SupplementalDataPartE4
// description selected in this view
return;
}
- else if(partObject instanceof AbstractGraphKeyEditorE4){
+ else if(partObject instanceof AbstractGraphKeyEditor){
showEmptyPage();
}
else if(selection!=null){
conceptViewer.setLabelProvider(new ConceptLabelProvider());
- conceptViewer.setSorter(new ViewerSorter());
+ conceptViewer.setComparator(new ViewerComparator());
viewer = conceptViewer;
//create context menu
menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.editor.popupmenu.conceptview");
-
}
@Override
super.changed(object);
}
- private class ConceptRelationViewer extends ListViewer {
-
- public ConceptRelationViewer(Composite parent) {
- super(parent);
- }
-
- @Override
- public ISelection getSelection() {
- ISelection selection = super.getSelection();
- List<TaxonRelationship> relationships = new ArrayList<>();
- if(selection instanceof IStructuredSelection && !selection.isEmpty()){
- for(Iterator iter = ((IStructuredSelection) selection).iterator();iter.hasNext();){
- Object object = iter.next();
- relationships.add(((Entry<TaxonRelationship, Taxon>)object).getKey());
- }
- return new StructuredSelection(relationships);
- }
- return selection;
- }
-
- @Override
- public void setSelection(ISelection selection) {
- super.setSelection(selection);
- }
-
- }
-
@Override
protected String getViewName() {
return Messages.ConceptViewPart_VIEWER_NAME;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.swt.widgets.Shell;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4;
import eu.etaxonomy.taxeditor.editor.view.concept.operation.CreateConceptRelationOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
UUID uuid = (UUID) menuItem.getTransientData().get(commandId+".taxonRelationshipType.uuid");
TaxonRelationshipType taxonRelationshipType = HibernateProxyHelper.deproxy(CdmStore.getService(ITermService.class).load(uuid), TaxonRelationshipType.class);
- TaxonNameEditorE4 editor = null;
+ TaxonEditor editor = null;
ConceptViewPartE4 conceptView = (ConceptViewPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(conceptView.getSelectionProvidingPart());
- if(e4WrappedPart instanceof TaxonNameEditorE4){
- editor = (TaxonNameEditorE4) e4WrappedPart;
+ if(e4WrappedPart instanceof TaxonEditor){
+ editor = (TaxonEditor) e4WrappedPart;
IUndoContext undoContext = null;
- ConversationHolder conversationHolder = null;
+
Taxon taxon = null;
taxon = editor.getTaxon();
- conversationHolder = editor.getConversationHolder();
+
undoContext = editor.getUndoContext();
//FIXME should this also be enabled for bulk editor
// BulkEditor bulkEditor = (BulkEditor)activeEditor;
// ISelection selection = bulkEditor.getSelectionProvider().getSelection();
// taxon = (Taxon) ((IStructuredSelection)selection).getFirstElement();
- // conversationHolder = bulkEditor.getConversationHolder();
// undoContext = bulkEditor.getUndoContext();
// }
- Taxon relatedConcept = TaxonSelectionDialog.selectTaxon(shell, //conversationHolder,
- taxon);
-
+ Taxon relatedConcept = TaxonSelectionDialog.selectTaxon(shell, taxon);
if(relatedConcept == null){
return;
}
boolean isInverse = taxonRelationshipType.getInverseLabel().isEmpty()?false:true;
- TaxonRelationshipTypeInverseContainer typeInverseContainer =new TaxonRelationshipTypeInverseContainer(taxonRelationshipType, isInverse) ;
-
+ TaxonRelationshipTypeInverseContainer typeInverseContainer = new TaxonRelationshipTypeInverseContainer(taxonRelationshipType, isInverse) ;
- AbstractPostOperation operation = new CreateConceptRelationOperation(menuItem.getLocalizedLabel(),
+ AbstractPostOperation<?> operation = new CreateConceptRelationOperation(menuItem.getLocalizedLabel(),
undoContext, taxon, relatedConcept, typeInverseContainer, conceptView);
AbstractUtility.executeOperation(operation, sync);
}
ConceptViewPartE4 conceptView = (ConceptViewPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(conceptView.getSelectionProvidingPart());
- canExecute = e4WrappedPart instanceof TaxonNameEditorE4;
+ canExecute = e4WrappedPart instanceof TaxonEditor;
menuItem.setVisible(canExecute);
return canExecute;
}
import org.eclipse.jface.viewers.IStructuredSelection;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4;
import eu.etaxonomy.taxeditor.editor.view.concept.operation.DeleteConceptRelationOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
MMenuItem menuItem,
UISynchronize sync) {
- TaxonNameEditorE4 editor = null;
+ TaxonEditor editor = null;
ConceptViewPartE4 conceptView = (ConceptViewPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(conceptView.getSelectionProvidingPart());
- if(e4WrappedPart instanceof TaxonNameEditorE4){
- editor = (TaxonNameEditorE4) e4WrappedPart;
+ if(e4WrappedPart instanceof TaxonEditor){
+ editor = (TaxonEditor) e4WrappedPart;
Set<TaxonRelationship> relations = new HashSet<TaxonRelationship>();
import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditor;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
@Optional@Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection,
EModelService modelService, EPartService partService, MApplication application) {
- TaxonNameEditorE4 editor = null;
+ TaxonEditor editor = null;
BulkEditor bulkEditor = null;
TaxonRelationship taxonRelationship = (TaxonRelationship) selection.getFirstElement();
ConceptViewPartE4 conceptView = (ConceptViewPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(conceptView.getSelectionProvidingPart());
- if(e4WrappedPart instanceof TaxonNameEditorE4){
- editor = (TaxonNameEditorE4) e4WrappedPart;
+ if(e4WrappedPart instanceof TaxonEditor){
+ editor = (TaxonEditor) e4WrappedPart;
}
else if(e4WrappedPart instanceof BulkEditor){
bulkEditor = (BulkEditor) e4WrappedPart;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInput;
/**
* @author andreas
*/
@Override
public Object[] getElements(Object inputElement) {
- if(inputElement instanceof TaxonEditorInputE4){
- Taxon taxon = ((TaxonEditorInputE4) inputElement).getTaxon();
+ if(inputElement instanceof TaxonEditorInput){
+ Taxon taxon = ((TaxonEditorInput) inputElement).getTaxon();
Map<String, TaxonRelationship> filteredTaxonRelations = new HashMap<String, TaxonRelationship>();
getTaxonRelationshipsRecursive(filteredTaxonRelations, taxon);
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.services.EMenuService;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.zest.core.viewers.GraphViewer;
import org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm;
import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditor;
-import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInput;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.concept.graph.ConceptGraphContentProvider;
import eu.etaxonomy.taxeditor.editor.view.concept.graph.ConceptGraphLabelProvider;
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
import eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPartE4;
+import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPart;
import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
import eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4;
/**
- *
* @author pplitzner
* @since Sep 27, 2017
- *
*/
-public class ConceptGraphViewE4 extends AbstractCdmEditorPartE4 {
+public class ConceptGraphViewE4 extends AbstractCdmEditorPart<GraphViewer> {
public static final String ID = "eu.etaxonomy.taxeditor.editor.view.concept.graph"; //$NON-NLS-1$
private LayoutAlgorithm layoutAlgoritm;
- /**
- * {@inheritDoc}
- */
@Override
public void selectionChanged_internal(Object selection, MPart activePart, MPart thisPart) {
if(activePart==thisPart){
return;
}
- Object partObject = createPartObject(activePart);
+ Object partObject = getPartObject(activePart);
if (partObject instanceof DetailsPartE4 || partObject instanceof SupplementalDataPartE4
|| partObject instanceof FactualDataPartE4|| partObject instanceof MediaViewPartE4) {
return;
}
-
- if(partObject instanceof TaxonNameEditorE4){
+ if(partObject instanceof TaxonEditor){
if (viewer.getControl() != null && !viewer.getControl().isDisposed()) {
viewer.getControl().setEnabled(true);
}
- TaxonEditorInputE4 input = ((TaxonNameEditorE4) partObject).getEditorInput();
+ TaxonEditorInput input = ((TaxonEditor) partObject).getEditorInput();
showViewer(new StructuredSelection(input), activePart, viewer);
}
-
}
@Override
}
@Override
- public Viewer getViewer() {
+ public GraphViewer getViewer() {
return viewer;
}
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.api.filter.TaxonOccurrenceRelationType;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.derivate.searchFilter.DerivateSearchCompositeController;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
/**
* Displays the derivate hierarchy of the specimen specified in the editor input.
*/
-public class DerivateView implements IPartContentHasFactualData, IConversationEnabled,
+public class DerivateView implements IPartContentHasFactualData,
ICdmEntitySessionEnabled<SpecimenOrObservationBase<?>>, IDirtyMarkable, IPostOperationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, IPartContentHasMedia,
IContextListener, IE4SavablePart, ICollapsableExpandable {
private static final int WARN_THRESHOLD = 200;
-
- private ConversationHolder conversation;
-
private TreeViewer viewer;
private final int dndOperations = DND.DROP_MOVE;
public void createPartControl(Composite parent, EMenuService menuService,
IEclipseContext context) {
if (CdmStore.isActive()){
- if(conversation == null){
- conversation = CdmStore.createConversation();
- }
if(cdmEntitySession == null){
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
}
contentProvider = new DerivateContentProvider();
viewer.setContentProvider(contentProvider);
labelProvider = new DerivateLabelProvider();
- labelProvider.setConversation(conversation);
+
viewer.setLabelProvider(labelProvider);
viewer.getTree().setEnabled(CdmStore.isActive());
}
public void updateRootEntities(Collection<UUID> derivativeUuids) {
- if(conversation!=null){
- if (!conversation.isBound()) {
- conversation.bind();
- }
- /*
- * If the active session is not the session of the Derivative Editor
- * then we will save the active session for later, bind temporarily
- * to our session and rebind to the original session when we are
- * done. This happens e.g. if a selection change happens in the
- * taxon editor and "Link with editor" is enabled. The selection
- * change event and thus the loading in updateRootEntities() happens
- * in the session of the taxon editor.
- */
- ICdmEntitySession previousCdmEntitySession = CdmStore.getCurrentSessionManager().getActiveSession();
- if(cdmEntitySession != null) {
- cdmEntitySession.bind();
- }
- eventBroker.post(WorkbenchEventConstants.CURRENT_ACTIVE_EDITOR, null);
- List<SpecimenOrObservationBase> derivates = null;
- if(derivativeUuids!=null){
- this.derivateToRootEntityMap = new HashMap<>();
- this.rootElements = new HashSet<>();
- derivates = CdmStore.getService(IOccurrenceService.class).load(new ArrayList(derivativeUuids), SPECIMEN_INIT_STRATEGY);
- }
- updateRootEntities(derivates);
- if(previousCdmEntitySession!=null){
- previousCdmEntitySession.bind();
- }
+
+ /*
+ * If the active session is not the session of the Derivative Editor
+ * then we will save the active session for later, bind temporarily
+ * to our session and rebind to the original session when we are
+ * done. This happens e.g. if a selection change happens in the
+ * taxon editor and "Link with editor" is enabled. The selection
+ * change event and thus the loading in updateRootEntities() happens
+ * in the session of the taxon editor.
+ */
+ ICdmEntitySession previousCdmEntitySession = CdmStore.getCurrentSessionManager().getActiveSession();
+ if(cdmEntitySession != null) {
+ cdmEntitySession.bind();
+ }
+ eventBroker.post(WorkbenchEventConstants.CURRENT_ACTIVE_EDITOR, null);
+ List<SpecimenOrObservationBase> derivates = null;
+ if(derivativeUuids!=null){
+ this.derivateToRootEntityMap = new HashMap<>();
+ this.rootElements = new HashSet<>();
+ derivates = CdmStore.getService(IOccurrenceService.class).load(new ArrayList(derivativeUuids), SPECIMEN_INIT_STRATEGY);
+ }
+ updateRootEntities(derivates);
+ if(previousCdmEntitySession!=null){
+ previousCdmEntitySession.bind();
}
+
}
public void updateRootEntities(List<SpecimenOrObservationBase> derivates) {
public void save(IProgressMonitor monitor) {
String taskName = Messages.DerivateView_SAVING_HIERARCHY;
monitor.beginTask(taskName, 3);
- if (!conversation.isBound()) {
- conversation.bind();
- if (!cdmEntitySession.isActive()){
- cdmEntitySession.bind();
- }
+
+ if (!cdmEntitySession.isActive()){
+ cdmEntitySession.bind();
}
- monitor.worked(1);
- // commit the conversation and start a new transaction immediately
- conversation.commit(true);
+ monitor.worked(1);
for(AbstractPostOperation entry:operations){
IStatus status = Status.CANCEL_STATUS;
@Focus
public void setFocus() {
- //make sure to bind again if maybe in another view the conversation was unbound
- if(conversation!=null && !conversation.isBound()){
- conversation.bind();
- }
+ //make sure to bind again if maybe in another view the session was unbound
+
if(cdmEntitySession != null) {
cdmEntitySession.bind();
}
}
}
- @Override
- public void update(CdmDataChangeMap changeEvents) {
- }
-
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
@Override
public void changed(Object element) {
setDirty(true);
@PreDestroy
public void dispose() {
- if(conversation!=null){
- conversation.close();
- conversation = null;
- }
- if(cdmEntitySession != null) {
+ if(cdmEntitySession != null) {
cdmEntitySession.dispose();
cdmEntitySession = null;
}
}
if(listenToSelectionChange){
selectedTaxon = null;
- if(activePart.getObject() instanceof TaxonNameEditorE4){
- selectedTaxon = ((TaxonNameEditorE4) activePart.getObject()).getTaxon();
+ if(activePart.getObject() instanceof TaxonEditor){
+ selectedTaxon = ((TaxonEditor) activePart.getObject()).getTaxon();
}
else if(selection != null){
Object selectedElement = selection.getFirstElement();
}
}
if(selectedTaxon!=null){
- Collection<FieldUnit> fieldUnits = CdmStore.getService(IOccurrenceService.class).listRootUnitsByAssociatedTaxon(FieldUnit.class, selectedTaxon, null, null);
+ boolean includeUnpublished = true;
+ EnumSet<TaxonOccurrenceRelationType> associationFilter = TaxonOccurrenceRelationType.All();
+ Collection<FieldUnit> fieldUnits = CdmStore.getService(IOccurrenceService.class)
+ .listRootUnitsByAssociatedTaxon(FieldUnit.class, selectedTaxon, includeUnpublished, associationFilter, null, null);
Collection<UUID> uuids = new HashSet<>();
for (SpecimenOrObservationBase<?> specimenOrObservationBase : fieldUnits) {
uuids.add(specimenOrObservationBase.getUuid());
part.setLabel(SPECIMEN_EDITOR+Messages.DerivateView_NO_TAXON_SELECTED);
}
}
-
+
public DerivateSearchCompositeController getSearchController() {
return derivateSearchCompositeController;
}
-
+/**
+* Copyright (C) 2019 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.editor.view.derivate.handler;
import javax.inject.Named;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeNode;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeCacheStrategy;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacadeCacheStrategy;
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
import eu.etaxonomy.cdm.model.occurrence.DerivationEventType;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
private void refreshView(DerivateView derivateView, Object createdElement) {
if(derivateView!=null){
- derivateView.getConversationHolder().commit();
- derivateView.refreshTree(createdElement);
+ derivateView.refreshTree(createdElement);
}
}
CdmStore.getService(ITaxonService.class).merge(taxon);
- derivateView.getConversationHolder().commit();
derivateView.addFieldUnit(fieldUnit);
derivateView.updateRootEntities();
derivateView.refreshTree(fieldUnit);
FieldUnit fieldUnit = FieldUnit.NewInstance();
fieldUnit = CdmBase.deproxy(CdmStore.getService(IOccurrenceService.class).save(fieldUnit), FieldUnit.class);
- derivateView.getConversationHolder().commit();
derivateView.addFieldUnit(fieldUnit);
derivateView.updateRootEntities();
derivateView.refreshTree(fieldUnit);
sequence.addSingleRead(singleRead);
CdmStore.getService(ISequenceService.class).merge(sequence);
- derivateView.getConversationHolder().commit();
derivateView.refreshTree();
LocalSelectionTransfer.getTransfer().setSelection(null);
}
derivateView.remove(draggedNode.getValue());
}
//update DerivateView
- derivateView.getConversationHolder().commit();
LocalSelectionTransfer.getTransfer().setSelection(null);
return postExecute(null);
}
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Widget;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.api.service.config.FindOccurrencesConfigurator;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.taxeditor.store.SearchManager;
import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
import eu.etaxonomy.taxeditor.ui.mvc.combo.EnumTermComboController;
-import eu.etaxonomy.taxeditor.view.search.derivative.DerivateLabelProvider;
/**
* Controller class for the {@link DerivateSearchComposite}.<br>
private final DerivateSearchComposite derivateSearchComposite;
private EnumTermComboController<SpecimenOrObservationType> comboSpecimenTypeController;
- private DerivateLabelProvider labelProvider;
private Taxon selectedTaxon;
private DerivateView derivativeEditor;
derivateSearchComposite.getButtonSearch().addListener(SWT.Selection, this);
derivateSearchComposite.getBtnBrowseTaxa().addListener(SWT.Selection, this);
derivateSearchComposite.getBtnClearTaxon().addListener(SWT.Selection, this);
-
}
private void searchDerivates(){
searchDerivates();
}
else if(eventSource==derivateSearchComposite.getBtnBrowseTaxa()){
- selectedTaxon = SelectionDialogFactory.getSelectionFromDialog(Taxon.class, this.derivateSearchComposite.getShell(), //derivativeEditor.getConversationHolder(),
- null);
+ selectedTaxon = SelectionDialogFactory.getSelectionFromDialog(Taxon.class, this.derivateSearchComposite.getShell(), null);
if(selectedTaxon!=null){
derivateSearchComposite.getTextTaxonName().setText(selectedTaxon.getTitleCache());
}
derivateSearchComposite.getComboTaxonAssignment().select(DerivateSearchComposite.ALL_SPECIMENS);
derivateSearchComposite.getComboTaxonAssignment().setEnabled(true);
derivateSearchComposite.getLbltaxonAssignment().setEnabled(true);
-
+
}
}
selectedTaxon = null;
}
- public void setConversation(ConversationHolder conversationHolder) {
- labelProvider.setConversation(conversationHolder);
- }
+
public void setTaxonFilter(UUID taxonUuid) {
TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(taxonUuid);
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.cdm.model.description.SpecimenDescription;
-import eu.etaxonomy.cdm.model.description.TaxonDescription;
-import eu.etaxonomy.cdm.model.description.TaxonNameDescription;
+import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionElementsOperation;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
boolean isCopy = getCurrentOperation() == DND.DROP_COPY ? true : false;
DescriptionBase<?> description = null;
+ boolean containsSpecimen = false;
// cannot drop a feature node onto itself
if (droppedElements != null){
for (Object droppedElement : droppedElements) {
}
for (Object element : target.getElements()){
if (element instanceof DescriptionElementBase){
- if( !((DescriptionElementBase)element).isPersited()){
+ if( !((DescriptionElementBase)element).isPersisted()){
MessagingUtils.warningDialog(OPERATION_NOT_SUPPORTED_YET, this, Messages.DescriptionElementDropAdapter_NOT_SUPPORTED_NEW_ELEMENT_IN_DESCRIPTION);
return false;
}
}
for (Object element : descriptionElement.getInDescription().getElements()){
if (element instanceof DescriptionElementBase){
- if( !((DescriptionElementBase)element).isPersited()){
+ if( !((DescriptionElementBase)element).isPersisted()){
MessagingUtils.warningDialog(OPERATION_NOT_SUPPORTED_YET, this, Messages.DescriptionElementDropAdapter_NOT_SUPPORTED_NEW_ELEMENT_IN_DESCRIPTION);
return false;
}
description = descriptionElement.getInDescription();
description.removeElement(descriptionElement);
target.addElement(descriptionElement);
-
+ if (descriptionElement instanceof IndividualsAssociation && PreferencesUtil.getBooleanValue("AskForNewCurrentDetermination")) {
+ if (((IndividualsAssociation)descriptionElement).getAssociatedSpecimenOrObservation() != null && !((IndividualsAssociation)descriptionElement).getAssociatedSpecimenOrObservation().getDeterminations().isEmpty()) {
+ containsSpecimen = true;
+ }
+ }
descriptionElements.add(descriptionElement);
}
}
- TaxonNameEditorE4 editor = null;
+ TaxonEditor editor = null;
Object activePart = EditorUtil.getActivePart();
if (activePart instanceof FactualDataPartE4){
MPart selectionProvidingPart =((FactualDataPartE4)activePart).getSelectionProvidingPart();
Object obj = selectionProvidingPart.getObject();
- if (obj instanceof TaxonNameEditorE4){
- editor = (TaxonNameEditorE4) obj;
+ if (obj instanceof TaxonEditor){
+ editor = (TaxonEditor) obj;
}
}
- AbstractPostTaxonOperation operation = new MoveDescriptionElementsOperation(Messages.DescriptionElementDropAdapter_MOVE_DESC, EditorUtil.getUndoContext(), target, description, descriptionElements, isCopy, null, sync, false);
+
+
+ AbstractPostTaxonOperation operation = new MoveDescriptionElementsOperation(Messages.DescriptionElementDropAdapter_MOVE_DESC, EditorUtil.getUndoContext(), target, description, descriptionElements, isCopy, null, sync, false, containsSpecimen);
editor.getEditorInput().addOperation(operation);
editor.setDirty();
package eu.etaxonomy.taxeditor.editor.view.descriptive;
import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
-import org.eclipse.jface.viewers.StyledString;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
/**
* @author p.ciardelli
*/
-public class DescriptiveLabelProvider extends ColumnLabelProvider implements IStyledLabelProvider {
-
+public class DescriptiveLabelProvider extends ColumnLabelProvider {
private static final String TRUNCATE_SIGN = "..."; //$NON-NLS-1$
private static final int MAX_LENGTH = 150;
}
@Override
- public StyledString getStyledText(Object element) {
- return new StyledString(getText(element), StyledString.QUALIFIER_STYLER);
+ public Font getFont(Object element) {
+
+ Font result = super.getFont(element);
+ if (element instanceof DescriptionBase && ((DescriptionBase)element).isDefault()) {
+ FontData fontData = new FontData("Bold", 9, SWT.BOLD);
+ Font font = new Font(null, fontData);
+ return font;
+ }
+ return result;
+
+
+
}
@Override
public Image getImage(Object element) {
if(element instanceof DescriptionBase){
DescriptionBase<?> description = (DescriptionBase<?>)element;
+ if (!description.isPublish()) {
+ return ImageResources.getImage(ImageResources.PROHIBITED);
+ }
if(description.isComputed()){
return MatrixUtility.getAggregatedDescriptionIcon();
}
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* 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.editor.view.descriptive;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.viewers.ViewerComparator;
+import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.taxeditor.model.DescriptionHelper;
* @author n.hoffmann
* @created Dec 2, 2010
*/
-public class DescriptiveViewerSorter extends ViewerSorter {
+public class DescriptiveViewerComparator extends ViewerComparator {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
if((e1 instanceof DescriptionElementBase) && (e2 instanceof DescriptionElementBase)){
- return DescriptionHelper.getLabel((DescriptionElementBase)e1).compareTo(DescriptionHelper.getLabel((DescriptionElementBase)e2));
+ return DescriptionHelper.getLabel(e1).compareTo(DescriptionHelper.getLabel(e2));
+ }
+ if ((e1 instanceof DescriptionBase) && (e2 instanceof DescriptionBase) && (((DescriptionBase)e1).isDefault() || ((DescriptionBase)e2).isDefault())) {
+ if (((DescriptionBase) e1).isDefault()){
+ return -1;
+ }else {
+ return 1;
+ }
}
return super.compare(viewer, e1, e2);
}
import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditor;
import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDragListener;
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDropAdapter;
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementTransfer;
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveContentProvider;
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveLabelProvider;
-import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewerSorter;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewerComparator;
import eu.etaxonomy.taxeditor.editor.view.descriptive.NameDescriptionFilter;
import eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
-import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPartE4;
+import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPart;
import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
import eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4;
import eu.etaxonomy.taxeditor.workbench.part.ICollapsableExpandable;
* @author pplitzner
* @date 15.08.2017
*/
-public class FactualDataPartE4 extends AbstractCdmEditorPartE4
+public class FactualDataPartE4 extends AbstractCdmEditorPart<TreeViewer>
implements IPartContentHasDetails, IPartContentHasSupplementalData,
ICdmEntitySessionEnabled<CdmBase>, ICollapsableExpandable {
provider = new DescriptiveContentProvider(featureNodeContainerCache);
treeViewer.setContentProvider(provider);
treeViewer.setLabelProvider(new DescriptiveLabelProvider());
- treeViewer.setSorter(new DescriptiveViewerSorter());
+ treeViewer.setComparator(new DescriptiveViewerComparator());
treeViewer.setFilters(new NameDescriptionFilter());
treeViewer.setAutoExpandLevel(2);
Transfer[] transfers = new Transfer[] { DescriptionElementTransfer.getInstance() };
treeViewer.addDragSupport(dndOperations, transfers, new DescriptionElementDragListener(
this));
-
viewer = treeViewer;
// Propagate selection from viewer
@Override
public void selectionChanged_internal(Object selection, MPart activePart, MPart thisPart) {
- if(activePart==thisPart){
+ if(activePart == thisPart){
return;
}
- Object partObject = createPartObject(activePart);
+ Object partObject = getPartObject(activePart);
- if ((partObject instanceof DetailsPartE4 && !(selection instanceof TaxonName))|| partObject instanceof SupplementalDataPartE4
- || partObject instanceof MediaViewPartE4 || partObject instanceof ConceptViewPartE4 || ((partObject instanceof AbstractCdmEditorPartE4) &&(((AbstractCdmEditorPartE4)partObject).getViewer().getInput() instanceof DescriptionElementBase))) {
+ if ((partObject instanceof DetailsPartE4 && !(selection instanceof TaxonName) )
+ || partObject instanceof SupplementalDataPartE4
+ || partObject instanceof MediaViewPartE4
+ || partObject instanceof ConceptViewPartE4
+ || ((partObject instanceof AbstractCdmEditorPart) &&(((AbstractCdmEditorPart<?>)partObject).getViewer().getInput() instanceof DescriptionElementBase))) {
// do not show empty page as these views are also used to edit the
// description selected in this view
return;
}
Object firstElement = structuredSelection.getFirstElement();
- if (partObject instanceof TaxonNameEditorE4){
- if (firstElement != ((TaxonNameEditorE4)partObject).getTaxon()){
+ if (partObject instanceof TaxonEditor){
+ if (firstElement != ((TaxonEditor)partObject).getTaxon()){
showEmptyPage();
return;
}
&& partObject instanceof IPartContentHasFactualData
&& !(firstElement instanceof SpecimenOrObservationBase && partObject instanceof BulkEditor)){
// && !(firstElement instanceof TaxonName && partObject instanceof BulkEditor)){
- if (firstElement instanceof TaxonName ){
+ if (firstElement instanceof TaxonName){
thisPart.setLabel(Messages.NameFactsDataView_Lable);
}else if (firstElement instanceof TaxonBase){
thisPart.setLabel(Messages.TaxaFactsDataView_Lable);
public void changed(Object object) {
Object[] expandedObjects = null;
if (!viewer.getControl().isDisposed()){
- expandedObjects = ((TreeViewer)viewer).getExpandedElements();
+ expandedObjects = viewer.getExpandedElements();
}else{
return;
}
viewer.refresh();
super.changed(object);
- ((TreeViewer) viewer).setExpandedElements(expandedObjects);
+ viewer.setExpandedElements(expandedObjects);
if(object instanceof DescriptionElementBase){
DescriptionElementBase descriptionElement = (DescriptionElementBase) object;
DescriptionBase<?> description = descriptionElement.getInDescription();
}
((AbstractTreeViewer) viewer).expandToLevel(featureNodeContainer, 2);
}
- if (object != null){
- StructuredSelection selection = new StructuredSelection(object);
- viewer.setSelection(selection, true);
- }
-
+ StructuredSelection selection = new StructuredSelection(object);
+ viewer.setSelection(selection, true);
}
-
-
-
}
@Inject
@Optional
private void updateView(@UIEventTopic(WorkbenchEventConstants.SAVE_TAXON)boolean refresh){
if(refresh){
- Object[] expandedObjects = ((TreeViewer)viewer).getExpandedElements();
+ Object[] expandedObjects = viewer.getExpandedElements();
viewer.refresh();
- ((TreeViewer)viewer).collapseAll();
+ viewer.collapseAll();
if (expandedObjects.length>0){
- ((TreeViewer)viewer).setExpandedElements(expandedObjects);
+ viewer.setExpandedElements(expandedObjects);
}
}
}
-
@Inject
@Optional
private void updateView(@UIEventTopic(WorkbenchEventConstants.CURRENT_ACTIVE_EDITOR)ITaxonEditor editor){
}
}
- /**
- * {@inheritDoc}
- */
@Override
public void collapse() {
- if(viewer instanceof TreeViewer) {
- ((TreeViewer) viewer).collapseAll();
- }
+ viewer.collapseAll();
}
- /**
- * {@inheritDoc}
- */
@Override
public void expand() {
- if(viewer instanceof TreeViewer) {
- ((TreeViewer) viewer).expandAll();
- }
+ viewer.expandAll();
}
public void toggleShowOnlyIndividualAssociations(){
public List<CdmBase> getRootEntities() {
return Arrays.asList((CdmBase)getViewer().getInput());
}
+
@Override
public Map<Object, List<String>> getPropertyPathsMap() {
return null;
@Override
protected void showViewer(IStructuredSelection selection, MPart activePart, Viewer viewer){
Object[] expandedObjects = null;
- if (!((TreeViewer)this.getViewer()).getControl().isDisposed()){
- expandedObjects = ((TreeViewer)this.getViewer()).getExpandedElements();
+ if (!this.getViewer().getControl().isDisposed()){
+ expandedObjects = this.getViewer().getExpandedElements();
}
super.showViewer(selection, activePart, viewer);
if (expandedObjects == null || expandedObjects.length == 0){
- ((TreeViewer)this.viewer).expandToLevel(2);
+ this.viewer.expandToLevel(2);
}else{
- ((TreeViewer)this.viewer).setExpandedElements(expandedObjects);
+ this.viewer.setExpandedElements(expandedObjects);
}
}
}
\ No newline at end of file
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.Feature;
+import eu.etaxonomy.cdm.model.description.TaxonDescription;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateDescriptionElementOperation;
+import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
String commandId = menuItem.getCommand().getElementId();
UUID uuid = (UUID) menuItem.getTransientData().get(commandId+".feature.uuid");
Feature feature = HibernateProxyHelper.deproxy(CdmStore.getService(ITermService.class).load(uuid), Feature.class);
-
- FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject();
-
- DescriptionBase description = null;
Object object = selection.getFirstElement();
+ if (activePart.getObject() instanceof TaxonEditor && object == null) {
+ object = ((TaxonEditor)activePart.getObject()).getTaxon();
+ }
+ FactualDataPartE4 factualDataPart = null;
+ if (activePart.getObject() instanceof FactualDataPartE4 ) {
+ factualDataPart = (FactualDataPartE4) activePart.getObject();
+ if(factualDataPart.getSelectionProvidingPart().getObject() instanceof TaxonEditor && object == null) {
+ object = ((TaxonEditor)factualDataPart.getSelectionProvidingPart().getObject()).getTaxon();
+ }
+ }
+ DescriptionBase description = null;
+
if(object instanceof FeatureNodeContainer){
description = ((FeatureNodeContainer) object).getDescription();
}
}
else if (object instanceof DescriptionBase) {
description = HibernateProxyHelper.deproxy(object, DescriptionBase.class);
- } else {
+ }
+ else if (object instanceof Taxon) {
+ Taxon taxon = (Taxon)object;
+ description = taxon.getDefaultDescription();
+ if (description == null) {
+ description = TaxonDescription.NewInstance(taxon);
+ description.setDefault(true);
+ }
+ }
+ else {
MessagingUtils.error(getClass(), new IllegalArgumentException("Could not determine the taxon description")); //$NON-NLS-1$
return;
}
boolean canExecute = false;
DescriptionBase description = null;
Object object = selection.getFirstElement();
+ if (object == null) {
+ MPart activePart = EventUtility.getActivePart();
+ Object o = activePart.getObject();
+ if (o instanceof FactualDataPartE4) {
+ FactualDataPartE4 part = (FactualDataPartE4)o;
+ MPart selectionProvidingPart = part.getSelectionProvidingPart();
+ if (selectionProvidingPart.getObject() instanceof TaxonEditor) {
+ TaxonEditor editor = (TaxonEditor)selectionProvidingPart.getObject();
+ object = editor.getTaxon();
+ }
+ }else if (o instanceof TaxonEditor) {
+ TaxonEditor editor = (TaxonEditor)AbstractUtility.getActiveEditor();
+ object = editor.getTaxon();
+ }
+ }
if(object instanceof FeatureNodeContainer){
description = ((FeatureNodeContainer) object).getDescription();
}
}
else if (object instanceof DescriptionBase) {
description = HibernateProxyHelper.deproxy(object, DescriptionBase.class);
- }
+ }else if (object instanceof Taxon){
+ Taxon taxon = (Taxon) object;
+ description =taxon.getDefaultDescription();
+
+ }
- if ((description.isComputed() || description.isCloneForSource())&& PreferencesUtil.isComputedDesciptionHandlingDisabled()){
+ if (description != null &&((description.isComputed() || description.isCloneForSource())&& PreferencesUtil.isComputedDesciptionHandlingDisabled())){
canExecute = false;
menuItem.getParent().setVisible(false);
}else{
- canExecute = selection.size()==1
+ canExecute = (selection.size()==1
&&
(selection.getFirstElement() instanceof DescriptionBase
|| selection.getFirstElement() instanceof DescriptionElementBase
- || selection.getFirstElement() instanceof FeatureNodeContainer);
+ || selection.getFirstElement() instanceof FeatureNodeContainer
+ || object instanceof Taxon))
+ || (selection.size() == 0 && object instanceof Taxon);
}
menuItem.setVisible(canExecute);
return canExecute;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditor;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteDescriptionElementOperation;
}
- if (factualDataPart.getSelectionProvidingPart().getObject() instanceof TaxonNameEditorE4){
- ((TaxonNameEditorE4)factualDataPart.getSelectionProvidingPart().getObject()).getEditorInput().addOperation(operation);
- ((TaxonNameEditorE4)factualDataPart.getSelectionProvidingPart().getObject()).setDirty();
- ((TaxonNameEditorE4)factualDataPart.getSelectionProvidingPart().getObject()).redraw();
+ if (factualDataPart.getSelectionProvidingPart().getObject() instanceof TaxonEditor){
+ ((TaxonEditor)factualDataPart.getSelectionProvidingPart().getObject()).getEditorInput().addOperation(operation);
+ ((TaxonEditor)factualDataPart.getSelectionProvidingPart().getObject()).setDirty();
+ ((TaxonEditor)factualDataPart.getSelectionProvidingPart().getObject()).redraw();
}
if (factualDataPart.getSelectionProvidingPart().getObject() instanceof DerivateView){
((DerivateView)factualDataPart.getSelectionProvidingPart().getObject()).addOperation(operation);
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditor;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
}
private boolean isTaxonEditor() {
- if(AbstractUtility.getActiveEditor() instanceof TaxonNameEditorE4){
+ if(AbstractUtility.getActiveEditor() instanceof TaxonEditor){
return true;
}
return false;
package eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
import javax.inject.Named;
import org.eclipse.e4.ui.di.AboutToShow;
import org.eclipse.e4.ui.model.application.commands.MCommand;
import org.eclipse.e4.ui.model.application.commands.MCommandsFactory;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.TaxonNameDescription;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.term.TermNode;
import eu.etaxonomy.cdm.model.term.TermTree;
import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateDescriptionElementOperation;
+import eu.etaxonomy.taxeditor.event.EventUtility;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
MMenu menu = MMenuFactory.INSTANCE.createMenu();
menu.setLabel(Messages.DynamicFeatureMenuE4_new);
items.add(menu);
-
+ List<MMenuElement> menuItems = new ArrayList<>();
Object selectedElement = selection.getFirstElement();
+ if (selectedElement == null) {
+ MPart activePart = EventUtility.getActivePart();
+ Object o = activePart.getObject();
+ if (o instanceof FactualDataPartE4) {
+ FactualDataPartE4 part = (FactualDataPartE4)o;
+ MPart selectionProvidingPart = part.getSelectionProvidingPart();
+ if (selectionProvidingPart.getObject() instanceof TaxonEditor) {
+ TaxonEditor editor = (TaxonEditor)selectionProvidingPart.getObject();
+ selectedElement = editor.getTaxon();
+ }
+ }else if (o instanceof TaxonEditor) {
+ TaxonEditor editor = (TaxonEditor)AbstractUtility.getActiveEditor();
+ selectedElement = editor.getTaxon();
+ }
+ }
+ DescriptionBase<?> description;
if (selectedElement instanceof DescriptionBase<?>) {
- if ((((DescriptionBase<?>) selectedElement).isComputed() || ((DescriptionBase<?>) selectedElement).isCloneForSource())&& PreferencesUtil.isComputedDesciptionHandlingDisabled()){
- items.remove(menu);
- return;
- }
- TermTree<?> featureTree = getFeatureTree((DescriptionBase<?>) selectedElement);
+ description = (DescriptionBase<?>) selectedElement;
+ } else if (selectedElement instanceof FeatureNodeContainer){
+ description = ((FeatureNodeContainer) selectedElement).getDescription();
+ } else if (selectedElement instanceof DescriptionElementBase){
+ description = ((DescriptionElementBase) selectedElement).getInDescription();
+ } else if (selectedElement instanceof Taxon){
+ Taxon taxon = (Taxon) selectedElement;
+ description = taxon.getDefaultDescription();
+ } else {
+ //TODO or should we throw exception instead?
+ return;
+ }
+ //check computed or cloned
+ //TODO AM: in the originally code the isCloneForSource was only implemented for the DescriptionBase case
+ // Was this on purpose or was it just forgotten in the other cases?
+ if ( description != null && (description.isComputed() || description.isCloneForSource())
+ && PreferencesUtil.isComputedDesciptionHandlingDisabled()){
+ items.remove(menu);
+ return;
+ }
- for (TermNode<?> childNode : featureTree.getRootChildren()) {
- createMenuItem(menu, childNode.getTerm(), globalLanguage);
- }
- } else if (selectedElement instanceof FeatureNodeContainer) {
- if (((FeatureNodeContainer) selectedElement).getDescription().isComputed()){
- items.remove(menu);
- return;
+ //compute menu to show
+ List<Feature> featureList = new ArrayList<>();
+ if (selectedElement instanceof DescriptionBase<?> || selectedElement instanceof Taxon) {
+ TermTree<Feature> featureTree = (TermTree)getFeatureTree(description);
+ for (TermNode<Feature> childNode : featureTree.getRootChildren()) {
+ Feature feature = childNode.getTerm();
+ //TODO duplicate check needed? But a feature tree should not have duplicates
+ featureList.add(feature);
}
- TermNode<?> featureNode = ((FeatureNodeContainer) selectedElement)
- .getFeatureNode();
-
- // add the feature to the menu
- createMenuItem(menu, featureNode.getTerm(), globalLanguage);
+ } else if (selectedElement instanceof FeatureNodeContainer){
+ //add feature
+ TermNode<Feature> featureNode = ((FeatureNodeContainer) selectedElement).getFeatureNode();
+ featureList.add(featureNode.getTerm());
// add possible children to the menu
- for (TermNode<?> childNode : featureNode.getChildNodes()) {
- TermTree<?> featureTree = getFeatureTree(((FeatureNodeContainer) selectedElement).getDescription());
- featureTree = PreferencesUtil.getPreferredFeatureTreeForNameDescription(false);
+ //TODO AM: does this really work and what is it for?
+ for (TermNode<Feature> childNode : featureNode.getChildNodes()) {
+ Feature feature = childNode.getTerm();
+ TermTree<Feature> featureTree = (TermTree)getFeatureTree(description);
- if (featureTree != null && featureTree.getRootChildren().contains(childNode.getTerm() )){
- createMenuItem(menu, childNode.getTerm(), globalLanguage);
+ if (featureTree != null && featureTree.getRootChildren().contains(feature)){
+ featureList.add(feature);
}
}
+ } else if (selectedElement instanceof DescriptionElementBase){
+ Feature feature = ((DescriptionElementBase) selectedElement).getFeature();
+ featureList.add(feature);
+ } else {
+ //TODO or should we throw exception instead?
+ return;
+ }
+
+ Map<UUID, Integer> feature_count_map = getElementCounts(description);
+
+ for (Feature feature : featureList){
+ Integer count = null;
+ if (feature_count_map != null) {
+ count = feature_count_map.get(feature.getUuid());
+ }
+ if(feature.getMaxPerDataset() == null || count == null || count < feature.getMaxPerDataset()) {
+ createMenuItem(menuItems, feature, globalLanguage);
+ }
+ }
- } else if (selectedElement instanceof DescriptionElementBase) {
- if (((DescriptionElementBase) selectedElement).getInDescription().isComputed() && PreferencesUtil.isComputedDesciptionHandlingDisabled()){
- items.remove(menu);
- return;
+ Collections.sort(menuItems, new MenuItemComparator());
+ menu.getChildren().clear();
+ for (MMenuElement element: menuItems) {
+ menu.getChildren().add(element);
+ }
+
+ }
+
+ protected Map<UUID, Integer> getElementCounts(DescriptionBase<?> selectedElement) {
+ if (selectedElement == null) {
+ return null;
+ }
+ Set<DescriptionElementBase> elements = selectedElement.getElements();
+ Map<UUID, Integer> feature_count_map = new HashMap<>();
+ for (DescriptionElementBase el: elements) {
+ Integer count = feature_count_map.get(el.getFeature().getUuid());
+ if (count == null) {
+ count = 1;
+ }else {
+ count++;
}
- Feature feature = ((DescriptionElementBase) selectedElement)
- .getFeature();
- createMenuItem(menu, feature, globalLanguage);
+ feature_count_map.put(el.getFeature().getUuid(), count);
}
+ return feature_count_map;
}
- private void createMenuItem(MMenu menu, final DefinedTermBase feature, Language globalLanguage) {
- final DefinedTermBase<?> deproxiedFeature = HibernateProxyHelper.deproxy(feature, DefinedTermBase.class);
+ private void createMenuItem(List<MMenuElement> menuItems, final DefinedTermBase feature, Language globalLanguage) {
+ final DefinedTermBase<?> deproxiedFeature = HibernateProxyHelper.deproxy(feature);
String label = deproxiedFeature.getLabel(globalLanguage);
if (label == null){
}
MHandledMenuItem menuItem = MMenuFactory.INSTANCE.createHandledMenuItem();
menuItem.setLabel(label);
+ if (deproxiedFeature.getDescription() != null) {
+ if (deproxiedFeature.getDescription(globalLanguage) != null) {
+ menuItem.setTooltip(deproxiedFeature.getDescription(globalLanguage));
+ }else {
+ menuItem.setTooltip(deproxiedFeature.getDescription());
+ }
+ }else {
+ menuItem.setTooltip(label);
+ }
MCommand mCommand = MCommandsFactory.INSTANCE.createCommand();
mCommand.setElementId(CreateDescriptionElementOperation.ID);
mCommand.setCommandName(label);
- // try {
- // mCommand.setCommandName(command.getName());
- // } catch (NotDefinedException e) {
- // e.printStackTrace();
- // }
+
+
//set params
menuItem.getTransientData().put(CreateDescriptionElementOperation.ID+".feature.uuid", deproxiedFeature.getUuid());
menuItem.setCommand(mCommand);
- menu.getChildren().add(menuItem);
+ menuItems.add(menuItem);
}
/**
*
* TODO as of now this is always the same thing because feature trees may
* not be associated to descriptions yet.
- *
- * @param description
- * @return
*/
- private TermTree<?> getFeatureTree(DescriptionBase description) {
- TermTree<?> featureTree = null;
-
- // TODO change this to the feature tree associated with this taxon
- // description
- if (description.hasStructuredData()) {
- featureTree = PreferencesUtil
- .getDefaultFeatureTreeForStructuredDescription();
- } else {
- featureTree = PreferencesUtil
- .getDefaultFeatureTreeForTextualDescription();
- }
-
- if (featureTree == null) {
- featureTree = TermEditorInput.getPreferredTaxonFeatureTree(false);
- }
- if (description instanceof TaxonNameDescription){
- featureTree = TermEditorInput.getPreferredNameFeatureTree(false);
-
- }
+ private TermTree<?> getFeatureTree(DescriptionBase<?> description) {
+
+ TermTree<?> featureTree = null;
+
+ if (description instanceof TaxonNameDescription){
+ featureTree = TermEditorInput.getPreferredNameFeatureTree(false);
+
+ }else if(description != null){
+ // TODO change this to the feature tree associated with this taxon
+ // description
+ if (description.hasStructuredData()) {
+ featureTree = PreferencesUtil
+ .getDefaultFeatureTreeForStructuredDescription();
+ } else {
+ featureTree = PreferencesUtil
+ .getDefaultFeatureTreeForTextualDescription();
+ }
+ if (featureTree == null) {
+ featureTree = TermEditorInput.getPreferredTaxonFeatureTree(false);
+ }
+ }else {
+ featureTree = TermEditorInput.getPreferredTaxonFeatureTree(false);
+ }
return featureTree;
}
+
+ private class MenuItemComparator implements Comparator<MMenuElement>{
+ @Override
+ public int compare(MMenuElement o1, MMenuElement o2) {
+ if (o1 == o2) {
+ return 0;
+ }
+ if (o1 == null) {
+ return -1;
+ }
+ if (o2 == null) {
+ return 1;
+ }
+ if (o1.getLabel() == null && o2.getLabel() != null) {
+ return -1;
+ }
+ if (o2.getLabel() == null) {
+ return 1;
+ }
+ if (o1.getLabel().equals(o2.getLabel())) {
+ return 0;
+ }
+ return o1.getLabel().compareTo(o2.getLabel());
+ }
+ }
}
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.cdm.model.description.TaxonNameDescription;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionElementsOperation;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeAndBoolean;
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
public class MoveDescriptionElementsHandlerE4 implements IPostOperationEnabled{
private UUID newAcceptedTaxonNodeUuid;
private UUID oldAcceptedTaxonNodeUuid;
- private TaxonNameEditorE4 editor;
+ private TaxonEditor editor;
private MApplication application;
private EModelService modelService;
private EPartService partService;
IStructuredSelection viewselection = (IStructuredSelection) factualDataPart.getViewer().getSelection();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart());
- if(e4WrappedPart instanceof TaxonNameEditorE4){
- editor = (TaxonNameEditorE4) e4WrappedPart;
+ if(e4WrappedPart instanceof TaxonEditor){
+ editor = (TaxonEditor) e4WrappedPart;
}
Taxon actualTaxon= null;
List<DescriptionElementBase> elements = new ArrayList<DescriptionElementBase>();
DescriptionBase<?> description = null;
+ boolean containsDeterminedSpecimen = false;
for (Iterator<?> iter = viewselection.iterator(); iter.hasNext();) {
Object object = iter.next();
if (object instanceof DescriptionElementBase) {
}else{
element = ((DescriptionElementBase) object);
}
-
+ if (element instanceof IndividualsAssociation) {
+ IndividualsAssociation indAss = (IndividualsAssociation)element;
+ SpecimenOrObservationBase specimen = HibernateProxyHelper.deproxy(indAss.getAssociatedSpecimenOrObservation());
+ if (!specimen.getDeterminations().isEmpty()) {
+ containsDeterminedSpecimen = true;
+ }
+ }
elements.add(element);
} else if (object instanceof FeatureNodeContainer) {
for (DescriptionElementBase de : ((FeatureNodeContainer) object).getDescriptionElements()) {
}else{
element = (de);
}
+ if (element instanceof IndividualsAssociation) {
+ IndividualsAssociation indAss = (IndividualsAssociation)element;
+ if (!indAss.getAssociatedSpecimenOrObservation().getDeterminations().isEmpty()) {
+ containsDeterminedSpecimen = true;
+ }
+ }
description = de.getInDescription();
elements.add(element);
}
if (classification != null){
classificationUuid = classification.getUuid();
}
- TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(shell,
+ TaxonNodeAndBoolean newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(shell,
Messages.MoveDescriptionElementsHandler_CHOOSE_ACC_TAXON,
excludeTaxa,
- null, classificationUuid
- );
- if (newAcceptedTaxonNode != null){
- Taxon targetTaxon = newAcceptedTaxonNode.getTaxon();
+ null, classificationUuid,
+ true, true);
+ boolean createNewCurrentDeterminations = false;
+ if (containsDeterminedSpecimen) {
+ if(MessageDialog.openQuestion(null,"Create new current determinations?", "There are specimen with determination(s) involved, do you want to create new current determinations with the target taxon?")){
+ createNewCurrentDeterminations = true;
+ }
+ }
+
+ if (newAcceptedTaxonNode != null && newAcceptedTaxonNode.getNode() != null){
+ Taxon targetTaxon = newAcceptedTaxonNode.getNode().getTaxon();
if(targetTaxon == null){
// canceled
return;
}
- newAcceptedTaxonNodeUuid = newAcceptedTaxonNode.getUuid();
+ newAcceptedTaxonNodeUuid = newAcceptedTaxonNode.getNode().getUuid();
Collection<IE4SavablePart> targetEditors = EditorUtil.checkForTaxonChanges(targetTaxon.getUuid(), partService);
}
String moveMessage = String.format(Messages.MoveDescriptionElementsHandler_ELEMENTS_MOVED, editor.getTaxon());
-
+ boolean useDefaultDescription = newAcceptedTaxonNode.getBool();
AbstractPostTaxonOperation operation = new MoveDescriptionElementsOperation(
menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(),
- targetTaxon.getUuid(), moveMessage, elements, false, this, null, false);
+ targetTaxon.getUuid(), moveMessage, elements, false, this, null, false,!useDefaultDescription, createNewCurrentDeterminations);
editor.getEditorInput().addOperation(operation);
for (DescriptionElementBase element: elements)
{
@Override
public boolean postOperation(Object objectAffectedByOperation) {
- editor.getConversationHolder().bind();
- editor.getConversationHolder().commit(true);
Display.getDefault().asyncExec(new Runnable(){
@Override
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject();
boolean isComputedDisabled = PreferencesUtil.isComputedDesciptionHandlingDisabled();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart());
- if(e4WrappedPart instanceof TaxonNameEditorE4){
+ if(e4WrappedPart instanceof TaxonEditor){
ISelection selection = factualDataPart.getViewer().getSelection();
if(selection instanceof IStructuredSelection){
- boolean selectionProviding = factualDataPart.getSelectionProvidingPart().getObject() instanceof TaxonNameEditorE4;
+ boolean selectionProviding = factualDataPart.getSelectionProvidingPart().getObject() instanceof TaxonEditor;
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
canExecute = ((firstElement instanceof FeatureNodeContainer && !(((FeatureNodeContainer)firstElement).getContainerTree().getDescription() instanceof TaxonNameDescription))
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.cdm.model.description.TaxonNameDescription;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionElementsOperation;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeAndBoolean;
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
public class MoveDescriptionElementsSetNameInSourceHandlerE5 implements IPostOperationEnabled{
private UUID newAcceptedTaxonNodeUuid;
private UUID oldAcceptedTaxonNodeUuid;
- private TaxonNameEditorE4 editor;
+ private TaxonEditor editor;
private MApplication application;
private EModelService modelService;
private EPartService partService;
IStructuredSelection viewselection = (IStructuredSelection) factualDataPart.getViewer().getSelection();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart());
- if(e4WrappedPart instanceof TaxonNameEditorE4){
- editor = (TaxonNameEditorE4) e4WrappedPart;
+ if(e4WrappedPart instanceof TaxonEditor){
+ editor = (TaxonEditor) e4WrappedPart;
}
Taxon actualTaxon= null;
List<DescriptionElementBase> elements = new ArrayList<DescriptionElementBase>();
DescriptionBase<?> description = null;
+ boolean containsDeterminedSpecimen = false;
for (Iterator<?> iter = viewselection.iterator(); iter.hasNext();) {
Object object = iter.next();
if (object instanceof DescriptionElementBase) {
}else{
element = ((DescriptionElementBase) object);
}
+ if (element instanceof IndividualsAssociation) {
+ IndividualsAssociation indAss = (IndividualsAssociation)element;
+ if (!indAss.getAssociatedSpecimenOrObservation().getDeterminations().isEmpty()) {
+ containsDeterminedSpecimen = true;
+ }
+ }
elements.add(element);
} else if (object instanceof FeatureNodeContainer) {
element = (de);
}
description = de.getInDescription();
+ if (element instanceof IndividualsAssociation) {
+ IndividualsAssociation indAss = (IndividualsAssociation)element;
+ if (!indAss.getAssociatedSpecimenOrObservation().getDeterminations().isEmpty()) {
+ containsDeterminedSpecimen = true;
+ }
+ }
elements.add(element);
}
}
if (classification != null){
classificationUuid = classification.getUuid();
}
- TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(shell,
+ TaxonNodeAndBoolean newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(shell,
Messages.MoveDescriptionElementsHandler_CHOOSE_ACC_TAXON,
excludeTaxa,
- null, classificationUuid
+ null, classificationUuid, true, true
);
if (newAcceptedTaxonNode != null){
- Taxon targetTaxon = newAcceptedTaxonNode.getTaxon();
+ Taxon targetTaxon = newAcceptedTaxonNode.getNode().getTaxon();
if(targetTaxon == null){
// canceled
return;
}
- newAcceptedTaxonNodeUuid = newAcceptedTaxonNode.getUuid();
+ newAcceptedTaxonNodeUuid = newAcceptedTaxonNode.getNode().getUuid();
Collection<IE4SavablePart> targetEditors = EditorUtil.checkForTaxonChanges(targetTaxon.getUuid(), partService);
return;
}
}
+ boolean createNewCurrentDeterminations = false;
+ if (containsDeterminedSpecimen) {
+ if(MessageDialog.openQuestion(null,"Create new current determinations?", "There are specimen with determination(s) involved, do you want to create new current determinations with the target taxon?")){
+ createNewCurrentDeterminations = true;
+ }
+ }
String moveMessage = String.format(Messages.MoveDescriptionElementsHandler_ELEMENTS_MOVED, editor.getTaxon());
-
+ boolean useDefaultDescription = newAcceptedTaxonNode.getBool();
AbstractPostTaxonOperation operation = new MoveDescriptionElementsOperation(
menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(),
- targetTaxon.getUuid(), moveMessage, elements, false, this, null, true);
+ targetTaxon.getUuid(), moveMessage, elements, false, this, null, true, !useDefaultDescription, createNewCurrentDeterminations);
editor.getEditorInput().addOperation(operation);
for (DescriptionElementBase element: elements)
{
@Override
public boolean postOperation(Object objectAffectedByOperation) {
- editor.getConversationHolder().bind();
- editor.getConversationHolder().commit(true);
Display.getDefault().asyncExec(new Runnable(){
@Override
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject();
boolean isComputedDisabled = PreferencesUtil.isComputedDesciptionHandlingDisabled();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart());
- if(e4WrappedPart instanceof TaxonNameEditorE4){
+ if(e4WrappedPart instanceof TaxonEditor){
ISelection selection = factualDataPart.getViewer().getSelection();
if(selection instanceof IStructuredSelection){
- boolean selectionProviding = factualDataPart.getSelectionProvidingPart().getObject() instanceof TaxonNameEditorE4;
+ boolean selectionProviding = factualDataPart.getSelectionProvidingPart().getObject() instanceof TaxonEditor;
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
canExecute = ((firstElement instanceof FeatureNodeContainer && !(((FeatureNodeContainer)firstElement).getContainerTree().getDescription() instanceof TaxonNameDescription))
|| (firstElement instanceof DescriptionElementBase && !(((DescriptionElementBase)firstElement).getInDescription() instanceof TaxonNameDescription)))
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionToOtherTaxonOperation;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
private UUID oldAcceptedTaxonNodeUuid;
private UUID newAcceptedTaxonUuid;
private UUID oldAcceptedTaxonUuid;
- private TaxonNameEditorE4 editor;
+ private TaxonEditor editor;
private MApplication application;
private EModelService modelService;
private EPartService partService;
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart());
- if(e4WrappedPart instanceof TaxonNameEditorE4){
- editor = (TaxonNameEditorE4) e4WrappedPart;
+ if(e4WrappedPart instanceof TaxonEditor){
+ editor = (TaxonEditor) e4WrappedPart;
}
Set<UUID> excludeTaxa = new HashSet<>();
excludeTaxa.add(oldAcceptedTaxonNodeUuid);
TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(shell,
-// editor.getConversationHolder(),
Messages.MoveDescriptionToOtherTaxonHandler_CHOOSE_ACC_TAXON,
excludeTaxa,
node,
taxonDescription,
newAcceptedTaxonNode,
this,
- editor,
editor.getEditorInput(),
false);
editor.getEditorInput().addOperation(operation);
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart());
- if(e4WrappedPart instanceof TaxonNameEditorE4){
+ if(e4WrappedPart instanceof TaxonEditor){
ISelection selection = factualDataPart.getViewer().getSelection();
if(selection instanceof IStructuredSelection){
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionToOtherTaxonOperation;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
private UUID oldAcceptedTaxonNodeUuid;
private UUID newAcceptedTaxonUuid;
private UUID oldAcceptedTaxonUuid;
- private TaxonNameEditorE4 editor;
+ private TaxonEditor editor;
private MApplication application;
private EModelService modelService;
private EPartService partService;
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart());
- if(e4WrappedPart instanceof TaxonNameEditorE4){
- editor = (TaxonNameEditorE4) e4WrappedPart;
+ if(e4WrappedPart instanceof TaxonEditor){
+ editor = (TaxonEditor) e4WrappedPart;
}
Set<UUID> excludeTaxa = new HashSet<>();
excludeTaxa.add(oldAcceptedTaxonNodeUuid);
TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(shell,
-// editor.getConversationHolder(),
Messages.MoveDescriptionToOtherTaxonHandler_CHOOSE_ACC_TAXON,
excludeTaxa,
node,
taxonDescription,
newAcceptedTaxonNode,
this,
- editor,
editor.getEditorInput(),
true);
editor.getEditorInput().addOperation(operation);
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart());
- if(e4WrappedPart instanceof TaxonNameEditorE4){
+ if(e4WrappedPart instanceof TaxonEditor){
ISelection selection = factualDataPart.getViewer().getSelection();
if(selection instanceof IStructuredSelection){
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
--- /dev/null
+/**
+ * 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.editor.view.descriptive.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.description.DescriptionBase;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.SetDefaultDescriptionOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+
+/**
+ *
+ * @author pplitzner
+ * @date 15.08.2017
+ *
+ */
+public class SetDefaultDescriptionHandler {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection,
+ MHandledMenuItem menuItem,
+ UISynchronize sync) {
+
+ String commandId = menuItem.getCommand().getElementId();
+ FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject();
+
+ DescriptionBase description = null;
+ Object object = selection.getFirstElement();
+ if (object instanceof DescriptionBase) {
+ description = HibernateProxyHelper.deproxy(object, DescriptionBase.class);
+ } else {
+ MessagingUtils.error(getClass(), new IllegalArgumentException("Could not determine the taxon description")); //$NON-NLS-1$
+ return;
+ }
+ AbstractPostOperation operation = operationCreationInstance(menuItem.getLocalizedLabel(), description, true,
+ factualDataPart);
+ // TODO use undo context specific to editor
+ AbstractUtility.executeOperation(operation, sync);
+ }
+
+ @CanExecute
+ public boolean canExecute(MHandledMenuItem menuItem,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection){
+ boolean canExecute = false;
+ DescriptionBase description = null;
+ Object object = selection.getFirstElement();
+
+ if (object instanceof DescriptionBase) {
+ description = HibernateProxyHelper.deproxy(object, DescriptionBase.class);
+ }
+
+ if ((description.isComputed() || description.isCloneForSource())&& PreferencesUtil.isComputedDesciptionHandlingDisabled()){
+ canExecute = false;
+
+ }else{
+ canExecute = selection.size()==1
+ &&
+ (selection.getFirstElement() instanceof DescriptionBase)&& !((DescriptionBase)selection.getFirstElement()).isDefault();;
+
+ }
+ menuItem.setVisible(canExecute);
+ return canExecute;
+
+ }
+
+ /**
+ * Added to make the Class more generic and limit the amount of code changes required
+ * @param label
+ * @param event
+ * @param description
+ * @param postOperationEnabled
+ * @return
+ */
+ protected AbstractPostOperation operationCreationInstance(String label,
+ DescriptionBase<?> description, boolean isDefault, IPostOperationEnabled postOperationEnabled) {
+ return new SetDefaultDescriptionOperation(label, EditorUtil.getUndoContext(), description, isDefault, postOperationEnabled);
+ }
+
+}
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacadeNotSupportedException;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- DerivedUnitFacade facade;
+ DerivedUnitFacade facade;
try {
if(specimen instanceof FieldUnit){
facade = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) specimen);
import org.eclipse.core.commands.operations.IUndoContext;
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
+import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.operation.AbstractDescriptionPostOperation;
@Override
protected void initDescription(){
+ boolean isFirst = false;
+ boolean defaultExists = false;
+ if (element.getDescriptions() == null || element.getDescriptions().isEmpty()) {
+ isFirst = true;
+ }else {
+ for (DescriptionBase desc:element.getDescriptions()) {
+ if (desc.isDefault()) {
+ defaultExists = true;
+ break;
+ }
+ }
+ }
description = TaxonDescription.NewInstance(element);
+ description.setDefault(isFirst || !defaultExists);
}
}
if (monitor != null){
monitor.worked(20);
}
- if (description != null && description.isPersited()){
+ if (description != null && description.isPersisted()){
// element.removeDescription(description);
CdmStore.getService(IDescriptionService.class).deleteDescription(description.getUuid());
return postExecute(element);
- }else if (description != null && !description.isPersited()){
+ }else if (description != null && !description.isPersisted()){
element.removeDescription(description);
return Status.OK_STATUS;
}
* @since 4 Mar 2019
*/
public class DeleteTaxonNameDescriptionOperation extends AbstractPostOperation<TaxonName> {
-
+
private final TaxonNameDescription description;
public DeleteTaxonNameDescriptionOperation(String label, IUndoContext undoContext, TaxonNameDescription description,
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
monitor.worked(20);
- if (description != null && description.isPersited()){
+ if (description != null && description.isPersisted()){
// element.removeDescription(description);
CdmStore.getService(IDescriptionService.class).deleteDescription(description.getUuid());
element.removeDescription(description);
return postExecute(element);
- }else if (description != null && !description.isPersited()){
+ }else if (description != null && !description.isPersisted()){
element.removeDescription(description);
return Status.OK_STATUS;
}
private boolean isCopy;
private UISynchronize sync;
private boolean setNameInSource;
-
+ private boolean useDefaultDescription;
+ private boolean addNewCurrentDetermination;
public MoveDescriptionElementsOperation(String label,
IUndoContext undoContext, DescriptionBase targetDescription, DescriptionBase sourceDescription,
Collection<DescriptionElementBase> descriptionElements, boolean isCopy,
- IPostOperationEnabled postOperationEnabled, UISynchronize sync, boolean setNameInSource) {
+ IPostOperationEnabled postOperationEnabled, UISynchronize sync, boolean setNameInSource, boolean addNewCurrentDetermination) {
super(label, undoContext, postOperationEnabled);
this.targetDescription = targetDescription;
this.sourceDescription = sourceDescription;
this.descriptionElements = descriptionElements;
+// this.useDefaultDescription = useDefaultDescription;
this.isCopy = isCopy;
this.sync = sync;
this.setNameInSource = setNameInSource;
+ this.addNewCurrentDetermination = addNewCurrentDetermination;
service = CdmStore.getService(IDescriptionService.class);
}
public MoveDescriptionElementsOperation(String label,
IUndoContext undoContext, UUID targetTaxonUuid, String moveMessage,
Collection<DescriptionElementBase> descriptionElements, boolean isCopy,
- IPostOperationEnabled postOperationEnabled, UISynchronize sync, boolean setNameInSource) {
+ IPostOperationEnabled postOperationEnabled, UISynchronize sync, boolean setNameInSource, boolean useDefaultDescription, boolean addNewCurrentDetermination) {
super(label, undoContext, postOperationEnabled);
this.targetTaxonUuid = targetTaxonUuid;
this.descriptionElements = descriptionElements;
this.isCopy = isCopy;
this.sync = sync;
this.setNameInSource = setNameInSource;
+ this.useDefaultDescription = useDefaultDescription;
+ this.addNewCurrentDetermination = addNewCurrentDetermination;
service = CdmStore.getService(IDescriptionService.class);
}
}
UpdateResult result;
if(targetDescription == null){
- result = service.moveDescriptionElementsToDescription(descriptionElementsUuid, targetTaxonUuid, moveMessage, isCopy, setNameInSource);
+ result = service.moveDescriptionElementsToDescription(descriptionElementsUuid, targetTaxonUuid, moveMessage, isCopy, setNameInSource, useDefaultDescription, addNewCurrentDetermination);
} else {
UUID targetDescriptionUuid = targetDescription.getUuid();
UUID sourceDescriptionUuid = sourceDescription.getUuid();
- if (!targetDescription.isPersited()){
+ if (!targetDescription.isPersisted()){
result = service.moveDescriptionElementsToDescription(descriptionElementsUuid, targetDescription, isCopy, setNameInSource);
}else{
result = service.moveDescriptionElementsToDescription(descriptionElementsUuid, targetDescriptionUuid, isCopy, setNameInSource);
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.IDescriptionService;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
* @param description a {@link TaxonDescription} object.
* @param targetTaxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
- * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
*/
public MoveDescriptionToOtherTaxonOperation(String label,
IUndoContext undoContext,
TaxonDescription description,
TaxonNode targetTaxonNode,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled,
- ICdmEntitySessionEnabled cdmEntitySessionEnabled,
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled,
boolean setNameInSource) {
- super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled); // FIXME is this the right constructor ???
+ super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled); // FIXME is this the right constructor ???
this.description = description;
this.setNameInSource = setNameInSource;
this.newAcceptedTaxonNode = targetTaxonNode;
--- /dev/null
+/**
+* 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.editor.view.descriptive.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.model.description.DescriptionBase;
+import eu.etaxonomy.cdm.model.description.TaxonDescription;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+
+/**
+ * <p>SetDefaultDescriptionOperation class.</p>
+ *
+ * @author p.ciardelli
+ * @author k.luther
+ * @created 05.10.2023
+ */
+public class SetDefaultDescriptionOperation extends AbstractPostTaxonOperation {
+
+ /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.descripti"{trunked}</code> */
+ public static final String ID = "eu.etaxonomy.taxeditor.editor.view.descriptive.e4.command.SetDefaultDescription"; //$NON-NLS-1$
+
+ private final DescriptionBase<?> description;
+ private boolean isDefault;
+
+ /**
+ * <p>Constructor for CreateDescriptionElementOperation.</p>
+ *
+ * @param label a {@link java.lang.String} object.
+ * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+ * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
+ * @param description a {@link DescriptionBase} object.
+ * @param feature a {@link eu.etaxonomy.cdm.model.description.Feature} object.
+ * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
+ */
+ public SetDefaultDescriptionOperation(String label, IUndoContext undoContext,
+ DescriptionBase<?> description, boolean isDefault, IPostOperationEnabled postOperationEnabled) {
+ super(label, undoContext, (Taxon)null, postOperationEnabled);
+
+ this.description = description;
+ this.isDefault = isDefault;
+ }
+
+
+
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+
+ monitor.worked(20);
+ if (description instanceof TaxonDescription) {
+ TaxonDescription taxDescription = (TaxonDescription)description;
+ Taxon taxon = taxDescription.getTaxon();
+ for (TaxonDescription desc :taxon.getDescriptions()) {
+ if (desc.isDefault() && !desc.getUuid().equals(taxDescription.getUuid()) && !taxDescription.isImageGallery()) {
+ desc.setDefault(false);
+ }
+ }
+ }
+ description.setDefault(isDefault);
+ monitor.worked(40);
+
+ return postExecute(description);
+ }
+
+ @Override
+ public IStatus redo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+
+ description.setDefault(isDefault);
+
+ return postExecute(description);
+ }
+
+ @Override
+ public IStatus undo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+
+ description.setDefault(!isDefault);
+
+ return postExecute(null);
+ }
+}
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInput;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
/**
@Override
public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof TaxonEditorInputE4 || parentElement instanceof Taxon) {
+ if (parentElement instanceof TaxonEditorInput || parentElement instanceof Taxon) {
Taxon taxon = null;
- if (parentElement instanceof TaxonEditorInputE4){
- taxon = ((TaxonEditorInputE4) parentElement).getTaxon();
+ if (parentElement instanceof TaxonEditorInput){
+ taxon = ((TaxonEditorInput) parentElement).getTaxon();
} else{
taxon = HibernateProxyHelper.deproxy(parentElement, Taxon.class);
}
* 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.editor.view.media.e4;
import javax.annotation.PostConstruct;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
import eu.etaxonomy.taxeditor.editor.view.media.MediaContentProvider;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
-import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPartE4;
+import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPart;
import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
import eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4;
/**
- *
* @author pplitzner
* @since Aug 14, 2017
- *
*/
-public class MediaViewPartE4 extends AbstractCdmEditorPartE4
+public class MediaViewPartE4 extends AbstractCdmEditorPart<TreeViewer>
implements IPartContentHasDetails, IPartContentHasSupplementalData {
@PostConstruct
//create context menu
menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.editor.popupmenu.mediaview");
-
}
@Override
public void selectionChanged_internal(Object selection, MPart activePart, MPart thisPart) {
- if(activePart==thisPart){
+ if(activePart == thisPart){
return;
}
- Object partObject = createPartObject(activePart);
+ Object partObject = getPartObject(activePart);
if (partObject instanceof DetailsPartE4 || partObject instanceof SupplementalDataPartE4
|| partObject instanceof FactualDataPartE4 || partObject instanceof ConceptViewPartE4) {
}
Object firstElement = structuredSelection.getFirstElement();
- if (partObject instanceof TaxonNameEditorE4){
- if (firstElement != ((TaxonNameEditorE4)partObject).getTaxon()){
+ if (partObject instanceof TaxonEditor){
+ if (firstElement != ((TaxonEditor)partObject).getTaxon()){
showEmptyPage();
return;
}
return;
}
- /** {@inheritDoc} */
@Override
public void changed(Object object) {
((AbstractTreeViewer) viewer).expandToLevel(2);
protected String getViewName() {
return Messages.MediaViewPart_MEDIA;
}
-
-
-
-}
+}
\ No newline at end of file
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4;
import eu.etaxonomy.taxeditor.editor.view.media.operation.MoveMediaInListOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
MediaViewPartE4 mediaView = (MediaViewPartE4) activePart.getObject();
- TaxonNameEditorE4 editor = null;
+ TaxonEditor editor = null;
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(mediaView.getSelectionProvidingPart());
- if (e4WrappedPart instanceof TaxonNameEditorE4) {
- editor = (TaxonNameEditorE4) e4WrappedPart;
- TaxonEditorInputE4 input = editor.getEditorInput();
+ if (e4WrappedPart instanceof TaxonEditor) {
+ editor = (TaxonEditor) e4WrappedPart;
+ TaxonEditorInput input = editor.getEditorInput();
Taxon taxon =input.getTaxon();
TreeSelection selection = (TreeSelection) mediaView.getViewer().getSelection();
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteSpecimenDescriptionOperation;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteTaxonDescriptionOperation;
import eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4;
if(object instanceof Media){
// TODO use undo context specific to editor
- if (!((Media)object).isPersited()){
+ if (!((Media)object).isPersisted()){
Set<DescriptionElementBase> elements = description.getElements();
if (elements.size() == 1){
DescriptionElementBase element = elements.iterator().next();
Set<Media> toDelete = new HashSet<>();
element.removeMedia((Media)object);
- ((TaxonNameEditorE4)mediaView.getSelectionProvidingPart().getObject()).redraw();
+ ((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).redraw();
return;
}
// containsPersistedMedia = element.getMedia().isEmpty();
if (element.getMedia() != null && !element.getMedia().isEmpty()){
for (Media media: element.getMedia()){
- containsPersistedMedia |= media.isPersited();
- if (media.isPersited()){
+ containsPersistedMedia |= media.isPersisted();
+ if (media.isPersisted()){
mediaList.add(media);
}
}
if(object instanceof TaxonDescription){
DeleteTaxonDescriptionOperation deleteTaxonDescriptionOperation = new DeleteTaxonDescriptionOperation(menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(), (TaxonDescription)object, mediaView, null);
- if (mediaView.getSelectionProvidingPart().getObject() instanceof TaxonNameEditorE4){
- ((TaxonNameEditorE4)mediaView.getSelectionProvidingPart().getObject()).getTaxon().removeDescription((TaxonDescription)description);
- ((TaxonNameEditorE4)mediaView.getSelectionProvidingPart().getObject()).getEditorInput().addOperation(deleteTaxonDescriptionOperation);
- ((TaxonNameEditorE4)mediaView.getSelectionProvidingPart().getObject()).setDirty();
- ((TaxonNameEditorE4)mediaView.getSelectionProvidingPart().getObject()).redraw();
+ if (mediaView.getSelectionProvidingPart().getObject() instanceof TaxonEditor){
+ ((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).getTaxon().removeDescription((TaxonDescription)description);
+ ((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).getEditorInput().addOperation(deleteTaxonDescriptionOperation);
+ ((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).setDirty();
+ ((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).redraw();
}else{
AbstractUtility.executeOperation(deleteTaxonDescriptionOperation, sync);
}
else if(object instanceof SpecimenDescription){
DeleteSpecimenDescriptionOperation deleteTaxonDescriptionOperation = new DeleteSpecimenDescriptionOperation(menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(), (SpecimenDescription)object, mediaView, null);
- if (mediaView.getSelectionProvidingPart().getObject() instanceof TaxonNameEditorE4){
- ((TaxonNameEditorE4)mediaView.getSelectionProvidingPart().getObject()).getEditorInput().addOperation(deleteTaxonDescriptionOperation);
- ((TaxonNameEditorE4)mediaView.getSelectionProvidingPart().getObject()).setDirty();
- ((TaxonNameEditorE4)mediaView.getSelectionProvidingPart().getObject()).redraw();
+ if (mediaView.getSelectionProvidingPart().getObject() instanceof TaxonEditor){
+ ((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).getEditorInput().addOperation(deleteTaxonDescriptionOperation);
+ ((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).setDirty();
+ ((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).redraw();
}else{
AbstractUtility.executeOperation(deleteTaxonDescriptionOperation, sync);
}
public void createMediaDeleteOperation(String menuLabel, UISynchronize sync, MediaViewPartE4 mediaView,
List<Media> media, DescriptionBase<?> description, MediaDeletionConfigurator config) {
AbstractPostOperation<?> operation = new DeleteMediaOperation(menuLabel, EditorUtil.getUndoContext(), description, media, config, mediaView);
- if (mediaView.getSelectionProvidingPart().getObject() instanceof TaxonNameEditorE4){
+ if (mediaView.getSelectionProvidingPart().getObject() instanceof TaxonEditor){
if (!config.isOnlyRemoveFromGallery()){
- ((TaxonNameEditorE4)mediaView.getSelectionProvidingPart().getObject()).getEditorInput().addOperation(operation);
+ ((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).getEditorInput().addOperation(operation);
}
if (description.isImageGallery()){
}
}
- ((TaxonNameEditorE4)mediaView.getSelectionProvidingPart().getObject()).setDirty();
- ((TaxonNameEditorE4)mediaView.getSelectionProvidingPart().getObject()).redraw();
+ ((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).setDirty();
+ ((TaxonEditor)mediaView.getSelectionProvidingPart().getObject()).redraw();
}else{
AbstractUtility.executeOperation(operation, sync);
}
import eu.etaxonomy.taxeditor.editor.view.uses.UsesContentProvider;
import eu.etaxonomy.taxeditor.editor.view.uses.UsesLabelProvider;
-
/**
* @author pplitzner
* @since Sep 8, 2017
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* 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.editor.name.operation;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.core.commands.ExecutionException;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
-import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
-import eu.etaxonomy.cdm.model.name.INonViralName;
-import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptToSynonymOperation;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.store.operations.AbstractTaxeditorOperationTestBase;
* @created 07.04.2009
*/
public class ChangeConceptToSynonymOperationTest extends AbstractTaxeditorOperationTestBase {
- private static final Logger logger = LogManager.getLogger(ChangeConceptToSynonymOperationTest.class);
-
+
+ private static final Logger logger = LogManager.getLogger();
+
private static Taxon taxon;
-
+
private static Taxon concept;
- private static AbstractPostOperation operation;
+ private static AbstractPostOperation<?> operation;
private static HomotypicalGroup homotypicalGroup;
-
+
private Synonym[] synonymType = new Synonym[0];
private Taxon[] taxonType = new Taxon[0];
-
- /**
- * @throws java.lang.Exception
- */
+
@BeforeClass
public static void setUpBeforeClass() throws Exception {
taxon = Taxon.NewInstance(null, null);
concept = Taxon.NewInstance(TaxonNameFactory.NewNonViralInstance(null), null);
homotypicalGroup = HomotypicalGroup.NewInstance();
-
+
concept.addTaxonRelation(taxon, TaxonRelationshipType.MISAPPLIED_NAME_FOR(), null, null);
-
+
operation = new ChangeConceptToSynonymOperation("Change misapplication to synonym", null, taxon, concept, homotypicalGroup, postOperation);
}
- /**
- * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptToSynonymOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- * @throws ExecutionException
- */
@Test
public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException {
operation.execute(null, null);
-
+
Assert.assertTrue(taxon.getSynonyms().size() == 1);
Assert.assertTrue(concept.getRelationsFromThisTaxon().size() == 0);
Assert.assertEquals(concept.getName(), taxon.getSynonyms().toArray(synonymType)[0].getName());
-
+
}
- /**
- * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptToSynonymOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- * @throws ExecutionException
- */
@Test
public void testUndoIProgressMonitorIAdaptable() throws ExecutionException {
operation.undo(null, null);
-
+
Assert.assertTrue("There shouldn't be synonyms after undo operations", taxon.getSynonyms().size() == 0);
Assert.assertTrue(concept.getRelationsFromThisTaxon().size() > 0);
Assert.assertEquals(taxon, concept.getRelationsFromThisTaxon().toArray(taxonType)[0]);
}
-
- /**
- * Test method for {@link eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptToSynonymOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- * @throws ExecutionException
- */
+
@Test
public void testRedoIProgressMonitorIAdaptable() throws ExecutionException {
operation.redo(null, null);
-
+
Assert.assertTrue(taxon.getSynonyms().size() == 1);
Assert.assertTrue(concept.getRelationsFromThisTaxon().size() == 0);
Assert.assertEquals(concept.getName(), taxon.getSynonyms().toArray(synonymType)[0].getName());
}
- /**
- * Test method for {@link eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation#postExecute(ICdmBase)}.
- */
@Test
public void testPostExecute() {
// TODO there is not post operation functionality for this class
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* 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.editor.name.operation;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.core.commands.ExecutionException;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
-import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.SynonymType;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToConceptOperation;
import eu.etaxonomy.taxeditor.store.operations.AbstractTaxeditorOperationTestBase;
/**
* @created 07.04.2009
*/
public class ChangeSynonymToConceptOperationTest extends AbstractTaxeditorOperationTestBase{
-
+
private static final Logger logger = LogManager.getLogger(ChangeSynonymToConceptOperationTest.class);
private static TaxonRelationshipType taxonRelationshipType;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
-
+
taxon = Taxon.NewInstance(null, null);
synonym = Synonym.NewInstance(TaxonNameFactory.NewNonViralInstance(null), null);
taxonRelationshipType = TaxonRelationshipType.CONTRADICTION();
-
- taxon.addSynonym(synonym, SynonymType.SYNONYM_OF());
-
+
+ taxon.addSynonym(synonym, SynonymType.SYNONYM_OF);
+
operation = new ChangeSynonymToConceptOperation("Change Synonym To Concept", null, taxon, synonym, taxonRelationshipType, postOperation);
}
@Test
public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException {
operation.execute(monitor, info);
-
+
Assert.assertTrue("Synonym should be deleted from taxon.", taxon.getSynonyms().size() == 0);
Assert.assertTrue("Taxon should have taxon relationships now.", taxon.getRelationsToThisTaxon().size() > 0);
Assert.assertEquals("Relationship is not the expected", taxonRelationshipType, taxon.getTaxonRelations().toArray(new TaxonRelationship[0])[0].getType());
@Test
public void testUndoIProgressMonitorIAdaptable() throws ExecutionException {
operation.undo(monitor, info);
-
+
Assert.assertTrue("There should be synonyms now.", taxon.getSynonyms().size() > 0);
Assert.assertEquals("Synonym is not the expected.", synonym, taxon.getSynonyms().toArray(new Synonym[0]));
Assert.assertTrue("There should not be taxon relationships.", taxon.getRelationsToThisTaxon().size() == 0);
}
-
+
@Test
public void testRedoIProgressMonitorIAdaptable() throws ExecutionException {
operation.redo(monitor, info);
-
+
Assert.assertTrue("Synonym should be deleted from taxon.", taxon.getSynonyms().size() == 0);
Assert.assertTrue("Taxon should have taxon relationships now.", taxon.getRelationsToThisTaxon().size() > 0);
Assert.assertEquals("Relationship is not the expected", taxonRelationshipType, taxon.getTaxonRelations().toArray(new TaxonRelationship[0])[0].getType());
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* 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.editor.name.operation;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.core.commands.ExecutionException;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
-import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.SynonymType;
* @created 07.04.2009
*/
public class ChangeSynonymToMisapplicationOperationTest extends AbstractTaxeditorOperationTestBase {
-
+
private static final Logger logger = LogManager.getLogger(ChangeSynonymToMisapplicationOperationTest.class);
private static AbstractPostOperation<Taxon> operation;
-
+
private static Synonym synonym;
private static Taxon taxon;
private static SynonymType synonymType;
-
+
@BeforeClass
public static void setUpBeforeClass() throws Exception {
taxon = Taxon.NewInstance(null, null);
synonym = Synonym.NewInstance(TaxonNameFactory.NewNonViralInstance(null), null);
- synonymType = SynonymType.SYNONYM_OF();
+ synonymType = SynonymType.SYNONYM_OF;
taxon.addSynonym(synonym, synonymType);
-
+
operation = new ChangeSynonymToMisapplicationOperation("Change Synonym To Misapplication", null, taxon, synonym, postOperation);
}
@Test
public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException {
operation.execute(null, null);
-
+
Assert.assertTrue("Synonym should be deleted from taxon", taxon.getSynonyms().size() == 0);
Assert.assertTrue("Taxon should have misapplications", taxon.getMisappliedNames(false).size() > 0);
Assert.assertEquals("The name of synonym and misapplication should be equal", synonym.getName(), taxon.getMisappliedNames(false).toArray(new Taxon[0])[0].getName());
@Test
public void testUndoIProgressMonitorIAdaptable() throws ExecutionException {
operation.undo(null, null);
-
+
Assert.assertTrue("Taxon should have synonyms.", taxon.getSynonyms().size() > 0);
Assert.assertTrue("Taxon should not have taxon relationship.", taxon.getTaxonRelations().size() == 0);
Assert.assertEquals("Not the expected synonym.", synonym, taxon.getSynonyms().toArray(new Synonym[0])[0]);
Assert.assertEquals("SynonymType is not the expected.", synonymType, taxon.getSynonyms().iterator().next().getType());
}
-
+
@Test
public void testRedoIProgressMonitorIAdaptable() throws ExecutionException {
operation.redo(null, null);
Assert.assertTrue("Taxon should have a synonym now.", taxon.getSynonyms().size() > 0);
Assert.assertTrue("Taxon should have a homotypic group", taxon.getHomotypicSynonymyGroups().size() > 0);
- Assert.assertEquals("Synonym relationship should be heterotypic", SynonymType.HETEROTYPIC_SYNONYM_OF(), taxon.getSynonyms().iterator().next().getType());
+ Assert.assertEquals("Synonym relationship should be heterotypic", SynonymType.HETEROTYPIC_SYNONYM_OF, taxon.getSynonyms().iterator().next().getType());
}
Assert.assertTrue("Taxon should have a synonym now.", taxon.getSynonyms().size() > 0);
Assert.assertTrue("Taxon should have a homotypic group", taxon.getHomotypicSynonymyGroups().size() > 0);
- Assert.assertEquals("Synonym relationship should be heterotypic", SynonymType.HETEROTYPIC_SYNONYM_OF(), taxon.getSynonyms().iterator().next().getType());
+ Assert.assertEquals("Synonym relationship should be heterotypic", SynonymType.HETEROTYPIC_SYNONYM_OF, taxon.getSynonyms().iterator().next().getType());
}
}
taxon.addMisappliedName(misapplication, null, null);
- operation = new DeleteMisapplicationOperation("", undoContext, null, taxon, misapplication, postOperation, null, null);
+ operation = new DeleteMisapplicationOperation("", undoContext, null, taxon, misapplication, postOperation, null);
}
private static SynonymType synonymType;
- /**
- * @throws java.lang.Exception
- */
@BeforeClass
public static void setUpBeforeClass() throws Exception {
taxon = Taxon.NewInstance(null, null);
synonym = Synonym.NewInstance(null, null);
- synonymType = SynonymType.SYNONYM_OF();
+ synonymType = SynonymType.SYNONYM_OF;
taxon.addSynonym(synonym, synonymType);
- operation = new DeleteSynonymOperation("", undoContext, new SynonymDeletionConfigurator(), taxon,synonym, postOperation, null, null);
+ operation = new DeleteSynonymOperation("", undoContext, new SynonymDeletionConfigurator(), taxon,synonym, postOperation, null);
}
*/
public class SwapSynonymAndAcceptedOperationTest extends AbstractTaxeditorOperationTestBase {
- private static final Logger logger = LogManager.getLogger(SwapSynonymAndAcceptedOperationTest.class);
+ private static final Logger logger = LogManager.getLogger();
private static SwapSynonymAndAcceptedOperation operation;
// oldTaxon.addS .addHeterotypicSynonym(oldHeterotypicSynonym, null, null);
heteroypicalGroup = HomotypicalGroup.NewInstance();
heteroypicalGroup.addTypifiedName(oldHeterotypicSynonym.getName());
- taxon.addSynonym(oldHeterotypicSynonym, SynonymType.HETEROTYPIC_SYNONYM_OF());
+ taxon.addSynonym(oldHeterotypicSynonym, SynonymType.HETEROTYPIC_SYNONYM_OF);
// Create a misapplication
misapplication = Taxon.NewInstance(TaxonNameFactory.NewNonViralInstance(null), null);
<feature\r
id="eu.etaxonomy.taxeditor.feature.platform"\r
label="Taxeditor Dependencies"\r
- version="5.34.0"\r
+ version="5.42.0"\r
os="linux,macosx,win32"\r
ws="cocoa,gtk,win32"\r
arch="x86,x86_64">\r
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.34.0</version>
+ <version>5.42.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eu.etaxonomy.taxeditor.feature.platform</artifactId>
<feature\r
id="eu.etaxonomy.taxeditor.feature"\r
label="Taxonomic Editor"\r
- version="5.34.0"\r
+ version="5.42.0"\r
provider-name="EDIT"\r
plugin="eu.etaxonomy.taxeditor.application"\r
os="linux,macosx,win32"\r
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.34.0</version>
+ <version>5.42.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eu.etaxonomy.taxeditor.feature</artifactId>
Bundle-ManifestVersion: 2
Bundle-Name: Help
Bundle-SymbolicName: eu.etaxonomy.taxeditor.help; singleton:=true
-Bundle-Version: 5.34.0
+Bundle-Version: 5.42.0
Bundle-Activator: eu.etaxonomy.taxeditor.help.Activator
Bundle-Vendor: EDIT
Require-Bundle: org.eclipse.ui,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.34.0</version>
+ <version>5.42.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Bundle-ManifestVersion: 2
Bundle-Name: Local
Bundle-SymbolicName: eu.etaxonomy.taxeditor.local;singleton:=true
-Bundle-Version: 5.34.0
+Bundle-Version: 5.42.0
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.jface,
org.eclipse.ui.ide,
lib/c3p0-0.9.5.2.jar,
lib/h2-1.4.190.jar,
lib/mchange-commons-java-0.2.11.jar,
- lib/postgresql-42.3.6.jar,
+ lib/postgresql-42.5.1.jar,
lib/mssql-jdbc-9.4.1.jre8.jar,
lib/jtds-1.3.1.jar,
lib/mysql-connector-java-8.0.29.jar,
Import-Package: javax.annotation;version="1.2.0",
eu.etaxonomy.cdm.api.application,
eu.etaxonomy.cdm.api.service,
+ eu.etaxonomy.cdm.api.service.geo,
eu.etaxonomy.cdm.cache,
eu.etaxonomy.cdm.common,
eu.etaxonomy.cdm.common.monitor,
lib/,\
lib/h2-1.4.190.jar,\
lib/mchange-commons-java-0.2.11.jar,\
- lib/postgresql-42.3.6.jar,\
+ lib/postgresql-42.5.1.jar,\
lib/mssql-jdbc-9.4.1.jre8.jar,\
lib/jtds-1.3.1.jar,\
lib/mysql-connector-java-8.0.29.jar,\
<elements xsi:type="application:Addon" xmi:id="_q4JBkJFJEeeDJpjGQES7gw" elementId="eu.etaxonomy.taxeditor.event.EventUtility" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.event.EventUtility"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_mNW70LMnEeeMU61m8yqdaA" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:eu.etaxonomy.taxeditor.workbench.menuseparator.referencing">
- <elements xsi:type="menu:HandledMenuItem" xmi:id="_mNW72bMnEeeMU61m8yqdaA" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.datasource" label="Datasource" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/system-file-manager.png" tooltip="%command.label.2" command="_bnVKsCZxEeeQLpuomSmVoQ">
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_mNW72bMnEeeMU61m8yqdaA" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.datasource" visible="false" label="Datasource Test" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/system-file-manager.png" tooltip="%command.label.2" enabled="false" command="_bnVKsCZxEeeQLpuomSmVoQ">
<parameters xmi:id="_mNW72rMnEeeMU61m8yqdaA" elementId="eu.etaxonomy.taxeditor.webapp.showView.parameter.dataSourceView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.view.datasource"/>
</elements>
</fragments>
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.34.0</version>
+ <version>5.42.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eu.etaxonomy.taxeditor.local</artifactId>
String partId = "eu.etaxonomy.taxeditor.navigation.navigator";
for (MPart part : parts) {
partService.hidePart(part);
-
}
RemotingLoginDialogLocal loginDialog = new RemotingLoginDialogLocal(shell,
* 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.local.server;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.swt.widgets.Display;
import org.springframework.core.io.Resource;
-import eu.etaxonomy.cdm.api.application.CdmApplicationController;
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
import eu.etaxonomy.cdm.api.application.ICdmRepository;
import eu.etaxonomy.cdm.config.CdmSourceException;
import eu.etaxonomy.cdm.config.ICdmSource;
import eu.etaxonomy.cdm.database.DbSchemaValidation;
-import eu.etaxonomy.cdm.database.ICdmDataSource;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.metadata.CdmMetaData;
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
import eu.etaxonomy.taxeditor.store.LoginManager;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
-
/**
* @author n.hoffmann
* @created Dec 8, 2010
ICdmSource cdmSource,
DbSchemaValidation dbSchemaValidation,
Resource applicationContextBean) {
+
super(String.format(Messages.CdmStoreConnector_CREATING_DATAMODEL, cdmSource));
this.display = display;
this.cdmSource = cdmSource;
try {
dialog.run(true, true, new IRunnableWithProgress() {
+
@Override
public void run(final IProgressMonitor monitor) {
try {
}
});
- ICdmRepository applicationController = null;
+ CdmApplicationRemoteController applicationController = null;
if (!monitor.isCanceled()) {
CdmProgressMonitorAdapter subprogressMonitor = CdmProgressMonitorAdapter
.CreateSubMonitor(monitor, 3);
// genrerate new application controller
- applicationController = getApplicationController(cdmSource,subprogressMonitor);
+ applicationController = getApplicationController(cdmSource, subprogressMonitor);
}
if (!monitor.isCanceled()) {
- CdmStoreLocal.setInstance(applicationController, cdmSource);
- CdmStoreLocal.getTermManager().reset();
+ CdmStore.setInstance(applicationController, cdmSource);
+ CdmStore.getTermManager().reset();
monitor.subTask(Messages.CdmStoreConnector_AUTHENTICATING_USER);
display.syncExec(()-> {
try {
}
}
- private ICdmRepository getApplicationController(ICdmSource cdmSource, CdmProgressMonitorAdapter subprogressMonitor) {
- if(cdmSource instanceof ICdmDataSource) {
- return CdmApplicationController.NewInstance(applicationContextBean,
- (ICdmDataSource)cdmSource,
- dbSchemaValidation,
- false,
- subprogressMonitor);
- } else if(cdmSource instanceof ICdmRemoteSource) {
+ private CdmApplicationRemoteController getApplicationController(ICdmSource cdmSource, CdmProgressMonitorAdapter subprogressMonitor) {
+ if(cdmSource instanceof ICdmRemoteSource) {
return CdmApplicationRemoteController.NewInstance((ICdmRemoteSource)cdmSource,
subprogressMonitor,
null);
import org.eclipse.swt.widgets.Display;
import org.springframework.core.io.Resource;
-import eu.etaxonomy.cdm.api.application.ICdmRepository;
+import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
import eu.etaxonomy.cdm.cache.CdmRemoteCacheManager;
import eu.etaxonomy.cdm.config.ICdmSource;
import eu.etaxonomy.cdm.database.DbSchemaValidation;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
-
/**
* @author k.luther
* @since Sep 18, 2020
protected static CdmStoreConnectorLocal job;
private static CdmServer managedServer;
- /**
- * @param repository
- * @param cdmSource
- */
- protected CdmStoreLocal(ICdmRepository repository, ICdmSource cdmSource) {
+
+ protected CdmStoreLocal(CdmApplicationRemoteController repository, ICdmSource cdmSource) {
super(repository, cdmSource);
- // TODO Auto-generated constructor stub
}
-
/**
* Initialize with a specific datasource
- *
- * @param datasource
- * a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
*/
public static void connect(ICdmSource cdmSource) {
connect(cdmSource, DEFAULT_DB_SCHEMA_VALIDATION,
/**
* Initialize and provide
- *
- * @param datasource
- * @param dbSchemaValidation
- * @param applicationContextBean
*/
private static void connect(final ICdmSource cdmSource,
final DbSchemaValidation dbSchemaValidation,
import java.io.File;
import java.io.IOException;
-import java.net.SocketTimeoutException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
import org.apache.commons.lang3.StringUtils;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.preferences.ConfigurationScope;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTException;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.progress.IProgressConstants;
import org.eclipse.wb.swt.SWTResourceManager;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-import org.springframework.security.authentication.BadCredentialsException;
-import org.springframework.security.authentication.LockedException;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-
-import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration;
-import eu.etaxonomy.cdm.api.application.CdmApplicationState;
-import eu.etaxonomy.cdm.api.service.IUserService;
-import eu.etaxonomy.cdm.common.CdmUtils;
+
import eu.etaxonomy.cdm.config.CdmSourceException;
import eu.etaxonomy.cdm.model.metadata.CdmMetaData;
import eu.etaxonomy.cdm.persistence.permission.Role;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-import eu.etaxonomy.taxeditor.remoting.server.CdmServerException;
import eu.etaxonomy.taxeditor.remoting.server.CdmServerUtils;
-import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteLocalhostSource;
import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfo;
import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfo.CdmInstanceInfo;
-import eu.etaxonomy.taxeditor.remoting.source.ICdmRemoteSource;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.LoginManager;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
private Logger logger = LogManager.getLogger(getClass());
-// protected Shell shlConnect;
-// private Text txtCdmServerStatus;
-// private Text txtCdmInstanceStatus;
-//
-// private Button btnConnect;
-//
-// private Composite remotingComposite;
-// private Button btnCdmServerRefresh;
-// private Button btnCdmInstanceRefresh;
-// private Button btnStopServer;
-// private Composite loginComposite;
-// private Label lblLogin;
-// private Text txtLogin;
-// private Label lblPassword;
-// private Text txtPassword;
-// private Button btnRememberMe;
-// private Label lblDefaultLogin;
-// private Composite compAdvanced;
-// private Label lblPort;
-// private Text txtPort;
-// private Label lblServerCdmlibVersion;
-// private Text txtServerCdmlibVersion;
-// private ExpandableComposite expandableCompositeAdvanced;
-// private StyledText styledTxtMessage;
-//
-// private Label lblEditorCdmlibVersion;
-// private Text txtEditorCdmlibVersion;
-// private Label lblServerSchemaVersion;
-// private Text txtServerSchemaVersion;
-// private Label lblEditorCdmVersion;
-// private Text txtEditorCdmVersion;
-//
-// private final int MESSAGE_HEIGHT = 50;
-// private final int COMBO_MIN_WIDTH =200;
-// private final int CONTROLS_MIN_HEIGHT = 23; //does not seem to work yet
-//// private final int MIN_EXP_HEIGHT = 380;
-//
-// private boolean autoConnect = false;
-// private boolean loadLoginPrefs = true;
-// private boolean isDevRemoteSource = false;
-
-// private Job serverJob;
-// protected Object result;
-//
-// private final Map<String, CdmServerInfo> serverInfoMap = new HashMap<>();
-
-// private String serverName;
-// private String instanceName;
-// private CdmServerInfo selectedServerInfo;
-// private CdmInstanceInfo selectedCdmInstance;
-// private String login;
-// private String password;
/**
* Create the dialog.
*/
public RemotingLoginDialogLocal(Shell parent, int style) {
super(parent, style);
- setText(Messages.RemotingLoginDialog_LABEL_LOGIN);
+ //setText(Messages.RemotingLoginDialog_LABEL_LOGIN);
this.isLocal = true;
}
-
- @Override
- public Object open(ICdmRemoteSource source, boolean loadLoginPrefs, boolean autoConnect) {
- this.loadLoginPrefs = loadLoginPrefs;
- this.serverName = source.getName();
- if (source instanceof CdmRemoteLocalhostSource){
- this.instanceName = ((CdmRemoteLocalhostSource)source).getDatasourceName();
- }else{
- String contextPath = source.getContext();
- this.instanceName = contextPath == null? "" : contextPath.substring(contextPath.lastIndexOf("/") + 1); //$NON-NLS-1$
- }
- return open(serverName, instanceName, loadLoginPrefs, autoConnect);
- }
-
-
- @Override
- public Object open(String serverName, String instanceName, boolean loadLoginPrefs, boolean autoConnect) {
- this.serverName = serverName;
- this.instanceName = instanceName;
- this.loadLoginPrefs = loadLoginPrefs;
- this.autoConnect = autoConnect;
- return open();
- }
-
- /**
- * Open the dialog.
- * @return the dialog result
- */
-
- @Override
- public Object open() {
-
- createContents();
- if(serverName == null && instanceName == null) {
- readPrefLastServerInstance();
- }
- expandableCompositeAdvanced.setExpanded(false);
-
- setEditorInfo();
- populateCdmServerCombo();
- shlConnect.pack(true);
-
- setCenterPoint();
- shlConnect.open();
-
- Display display = getParent().getDisplay();
- while (!shlConnect.isDisposed()) {
- if (!display.isDisposed()){
- if (!display.readAndDispatch()) {
- display.sleep();
- }
- }
- }
- return result;
- }
-
/**
* Create contents of the dialog.
*/
txtEditorCdmVersion = new Text(compAdvanced, SWT.BORDER);
txtEditorCdmVersion.setEditable(false);
txtEditorCdmVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
- }
-
- @Override
- public void setCenterPoint() {
- Rectangle parentSize = getParent().getBounds();
- Rectangle shellSize = shlConnect.getBounds();
- int locationX = (parentSize.width - shellSize.width)/2+parentSize.x;
- int locationY = (parentSize.height - shellSize.height)/2+parentSize.y;
- shlConnect.setLocation(new Point(locationX, locationY));
+ this.comboCdmServer.setEnabled(this.allowServerChange);
+ this.comboCdmInstance.setEnabled(this.allowInstanceChange);
}
-
- @SuppressWarnings("unused")
- private void addEmptyCells(int cnt) {
- for (int i = 0; i < cnt; i++) {
- new Label(compAdvanced, SWT.NONE);
- }
- }
-
@Override
protected void onConnectButtonPressed() {
if(selectedServerInfo.isLocalhostMgd() && !isSelectedCdmInstanceRunningInManagedServer()) {
}
}
-// private void populateCdmServerCombo() {
-// Job job = new Job(Messages.RemotingLoginDialog_RETRIEVE_SERVER_INSTANCES) {
-// @Override
-// protected IStatus run(IProgressMonitor monitor) {
-// Display.getDefault().syncExec(new Runnable() {
-// @Override
-// public void run() {
-// //TODO performance
-// for(CdmServerInfo csii : CdmServerInfo.getCdmServers(true)) {
-// serverInfoMap.put(csii.getName(), csii);
-// comboCdmServer.add(csii.getName());
-// }
-// int serverIndex = -1;
-// if(serverName != null) {
-// serverIndex = comboCdmServer.indexOf(serverName);
-// }
-// if(serverIndex == -1) {
-// comboCdmServer.select(0);
-// autoConnect = false;
-// } else {
-// comboCdmServer.select(serverIndex);
-// }
-// ICdmSource devRemoteSource = CdmServerInfo.getDevServerRemoteSource();
-// if(devRemoteSource != null) {
-// isDevRemoteSource = true;
-// String username = System.getProperty("cdm.server.dev.username"); //$NON-NLS-1$
-// String password = System.getProperty("cdm.server.dev.password"); //$NON-NLS-1$
-// if(username != null && !username.isEmpty() && password != null && !password.isEmpty()) {
-// txtLogin.setText(username);
-// txtPassword.setText(password);
-// CdmStoreLocal.connect(devRemoteSource, RemotingLoginDialogLocal.this);
-// }
-// } else {
-// onRefreshCdmServer();
-// }
-// }
-// });
-// return Status.OK_STATUS;
-// }
-// };
-// job.schedule();
-// }
-
- @Override
- public void onRefreshCdmServer() {
- try{
- txtCdmServerStatus.setText(STATUS_CHECKING_AVAILABILITY);
- clearOnServerChange();
- emptyCredentials();
- updateSelectedCdmServer();
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- checkSelectedCdmServer();
- }
- });
- }
- catch(SWTException e){
- //catch widget is disposed exception which may occur if
- //dialog is closed but the runnable tries to update
- }
- }
-
- @Override
- protected void updateSelectedCdmServer() {
- int selIndex = comboCdmServer.getSelectionIndex();
- if(selIndex != -1) {
- selectedServerInfo = serverInfoMap.get(comboCdmServer.getItem(selIndex));
- }
- }
-
- @Override
- protected void updatePort() {
- txtPort.setText(""); //$NON-NLS-1$
- if(selectedServerInfo != null) {
- int port = selectedServerInfo.getPort();
- if(port == CdmServerInfo.NULL_PORT) {
- txtPort.setText(CdmServerInfo.NULL_PORT_STRING);
- } else {
- txtPort.setText(String.valueOf(port));
- }
- }
- }
-
- @Override
- protected int getPort() {
- int port = CdmServerInfo.NULL_PORT;
- try {
- port = Integer.valueOf(txtPort.getText());
- } catch (NumberFormatException nfe) {
- if(!CdmServerInfo.NULL_PORT_STRING.equals(txtPort.getText())) {
- setMessage(Messages.RemotingLoginDialog_MESSAGE_PORT_SHOULD_BE_INTEGER);
- }
- }
- return port;
- }
-
- private void checkSelectedCdmServer() {
- try{
- if(selectedServerInfo != null) {
- if(selectedServerInfo.isLocalhost()) {
- txtPort.setEditable(true);
- txtPort.setEnabled(true);
- }
- try {
- if(selectedServerInfo.pingServer()) {
- txtCdmServerStatus.setText(STATUS_AVAILABLE);
- populateCdmInstanceCombo(true);
- if(selectedServerInfo.isLocalhost()){
- setCdmlibVersion(txtServerCdmlibVersion);
- }else{
- String serverVersionTimestamp = generateLastModifiedTooltip(selectedServerInfo.getCdmlibLastModified());
- txtServerCdmlibVersion.setText(selectedServerInfo.getCdmlibServicesVersion() + ":" + serverVersionTimestamp); //$NON-NLS-1$
- }
- } else {
- txtCdmServerStatus.setText(STATUS_NOT_AVAILABLE);
- comboCdmInstance.removeAll();
- disableCdmInstanceControls("", ""); //$NON-NLS-1$ //$NON-NLS-2$
- }
- } catch (CdmServerException | IOException e) {
- txtCdmServerStatus.setText(STATUS_NOT_AVAILABLE);
- // TODO distinguish java.net.ConnectException: Connection refused, java.net.SocketTimeoutException: Read timed out
- Throwable cause = e;
- if(e instanceof CdmServerException && e.getCause() != null){
- cause = e.getCause();
- }
- String message = Messages.RemotingLoginDialog_CONNECTION_FAILED_MESSAGE;
- if(cause instanceof SocketTimeoutException){
- message = Messages.RemotingLoginDialog_CONNECTION_TIMEOUT_MESSAGE;
- }
- MessagingUtils.warningDialog(Messages.RemotingLoginDialog_CONNECTION_FAILED_TITLE, this,
- message);
- logger.warn(Messages.RemotingLoginDialog_CONNECTION_FAILED_TITLE, e);
- }
- }
- updatePort();
- }
- catch(SWTException e){
- //catch widget is disposed exception which may occur if
- //dialog is closed but the runnable tries to update
- }
- }
-
- @Override
- protected void populateCdmInstanceCombo(final boolean forceRefresh) {
- comboCdmInstance.removeAll();
- comboCdmInstance.setEnabled(false);
- btnConnect.setEnabled(false);
- txtCdmInstanceStatus.setText(STATUS_RETRIEVING);
- txtCdmInstanceStatus.setToolTipText(""); //$NON-NLS-1$
-
- serverJob = new Job(Messages.RemotingLoginDialog_RETRIEVE_SERVER_INSTANCES) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- if(selectedServerInfo != null) {
- if(forceRefresh) {
- selectedServerInfo.refreshInstances();
- }
- final List<CdmInstanceInfo> instances = selectedServerInfo.getInstances();
- Display.getDefault().asyncExec(()->{
- if(!instances.isEmpty()) {
- for(CdmInstanceInfo cdmInstance : instances) {
- comboCdmInstance.add(cdmInstance.getName());
- }
- int instanceIndex = -1;
- if(instanceName != null) {
- instanceIndex = comboCdmInstance.indexOf(instanceName);
- }
- if(instanceIndex == -1) {
- comboCdmInstance.select(0);
- autoConnect = false;
- } else {
- comboCdmInstance.select(instanceIndex);
- }
- onRefreshCdmInstance();
- comboCdmInstance.setEnabled(true);
- if(autoConnect) {
- connect();
- }
- } else {
- txtCdmInstanceStatus.setText(STATUS_NO_INSTANCES);
- btnConnect.setEnabled(false);
- }
- });
- }
- } catch (final CdmServerException e) {
- MessagingUtils.warn(getClass(), e);
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- disableCdmInstanceControls(STATUS_NOT_AVAILABLE, e.getMessage());
- }
- });
- }
- return Status.OK_STATUS;
- }
- };
-
- if(txtCdmServerStatus.getText().equals(STATUS_AVAILABLE) && !isDevRemoteSource) {
- // Start the Job
- serverJob.schedule();
- }
- }
-
- @Override
- public void disableCdmInstanceControls(String cdmInstanceStatus, String tooltip) {
- txtCdmInstanceStatus.setText(cdmInstanceStatus);
- txtCdmInstanceStatus.setToolTipText(tooltip);
- comboCdmInstance.setEnabled(false);
- btnConnect.setEnabled(false);
- }
- @Override
- public void onRefreshCdmInstance() {
- txtCdmInstanceStatus.setText(STATUS_CHECKING_AVAILABILITY);
- clearOnInstanceChange();
- updateSelectedCdmInstance();
- checkSelectedCdmInstance();
- updateManagedServerControls();
- }
-
- @Override
- protected void updateSelectedCdmInstance() {
- int selIndex = comboCdmInstance.getSelectionIndex();
- if(selIndex != -1) {
- selectedCdmInstance = selectedServerInfo.getInstanceFromName(comboCdmInstance.getItem(selIndex));
- if(loadLoginPrefs) {
- readPrefCredentials();
- }
- }
- }
private void updateManagedServerControls() {
if(selectedServerInfo.isLocalhostMgd()) {
}
- @Override
- public void handleError(final Throwable t) {
-
- Display.getDefault().syncExec(()-> {
- serverJob.cancel();
-
- String title = Messages.RemotingLoginDialog_SERVER_LAUNCH_ERROR;
- String message = t.getMessage();
-
- MessagingUtils.errorDialog(title,
- this,
- message,
- TaxeditorStorePlugin.PLUGIN_ID,
- t,
- true);
- });
- }
-
private void onStopManagedServer() {
try {
CdmStoreLocal.getManagedServer().stop();
if (selectedServerInfo.isLocalhostMgd()){
checkManagedSelectedInstance();
}else if (txtCdmServerStatus.getText().equals(STATUS_AVAILABLE)) {
-
+ compAdvanced.setEnabled(false);
boolean available = false;
String instanceStatus = STATUS_NOT_AVAILABLE;
String message = null;
});
}
- @Override
- public void connect() {
- checkSelectedCdmInstance();
-
- if(!txtCdmInstanceStatus.getText().equals(STATUS_AVAILABLE)) {
- return;
- }
-
- ICdmRemoteSource source = selectedServerInfo.getCdmRemoteSource(selectedCdmInstance, getPort());
-
- if(!validateLogin(source)) {
- return;
- }
-
- try {
- CdmStoreLocal.connect(source, RemotingLoginDialogLocal.this);
- } catch (Exception e) {
- // Do not expect anything to go wrong at this point, so we throw a runtime exception
- // if any problems
- throw new RuntimeException(e);
- }
- }
-
-
- @Override
- public boolean isRememberMe() {
- return btnRememberMe.getSelection();
- }
-
- private void persistPrefLastServerInstance() {
- IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode(STORE_PREFERENCES_NODE);
- Preferences lastServerInstancePrefs = preferences.node(LAST_SERVER_INSTANCE_NODE);
-
- lastServerInstancePrefs.put(LAST_SERVER_KEY, selectedServerInfo.getName());
- lastServerInstancePrefs.put(LAST_INSTANCE_KEY, selectedCdmInstance.getName());
-
- flushPreferences(lastServerInstancePrefs);
- }
-
- private void persistPrefCredentials() {
- IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode(STORE_PREFERENCES_NODE);
- Preferences credentialsPrefs = preferences.node(LOGIN_NODE);
- credentialsPrefs.put(getUsernamePrefKey(), txtLogin.getText());
- credentialsPrefs.put(getPasswordPrefKey(), txtPassword.getText());
- flushPreferences(credentialsPrefs);
- }
-
- private void removePrefCredentials() {
- IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode(STORE_PREFERENCES_NODE);
- Preferences credentialsPrefs = preferences.node(LOGIN_NODE);
- credentialsPrefs.put(getUsernamePrefKey(), txtLogin.getText());
- credentialsPrefs.put(getPasswordPrefKey(), txtPassword.getText());
- removePreferences(credentialsPrefs);
- }
-
- private void removePreferences(Preferences prefs) {
- try {
- prefs.removeNode();
- } catch (BackingStoreException bse) {
- setMessage(bse.getMessage());
- }
- }
-
- private void flushPreferences(Preferences prefs) {
- try {
- prefs.flush();
- } catch (BackingStoreException bse) {
- setMessage(bse.getMessage());
- }
- }
-
- @Override
- protected void readPrefCredentials() {
- String username, password;
- IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode(STORE_PREFERENCES_NODE);
- Preferences credentialsPrefs = preferences.node(LOGIN_NODE);
- username = credentialsPrefs.get(getUsernamePrefKey(), ""); //$NON-NLS-1$
- txtLogin.setText(username);
- password = credentialsPrefs.get(getPasswordPrefKey(),""); //$NON-NLS-1$
- txtPassword.setText(password);
- if(username.isEmpty() || password.isEmpty()) {
- autoConnect = false;
- }
- }
-
- private void readPrefLastServerInstance() {
- IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode(STORE_PREFERENCES_NODE);
- Preferences lastServerInstancePrefs = preferences.node(LAST_SERVER_INSTANCE_NODE);
-
- serverName = lastServerInstancePrefs.get(LAST_SERVER_KEY, null);
- instanceName = lastServerInstancePrefs.get(LAST_INSTANCE_KEY, null);
- }
-
- private void emptyCredentials() {
- txtLogin.setText(""); //$NON-NLS-1$
- txtPassword.setText(""); //$NON-NLS-1$
- }
-
- private String getUsernamePrefKey() {
- return selectedServerInfo.toString(selectedCdmInstance.getName(), isDevRemoteSource?getPort():-1) + USERNAME_SUFFIX;
- }
-
- private String getPasswordPrefKey() {
- return selectedServerInfo.toString(selectedCdmInstance.getName(), isDevRemoteSource?getPort():-1) + PASSWORD_SUFFIX;
- }
-
- private boolean validateLogin(ICdmRemoteSource remoteSource) {
- if(getUsername() == null || getUsername().isEmpty()) {
- setMessage(Messages.RemotingLoginDialog_LOGIN_CANNOT_BE_EMPTY);
- return false;
- }
- if(getPassword() == null || getPassword().isEmpty()) {
- setMessage(Messages.RemotingLoginDialog_PASSWORD_CANNOT_BE_EMPTY);
- return false;
- }
-
- try {
- IUserService userService = CdmApplicationRemoteConfiguration.getUserService(remoteSource);
- UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(getUsername(), getPassword());
- CdmApplicationRemoteConfiguration.getAuthenticationManager(userService).authenticate(token);
- } catch(BadCredentialsException e){
- setMessage(LoginManager.INCORRECT_CREDENTIALS_MESSAGE);
- return false;
- } catch(LockedException e){
- setMessage(LoginManager.ACCOUNT_LOCKED_MESSAGE);
- return false;
- } catch(IllegalArgumentException e){
- setMessage(LoginManager.INCORRECT_CREDENTIALS_MESSAGE);
- return false;
- }
- return true;
- }
-
-
- @Override
- public String getUsername() {
- return txtLogin.getText();
- }
-
-
- @Override
- public String getPassword() {
- return txtPassword.getText();
- }
-
-
- @Override
- public void setMessage(String message) {
- if(CdmUtils.isNotBlank(message)) {
-// if(message.length() > 50) {
-// styledTxtMessage.setToolTipText(message);
-// message = message.substring(0,50) + "..."; //$NON-NLS-1$
-// }
- styledTxtMessage.setText(message);
- styledTxtMessage.setVisible(true);
- ((GridData)styledTxtMessage.getLayoutData()).exclude = false;
-// shlConnect.setMinimumSize(MIN_WIDTH, getHeightWithoutMessage() + MESSAGE_HEIGHT);
- shlConnect.pack(true);
- } else {
- if (!styledTxtMessage.isDisposed()){
- styledTxtMessage.setText(""); //$NON-NLS-1$
- styledTxtMessage.setVisible(false);
- ((GridData)styledTxtMessage.getLayoutData()).exclude = true;
- }
- if(!shlConnect.isDisposed()){
- shlConnect.pack(true);
- }
- }
- if (!remotingComposite.isDisposed()){
- remotingComposite.layout();
- }
- }
-
-// private int getHeightWithoutMessage() {
-// if(xpndblcmpstAdvanced.isExpanded()) {
-// return MIN_EXP_HEIGHT;
-// } else {
-// return MIN_HEIGHT;
-// }
-// }
-
- @Override
- public void hide(boolean isHidden) {
- if (!shlConnect.isDisposed()){
- if(shlConnect != null && shlConnect.getDisplay() != null) {
- shlConnect.setVisible(!isHidden);
- }
- }
- }
-
-
- @Override
- public void dispose() {
- if (!shlConnect.isDisposed()){
- if(shlConnect != null && shlConnect.getDisplay() != null) {
- shlConnect.dispose();
- }
- }
- }
-
-
- @Override
- public void onComplete() {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if(selectedCdmInstance!=null){
- if(isRememberMe()) {
- persistPrefCredentials();
- }else{
- removePrefCredentials();
- }
- persistPrefLastServerInstance();
- }
- dispose();
- }
- });
- }
-
- private String generateLastModifiedTooltip(String cdmlibLastModified) {
- if(StringUtils.isBlank(cdmlibLastModified)) {
- return ""; //$NON-NLS-1$
- }
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd.HH.mm.z"); //$NON-NLS-1$
- Date cdmlibLastModifiedDate;
- String cdmlibLastModifiedTimestamp = ""; //$NON-NLS-1$
-
- cdmlibLastModifiedDate = new Date(Long.valueOf(cdmlibLastModified));
- cdmlibLastModifiedTimestamp = sdf.format(cdmlibLastModifiedDate);
-
- return cdmlibLastModifiedTimestamp;
- }
-
- private void setEditorInfo() {
- txtEditorCdmVersion.setText(CdmMetaData.getDbSchemaVersion());
- setCdmlibVersion(txtEditorCdmlibVersion);
- }
-
- private void setCdmlibVersion(Text txt) {
- String editorVersionTimestamp = generateLastModifiedTooltip(CdmApplicationState.getCdmlibLastModified());
- txt.setText(CdmApplicationState.getCdmlibVersion() + ":" + editorVersionTimestamp); //$NON-NLS-1$
- }
-
- private void clearOnServerChange() {
- setMessage(""); //$NON-NLS-1$
- txtServerSchemaVersion.setText(""); //$NON-NLS-1$
- txtServerCdmlibVersion.setText(""); //$NON-NLS-1$
- txtServerCdmlibVersion.setToolTipText(""); //$NON-NLS-1$
- txtServerSchemaVersion.setText(""); //$NON-NLS-1$
- comboCdmInstance.removeAll();
- txtCdmInstanceStatus.setText(""); //$NON-NLS-1$
- txtPort.setEditable(false);
- txtPort.setEnabled(false);
- }
-
- private void clearOnInstanceChange() {
- setMessage(""); //$NON-NLS-1$
- txtServerSchemaVersion.setText(""); //$NON-NLS-1$
- btnConnect.setText(LABEL_CONNECT);
- btnConnect.setBackground(null);
- btnConnect.requestLayout();
- }
-
- @SuppressWarnings("unused") //in work, for future centralized handling of control's status
- private void updateControls(){
-
- //server
-// comboCdmServer; //nothing to change
- String strServerStatus = this.selectedServerInfo != null? STATUS_NOT_AVAILABLE : STATUS_AVAILABLE;
- txtCdmServerStatus.setText(strServerStatus);
-// btnCdmServerRefresh; //nothing to change
-
- //database
-// comboCdmInstance
- String strInstanceStatus = this.selectedCdmInstance != null? STATUS_NOT_AVAILABLE : STATUS_AVAILABLE;
- txtCdmInstanceStatus.setText(strInstanceStatus);
-// btnCdmInstanceRefresh; //nothing to change
-
- //login + connect
- txtLogin.setText(Nz(login));
- txtPassword.setText(Nz(password));
- btnConnect.setText(LABEL_CONNECT); //TODO
- btnConnect.setEnabled(true);
-
- //rememberMe + defaultValues
-// btnRememberMe;
-// lblDefaultLogin;
-
- //message
-// styledTxtMessage;
-
- //Advanced
-// txtPort
-// btnStopServer;
-
-// txtServerCdmlibVersion;
-// txtEditorCdmlibVersion;
-// txtServerSchemaVersion;
-// txtEditorCdmVersion;
- }
-
- private String Nz(String value) {
- return CdmUtils.Nz(value);
- }
}
* 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.local.view.datasource.e4.handler;
import javax.inject.Named;
import eu.etaxonomy.taxeditor.local.view.datasource.e4.CdmDataSourceViewPartE4;
/**
- *
* @author pplitzner
* @date 22.08.2017
- *
*/
-public abstract class AbstractDataSourceHandlerE4 {
+public abstract class AbstractDataSourceHandler {
protected UISynchronize sync;
* 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.local.view.datasource.e4.handler;
import org.eclipse.core.runtime.IStatus;
import eu.etaxonomy.taxeditor.local.view.datasource.e4.CdmDataSourceViewPartE4;
/**
- *
* @author pplitzner
* @date 22.08.2017
- *
*/
-public class CloneDataSourceHandlerE4 extends AbstractDataSourceHandlerE4 {
+public class CloneDataSourceHandlerE4 extends AbstractDataSourceHandler {
- /** {@inheritDoc} */
@Override
public boolean specificExecute(CdmDataSourceViewPartE4 dataSourceViewPart, CdmMetaDataAwareDataSourceContainer container, Shell shell) {
ICdmSource cdmSource = container.getCdmSource();
}
return true;
}
-
-}
+}
\ No newline at end of file
* @date 22.08.2017
*
*/
-public class DeleteDataSourceHandlerE4 extends AbstractDataSourceHandlerE4 {
+public class DeleteDataSourceHandlerE4 extends AbstractDataSourceHandler {
* @author pplitzner
* @date 22.08.2017
*/
-public class EditDataSourceHandlerE4 extends AbstractDataSourceHandlerE4 {
+public class EditDataSourceHandlerE4 extends AbstractDataSourceHandler {
@Override
public boolean specificExecute(CdmDataSourceViewPartE4 dataSourceViewPart, CdmMetaDataAwareDataSourceContainer container, Shell shell) {
Bundle-ManifestVersion: 2
Bundle-Name: eu.etaxonomy.taxeditor.molecular.lib
Bundle-SymbolicName: eu.etaxonomy.taxeditor.molecular.lib;singleton:=true
-Bundle-Version: 5.34.0
+Bundle-Version: 5.42.0
Bundle-ClassPath: .,
lib/owlapi-xmlutils-4.1.4.jar,
lib/commons-collections4-4.1.jar,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.34.0</version>
+ <version>5.42.0</version>
</parent>
<name>Molecular Library Dependencies Bundle</name>
Bundle-ManifestVersion: 2
Bundle-Name: Molecular Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.molecular;singleton:=true
-Bundle-Version: 5.34.0
+Bundle-Version: 5.42.0
Bundle-Activator: eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.34.0</version>
+ <version>5.42.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
import eu.etaxonomy.cdm.common.URI;
import eu.etaxonomy.cdm.model.media.MediaUtils;
public static final String CONSENSUS_NAME = "Consensus"; //$NON-NLS-1$
- private ConversationHolder conversationHolder;
- private final AlignmentModelChangeListener DIRTY_LISTENER = new AlignmentModelChangeListener() {
+ private final AlignmentModelChangeListener DIRTY_LISTENER = new AlignmentModelChangeListener() {
@Override
public <T> void afterTokenChange(TokenChangeEvent<T> e) {
setDirty();
for (SingleReadAlignment singleReadAlignment : sequenceNode.getSingleReadAlignments()) {
try {
SingleRead pherogramInfo = singleReadAlignment.getSingleRead();
- String id = addRead(DerivateLabelProvider.getDerivateText(pherogramInfo, conversationHolder),
+ String id = addRead(DerivateLabelProvider.getDerivateText(pherogramInfo),
getPherogramURI(pherogramInfo),
singleReadAlignment.isReverseComplement(),
singleReadAlignment.getEditedSequence(),
@PostConstruct
public void createPartControl(Composite parent) {
- if (CdmStore.isActive()){
- if(conversationHolder == null){
- conversationHolder = CdmStore.createConversation();
- }
- }
- else{
- return;
- }
- SWTComponentFactory.getInstance().getSWTComponent(getAlignmentsContainer(), parent, SWT.NONE);
+ SWTComponentFactory.getInstance().getSWTComponent(getAlignmentsContainer(), parent, SWT.NONE);
Display.getCurrent().addFilter(SWT.FocusIn, ACTION_UPDATER);
Display.getCurrent().addFilter(SWT.FocusOut, ACTION_UPDATER);
}
CLIPBOARD.dispose();
input.dispose();
- if(conversationHolder!=null){
- conversationHolder.close();
- conversationHolder = null;
- }
if(input!=null){
input.dispose();
}
}
}
- if (!conversationHolder.isBound()) {
- conversationHolder.bind();
- }
monitor.worked(1);
input.merge();
- // Commit the conversation and start a new transaction immediately:
- conversationHolder.commit(true);
monitor.worked(1);
dirty.setDirty(false);
@Focus
public void setFocus() {
- if(conversationHolder != null){
- conversationHolder.bind();
- }
if(input!=null){
input.bind();
}
Bundle-ManifestVersion: 2
Bundle-Name: Navigation Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.navigation;singleton:=true
-Bundle-Version: 5.34.0
+Bundle-Version: 5.42.0
Bundle-Activator: eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin
Bundle-Vendor: EDIT
Export-Package: eu.etaxonomy.taxeditor.navigation,
wizard.name.2 = Excel Normal Explicit\r
wizard.name.3 = ABCD file\r
wizard.name.4 = SDD\r
-wizard.name.5 = Specimen CDM Excel\r
wizard.name.6 = JAXB\r
wizard.name.8 = SDD\r
wizard.name.9 = DwC-A\r
wizard.name.19 = CSV_NAME\r
wizard.name.20 = CSV_PRINT\r
wizard.name.22 = CDM light (csv)\r
+wizard.name.122 = Col DP\r
+wizard.name.123 = WFO Backbone\r
wizard.name.14 = Specimen\r
wizard.name.23 = Excel Distribution Data Update\r
wizard.name.24 = RIS\r
wizard.name.2 = Excel Normal Explicit\r
wizard.name.3 = ABCD Datei\r
wizard.name.4 = SDD\r
-wizard.name.5 = Beleg CDM Excel\r
wizard.name.6 = JAXB\r
wizard.name.8 = SDD\r
wizard.name.9 = DwC-A\r
wizard.name.19 = CSV_NAME\r
wizard.name.20 = CSV_PRINT\r
wizard.name.22 = CDM light (csv)\r
+wizard.name.122 = Col DP\r
+wizard.name.123 = WFO Backbone\r
wizard.name.14 = Beleg\r
wizard.name.23 = Excel Verbreitungsdaten Update\r
wizard.name.24 = RIS\r
<imports xsi:type="commands:Command" xmi:id="_AqZK8KnKEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importExcelTaxa"/>
<imports xsi:type="commands:Command" xmi:id="_AsTPcKnKEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importRisReference"/>
<imports xsi:type="commands:Command" xmi:id="_AuNT8KnKEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importSdd"/>
- <imports xsi:type="commands:Command" xmi:id="_Av4u8KnKEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importExcelSpecimen"/>
<imports xsi:type="commands:Command" xmi:id="_LCsbgKnKEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importTcs"/>
<imports xsi:type="commands:Command" xmi:id="_fQX7EKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportJaxb"/>
<imports xsi:type="commands:Command" xmi:id="_iaZnEKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportSdd"/>
<imports xsi:type="commands:Command" xmi:id="_mOC30KqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportCsvPrint"/>
<imports xsi:type="commands:Command" xmi:id="_n1FHEKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportCdmLight"/>
<imports xsi:type="commands:Command" xmi:id="_aN3BsL2gEeeyWfw0n8-ICQ" elementId="eu.etaxonomy.taxeditor.workbench.command.collapse"/>
+ <imports xsi:type="commands:Command" xmi:id="_Ih5dAEjAEe6gZ65AByRHxQ" elementId="eu.etaxonomy.taxeditor.store.command.exportColDP"/>
+ <imports xsi:type="commands:Command" xmi:id="_lMkLQLnKEe6hy6A4KTNM1w" elementId="eu.etaxonomy.taxeditor.store.command.exportWfoBackbone"/>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_oDvMsCTfEeeiN5lBIuqN3g" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.trimcontribution.mainToolbar">
<elements xsi:type="menu:ToolControl" xmi:id="_7kZI4CTfEeeiN5lBIuqN3g" elementId="eu.etaxonomy.taxeditor.navigation.toolcontrol.search_bar" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.search.SearchBar"/>
</fragments>
<children xsi:type="menu:Menu" xmi:id="_2sWBQAUvEeqpi5fkbwgEHQ" elementId="eu.etaxonomy.taxeditor.navigation.menu.specimen" label="Specimen">
<children xsi:type="menu:HandledMenuItem" xmi:id="_YMugAKkeEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importSpecimens" label="%handledmenuitem.label.2" command="_yBC78KnJEeeTAPHmaMLwQQ"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_2NC0kKnEEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importAbcd" label="%wizard.name.3" command="_AOq4QKnKEeeTAPHmaMLwQQ"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_6uLdcKnEEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importExcelSpecimen" label="%wizard.name.5" command="_Av4u8KnKEeeTAPHmaMLwQQ"/>
</children>
<children xsi:type="menu:Menu" xmi:id="_6UTmcAUvEeqpi5fkbwgEHQ" elementId="eu.etaxonomy.taxeditor.navigation.menu.taxa" label="Taxa">
<children xsi:type="menu:HandledMenuItem" xmi:id="_6YeTMKnEEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importExcelTaxa" label="%wizard.name.2" command="_AqZK8KnKEeeTAPHmaMLwQQ"/>
</children>
<children xsi:type="menu:Menu" xmi:id="_rbInwKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.menu.export" label="%menu.label.2">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_3qJaEMuuEeiGO4eKaXkw0w" coreExpressionId="isShowIOMenuEnabled"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_zDuJwKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportDwca" label="%wizard.name.9" command="_juMxQKqhEeeXcJGhyhlrKA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_IfCk8LnMEe6hy6A4KTNM1w" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.wizardname123" label="%wizard.name.123" command="_lMkLQLnKEe6hy6A4KTNM1w"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_kVpisEi-Ee6gZ65AByRHxQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportColDP" label="%wizard.name.122" command="_Ih5dAEjAEe6gZ65AByRHxQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_44XB4KqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportCdmLight" label="%wizard.name.22" command="_n1FHEKqhEeeXcJGhyhlrKA"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_8AZ3kEx-Ee6gZ65AByRHxQ" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.9"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_tPAZIKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportJaxb" label="%wizard.name.6" command="_fQX7EKqhEeeXcJGhyhlrKA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_xwZgsKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportSdd" label="%wizard.name.8" command="_iaZnEKqhEeeXcJGhyhlrKA"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_zDuJwKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportDwca" label="%wizard.name.9" command="_juMxQKqhEeeXcJGhyhlrKA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_0e68cKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportCsv" label="%wizard.name.18" command="_kuP5AKqhEeeXcJGhyhlrKA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_2C_-UKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportCsvName" label="%wizard.name.19" command="_lMwZ8KqhEeeXcJGhyhlrKA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_3p8G8KqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportCsvPrint" label="%wizard.name.20" command="_mOC30KqhEeeXcJGhyhlrKA"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_44XB4KqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportCdmLight" label="%wizard.name.22" command="_n1FHEKqhEeeXcJGhyhlrKA"/>
</children>
<children xsi:type="menu:MenuSeparator" xmi:id="_x0uEMJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.3"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_yH9JQJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.delete" label="%command.label.10" command="__n644JIxEeeJAdt8ZUxyaw"/>
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.34.0</version>
+ <version>5.42.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_EXPORTSDD = "eu.etaxonomy.taxeditor.store.command.exportSdd";
public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTABCD = "eu.etaxonomy.taxeditor.store.command.importAbcd";
public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTEXCELDISTRIBUTION = "eu.etaxonomy.taxeditor.store.command.importExcelDistribution";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTEXCELSPECIMEN = "eu.etaxonomy.taxeditor.store.command.importExcelSpecimen";
public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTEXCELTAXA = "eu.etaxonomy.taxeditor.store.command.importExcelTaxa";
public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTRISREFERENCE = "eu.etaxonomy.taxeditor.store.command.importRisReference";
public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTSDD = "eu.etaxonomy.taxeditor.store.command.importSdd";
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin;
Collection<MPart> dirtyParts = partService.getDirtyParts();
for (MPart part : dirtyParts) {
- if(part.getObject() instanceof TaxonNameEditorE4){
- TaxonEditorInputE4 input = ((TaxonNameEditorE4) part.getObject()).getEditorInput();
+ if(part.getObject() instanceof TaxonEditor){
+ TaxonEditorInput input = ((TaxonEditor) part.getObject()).getEditorInput();
if(input.getTaxonNode().getUuid().equals(taxonNode.getUuid())){
return true;
}
Collection<MPart> dirtyParts = partService.getDirtyParts();
for (MPart part : dirtyParts) {
- if(part.getObject() instanceof TaxonNameEditorE4){
- TaxonEditorInputE4 input = ((TaxonNameEditorE4) part.getObject()).getEditorInput();
+ if(part.getObject() instanceof TaxonEditor){
+ TaxonEditorInput input = ((TaxonEditor) part.getObject()).getEditorInput();
if(input.getTaxonNode().equals(taxonNode)){
return true;
}
+++ /dev/null
-/**
-* 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.navigation.key.polytomous.e4;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.swt.widgets.Display;
-
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.description.PolytomousKey;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour;
-import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
-
-/**
- *
- * @author pplitzner
- * @since Sep 28, 2017
- *
- */
-public class PolytomousKeyViewPartDataChangeBehaviorE4 extends
- AbstractDataChangeBehaviour {
-
- private static final String UPDATING_POLYTOMOUS_KEY_VIEWER = Messages.PolytomousKeyViewPartDataChangeBehavior_UPDATE;
- private final PolytomousKeyViewPartE4 source;
-
- public PolytomousKeyViewPartDataChangeBehaviorE4(
- PolytomousKeyViewPartE4 polytomousKeyViewPart) {
- source = polytomousKeyViewPart;
- }
-
- @Override
- public void reactOnDataChange(CdmDataChangeMap changeEvents) {
- if(isRelevant(changeEvents)){
- final Display display = Display.getCurrent();
- Job job = new Job(UPDATING_POLYTOMOUS_KEY_VIEWER) {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask(UPDATING_POLYTOMOUS_KEY_VIEWER, 3);
- monitor.worked(1);
-
- // clear the session completely
- monitor.subTask(Messages.PolytomousKeyViewPartDataChangeBehavior_CLEAR);
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- source.getConversationHolder().clear();
- }
- });
- // FIXME completely clearing the session is a brute force approach.
- // It would be much more elegant to clear only those elements that have been changed.
- // I could not get that to work but we should consider workin on this because we might
- // run into serious performance issues, especially when it comes to large trees
- //
- // at least, we moved this to a job so it can run in a background thred
- // seems to improve the situation but not sure if final solution
- monitor.worked(1);
-
- monitor.subTask(Messages.PolytomousKeyViewPartDataChangeBehavior_REFRESH);
-
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- source.refresh();
- }
- });
-
-
-
- monitor.worked(1);
- monitor.done();
- return Status.OK_STATUS;
- }
- };
-
- job.setPriority(Job.SHORT);
- job.schedule();
-
- }
- }
-
- private boolean isRelevant(CdmDataChangeMap changeEvents) {
- for(CdmDataChangeEvent event : changeEvents.getAllEvents()){
- EventType eventType = event.getEventType();
- CdmBase eventEntity = event.getEntity();
-
- // all poyltomous key changes are relevant
- if((eventType == EventType.INSERT || eventType == EventType.DELETE || eventType == EventType.UPDATE)
- && eventEntity instanceof PolytomousKey){
- return true;
- }
- }
- return false;
- }
-}
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
import eu.etaxonomy.cdm.api.application.ICdmChangeListener;
import eu.etaxonomy.cdm.api.application.ICdmDataChangeService;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
-import eu.etaxonomy.taxeditor.model.DataChangeBridge;
import eu.etaxonomy.taxeditor.model.IContextListener;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyContentProvider;
* @since Sep 28, 2017
*/
public class PolytomousKeyViewPartE4 implements
- IConversationEnabled, ICdmEntitySessionEnabled<PolytomousKey>, IPostOperationEnabled,
+ ICdmEntitySessionEnabled<PolytomousKey>, IPostOperationEnabled,
ICdmChangeListener {
private class FilterModifyListener implements ModifyListener{
}
private ListViewer viewer;
- private ConversationHolder conversation;
private IContextListener contextListener;
private final CdmFormFactory formFactory;
private Text text_filter;
private ICdmEntitySession cdmEntitySession;
- private PolytomousKeyViewPartDataChangeBehaviorE4 dataChangeBehavior;
+ //private PolytomousKeyViewPartDataChangeBehaviorE4 dataChangeBehavior;
@Inject
}
private void setInput() {
- conversation = CdmStore.createConversation();
- conversation.registerForDataStoreChanges(this);
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
CdmApplicationState.getCurrentDataChangeService().register(this);
}
}
- @Override
- public void update(CdmDataChangeMap changeEvents) {
- if (dataChangeBehavior == null) {
- dataChangeBehavior = new PolytomousKeyViewPartDataChangeBehaviorE4(this);
- }
-
- DataChangeBridge.handleDataChange(changeEvents, dataChangeBehavior);
- }
-
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
@PreDestroy
public void dispose() {
- if(conversation!=null){
- conversation.unregisterForDataStoreChanges(this);
- conversation.close();
- CdmStore.getContextManager().removeContextListener(contextListener);
- conversation = null;
- }
+
if(cdmEntitySession != null) {
+ CdmStore.getContextManager().removeContextListener(contextListener);
cdmEntitySession.dispose();
cdmEntitySession = null;
}
@Override
public boolean postOperation(Object objectAffectedByOperation) {
- getConversationHolder().bind();
- getConversationHolder().commit(true);
viewer.refresh();
return true;
}
}
public void refresh() {
- getConversationHolder().bind();
- //FIXME : Need to make sure this is a stable fix (ticket 3822)
- getConversationHolder().commit();
List<PolytomousKey> input = CdmStore.getService(IPolytomousKeyService.class).list(PolytomousKey.class, null, null, null, null);
if(!viewer.getControl().isDisposed()){
viewer.setInput(input);
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.MessageDialog;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
public DeleteOperation(String label, IUndoContext undoContext,
PolytomousKey key,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled,
ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
+ super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
this.key = key;
this.cdmEntitySessionEnabled = cdmEntitySessionEnabled;
}
+/**
+* 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.navigation.key.polytomous.operation;
import java.util.UUID;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService;
-import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
-import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
/**
* Operation responsible for refreshing key nodes node numbers of the Polytomous Keys.
* The refresh is performed on all keys/
- *
+ *
* @author c.mathew
* @created Jan 17 2013
- * @version 1.0
- *
*/
public class RefreshNodesOperation extends AbstractPostTaxonOperation {
- PolytomousKey key;
-
+ private PolytomousKey key;
+
public RefreshNodesOperation(String label,
- IUndoContext undoContext,
- PolytomousKey key,
+ IUndoContext undoContext,
+ PolytomousKey key,
IPostOperationEnabled postOperationEnabled) {
super(label, undoContext, postOperationEnabled);
this.key = key;
}
-
- /* (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 {
UUID polytomousKeyNodeUuid = key.getRoot().getUuid();
- ConversationHolder conversation = CdmStore.createConversation();
PolytomousKeyNode root = CdmStore.getService(IPolytomousKeyNodeService.class).load(polytomousKeyNodeUuid, null);
- root.refreshNodeNumbering();
+ root.refreshNodeNumbering();
CdmStore.getService(IPolytomousKeyNodeService.class).saveOrUpdate(root);
- conversation.commit(true);
return postExecute(root);
}
- /* (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 {
- // TODO Auto-generated method stub
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 {
- // TODO Auto-generated method stub
return null;
}
-
-}
+}
\ No newline at end of file
DeleteHandler_CONFIRM_MESSAGE=Do you want to delete the selected key(s)?
DeleteHandler_DELETE_ALL=Delete all children
DeleteHandler_DELETE_CLASSIFICATION=Do you really want to delete the classification?
-DeleteHandler_DELETE_NODE=Do you really want to delete the selected node?
-DeleteHandler_DELETE_NODES=Do you really want to delete the selected nodes?
+DeleteHandler_DELETE_NODE=Do you really want to delete the selected node? Taxa will be deleted including all factual data.
+DeleteHandler_DELETE_NODES=Do you really want to delete the selected nodes? Taxa will be deleted including all factual data.
DeleteHandler_MOVE_TO_PARENT=Move children to parent node
DeleteHandler_SKIP=Cancel
DeleteHandler_DELETE=Delete
DeleteHandler_CONFIRM_MESSAGE=Wollen wie Sie die ausgewählten Schlüssen löschen?
DeleteHandler_DELETE_ALL=Alle Kinder löschen
DeleteHandler_DELETE_CLASSIFICATION=Wollen Sie die Klassifikation wirklich löschen?
-DeleteHandler_DELETE_NODE=Wollen Sie den ausgewählten Knoten wirklich löschen?
-DeleteHandler_DELETE_NODES=Wollen Sie die ausgewählten Knoten wirklich löschen?
+DeleteHandler_DELETE_NODE=Wollen Sie den ausgewählten Knoten wirklich löschen? Taxa werden inklusive aller Faktendaten gelöscht.
+DeleteHandler_DELETE_NODES=Wollen Sie die ausgewählten Knoten wirklich löschen? Taxa werden inklusive aller Faktendaten gelöscht.
DeleteHandler_MOVE_TO_PARENT=Verschiebe Kinder zu Elternknoten
DeleteHandler_SKIP=Abbrechen
DeleteHandler_DELETE=Löschen
* <p>Constructor for EmptyRoot.</p>
*/
public EmptyRoot() {
- super(null);
+ super();
}
/**
* 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.navigation.navigator;
import java.util.ArrayList;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>Root class.</p>
- *
* @author p.ciardelli
* @created 02.06.2009
- * @version 1.0
*/
-public class Root extends PlatformObject implements IAdaptable, IPersistableElement, IElementFactory, IConversationEnabled {
+public class Root extends PlatformObject
+ implements IPersistableElement, IElementFactory {
- private final ConversationHolder conversation;
private List<TaxonNodeDto> rootNodes = new ArrayList<>();
- /**
- * <p>Constructor for Root.</p>
- *
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- public Root (ConversationHolder conversation){
- this.conversation = conversation;
- }
+ public Root () {}
- /**
- * <p>getParentBeans</p>
- *
- * @return a {@link java.util.List} object.
- */
public List<TaxonNodeDto> getParentBeans() {
List<String> propertyPaths = Arrays.asList(new String[]{
"name", //$NON-NLS-1$
return rootNodes;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPersistableElement#getFactoryId()
- */
- /**
- * <p>getFactoryId</p>
- *
- * @return a {@link java.lang.String} object.
- */
@Override
public String getFactoryId() {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPersistable#saveState(org.eclipse.ui.IMemento)
- */
- /** {@inheritDoc} */
@Override
public void saveState(IMemento memento) {
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IElementFactory#createElement(org.eclipse.ui.IMemento)
- */
- /** {@inheritDoc} */
@Override
public IAdaptable createElement(IMemento memento) {
return null;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
- */
- @Override
- public void update(CdmDataChangeMap changeEvents) {}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
- */
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
public void addRootNode(Classification newClassification){
newClassification = CdmStore.getService(IClassificationService.class).load(newClassification.getUuid());
boolean exist = false;
if (!exist){
rootNodes.add(new TaxonNodeDto(newClassification.getRootNode()));
}
-
}
- /**
- * @param cb
- */
public void removeRootNode(Classification cb) {
int index = -1;
for (TaxonNodeDto dto: rootNodes){
if (index > 0){
rootNodes.remove(index);
}
-
}
-}
+}
\ No newline at end of file
+++ /dev/null
-/**
-* 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.navigation.navigator.e4;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.swt.widgets.Display;
-
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.name.TaxonName;
-import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour;
-import eu.etaxonomy.taxeditor.model.IDataChangeBehavior;
-import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
-
-/**
- * <p>TaxonNavigatorDataChangeBehavior class.</p>
- *
- * @author n.hoffmann
- * @created 01.04.2009
- * @version 1.0
- */
-public class TaxonNavigatorDataChangeBehaviorE4 extends AbstractDataChangeBehaviour implements
- IDataChangeBehavior {
-
- private static final String UPDATING_TAXON_NAVIGATOR = Messages.TaxonNavigatorDataChangeBehavior_UPDATE_NAVIGATOR;
-
- private final TaxonNavigatorE4 source;
-
- private Set<CdmBase> staleObjects;
-
- /**
- * <p>Constructor for TaxonNavigatorDataChangeBehavior.</p>
- *
- * @param taxonNavigator a {@link eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator} object.
- */
- public TaxonNavigatorDataChangeBehaviorE4(TaxonNavigatorE4 taxonNavigator) {
- source = taxonNavigator;
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.store.model.IDataChangeBehavior#isRelevant(java.lang.Object, eu.etaxonomy.cdm.persistence.hibernate.CdmCrudEvent)
- */
- /**
- * <p>isRelevant</p>
- *
- * @param events a {@link eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap} object.
- * @return a boolean.
- */
- public boolean isRelevant(CdmDataChangeMap events) {
-
- // TODO react only on insert/update/delete of taxon and synonym objects
- // and on update of name objects
- boolean relevant = false;
- staleObjects = new HashSet<CdmBase>();
-
- for(CdmDataChangeEvent event : events.getAllEvents()){
- EventType eventType = event.getEventType();
- CdmBase eventEntity = event.getEntity();
-
- Set<CdmBase> affectedObjects = event.getAffectedObjects();
- if(affectedObjects != null) {
- for(CdmBase cb : affectedObjects) {
- staleObjects.add(HibernateProxyHelper.deproxy(cb));
- }
- }
-
- // all tree node changes are relevant
- if((eventType == EventType.INSERT || eventType == EventType.DELETE || eventType == EventType.UPDATE)
- && event.getEntity() instanceof ITaxonTreeNode){
- return true;
- }
-
- if (eventType == EventType.DELETE){
- return true;
- }
-
-
-
- if(eventType == EventType.UPDATE && event.getEntity() instanceof Taxon){
- TaxonName name = null;
- if(eventEntity instanceof Taxon){
- name = ((Taxon) eventEntity).getName();
- }else{
- continue;
- }
-
- // Set<IEditorPart> openEditors = NavigationUtil.getOpenEditors();
- /*for(IEditorPart editor : openEditors){
-
- if(name.equals(((TaxonEditorInput) editor.getEditorInput()).getTaxon().getName())){
- return true;
- }
- }*/
- }
-
-// if(eventType == EventType.UPDATE){
-// relevant = true;
-// CdmBase entity = event.getEntity();
-// if((entity instanceof TaxonNameBase)
-// || (entity instanceof Taxon)
-// || (entity instanceof Synonym)){
-// staleObjects.add(entity);
-// }
-// }
- }
-
- return false;
-
- // @deprecated
- // react on everything except load
-// if(events.sizeByEventType(EventType.INSERT) > 0){
-// return true;
-// }else if(events.sizeByEventType(EventType.UPDATE) > 0){
-// return true;
-// }else if(events.sizeByEventType(EventType.DELETE) > 0){
-// return true;
-// }else{
-// return false;
-// }
- }
-
- /** {@inheritDoc} */
- @Override
- public void reactOnDataChange(CdmDataChangeMap events) {
- if(isRelevant(events)){
-
- final Display display = Display.getCurrent();
- Job job = new Job(UPDATING_TAXON_NAVIGATOR) {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask(UPDATING_TAXON_NAVIGATOR, 3);
- monitor.worked(1);
-
- // clear the session completely
- monitor.subTask(Messages.TaxonNavigatorDataChangeBehavior_CLEAR_SESSION);
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- source.getConversationHolder().clear();
- }
- });
- // FIXME completely clearing the session is a brute force approach.
- // It would be much more elegant to clear only those elements that have been changed.
- // I could not get that to work but we should consider workin on this because we might
- // run into serious performance issues, especially when it comes to large trees
- //
- // at least, we moved this to a job so it can run in a background thred
- // seems to improve the situation but not sure if final solution
- monitor.worked(1);
-
- monitor.subTask(Messages.TaxonNavigatorDataChangeBehavior_REFRESH_VIEWER);
-
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- if(staleObjects != null && staleObjects.size() > 0) {
- source.refresh(staleObjects);
- } else {
- source.refresh();
- }
- }
- });
-
-
-
- monitor.worked(1);
- monitor.done();
- return Status.OK_STATUS;
- }
- };
-
- job.setPriority(Job.SHORT);
- job.schedule();
-
- }
- }
-}
import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
import eu.etaxonomy.cdm.api.application.ICdmChangeListener;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;
import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.DataChangeBridge;
import eu.etaxonomy.taxeditor.model.IContextListener;
import eu.etaxonomy.taxeditor.model.IDataChangeBehavior;
import eu.etaxonomy.taxeditor.navigation.AppModelId;
* @since Sep 7, 2017
*/
public class TaxonNavigatorE4 implements
- IPostOperationEnabled, IConversationEnabled, Observer,
+ IPostOperationEnabled, Observer,
ICdmChangeListener, IContextListener,
ICollapsableExpandable {
private final int dndOperations = DND.DROP_MOVE;
- private ConversationHolder conversation;
-
private IDataChangeBehavior dataChangeBehavior;
private Root root;
// we do not preserve state. Closing the view, in contrary to
// closing the whole application
// should be handled by the state manager too
- root = new Root(conversation);
+ root = new Root();
return root;
}
}
public void init() {
- if (CdmStore.isActive() && conversation == null) {
- conversation = CdmStore.createConversation();
- conversation.registerForDataStoreChanges(TaxonNavigatorE4.this);
- }
+// if (CdmStore.isActive() && conversation == null) {
+// conversation = CdmStore.createConversation();
+// conversation.registerForDataStoreChanges(TaxonNavigatorE4.this);
+// }
if (CdmStore.isActive()) {
// cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
CdmApplicationState.getCurrentDataChangeService().register(this);
viewer.refresh();
TaxonNodeDto taxonNode = null;
if(editor.getTaxon()!=null && editor.getTaxon().getTaxonNodes()!=null){
- if (editor instanceof TaxonNameEditorE4){
- taxonNode = new TaxonNodeDto( ((TaxonNameEditorE4)editor).getEditorInput().getTaxonNode());
+ if (editor instanceof TaxonEditor){
+ taxonNode = new TaxonNodeDto( ((TaxonEditor)editor).getEditorInput().getTaxonNode());
}else{
if (editor.getTaxon().getTaxonNodes() != null && !editor.getTaxon().getTaxonNodes().isEmpty()){
taxonNode = new TaxonNodeDto(editor.getTaxon().getTaxonNodes().iterator().next());
* Refresh this navigators viewer
*/
public void refresh() {
- if(getConversationHolder() != null){
- getConversationHolder().bind();
- //FIXME : Need to make sure this is a stable fix (ticket 3822)
- if(!getConversationHolder().isCompleted()){
- getConversationHolder().commit();
- }
- }
+
if(!viewer.getTree().isDisposed()){
if (CdmStore.isActive()){
}
private void restore(IMemento memento, IProgressMonitor monitor) {
- root = new Root(conversation);
+ root = new Root();//conversation);
if (memento == null) {
viewer.setInput(root);
return;
subProgressMonitor.subTask(RESTORING_TAXON_NAVIGATOR);
subProgressMonitor.worked(1);
- conversation = CdmStore.createConversation();
+ //conversation = CdmStore.createConversation();
subProgressMonitor.worked(1);
- conversation.registerForDataStoreChanges(TaxonNavigatorE4.this);
+ //conversation.registerForDataStoreChanges(TaxonNavigatorE4.this);
subProgressMonitor.worked(1);
viewer.setInput(root);
subProgressMonitor.worked(1);
viewer.expandAll();
}
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
+
@PreDestroy
public void dispose() {
- dataChangeBehavior = null;
- if (conversation != null) {
- conversation.unregisterForDataStoreChanges(this);
- conversation.close();
- }
if(CdmApplicationState.getCurrentDataChangeService() != null) {
CdmApplicationState.getCurrentDataChangeService().unregister(this);
}
@Focus
public void setFocus() {
- if (getConversationHolder() != null) {
- getConversationHolder().bind();
- }
+
}
public UISynchronize getSync() {
}
}
- @Override
- public void update(CdmDataChangeMap changeEvents) {
- if (dataChangeBehavior == null) {
- dataChangeBehavior = new TaxonNavigatorDataChangeBehaviorE4(this);
- }
-
- DataChangeBridge.handleDataChange(changeEvents, dataChangeBehavior);
- updateSyncButton();
-
- }
+// @Override
+// public void update(CdmDataChangeMap changeEvents) {
+// if (dataChangeBehavior == null) {
+// dataChangeBehavior = new TaxonNavigatorDataChangeBehaviorE4(this);
+// }
+//
+// DataChangeBridge.handleDataChange(changeEvents, dataChangeBehavior);
+// updateSyncButton();
+//
+// }
public List<TaxonNodeDto> getRootEntities() {
if(root != null) {
*/
package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler;
+import java.util.EnumSet;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.model.metadata.SecReferenceHandlingEnum;
+import eu.etaxonomy.cdm.model.permission.CRUD;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
private Classification classification;
protected boolean isSetSource = false;
+ private static final EnumSet<CRUD> UPDATE = EnumSet.of(CRUD.UPDATE);
+
public ChangeAcceptedTaxonToSynonymHandlerE4() {
super(TaxonNavigatorLabels.CHANGE_ACCEPTED_TAXON_TO_SYNONYM_LABEL);
}
}
TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(shell,
-// new ConversationHolderMock(),
Messages.RemotingChangeAcceptedTaxonToSynonymHandler_CHOOSE_TAXON,
excludeTaxa,
null,
for (TaxonNodeDto tn: oldTaxonNodes){
EditorUtil.closeObsoleteEditor(tn, partService);
}
+ //Authentication aut = CdmStore.getCurrentAuthentiation();
ChangeAcceptedTaxonToSynonymOperation rcattso =
new ChangeAcceptedTaxonToSynonymOperation(getTrigger(),
false,
nodeUuids,
- newAcceptedTaxonNode.getUuid(), newSecUuid, secHandling, partService, activePart, application, isSetSource);
+ newAcceptedTaxonNode.getUuid(), newSecUuid, secHandling,partService, activePart, application, isSetSource);
return rcattso;
}
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
boolean canExecute = !selection.isEmpty();
Object[] array = selection.toArray();
+// boolean hasPermission = CdmStore.currentAuthentiationHasPermission(TaxonNode.class, UPDATE);
+// if (!hasPermission && !CdmStore.currentAuthentiationHasOneOfRoles(Role.ROLE_ADMIN)) {
+// return hasPermission;
+// }
for (Object object : array) {
canExecute &= (object instanceof TaxonNodeDto) && ((TaxonNodeDto)selection.getFirstElement()).getTaxonUuid() != null;
}
CloneClassificationOperation operation = new CloneClassificationOperation(Messages.CloneClassificationHandler_CLONE_CLASSIFICATION,
StoreUtil.getUndoContext(), classification, classificationName, reference, relationType,
- taxonNavigator, taxonNavigator);
+ taxonNavigator);
AbstractUtility.executeOperation(operation, sync);
taxonNavigator.refresh();
@CanExecute
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
boolean canExecute = false;
+
+// boolean hasPermission = CdmStore.currentAuthentiationHasPermission(TaxonNode.class, EnumSet.of(CRUD.UPDATE));
+// if (!hasPermission && !CdmStore.currentAuthentiationHasOneOfRoles(Role.ROLE_ADMIN)) {
+// return hasPermission;
+// }
canExecute = selection.size()==1
&& selection.getFirstElement() instanceof TaxonNodeDto;
menuItem.setVisible(canExecute);
if (selectedElement instanceof TaxonNode && !((TaxonNode)selectedElement).hasTaxon()) {
Classification classification = ((TaxonNode) selectedElement).getClassification();
try {
- CreateNewTaxonHierarchyOperation operation = new CreateNewTaxonHierarchyOperation(Messages.CreateClassificationHierarchyHandler_CREATE_HIERARCHY, StoreUtil.getUndoContext(),classification, taxonNavigator, taxonNavigator);
+ CreateNewTaxonHierarchyOperation operation = new CreateNewTaxonHierarchyOperation(Messages.CreateClassificationHierarchyHandler_CREATE_HIERARCHY, StoreUtil.getUndoContext(),classification, taxonNavigator);
AbstractUtility.executeOperation(operation, sync);
taxonNavigator.refresh();
} catch (Exception e) {
taxonNode,
config,
taxonNavigator,
- taxonNavigator,
null);
AbstractUtility.executeOperation(operation, sync);
treeNodes,
new TaxonDeletionConfigurator(),
taxonNavigator,
- taxonNavigator,
null);
AbstractUtility.executeOperation(operation, sync);
@CanExecute
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
boolean canExecute = false;
+// boolean hasPermission = CdmStore.currentAuthentiationHasPermission(TaxonNode.class, EnumSet.of(CRUD.DELETE));
+// if (!hasPermission && !CdmStore.currentAuthentiationHasOneOfRoles(Role.ROLE_ADMIN)) {
+// return hasPermission;
+// }
canExecute = selection.size()==1
&& (selection.getFirstElement() instanceof TaxonNodeDto)
||
excludeTaxa.add(sourceTaxonNode.getUuid());
targetTaxonNode = TaxonNodeSelectionDialog.select(shell,
-// new ConversationHolderMock(),
Messages.RemotingMoveFactualDataHandler_CHOOSE_TAXA,
excludeTaxa,
CdmStore.getService(ITaxonNodeService.class).find(sourceTaxonNode.getUuid()),
@CanExecute
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
boolean canExecute = false;
+// boolean hasPermission = CdmStore.currentAuthentiationHasPermission(Taxon.class, EnumSet.of(CRUD.UPDATE));
+// if (!hasPermission && !CdmStore.currentAuthentiationHasOneOfRoles(Role.ROLE_ADMIN)) {
+// return hasPermission;
+// }
canExecute = selection.size()==1
&& selection.getFirstElement() instanceof TaxonNodeDto
&& ((TaxonNodeDto)selection.getFirstElement()).getTaxonUuid() != null;
excludeTaxa.add(sourceTaxonNode.getUuid());
targetTaxonNode = TaxonNodeSelectionDialog.select(shell,
-// new ConversationHolderMock(),
Messages.RemotingMoveFactualDataHandler_CHOOSE_TAXA,
excludeTaxa,
CdmStore.getService(ITaxonNodeService.class).find(sourceTaxonNode.getUuid()),
@CanExecute
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
boolean canExecute = false;
+// boolean hasPermission = CdmStore.currentAuthentiationHasPermission(Taxon.class, EnumSet.of(CRUD.UPDATE));
+// if (!hasPermission && !CdmStore.currentAuthentiationHasOneOfRoles(Role.ROLE_ADMIN)) {
+// return hasPermission;
+// }
canExecute = selection.size()==1
&& selection.getFirstElement() instanceof TaxonNodeDto
&& ((TaxonNodeDto)selection.getFirstElement()).getTaxonUuid() != null;
@CanExecute
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
boolean canExecute = false;
+// boolean hasPermission = CdmStore.currentAuthentiationHasPermission(TaxonNode.class, EnumSet.of(CRUD.UPDATE));
+// if (!hasPermission && !CdmStore.currentAuthentiationHasOneOfRoles(Role.ROLE_ADMIN)) {
+// return hasPermission;
+// }
canExecute = selection.getFirstElement() instanceof TaxonNodeDto
&& ((TaxonNodeDto)selection.getFirstElement()).getTaxonUuid() != null;
menuItem.setVisible(canExecute);
//TODO Performance check for existing classification causes server call, this should be cached somehow
canExecute = !PreferencesUtil.getBooleanValue(PreferencePredicate.DisableMultiClassification.getKey()) || TaxonNodePropertyTester.noClassifiactionExists();
+ if (!canExecute) {
+ return canExecute;
+ }
+ //canExecute = canExecute && CdmStore.currentAuthentiationHasPermission(TaxonNode.class, CREATE);
+
+// CdmStore.currentAuthentiationHasOneOfRoles(Role.ROLE_ADMIN, Role.ROLE_PROJECT_MANAGER);
+// CdmStore.getCurrentAuthentiation().getAuthorities().contains(menuItem)
+// if (selection != null && selection.getFirstElement() != null && selection.getFirstElement() instanceof TaxonNodeDto) {
+// TaxonNodeDto targetNode = (TaxonNodeDto)selection.getFirstElement();
+// TaxonNode node = CdmStore.getService(ITaxonNodeService.class).load(targetNode.getUuid());
+// boolean hasTargetNodePermission = CdmStore.currentAuthentiationHasPermission(node, UPDATE);
+//
+// canExecute = canExecute && hasTargetNodePermission;
+// canExecute = canExecute && CdmStore.currentAuthentiationHasPermission(node, CREATE);
+// }
+
menuItem.setVisible(canExecute);
return canExecute;
}
package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler;
+import java.util.EnumSet;
+
import javax.inject.Named;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.model.permission.CRUD;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.event.EventUtility;
-import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.newWizard.IWizardPageListener;
import eu.etaxonomy.taxeditor.newWizard.NewTaxonNodeWizard;
import eu.etaxonomy.taxeditor.newWizard.NewTaxonNodeWizardDialog;
+import eu.etaxonomy.taxeditor.store.CdmStore;
/**
*
*
*/
public class NewTaxonNodeHandlerE4 {
+ private static final EnumSet<CRUD> CREATE = EnumSet.of(CRUD.CREATE);
+ private static final EnumSet<CRUD> UPDATE = EnumSet.of(CRUD.UPDATE);
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
MHandledMenuItem menuItem){
boolean canExecute = false;
canExecute = selection!=null && selection.size()==1;
+ if (!canExecute) {
+ return canExecute;
+ }
+ //canExecute = canExecute && CdmStore.currentAuthentiationHasPermission(TaxonNode.class, CREATE);
+ if (selection != null && selection.getFirstElement() != null && selection.getFirstElement() instanceof TaxonNodeDto) {
+ TaxonNodeDto targetNode = (TaxonNodeDto)selection.getFirstElement();
+ TaxonNode node = CdmStore.getService(ITaxonNodeService.class).load(targetNode.getUuid());
+ boolean hasTargetNodePermission = CdmStore.currentAuthentiationHasPermission(node, UPDATE);
+
+ canExecute = canExecute && hasTargetNodePermission;
+ canExecute = canExecute && CdmStore.currentAuthentiationHasPermission(node, CREATE);
+ }
+
menuItem.setVisible(canExecute);
return canExecute;
}
@CanExecute
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
boolean canExecute = false;
+// boolean hasPermission = CdmStore.currentAuthentiationHasPermission(Taxon.class, EnumSet.of(CRUD.UPDATE));
+// if (!hasPermission && !CdmStore.currentAuthentiationHasOneOfRoles(Role.ROLE_ADMIN)) {
+// return hasPermission;
+// }
canExecute = selection.size()==1
&& selection.getFirstElement() instanceof TaxonNodeDto;
menuItem.setEnabled(canExecute);
import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
import eu.etaxonomy.cdm.model.taxon.TaxonNode;\r
import eu.etaxonomy.taxeditor.editor.EditorUtil;\r
-import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;\r
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonEditor;\r
import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;\r
import eu.etaxonomy.taxeditor.operation.CdmUpdateOperation;\r
\r
-\r
/**\r
* @author cmathew\r
* @date 17 Jun 2015\r
- *\r
*/\r
public class ChangeAcceptedTaxonToSynonymOperation extends CdmUpdateOperation {\r
\r
- private Set<UUID> oldTaxonNodeUuids = new HashSet();\r
+ private Set<UUID> oldTaxonNodeUuids = new HashSet<>();\r
private final UUID newAcceptedTaxonNodeUuid;\r
private UUID secundumUuid;\r
private boolean setNameInSource ;\r
private SecReferenceHandlingEnum secHandling;\r
- private DeleteResult deleteResult;\r
-\r
\r
private final static String LABEL = Messages.RemotingChangeAcceptedTaxonToSynonymOperation_CHANGE_OP;\r
\r
- /**\r
- * @param label\r
- */\r
public ChangeAcceptedTaxonToSynonymOperation(Object source,\r
boolean async,\r
Set<UUID> oldTaxonNodeUuids,\r
\r
}\r
\r
- /**\r
- * @param label\r
- */\r
public ChangeAcceptedTaxonToSynonymOperation(Object source,\r
boolean async,\r
UUID oldTaxonNodeUuid,\r
this.secHandling = secHandling;\r
}\r
\r
- /**\r
- * @param label\r
- */\r
public ChangeAcceptedTaxonToSynonymOperation(Object source,\r
boolean async,\r
UUID oldTaxonNodeUuid,\r
this.secHandling = secHandling;\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.operation.CdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
- */\r
@Override\r
protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {\r
\r
}\r
}\r
}\r
-\r
}\r
if (newTaxon != null && oldTaxaPublished != newTaxon.isPublish()){\r
MessagingUtils.warningDialog("Publish flag", null, Messages.RemotingChangeAcceptedTaxonToSynonym_warning_publish);\r
}\r
- updateNameEditor();\r
+ updateTaxonEditor();\r
return updateResult;\r
-\r
}\r
\r
- private void updateNameEditor(){\r
+ private void updateTaxonEditor(){\r
if (partService != null){\r
Display.getDefault().asyncExec(new Runnable() {\r
\r
if (part.getContributionURI().endsWith("TaxonNameEditorE4")){\r
\r
}\r
- if (object instanceof TaxonNameEditorE4 ){\r
- Set<TaxonNode> nodes = ((TaxonNameEditorE4)object).getTaxon().getTaxonNodes();\r
+ if (object instanceof TaxonEditor ){\r
+ Set<TaxonNode> nodes = ((TaxonEditor)object).getTaxon().getTaxonNodes();\r
for (TaxonNode node: nodes){\r
if (node.getUuid().equals(newAcceptedTaxonNodeUuid)){\r
- EditorUtil.updateEditor(node, (TaxonNameEditorE4)object);\r
+ EditorUtil.updateEditor(node, (TaxonEditor)object);\r
}\r
\r
}\r
import org.eclipse.core.runtime.IStatus;
import eu.etaxonomy.cdm.api.application.ICdmRepository;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
* @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 treeNodes a {@link java.util.Set} object.
*/
public DeleteOperation(String label, IUndoContext undoContext,
TaxonNodeDto taxonNode, TaxonDeletionConfigurator config,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled,
ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
+ super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
this.taxonNode = taxonNode;
this.config = config;
this.cdmEntitySessionEnabled = cdmEntitySessionEnabled;
* @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 treeNodes a {@link java.util.Set} object.
*/
public DeleteOperation(String label, IUndoContext undoContext,
Set<TaxonNodeDto> treeNodes, TaxonDeletionConfigurator config,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled,
ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
+ super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
this.treeNodes = treeNodes;
this.config = config;
this.cdmEntitySessionEnabled = cdmEntitySessionEnabled;
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.config.SubtreeCloneConfigurator;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.api.service.UpdateResult;
public CloneClassificationOperation(String label, IUndoContext undoContext, Classification classification,
String classificationName, Reference sec, TaxonRelationshipType relationType,
- IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled);
+ IPostOperationEnabled postOperationEnabled) {
+ super(label, undoContext, postOperationEnabled);
this.classification = classification;
this.classificationName = classificationName;
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.IClassificationService;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
* @param classification a {@link eu.etaxonomy.cdm.model.taxon.TaxonomicTree} object.
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
*/
public CreateClassification(String label, IUndoContext undoContext, Classification classification,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled,
ICdmEntitySessionEnabled cdmEntitiySessionEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitiySessionEnabled);
+ super(label, undoContext, postOperationEnabled, cdmEntitiySessionEnabled);
this.classification = classification;
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.IClassificationService;
import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.model.common.CdmBase;
* @param undoContext
*/
public CreateNewTaxonHierarchyOperation(String label, IUndoContext undoContext, Classification classification,
- IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled);
+ IPostOperationEnabled postOperationEnabled) {
+ super(label, undoContext, postOperationEnabled);
this.classification = classification;
this.service = CdmStore.getService(IClassificationService.class);
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.IPolytomousKeyService;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
IUndoContext undoContext,
PolytomousKey key,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled,
ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
- super(label, undoContext, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
+ super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
this.key = key;
}
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.taxon.Taxon;
* @param name a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
* @param parentNode a {@link eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode} object.
- * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
*/
public CreateTaxonNode(String label,
IUndoContext undoContext,
TaxonNodeDto parentNode, TaxonName name,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled,
- ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
- super(label, undoContext, parentNode, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, parentNode, postOperationEnabled, cdmEntitySessionEnabled);
newTaxon = Taxon.NewInstance(name, null);
}
* @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
* @param parentNode a {@link eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode} object.
- * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
*/
public CreateTaxonNode(String label,
IUndoContext undoContext,
TaxonNodeDto parentNode,
Taxon taxon,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled,
- ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
- super(label, undoContext, parentNode, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+ super(label, undoContext, parentNode, postOperationEnabled, cdmEntitySessionEnabled);
this.newTaxon = taxon;
}
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IMemento;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
* @since Sep 27, 2017
*
*/
-public class SearchResultViewE4 implements IConversationEnabled{
+public class SearchResultViewE4 {
private static Object[] EMPTY = new Object[0];
private TableViewer resultViewer;
- private ConversationHolder conversation;
-
private Text searchString;
private Text configurationLabel;
/** {@inheritDoc} */
@PostConstruct
public void createPartControl(Composite parent, EMenuService menuService) {
- if (CdmStore.isActive()){
- if(conversation == null){
- conversation = getConversation_internal();
- }
- }
- else{
- return;
- }
- contextListener = new ContextListener();
+ contextListener = new ContextListener();
CdmStore.getContextManager().addContextListener(contextListener);
GridLayout layout = new GridLayout();
@Focus
public void setFocus() {
//logger.warn("Setting focus to search result viewer");
- ConversationHolder conversation_internal = getConversation_internal();
- if(conversation_internal!=null){
- conversation_internal.bind();
- }
+
// pass focus to resultViewer
if(resultViewer!=null && resultViewer.getControl()!=null && !resultViewer.getControl().isDisposed()){
resultViewer.getControl().setFocus();
}
}
- /**
- * <p>getConversationHolder</p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- @Override
- public ConversationHolder getConversationHolder() {
- return this.conversation;
- }
-
- /** {@inheritDoc} */
- @Override
- public void update(CdmDataChangeMap changeEvents) {
- // TODO Auto-generated method stub
-
- }
+
/** {@inheritDoc} */
@PreDestroy
public void dispose() {
- if(conversation!=null){
- conversation.close();
- conversation = null;
- }
if(searchJob != null) {
searchJob.cancel();
}
}
- private ConversationHolder getConversation_internal(){
- if(conversation==null && CdmStore.isActive()){
- try {
- conversation = CdmStore.createConversation();
- } catch (Exception e) {
- //nothing
- }
- }
- return conversation;
- }
/**
*
Bundle-ManifestVersion: 2
Bundle-Name: Printpublisher Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.printpublisher;singleton:=true
-Bundle-Version: 5.34.0
+Bundle-Version: 5.42.0
Export-Package: eu.etaxonomy.cdm.print,
eu.etaxonomy.cdm.print.out,
eu.etaxonomy.cdm.print.out.odf,
eu.etaxonomy.taxeditor.editor,
eu.etaxonomy.taxeditor.store
Bundle-ClassPath: .,
- lib/cdmlib-print-5.34.0.jar,
- lib/cdmlib-remote-5.34.0.jar
+ lib/cdmlib-print-5.42.0.jar,
+ lib/cdmlib-remote-5.42.0.jar
Import-Package: org.apache.logging.log4j,
org.apache.logging.log4j.core,
org.eclipse.core.runtime,
bin.includes = META-INF/,\
.,\
plugin.xml,\
- lib/cdmlib-print-5.34.0.jar,\
- lib/cdmlib-remote-5.34.0.jar,\
+ lib/cdmlib-print-5.42.0.jar,\
+ lib/cdmlib-remote-5.42.0.jar,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/l10n/bundle_de.properties,\
<parent>
<artifactId>taxeditor-parent</artifactId>
<groupId>eu.etaxonomy</groupId>
- <version>5.34.0</version>
+ <version>5.42.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
* 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.printpublisher.handler;
import java.util.UUID;
import eu.etaxonomy.cdm.print.PublishConfigurator;
import eu.etaxonomy.cdm.print.out.pdf.PdfOutputModule;
import eu.etaxonomy.cdm.print.out.xml.XMLOutputModule;
-import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInput;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.printpublisher.wizard.DirectPublishingWizard;
-import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>GeneratePdfHandler class.</p>
- *
* @author n.hoffmann
* @created Jul 20, 2010
*/
IEditorInput input = editor.getEditorInput();
- if(!(input instanceof TaxonEditorInputE4)){
+ if(!(input instanceof TaxonEditorInput)){
MessagingUtils.warningDialog("PDF generation not supported for selected input", this, "Generating PDF output is not supported for the current active editor");
return null;
}
- configurator = PublishConfigurator.NewLocalInstance(CdmStore.getCurrentApplicationConfiguration());
+ //Note: was NewLocalInstance before
+ configurator = PublishConfigurator.NewRemoteInstance();
- Element taxonNodeElement = getTaxonNodeElement((TaxonEditorInputE4) input);
+ Element taxonNodeElement = getTaxonNodeElement((TaxonEditorInput) input);
configurator.addSelectedTaxonNodeElements(taxonNodeElement);
configurator.setDoPublishEntireBranches(false);
return null;
}
- private Element getTaxonNodeElement(TaxonEditorInputE4 input){
+ private Element getTaxonNodeElement(TaxonEditorInput input){
UUID taxonNodeUuid = input.getTaxonNode().getUuid();
import org.eclipse.ui.IExportWizard;
import org.eclipse.ui.IWorkbench;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.print.PublishConfigurator;
import eu.etaxonomy.cdm.print.Publisher;
import eu.etaxonomy.cdm.print.out.IPublishOutputModule;
import eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.printpublisher.internal.PrintpublisherPlugin;
-import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* <p>AbstractPublishWizard class.</p>
@Override
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask("Print Publisher", getConfigurator().calculateNumberOfNodes() + 1);
- ConversationHolder conversation = null;
+
try{
getConfigurator().setProgressMonitor(CdmProgressMonitorAdapter.CreateMonitor(monitor));
if(getConfigurator().isLocal()){
- conversation = CdmStore.createConversation();
- // we want to enforce that the session is closed and nothing is
- // instantiated beneath the regular cdmlib-remote object boundaries
- conversation.commit(false);
+ //TODO conversation not supported anymore as we use only remote
+// conversation = CdmStore.createConversation();
+// // we want to enforce that the session is closed and nothing is
+// // instantiated beneath the regular cdmlib-remote object boundaries
+// conversation.commit(false);
}
Publisher.publish(getConfigurator());
}finally{
monitor.done();
- if(conversation != null) {
- conversation.close();
- }
+// if(conversation != null) {
+// conversation.close();
+// }
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* 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.
*/
import org.eclipse.swt.widgets.Text;
import org.jdom.Element;
-import eu.etaxonomy.cdm.api.application.ICdmRepository;
import eu.etaxonomy.cdm.print.IXMLEntityFactory;
import eu.etaxonomy.cdm.print.PublishConfigurator;
import eu.etaxonomy.cdm.print.XMLHelper;
import eu.etaxonomy.cdm.print.XMLHelper.EntityType;
-import eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.printpublisher.PrintUtil;
-import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>SelectServiceWizardPage class.</p>
- *
* @author n.hoffmann
* @created Apr 6, 2010
*/
setTitle("Select a Service");
}
- public void createControl(Composite parent) {
+ @Override
+ public void createControl(Composite parent) {
composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
"connected to will be used to gather data.)");
button_local.addSelectionListener(listener);
-
+
button_remote = new Button(radioGroup, SWT.RADIO);
button_remote.setText("Remote");
button_remote.addSelectionListener(listener);
-
+
text_serviceUrl = new Text(radioGroup, SWT.BORDER);
text_serviceUrl.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- text_serviceUrl.setText("http://");
+ text_serviceUrl.setText("http://");
text_serviceUrl.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
+ @Override
+ public void modifyText(ModifyEvent e) {
String text = text_serviceUrl.getText();
if(!text.endsWith("/")){
getConfigurator().setWebserviceUrl(url);
SelectServiceWizardPage.this.setErrorMessage(null);
-
+
}
});
treeViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- if(CdmStore.isActive()){
- enableLocal();
- }else{
+// if(CdmStore.isActive()){
+// enableLocal();
+// }else{
enableRemote();
button_local.setEnabled(false);
- }
+// }
setControl(composite);
}
setConfigurator(PublishConfigurator.NewRemoteInstance());
getConfigurator().addOutputModule(getOutputModule());
}
-
+
+ /**
+ * @deprecated real local is not supported anymore, also the currently active
+ * database is a "remoting" database
+ */
+ @Deprecated
private void enableLocal() {
button_remote.setSelection(false);
button_local.setSelection(true);
text_serviceUrl.setEnabled(false);
- setConfigurator(PublishConfigurator.NewLocalInstance((ICdmRepository) CdmStore.getCurrentApplicationConfiguration()));
+ setConfigurator(PublishConfigurator.NewRemoteInstance());
getConfigurator().addOutputModule(getOutputModule());
refresh();
}
@Override
- public boolean canFlipToNextPage() {
+ public boolean canFlipToNextPage() {
return isPageComplete();
}
-
+
public void refresh(){
if(getConfigurator() != null){
monitor.beginTask("Loading classifications", IProgressMonitor.UNKNOWN);
IXMLEntityFactory factory = getConfigurator().getFactory();
final List<Element> classifications = factory.getClassifications();
-
+
Display.getDefault().asyncExec(new Runnable(){
@Override
}
}
}
-
+
@Override
public boolean isPageComplete() {
boolean complete = true;
if(getConfigurator().isLocal()){
complete &= true;
- }else if(getConfigurator().isRemote()
- && getConfigurator().getWebserviceUrl() != null
+ }else if(getConfigurator().isRemote()
+ && getConfigurator().getWebserviceUrl() != null
&& getConfigurator().getWebserviceUrl().toString().endsWith("/")){
complete &= true;
}else{
return false;
}
-
+
List<Element> selectedTaxonNodes = getConfigurator().getSelectedTaxonNodeElements();
-
+
complete &= !selectedTaxonNodes.isEmpty();
-
+
return complete;
}
-
+
private class SelectionChangedListener implements ISelectionChangedListener {
- public void selectionChanged(SelectionChangedEvent event) {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
StructuredSelection selection = (StructuredSelection) treeViewer.getSelection();
-
+
List<Element> selectedElements = selection.toList();
if(selectedElements.size() > 0){
getConfigurator().setSelectedTaxonNodeElements(selectedElements);
setPageComplete(true);
}
}
-
+
}
-
+
private class ContentProvider implements ITreeContentProvider{
- public Object[] getChildren(Object parentElement) {
+ @Override
+ public Object[] getChildren(Object parentElement) {
if(parentElement instanceof List){
return ((List)parentElement).toArray();
}
else if(parentElement instanceof Element){
Element element = (Element) parentElement;
-
+
IXMLEntityFactory factory = getConfigurator().getFactory();
-
+
return factory != null ? factory.getChildNodes(element).toArray() : new Object[]{};
-
+
}
-
+
return new Object[]{};
}
- public Object getParent(Object element) {
+ @Override
+ public Object getParent(Object element) {
return null;
}
- public boolean hasChildren(Object element) {
+ @Override
+ public boolean hasChildren(Object element) {
return getChildren(element).length > 0;
}
- public Object[] getElements(Object inputElement) {
+ @Override
+ public Object[] getElements(Object inputElement) {
return getChildren(inputElement);
}
- public void dispose() {
-
+ @Override
+ public void dispose() {
+
}
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
- }
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ }
}
-
+
private class LabelProvider extends ColumnLabelProvider
implements ILabelProvider{
-
+
@Override
public String getText(Object element) {
if(element instanceof Element){
EntityType entityType = XMLHelper.getEntityType(xmlElement);
if(EntityType.TAXON_NODE.equals(entityType)){
xmlElement = getConfigurator().getFactory().getTaxonForTaxonNode(xmlElement);
- }
+ }
return XMLHelper.getTitleCache(xmlElement);
}
return "no title cache";
- }
+ }
}
}
\ No newline at end of file
Bundle-ManifestVersion: 2
Bundle-Name: DataStore Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.store;singleton:=true
-Bundle-Version: 5.34.0
+Bundle-Version: 5.42.0
Bundle-Activator: eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin
Bundle-Vendor: EDIT
Bundle-Localization: OSGI-INF/l10n/bundle
category.name = CDM\r
wizard.name = TCS\r
wizard.name.0 = Berlin Model\r
-wizard.name.1 = Endnote\r
wizard.name.2 = Excel Normal Explicit\r
wizard.name.3 = ABCD file\r
wizard.name.4 = SDD\r
-wizard.name.5 = Specimen CDM Excel\r
category.name.0 = CDM\r
wizard.name.6 = JAXB\r
wizard.name.7 = Berlin Model\r
category.name.2 = CDM\r
wizard.name.16 = Taxon\r
wizard.name.17 = Classification\r
+wizard.name.123 = WFO Backbone\r
themeElementCategory.label = Taxonomic Editor\r
themeElementCategory.description = Color and font definitions for the EDIT Taxonomic Editor\r
colorDefinition.label = List Background\r
command.label.CONNECT = Connect\r
command.label.RE_CONNECT = Re-connect\r
wizard.name.22 = CDM light (csv)\r
+wizard.name.122 = Col DP\r
wizard.name.23 = Excel Distribution Data Update\r
wizard.name.24 = RIS\r
command.label.25 = Import Preferences
handledmenuitem.label.5 = Remove Term
handledmenuitem.label.6 = Delete
handledmenuitem.label.7 = Kind Of Term
-partdescriptor.label.1 = GFBio Term Import
-partdescriptor.tooltip.1 = GFBio Term Import
+partdescriptor.label.1 = GFBio Term Search
+partdescriptor.tooltip.1 = GFBio Term Search
command.commandname.1 = Add Feature
command.description.1 = Add a term to the term tree
command.commandname.2 = Remove term
menu.label.1 = Terms
handledmenuitem.label.8 = Term Tree
handledmenuitem.tooltip.1 = Term Tree Editor
-handledmenuitem.label.9 = GFBio Term Import
-handledmenuitem.tooltip.2 = GFBio Term Import
+handledmenuitem.label.9 = GFBio Term Search
+handledmenuitem.tooltip.2 = GFBio Term Search
menu.label.2 = Export
menu.label.3 = Import
handledmenuitem.label.10 = Restart
category.name = CDM
wizard.name = TCS
wizard.name.0 = Berlin Modell
-wizard.name.1 = Endnote
wizard.name.2 = Excel Normal Explicit
wizard.name.3 = ABCD Datei
wizard.name.4 = SDD
-wizard.name.5 = Beleg CDM Excel
category.name.0 = CDM
wizard.name.6 = JAXB
wizard.name.7 = Berlin Model
category.name.2 = CDM
wizard.name.16 = Taxon
wizard.name.17 = Klassifikation
+wizard.name.123 = WFO Backbone
themeElementCategory.label = Taxonomischer Editor
themeElementCategory.description = Farb- und Schriftdefinitionen f\u00fcr den EDIT Taxonomischen Editor
colorDefinition.label = Liste Hintergrund
command.label.CONNECT = Verbinden
command.label.RE_CONNECT = Aktualisiere Verbindung
wizard.name.22 = CDM light (csv)
+wizard.name.122 = Col DP
wizard.name.23 = Excel Verbreitungsdaten Update
wizard.name.24 = RIS
command.label.25 = Import Präferenzen
handledmenuitem.label.5 = Term entfernen
handledmenuitem.label.6 = Löschen
handledmenuitem.label.7 = Kind-Of Term
-partdescriptor.label.1 = GFBio Term Import
-partdescriptor.tooltip.1 = GFBio Term Import
+partdescriptor.label.1 = GFBio Term Suche
+partdescriptor.tooltip.1 = GFBio Term Suche
command.commandname.1 = Term hinzufügen
command.description.1 = Term dem Termbaum hinzufügen
command.commandname.2 = Term entfernen
menu.label.1 = Terme
handledmenuitem.label.8 = Termbaum
handledmenuitem.tooltip.1 = Termbaum-Editor
-handledmenuitem.label.9 = GFBio Term Import
-handledmenuitem.tooltip.2 = GFBio Term Import
+handledmenuitem.label.9 = GFBio Term Suche
+handledmenuitem.tooltip.2 = GFBio Term Suche
menu.label.2 = Export
menu.label.3 = Import
handledmenuitem.label.10 = Neustarten
<children xsi:type="menu:HandledMenuItem" xmi:id="_-y1Cj8KPEem1vZq1LletZg" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.deletefeaturetree" label="%handledmenuitem.label.6" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/delete.gif" command="_3mqzkCFdEeiVXriJfxPIuA"/>
</menus>
</elements>
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_WsXuMJ1XEe2Oid79gMgNzw" elementId="eu.etaxonomy.taxeditor.view.remoteservers" label="Remote Servers" iconURI="" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.remoteserver.CdmRemoteServerViewPart">
+ <handlers xmi:id="_WsXuMZ1XEe2Oid79gMgNzw" elementId="eu.etaxonomy.taxeditor.local.handler.CreateRemoteServerHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.remoteserver.handler.CreateRemoteServerHandler" command="_nYPOkJ1XEe2Oid79gMgNzw"/>
+ <handlers xmi:id="_WsXuMp1XEe2Oid79gMgNzw" elementId="eu.etaxonomy.taxeditor.local.handler.EditRemoteServerHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.remoteserver.handler.EditRemoteServerHandler" command="_m1wMkJ1XEe2Oid79gMgNzw"/>
+ <handlers xmi:id="_WsXuNJ1XEe2Oid79gMgNzw" elementId="eu.etaxonomy.taxeditor.local.handler.DeleteRemoteServerHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.remoteserver.handler.DeleteRemoteServerHandler" command="_lvyqEJ1XEe2Oid79gMgNzw"/>
+ <handlers xmi:id="_l8zFcNkaEe231IdeAjpAvg" elementId="eu.etaxonomy.taxeditor.local.handler.MoveUpRemoteServerHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.remoteserver.handler.MoveUpRemoteServerHandler" command="_tEWW8NkaEe231IdeAjpAvg"/>
+ <handlers xmi:id="_8KIN0NkbEe231IdeAjpAvg" elementId="eu.etaxonomy.taxeditor.local.handler.MoveDownRemoteServerHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.remoteserver.handler.MoveDownRemoteServerHandler" command="_-iLDQNkbEe231IdeAjpAvg"/>
+ <menus xsi:type="menu:PopupMenu" xmi:id="_WsXuNZ1XEe2Oid79gMgNzw" elementId="eu.etaxonomy.taxeditor.local.popupmenu.remoteServerViewPart">
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_WsXuNp1XEe2Oid79gMgNzw" elementId="eu.etaxonomy.taxeditor.local.handledmenuitem.new" label="New" command="_nYPOkJ1XEe2Oid79gMgNzw"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_WsXuN51XEe2Oid79gMgNzw" elementId="eu.etaxonomy.taxeditor.local.handledmenuitem.edit" label="Edit" command="_m1wMkJ1XEe2Oid79gMgNzw"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_WsXuOZ1XEe2Oid79gMgNzw" elementId="eu.etaxonomy.taxeditor.local.handledmenuitem.delete" label="Delete" command="_lvyqEJ1XEe2Oid79gMgNzw"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_lMYVINkaEe231IdeAjpAvg" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.moveup" label="Move up" command="_tEWW8NkaEe231IdeAjpAvg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_6bF5INkbEe231IdeAjpAvg" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.movedown" label="Move down" command="_-iLDQNkbEe231IdeAjpAvg"/>
+ </menus>
+ </elements>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_3rW8wCXaEeex9MwMOgUeWw" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:eu.etaxonomy.taxeditor.workbench.menuseparator.afterConcept">
<elements xsi:type="menu:HandledMenuItem" xmi:id="_TlufMCaGEeeTEd_pKXBflg" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.supplemental" label="%command.label.1" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/applications-office.png" tooltip="%command.label.1" command="_bnVKsCZxEeeQLpuomSmVoQ">
<elements xsi:type="commands:Command" xmi:id="_qAEkYKmjEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importExcelTaxa" commandName="%wizard.name.2"/>
<elements xsi:type="commands:Command" xmi:id="_tBCr8KmsEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importRisReference" commandName="%wizard.name.24"/>
<elements xsi:type="commands:Command" xmi:id="_bLGTMKmuEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importSdd" commandName="%wizard.name.4"/>
- <elements xsi:type="commands:Command" xmi:id="_2JV9IKnAEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importExcelSpecimen" commandName="%wizard.name.5"/>
<elements xsi:type="commands:Command" xmi:id="_OQ9n8KnCEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importTcs" commandName="%wizard.name"/>
<elements xsi:type="commands:Command" xmi:id="_L0xNEKqYEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportJaxb" commandName="%wizard.name.6"/>
<elements xsi:type="commands:Command" xmi:id="_ybovsKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportSdd" commandName="%wizard.name.8"/>
</elements>
<elements xsi:type="commands:Command" xmi:id="_MkieEMKuEeufc9n3VJNAaA" elementId="eu.etaxonomy.taxeditor.store.command.featureTree.createFeatureTree_flat" commandName="%command.commandname.flat_tree"/>
<elements xsi:type="commands:Command" xmi:id="_ukIJAMKuEeufc9n3VJNAaA" elementId="eu.etaxonomy.taxeditor.store.command.featureTree.createFeatureTree_ordered" commandName="%command.commandname.ordered_tree"/>
+ <elements xsi:type="commands:Command" xmi:id="_lB0JwJ1XEe2Oid79gMgNzw" elementId="eu.etaxonomy.taxeditor.local.command.cloneRemoteServer" commandName="Clone"/>
+ <elements xsi:type="commands:Command" xmi:id="_lvyqEJ1XEe2Oid79gMgNzw" elementId="eu.etaxonomy.taxeditor.local.command.deleteRemoteServer" commandName="Delete"/>
+ <elements xsi:type="commands:Command" xmi:id="_m1wMkJ1XEe2Oid79gMgNzw" elementId="eu.etaxonomy.taxeditor.local.command.editRemoteServer" commandName="Edit"/>
+ <elements xsi:type="commands:Command" xmi:id="_nYPOkJ1XEe2Oid79gMgNzw" elementId="eu.etaxonomy.taxeditor.local.command.newRemoteServer" commandName="New"/>
+ <elements xsi:type="commands:Command" xmi:id="_tEWW8NkaEe231IdeAjpAvg" elementId="eu.etaxonomy.taxeditor.local.command.moveUpRemoteServer" commandName="Move up"/>
+ <elements xsi:type="commands:Command" xmi:id="_-iLDQNkbEe231IdeAjpAvg" elementId="eu.etaxonomy.taxeditor.local.command.moveDownRemoteServer" commandName="Move down"/>
+ <elements xsi:type="commands:Command" xmi:id="_lbmBoEi_Ee6gZ65AByRHxQ" elementId="eu.etaxonomy.taxeditor.store.command.exportColDP" commandName="%wizard.name.122"/>
+ <elements xsi:type="commands:Command" xmi:id="_1BzvkLU-Ee6JFM-mIdEBFA" elementId="eu.etaxonomy.taxeditor.store.command.exportWfoBackbone" commandName="%wizard.name.123"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_swGH0GhvEee3K4uKJljEYg" featurename="handlers" parentElementId="xpath:/">
<elements xsi:type="commands:Handler" xmi:id="_rVEdIGcjEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.termtree.e4.handler.RemoveTermHandler" command="_fNBtQGcjEee0qLTtA2ZpVQ"/>
<elements xsi:type="commands:Handler" xmi:id="_wvx9oKmjEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.excel.taxa.OpenExcelTaxaImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.in.excel.taxa.OpenExcelTaxaImportWizard" command="_qAEkYKmjEeeTAPHmaMLwQQ"/>
<elements xsi:type="commands:Handler" xmi:id="_96ANIKmsEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.ris.OpenRisImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.in.ris.OpenRisImportWizard" command="_tBCr8KmsEeeTAPHmaMLwQQ"/>
<elements xsi:type="commands:Handler" xmi:id="_do2IAKmuEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.sdd.OpenSddImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.in.sdd.OpenSddImportWizard" command="_bLGTMKmuEeeTAPHmaMLwQQ"/>
- <elements xsi:type="commands:Handler" xmi:id="_6BmBEKnAEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.excel.specimen.OpenExcelSpecimenImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.in.excel.specimen.OpenExcelSpecimenImportWizard" command="_2JV9IKnAEeeTAPHmaMLwQQ"/>
<elements xsi:type="commands:Handler" xmi:id="_Q8Z6gKnCEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.in.tcs.OpenTcsImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.in.tcs.OpenTcsImportWizard" command="_OQ9n8KnCEeeTAPHmaMLwQQ"/>
<elements xsi:type="commands:Handler" xmi:id="_SciLQKqYEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.io.e4.out.csv.OpenCsvExportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.out.csv.OpenCsvExportWizard" command="_y_uUMKqZEeeXcJGhyhlrKA"/>
<elements xsi:type="commands:Handler" xmi:id="_SOrDgKqaEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.io.e4.out.jaxb.OpenJaxbExportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.out.jaxb.OpenJaxbExportWizard" command="_L0xNEKqYEeeXcJGhyhlrKA"/>
<elements xsi:type="commands:Handler" xmi:id="_wSjnIP5VEeqwiqpCwftRog" elementId="eu.etaxonomy.taxeditor.store.handler.searchForPlugin" command="_qENOgP5VEeqwiqpCwftRog"/>
<elements xsi:type="commands:Handler" xmi:id="_4kk8oDoqEeud_N8qGaxX2Q" elementId="eu.etaxonomy.taxeditor.store.OpenDefinedTermHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.OpenDefinedTermEditorHandlerE4" command="_qEMrsIdPEeecZ4F2Y9Z0Og"/>
<elements xsi:type="commands:Handler" xmi:id="_4GeBAD4fEeuM4JU-Ch98ZA" elementId="eu.etaxonomy.taxeditor.store.OpenTermTreeHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.termtree.e4.handler.OpenTermTreeEditorHandler" command="_8aaicD4fEeuM4JU-Ch98ZA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_oEReoEjAEe6gZ65AByRHxQ" elementId="eu.etaxonomy.taxeditor.io.e4.out.cdmlight.OpenColDPExportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.out.col.OpenColExportWizard" command="_lbmBoEi_Ee6gZ65AByRHxQ"/>
+ <elements xsi:type="commands:Handler" xmi:id="_rng_YLU-Ee6JFM-mIdEBFA" elementId="eu.etaxonomy.taxeditor.io.e4.out.dwca.OpenWfoBackboneExportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.out.wfo.OpenWfoBackboneExportWizard" command="_1BzvkLU-Ee6JFM-mIdEBFA"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_qT4hgIfTEeecZ4F2Y9Z0Og" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.window" positionInList="before:eu.etaxonomy.taxeditor.application.windowMenu.last">
<elements xsi:type="menu:Menu" xmi:id="_LT3P8IfcEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.menu.termeditor" label="%menu.label.1">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_1xVggMTDEemAeKumL6iTpg" coreExpressionId="isCdmStoreConnected"/>
<children xsi:type="menu:Menu" xmi:id="_umxYEDocEeuzzbCHEqs6jg" elementId="eu.etaxonomy.taxeditor.store.menu." label="%command.label.12">
- <children xsi:type="menu:HandledMenuItem" xmi:id="_46o0kDocEeuzzbCHEqs6jg" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.features" label="%handledmenuitem.label.24" command="_n5NykDoqEeud_N8qGaxX2Q">
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_46o0kDocEeuzzbCHEqs6jg" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.features" label="%handledmenuitem.label.24" tooltip="%handledmenuitem.label.24" command="_n5NykDoqEeud_N8qGaxX2Q">
<parameters xmi:id="_UQRgQDouEeud_N8qGaxX2Q" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.featureEditor" name="eu.etaxonomy.taxeditor.store.commandparameter.termType" value="FE"/>
</children>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_Sa3ZoDo1Eeud_N8qGaxX2Q" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.characters" label="%handledmenuitem.label.25" command="_n5NykDoqEeud_N8qGaxX2Q">
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_Sa3ZoDo1Eeud_N8qGaxX2Q" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.characters" label="%handledmenuitem.label.25" tooltip="%handledmenuitem.label.25" command="_n5NykDoqEeud_N8qGaxX2Q">
<parameters xmi:id="_mglxwDo1Eeud_N8qGaxX2Q" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.characterEditor" name="eu.etaxonomy.taxeditor.store.commandparameter.termType" value="CHA"/>
</children>
<children xsi:type="menu:HandledMenuItem" xmi:id="_nsbb4Dq7EeuAuPxcOe1-XA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.properties" label="%handledmenuitem.label.27" command="_n5NykDoqEeud_N8qGaxX2Q">
<children xsi:type="menu:HandledMenuItem" xmi:id="_7VAvkDq8EeuAuPxcOe1-XA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.handledmenuitemlabel26" label="%handledmenuitem.label.26" command="_n5NykDoqEeud_N8qGaxX2Q">
<parameters xmi:id="__0nHYDq8EeuAuPxcOe1-XA" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.structureEditor" name="eu.etaxonomy.taxeditor.store.commandparameter.termType" value="STRU"/>
</children>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_YFuh4Dq9EeuAuPxcOe1-XA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.handledmenuitemlabel31" label="%handledmenuitem.label.31" command="_n5NykDoqEeud_N8qGaxX2Q">
- <parameters xmi:id="_Yh7VsDq9EeuAuPxcOe1-XA" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.structureEditor" name="eu.etaxonomy.taxeditor.store.commandparameter.termType" value="STMO"/>
- </children>
<children xsi:type="menu:MenuSeparator" xmi:id="_6DMs8Dq9EeuAuPxcOe1-XA" elementId="eu.etaxonomy.taxeditor.store.menuseparator.1"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_3HtMMDq9EeuAuPxcOe1-XA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.handledmenuitemlabel20" label="%handledmenuitem.label.20" command="_n5NykDoqEeud_N8qGaxX2Q">
<parameters xmi:id="_BhV5gDq-EeuAuPxcOe1-XA" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.namedAreaEditor" name="eu.etaxonomy.taxeditor.store.commandparameter.termType" value="NA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_CUh5gMKOEem1vZq1LletZg" elementId="eu.etaxonomy.taxeditor.store.termEditorMenu.structureTreeEditor" label="%handledmenuitem.label.26" tooltip="%handledmenuitem.label.26" command="_8aaicD4fEeuM4JU-Ch98ZA">
<parameters xmi:id="_CUh5gcKOEem1vZq1LletZg" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.structureTreeEditor" name="eu.etaxonomy.taxeditor.store.commandparameter.termType" value="STRU"/>
</children>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_0JJOoD4FEeuM4JU-Ch98ZA" elementId="eu.etaxonomy.taxeditor.store.termEditorMenu.featureTreeEditor" label="%handledmenuitem.label.31" tooltip="%handledmenuitem.label.31" command="_8aaicD4fEeuM4JU-Ch98ZA">
- <parameters xmi:id="_0JJ1sD4FEeuM4JU-Ch98ZA" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.featureTreeEditor" name="eu.etaxonomy.taxeditor.store.commandparameter.termType" value="STMO"/>
- </children>
<children xsi:type="menu:MenuSeparator" xmi:id="_AVOnkP8QEem7jP7thrJFNA" elementId="eu.etaxonomy.taxeditor.store.menuseparator.10"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_ZdYr4PysEemPDYtIH5gauA" elementId="eu.etaxonomy.taxeditor.store.termEditorMenu.propertyTreeEditor" label="%handledmenuitem.label.20" tooltip="%handledmenuitem.label.20" command="_8aaicD4fEeuM4JU-Ch98ZA">
<parameters xmi:id="_ZdYr4fysEemPDYtIH5gauA" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.namedAreaTreeEditor" name="eu.etaxonomy.taxeditor.store.commandparameter.termType" value="NA"/>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_ITE10KkVEeejedk4mZQIGw" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.file" positionInList="before:eu.etaxonomy.taxeditor.application.filemenu.io">
<elements xsi:type="menu:Menu" xmi:id="_z6EugKqXEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.menu.export" label="%menu.label.2">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_3eyLYKqXEeeXcJGhyhlrKA" coreExpressionId="isCdmStoreConnectedAndShowIOMenuEnabled"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_nf4z0KqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportDwca" label="%wizard.name.9" command="_y69I8KqZEeeXcJGhyhlrKA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_WVBa4Ex_Ee6gZ65AByRHxQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportColDP" label="%wizard.name.122" command="_lbmBoEi_Ee6gZ65AByRHxQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_eE6dALnTEe6hy6A4KTNM1w" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.wizardname123" label="%wizard.name.123" command="_1BzvkLU-Ee6JFM-mIdEBFA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_uruvcKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportCdmLight" label="%wizard.name.22" command="_zLKvMKqZEeeXcJGhyhlrKA"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_l9Oe0Ex_Ee6gZ65AByRHxQ" elementId="eu.etaxonomy.taxeditor.store.menuseparator.17"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_OL6sMH1LEem6uMX-L-maww" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportOwlTerm" label="%handledmenuitem.label.22" command="_WISF0H1LEem6uMX-L-maww"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_b9E38KqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportJaxb" label="%wizard.name.6" command="_L0xNEKqYEeeXcJGhyhlrKA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_lXe84KqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportSdd" label="%wizard.name.8" command="_ybovsKqZEeeXcJGhyhlrKA"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_nf4z0KqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportDwca" label="%wizard.name.9" command="_y69I8KqZEeeXcJGhyhlrKA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_V3eBEKqYEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportCsv" label="%wizard.name.18" command="_y_uUMKqZEeeXcJGhyhlrKA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_qR5ocKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportCsvName" label="%wizard.name.19" command="_zDy74KqZEeeXcJGhyhlrKA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_tBUcEKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportCsvPrint" label="%wizard.name.20" command="_zIKegKqZEeeXcJGhyhlrKA"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_uruvcKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportCdmLight" label="%wizard.name.22" command="_zLKvMKqZEeeXcJGhyhlrKA"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_OL6sMH1LEem6uMX-L-maww" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportOwlTerm" label="%handledmenuitem.label.22" command="_WISF0H1LEem6uMX-L-maww"/>
</elements>
<elements xsi:type="menu:Menu" xmi:id="_QC5O8KkaEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.store.menu.import" label="%menu.label.3">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_UL4dkKkaEeejedk4mZQIGw" coreExpressionId="isCdmStoreConnectedAndShowIOMenuEnabled"/>
<children xsi:type="menu:Menu" xmi:id="_A8bvEAIREeqn7oFuQSAIvQ" elementId="eu.etaxonomy.taxeditor.store.menu.specimen" label="%menu.label.5">
<children xsi:type="menu:HandledMenuItem" xmi:id="_RUOtQKkVEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.workbench.handledmenuitem.importspecimens" label="%wizard.name.14" command="_TwGSwKkVEeejedk4mZQIGw"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_NO718KmQEeeDJPU_cUTI2g" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importAbcd" label="%wizard.name.3" command="_QbHeEKmQEeeDJPU_cUTI2g"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_0z1o8KmjEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importExcelSpecimen" label="%wizard.name.5" command="_2JV9IKnAEeeTAPHmaMLwQQ"/>
</children>
<children xsi:type="menu:Menu" xmi:id="_lspukAIREeqn7oFuQSAIvQ" elementId="eu.etaxonomy.taxeditor.store.menu.taxa" label="%menu.label.6">
<children xsi:type="menu:HandledMenuItem" xmi:id="_BLzlAKnBEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importExcelTaxa" label="%wizard.name.2" command="_qAEkYKmjEeeTAPHmaMLwQQ"/>
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_mNW73LMnEeeMU61m8yqdaA" coreExpressionId="isCdmStoreConnected"/>
<parameters xmi:id="_mNW73bMnEeeMU61m8yqdaA" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.sessionView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart"/>
</elements>
+ <elements xsi:type="menu:MenuSeparator" xmi:id="_KbVZUM76Ee2JEuR6aPJuLg" elementId="eu.etaxonomy.taxeditor.store.menuseparator.3"/>
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_Aq3JYJ1YEe2Oid79gMgNzw" elementId="eu.etaxonomy.taxeditor.local.handledmenuitem.remoteservers" label="Remote Servers" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/web.gif" tooltip="Edit the available remote servers" command="_bnVKsCZxEeeQLpuomSmVoQ">
+ <parameters xmi:id="_H7ooUJ1YEe2Oid79gMgNzw" elementId="eu.etaxonomy.taxeditor.webapp.showView.parameter.remoteServerView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.view.remoteservers"/>
+ </elements>
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_Ub4tsM75Ee2JEuR6aPJuLg" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.datasource2" label="Datasource" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/system-file-manager.png" tooltip="%command.label.2" command="_bnVKsCZxEeeQLpuomSmVoQ">
+ <parameters xmi:id="_fD4nIM75Ee2JEuR6aPJuLg" elementId="eu.etaxonomy.taxeditor.webapp.showView.parameter.dataSourceView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.view.datasource"/>
+ </elements>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_lnmLABWNEeiazYUJirF0Pw" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.help" positionInList="after:eu.etaxonomy.taxeditor.workbench.menuseparator.beforeHelp">
<elements xsi:type="menu:HandledMenuItem" xmi:id="_uHiLwBWNEeiazYUJirF0Pw" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.handledmenuitemlabel6" label="%handledmenuitem.label.11" command="_jSJrsBWPEeiazYUJirF0Pw"/>
id="eu.etaxonomy.taxeditor.store.distributionNamedAreaVocabularies"
name="%page.name.106">
</page>
-
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.MediaMetaDataPreference"
+ id="eu.etaxonomy.taxeditor.store.metaDataPreference"
+ name="Media Meta Data">
+ </page>
<page
category="eu.etaxonomy.taxeditor.store.abcdImportPreference"
class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.AbcdImportProviderAdminPreferencePage"
id="eu.etaxonomy.taxeditor.store.TaxonNavigator"
name="%page.name.32">
</page>
+ <page
+ category="eu.etaxonomy.taxeditor.preference.EmptyLanguagePage"
+ class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.LanguageRepresentationAdminPreferencePage"
+ id="eu.etaxonomy.taxeditor.preferences.termLanguages"
+ name="%page.name.23">
+ </page>
</extension>
</plugin>
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.34.0</version>
+ <version>5.42.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
import eu.etaxonomy.cdm.api.application.ICdmRepository;
import eu.etaxonomy.cdm.api.service.IPreferenceService;
-import eu.etaxonomy.cdm.ext.geo.CondensedDistributionRecipe;
+import eu.etaxonomy.cdm.format.description.distribution.CondensedDistributionRecipe;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
}else{
recipe = null;
}
-
}
@Override
}
return true;
}
-
-}
+}
\ No newline at end of file
import eu.etaxonomy.cdm.api.application.ICdmRepository;
import eu.etaxonomy.cdm.api.service.IPreferenceService;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.DistributionDescription;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
import eu.etaxonomy.cdm.model.metadata.TermComboEnum;
pref.setAllowOverride(prefNumberStatus.isAllowOverride());
service.set(pref);
}
+
+ if (descriptionForDistributionEditor == null && allowOverrideDescriptionSelectionButton.getSelection()){
+ service.remove(CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.DescriptionForDistributionEditor));
+ }else{
+ pref = CdmPreference.NewTaxEditorInstance( PreferencePredicate.DescriptionForDistributionEditor, descriptionForDistributionEditor != null? descriptionForDistributionEditor.getKey(): null);
+ if (prefDescription == null){
+ prefDescription = pref;
+ }
+ pref.setAllowOverride(prefDescription.isAllowOverride());
+ service.set(pref);
+ }
PreferencesUtil.updateDBPreferences();
this.numberOfStatus = null;
}
- if (prefOwnDescription != null){
- this.ownDescriptionForDistributionEditor = prefOwnDescription.getValue() != null? Boolean.valueOf(prefOwnDescription.getValue().toString()): null;
+ if (prefDescription != null){
+ this.descriptionForDistributionEditor = prefDescription.getValue() != null? DistributionDescription.byKey(prefDescription.getValue().toString()): null;
}else{
- this.ownDescriptionForDistributionEditor = null;
+ this.descriptionForDistributionEditor = null;
}
import eu.etaxonomy.cdm.api.application.ICdmRepository;
import eu.etaxonomy.cdm.api.service.IPreferenceService;
-import eu.etaxonomy.cdm.ext.geo.CondensedDistributionRecipe;
+import eu.etaxonomy.cdm.format.description.distribution.CondensedDistributionRecipe;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
/**
* @author k.luther
* @since 08.10.2018
- *
*/
public class DistributionAdminPreferences extends DistributionGeneralPreference {
recipe = null;
}
}
-
-
-
-}
+}
\ No newline at end of file
allowOverrideFreeText = getPrefAllowOverride(prefFreeText);
isShowModifierFreeText = getBooleanPrefValue(prefFreeText);
+
+ prefShowSpecimenAsSource = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowSpecimenInFactSource);
+
+ allowOverrideSpecimen = getPrefAllowOverride(prefShowSpecimenAsSource);
+
+ isShowSpecimenAsSource = getBooleanPrefValue(prefShowSpecimenAsSource);
}
prefFreeText = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowModifierFreeText, isShowModifierFreeText != null? Boolean.toString(this.isShowModifierFreeText): null);
prefFreeText.setAllowOverride(allowOverrideFreeText);
PreferencesUtil.setPreferenceToDB(prefFreeText);
+
+ prefShowSpecimenAsSource = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowSpecimenInFactSource, isShowSpecimenAsSource != null? Boolean.toString(this.isShowSpecimenAsSource): null);
+ prefShowSpecimenAsSource.setAllowOverride(allowOverrideSpecimen);
+ PreferencesUtil.setPreferenceToDB(prefShowSpecimenAsSource);
setApply(false);
}
return true;
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2023 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.databaseAdmin.preferencePage;
+
+import java.util.UUID;
+
+import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.taxeditor.preference.LanguageRepresentationPreferencePage;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+
+/**
+ * @author k.luther
+ * @date 25.04.2023
+ *
+ */
+public class LanguageRepresentationAdminPreferencePage extends LanguageRepresentationPreferencePage {
+
+ public LanguageRepresentationAdminPreferencePage() {
+ super();
+ isAdminPreference = true;
+
+ }
+
+
+ @Override
+ public boolean performOk() {
+ if (!isApply()){
+ return true;
+ }
+
+ //boolean result = performOkAdmin();
+ if (this.globalLanguage == null && termLanguagePref.isAllowOverride()){
+ CdmPreference savePref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.TermLanguage, null);
+ PreferencesUtil.removeFromDB(savePref);
+ }else{
+ CdmPreference savePref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.TermLanguage, globalLanguage != null? globalLanguage.getUuid().toString(): null);
+ Boolean allowOverride = this.allowOverrideOrderButton.getSelection();
+ savePref.setAllowOverride(allowOverride);
+
+ PreferencesUtil.setPreferenceToDB(savePref);
+ }
+ PreferencesUtil.updateDBPreferences();
+ PreferencesUtil.firePreferencesChanged(this.getClass());
+// CdmStore.getTermManager().clearTermMapForTermType(TermType.Language);
+ return true;
+ }
+
+ @Override
+ public void getValues() {
+ isAdminPreference = true;
+
+ setPreferenceStore(PreferencesUtil.getPreferenceStore());
+ termLanguagePref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.TermLanguage);
+ if (termLanguagePref == null){
+ termLanguagePref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.TermLanguage, null);
+ }
+
+
+ globalLanguage = termLanguagePref.getValue() != null? Language.getLanguageFromUuid(UUID.fromString(termLanguagePref.getValue())): null;
+ }
+
+ @Override
+ protected void performDefaults() {
+
+ globalLanguage = null;
+ //termLanguagePref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.TermLanguage, globalLanguage.getUuid().toString());
+ overrideActivated = true;
+ this.allowOverrideOrderButton.setSelection(overrideActivated);
+
+ combo_globalLanguage.select(0);
+
+
+ setApply(true);
+
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2019 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.databaseAdmin.preferencePage;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.custom.TableEditor;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.model.ImageResources;
+import eu.etaxonomy.taxeditor.preference.CdmPreferenceCache;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
+
+/**
+ * @author k.luther
+ * @since 19.12.2023
+ *
+ */
+public class MediaMetaDataPreference extends CdmPreferencePage {
+
+ protected String commandHandlerStringStatus;
+
+
+ private Button button_addAdditional;
+ private Button button_removeLine;
+
+ private Composite composite;
+ private Composite tableComposite;
+ private Table table;
+
+ CdmPreferenceCache cache;
+ CdmPreference pref;
+
+ List<String> metaData;
+ Map<String,String> metaDataMapping= new HashMap<>();
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Control createContents(Composite parent) {
+ getValues();
+ composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout());
+
+ GridData textGrid = createTextGridData();
+ textGrid.verticalSpan = 2;
+
+ final CLabel labelPerAreaStatus = new CLabel(composite, SWT.NULL);
+ labelPerAreaStatus.setText(Messages.MediaMetadataPreferenceDescription);
+ labelPerAreaStatus.setLayoutData(textGrid);
+
+
+ createStatusTable();
+ Composite compositeButtons = new Composite(composite, SWT.NULL);
+ GridLayout grid = new GridLayout();
+ grid.numColumns = 2;
+ compositeButtons.setLayout(grid);
+ button_addAdditional = new Button(compositeButtons, SWT.PUSH);
+
+ button_addAdditional.setImage(ImageResources.getImage(ImageResources.ADD_EDIT));
+ button_addAdditional.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent se) {
+ InputDialog dialog = null;
+
+ dialog = new InputDialog(null,
+ String.format("Create %s", "metadata entry"), String.format("Enter new %s", "metadata entry"), "",
+ null);
+ dialog.open();
+ if (dialog.getValue() != null) {
+ metaDataMapping.put(dialog.getValue(), dialog.getValue());
+ refresh();
+ table.setSelection(table.getItemCount()-1);
+ }
+
+ }
+
+ });
+ button_addAdditional.setToolTipText("Add new meta data entry");
+
+
+
+ button_removeLine = new Button(compositeButtons, SWT.PUSH);
+ button_removeLine.setImage(ImageResources.getImage(ImageResources.ACTIVE_DELETE_ICON));
+ button_removeLine.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent se) {
+ // you can execute a command directly ... but to get the proper environment it's better to execute it through the IHandlerService:
+ TableItem[] selection = table.getSelection();
+ if (selection != null && selection.length > 0) {
+ int n = 0;
+ for (TableItem item: selection) {
+ metaDataMapping.remove(selection[n].getText(1));
+ n++;
+ }
+
+ refresh();
+ }
+
+ }
+
+ });
+ button_removeLine.setToolTipText("Remove selected meta data entry");
+ composite.pack ();
+ return composite;
+ }
+
+
+
+
+
+
+
+ public void createStatusTable() {
+ tableComposite = new Composite(composite, SWT.NULL);
+
+ GridLayout gridLayout = new GridLayout();
+ GridData gridData = new GridData();
+ gridData.grabExcessVerticalSpace = false;
+ gridData.heightHint = 400;
+ tableComposite.setLayoutData(gridData);
+
+
+ tableComposite.setLayout(gridLayout);
+
+ table = new Table(
+ tableComposite, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION | SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL
+ );
+
+ table.setLinesVisible(true);
+ table.setHeaderVisible(true);
+
+
+
+ GridData tableGrid = createTextGridData();
+ tableGrid.grabExcessVerticalSpace = true;
+
+ table.setLayoutData(tableGrid);
+ TableColumn column = new TableColumn(table, SWT.CHECK);
+ column.setText(Messages.Show);
+ column.setToolTipText("Show this attribute if available in media viewer of dataportal.");
+ column.setWidth(100);
+
+ column = new TableColumn(table, SWT.NONE);
+ column.setText(Messages.OriginalLabel);
+ column.setWidth(300);
+
+ column = new TableColumn(table, SWT.NONE);
+ column.setText(Messages.DisplayedLabel);
+ column.setWidth(300);
+
+ final TableEditor editor = new TableEditor(table);
+ //The editor must have the same size as the cell and must
+ //not be any smaller than 50 pixels.
+ editor.horizontalAlignment = SWT.LEFT;
+ editor.grabHorizontal = true;
+ editor.minimumWidth = 50;
+ // editing the second column
+ final int EDITABLECOLUMN = 2;
+
+ table.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ // Clean up any previous editor control
+ Control oldEditor = editor.getEditor();
+ if (oldEditor != null) {
+ oldEditor.dispose();
+ }
+
+ // Identify the selected row
+ TableItem item = (TableItem) e.item;
+ if (item == null) {
+ return;
+ }
+
+ // The control that will be the editor must be a child of the Table
+ Text newEditor = new Text(table, SWT.NONE);
+ newEditor.setText(item.getText(EDITABLECOLUMN));
+ newEditor.addModifyListener(me -> {
+ Text text = (Text) editor.getEditor();
+ editor.getItem().setText(EDITABLECOLUMN, text.getText());
+ });
+ newEditor.selectAll();
+ newEditor.setFocus();
+ editor.setEditor(newEditor, item, EDITABLECOLUMN);
+ setApply(true);
+ }
+ });
+
+ for (String metaDataString: this.metaDataMapping.keySet()) {
+ createTableRow(metaDataString);
+ }
+
+ // tableComposite.pack();
+ composite.pack();
+ }
+
+
+ public void createTableRow(String metaDataItem) {
+ TableItem item = new TableItem(table, SWT.NONE);
+
+ item.setText(1, metaDataItem);
+ if (metaDataMapping.get(metaDataItem) != null) {
+ item.setText(2, metaDataMapping.get(metaDataItem));
+ item.setChecked(true);
+
+ }
+ }
+
+ @Override
+ public void getValues() {
+ isAdminPreference = true;
+
+ cache = CdmPreferenceCache.instance();
+
+
+ this.pref = cache.get(PreferencePredicate.MediaMetadataKeynameIncludes.getKey());
+ if (this.pref == null) {
+ pref = new CdmPreference("/", PreferencePredicate.MediaMetadataKeynameIncludes.getKey(), PreferencePredicate.MediaMetadataKeynameIncludes.getDefaultValue().toString());
+ pref.setAllowOverride(false);
+ }
+
+ String prefString = pref.getValue();
+ metaDataMapping = readJson(prefString);
+ if (metaDataMapping.isEmpty()) {
+ metaDataMapping = readJson(PreferencePredicate.MediaMetadataKeynameIncludes.getDefaultValue().toString());
+ }
+ TreeMap<String, String> treeMap = new TreeMap<>(metaDataMapping);
+ metaDataMapping = treeMap;
+
+ setApply(true);
+ }
+
+ /**
+ * @return the metaData
+ */
+ public List<String> getMetaData() {
+ return metaData;
+ }
+
+
+
+ /**
+ * @param metaData the metaData to set
+ */
+ public void setMetaData(List<String> metaData) {
+ this.metaData = metaData;
+ }
+
+
+
+ protected void refresh() {
+
+ if (table != null){
+ table.removeAll();
+
+ disposeTableEditors();
+
+ pref = cache.get(PreferencePredicate.MediaMetadataKeynameIncludes.getKey());
+ if (this.pref == null) {
+ pref = new CdmPreference("/", PreferencePredicate.MediaMetadataKeynameIncludes.getKey(), PreferencePredicate.MediaMetadataKeynameIncludes.getDefaultValue().toString());
+ }
+ for (String metaDataString: this.metaDataMapping.keySet()) {
+ createTableRow(metaDataString);
+ }
+
+
+// table.redraw();
+// table.pack();
+
+ }
+ composite.layout(true);
+ composite.redraw();
+
+
+ }
+
+ private void disposeTableEditors() {
+ Control [] controls = table.getChildren();
+
+ for (int i = 0; i < controls.length; i++) {
+ if(!controls[i].isDisposed()){
+ controls[i].setVisible(false);
+ controls[i].dispose();
+
+ }
+ }
+ }
+
+
+
+
+ @Override
+ protected void performDefaults() {
+ metaDataMapping = readJson(PreferencePredicate.MediaMetadataKeynameIncludes.getDefaultValue().toString());
+ refresh();
+ setApply(true);
+ }
+
+ @Override
+ public boolean performOk(){
+ if (!isApply()){
+ return true;
+ }
+ CdmPreferenceCache cache = CdmPreferenceCache.instance();
+ TableItem[] itemsArray = table.getItems();
+ Map<String, String> prefmap= new HashMap<>();
+ for (TableItem item: itemsArray) {
+ if (item.getChecked()) {
+ if (StringUtils.isNotBlank(item.getText(2))) {
+ prefmap.put(item.getText(1), item.getText(2));
+ }else {
+ prefmap.put(item.getText(1), item.getText(1));
+ }
+ }
+ }
+ if (!prefmap.isEmpty()) {
+ String prefString = createJsonString(prefmap);
+ pref = CdmPreference.NewInstance(pref.getKey(), prefString);
+ pref.setAllowOverride(false);
+ PreferencesUtil.setPreferenceToDB(pref);
+ }else {
+
+ PreferencesUtil.removeFromDB(pref);
+ }
+
+
+ return true;
+ }
+
+ protected Map<String, String> readJson(String json) {
+ JsonNode tree = null;
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ Map<String, String> map
+ = mapper.readValue(json, new TypeReference<Map<String,String>>(){});
+ return map;
+ } catch (JsonProcessingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+
+ }
+
+ protected String createJsonString(Map<String,String> map) {
+ String result = null;
+ ObjectMapper objectMapper = new ObjectMapper();
+ try {
+ result = objectMapper.writeValueAsString(map);
+ } catch (JsonProcessingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+
+
+
+
+}
import eu.etaxonomy.cdm.api.service.config.SortIndexUpdaterConfigurator;
import eu.etaxonomy.cdm.api.service.longrunningService.ILongRunningTasksService;
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
-import eu.etaxonomy.cdm.config.ICdmSource;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.operation.IPostMoniteredOperationEnabled;
-import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @author k.luther
ILongRunningTasksService longRunningTaskService;
-
public DatabaseRepairUpdateSortIndicesWizard() {
setWindowTitle("Update Sort Indices");
config = SortIndexUpdaterConfigurator.NewInstance();
longRunningTaskService = CdmApplicationState.getLongRunningTasksService();
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean performFinish() {
- if (config == null){
- ICdmSource source= CdmStore.getActiveCdmSource();
- config = SortIndexUpdaterConfigurator.NewInstance();
- config.setDoTermNode(false);
- config.setDoPolytomousKeyNode(false);
- }
- if (config.isDoTermNode() || config.isDoPolytomousKeyNode() || config.isDoTaxonNode()){
+ if (config == null){
+ config = SortIndexUpdaterConfigurator.NewInstance();
+ config.setDoTermNode(false);
+ config.setDoPolytomousKeyNode(false);
+ }
+ if (config.isDoTermNode() || config.isDoPolytomousKeyNode() || config.isDoTaxonNode()){
- final UUID uuid = longRunningTaskService.monitLongRunningTask(config);
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- AbstractUtility.executeMoniteredOperation("Update SortIndices: ",
- uuid,
- 1000,
- false,
- DatabaseRepairUpdateSortIndicesWizard.this,
- null,
- true, true);
- }
- });
- }
+ final UUID uuid = longRunningTaskService.monitLongRunningTask(config);
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ AbstractUtility.executeMoniteredOperation("Update SortIndices: ",
+ uuid,
+ 1000,
+ false,
+ DatabaseRepairUpdateSortIndicesWizard.this,
+ null,
+ true, true);
+ }
+ });
+ }
return true;
}
addPage(page);
}
- /**
- * {@inheritDoc}
- */
@Override
public void postOperation(IRemotingProgressMonitor monitor) {
// TODO Auto-generated method stub
}
-}
+}
\ No newline at end of file
boolean isShowEpithets;
boolean isShowAuthorshipCache;
boolean isShowAuthorship;
+ boolean isShowInAuthors;
boolean isShowNomenclaturalRef;
boolean isShowNomenclaturalStatus;
boolean isShowProtologue;
boolean isShowHybrid;
Composite child;
private boolean isShowNameApprobiation;
+ Button showInAuthors;
public NameDetailsViewComposite(Composite parent, int style, NameDetailsConfigurator config){
@Override
public void widgetSelected(SelectionEvent e) {
isShowAuthorship = showAuthorship.getSelection();
+ showInAuthors.setEnabled(isShowAuthorship);
}
});
+ showInAuthors = new Button(child, SWT.CHECK);
+ isShowInAuthors =config.isInAuthorshipActivated();
+ showInAuthors.setText(Messages.NameDetailsViewComposite_Show_In_Author);
+ showInAuthors.setSelection(isShowInAuthors);
+ showInAuthors.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ isShowInAuthors = showInAuthors.getSelection();
+ }
+ });
+ showInAuthors.setEnabled(isShowAuthorship);
final Button showNomenclaturalRef = new Button(child, SWT.CHECK);
isShowNomenclaturalRef = config.isNomenclaturalReferenceSectionActivated();
showNomenclaturalRef.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalReference);
}
public void bind() {
- if(cdmEntitySession!=null){
+ if(cdmEntitySession != null){
cdmEntitySession.bind();
}
else {
+ //TODO AM: what if session initializing is not successful
initSession();
}
}
cdmEntitySession.dispose();
}
cdmEntitySession = null;
-
}
public abstract void merge();
--- /dev/null
+/**
+* Copyright (C) 2023 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.editor;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
+
+/**
+ * @author KatjaLuther
+ * @since 05.07.2023
+ */
+public interface ICharacterMatrix {
+
+ public IStructuredSelection getActualSelection();
+
+ /**
+ * @param columnPosition
+ * @return
+ */
+ FeatureDto getActualFeature(int columnPosition);
+
+}
-// $Id$
/**
* Copyright (C) 2018 EDIT
* European Distributed Institute of Taxonomy
*/
package eu.etaxonomy.taxeditor.editor.definedterm;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import eu.etaxonomy.cdm.api.service.l10n.TermRepresentation_L10n;
-import eu.etaxonomy.cdm.model.term.OrderedTermBase;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
/**
* @author pplitzner
// location <-> add term method used in the MoveDefinedTermOperation
// execute call
//FIXME: remove this when all viewer are changed to use DTOs
- if(e1 instanceof OrderedTermBase && e2 instanceof OrderedTermBase) {
- OrderedTermBase otbe1 = (OrderedTermBase)e1;
- OrderedTermBase otbe2 = (OrderedTermBase)e2;
+ List<Language> languages = new ArrayList<>();
+ languages.add(PreferencesUtil.getGlobalLanguage());
+ if(e1 instanceof DefinedTermBase && CdmBase.deproxy(e1, DefinedTermBase.class).isOrderRelevant()
+ && e2 instanceof DefinedTermBase && CdmBase.deproxy(e2, DefinedTermBase.class).isOrderRelevant()) {
+ DefinedTermBase<?> otbe1 = (DefinedTermBase<?>)e1;
+ DefinedTermBase<?> otbe2 = (DefinedTermBase<?>)e2;
if(otbe1.getOrderIndex() == otbe2.getOrderIndex()) {
return 0;
} else if (otbe1.getOrderIndex() < otbe2.getOrderIndex()){
}
else {
// order indexes are equal or null -> compare by label
- termDto1.localize(new TermRepresentation_L10n());
- termDto2.localize(new TermRepresentation_L10n());
+
+ termDto1.localize(new TermRepresentation_L10n(), languages);
+ termDto2.localize(new TermRepresentation_L10n(), languages);
if(termDto1.getRepresentation_L10n()!=null){
if(termDto2.getRepresentation_L10n()!=null) {
return termDto1.getRepresentation_L10n().toLowerCase().compareTo(termDto2.getRepresentation_L10n().toLowerCase());
else if(e1 instanceof TermVocabularyDto && e2 instanceof TermVocabularyDto) {
TermVocabularyDto termVoc1 = (TermVocabularyDto)e1;
TermVocabularyDto termVoc2 = (TermVocabularyDto)e2;
- termVoc1.localize(new TermRepresentation_L10n());
- termVoc2.localize(new TermRepresentation_L10n());
+ termVoc1.localize(new TermRepresentation_L10n(), languages);
+ termVoc2.localize(new TermRepresentation_L10n(), languages);
if(termVoc1.getRepresentation_L10n()!=null){
if(termVoc2.getRepresentation_L10n()!=null) {
return termVoc1.getRepresentation_L10n().toLowerCase().compareTo(termVoc2.getRepresentation_L10n().toLowerCase());
boolean isAvailableForTaxonName = true;
boolean isAvailableForOccurrence = true;
- public FeatureDtoContentProvider(boolean isAvailableForTaxon, boolean isAvailableForTaxonName, boolean isAvailableForOccurrence){
+ public FeatureDtoContentProvider(boolean isAvailableForTaxon, boolean isAvailableForTaxonName,
+ boolean isAvailableForOccurrence) {
super();
this.isAvailableForOccurrence = isAvailableForOccurrence;
this.isAvailableForTaxon = isAvailableForTaxon;
@Override
public Object[] getChildren(Object parentElement) {
Collection<TermDto> children = new HashSet<>();
- if(parentElement instanceof TermVocabularyDto){
- children.addAll(getChildTerms((TermVocabularyDto)parentElement));
- } else if(parentElement instanceof FeatureDto){
- if(((FeatureDto) parentElement).getIncludes()!=null){
- for (TermDto child: ((FeatureDto) parentElement).getIncludes()){
- if (child instanceof FeatureDto){
- FeatureDto featureChild= (FeatureDto)child;
- if (featureChild.isAvailableForOccurrence() && isAvailableForOccurrence) {
- children.add(featureChild);
- }
- else if (featureChild.isAvailableForTaxon() && isAvailableForTaxon) {
- children.add(featureChild);
- }else if (featureChild.isAvailableForTaxonName() && isAvailableForTaxonName) {
- children.add(featureChild);
- }
+ if (parentElement instanceof TermVocabularyDto) {
+ children.addAll(getChildTerms((TermVocabularyDto) parentElement));
+ } else if (parentElement instanceof FeatureDto) {
+ if (((FeatureDto) parentElement).getIncludes() != null) {
+ for (TermDto child : ((FeatureDto) parentElement).getIncludes()) {
+ if (child instanceof FeatureDto) {
+ FeatureDto featureChild = (FeatureDto) child;
+ if (featureChild.isAvailableForOccurrence() && isAvailableForOccurrence) {
+ children.add(featureChild);
+ } else if (featureChild.isAvailableForTaxon() && isAvailableForTaxon) {
+ children.add(featureChild);
+ } else if (featureChild.isAvailableForTaxonName() && isAvailableForTaxonName) {
+ children.add(featureChild);
}
}
-
}
- if(((FeatureDto) parentElement).getGeneralizationOf()!=null){
- for (TermDto child: ((FeatureDto) parentElement).getGeneralizationOf()){
- if (child instanceof FeatureDto){
- FeatureDto featureChild= (FeatureDto)child;
- if (featureChild.isAvailableForOccurrence() && isAvailableForOccurrence) {
- children.add(featureChild);
- }
- else if (featureChild.isAvailableForTaxon() && isAvailableForTaxon) {
- children.add(featureChild);
- }else if (featureChild.isAvailableForTaxonName() && isAvailableForTaxonName) {
- children.add(featureChild);
- }
+
+ }
+ if (((FeatureDto) parentElement).getGeneralizationOf() != null) {
+ for (TermDto child : ((FeatureDto) parentElement).getGeneralizationOf()) {
+ if (child instanceof FeatureDto) {
+ FeatureDto featureChild = (FeatureDto) child;
+ if (featureChild.isAvailableForOccurrence() && isAvailableForOccurrence) {
+ children.add(featureChild);
+ } else if (featureChild.isAvailableForTaxon() && isAvailableForTaxon) {
+ children.add(featureChild);
+ } else if (featureChild.isAvailableForTaxonName() && isAvailableForTaxonName) {
+ children.add(featureChild);
}
}
-
}
+
+ }
}
return children.toArray();
}
-
-
- @Override
public Collection<TermDto> getChildTerms(TermVocabularyDto voc) {
Collection<TermDto> children = getVocabularyToChildTermMap().get(voc);
Collection<TermDto> filteredChildren = new HashSet<>();
- if(children==null || children.isEmpty()){
+ if (children == null || children.isEmpty()) {
children = new ArrayList<>(CdmStore.getService(IVocabularyService.class).getCompleteTermHierarchy(voc));
- for (TermDto child: children){
- if (child instanceof FeatureDto){
- FeatureDto featureChild= (FeatureDto)child;
+ for (TermDto child : children) {
+ if (child instanceof FeatureDto) {
+ FeatureDto featureChild = (FeatureDto) child;
if (featureChild.isAvailableForOccurrence() && isAvailableForOccurrence) {
filteredChildren.add(featureChild);
- }
- else if (featureChild.isAvailableForTaxon() && isAvailableForTaxon) {
+ } else if (featureChild.isAvailableForTaxon() && isAvailableForTaxon) {
filteredChildren.add(featureChild);
- }else if (featureChild.isAvailableForTaxonName() && isAvailableForTaxonName) {
+ } else if (featureChild.isAvailableForTaxonName() && isAvailableForTaxonName) {
filteredChildren.add(featureChild);
}
}
}
- if (filteredChildren.isEmpty()){
+ if (filteredChildren.isEmpty()) {
getVocabularyToChildTermMap().remove(voc);
- }else{
+ } else {
getVocabularyToChildTermMap().put(voc, filteredChildren);
}
- }else{
+ } else {
filteredChildren = children;
}
return filteredChildren;
}
-
}
import eu.etaxonomy.cdm.model.term.DefinedTermBase;\r
import eu.etaxonomy.cdm.model.term.TermBase;\r
import eu.etaxonomy.cdm.model.term.TermVocabulary;\r
+import eu.etaxonomy.cdm.persistence.dto.AbstractTermDto;\r
import eu.etaxonomy.cdm.persistence.dto.TermDto;\r
+import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;\r
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
\r
*/\r
public class TermBasePropertyTester extends PropertyTester {\r
\r
- private static final String IS_MODIFIABLE = "isModifiable";\r
+ private static final String IS_MODIFIABLE = "isModifiable";\r
\r
- @Override\r
- public boolean test(Object receiver, String property, Object[] args,\r
- Object expectedValue) {\r
+ @Override\r
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {\r
\r
- IStructuredSelection selection = (IStructuredSelection) receiver;\r
- Object selectedElement = selection.getFirstElement();\r
- if (selectedElement != null && HibernateProxyHelper.isInstanceOf(selectedElement, TermBase.class)){\r
- TermBase term = HibernateProxyHelper.deproxy(selectedElement, TermBase.class);\r
+ IStructuredSelection selection = (IStructuredSelection) receiver;\r
+ Object selectedElement = selection.getFirstElement();\r
+ if (selectedElement != null && HibernateProxyHelper.isInstanceOf(selectedElement, TermBase.class)) {\r
+ TermBase term = HibernateProxyHelper.deproxy(selectedElement, TermBase.class);\r
\r
- if(IS_MODIFIABLE.equals(property)){\r
- return isModifiable(term);\r
- }\r
- }\r
-\r
- return false;\r
- }\r
+ if (IS_MODIFIABLE.equals(property)) {\r
+ return isModifiable(term);\r
+ }\r
+ }\r
\r
+ return false;\r
+ }\r
\r
- /**\r
- * Checks whether there is a {@link Marker} with the type {@link MarkerType#MODIFIABLE()} and if there is then return its value.\r
- *\r
- * @return The markers value if it exists\r
- */\r
- public static boolean isModifiable(Object object) {\r
- if (object == null){\r
- return true;\r
- }\r
+ /**\r
+ * Checks whether there is a {@link Marker} with the type\r
+ * {@link MarkerType#MODIFIABLE()} and if there is then return its value.\r
+ *\r
+ * @return The markers value if it exists\r
+ */\r
+ public static boolean isModifiable(Object object) {\r
+ if (object == null) {\r
+ return true;\r
+ }\r
\r
- TermVocabulary<?> vocabulary = null;\r
+ TermVocabulary<?> vocabulary = null;\r
+ if (object instanceof TermBase) {\r
+ if (((TermBase) object).isManaged()) {\r
+ return false;\r
+ }\r
+ }\r
+ if (object instanceof AbstractTermDto) {\r
+ if (((AbstractTermDto) object).isManaged()) {\r
+ return false;\r
+ }\r
+ }\r
+ if (object instanceof TermNodeDto) {\r
+ if (((TermNodeDto) object).isExternallyManaged()) {\r
+ return false;\r
+ }\r
+ }\r
\r
- if(object instanceof DefinedTermBase){\r
- vocabulary = ((DefinedTermBase<?>) object).getVocabulary();\r
- }else if(object instanceof TermVocabulary){\r
- vocabulary = (TermVocabulary<?>) object;\r
- }else if(object instanceof TermDto){\r
+ if (object instanceof DefinedTermBase) {\r
+ vocabulary = ((DefinedTermBase<?>) object).getVocabulary();\r
+ } else if (object instanceof TermVocabulary) {\r
+ vocabulary = (TermVocabulary<?>) object;\r
+ } else if (object instanceof TermDto) {\r
vocabulary = CdmStore.getService(IVocabularyService.class).load(((TermDto) object).getVocabularyUuid());\r
- }else if(object instanceof TermVocabularyDto){\r
+ } else if (object instanceof TermVocabularyDto) {\r
vocabulary = CdmStore.getService(IVocabularyService.class).load(((TermVocabularyDto) object).getUuid());\r
}\r
\r
- if(vocabulary == null){\r
- return true;\r
- }\r
+ if (vocabulary == null) {\r
+ return true;\r
+ }\r
\r
- for(Marker vocabularyMarker : vocabulary.getMarkers()){\r
- if(vocabularyMarker.getMarkerType().equals(MarkerType.MODIFIABLE())){\r
- return vocabularyMarker.getValue();\r
- }\r
- }\r
+ for (Marker vocabularyMarker : vocabulary.getMarkers()) {\r
+ if (vocabularyMarker.getMarkerType().equals(MarkerType.MODIFIABLE())) {\r
+ return vocabularyMarker.getValue();\r
+ }\r
+ }\r
\r
- return true;\r
- }\r
+ return true;\r
+ }\r
}\r
*/
package eu.etaxonomy.taxeditor.editor.definedterm;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import org.eclipse.jface.viewers.TreeNodeContentProvider;
import eu.etaxonomy.cdm.api.service.IVocabularyService;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
+import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.store.CdmStore;
*/
public class TermDtoContentProvider extends TreeNodeContentProvider {
- private Map<TermVocabularyDto, Collection<TermDto>> vocabularyToChildTermMap = new HashMap<>();
+ private Map<TermCollectionDto, Collection<TermDto>> vocabularyToChildTermMap = new HashMap<>();
@Override
- public Object[] getElements(Object inputElement) {
- Collection<TermVocabularyDto> inputElements = (Collection<TermVocabularyDto>) inputElement;
- return inputElements.toArray();
- }
-
- @Override
- public Object[] getChildren(Object parentElement) {
- Collection<TermDto> children = new HashSet<>();
- if(parentElement instanceof TermVocabularyDto){
- children.addAll(getChildTerms((TermVocabularyDto)parentElement));
- } else if(parentElement instanceof TermDto){
- if(((TermDto) parentElement).getIncludes()!=null){
- children.addAll(((TermDto) parentElement).getIncludes());
- }
- if(((TermDto) parentElement).getGeneralizationOf()!=null){
- children.addAll(((TermDto) parentElement).getGeneralizationOf());
- }
- }
- return children.toArray();
- }
-
- @Override
- public Object getParent(Object element) {
- if(element instanceof TermDto){
- TermDto termDto = (TermDto) element;
- TermDto partOfDto = termDto.getPartOfDto();
- if(partOfDto!=null){
- return partOfDto;
- }
- TermDto kindOfDto = termDto.getKindOfDto();
- if(kindOfDto!=null){
- return kindOfDto;
- }
- TermVocabularyDto vocabularyDto = termDto.getVocabularyDto();
- if(vocabularyDto!=null){
- return vocabularyDto;
- }
- //parent is the vocabulary
- return termDto.getVocabularyDto();
- }
- return null;
-
- }
-
- @Override
- public boolean hasChildren(Object element) {
- if(element instanceof TermVocabularyDto){
- return getChildren(element).length > 0;
- }
- if (getChildren(element) != null){
- return getChildren(element).length > 0;
- }
- return false;
- }
-
- public Collection<? extends TermDto> getChildTerms(TermVocabularyDto voc) {
+ public Object[] getElements(Object inputElement) {
+ Collection<TermCollectionDto> inputElements = (Collection<TermCollectionDto>) inputElement;
+ return inputElements.toArray();
+ }
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ Collection<Object> children = new HashSet<>();
+ if (parentElement instanceof TermVocabularyDto) {
+ children.addAll(getChildTerms((TermVocabularyDto) parentElement));
+ } else if (parentElement instanceof TermDto) {
+ if (((TermDto) parentElement).getIncludes() != null) {
+ children.addAll(((TermDto) parentElement).getIncludes());
+ }
+ if (((TermDto) parentElement).getGeneralizationOf() != null) {
+ children.addAll(((TermDto) parentElement).getGeneralizationOf());
+ }
+ } else if (parentElement instanceof TermTreeDto) {
+ TermNodeDto root = ((TermTreeDto) parentElement).getRoot();
+ children.addAll(root.getChildren());
+
+ } else if (parentElement instanceof TermNodeDto) {
+ children.addAll(((TermNodeDto) parentElement).getChildren());
+ }
+ return children.toArray();
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ if (element instanceof TermDto) {
+ TermDto termDto = (TermDto) element;
+ TermDto partOfDto = termDto.getPartOfDto();
+ if (partOfDto != null) {
+ return partOfDto;
+ }
+ TermDto kindOfDto = termDto.getKindOfDto();
+ if (kindOfDto != null) {
+ return kindOfDto;
+ }
+ TermCollectionDto vocabularyDto = termDto.getVocabularyDto();
+ if (vocabularyDto != null) {
+ return vocabularyDto;
+ }
+ // parent is the vocabulary
+ return termDto.getVocabularyDto();
+ }
+ return null;
+
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ if (element instanceof TermVocabularyDto) {
+ return getChildren(element).length > 0;
+ }
+ if (getChildren(element) != null) {
+ return getChildren(element).length > 0;
+ }
+ return false;
+ }
+
+ public Collection<? extends TermDto> getChildTerms(TermCollectionDto voc) {
Collection<TermDto> children = getVocabularyToChildTermMap().get(voc);
- if(children==null){
- children = new ArrayList<>(CdmStore.getService(IVocabularyService.class).getCompleteTermHierarchy(voc));
- getVocabularyToChildTermMap().put(voc, children);
+ if (children == null) {
+ children = CdmStore.getService(IVocabularyService.class).getCompleteTermHierarchy(voc);
+ getVocabularyToChildTermMap().put(voc, children);
}
return children;
}
- public void removeVocabularyFromCache(TermVocabularyDto voc){
+ public void removeVocabularyFromCache(TermCollectionDto voc) {
getVocabularyToChildTermMap().remove(voc);
}
- public Map<TermVocabularyDto, Collection<TermDto>> getVocabularyToChildTermMap() {
+ public Map<TermCollectionDto, Collection<TermDto>> getVocabularyToChildTermMap() {
return vocabularyToChildTermMap;
}
- public void setVocabularyToChildTermMap(Map<TermVocabularyDto, Collection<TermDto>> vocabularyToChildTermMap) {
+ public void setVocabularyToChildTermMap(Map<TermCollectionDto, Collection<TermDto>> vocabularyToChildTermMap) {
this.vocabularyToChildTermMap = vocabularyToChildTermMap;
}
import org.eclipse.swt.graphics.TextStyle;
import org.eclipse.swt.widgets.Display;
-import eu.etaxonomy.cdm.api.service.l10n.TermRepresentation_L10n;
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.term.Representation;
import eu.etaxonomy.cdm.persistence.dto.AbstractTermDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
-import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
+import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
label = termDto.getTitleCache();
}
}
+ if(element instanceof TermNodeDto){
+ TermNodeDto termNodeDto = (TermNodeDto)element;
+ Representation rep = termNodeDto.getTerm().getRepresentation(PreferencesUtil.getGlobalLanguage());
+ label = rep != null? rep.getLabel() :termNodeDto.getTerm().getTitleCache() ;
+
+ if(showIdInVoc && element instanceof TermNodeDto && termNodeDto.getTerm().getIdInVocabulary()!=null){
+ label = CdmUtils.concat(" : ", ( termNodeDto).getTerm().getIdInVocabulary(), label);
+ }
+ if (label == null){
+ label = termNodeDto.getTerm().getTitleCache();
+ }
+ }
// TODO add fallback for label
if(label==null){
label = element.toString();
String label2 = "";
if (e1 instanceof TermNodeDto ){
- if (((TermNodeDto)e1).getTree().isOrderRelevant()){
+ if (((TermNodeDto)e1).isOrderRelevant()){
return 0;
}
}else if (e1 instanceof TermNode){
import org.eclipse.swt.dnd.DragSourceAdapter;
import org.eclipse.swt.dnd.DragSourceEvent;
+import eu.etaxonomy.cdm.model.term.VocabularyEnum;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.taxeditor.editor.definedterm.TermTransfer;
if(!(object instanceof TermDto)){
event.doit = false;
return;
+ }else {
+ if (VocabularyEnum.getVocabularyEnumByUuid(((TermDto) object).getVocabularyUuid()) != null) {
+ event.doit = false;
+ return;
+ }
+ if(((TermDto)object).isManaged() || ((TermDto)object).getVocabularyDto().isManaged()) {
+ event.doit = false;
+ return;
+ }
+
}
+
}
event.doit = true;
}
import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.swt.dnd.TransferData;
+import eu.etaxonomy.cdm.model.term.VocabularyEnum;
import eu.etaxonomy.cdm.persistence.dto.AbstractTermDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
private static final String MOVE_FAILED_MESSAGE = Messages.DefinedTermDropAdapterE4_MOVE_FAILED_MESSAGE;
+ public static final String MOVE_FAILED_STANDARD_TERM = Messages.DefinedTermDropAdapterE4_MOVE_FAILED_STANDARD_TERM;
+ public static final String MOVE_FAILED_TO_STANDARD_VOC = Messages.DefinedTermDropAdapterE4_MOVE_FAILED_TO_STANDARD_VOC;
+ public static final String MOVE_FAILED_TO_MANAGED_VOC = Messages.DefinedTermDropAdapterE4_MOVE_FAILED_TO_MANAGED_VOC;
+ public static final String MOVE_FAILED_TO_MANAGED_TERM = Messages.DefinedTermDropAdapterE4_MOVE_FAILED_MANAGED_TERM;
+
+
private final DefinedTermEditorE4 editor;
+
+ private int test = 0;
@Inject
private UISynchronize sync;
MOVE_FAILED_MESSAGE);
return false;
}
+
+ if(droppedObject instanceof TermDto ) {
+ if (VocabularyEnum.getVocabularyEnumByUuid(((TermDto) droppedObject).getVocabularyUuid()) != null) {
+ MessagingUtils.warningDialog(MOVE_FAILED, this, MOVE_FAILED_STANDARD_TERM);
+ return false;
+ }
+ }
+
if(target instanceof TermDto){
TermDto parentTerm = (TermDto)target;
//check term type compatibility
+ if (VocabularyEnum.getVocabularyEnumByUuid(((TermDto) target).getVocabularyUuid()) != null) {
+ MessagingUtils.warningDialog(MOVE_FAILED, this, MOVE_FAILED_TO_STANDARD_VOC);
+ return false;
+ }
+ if (((TermDto) target).isManaged()) {
+ MessagingUtils.warningDialog(MOVE_FAILED, this, MOVE_FAILED_TO_MANAGED_VOC);
+ return false;
+ }
if(droppedObject instanceof TermDto && !((TermDto) droppedObject).getTermType().equals(parentTerm.getTermType())){
MessagingUtils.warningDialog(TERM_TYPE_ERROR_TITLE, this, TERM_TYPE_ERROR_MESSAGE);
return false;
}
-
+
TermDto partOfDto = parentTerm.getPartOfDto();
if(partOfDto!=null && partOfDto.equals(droppedObject)){
MessagingUtils.warningDialog(MOVE_FAILED, this.getClass(),
else if(target instanceof TermVocabularyDto){
TermVocabularyDto vocDto = (TermVocabularyDto)target;
//check term type compatibility
+ if (VocabularyEnum.getVocabularyEnumByUuid(((TermVocabularyDto) target).getUuid()) != null) {
+ MessagingUtils.warningDialog(MOVE_FAILED, this, MOVE_FAILED_TO_STANDARD_VOC);
+ return false;
+ }
+ if (((TermVocabularyDto) target).isManaged()) {
+ MessagingUtils.warningDialog(MOVE_FAILED, this, MOVE_FAILED_TO_MANAGED_VOC);
+ return false;
+ }
if(droppedObject instanceof TermDto && !((TermDto) droppedObject).getTermType().equals(vocDto.getTermType())){
MessagingUtils.warningDialog(TERM_TYPE_ERROR_TITLE, this, TERM_TYPE_ERROR_MESSAGE);
return false;
TransferData transferType) {
boolean valid = LocalSelectionTransfer.getTransfer().isSupportedType(transferType)
&& target instanceof AbstractTermDto;
- if(target instanceof TermVocabularyDto && getCurrentLocation()!=ViewerDropAdapter.LOCATION_ON ){
+
+ if(target instanceof TermVocabularyDto && (getCurrentLocation()!=ViewerDropAdapter.LOCATION_ON || ((TermVocabularyDto)target).isManaged())){
valid = false;
}
- if (target instanceof TermDto && ((TermDto)target).getOrderIndex() == null && getCurrentLocation() == ViewerDropAdapter.LOCATION_AFTER){
+ if (target instanceof TermDto && ((((TermDto)target).getOrderIndex() == null && getCurrentLocation() == ViewerDropAdapter.LOCATION_AFTER)||(((TermDto)target).isManaged()) || (((TermDto)target).getVocabularyDto().isManaged()))){
valid = false;
}
+
return valid;
}
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IMemento;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.api.service.IVocabularyService;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.term.TermBase;
import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.cdm.persistence.dto.AbstractTermDto;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermSorter;
import eu.etaxonomy.taxeditor.editor.definedterm.TermDtoContentProvider;
import eu.etaxonomy.taxeditor.editor.definedterm.TermDtoLabelProvider;
* @since Aug 22, 2017
*
*/
-public class DefinedTermEditorE4 implements IConversationEnabled, IDirtyMarkable, IPostOperationEnabled,
-IPartContentHasDetails, IPartContentHasSupplementalData, IE4SavablePart, IContextListener {
+public class DefinedTermEditorE4 implements IDirtyMarkable, IPostOperationEnabled, IPartContentHasDetails,
+ IPartContentHasSupplementalData, IE4SavablePart, IContextListener {
- public static final String OPEN_COMMAND_ID = "eu.etaxonomy.taxeditor.store.openDefinedTermEditor"; //$NON-NLS-1$
- private final int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;
+ public static final String OPEN_COMMAND_ID = "eu.etaxonomy.taxeditor.store.openDefinedTermEditor"; //$NON-NLS-1$
+ private final int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;
- protected TreeViewer viewer;
-
- protected ConversationHolder conversation;
+ protected TreeViewer viewer;
@Inject
private ESelectionService selService;
private ISelectionChangedListener selectionChangedListener;
- private TermEditorInput input =null;
+ private TermEditorInput input = null;
@Inject
private MPart thisPart;
private TermDtoContentProvider contentProvider;
- @Inject
- public DefinedTermEditorE4() {
- CdmStore.getContextManager().addContextListener(this);
- }
-
- @PostConstruct
- public void createPartControl(Composite parent, EMenuService menuService,
- IEclipseContext context) {
- if (CdmStore.isActive()){
- if(conversation == null){
- conversation = CdmStore.createConversation();
- }
- }
- else{
- return;
- }
- FillLayout layout = new FillLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.type = SWT.VERTICAL;
-
- parent.setLayout(layout);
- viewer = new TreeViewer(new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI));
- viewer.getControl().setLayoutData(LayoutConstants.FILL());
- contentProvider = new TermDtoContentProvider();
+ @Inject
+ public DefinedTermEditorE4() {
+ CdmStore.getContextManager().addContextListener(this);
+ }
+
+ @PostConstruct
+ public void createPartControl(Composite parent, EMenuService menuService, IEclipseContext context) {
+
+ FillLayout layout = new FillLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.type = SWT.VERTICAL;
+
+ parent.setLayout(layout);
+ viewer = new TreeViewer(new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI));
+ viewer.getControl().setLayoutData(LayoutConstants.FILL());
+ contentProvider = new TermDtoContentProvider();
viewer.setContentProvider(contentProvider);
- viewer.setLabelProvider(new TermDtoLabelProvider());
- viewer.setComparator(new DefinedTermSorter());
+ viewer.setLabelProvider(new TermDtoLabelProvider());
+ viewer.setComparator(new DefinedTermSorter());
- Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getTransfer() };
- viewer.addDragSupport(dndOperations, transfers, new DefinedTermDragListenerE4(viewer));
- DefinedTermDropAdapterE4 dropListener = new DefinedTermDropAdapterE4(this);
- ContextInjectionFactory.inject(dropListener, context);
+ Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getTransfer() };
+ viewer.addDragSupport(dndOperations, transfers, new DefinedTermDragListenerE4(viewer));
+ DefinedTermDropAdapterE4 dropListener = new DefinedTermDropAdapterE4(this);
+ ContextInjectionFactory.inject(dropListener, context);
viewer.addDropSupport(dndOperations, transfers, dropListener);
- //propagate selection
- selectionChangedListener = (event -> selService.setSelection(event.getSelection()));
- viewer.addSelectionChangedListener(selectionChangedListener);
+ // propagate selection
+ selectionChangedListener = (event -> selService.setSelection(event.getSelection()));
+ viewer.addSelectionChangedListener(selectionChangedListener);
- //create context menu
- menuService.registerContextMenu(viewer.getControl(), AppModelId.POPUPMENU_EU_ETAXONOMY_TAXEDITOR_STORE_POPUPMENU_TERMEDITOR);
+ // create context menu
+ menuService.registerContextMenu(viewer.getControl(),
+ AppModelId.POPUPMENU_EU_ETAXONOMY_TAXEDITOR_STORE_POPUPMENU_TERMEDITOR);
- }
+ }
- @Override
- public boolean postOperation(Object objectAffectedByOperation) {
+ @Override
+ public boolean postOperation(Object objectAffectedByOperation) {
input.initialiseVocabularies();
- Collection<AbstractTermDto> itemsToSelect = new HashSet<>();
+ Collection<AbstractTermDto> itemsToSelect = new HashSet<>();
- if(objectAffectedByOperation instanceof Collection){
- for (Object o : (Collection<?>)objectAffectedByOperation) {
- if(o instanceof TermVocabularyDto){
- contentProvider.removeVocabularyFromCache((TermVocabularyDto) o);
- }
- else if(o instanceof TermDto){
+ if (objectAffectedByOperation instanceof Collection) {
+ for (Object o : (Collection<?>) objectAffectedByOperation) {
+ if (o instanceof TermVocabularyDto) {
+ contentProvider.removeVocabularyFromCache((TermCollectionDto) o);
+ } else if (o instanceof TermDto) {
contentProvider.removeVocabularyFromCache(((TermDto) o).getVocabularyDto());
itemsToSelect.add((TermDto) o);
}
}
- }
- if(objectAffectedByOperation instanceof TermVocabularyDto){
- contentProvider.removeVocabularyFromCache((TermVocabularyDto) objectAffectedByOperation);
- itemsToSelect.add((AbstractTermDto) objectAffectedByOperation);
- }
- else if(objectAffectedByOperation instanceof TermDto){
- TermDto termDto = (TermDto) objectAffectedByOperation;
+ }
+ if (objectAffectedByOperation instanceof TermVocabularyDto) {
+ contentProvider.removeVocabularyFromCache((TermVocabularyDto) objectAffectedByOperation);
+ itemsToSelect.add((AbstractTermDto) objectAffectedByOperation);
+ } else if (objectAffectedByOperation instanceof TermDto) {
+ TermDto termDto = (TermDto) objectAffectedByOperation;
itemsToSelect.add(termDto);
contentProvider.removeVocabularyFromCache(termDto.getVocabularyDto());
- }
- if(!itemsToSelect.isEmpty()){
- StructuredSelection selection = new StructuredSelection(itemsToSelect);
+ }
+ if (!itemsToSelect.isEmpty()) {
+ StructuredSelection selection = new StructuredSelection(itemsToSelect);
viewer.setSelection(selection);
for (AbstractTermDto termDto : itemsToSelect) {
viewer.expandToLevel(termDto, 1);
}
- }
- viewer.refresh();
- return true;
- }
+ }
+ viewer.refresh();
+ return true;
+ }
- public void init(TermEditorInput input, String label){
- this.input = input;
+ public void init(TermEditorInput input, String label) {
+ this.input = input;
viewer.setInput(input.getVocabularies());
- for (TermVocabularyDto voc:input.getVocabularies()){
- for (TermDto dto: this.contentProvider.getChildTerms(voc)){
- voc.addTerm(dto);;
+ for (TermCollectionDto voc : input.getVocabularies()) {
+ for (TermDto dto : this.contentProvider.getChildTerms(voc)) {
+ voc.addTerm(dto);
+
}
}
thisPart.setLabel(label);
- }
+ }
- @Override
+ @Override
@Persist
- public void save(IProgressMonitor monitor) {
- getConversationHolder().commit();
- List<DefinedTermBase> terms = new ArrayList<>();
- List<TermVocabulary> vocs = new ArrayList<>();
- for(TermBase term:changedTerms){
- if(term.isInstanceOf(DefinedTermBase.class)){
+ public void save(IProgressMonitor monitor) {
+ List<DefinedTermBase> terms = new ArrayList<>();
+ List<TermVocabulary> vocs = new ArrayList<>();
+ for (TermBase term : changedTerms) {
+ if (term.isInstanceOf(DefinedTermBase.class)) {
DefinedTermBase<?> definedTermBase = (DefinedTermBase<?>) term;
terms.add(definedTermBase);
- }
- else if(term.isInstanceOf(TermVocabulary.class)){
+ } else if (term.isInstanceOf(TermVocabulary.class)) {
TermVocabulary<?> voc = (TermVocabulary<?>) term;
vocs.add(voc);
}
- }
- if (!terms.isEmpty()){
- CdmStore.getService(ITermService.class).merge(terms, true);
- }
- if (!vocs.isEmpty()){
- CdmStore.getService(IVocabularyService.class).merge(vocs, true);
- }
- setDirty(false);
- input.initialiseVocabularies();
+ }
+ if (!terms.isEmpty()) {
+ CdmStore.getService(ITermService.class).merge(terms, true);
+ }
+ if (!vocs.isEmpty()) {
+ CdmStore.getService(IVocabularyService.class).merge(vocs, true);
+ }
+ setDirty(false);
+ input.initialiseVocabularies();
changedTerms.clear();
viewer.refresh();
- EventUtility.postEvent(WorkbenchEventConstants.REFRESH_SUPPLEMENTAL, true);
- }
+ EventUtility.postEvent(WorkbenchEventConstants.REFRESH_SUPPLEMENTAL, true);
+ }
- @Override
+ @Override
public boolean isDirty() {
- return dirty.isDirty();
- }
-
- @Focus
- public void setFocus() {
- if(viewer!=null && viewer.getControl() != null && !viewer.getControl().isDisposed()){
- viewer.getControl().setFocus();
- }
- if(conversation!=null){
- conversation.bind();
- }
- if(input!=null){
- input.bind();
- }
-
- if (viewer.getSelection().isEmpty()){
- viewer.setSelection(null);
- }
- }
-
- @Override
- public void update(CdmDataChangeMap changeEvents) {
- }
-
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
- @Override
- public void changed(Object element) {
- if(element instanceof DefinedTermBase){
- DefinedTermBase<?> definedTermBase = (DefinedTermBase<?>) element;
+ return dirty.isDirty();
+ }
+
+ @Focus
+ public void setFocus() {
+ if (viewer != null && viewer.getControl() != null && !viewer.getControl().isDisposed()) {
+ viewer.getControl().setFocus();
+ }
+ if (input != null) {
+ input.bind();
+ }
+
+ if (viewer.getSelection().isEmpty()) {
+ viewer.setSelection(null);
+ }
+ }
+
+ @Override
+ public void changed(Object element) {
+ if (element instanceof DefinedTermBase) {
+ DefinedTermBase<?> definedTermBase = (DefinedTermBase<?>) element;
TermDto termDto = TermDto.fromTerm(definedTermBase);
- viewer.update(termDto, null);
- changedTerms.add(definedTermBase);
+ viewer.update(termDto, null);
+ changedTerms.add(definedTermBase);
contentProvider.removeVocabularyFromCache(termDto.getVocabularyDto());
- }
- else if(element instanceof TermVocabulary){
- TermVocabulary<?> vocabulary = (TermVocabulary<?>)element;
- TermVocabularyDto vocabularyDto = new TermVocabularyDto(vocabulary.getUuid(), vocabulary.getRepresentations(), vocabulary.getTermType(), vocabulary.getTitleCache(), vocabulary.isAllowDuplicates(), vocabulary.isOrderRelevant(), vocabulary.isFlat());
- viewer.update(vocabularyDto, null);
- changedTerms.add(vocabulary);
+ } else if (element instanceof TermVocabulary) {
+ TermVocabulary<?> vocabulary = (TermVocabulary<?>) element;
+ TermVocabularyDto vocabularyDto = new TermVocabularyDto(vocabulary.getUuid(),
+ vocabulary.getRepresentations(), vocabulary.getTermType(), vocabulary.getTitleCache(),
+ vocabulary.isAllowDuplicates(), vocabulary.isOrderRelevant(), vocabulary.isFlat());
+ viewer.update(vocabularyDto, null);
+ changedTerms.add(vocabulary);
contentProvider.removeVocabularyFromCache(vocabularyDto);
- }
- setDirty(true);
- viewer.update(element, null);
- }
-
- @Override
- public void forceDirty() {
- changed(null);
- }
-
- public void setDirty(boolean dirty) {
- this.dirty.setDirty(dirty);
- }
-
- @Override
- public boolean onComplete() {
- return false;
- }
-
- public TreeViewer getViewer() {
- return viewer;
- }
-
- @PreDestroy
- public void dispose() {
- if(conversation!=null){
- conversation.unregisterForDataStoreChanges(this);
- conversation.close();
- conversation = null;
- }
- if(input!=null){
- input.dispose();
- }
- this.dirty.setDirty(false);
- }
+ }
+ setDirty(true);
+ viewer.update(element, null);
+ }
+
+ @Override
+ public void forceDirty() {
+ changed(null);
+ }
+
+ public void setDirty(boolean dirty) {
+ this.dirty.setDirty(dirty);
+ }
+
+ @Override
+ public boolean onComplete() {
+ return false;
+ }
+
+ public TreeViewer getViewer() {
+ return viewer;
+ }
+
+ @PreDestroy
+ public void dispose() {
+ if (input != null) {
+ input.dispose();
+ }
+ this.dirty.setDirty(false);
+ }
public TermEditorInput getDefinedTermEditorInput() {
return input;
@Override
public void contextStop(IMemento memento, IProgressMonitor monitor) {
- //close view when workbench closes
- try{
+ // close view when workbench closes
+ try {
thisPart.getContext().get(EPartService.class).hidePart(thisPart);
- }
- catch(Exception e){
- //nothing
+ } catch (Exception e) {
+ // nothing
}
}
public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
}
- public void setSelection(TermDto toBeSelected){
+ public void setSelection(TermDto toBeSelected) {
TreeItem[] children = viewer.getTree().getItems();
- for (TreeItem con: children){
- if (con.getData() == toBeSelected){
+ for (TreeItem con : children) {
+ if (con.getData() == toBeSelected) {
this.viewer.setSelection(new StructuredSelection(toBeSelected));
return;
- }else {
- if(con != null){
- Object data= con.getData();
- if(data != null && data instanceof TermVocabularyDto ){
- for (TermDto term:((TermVocabularyDto)data).getTerms()){
- if(term.getUuid().equals(toBeSelected.getUuid())){
- StructuredSelection selection = new StructuredSelection(term);
- viewer.expandToLevel(data, 1);
- viewer.setSelection(selection,true);
- return;
- }
- }
- }
- }
+ } else {
+ if (con != null) {
+ Object data = con.getData();
+ if (data != null && data instanceof TermVocabularyDto) {
+ for (TermDto term : ((TermVocabularyDto) data).getTerms()) {
+ if (term.getUuid().equals(toBeSelected.getUuid())) {
+ StructuredSelection selection = new StructuredSelection(term);
+ viewer.expandToLevel(data, 1);
+ viewer.setSelection(selection, true);
+ return;
+ }
+ }
+ }
+ }
}
}
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.viewers.IStructuredSelection;
-import eu.etaxonomy.cdm.model.common.Language;
-import eu.etaxonomy.cdm.model.location.Country;
+import eu.etaxonomy.cdm.model.term.VocabularyEnum;
import eu.etaxonomy.cdm.persistence.dto.AbstractTermDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
UUID vocabularyUuid = null;
if(firstElement instanceof TermDto){
+ if (((TermDto)firstElement).isManaged() || ((TermDto)firstElement).getVocabularyDto().isManaged()) {
+ return false;
+ }
vocabularyUuid = ((TermDto) firstElement).getVocabularyUuid();
- }else if(firstElement instanceof TermVocabularyDto
- && !menuItem.getCommand().getElementId()
- .equals(AppModelId.COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DEFINEDTERMS_NEWKINDOFTERM)){
- vocabularyUuid = ((TermVocabularyDto) firstElement).getUuid();
+ }else if(firstElement instanceof TermVocabularyDto) {
+ if (((TermVocabularyDto)firstElement).isManaged()) {
+ return false;
+ }
+ if (!menuItem.getCommand().getElementId()
+ .equals(AppModelId.COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DEFINEDTERMS_NEWKINDOFTERM)){
+ vocabularyUuid = ((TermVocabularyDto) firstElement).getUuid();
+ }
}
+
canExecute &= vocabularyUuid!=null
// TODO temporary fix for #7933
- && !vocabularyUuid.equals(Country.uuidCountryVocabulary) && !Language.cdmVocabularyUuids().contains(vocabularyUuid);
+ && VocabularyEnum.getVocabularyEnumByUuid(vocabularyUuid) == null;
menuItem.setVisible(canExecute);
return canExecute;
}
*/
package eu.etaxonomy.taxeditor.editor.definedterm.e4.handler;
+import java.util.HashSet;
+import java.util.Set;
import java.util.UUID;
import javax.inject.Named;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.viewers.IStructuredSelection;
-import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.term.VocabularyEnum;
import eu.etaxonomy.cdm.persistence.dto.AbstractTermDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
if(!StoreUtil.confirmDelete()){
return;
}
-
+ Set<AbstractTermDto> deleteTerms = new HashSet(selection.toList());
String label = menuItem.getLocalizedLabel();
IUndoContext undoContext = StoreUtil.getUndoContext();
AbstractPostOperation operation =
new DeleteTermBaseOperation(label,
undoContext,
- (AbstractTermDto) selection.getFirstElement(),
+ deleteTerms,
termEditor.getDefinedTermEditorInput(),
termEditor);
AbstractUtility.executeOperation(operation, sync);
MHandledMenuItem menuItem){
boolean canExecute = false;
Object firstElement = selection.getFirstElement();
- canExecute = selection.size()==1
- && (firstElement instanceof AbstractTermDto);
+ canExecute = //selection.size()==1 &&
+ (firstElement instanceof AbstractTermDto);
UUID vocabularyUuid = null;
if(firstElement instanceof TermDto){
+ if (((TermDto)firstElement).isManaged() || ((TermDto)firstElement).getVocabularyDto().isManaged()) {
+ return false;
+ }
vocabularyUuid = ((TermDto) firstElement).getVocabularyUuid();
}else if(firstElement instanceof TermVocabularyDto){
+ if (((TermVocabularyDto)firstElement).isManaged()) {
+ return false;
+ }
vocabularyUuid = ((TermVocabularyDto) firstElement).getUuid();
}
- canExecute &= vocabularyUuid!=null && !Language.cdmVocabularyUuids().contains(vocabularyUuid);
+
+
+ canExecute &= vocabularyUuid!=null && VocabularyEnum.getVocabularyEnumByUuid(vocabularyUuid)== null;//!Language.cdmVocabularyUuids().contains(vocabularyUuid);
menuItem.setVisible(canExecute);
return canExecute;
}
package eu.etaxonomy.taxeditor.editor.definedterm.e4.handler;
import java.util.ArrayList;
-import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
-import eu.etaxonomy.cdm.model.common.Language;
-import eu.etaxonomy.cdm.model.location.Country;
+import eu.etaxonomy.cdm.model.term.VocabularyEnum;
import eu.etaxonomy.cdm.persistence.dto.AbstractTermDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.editor.definedterm.e4.DefinedTermEditorE4;
import eu.etaxonomy.taxeditor.editor.definedterm.operation.MoveDefinedTermOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
TermDto selectedTerm = (TermDto) selection.getFirstElement();
- TermChooseWizard wizard = new TermChooseWizard(selectedTerm);
+ TermChooseWizard wizard = new TermChooseWizard(selectedTerm, true, true);
WizardDialog dialog = new WizardDialog(shell, wizard);
List<AbstractTermDto> selectedTerms = new ArrayList<>();
return;
}
+ if(selectedTerms.size()==1){
+ if (selectedTerms.get(0) instanceof TermVocabularyDto) {
+ if (VocabularyEnum.getVocabularyEnumByUuid(((TermVocabularyDto)selectedTerms.get(0)).getUuid()) != null) {
+ MessagingUtils.warningDialog("Move not possible", this, "Standard Vocabularies should not be changed");
+ return;
+ }
+
+ }
+ if (selectedTerms.get(0) instanceof TermDto) {
+ if (VocabularyEnum.getVocabularyEnumByUuid(((TermDto)selectedTerms.get(0)).getVocabularyUuid()) != null) {
+ MessagingUtils.warningDialog("Move not possible", this, "Standard Vocabularies should not be changed");
+ return;
+ }
+
+ }
+ }
AbstractTermDto target = selectedTerms.get(0);
String label = menuItem.getLocalizedLabel();
IUndoContext undoContext = StoreUtil.getUndoContext();
- Set<TermDto> movedTerms = Collections.singleton(selectedTerm);
+ Set<TermDto> movedTerms = new HashSet(selection.toList());
AbstractPostOperation operation =
new MoveDefinedTermOperation(label,
undoContext,
MHandledMenuItem menuItem){
boolean canExecute = false;
Object firstElement = selection.getFirstElement();
- canExecute = selection.size()==1
- && firstElement instanceof TermDto
- // TODO temporary fix for #7933
- && !((TermDto) firstElement).getVocabularyUuid().equals(Country.uuidCountryVocabulary)
- && !Language.cdmVocabularyUuids().contains(((TermDto) firstElement).getVocabularyUuid());
+ canExecute = //selection.size()==1 &&
+ firstElement instanceof TermDto
+ // default vocabularies should not be changed
+ && VocabularyEnum.getVocabularyEnumByUuid(((TermDto) firstElement).getVocabularyUuid()) == null
+ && !((TermDto) firstElement).isManaged()
+ && !((TermDto) firstElement).getVocabularyDto().isManaged();
+// && !((TermDto) firstElement).getVocabularyUuid().equals(VocabularyEnum.Feature.getUuid())
+// && !((TermDto) firstElement).getVocabularyUuid().equals(VocabularyEnum.NameFeature.getUuid())
+// && !Language.cdmVocabularyUuids().contains(((TermDto) firstElement).getVocabularyUuid());
menuItem.setVisible(canExecute);
return canExecute;
}
import eu.etaxonomy.cdm.model.term.TermTree;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.model.term.TermVocabulary;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
*/
public class TermEditorInput extends AbstractDefinedTermEditorInput<DefinedTerm> {
- private TermType termType;
- private Set<TermVocabularyDto> vocabularies;
-
- // FIXME: the default feature should be move to CdmApplicationState
- // where it is a singleton instance variable
- private static TermTree defaultFeatureTree = null;
- private static TermTree completeFeatureTree = null;
- private static TermTree defaultNameFeatureTree = null;
-
- private List<String> termClasses = Arrays.asList(new String[]{
- DefinedTerm.class.getName()
- });
-
- public TermEditorInput(TermType termType) {
- this.termType = termType;
- vocabularies = new HashSet<>();
- initialiseVocabularies();
- }
- public String getName() {
- return termType.getLabel();
- }
-
- @Override
- public List<String> getTermClasses() {
- return termClasses;
- }
-
- public TermType getTermType() {
- return termType;
- }
-
- public void initialiseVocabularies() {
- if(vocabularies != null) {
- vocabularies.clear();
- }
- List<TermVocabularyDto> vocs = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermType(termType, false);
- vocabularies.addAll(vocs);
-
- }
-
- public Set<TermVocabularyDto> getVocabularies() {
- return vocabularies;
- }
-
- public void updateDefaultFeatureTree() {
- for(TermVocabularyDto vocab : getVocabularies()) {
- if(vocab != null && TermType.Feature.equals(vocab.getTermType())) {
- defaultFeatureTree = null;
- return;
- }
- }
- }
-
- @Override
- public Set<TermVocabularyDto> getRootEntities() {
+ private TermType termType;
+ private Set<TermCollectionDto> vocabularies;
+
+ // FIXME: the default feature should be move to CdmApplicationState
+ // where it is a singleton instance variable
+ private static TermTree<Feature> defaultFeatureTree = null;
+ private static TermTree<Feature> completeFeatureTree = null;
+ private static TermTree<Feature> defaultNameFeatureTree = null;
+
+ private List<String> termClasses = Arrays.asList(new String[] { DefinedTerm.class.getName() });
+
+ public TermEditorInput(TermType termType) {
+ this.termType = termType;
+ vocabularies = new HashSet<>();
+ initialiseVocabularies();
+ }
+
+ public String getName() {
+ return termType.getLabel();
+ }
+
+ @Override
+ public List<String> getTermClasses() {
+ return termClasses;
+ }
+
+ public TermType getTermType() {
+ return termType;
+ }
+
+ public void initialiseVocabularies() {
+ if (vocabularies != null) {
+ vocabularies.clear();
+ }
+ List<TermVocabularyDto> vocs = CdmStore.getService(IVocabularyService.class)
+ .findVocabularyDtoByTermType(termType, false);
+ vocabularies.addAll(vocs);
+
+ }
+
+ public Set<TermCollectionDto> getVocabularies() {
+ return vocabularies;
+ }
+
+ public void updateDefaultFeatureTree() {
+ for (TermCollectionDto vocab : getVocabularies()) {
+ if (vocab != null && TermType.Feature.equals(vocab.getTermType())) {
+ defaultFeatureTree = null;
+ return;
+ }
+ }
+ }
+
+ @Override
+ public Set<TermCollectionDto> getRootEntities() {
return getVocabularies();
}
- @Override
+ @Override
public void merge() {
- List<TermVocabulary> vocabularies = new ArrayList<>();
- getRootEntities().forEach(vocDto->vocabularies.add(CdmStore.getService(IVocabularyService.class).load(vocDto.getUuid())));
+ List<TermVocabulary> vocabularies = new ArrayList<>();
+ getRootEntities().forEach(
+ vocDto -> vocabularies.add(CdmStore.getService(IVocabularyService.class).load(vocDto.getUuid())));
CdmStore.getService(IVocabularyService.class).merge(vocabularies, true);
updateDefaultFeatureTree();
}
public static TermTree getDefaultFeatureTree() {
- if(defaultFeatureTree == null) {
+ if (defaultFeatureTree == null) {
List<Feature> features = TermStore.getTerms(Feature.class);
List<Feature> taxonFeatures = features.stream().filter(f -> f.isAvailableForTaxon())
.collect(Collectors.toList());
- defaultFeatureTree = TermTree.NewInstance(taxonFeatures);
+ defaultFeatureTree = TermTree.NewFeatureInstance(taxonFeatures);
}
return defaultFeatureTree;
}
-
+
public static TermTree getCompleteFeatureTree() {
- if(completeFeatureTree == null) {
+ if (completeFeatureTree == null) {
List<Feature> features = TermStore.getTerms(Feature.class);
- completeFeatureTree = TermTree.NewInstance(features);
+ completeFeatureTree = TermTree.NewFeatureInstance(features);
}
return completeFeatureTree;
}
- public static void resetDefaultFeatureTree(){
+ public static void resetDefaultFeatureTree() {
defaultFeatureTree = null;
}
+
public static TermTree getDefaultNameFeatureTree() {
- if(defaultNameFeatureTree == null) {
-// List<TermVocabularyDto> vocs = new ArrayList<>();
-// Set<CdmClass> availableFor = new HashSet<>();
-// availableFor.add(CdmClass.TAXON_NAME);
-// vocs = CdmStore.getService(IVocabularyService.class).findFeatureVocabularyDtoByTermTypes(availableFor);
-// TermVocabulary voc = CdmStore.getService(IVocabularyService.class).load(VocabularyEnum.NameFeature.getUuid());
-// List<Feature> nameFeatures = new ArrayList(voc.getTerms());
-// nameFeatures.remove(Feature.PROTOLOGUE());
-// PreferencesUtil.createPreferredFeatureTreeForNameDescription();
+ if (defaultNameFeatureTree == null) {
+ // List<TermVocabularyDto> vocs = new ArrayList<>();
+ // Set<CdmClass> availableFor = new HashSet<>();
+ // availableFor.add(CdmClass.TAXON_NAME);
+ // vocs =
+ // CdmStore.getService(IVocabularyService.class).findFeatureVocabularyDtoByTermTypes(availableFor);
+ // TermVocabulary voc =
+ // CdmStore.getService(IVocabularyService.class).load(VocabularyEnum.NameFeature.getUuid());
+ // List<Feature> nameFeatures = new ArrayList(voc.getTerms());
+ // nameFeatures.remove(Feature.PROTOLOGUE());
+ // PreferencesUtil.createPreferredFeatureTreeForNameDescription();
defaultNameFeatureTree = PreferencesUtil.getPreferredFeatureTreeForNameDescription(true);
- //List<Feature> nameFeatures = CdmStore.getTermManager().getPreferredTerms(CdmStore.getService(IVocabularyService.class).load(VocabularyEnum.NameFeature.getUuid()), null);
-// defaultNameFeatureTree = TermTree.NewInstance(nameFeatures);
+ // List<Feature> nameFeatures =
+ // CdmStore.getTermManager().getPreferredTerms(CdmStore.getService(IVocabularyService.class).load(VocabularyEnum.NameFeature.getUuid()),
+ // null);
+ // defaultNameFeatureTree = TermTree.NewInstance(nameFeatures);
}
return defaultNameFeatureTree;
}
- public static void resetDefaultNameFeatureTree(){
+ public static void resetDefaultNameFeatureTree() {
defaultNameFeatureTree = null;
}
\r
import eu.etaxonomy.cdm.api.service.IVocabularyService;\r
import eu.etaxonomy.cdm.model.term.DefinedTermBase;\r
-import eu.etaxonomy.cdm.model.term.OrderedTermBase;\r
import eu.etaxonomy.cdm.model.term.OrderedTermVocabulary;\r
import eu.etaxonomy.cdm.model.term.TermType;\r
import eu.etaxonomy.cdm.model.term.TermVocabulary;\r
/**\r
* @author l.morris\r
* @date 21 Dec 2011\r
- *\r
*/\r
public class CreateTermVocabularyOperation extends AbstractPostTaxonOperation {\r
\r
public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
throws ExecutionException {\r
\r
- TermType type= definedEditorInput.getTermType();\r
- DefinedTermBase test = type.getEmptyDefinedTermBase(PreferencesUtil.getGlobalLanguage());\r
- TermVocabulary termVocabulary = null;\r
- if (test instanceof OrderedTermBase){\r
+ TermType type = definedEditorInput.getTermType();\r
+ DefinedTermBase<?> test = type.getEmptyDefinedTermBase(PreferencesUtil.getGlobalLanguage());\r
+ TermVocabulary<?> termVocabulary = null;\r
+ if (test.isOrderRelevant()){\r
termVocabulary = OrderedTermVocabulary.NewInstance(definedEditorInput.getTermType());\r
- termVocabulary.setLabel("Untitled", PreferencesUtil.getGlobalLanguage()); \r
+ termVocabulary.setLabel("Untitled", PreferencesUtil.getGlobalLanguage());\r
}\r
\r
if (termVocabulary == null){\r
termVocabulary =\r
TermVocabulary.NewInstance(definedEditorInput.getTermType(),\r
- null,null, \r
+ null,null,\r
"Untitled",\r
null,\r
null, PreferencesUtil.getGlobalLanguage());\r
throws ExecutionException {\r
return null;\r
}\r
-\r
-}\r
+}
\ No newline at end of file
*/\r
package eu.etaxonomy.taxeditor.editor.definedterm.operation;\r
\r
+import java.util.ArrayList;\r
import java.util.Collection;\r
+import java.util.HashSet;\r
+import java.util.List;\r
+import java.util.Set;\r
+import java.util.UUID;\r
\r
import org.eclipse.core.commands.ExecutionException;\r
import org.eclipse.core.commands.operations.IUndoContext;\r
public class DeleteTermBaseOperation extends AbstractPostTaxonOperation {\r
\r
private final TermEditorInput definedEditorInput;\r
- private final AbstractTermDto termBase;\r
+ private final Set<AbstractTermDto> termBases;\r
\r
public DeleteTermBaseOperation(String label,\r
IUndoContext undoContext,\r
- AbstractTermDto termBase,\r
+ Set<AbstractTermDto> termBases,\r
TermEditorInput definedEditorInput,\r
IPostOperationEnabled postOperationEnabled) {\r
super(label, undoContext, postOperationEnabled);\r
- this.termBase = termBase;\r
+ this.termBases = termBases;\r
this.definedEditorInput = definedEditorInput;\r
}\r
\r
@Override\r
public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
throws ExecutionException {\r
- if (termBase instanceof TermVocabularyDto) {\r
- definedEditorInput.getVocabularies().remove(termBase);\r
+ Set<TermVocabularyDto> vocs = new HashSet<>();\r
+ Set<TermDto> terms = new HashSet<>();\r
+ for (AbstractTermDto dto: termBases) {\r
+ if (dto instanceof TermVocabularyDto) {\r
+ vocs.add((TermVocabularyDto)dto);\r
+ }else if (dto instanceof TermDto){\r
+ terms.add((TermDto)dto);\r
+ }\r
+ }\r
+ \r
+ if (!terms.isEmpty()) {\r
+ List<UUID> uuids = new ArrayList<>();\r
+ terms.forEach(term -> uuids.add(term.getUuid()));\r
+ DeleteResult result = CdmStore.getService(ITermService.class).delete(uuids,\r
+ new TermDeletionConfigurator());\r
+ if (!result.isOk()){\r
+ return showErrorMessage(result);\r
+ }\r
+ }\r
+ \r
+ if (!vocs.isEmpty()) {\r
+ for (TermVocabularyDto voc: vocs) {\r
+ definedEditorInput.getVocabularies().remove(voc);\r
\r
// FIXME this is just a temporary fix for #6952\r
- Collection<TermDto> topLevelTerms = CdmStore.getService(IVocabularyService.class).getTopLevelTerms(termBase.getUuid());\r
+ Collection<TermDto> topLevelTerms = CdmStore.getService(IVocabularyService.class).getTopLevelTerms(voc.getUuid());\r
if(!topLevelTerms.isEmpty()){\r
- MessagingUtils.warningDialog("Deletion not possible", this, "Deletion not possible. Vocabulary is not empty.\nPlease delete or move the child terms first");\r
+ MessagingUtils.warningDialog("Deletion not possible", this, "Deletion not possible. Vocabulary "+ voc.getTitleCache()+" is not empty.\nPlease delete or move the child terms first");\r
return Status.CANCEL_STATUS;\r
}\r
\r
- DeleteResult result = CdmStore.getService(IVocabularyService.class).delete(termBase.getUuid());\r
+ DeleteResult result = CdmStore.getService(IVocabularyService.class).delete(voc.getUuid());\r
if (!result.isOk()){\r
return showErrorMessage(result);\r
}\r
+ }\r
\r
- } else if (termBase instanceof TermDto) {\r
- DeleteResult result = CdmStore.getService(ITermService.class).delete(termBase.getUuid(),\r
- new TermDeletionConfigurator());\r
- if (!result.isOk()){\r
- return showErrorMessage(result);\r
- }\r
- }\r
- return postExecute(termBase);\r
+ } \r
+ return postExecute(termBases);\r
}\r
\r
private IStatus showErrorMessage(DeleteResult result) {\r
import eu.etaxonomy.cdm.model.term.DefinedTermBase;\r
import eu.etaxonomy.cdm.model.term.TermVocabulary;\r
import eu.etaxonomy.cdm.persistence.dto.AbstractTermDto;\r
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;\r
import eu.etaxonomy.cdm.persistence.dto.TermDto;\r
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;\r
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;\r
*/\r
public class MoveDefinedTermOperation extends AbstractPostTaxonOperation {\r
\r
- private final Collection<TermDto> sourceTerms;// the actual DefinedTermBase(s) we are moving\r
- private final Collection<TermVocabularyDto> sourceVocabularies;\r
- private final AbstractTermDto targetTermOrVocabulary;// the target VOCABULARY or DefinedTerm we are moving these to\r
- private final int currentLocation;\r
+ private final Collection<TermDto> sourceTerms;// the actual\r
+ // DefinedTermBase(s) we are\r
+ // moving\r
+ private final Collection<TermCollectionDto> sourceVocabularies;\r
+ private final AbstractTermDto targetTermOrVocabulary;// the target\r
+ // VOCABULARY or\r
+ // DefinedTerm we are\r
+ // moving these to\r
+ private final int currentLocation;\r
\r
- public MoveDefinedTermOperation(String label,\r
- IUndoContext undoContext,\r
- AbstractTermDto target,\r
- Collection<TermDto> sourceTerms,\r
- IPostOperationEnabled postOperationEnabled) {\r
- this(label, undoContext, target, sourceTerms, postOperationEnabled, ViewerDropAdapter.LOCATION_ON);\r
- }\r
- public MoveDefinedTermOperation(String label,\r
- IUndoContext undoContext,\r
- AbstractTermDto target,\r
- Collection<TermDto> sourceTerms,\r
- IPostOperationEnabled postOperationEnabled,\r
- int currentLocation) {\r
- super(label, undoContext, postOperationEnabled);\r
+ public MoveDefinedTermOperation(String label, IUndoContext undoContext, AbstractTermDto target,\r
+ Collection<TermDto> sourceTerms, IPostOperationEnabled postOperationEnabled) {\r
+ this(label, undoContext, target, sourceTerms, postOperationEnabled, ViewerDropAdapter.LOCATION_ON);\r
+ }\r
\r
- this.targetTermOrVocabulary = target;\r
- this.sourceTerms = sourceTerms;\r
- this.currentLocation = currentLocation;\r
- sourceVocabularies = new HashSet<>();\r
- }\r
+ public MoveDefinedTermOperation(String label, IUndoContext undoContext, AbstractTermDto target,\r
+ Collection<TermDto> sourceTerms, IPostOperationEnabled postOperationEnabled, int currentLocation) {\r
+ super(label, undoContext, postOperationEnabled);\r
\r
- @Override\r
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
- throws ExecutionException {\r
- UpdateResult result = new UpdateResult();\r
- for(TermDto term:sourceTerms){\r
- sourceVocabularies.add(term.getVocabularyDto());\r
+ this.targetTermOrVocabulary = target;\r
+ this.sourceTerms = sourceTerms;\r
+ this.currentLocation = currentLocation;\r
+ sourceVocabularies = new HashSet<>();\r
+ }\r
+\r
+ @Override\r
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {\r
+ UpdateResult result = new UpdateResult();\r
+ for (TermDto term : sourceTerms) {\r
+ sourceVocabularies.add(term.getVocabularyDto());\r
UUID parentUuid = targetTermOrVocabulary.getUuid();\r
TermMovePosition termMovePosition = TermMovePosition.ON;\r
- if(currentLocation == ViewerDropAdapter.LOCATION_BEFORE) {\r
+ if (currentLocation == ViewerDropAdapter.LOCATION_BEFORE) {\r
termMovePosition = TermMovePosition.BEFORE;\r
- }\r
- else if(currentLocation == ViewerDropAdapter.LOCATION_AFTER) {\r
+ } else if (currentLocation == ViewerDropAdapter.LOCATION_AFTER) {\r
termMovePosition = TermMovePosition.AFTER;\r
}\r
result.includeResult(CdmStore.getService(ITermService.class).moveTerm(term, parentUuid, termMovePosition));\r
}\r
- Collection<CdmBase> affectedObjects = result.getUpdatedObjects();\r
- Collection<AbstractTermDto> affectedDtos = new HashSet();\r
- for (CdmBase base: affectedObjects){\r
- if (base instanceof TermVocabulary){\r
- TermVocabularyDto dto = new TermVocabularyDto(base.getUuid(), ((TermVocabulary)base).getRepresentations(), ((TermVocabulary)base).getTermType(), ((TermVocabulary)base).getTitleCache(), ((TermVocabulary)base).isAllowDuplicates(), ((TermVocabulary)base).isOrderRelevant(), ((TermVocabulary)base).isFlat());\r
- affectedDtos.add(dto);\r
- }\r
- if (base instanceof DefinedTermBase){\r
- TermDto dto = TermDto.fromTerm((DefinedTermBase)base);\r
+ Collection<CdmBase> affectedObjects = result.getUpdatedObjects();\r
+ Collection<AbstractTermDto> affectedDtos = new HashSet<>();\r
+ for (CdmBase base : affectedObjects) {\r
+ if (base instanceof TermVocabulary) {\r
+ TermVocabularyDto dto = new TermVocabularyDto(base.getUuid(),\r
+ ((TermVocabulary<?>) base).getRepresentations(), ((TermVocabulary) base).getTermType(),\r
+ ((TermVocabulary) base).getTitleCache(), ((TermVocabulary) base).isAllowDuplicates(),\r
+ ((TermVocabulary) base).isOrderRelevant(), ((TermVocabulary) base).isFlat());\r
affectedDtos.add(dto);\r
- }\r
- }\r
-\r
+ }\r
+ if (base instanceof DefinedTermBase) {\r
+ TermDto dto = TermDto.fromTerm((DefinedTermBase) base);\r
+ affectedDtos.add(dto);\r
+ }\r
+ }\r
\r
- return postExecute(affectedDtos);\r
- }\r
+ return postExecute(affectedDtos);\r
+ }\r
\r
- @Override\r
- public IStatus redo(IProgressMonitor monitor, IAdaptable info)\r
- throws ExecutionException {\r
- return null;\r
- }\r
+ @Override\r
+ public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {\r
+ return null;\r
+ }\r
\r
- @Override\r
- public IStatus undo(IProgressMonitor monitor, IAdaptable info)\r
- throws ExecutionException {\r
- return null;\r
- }\r
+ @Override\r
+ public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {\r
+ return null;\r
+ }\r
\r
}\r
public static final String REFRESH_DESCRIPTIVE_DATASET = "REFRESH/DESCRIPTIVE_DATASET";
public static final String ADD_SAVE_CANDIDATE = "ADD/SAVE/CANDIDATE";
+
+ public static final String REMOVE_ELEMENT = "REMOVE/ELEMENT";
+
public static final String ADD_SAVE_CHARACTER = "ADD/SAVE/CHARACTER";
public static final String ADD_TO_MERGE_ROWS = "ADD/TO/MERGE/ROWS";
public static final String UPDATE_LINK_WITH_TAXON = "UPDATE/LINK_WITH_TAXON";
-
+
public static final String REFRESH_MATRIX = "REFRESH/MATRIX";
+ public static final String NEED_REFRESH_DETAILS = "BLOCK/DETAILS/TAXON";
+
}
if(principal instanceof User){
- PasswordWizard wizard = new PasswordWizard((User)principal, null);
+ PasswordWizard wizard = new PasswordWizard((User)principal);
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.open();
* 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.handler.e4;
import javax.inject.Named;
* 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.io;
import java.util.List;
import eu.etaxonomy.taxeditor.ui.dialog.ReportTextDialog;
/**
- * <p>
- * Abstract AbstractIOHandler class.
- * </p>
- *
* @author n.hoffmann
* @created Sep 11, 2009
- * @version 1.0
*/
public abstract class AbstractIOManager<CONFIGURATOR extends IIoConfigurator> {
protected ICdmRepository applicationConfiguration;
public static enum TYPE {
- Jaxb, Tcs, Excel_Taxa, Endnote, Sdd, Abcd, SpecimenCdmExcel, Excel_Name, SpecimenSearch, Gbif, Excel_Distribution, Ris, OWL
+ Jaxb, Tcs, Excel_Taxa, Sdd, Abcd, Excel_Name, SpecimenSearch, Gbif, Excel_Distribution, Ris, OWL
}
- /**
- * <p>
- * Constructor for AbstractIOHandler.
- * </p>
- *
- * @param applicationController
- * a
- * {@link eu.etaxonomy.cdm.api.application.CdmApplicationController}
- * object.
- * @param <CONFIGURATOR>
- * a CONFIGURATOR object.
- */
protected AbstractIOManager(
ICdmRepository applicationConfiguration) {
this.applicationConfiguration = applicationConfiguration;
}
-
- /**
- * Starts the IO process
- *
- * @param configurator
- * a CONFIGURATOR object.
- */
- public void run(final CONFIGURATOR configurator) {
- // create job
- Job job = createIOJob(configurator);
- run(job);
- }
+//
+// /**
+// * Starts the IO process
+// *
+// * @param configurator
+// * a CONFIGURATOR object.
+// */
+// public void run(final CONFIGURATOR configurator) {
+// // create job
+// Job job = createIOJob(configurator);
+// run(job);
+// }
public void run(Job job) {
// configure the job
job.schedule();
}
- /**
- * <p>
- * createIOJob
- * </p>
- *
- * @param configurator
- * a CONFIGURATOR object.
- * @return a {@link org.eclipse.core.runtime.jobs.Job} object.
- */
- protected abstract Job createIOJob(CONFIGURATOR configurator);
+// /**
+// * <p>
+// * createIOJob
+// * </p>
+// *
+// * @param configurator
+// * a CONFIGURATOR object.
+// * @return a {@link org.eclipse.core.runtime.jobs.Job} object.
+// */
+// protected abstract Job createIOJob(CONFIGURATOR configurator);
/**
* @param configurator
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.application.ICdmRepository;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
import eu.etaxonomy.cdm.io.cdmLight.CdmLightExportConfigurator;
-import eu.etaxonomy.cdm.io.common.CdmDefaultExport;
+import eu.etaxonomy.cdm.io.coldp.ColDpExportConfigurator;
import eu.etaxonomy.cdm.io.common.ExportDataWrapper;
import eu.etaxonomy.cdm.io.common.ExportResult;
import eu.etaxonomy.cdm.io.common.ExportResultType;
import eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator;
import eu.etaxonomy.cdm.io.sdd.out.SDDExportConfigurator;
import eu.etaxonomy.cdm.io.service.IIOService;
-import eu.etaxonomy.taxeditor.event.EventUtility;
+import eu.etaxonomy.cdm.io.wfo.out.WfoBackboneExportConfigurator;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
/**
- *
* @author n.hoffmann
* @created Sep 11, 2009
*/
extends AbstractIOManager<IExportConfigurator>
implements IPostMoniteredOperationEnabled {
- private static final Logger logger = LogManager.getLogger(ExportManager.class);
+ private static final Logger logger = LogManager.getLogger();
+
/** Constant <code>DATE_FORMAT_NOW="yyyyMMddHHmm"</code> */
public static final String DATE_FORMAT_NOW = "yyyyMMddHHmm";
return new ExportManager(applicationConfiguration);
}
- @Override
- protected Job createIOJob(final IExportConfigurator configurator) {
-
- Assert.isNotNull(configurator, "Configuration may not be null");
-
- final Display display = Display.getCurrent();
-
- Job job = new Job("Export: " + configurator.getClass().getSimpleName()) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask(
- "Exporting database. This will take some time.", 100);
- monitor.worked(10);
-
- /** see ticket # 4456 and */
-// display.asyncExec(new Runnable() {
-//
-// @Override
-// public void run() {
-//
-// // terminate any open transactions
-// IConversationEnabled activePart = (IConversationEnabled) StoreUtil
-// .getActivePage().getActivePart();
-// activePart.getConversationHolder().commit(false);
-// }
-// });
-
-// monitor.worked(10);
-
- CdmDefaultExport<IExportConfigurator> exporter = new CdmDefaultExport<>();
- configurator.setProgressMonitor(CdmProgressMonitorAdapter
- .CreateSubMonitor(monitor, 80));
- exporter.setCdmAppController(applicationConfiguration);
- monitor.worked(10);
-
- try {
- exporter.invoke(configurator);
- monitor.worked(60);
- } catch (RuntimeException e) {
- MessagingUtils.messageDialog("Error exporting data", this,
- "An error occurred while"
- + "exporting to destination '"
- + configurator.getDestinationNameString()
- + "'.\n"
- + "Please check error log for details.", e);
- }
-
- display.asyncExec(()-> {
- Object activePart = EventUtility.getActivePart();
- if (activePart instanceof IConversationEnabled) {
- // terminate any open transactions
- IConversationEnabled conversationEnabled = (IConversationEnabled) activePart;
- // restarting transaction and committing it to
- // trigger
- // change listener
- // TODO verify correct behaviour
-
- try{
- conversationEnabled.getConversationHolder()
- .startTransaction();
-
- conversationEnabled.getConversationHolder()
- .commit();
- }catch(RuntimeException e){
- MessagingUtils.messageDialog("Error starting conversation handling", this, "" +
- "Conversation Error: "+ e);
- }
- }
- });
- monitor.worked(10);
-
- return Status.OK_STATUS;
- }
- };
-
- return job;
- }
-
public Job createIOServiceJob(final IExportConfigurator configurator, final File exportFile) {
Assert.isNotNull(configurator, "Configuration may not be null");
Writer out = new BufferedWriter(new OutputStreamWriter(
stream, "UTF8"));
stream.write(fileData);
+ out.flush();
stream.close();
+
}
}
}else{
@Override
public void run() {
boolean isZip = false;
- if (configurator instanceof CdmLightExportConfigurator){
- isZip = ((CdmLightExportConfigurator)configurator).isCreateZipFile();
+ String urlAddition = "";
+ if (configurator instanceof CdmLightExportConfigurator
+ || configurator instanceof ColDpExportConfigurator
+ || configurator instanceof WfoBackboneExportConfigurator){
+
+ if (configurator instanceof CdmLightExportConfigurator) {
+ isZip = ((CdmLightExportConfigurator)configurator).isCreateZipFile();
+ }else if (configurator instanceof ColDpExportConfigurator){
+ isZip = ((ColDpExportConfigurator)configurator).isCreateZipFile();
+ }else if (configurator instanceof WfoBackboneExportConfigurator){
+ isZip = ((WfoBackboneExportConfigurator)configurator).isCreateZipFile();
+ if (isZip) {
+ SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
+ Calendar cal = Calendar.getInstance();
+ urlAddition = File.separator + ((WfoBackboneExportConfigurator)configurator).getFamilyStr() + "_WFO_" + sdf.format(cal.getTime());
+ }
+ }
}
- AbstractUtility.executeMoniteredExport(configurator.getUserFriendlyIOName() != null? configurator.getUserFriendlyIOName(): "Export",
+ AbstractUtility.executeMoniteredExport(
+ configurator.getUserFriendlyIOName() != null? configurator.getUserFriendlyIOName(): "Export",
uuid,
1000,
true,
ExportManager.this,
null,
- urlString,
+ urlString+urlAddition,
isZip);
}
});
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.application.ICdmRepository;
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
-import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;
import eu.etaxonomy.cdm.io.dwca.in.DwcaImportConfigurator;
import eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator;
import eu.etaxonomy.cdm.io.jaxb.JaxbImportConfigurator;
-import eu.etaxonomy.cdm.io.reference.endnote.in.EndnoteImportConfigurator;
import eu.etaxonomy.cdm.io.sdd.in.SDDImportConfigurator;
import eu.etaxonomy.cdm.io.service.IIOService;
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
-import eu.etaxonomy.cdm.io.specimen.excel.in.SpecimenCdmExcelImportConfigurator;
import eu.etaxonomy.cdm.io.specimen.gbif.in.GbifImportConfigurator;
import eu.etaxonomy.cdm.io.specimen.gbif.in.GbifImportState;
import eu.etaxonomy.cdm.io.tcsxml.in.TcsXmlImportConfigurator;
import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.IPostMoniteredOperationEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
-import eu.etaxonomy.taxeditor.ui.dialog.ReportTextDialog;
/**
* @author n.hoffmann
return new ImportManager(applicationConfiguration);
}
- /**
- * Use when importing data into the current application context
- *
- * @param configurator
- * a {@link eu.etaxonomy.cdm.io.common.IImportConfigurator}
- * object.
- * @return a {@link org.eclipse.core.runtime.jobs.Job} object.
- */
- @Override
- protected Job createIOJob(final IImportConfigurator configurator) {
- Assert.isNotNull(configurator, "Configuration may not be null");
-
- final Display display = Display.getDefault();
-
- Job job = new Job("Import: " + configurator.getClass().getSimpleName()) {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask("Importing data", 100);
- configurator.setProgressMonitor(CdmProgressMonitorAdapter
- .CreateSubMonitor(monitor, 70));
-
- monitor.worked(5);
-
- CdmDefaultImport<IImportConfigurator> importer = new CdmDefaultImport<IImportConfigurator>();
- importer.setCdmAppController(applicationConfiguration);
- monitor.worked(5);
- ImportResult importResult = null;
- try {
- importResult = importer.invoke(configurator);
-
- monitor.worked(80);
- } catch (RuntimeException e) {
- MessagingUtils.messageDialog(
- "Error importing data",
- this,
- "An error occurred while"
- + "importing from source '"
- + configurator.getSourceNameString()
- + "'.\n"
- + "Please check error log for details.", e);
- }
-
- monitor.worked(5);
- monitor.done();
-
-
- final StringBuilder reportText = new StringBuilder();
- if(importResult!=null){
- List<byte[]> reports = importResult.getReports();
- for (byte[] bs : reports) {
- reportText.append(new String(bs));
- }
- }
- display.asyncExec(new Runnable() {
-
- @Override
- public void run() {
- // display reports with possibility to save
- ReportTextDialog dialog = new ReportTextDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
- dialog.setTitle(configurator.getClass().getSimpleName()+" Report");
- dialog.setReportText(reportText.toString());
- dialog.open();
-
- CdmStore.getContextManager().notifyContextRefresh();
-
- }
- });
-
- return Status.OK_STATUS;
- }
- };
-
- return job;
-
- }
+// /**
+// * Use when importing data into the current application context
+// *
+// * @param configurator
+// * a {@link eu.etaxonomy.cdm.io.common.IImportConfigurator}
+// * object.
+// * @return a {@link org.eclipse.core.runtime.jobs.Job} object.
+// */
+// @Override
+// protected Job createIOJob(final IImportConfigurator configurator) {
+// Assert.isNotNull(configurator, "Configuration may not be null");
+//
+// final Display display = Display.getDefault();
+//
+// Job job = new Job("Import: " + configurator.getClass().getSimpleName()) {
+//
+// @Override
+// protected IStatus run(IProgressMonitor monitor) {
+// monitor.beginTask("Importing data", 100);
+// configurator.setProgressMonitor(CdmProgressMonitorAdapter
+// .CreateSubMonitor(monitor, 70));
+//
+// monitor.worked(5);
+//
+// CdmDefaultImport<IImportConfigurator> importer = new CdmDefaultImport<>();
+// importer.setCdmAppController(applicationConfiguration);
+// monitor.worked(5);
+// ImportResult importResult = null;
+// try {
+// importResult = importer.invoke(configurator);
+//
+// monitor.worked(80);
+// } catch (RuntimeException e) {
+// MessagingUtils.messageDialog(
+// "Error importing data",
+// this,
+// "An error occurred while"
+// + "importing from source '"
+// + configurator.getSourceNameString()
+// + "'.\n"
+// + "Please check error log for details.", e);
+// }
+//
+// monitor.worked(5);
+// monitor.done();
+//
+//
+// final StringBuilder reportText = new StringBuilder();
+// if(importResult!=null){
+// List<byte[]> reports = importResult.getReports();
+// for (byte[] bs : reports) {
+// reportText.append(new String(bs));
+// }
+// }
+// display.asyncExec(new Runnable() {
+//
+// @Override
+// public void run() {
+// // display reports with possibility to save
+// ReportTextDialog dialog = new ReportTextDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+// dialog.setTitle(configurator.getClass().getSimpleName()+" Report");
+// dialog.setReportText(reportText.toString());
+// dialog.open();
+//
+// CdmStore.getContextManager().notifyContextRefresh();
+//
+// }
+// });
+//
+// return Status.OK_STATUS;
+// }
+// };
+//
+// return job;
+//
+// }
public Job createIOServiceJob(IImportConfigurator configurator, InputStream is, SOURCE_TYPE type) {
return JaxbImportConfigurator.NewInstance(null, null);
case Tcs:
return TcsXmlImportConfigurator.NewInstance(null, null);
- case Endnote:
- return EndnoteImportConfigurator.NewInstance(null, null);
case Excel_Taxa:
return NormalExplicitImportConfigurator.NewInstance(null, null,
null, null);
return Abcd206ImportConfigurator.NewInstance(null, null);
case Sdd:
return SDDImportConfigurator.NewInstance(null, null);
- case SpecimenCdmExcel:
- return SpecimenCdmExcelImportConfigurator.NewInstance(null, null);
case SpecimenSearch:
return Abcd206ImportConfigurator.NewInstance(null, null);
case Gbif:
return (TcsXmlImportConfigurator) getConfigurator(TYPE.Tcs);
}
- /**
- * <p>
- * EndnoteConfigurator
- * </p>
- *
- * @return a
- * {@link eu.etaxonomy.cdm.io.reference.endnote.in.EndnoteImportConfigurator}
- * object.
- */
- public final EndnoteImportConfigurator EndnoteConfigurator() {
- return (EndnoteImportConfigurator) getConfigurator(TYPE.Endnote);
- }
+
/**
* <p>
return (Abcd206ImportConfigurator) getConfigurator(TYPE.Abcd);
}
- public SpecimenCdmExcelImportConfigurator SpecimenCdmExcelImportConfigurator() {
- return (SpecimenCdmExcelImportConfigurator) getConfigurator(TYPE.SpecimenCdmExcel);
- }
-
public DwcaImportConfigurator DwcaImportConfigurator() {
return (DwcaImportConfigurator) getConfigurator(TYPE.Gbif);
}
* 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.io.e4.in;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import eu.etaxonomy.taxeditor.l10n.Messages;
/**
- *
* @author pplitzner
* @since Oct 5, 2017
*
* @param <CONFIG>
*/
-public abstract class AbstractImportWizardE4<CONFIG extends IIoConfigurator> extends Wizard {
+public abstract class AbstractImportWizard<CONFIG extends IIoConfigurator> extends Wizard {
protected GenericConfiguratorWizardPageE4 pageConfiguration;
private NomenclaturalCodeWizardPageE4 pageNomenclaturalCode;
private EPartService partService;
- public AbstractImportWizardE4(IEclipseContext context, EPartService partService) {
+ public AbstractImportWizard(IEclipseContext context, EPartService partService) {
this(context, partService, null);
}
- public AbstractImportWizardE4(IEclipseContext context, EPartService partService, IStructuredSelection selection) {
+ public AbstractImportWizard(IEclipseContext context, EPartService partService, IStructuredSelection selection) {
this.context = context;
this.partService = partService;
this.selection = selection;
}
- /** {@inheritDoc} */
@Override
public void addPages() {
super.addPages();
public IStructuredSelection getSelection() {
return selection;
}
-
-}
+}
\ No newline at end of file
/**
* @author pplitzner
* @since Oct 5, 2017
- *
*/
public abstract class AbstractOpenImportWizard {
@Execute
- public void execute(IEclipseContext ctx, Shell s)
- {
- AbstractImportWizardE4 wizard = ContextInjectionFactory.make(getImportWizardClass(), ctx);
+ public void execute(IEclipseContext ctx, Shell s){
+ AbstractImportWizard<?> wizard = ContextInjectionFactory.make(getImportWizardClass(), ctx);
wizard.init();
WizardDialog dialog = new WizardDialog(s, wizard);
dialog.open();
}
- protected abstract Class<? extends AbstractImportWizardE4> getImportWizardClass();
+ protected abstract Class<? extends AbstractImportWizard> getImportWizardClass();
}
\ No newline at end of file
* 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.io.e4.in;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
/**
- *
* @author pplitzner
* @since Oct 5, 2017
- *
*/
public class GenericConfiguratorWizardPageE4 extends WizardPage {
init("Export Configuration", "Configure the export mechanism.", configurator, ignoreMethods);
}
- /** {@inheritDoc} */
@Override
public void createControl(Composite parent) {
composite.setLayout(gridLayout);
List<Method> methods = getConfiguratorsBooleanSetMethods(configurator);
- Collections.sort(methods, new Comparator<Method>() {
- @Override
- public int compare(Method o1, Method o2) {
+ Collections.sort(methods, (o1,o2)-> {
if (o1.equals(o2)){
return 0;
}
return o1.toString().compareTo(o1.toString());
}
return result;
- }
});
- for (Method method : methods) {
- if (ignoreMethods != null){
- if (!ignoreMethods.contains( method.getName())) {
- createCheckbox(composite, method, configurator);
- }
- }else{
- createCheckbox(composite, method, configurator);
- }
-
- }
+ for (Method method : methods) {
+ if (ignoreMethods != null){
+ if (!ignoreMethods.contains( method.getName())) {
+ createCheckbox(composite, method, configurator);
+ }
+ }else{
+ createCheckbox(composite, method, configurator);
+ }
+ }
setControl(composite);
}
+ methodName.substring(3));
checkBox.setSelection(defaultSelection);
checkBox.addSelectionListener(new SelectionAdapter() {
-
@Override
public void widgetSelected(SelectionEvent e) {
executeBooleanSetMethod(configurator, methodName,
checkBox.getSelection());
}
-
});
-
}
private String getLabel(String methodName){
private boolean executeBooleanGetMethod(IIoConfigurator configurator,
String methodName) {
- Class<? extends IIoConfigurator> configuratorClass = configurator
- .getClass();
+ Class<? extends IIoConfigurator> configuratorClass = configurator.getClass();
boolean result = false;
import org.eclipse.swt.widgets.Text;
import org.eclipse.wb.swt.ResourceManager;
-import eu.etaxonomy.cdm.common.URI;
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.api.service.IReferenceService;
+import eu.etaxonomy.cdm.common.URI;
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
private Text textClassification;
private Button btnBrowseClassification;
private Button btnClear;
+ private Combo comboAddIndividualsAssociations;
private Text textSource;
private Button btnBrowseSource;
private Combo nomenclaturalCodeSelectionCombo;
private Combo checkBoxMapUnitId;
private Combo textDNAProviderString;
+ Button checkBoxReuseDescriptiveGroups;
protected AbcdImportConfiguratorWizardPage(String title, String description, Abcd206ImportConfigurator configurator) {
this(title, description, configurator, false, false);
textClassification.setEnabled(false);
textClassification.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, true));
if (abcdImportConfigurator.getClassificationUuid() != null){
- if (abcdImportConfigurator.getClassificationName() != null){
- textClassification.setText(abcdImportConfigurator.getClassificationName());
- }else{
- Classification classification = CdmStore.getService(IClassificationService.class).load(abcdImportConfigurator.getClassificationUuid());
+ Classification classification = CdmStore.getService(IClassificationService.class).load(abcdImportConfigurator.getClassificationUuid());
+ if (classification != null){
textClassification.setText(classification.getTitleCache());
}
}
labelLinkToTaxon.setText("Link to Taxon");
labelLinkToTaxon.setFont(font);
- Button checkBoxAddIndividualsAssociations = new Button(composite, SWT.CHECK);
+ comboAddIndividualsAssociations = new Combo(composite, SWT.NULL);
gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL_HORIZONTAL;
+ gridData.horizontalAlignment=SWT.BEGINNING;
gridData.horizontalSpan = 2;
- checkBoxAddIndividualsAssociations.setLayoutData(gridData);
+ comboAddIndividualsAssociations.setLayoutData(gridData);
GridDataFactory.fillDefaults();
- checkBoxAddIndividualsAssociations.setSelection(abcdImportConfigurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
- checkBoxAddIndividualsAssociations.setText("Create an Individual Association for each Specimen");
- checkBoxAddIndividualsAssociations
- .setToolTipText("For each specimen associated to a taxon an indiviadual association to this taxon is created");
- checkBoxAddIndividualsAssociations.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- abcdImportConfigurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(!abcdImportConfigurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
- }
- });
+
+ comboAddIndividualsAssociations.add("Add Taxon Facts");
+ comboAddIndividualsAssociations.add("Add Specimen Determination");
+ comboAddIndividualsAssociations.add("Add Both");
+
+
+ comboAddIndividualsAssociations.addSelectionListener(this);
+
+ if (abcdImportConfigurator.isAddIndividualsAssociations() ){
+ if (abcdImportConfigurator.isAddDeterminations()) {
+ comboAddIndividualsAssociations.select(2);
+ }else {
+ comboAddIndividualsAssociations.select(0);
+ }
+ }else {
+ comboAddIndividualsAssociations.select(1);
+ }
+
- Button checkBoxReuseDescriptiveGroups = new Button(composite, SWT.CHECK);
+ checkBoxReuseDescriptiveGroups = new Button(composite, SWT.CHECK);
gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL_HORIZONTAL;
gridData.horizontalSpan = 2;
checkBoxReuseDescriptiveGroups.setLayoutData(gridData);
GridDataFactory.fillDefaults();
checkBoxReuseDescriptiveGroups.setSelection(abcdImportConfigurator.isReuseExistingDescriptiveGroups());
- checkBoxReuseDescriptiveGroups.setText("Reuse existing descriptive group");
+ checkBoxReuseDescriptiveGroups.setText("Reuse existing descriptive group (only for taxon facts)");
checkBoxReuseDescriptiveGroups
.setToolTipText("Reuse one of the existing descriptive groups or create a new one for every import");
checkBoxReuseDescriptiveGroups.addSelectionListener(new SelectionAdapter() {
abcdImportConfigurator.setReuseExistingDescriptiveGroups(!abcdImportConfigurator.isReuseExistingDescriptiveGroups());
}
});
+
+ if (!abcdImportConfigurator.isAddIndividualsAssociations()) {
+ checkBoxReuseDescriptiveGroups.setEnabled(false);
+ }
Label labelSpecimen = new Label(composite, SWT.NONE);
if (e.getSource().equals(nomenclaturalCodeSelectionCombo)){
this.abcdImportConfigurator.setNomenclaturalCode(NomenclaturalCode.getByKey(nomenclaturalCodeSelectionCombo.getText()));
}
+ if (e.getSource().equals(comboAddIndividualsAssociations)){
+ int index = comboAddIndividualsAssociations.getSelectionIndex();
+ if (index == 0) {
+ this.abcdImportConfigurator.setAddIndividualsAssociations(true);
+ this.abcdImportConfigurator.setAddDeterminations(false);
+ this.checkBoxReuseDescriptiveGroups.setEnabled(true);
+ }
+ if (index == 1) {
+ this.abcdImportConfigurator.setAddIndividualsAssociations(false);
+ this.abcdImportConfigurator.setAddDeterminations(true);
+ this.checkBoxReuseDescriptiveGroups.setEnabled(false);
+ }
+ if (index == 2) {
+ this.abcdImportConfigurator.setAddIndividualsAssociations(true);
+ this.abcdImportConfigurator.setAddDeterminations(true);
+ this.checkBoxReuseDescriptiveGroups.setEnabled(true);
+ }
+
+ }
if (e.getSource().equals(checkBoxMapUnitId)){
String text = checkBoxMapUnitId.getText();
if (text.equals(ACCESSION_NUMBER)){
try{
abcdImportConfigurator.setDnaSoure(URI.create(textDNAProviderString.getText()));
}catch(IllegalArgumentException e){
-//TODO: check prior or message
abcdImportConfigurator.setDnaSoure(null);
}
-
PreferencesUtil.setStringValue(IPreferenceKeys.LAST_USED_ABCD_CONFIG, abcdImportConfigurator.toString());
}
import eu.etaxonomy.cdm.database.DbSchemaValidation;
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizard;
import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileDataSourceWithReferenceWizardPage;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @author pplitzner
* @since Oct 5, 2017
*/
-public class AbcdImportWizardE4 extends AbstractImportWizardE4<Abcd206ImportConfigurator> {
+public class AbcdImportWizardE4 extends AbstractImportWizard<Abcd206ImportConfigurator> {
private Abcd206ImportConfigurator configurator;
private ImportFromFileDataSourceWithReferenceWizardPage dataSourcePage;
*/
package eu.etaxonomy.taxeditor.io.e4.in.abcd;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizard;
import eu.etaxonomy.taxeditor.io.e4.in.AbstractOpenImportWizard;
/**
* {@inheritDoc}
*/
@Override
- protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
+ protected Class<? extends AbstractImportWizard> getImportWizardClass() {
return AbcdImportWizardE4.class;
}
import eu.etaxonomy.cdm.common.URI;
import eu.etaxonomy.cdm.database.DbSchemaValidation;
import eu.etaxonomy.cdm.io.distribution.excelupdate.ExcelDistributionUpdateConfigurator;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizard;
import eu.etaxonomy.taxeditor.io.e4.in.GenericConfiguratorWizardPageE4;
import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileAndChooseVocIdWizardPageE4;
import eu.etaxonomy.taxeditor.l10n.Messages;
* @author k.luther
* @date 03.05.2017
*/
-public class ExcelDistributionUpdateWizardE4 extends AbstractImportWizardE4<ExcelDistributionUpdateConfigurator> {
+public class ExcelDistributionUpdateWizardE4 extends AbstractImportWizard<ExcelDistributionUpdateConfigurator> {
private ExcelDistributionUpdateConfigurator configurator;
*/
package eu.etaxonomy.taxeditor.io.e4.in.excel.distribution;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizard;
import eu.etaxonomy.taxeditor.io.e4.in.AbstractOpenImportWizard;
/**
* {@inheritDoc}
*/
@Override
- protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
+ protected Class<? extends AbstractImportWizard> getImportWizardClass() {
return ExcelDistributionUpdateWizardE4.class;
}
+++ /dev/null
-/**
-* Copyright (C) 2017 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.io.e4.in.excel.specimen;
-
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractOpenImportWizard;
-
-/**
- * @author pplitzner
- * @since Oct 5, 2017
- *
- */
-public class OpenExcelSpecimenImportWizard extends AbstractOpenImportWizard {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
- return SpecimenCdmExcelImportWizardE4.class;
- }
-
-}
+++ /dev/null
-/**
- *
- */
-package eu.etaxonomy.taxeditor.io.e4.in.excel.specimen;
-
-import eu.etaxonomy.cdm.common.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.eclipse.e4.core.contexts.ContextInjectionFactory;
-import org.eclipse.e4.core.contexts.IEclipseContext;
-import org.eclipse.e4.ui.workbench.modeling.EPartService;
-
-import eu.etaxonomy.cdm.database.DbSchemaValidation;
-import eu.etaxonomy.cdm.io.specimen.excel.in.SpecimenCdmExcelImportConfigurator;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
-import eu.etaxonomy.taxeditor.io.e4.in.GenericConfiguratorWizardPageE4;
-import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileDataSourceWithReferenceWizardPage;
-import eu.etaxonomy.taxeditor.l10n.Messages;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- *
- * @author pplitzner
- * @since Oct 5, 2017
- *
- */
-public class SpecimenCdmExcelImportWizardE4 extends AbstractImportWizardE4<SpecimenCdmExcelImportConfigurator> {
-
-
- private SpecimenCdmExcelImportConfigurator configurator;
-
- private ImportFromFileDataSourceWithReferenceWizardPage dataSourcePage;
-
- @Inject
- public SpecimenCdmExcelImportWizardE4(IEclipseContext context, EPartService partService) {
- super(context, partService);
- }
-
- @Override
- public SpecimenCdmExcelImportConfigurator getConfigurator() {
- return configurator;
- }
-
- /** {@inheritDoc} */
- @Override
- public void init() {
- configurator = CdmStore.getImportManager().SpecimenCdmExcelImportConfigurator();
- }
-
- @Override
- public boolean performFinish() {
- URI source = dataSourcePage.getUri();
- configurator.setSource(source);
- configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
-
- CdmStore.getImportManager().run(configurator);
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override
- public void addPages() {
- dataSourcePage = ContextInjectionFactory.make(ImportFromFileDataSourceWithReferenceWizardPage.class, context);
- dataSourcePage.setTitle("Choose Specimen CDM Excel");
- dataSourcePage.setDescription("Please choose an xls file in the SpecimenCdmExcel format.");
- dataSourcePage.setExtensions(new String[]{"*.xlsx", "*.xls", "*.*"});
-
- addPage(dataSourcePage);
- super.addPages();
- }
-
- @Override
- protected void addConfiguratorPage(){
- List<String> ignoreMethods = new ArrayList<>();
- ignoreMethods.add("setIgnoreNull");
- ignoreMethods.add("setInteractWithUser");
- ignoreMethods.add("setUseClassification");
- ignoreMethods.add("setRegisterAuditing");
- ignoreMethods.add("setDeduplicateAuthors");
- ignoreMethods.add("setDeduplicateReferences");
- pageConfiguration = ContextInjectionFactory.make(GenericConfiguratorWizardPageE4.class, context);
- pageConfiguration.initImport(getConfigurator(), ignoreMethods, Messages.ExcelSpecimenUpdateWizard_ConfiguratorWizard_label);
- addPage(pageConfiguration);
- }
-
-}
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
import eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizard;
import eu.etaxonomy.taxeditor.io.e4.in.GenericConfiguratorWizardPageE4;
import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileDataSourceWithReferenceWizardPage;
import eu.etaxonomy.taxeditor.l10n.Messages;
* @author pplitzner
* @since Oct 5, 2017
*/
-public class ExcelNormalExplicitTaxaImportWizardE4 extends AbstractImportWizardE4<NormalExplicitImportConfigurator>{
+public class ExcelNormalExplicitTaxaImportWizardE4 extends AbstractImportWizard<NormalExplicitImportConfigurator>{
private NormalExplicitImportConfigurator configurator;
*/
package eu.etaxonomy.taxeditor.io.e4.in.excel.taxa;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizard;
import eu.etaxonomy.taxeditor.io.e4.in.AbstractOpenImportWizard;
/**
* {@inheritDoc}
*/
@Override
- protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
+ protected Class<? extends AbstractImportWizard> getImportWizardClass() {
return ExcelNormalExplicitTaxaImportWizardE4.class;
}
*/
package eu.etaxonomy.taxeditor.io.e4.in.owl;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizard;
import eu.etaxonomy.taxeditor.io.e4.in.AbstractOpenImportWizard;
/**
public class OpenOwlImportWizard extends AbstractOpenImportWizard {
@Override
- protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
+ protected Class<? extends AbstractImportWizard> getImportWizardClass() {
return OwlImportWizard.class;
}
import eu.etaxonomy.cdm.io.descriptive.owl.in.StructureTreeOwlImportConfigurator;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizard;
import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileDataSourceWizardPage;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @author pplitzner
* @since Apr 25, 2019
*/
-public class OwlImportWizard extends AbstractImportWizardE4<StructureTreeOwlImportConfigurator> {
+public class OwlImportWizard extends AbstractImportWizard<StructureTreeOwlImportConfigurator> {
private StructureTreeOwlImportConfigurator configurator;
private ImportFromFileDataSourceWizardPage dataSourcePage;
*/
package eu.etaxonomy.taxeditor.io.e4.in.ris;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizard;
import eu.etaxonomy.taxeditor.io.e4.in.AbstractOpenImportWizard;
/**
* {@inheritDoc}
*/
@Override
- protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
+ protected Class<? extends AbstractImportWizard> getImportWizardClass() {
return RISImportWizardE4.class;
}
import eu.etaxonomy.cdm.database.DbSchemaValidation;
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
import eu.etaxonomy.cdm.io.reference.ris.in.RisReferenceImportConfigurator;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizard;
import eu.etaxonomy.taxeditor.io.e4.in.GenericConfiguratorWizardPageE4;
import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileDataSourceWithReferenceWizardPage;
import eu.etaxonomy.taxeditor.io.e4.in.excel.distribution.ExcelDistributionUpdateWizardE4;
* @author k.luther
* @date 12.05.2017
*/
-public class RISImportWizardE4 extends AbstractImportWizardE4<RisReferenceImportConfigurator>{
+public class RISImportWizardE4 extends AbstractImportWizard<RisReferenceImportConfigurator>{
private RisReferenceImportConfigurator configurator;
*/
package eu.etaxonomy.taxeditor.io.e4.in.sdd;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizard;
import eu.etaxonomy.taxeditor.io.e4.in.AbstractOpenImportWizard;
/**
* {@inheritDoc}
*/
@Override
- protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
+ protected Class<? extends AbstractImportWizard> getImportWizardClass() {
return SddImportWizardE4.class;
}
import eu.etaxonomy.cdm.database.DbSchemaValidation;
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
import eu.etaxonomy.cdm.io.sdd.in.SDDImportConfigurator;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizard;
import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileDataSourceWithReferenceWizardPage;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @author pplitzner
* @since Oct 5, 2017
*/
-public class SddImportWizardE4 extends AbstractImportWizardE4<SDDImportConfigurator> {
+public class SddImportWizardE4 extends AbstractImportWizard<SDDImportConfigurator> {
private SDDImportConfigurator configurator;
*/
package eu.etaxonomy.taxeditor.io.e4.in.tcs;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizard;
import eu.etaxonomy.taxeditor.io.e4.in.AbstractOpenImportWizard;
/**
* {@inheritDoc}
*/
@Override
- protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
+ protected Class<? extends AbstractImportWizard> getImportWizardClass() {
return TcsImportWizardE4.class;
}
import eu.etaxonomy.cdm.database.DbSchemaValidation;
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
import eu.etaxonomy.cdm.io.tcsxml.in.TcsXmlImportConfigurator;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizard;
import eu.etaxonomy.taxeditor.io.e4.in.GenericConfiguratorWizardPageE4;
import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileDataSourceWithReferenceWizardPage;
import eu.etaxonomy.taxeditor.l10n.Messages;
* @author pplitzner
* @since Oct 5, 2017
*/
-public class TcsImportWizardE4 extends AbstractImportWizardE4<TcsXmlImportConfigurator> {
+public class TcsImportWizardE4 extends AbstractImportWizard<TcsXmlImportConfigurator> {
private TcsXmlImportConfigurator configurator;
* @author pplitzner
* @since Oct 6, 2017
*/
-public abstract class AbstractExportWizardE4<CONFIG extends IIoConfigurator> extends Wizard {
+public abstract class AbstractExportWizard<CONFIG extends IIoConfigurator> extends Wizard {
protected final String CONFIGURATION_PAGE = "CONFIGURATION_PAGE";
- private GenericConfiguratorWizardPageE4 pageConfiguration;
+ protected GenericConfiguratorWizardPageE4 pageConfiguration;
protected IStructuredSelection selection;
- private IEclipseContext context;
+ protected IEclipseContext context;
- public AbstractExportWizardE4(IEclipseContext context) {
+ public AbstractExportWizard(IEclipseContext context) {
this(context, null);
}
- public AbstractExportWizardE4(IEclipseContext context, IStructuredSelection selection) {
+ public AbstractExportWizard(IEclipseContext context, IStructuredSelection selection) {
this.context = context;
this.selection = selection;
}
@Execute
public void execute(IEclipseContext ctx, Shell s)
{
- AbstractExportWizardE4 wizard = ContextInjectionFactory.make(getExportWizardClass(), ctx);
+ AbstractExportWizard wizard = ContextInjectionFactory.make(getExportWizardClass(), ctx);
wizard.init();
WizardDialog dialog = new WizardDialog(s, wizard);
dialog.open();
}
- protected abstract Class<? extends AbstractExportWizardE4> getExportWizardClass();
+ protected abstract Class<? extends AbstractExportWizard> getExportWizardClass();
}
\ No newline at end of file
import java.io.File;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashSet;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Named;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.swt.widgets.Combo;
-import eu.etaxonomy.cdm.ext.geo.CondensedDistributionRecipe;
import eu.etaxonomy.cdm.filter.TaxonNodeFilter;
+import eu.etaxonomy.cdm.format.description.distribution.CondensedDistributionRecipe;
import eu.etaxonomy.cdm.io.cdmLight.CdmLightExportConfigurator;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
-import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.GenericConfiguratorWizardPageE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
import eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @date 21.03.2017
*/
public class CdmLightExportWizardE4 extends
-AbstractExportWizardE4<CdmLightExportConfigurator> {
+AbstractExportWizard<CdmLightExportConfigurator> {
private CdmLightExportConfigurator configurator;
}
}
configurator.getTaxonNodeFilter().setIncludeUnpublished(page.isExportUnpublishedData());
+ configurator.setDoFactualData(page.isExportFactualData());
+ configurator.setIncludeUnpublishedFacts(page.isExportUnpublishedFactualData());
CdmStore.getExportManager().runMoniteredOperation(configurator, urlString);
// create job
// Job job = CdmStore.getExportManager().createIOServiceJob(configurator, urlString);
@Override
public void addPages() {
//standard page
- page = ExportToFileDestinationWizardPage.OutputModel(configurator);
+ page = ExportToFileDestinationWizardPage.CdmLight(configurator);
addPage(page);
- super.addPages();
+ pageConfiguration = ContextInjectionFactory.make(GenericConfiguratorWizardPageE4.class, context);
+ List<String> ignoreMethods = new ArrayList<>();
+ ignoreMethods.add("setDoFactualData");
+ ignoreMethods.add("setIncludeUnpublishedFacts");
+ pageConfiguration.initExport(getConfigurator(), ignoreMethods);
+ this.addPage(pageConfiguration);
+
if (PreferencesUtil.showGfbioMetaData()){
metaDataPage = new MetaDataConfigurationWizardPage("Add Meta Data", configurator);
addPage(metaDataPage);
*/
package eu.etaxonomy.taxeditor.io.e4.out.cdmlight;
-import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
/**
* {@inheritDoc}
*/
@Override
- protected Class<? extends AbstractExportWizardE4> getExportWizardClass() {
+ protected Class<? extends AbstractExportWizard> getExportWizardClass() {
return CdmLightExportWizardE4.class;
}
--- /dev/null
+/**
+ * Copyright (C) 2023 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.io.e4.out.col;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashSet;
+import java.util.List;
+import java.util.UUID;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.swt.widgets.Combo;
+
+import eu.etaxonomy.cdm.filter.TaxonNodeFilter;
+import eu.etaxonomy.cdm.io.coldp.ColDpExportConfigurator;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
+import eu.etaxonomy.taxeditor.io.e4.in.GenericConfiguratorWizardPageE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
+import eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author katjaluther
+ * @date 01.09.2023
+ */
+public class ColExportWizardE4 extends
+AbstractExportWizard<ColDpExportConfigurator> {
+
+
+ private ColDpExportConfigurator configurator;
+ private ExportToFileDestinationWizardPage page;
+
+ public static final String DATE_FORMAT_NOW = "yyyyMMddHHmm";
+ TaxonNodeDto selectedNode;
+
+ @Inject
+ public ColExportWizardE4(IEclipseContext context,
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection) {
+ super(context, selection);
+ }
+
+ @Override
+ public void init() {
+ configurator = ColDpExportConfigurator.NewInstance();
+
+ if (selection instanceof TreeSelection && !selection.isEmpty() && selection.getFirstElement() instanceof TaxonNodeDto){
+ selectedNode = (TaxonNodeDto)selection.getFirstElement();
+
+ if (selectedNode.getParentUUID() == null){
+ configurator.setTaxonNodeFilter(TaxonNodeFilter.NewClassificationInstance(selectedNode.getClassificationUUID()));
+ }else{
+ configurator.setTaxonNodeFilter(TaxonNodeFilter.NewSubtreeInstance(selectedNode.getUuid()));
+ }
+ }
+ }
+
+
+ @Override
+ public ColDpExportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ @Override
+ public boolean performFinish() {
+ String urlString = page.getFolderText() + File.separator ;
+ if (configurator.isCreateZipFile()){
+ SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
+ Calendar cal = Calendar.getInstance();
+
+ if (!configurator.getTaxonNodeFilter().getSubtreeFilter().isEmpty()){
+ urlString += selectedNode.getNameCache().replace(" ", "_")+"_colDP_"+sdf.format(cal.getTime());
+ }else if (!configurator.getTaxonNodeFilter().getClassificationFilter().isEmpty()){
+ urlString += page.getSelectedClassification().getTitleCache().replace(" ", "_")+"_colDP_"+sdf.format(cal.getTime());
+ page.getSelectedClassification();
+ }
+
+ }
+
+ //+ page.getExportFileName();
+
+ final Combo combo = page.getCombo();
+
+
+ final List<Classification> listClassifications = CdmStore.getCurrentApplicationConfiguration().getClassificationService().listClassifications(null, null, null, null);
+ if(combo != null){
+ int selectionIndex = combo.getSelectionIndex();
+ HashSet<UUID> set = new HashSet<UUID>();
+ if(selectionIndex == -1){
+ for(Classification c:listClassifications){
+ set.add(c.getUuid());
+ }
+ }else{
+ for(Classification c:listClassifications){
+ if(c.getTitleCache().equalsIgnoreCase(combo.getItem(selectionIndex))){
+ set.add(c.getUuid());
+
+ if (!page.getCheckUseSelectedTaxonNode()){
+ configurator.setTaxonNodeFilter(TaxonNodeFilter.NewClassificationInstance(c.getUuid()));
+ }
+ }
+ }
+
+
+ }
+ }
+ configurator.getTaxonNodeFilter().setIncludeUnpublished(page.isExportUnpublishedData());
+ configurator.setDoFactualData(page.isExportFactualData());
+ configurator.setIncludeUnpublishedFacts(page.isExportUnpublishedFactualData());
+ CdmStore.getExportManager().runMoniteredOperation(configurator, urlString);
+ // create job
+// Job job = CdmStore.getExportManager().createIOServiceJob(configurator, urlString);
+// // configure the job
+// job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+// job.setUser(true);
+// // schedule job
+// job.schedule();
+ PreferencesUtil.setStringValue("exportFolder", page.getFolderText());
+ return true;
+ }
+
+ @Override
+ public void addPages() {
+ //standard page
+ page = ExportToFileDestinationWizardPage.ColDp(configurator);
+
+ addPage(page);
+ pageConfiguration = ContextInjectionFactory.make(GenericConfiguratorWizardPageE4.class, context);
+ List<String> ignoreMethods = new ArrayList<>();
+ ignoreMethods.add("setDoFactualData");
+ ignoreMethods.add("setIncludeUnpublishedFacts");
+ pageConfiguration.initExport(getConfigurator(), ignoreMethods);
+ this.addPage(pageConfiguration);
+
+
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2017 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.io.e4.out.col;
+
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class OpenColExportWizard extends AbstractOpenExportWizard {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<? extends AbstractExportWizard> getExportWizardClass() {
+ return ColExportWizardE4.class;
+ }
+
+}
import eu.etaxonomy.cdm.io.csv.redlist.demo.CsvDemoExportConfigurator;
import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
import eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @created Nov. 11, 2014
* @version 1.0
*/
-public class CsvExportWizardE4 extends AbstractExportWizardE4<CsvDemoExportConfigurator> {
+public class CsvExportWizardE4 extends AbstractExportWizard<CsvDemoExportConfigurator> {
private CsvDemoExportConfigurator configurator;
private ExportToFileDestinationWizardPage page;
*/
package eu.etaxonomy.taxeditor.io.e4.out.csv;
-import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
/**
* {@inheritDoc}
*/
@Override
- protected Class<? extends AbstractExportWizardE4> getExportWizardClass() {
+ protected Class<? extends AbstractExportWizard> getExportWizardClass() {
return CsvExportWizardE4.class;
}
import eu.etaxonomy.cdm.io.csv.caryophyllales.out.CsvNameExportConfigurator;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
-import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
import eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @created Apr. 12, 2015
* @version 1.0
*/
-public class CsvNameExportWizardE4 extends AbstractExportWizardE4<CsvNameExportConfigurator> {
+public class CsvNameExportWizardE4 extends AbstractExportWizard<CsvNameExportConfigurator> {
protected CsvNameExportConfigurator configurator;
*/
package eu.etaxonomy.taxeditor.io.e4.out.csv.name;
-import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
/**
* {@inheritDoc}
*/
@Override
- protected Class<? extends AbstractExportWizardE4> getExportWizardClass() {
+ protected Class<? extends AbstractExportWizard> getExportWizardClass() {
return CsvNameExportWizardE4.class;
}
*/
package eu.etaxonomy.taxeditor.io.e4.out.csv.print;
-import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
/**
* {@inheritDoc}
*/
@Override
- protected Class<? extends AbstractExportWizardE4> getExportWizardClass() {
+ protected Class<? extends AbstractExportWizard> getExportWizardClass() {
return CsvPrintExportWizardE4.class;
}
import eu.etaxonomy.cdm.filter.TaxonNodeFilter;
import eu.etaxonomy.cdm.io.dwca.out.DwcaTaxExportConfigurator;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
-import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
import eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage;
import eu.etaxonomy.taxeditor.store.CdmStore;
*
*/
public class DarwinCoreArchiveExportWizardE4 extends
- AbstractExportWizardE4<DwcaTaxExportConfigurator> {
+ AbstractExportWizard<DwcaTaxExportConfigurator> {
private DwcaTaxExportConfigurator configurator;
private ExportToFileDestinationWizardPage page;
*/
package eu.etaxonomy.taxeditor.io.e4.out.dwca;
-import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
/**
* {@inheritDoc}
*/
@Override
- protected Class<? extends AbstractExportWizardE4> getExportWizardClass() {
+ protected Class<? extends AbstractExportWizard> getExportWizardClass() {
return DarwinCoreArchiveExportWizardE4.class;
}
import org.eclipse.ui.progress.IProgressConstants;
import eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator;
-import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
import eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @since Oct 6, 2017
*
*/
-public class JaxbExportWizardE4 extends AbstractExportWizardE4<JaxbExportConfigurator> {
+public class JaxbExportWizardE4 extends AbstractExportWizard<JaxbExportConfigurator> {
private ExportToFileDestinationWizardPage page;
*/
package eu.etaxonomy.taxeditor.io.e4.out.jaxb;
-import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
/**
* {@inheritDoc}
*/
@Override
- protected Class<? extends AbstractExportWizardE4> getExportWizardClass() {
+ protected Class<? extends AbstractExportWizard> getExportWizardClass() {
return JaxbExportWizardE4.class;
}
*/
package eu.etaxonomy.taxeditor.io.e4.out.owl;
-import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
/**
public class OpenOwlTermExportWizard extends AbstractOpenExportWizard {
@Override
- protected Class<? extends AbstractExportWizardE4> getExportWizardClass() {
+ protected Class<? extends AbstractExportWizard> getExportWizardClass() {
return OwlTermExportWizard.class;
}
import org.eclipse.ui.progress.IProgressConstants;
import eu.etaxonomy.cdm.io.descriptive.owl.out.StructureTreeOwlExportConfigurator;
-import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
*
*/
public class OwlTermExportWizard extends
-AbstractExportWizardE4<StructureTreeOwlExportConfigurator> {
+AbstractExportWizard<StructureTreeOwlExportConfigurator> {
private StructureTreeOwlExportConfigurator configurator;
private OwlTermExportWizardPage exportPage;
private OwlTermExportComposite composite;
private DirectoryDialog folderDialog;
- private static final String EXPORT_FOLDER ="EXPORT_FOLDER";
+ private static final String EXPORT_FOLDER = "EXPORT_FOLDER";
+
protected OwlTermExportWizardPage(String pageName) {
super(pageName);
setTitle("OWL Term Export");
termTypes.add(TermType.Property);
termTypes.add(TermType.State);
termTypes.add(TermType.Character);
- List<TermVocabularyDto> areaVocabularies = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermTypes(termTypes);
+ List<TermVocabularyDto> areaVocabularies = CdmStore.getService(IVocabularyService.class)
+ .findVocabularyDtoByTermTypes(termTypes);
composite.getSelectVocabularyComposite().getViewer().setInput(areaVocabularies);
- composite.getSelectVocabularyComposite().getViewer().addCheckStateListener(e->updateButtons());
+ composite.getSelectVocabularyComposite().getViewer().addCheckStateListener(e -> updateButtons());
List<TermTree> trees = CdmStore.getService(ITermTreeService.class).list(TermTree.class, null, null, null, null);
composite.getSelectFeatureTreeComposite().getViewer().setInput(trees);
- composite.getSelectFeatureTreeComposite().getViewer().addCheckStateListener(e->updateButtons());
+ composite.getSelectFeatureTreeComposite().getViewer().addCheckStateListener(e -> updateButtons());
folderDialog = new DirectoryDialog(parent.getShell());
String exportFolder = PreferencesUtil.getStringValue(EXPORT_FOLDER, true);
updateButtons();
}
-
-// FileDialog dialog = new FileDialog(parent.getShell());
-// String[] filterNames = {
-// "Web Ontology Language (*.owl)",
-// "Extensible Markup Language (*.xml)",
-// "All files (*.*)"
-// };
-// String[] filterExtensions = { "*.owl", "*.xml", "*.*"};
-//
-// dialog.setOverwrite(true);
-// dialog.setFilterNames(filterNames);
-// dialog.setFilterExtensions(filterExtensions);
-// String fileString = dialog.open();
-// if(fileString!=null){
-// composite.getTxtExportDirectory().setText(fileString);
-//
-// }
+ // FileDialog dialog = new FileDialog(parent.getShell());
+ // String[] filterNames = {
+ // "Web Ontology Language (*.owl)",
+ // "Extensible Markup Language (*.xml)",
+ // "All files (*.*)"
+ // };
+ // String[] filterExtensions = { "*.owl", "*.xml", "*.*"};
+ //
+ // dialog.setOverwrite(true);
+ // dialog.setFilterNames(filterNames);
+ // dialog.setFilterExtensions(filterExtensions);
+ // String fileString = dialog.open();
+ // if(fileString!=null){
+ // composite.getTxtExportDirectory().setText(fileString);
+ //
+ // }
}
});
setControl(composite);
}
- private void updateButtons(){
+ private void updateButtons() {
this.getWizard().getContainer().updateButtons();
}
- String getExportDirectory(){
+ String getExportDirectory() {
return composite.getExportDirectory();
}
- List<UUID> getSelectedTrees(){
+ List<UUID> getSelectedTrees() {
List<UUID> selectedTrees = new ArrayList<>();
Object[] checkedElements = composite.getSelectFeatureTreeComposite().getViewer().getCheckedElements();
for (Object object : checkedElements) {
- if(object instanceof TermTree) {
+ if (object instanceof TermTree) {
selectedTrees.add(((TermTree) object).getUuid());
}
}
return selectedTrees;
}
- List<UUID> getSelectedVocabularies(){
+ List<UUID> getSelectedVocabularies() {
List<UUID> vocs = new ArrayList<>();
Object[] checkedElements = composite.getSelectVocabularyComposite().getViewer().getCheckedElements();
for (Object object : checkedElements) {
- if(object instanceof TermVocabularyDto){
+ if (object instanceof TermVocabularyDto) {
vocs.add(((TermVocabularyDto) object).getUuid());
}
}
@Override
public boolean isPageComplete() {
- return !getSelectedVocabularies().isEmpty()
- || !getSelectedTrees().isEmpty()
+ return !getSelectedVocabularies().isEmpty() || !getSelectedTrees().isEmpty()
|| CdmUtils.isNotBlank(getExportDirectory());
}
*/
package eu.etaxonomy.taxeditor.io.e4.out.sdd;
-import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
/**
* {@inheritDoc}
*/
@Override
- protected Class<? extends AbstractExportWizardE4> getExportWizardClass() {
+ protected Class<? extends AbstractExportWizard> getExportWizardClass() {
return SddExportWizardE4.class;
}
import org.eclipse.ui.progress.IProgressConstants;
import eu.etaxonomy.cdm.io.sdd.out.SDDExportConfigurator;
-import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
import eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @since Oct 6, 2017
*
*/
-public class SddExportWizardE4 extends AbstractExportWizardE4<SDDExportConfigurator> {
+public class SddExportWizardE4 extends AbstractExportWizard<SDDExportConfigurator> {
private ExportToFileDestinationWizardPage page;
--- /dev/null
+/**
+* Copyright (C) 2017 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.io.e4.out.wfo;
+
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
+
+/**
+ * @author k.luther
+ * @since Jan 2024
+ */
+public class OpenWfoBackboneExportWizard extends AbstractOpenExportWizard {
+
+ @Override
+ protected Class<? extends AbstractExportWizard> getExportWizardClass() {
+ return WfoBackboneExportWizard.class;
+ }
+
+ @Override
+ @Execute
+ public void execute(IEclipseContext ctx, Shell s){
+
+ AbstractExportWizard<?> wizard = ContextInjectionFactory.make(getExportWizardClass(), ctx);
+ wizard.init();
+ WizardDialog dialog = new WizardDialog(s, wizard);
+ dialog.open();
+ }
+}
\ No newline at end of file
--- /dev/null
+/**
+ * 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.io.e4.out.wfo;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeSelection;
+
+import eu.etaxonomy.cdm.filter.TaxonNodeFilter;
+import eu.etaxonomy.cdm.io.wfo.out.WfoBackboneExportConfigurator;
+import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
+import eu.etaxonomy.taxeditor.io.e4.in.GenericConfiguratorWizardPageE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizard;
+import eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @since Jan 23, 2024
+ */
+public class WfoBackboneExportWizard extends
+ AbstractExportWizard<WfoBackboneExportConfigurator> {
+
+ private WfoBackboneExportConfigurator configurator;
+ private ExportToFileDestinationWizardPage page;
+
+ @Inject
+ public WfoBackboneExportWizard(IEclipseContext context,
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection) {
+ super(context, selection);
+ }
+
+ @Override
+ public void init() {
+ configurator = WfoBackboneExportConfigurator.NewInstance();
+ if (selection instanceof TreeSelection && !selection.isEmpty()){
+ Iterator<?> it = selection.iterator();
+
+ while(it.hasNext()){
+ Object obj = it.next();
+ if (obj instanceof TaxonNodeDto){
+ TaxonNodeDto node = (TaxonNodeDto) obj;
+ if (node.getParentUUID() == null){
+ //configurator = null;
+ }else{
+ if (configurator.getTaxonNodeFilter() == null){
+ configurator.setTaxonNodeFilter(TaxonNodeFilter.NewSubtreeInstance(node.getUuid()));
+ }else{
+ configurator.getTaxonNodeFilter().orSubtree(node.getUuid());
+ }
+
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public WfoBackboneExportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ @Override
+ public boolean performFinish() {
+ String urlString = page.getFolderText();// + File.separator
+ //+ page.getExportFileName();
+
+
+ if (StringUtils.isNotBlank(page.getFamilyString())) {
+ configurator.setFamilyStr(page.getFamilyString());
+ }
+ if (StringUtils.isNotBlank(page.get_baseUrl())) {
+ configurator.setSourceLinkBaseUrl(page.get_baseUrl());
+ }
+ CdmStore.getExportManager().runMoniteredOperation(configurator, urlString);
+
+ return true;
+ }
+
+ @Override
+ public void addPages() {
+ if (configurator == null) {
+ //don't call the export on classifications
+ this.setWindowTitle("Please select a subtree for WFO Backbone export, not a classification");
+ }
+ page = ExportToFileDestinationWizardPage.WFO(configurator);
+ addPage(page);
+ pageConfiguration = ContextInjectionFactory.make(GenericConfiguratorWizardPageE4.class, context);
+ List<String> ignoreMethods = new ArrayList<>();
+ ignoreMethods.add("setDoFactualData");
+ pageConfiguration.initExport(getConfigurator(), ignoreMethods);
+ this.addPage(pageConfiguration);
+ }
+ @Override
+ public boolean canFinish() {
+ boolean canFinish = super.canFinish();
+ if (configurator.getTaxonNodeFilter().getSubtreeFilter().isEmpty()) {
+ return false;
+ }
+ return canFinish;
+ }
+}
\ No newline at end of file
+++ /dev/null
-/**
-* 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.io.wizard;
-
-import java.io.File;
-
-import javax.inject.Inject;
-
-import org.eclipse.e4.core.contexts.IEclipseContext;
-import org.eclipse.e4.ui.workbench.modeling.EPartService;
-
-import eu.etaxonomy.cdm.common.URI;
-import eu.etaxonomy.cdm.io.reference.endnote.in.EndnoteImportConfigurator;
-import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
-import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileDataSourceWizardPage;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * <p>EndnoteImportWizard class.</p>
- *
- * @author n.hoffmann
- * @created Sep 18, 2009
- */
-public class EndnoteImportWizard extends AbstractImportWizardE4<EndnoteImportConfigurator> {
-
- private EndnoteImportConfigurator configurator;
-
- private ImportFromFileDataSourceWizardPage dataSourcePage;
-
- @Inject
- public EndnoteImportWizard(IEclipseContext context, EPartService partService) {
- super(context, partService);
- }
-
- @Override
- public boolean performFinish() {
-
- File file = dataSourcePage.getFile();
- configurator.setSource(URI.fromFile(file));
-
- CdmStore.getImportManager().run(configurator);
-
- return true;
- }
-
- @Override
- public void addPages() {
- super.addPages();
-
- dataSourcePage = new ImportFromFileDataSourceWizardPage();
- addPage(dataSourcePage);
- }
-
- @Override
- public void init() {
- configurator = CdmStore.getImportManager().EndnoteConfigurator();
- }
-
- @Override
- public EndnoteImportConfigurator getConfigurator() {
- return configurator;
- }
-
-
-
-}
\ No newline at end of file
* The content 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.io.wizard;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.filter.LogicFilter;
import eu.etaxonomy.cdm.io.cdmLight.CdmLightExportConfigurator;
+import eu.etaxonomy.cdm.io.coldp.ColDpExportConfigurator;
import eu.etaxonomy.cdm.io.common.ExportConfiguratorBase;
import eu.etaxonomy.cdm.io.csv.caryophyllales.out.CsvNameExportConfigurator;
import eu.etaxonomy.cdm.io.csv.redlist.demo.CsvDemoExportConfigurator;
import eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator;
import eu.etaxonomy.cdm.io.sdd.out.SDDExportConfigurator;
import eu.etaxonomy.cdm.io.tcsxml.out.TcsXmlExportConfigurator;
+import eu.etaxonomy.cdm.io.wfo.out.WfoBackboneExportConfigurator;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.model.name.Rank;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDtoByNameComparator;
*/
public class ExportToFileDestinationWizardPage extends WizardPage implements SelectionListener {
- /** Constant <code>DATE_FORMAT_NOW="yyyyMMddHHmm"</code> */
- public static final String DATE_FORMAT_NOW = "yyyyMMddHHmm";
+ /** Constant <code>DATE_FORMAT_NOW="yyyyMMddHHmm"</code> */
+ public static final String DATE_FORMAT_NOW = "yyyyMMddHHmm";
- /** Constant <code>JAXB_EXPORT="JAXB_EXPORT"</code> */
- public static final String JAXB_EXPORT = "JAXB_EXPORT";
+ /** Constant <code>JAXB_EXPORT="JAXB_EXPORT"</code> */
+ public static final String JAXB_EXPORT = "JAXB_EXPORT";
- /** Constant <code>TCS_EXPORT="TCS_EXPORT"</code> */
- public static final String TCS_EXPORT = "TCS_EXPORT";
+ /** Constant <code>TCS_EXPORT="TCS_EXPORT"</code> */
+ public static final String TCS_EXPORT = "TCS_EXPORT";
- /** Constant <code>SDD_EXPORT="SDD_EXPORT"</code> */
- public static final String SDD_EXPORT = "SDD_EXPORT";
+ /** Constant <code>SDD_EXPORT="SDD_EXPORT"</code> */
+ public static final String SDD_EXPORT = "SDD_EXPORT";
- public static final String DWCA_EXPORT = "DWCA_EXPORT";
- public static final String OUTPUT_MODEL_EXPORT = "CDM_LIGHT(CSV)";
- public static final String CSV_EXPORT = "CSV_EXPORT";
- public static final String CSV_NAME_EXPORT = "CSV_NAME_EXPORT";
- private static final String CSV_PRINT_EXPORT ="CSV_PRINT_EXPORT";
- private static final String EXPORT_FOLDER ="EXPORT_FOLDER";
- public static final String XML = "xml";
+ public static final String DWCA_EXPORT = "DWCA_EXPORT";
+ public static final String WFO_BACKBONE_EXPORT = "WFO_BACKBONE_EXPORT";
+ public static final String CDM_LIGHT_EXPORT = "CDM_LIGHT(CSV)";
+ public static final String COL_DP_EXPORT = "COL DP";
+ public static final String CSV_EXPORT = "CSV_EXPORT";
+ public static final String CSV_NAME_EXPORT = "CSV_NAME_EXPORT";
+ private static final String CSV_PRINT_EXPORT = "CSV_PRINT_EXPORT";
+ private static final String EXPORT_FOLDER = "EXPORT_FOLDER";
+ public static final String XML = "xml";
- public static final String CSV = "csv";
+ public static final String CSV = "csv";
- public static final String ZIP = "zip";
+ public static final String ZIP = "zip";
private boolean csvExport = false;
private boolean csvNameExport = false;
- private boolean csvPrintExport = false;
+ private boolean csvPrintExport = false;
+
+ private boolean cdmLightExport = false;
- private boolean outputModelExport = false;
- private boolean dwcaExport = false;
+ private boolean colDPExport = false;
+ private boolean dwcaExport = false;
+ private boolean wfoBackboneExport = false;
- private DirectoryDialog folderDialog;
- private Text text_exportFileName;
+ private DirectoryDialog folderDialog;
+ private Text text_exportFileName;
- private Text text_folder;
+ private Text text_folder;
- private final String type;
+ private final String type;
- private final String extension;
+ private final String extension;
private Combo classificationSelectionCombo;
private Classification selectedClassification;
- private Label classificationLabel;
-
- private ExportConfiguratorBase configurator;
- private Button checkUseSelectedtaxonNode;
+ private ExportConfiguratorBase<?, ?, ?> configurator;
+ private Button checkUseSelectedTaxonNode;
private Button checkUseSelectedClassification;
private Button checkUseAllClassification;
private Button checkExportUnpublished;
- Combo orderSelectionCombo;
-
-
- protected ExportToFileDestinationWizardPage(String pageName, String type,
- String title, String description, String extension, ExportConfiguratorBase configurator) {
- super(pageName);
- this.configurator = configurator;
- this.type = type;
- switch(type) {
- case CSV_EXPORT :
- csvExport = true;
- break;
- case CSV_NAME_EXPORT:
- csvNameExport = true;
- break;
- case OUTPUT_MODEL_EXPORT:
- outputModelExport = true;
- break;
- case CSV_PRINT_EXPORT:
- csvPrintExport = true;
- break;
- case DWCA_EXPORT:
- dwcaExport = true;
- break;
- }
- this.extension = extension;
- this.setTitle(title);
- this.setDescription(description);
- }
-
- public static ExportToFileDestinationWizardPage Jaxb(JaxbExportConfigurator configurator) {
- return new ExportToFileDestinationWizardPage(
- JAXB_EXPORT,
- "jaxb",
- "JAXB Export",
- "Exports the content of the currently selected database into the cdm jaxb format.",
- XML, configurator);
- }
-
- public static ExportToFileDestinationWizardPage Tcs(TcsXmlExportConfigurator config) {
- return new ExportToFileDestinationWizardPage(
- TCS_EXPORT,
- "tcs",
- "Tcs Export",
- "Export the content of the currently selected database into TCS format.",
- XML, config);
- }
-
- public static ExportToFileDestinationWizardPage Sdd(SDDExportConfigurator config) {
- return new ExportToFileDestinationWizardPage(
- SDD_EXPORT,
- "sdd",
- "Sdd Export",
- "Export the content of the currently selected database into SDD format.",
- XML, config);
- }
-
- public static ExportToFileDestinationWizardPage Dwca(DwcaTaxExportConfigurator config) {
- return new ExportToFileDestinationWizardPage(
- DWCA_EXPORT,
- DWCA_EXPORT,
- "DwC-Archive Export",
- "Export the content of the currently selected database into Darwin Core Archive format.",
- ZIP, config);
- }
-
- public static ExportToFileDestinationWizardPage OutputModel(CdmLightExportConfigurator config) {
-
- return new ExportToFileDestinationWizardPage(
- OUTPUT_MODEL_EXPORT,
- OUTPUT_MODEL_EXPORT,
- "CDM Light Export (csv)",
- "Export the content of the currently selected database into the CDM light (csv) format.",
- CSV,config);
+ private Button checkExportFactualData;
+ private Button checkExportUnpublishedFactualData;
+
+ private Combo orderSelectionCombo;
+
+ private Text text_familyString;
+
+ private Text text_baseUrl;
+
+ protected ExportToFileDestinationWizardPage(String pageName, String type, String title, String description,
+ String extension, ExportConfiguratorBase<?, ?, ?> configurator) {
+ super(pageName);
+ this.configurator = configurator;
+ this.type = type;
+ switch (type) {
+ case CSV_EXPORT:
+ csvExport = true;
+ break;
+ case CSV_NAME_EXPORT:
+ csvNameExport = true;
+ break;
+ case CDM_LIGHT_EXPORT:
+ cdmLightExport = true;
+ break;
+ case COL_DP_EXPORT:
+ colDPExport = true;
+ break;
+ case CSV_PRINT_EXPORT:
+ csvPrintExport = true;
+ break;
+ case DWCA_EXPORT:
+ dwcaExport = true;
+ break;
+ case WFO_BACKBONE_EXPORT:
+ wfoBackboneExport = true;
+ break;
+ default:
+ throw new RuntimeException("Export type not yet handeled: " + type);
+ }
+ this.extension = extension;
+ this.setTitle(title);
+ this.setDescription(description);
}
- public static ExportToFileDestinationWizardPage Csv(CsvDemoExportConfigurator config) {
+ public static ExportToFileDestinationWizardPage Jaxb(JaxbExportConfigurator configurator) {
+ return new ExportToFileDestinationWizardPage(JAXB_EXPORT, "jaxb", "JAXB Export",
+ "Exports the content of the currently selected database into the cdm jaxb format.", XML, configurator);
+ }
+
+ public static ExportToFileDestinationWizardPage Tcs(TcsXmlExportConfigurator config) {
+ return new ExportToFileDestinationWizardPage(TCS_EXPORT, "tcs", "Tcs Export",
+ "Export the content of the currently selected database into TCS format.", XML, config);
+ }
- return new ExportToFileDestinationWizardPage(
- CSV_EXPORT,
- CSV_EXPORT,
- "CSV Export",
- "Export the content of the currently selected database into Comma Separated Value format.",
+ public static ExportToFileDestinationWizardPage Sdd(SDDExportConfigurator config) {
+ return new ExportToFileDestinationWizardPage(SDD_EXPORT, "sdd", "Sdd Export",
+ "Export the content of the currently selected database into SDD format.", XML, config);
+ }
+
+ public static ExportToFileDestinationWizardPage Dwca(DwcaTaxExportConfigurator config) {
+ return new ExportToFileDestinationWizardPage(DWCA_EXPORT, DWCA_EXPORT, "DwC-Archive Export",
+ "Export the content of the currently selected database into Darwin Core Archive format.", ZIP, config);
+ }
+
+ public static ExportToFileDestinationWizardPage WFO(WfoBackboneExportConfigurator config) {
+ return new ExportToFileDestinationWizardPage(WFO_BACKBONE_EXPORT, WFO_BACKBONE_EXPORT, "WFO Backbone Export",
+ "Export the content of the currently selected database into WFO Backbone format."
+ , CSV, config);
+ }
+
+ public static ExportToFileDestinationWizardPage CdmLight(CdmLightExportConfigurator config) {
+ return new ExportToFileDestinationWizardPage(CDM_LIGHT_EXPORT, CDM_LIGHT_EXPORT, "CDM Light Export (csv)",
+ "Export the content of the currently selected database into the CDM light (csv) format.",
CSV, config);
}
- public static ExportToFileDestinationWizardPage CsvNames(CsvNameExportConfigurator config) {
+ public static ExportToFileDestinationWizardPage ColDp(ColDpExportConfigurator config) {
+ return new ExportToFileDestinationWizardPage(COL_DP_EXPORT, COL_DP_EXPORT, "Col DP Export (zip)",
+ "Export the content of the currently selected database into the Catalogue of Life Data Package (Col DP) format.",
+ ZIP, config);
+ }
- return new ExportToFileDestinationWizardPage(
- CSV_NAME_EXPORT,
- CSV_NAME_EXPORT,
- "CSV Name Export",
- "Export the names of the currently selected database into Semicolon Separated Value format.",
+ public static ExportToFileDestinationWizardPage Csv(CsvDemoExportConfigurator config) {
+ return new ExportToFileDestinationWizardPage(CSV_EXPORT, CSV_EXPORT, "CSV Export",
+ "Export the content of the currently selected database into Comma Separated Value format.",
CSV, config);
}
- public static ExportToFileDestinationWizardPage CsvPrint(CsvNameExportConfigurator config) {
+ public static ExportToFileDestinationWizardPage CsvNames(CsvNameExportConfigurator config) {
+ return new ExportToFileDestinationWizardPage(CSV_NAME_EXPORT, CSV_NAME_EXPORT, "CSV Name Export",
+ "Export the names of the currently selected database into Semicolon Separated Value format.",
+ CSV, config);
+ }
- return new ExportToFileDestinationWizardPage(
- CSV_PRINT_EXPORT,
- CSV_NAME_EXPORT,
- "CSV Print Export",
- "Export the content of the currently selected database into Semicolon Separated Value format.",
+ public static ExportToFileDestinationWizardPage CsvPrint(CsvNameExportConfigurator config) {
+ return new ExportToFileDestinationWizardPage(CSV_PRINT_EXPORT, CSV_NAME_EXPORT, "CSV Print Export",
+ "Export the content of the currently selected database into Semicolon Separated Value format.",
CSV, config);
}
- /** {@inheritDoc} */
- @Override
+ @Override
public void createControl(Composite parent) {
- setPageComplete(false);
+ setPageComplete(false);
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout gridLayout = new GridLayout();
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- TaxonNode node = null;
+ gridLayout.numColumns = 2;
+ TaxonNode node = null;
- composite.setLayout(gridLayout);
- if (outputModelExport || dwcaExport){
- checkExportUnpublished = new Button(composite, SWT.CHECK);
+ composite.setLayout(gridLayout);
+ if (cdmLightExport || dwcaExport || colDPExport) {
+ checkExportUnpublished = new Button(composite, SWT.CHECK);
checkExportUnpublished.setText("Export unpublished taxa");
+ Label emptyLabel = new Label(composite, SWT.NONE);
+ checkExportFactualData = new Button(composite, SWT.CHECK);
+ checkExportFactualData.setText("Export factual data");
+ checkExportFactualData.setSelection(true);
+ checkExportFactualData.addListener(SWT.Selection, e -> {
+ Button b = (Button) e.widget;
+ GridData data = (GridData) checkExportUnpublishedFactualData.getLayoutData();
+ data.exclude = b.getSelection();
+ checkExportUnpublishedFactualData.setEnabled(data.exclude);
+ });
+ if (cdmLightExport || colDPExport) {
+ emptyLabel = new Label(composite, SWT.NONE);
+
+ checkExportUnpublishedFactualData = new Button(composite, SWT.CHECK);
+ checkExportUnpublishedFactualData.setText("Export unpublished factual data");
+ checkExportUnpublishedFactualData.setSelection(false);
+ GridData gridData = new GridData();
+ gridData.horizontalIndent = 20;
+ checkExportUnpublishedFactualData.setLayoutData(gridData);
+ }
+
@SuppressWarnings("unused")
Label nope = new Label(composite, SWT.NONE);
Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalSpan = 2;
- separator.setLayoutData(gridData);
+ GridData gridDataSep = new GridData(GridData.FILL_HORIZONTAL);
+ gridDataSep.horizontalSpan = 2;
+ separator.setLayoutData(gridDataSep);
}
- if(classifications == null){
- classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, null);
- Collections.sort(classifications, new Comparator<Classification>() {
-
- @Override
- public int compare(Classification o1, Classification o2) {
- if (o1.equals(o2)){
- return 0;
- }
- int result = o1.getTitleCache().compareTo(o2.getTitleCache());
- if (result == 0){
- return o1.getUuid().compareTo(o2.getUuid());
- }
- return result;
+ if (classifications == null && !wfoBackboneExport) {
+ classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, null);
+ Collections.sort(classifications, (o1, o2) -> {
+ if (o1.equals(o2)) {
+ return 0;
}
+ int result = o1.getTitleCache().compareTo(o2.getTitleCache());
+ if (result == 0) {
+ return o1.getUuid().compareTo(o2.getUuid());
+ }
+ return result;
});
- if (!configurator.getTaxonNodeFilter().getClassificationFilter().isEmpty()){
- selectedClassification = CdmStore.getService(IClassificationService.class).load(configurator.getTaxonNodeFilter().getClassificationFilter().get(0).getUuid());
- }else{
-
- selectedClassification = classifications.iterator().next();
- }
- }
+ if (!configurator.getTaxonNodeFilter().getClassificationFilter().isEmpty()) {
+ selectedClassification = CdmStore.getService(IClassificationService.class)
+ .load(configurator.getTaxonNodeFilter().getClassificationFilter().get(0).getUuid());
+ } else {
+ selectedClassification = classifications.iterator().next();
+ }
+ }
- if(csvExport || csvPrintExport || outputModelExport|| csvNameExport || dwcaExport){
+ if (csvExport || csvPrintExport || cdmLightExport || csvNameExport || dwcaExport || colDPExport || wfoBackboneExport) {
-// Label comboBoxLabel = new Label(composite, SWT.NONE);
-// comboBoxLabel.setText("Classification");
- Composite selectNodeOrClassification = new Composite(composite, SWT.NONE);
- GridLayout grid = new GridLayout();
+ // Label comboBoxLabel = new Label(composite, SWT.NONE);
+ // comboBoxLabel.setText("Classification");
+ Composite selectNodeOrClassification = new Composite(composite, SWT.NONE);
+ GridLayout grid = new GridLayout();
grid.numColumns = 1;
+ GridData gridDataNode = new GridData(SWT.FILL, SWT.FILL, true, false);
+ gridDataNode.horizontalSpan = 2;
+
selectNodeOrClassification.setLayout(grid);
- if ((outputModelExport || dwcaExport)&& !configurator.getTaxonNodeFilter().getSubtreeFilter().isEmpty()){
- checkUseSelectedtaxonNode= new Button(selectNodeOrClassification, SWT.RADIO);
- String taxonStr = "";
- int count = configurator.getTaxonNodeFilter().getSubtreeFilter().size();
- for (LogicFilter<TaxonNode> filter: configurator.getTaxonNodeFilter().getSubtreeFilter()){
- node = CdmApplicationState.getCurrentAppConfig().getTaxonNodeService().load(filter.getUuid());
- count--;
- if (node.hasTaxon()){
- taxonStr += node.getTaxon().getName().getTitleCache();
- if (count>0){
- taxonStr += ", ";
- }
- }
- }
-
- checkUseSelectedtaxonNode.setText("Export selected subtree(s) ("+ taxonStr+")");
- checkUseSelectedtaxonNode.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event e) {
- Button b = (Button) e.widget;
- GridData data = (GridData) classificationSelectionCombo.getLayoutData();
- data.exclude = b.getSelection();
- classificationSelectionCombo.setEnabled(!data.exclude);
-
- }
- });
- checkUseSelectedtaxonNode.setSelection(true);
- }
- if(outputModelExport || dwcaExport){
- if (dwcaExport){
- checkUseAllClassification= new Button(selectNodeOrClassification, SWT.RADIO);
- checkUseAllClassification.setText("Export all classifications");
- checkUseAllClassification.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event e) {
- Button b = (Button) e.widget;
- GridData data = (GridData) classificationSelectionCombo.getLayoutData();
- data.exclude = b.getSelection();
- classificationSelectionCombo.setEnabled(!data.exclude);
-
- }
- });
- }
- checkUseSelectedClassification= new Button(selectNodeOrClassification, SWT.RADIO);
- checkUseSelectedClassification.setText("Export selected classification");
- checkUseSelectedClassification.addListener(SWT.Selection, new Listener() {
- @Override
- public void handleEvent(Event e) {
- Button b = (Button) e.widget;
- GridData data = (GridData) classificationSelectionCombo.getLayoutData();
- data.exclude = b.getSelection();
- classificationSelectionCombo.setEnabled(data.exclude);
-
- }
- });
- }
-
- if (node!= null){
- selectedClassification = node.getClassification();
- }
- createClassificationSelectionCombo(selectNodeOrClassification);
- if (outputModelExport){
- Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
- GridData gridDataSep = new GridData();
- gridDataSep = new GridData(GridData.BEGINNING, GridData.CENTER, true, true);
- gridDataSep.horizontalSpan = 2;
+ selectNodeOrClassification.setLayoutData(gridDataNode);
+ if ((cdmLightExport || dwcaExport || colDPExport || wfoBackboneExport) && !configurator.getTaxonNodeFilter().getSubtreeFilter().isEmpty()) {
+ if (!wfoBackboneExport) {
+ checkUseSelectedTaxonNode = new Button(selectNodeOrClassification, SWT.RADIO);
+ }
+ String taxonStr = "";
+ int count = configurator.getTaxonNodeFilter().getSubtreeFilter().size();
+ List<TaxonNode> selectedNodes = new ArrayList<>();
+ for (LogicFilter<TaxonNode> filter : configurator.getTaxonNodeFilter().getSubtreeFilter()) {
+ node = CdmApplicationState.getCurrentAppConfig().getTaxonNodeService().load(filter.getUuid());
+ selectedNodes.add(node);
+ count--;
+ if (node.hasTaxon()) {
+ taxonStr += node.getTaxon().getName().getTitleCache();
+ if (count > 0) {
+ taxonStr += ", ";
+ }
+ }
+ }
+ if (!wfoBackboneExport) {
+ checkUseSelectedTaxonNode.setText("Export all selected subtree(s) (" + taxonStr + ")");
+ checkUseSelectedTaxonNode.addListener(SWT.Selection, e -> {
+ Button b = (Button) e.widget;
+ GridData data = (GridData) classificationSelectionCombo.getLayoutData();
+ data.exclude = b.getSelection();
+ if (classificationSelectionCombo != null) {
+ classificationSelectionCombo.setEnabled(!data.exclude);
+ }
+ });
+ checkUseSelectedTaxonNode.setSelection(true);
+ }else {
+ Composite wfoComp = new Composite(selectNodeOrClassification, SWT.NONE);
+ grid = new GridLayout();
+ grid.numColumns = 2;
+ GridData gridDataWfo = new GridData(SWT.FILL, SWT.FILL, true, false);
+ gridDataWfo.grabExcessHorizontalSpace=true;
+ // gridDataWfo.horizontalSpan=2;
+ wfoComp.setLayout(grid);
+ wfoComp.setLayoutData(gridDataWfo);
+
+ Label label = new Label(wfoComp, SWT.NONE);
+ label.setText("Export all selected subtree(s) (" + taxonStr + ")");
+ GridData gridData = new GridData();
+ gridData.horizontalSpan = 3;
+ gridData.grabExcessHorizontalSpace = true;
+ label.setLayoutData(gridData);
+
+ Label familyString = new Label(wfoComp, SWT.NONE);
+ familyString.setText("Family");
+ text_familyString = new Text(wfoComp, SWT.BORDER);
+ text_familyString.setText(generateFamilyName(selectedNodes));
+ GridData gridFamily = new GridData(SWT.FILL, SWT.FILL, true, false);
+
+ text_familyString.setLayoutData(gridFamily);
+
+
+ Label baseUrlString = new Label(wfoComp, SWT.NONE);
+ baseUrlString.setText("Base url");
+ text_baseUrl = new Text(wfoComp, SWT.BORDER);
+
+ GridData gridDataBaseUrl = new GridData(SWT.FILL, SWT.FILL, true, false);
+
+ text_baseUrl.setLayoutData(gridDataBaseUrl);
+ text_baseUrl.setToolTipText("The base url without /cdm_dataportal/taxon/{uuid} e.g. https://portal.cybertaxonomy.org/salvador");
+
+
+
+ }
+ }else if (wfoBackboneExport) {
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setText("WFO Backbone export is only available for subtrees, not for classifications");
+ GridData gridData = new GridData();
+ gridData.horizontalSpan = 2;
+ gridData.grabExcessHorizontalSpace = true;
+ label.setLayoutData(gridData);
+ label.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
+ }
+
+ if (cdmLightExport || dwcaExport || colDPExport ) {
+ if (dwcaExport) {
+ checkUseAllClassification = new Button(selectNodeOrClassification, SWT.RADIO);
+ checkUseAllClassification.setText("Export all classifications");
+ checkUseAllClassification.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ Button b = (Button) e.widget;
+ GridData data = (GridData) classificationSelectionCombo.getLayoutData();
+ data.exclude = b.getSelection();
+ classificationSelectionCombo.setEnabled(!data.exclude);
+
+ }
+ });
+ }
+ checkUseSelectedClassification = new Button(selectNodeOrClassification, SWT.RADIO);
+ checkUseSelectedClassification.setText("Export selected classification");
+ checkUseSelectedClassification.addListener(SWT.Selection, e -> {
+ Button b = (Button) e.widget;
+ GridData data = (GridData) classificationSelectionCombo.getLayoutData();
+ data.exclude = b.getSelection();
+ classificationSelectionCombo.setEnabled(data.exclude);
+ });
+ }
+
+ if (node != null && !wfoBackboneExport) {
+ selectedClassification = node.getClassification();
+ }
+ if (!wfoBackboneExport) {
+ createClassificationSelectionCombo(selectNodeOrClassification);
+ }
+ if (cdmLightExport) {
+ Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ GridData gridDataSep = new GridData();
+ gridDataSep = new GridData(GridData.BEGINNING, GridData.CENTER, true, true);
+ gridDataSep.horizontalSpan = 2;
separator.setLayoutData(gridDataSep);
Composite comp = new Composite(composite, SWT.NONE);
GridData gridData = new GridData();
- gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
- gridData.horizontalSpan = 2;
- comp.setLayoutData(gridData);
+ gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
+ gridData.horizontalSpan = 2;
+ comp.setLayoutData(gridData);
- Label label = new Label(comp, SWT.NONE);
+ Label label = new Label(comp, SWT.NONE);
label.setText("Sorting of taxa");
- orderSelectionCombo = new Combo(comp, SWT.BORDER| SWT.READ_ONLY);
+ orderSelectionCombo = new Combo(comp, SWT.BORDER | SWT.READ_ONLY);
- GridLayoutFactory.fillDefaults().applyTo(comp);
- for(NavigatorOrderEnum display: NavigatorOrderEnum.values()){
- orderSelectionCombo.add(display.getLabel());
- }
-
- int index = 0;
- if (PreferencesUtil.getStringValue(PreferencePredicate.TaxonNodeOrder.getKey()) != null){
- NavigatorOrderEnum orderInNavigator = NavigatorOrderEnum.valueOf(PreferencesUtil.getStringValue(PreferencePredicate.TaxonNodeOrder.getKey()));
+ GridLayoutFactory.fillDefaults().applyTo(comp);
+ for (NavigatorOrderEnum display : NavigatorOrderEnum.values()) {
+ orderSelectionCombo.add(display.getLabel());
+ }
- for (String itemLabel : orderSelectionCombo.getItems()){
- if (itemLabel.equalsIgnoreCase(orderInNavigator.getLabel())){
- orderSelectionCombo.select(index);
- setComparatorToConfig();
- break;
- }
- index++;
- }
- }
+ int index = 0;
+ if (PreferencesUtil.getStringValue(PreferencePredicate.TaxonNodeOrder.getKey()) != null) {
+ NavigatorOrderEnum orderInNavigator = NavigatorOrderEnum
+ .valueOf(PreferencesUtil.getStringValue(PreferencePredicate.TaxonNodeOrder.getKey()));
+
+ for (String itemLabel : orderSelectionCombo.getItems()) {
+ if (itemLabel.equalsIgnoreCase(orderInNavigator.getLabel())) {
+ orderSelectionCombo.select(index);
+ setComparatorToConfig();
+ break;
+ }
+ index++;
+ }
+ }
- orderSelectionCombo.addSelectionListener(new SelectionListener() {
+ orderSelectionCombo.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
// TODO Auto-generated method stub
}
});
- }
-
- if (checkUseSelectedtaxonNode != null){
- if (checkUseSelectedtaxonNode.getSelection()){
- classificationSelectionCombo.setEnabled(false);
- }
- }else{
- classificationSelectionCombo.setEnabled(true);
- classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
- true, false, 2, 1));
- }
- Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ }
+
+ if (classificationSelectionCombo != null) {
+ if (checkUseSelectedTaxonNode != null) {
+ if (checkUseSelectedTaxonNode.getSelection()) {
+ classificationSelectionCombo.setEnabled(false);
+ }
+ } else {
+ classificationSelectionCombo.setEnabled(true);
+ classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
+ }
+ }
+ Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
separator.setLayoutData(gridData);
- }
-
- Label folderLabel = new Label(composite, SWT.NONE);
- folderLabel.setText("Select Folder for exported files");
- folderLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
- true, false, 2, 1));
- folderDialog = new DirectoryDialog(parent.getShell());
- String exportFolder = PreferencesUtil.getStringValue(EXPORT_FOLDER, true);
- folderDialog.setFilterPath(exportFolder);
-
- text_folder = new Text(composite, SWT.BORDER);
- text_folder.setEditable(false);
- text_folder.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
- false));
- if (exportFolder != null){
- text_folder.setText(exportFolder);
- setPageComplete(true);
- }
-
- Button button = new Button(composite, SWT.PUSH);
- button.setText("Browse...");
-
- button.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- super.widgetSelected(e);
-
- String path = folderDialog.open();
- if (path != null) { // a folder was selected
- text_folder.setText(path);
- PreferencesUtil.setStringValue(EXPORT_FOLDER, path);
- setPageComplete(true);
- }
- }
- });
- if (!outputModelExport){
-
- Label fileLabel = new Label(composite, SWT.NONE);
- fileLabel.setText("File");
- text_exportFileName = new Text(composite, SWT.BORDER);
- text_exportFileName.setText(generateFilename());
- text_exportFileName.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
- true, false));
- }
-
- // make the composite the wizard pages control
- setControl(composite);
- }
+ }
+
+ Label folderLabel = new Label(composite, SWT.NONE);
+ folderLabel.setText("Select Folder for exported files");
+ folderLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
+ folderDialog = new DirectoryDialog(parent.getShell());
+ String exportFolder = PreferencesUtil.getStringValue(EXPORT_FOLDER, true);
+ folderDialog.setFilterPath(exportFolder);
+
+ text_folder = new Text(composite, SWT.BORDER);
+ text_folder.setEditable(false);
+ text_folder.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ if (exportFolder != null) {
+ text_folder.setText(exportFolder);
+ setPageComplete(true);
+ }
+
+ Button button = new Button(composite, SWT.PUSH);
+ button.setText("Browse...");
+
+ button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+
+ String path = folderDialog.open();
+ if (path != null) { // a folder was selected
+ text_folder.setText(path);
+ PreferencesUtil.setStringValue(EXPORT_FOLDER, path);
+ setPageComplete(true);
+ }
+ }
+ });
+ if (!cdmLightExport && !wfoBackboneExport) {
+
+ Label fileLabel = new Label(composite, SWT.NONE);
+ fileLabel.setText("Filename");
+ text_exportFileName = new Text(composite, SWT.BORDER);
+ text_exportFileName.setText(generateFilename());
+ text_exportFileName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ }
+
+ // make the composite the wizard pages control
+ setControl(composite);
+ }
+
+ /**
+ * @return
+ */
+ private String generateFamilyName(List<TaxonNode> nodes) {
+ if (nodes.size() == 1){
+ TaxonNode node = nodes.get(0);
+ if (node.getTaxon() != null) {
+ if(node.getTaxon().getName().getRank().getOrderIndex() >= Rank.FAMILY().getOrderIndex()) {
+ TaxonNode familyNode = node.getAncestorOfRank(Rank.FAMILY());
+ if (familyNode != null && familyNode.getTaxon() != null) {
+ return familyNode.getTaxon().getName().getNameCache();
+ }
+
+ }
+ }
+
+ }
+ return "";
+ }
protected void setComparatorToConfig() {
- if (orderSelectionCombo.getText().equals(NavigatorOrderEnum.NaturalOrder.getLabel())){
- ((CdmLightExportConfigurator)configurator).setComparator(new TaxonNodeDtoNaturalComparator());
- } else if (orderSelectionCombo.getText().equals(NavigatorOrderEnum.AlphabeticalOrder.getLabel())){
- ((CdmLightExportConfigurator)configurator).setComparator(new TaxonNodeDtoByNameComparator());
- }else {
- ((CdmLightExportConfigurator)configurator).setComparator(new TaxonNodeDtoByRankAndNameComparator());
+ if (orderSelectionCombo.getText().equals(NavigatorOrderEnum.NaturalOrder.getLabel())) {
+ ((CdmLightExportConfigurator) configurator).setTaxonNodeComparator(new TaxonNodeDtoNaturalComparator());
+ } else if (orderSelectionCombo.getText().equals(NavigatorOrderEnum.AlphabeticalOrder.getLabel())) {
+ ((CdmLightExportConfigurator) configurator).setTaxonNodeComparator(new TaxonNodeDtoByNameComparator());
+ } else {
+ ((CdmLightExportConfigurator) configurator)
+ .setTaxonNodeComparator(new TaxonNodeDtoByRankAndNameComparator());
+ }
+ }
+
+ protected String generateFilename() {
+ StringBuffer buffer = new StringBuffer();
+
+ Calendar cal = Calendar.getInstance();
+ SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
+ buffer.append(sdf.format(cal.getTime()));
+
+ buffer.append("-");
+ buffer.append(type + "_");
+
+ String source = ((ICdmRemoteSource) CdmStore.getActiveCdmSource()).toString();
+ source = source.substring(source.indexOf("/") + 1);
+ buffer.append(source);
+
+ buffer.append(".");
+ buffer.append(extension);
+
+ return buffer.toString();
+ }
+
+ public String getExportFileName() {
+ return text_exportFileName.getText();
+ }
+
+ public String getFamilyString() {
+ return text_familyString.getText();
+ }
+
+ public String getFolderText() {
+ return text_folder.getText();
+ }
+
+ public String get_baseUrl() {
+ return text_baseUrl.getText();
+ }
+
+ public Text getFolderComposite() {
+ return text_folder;
+ }
+
+ public boolean isExportUnpublishedData() {
+ return checkExportUnpublished.getSelection();
+ }
+
+ public boolean isExportFactualData() {
+ return checkExportFactualData.getSelection();
+ }
+
+ public boolean isExportUnpublishedFactualData() {
+ return checkExportUnpublishedFactualData.getSelection();
+ }
+
+ private void createClassificationSelectionCombo(Composite parent) {
+
+ GridData gridData = new GridData();
+ gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
+ gridData.horizontalIndent = 5;
+
+ classificationSelectionCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
+ classificationSelectionCombo.setLayoutData(gridData);
+ for (Classification tree : classifications) {
+ classificationSelectionCombo.add(tree.getTitleCache(), classifications.indexOf(tree));
+ }
+
+ classificationSelectionCombo.select(classifications.indexOf(selectedClassification));
+
+ // TODO remember last selection
+ classificationSelectionCombo.addSelectionListener(this);
+
+ }
+
+ public Combo getCombo() {
+ return classificationSelectionCombo;
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ selectedClassification = classifications.get(classificationSelectionCombo.getSelectionIndex());
+ }
+
+ public Classification getSelectedClassification() {
+ return selectedClassification;
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // not needed here
+ }
+
+ public UUID getSelectedClassificationUUID() {
+ return selectedClassification.getUuid();
+ }
+
+ public boolean getCheckUseSelectedTaxonNode() {
+ if (checkUseSelectedTaxonNode == null) {
+ return false;
+ }
+ return checkUseSelectedTaxonNode.getSelection();
+ }
+
+ public boolean getCheckUseAllClassifications() {
+ if (checkUseAllClassification == null) {
+ return false;
+ }
+ return checkUseAllClassification.getSelection();
+ }
+
+ public Set<UUID> getAllClassificationUuids() {
+ Set<UUID> allClassificationUuids = new HashSet<>();
+ for (Classification classification : this.classifications) {
+ allClassificationUuids.add(classification.getUuid());
}
+ return allClassificationUuids;
}
- protected String generateFilename() {
- StringBuffer buffer = new StringBuffer();
-
- Calendar cal = Calendar.getInstance();
- SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
- buffer.append(sdf.format(cal.getTime()));
-
- buffer.append("-");
- buffer.append(type +"_");
-
- String source = ((ICdmRemoteSource)CdmStore.getActiveCdmSource()).toString();
- source = source.substring(source.indexOf("/")+1);
- buffer.append(source);
-
- buffer.append(".");
- buffer.append(extension);
-
- return buffer.toString();
- }
-
- public String getExportFileName() {
- return text_exportFileName.getText();
- }
-
- public String getFolderText() {
- return text_folder.getText();
- }
-
- public Text getFolderComposite() {
- return text_folder;
- }
-
- public boolean isExportUnpublishedData(){
- return checkExportUnpublished.getSelection();
- }
-
- private void createClassificationSelectionCombo(Composite parent){
-
-// Composite classificationSelection = new Composite(parent, SWT.NULL);
-// classificationSelection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
-
-// GridLayout layout = new GridLayout();
-// classificationSelection.setLayout(layout);
- GridData gridData = new GridData();
- gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
- gridData.horizontalIndent = 5;
-// classificationSelection.setLayoutData(gridData);
-
- classificationSelectionCombo = new Combo(parent, SWT.BORDER| SWT.READ_ONLY);
- classificationSelectionCombo.setLayoutData(gridData);
- for(Classification tree : classifications){
- classificationSelectionCombo.add(tree.getTitleCache(), classifications.indexOf(tree));
- }
-
- classificationSelectionCombo.select(classifications.indexOf(selectedClassification));
-
- // TODO remember last selection
- classificationSelectionCombo.addSelectionListener(this);
-
- //return classificationSelection;
- }
-
- public Combo getCombo(){
- return classificationSelectionCombo;
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- selectedClassification = classifications.get(classificationSelectionCombo.getSelectionIndex());
- }
-
- public Classification getSelectedClassification(){
- return selectedClassification;
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- //not needed here
- }
-
- public UUID getSelectedClassificationUUID() {
- return selectedClassification.getUuid();
- }
-
- public boolean getCheckUseSelectedTaxonNode() {
- if (checkUseSelectedtaxonNode== null){
- return false;
- }
- return checkUseSelectedtaxonNode.getSelection();
- }
- public boolean getCheckUseAllClassifications() {
- if (checkUseAllClassification== null){
- return false;
- }
- return checkUseAllClassification.getSelection();
- }
-
- public Set<UUID> getAllClassificationUuids(){
- Set<UUID> allClassificationUuids = new HashSet<>();
- for (Classification classification: this.classifications){
- allClassificationUuids.add(classification.getUuid());
- }
- return allClassificationUuids;
- }
-
- @Override
- public boolean canFlipToNextPage() {
- return getFolderText() != null;
+ @Override
+ public boolean canFlipToNextPage() {
+ return getFolderText() != null && !(wfoBackboneExport && configurator.getTaxonNodeFilter().getSubtreeFilter().isEmpty());
}
}
public static String LanguageRepresentationPreferencePage_global;
public static String LanguageRepresentationPreferencePage_enable;
-
+ public static String LanguageRepresentationPreferencePage_not_available;
public static String ListComponent_ADD_PROVIDER;
public static String ListComponent_NO_PROVIDER_AVAILABLE;
public static String ListComponent_REMOVE_PROVIDER;
public static String DefinedTermDropAdapterE4_MOVE_FAILED;
public static String DefinedTermDropAdapterE4_MOVE_FAILED_MESSAGE;
public static String DefinedTermDropAdapterE4_MOVE_FAILED_SAVE_MESSAGE;
+ public static String DefinedTermDropAdapterE4_MOVE_FAILED_STANDARD_TERM;
+ public static String DefinedTermDropAdapterE4_MOVE_FAILED_TO_STANDARD_VOC;
+ public static String DefinedTermDropAdapterE4_MOVE_FAILED_TO_MANAGED_VOC;
+ public static String DefinedTermDropAdapterE4_MOVE_FAILED_MANAGED_TERM;
public static String DebugPreferences_0;
public static String DebugPreferences_1;
public static String EditPasswordElement_USERNAME_DOES_NOT_EXIST;
public static String EmptySection_NO_VIEW_IMPLEMENTED;
+ public static String More_than_one_distribution;
public static String PasswordWizard_COULD_NOT_CHANGE_PWD;
public static String PasswordWizard_OLD_PWD_INCORRECT;
public static String NameDetailsViewComposite_Show_AtomisedEpithets;
public static String NameDetailsViewComposite_Show_AuthorCache;
public static String NameDetailsViewComposite_Show_Author;
+ public static String NameDetailsViewComposite_Show_In_Author;
public static String NameDetailsViewComposite_Show_NomenclaturalReference;
public static String NameDetailsViewComposite_Show_NomenclaturalStatus;
public static String NameDetailsViewComposite_Show_Protologue;
public static String TypeDesignationSection_NO_TYPES_YET;
public static String TypeDesignationSection_TYPE_DESIGNATIONS;
+ public static String TaxonNodeSelectionDialog_0;
+
+ public static String TaxonNodeSelectionDialog_1;
+
public static String TaxonNodeWizardPage_edit;
public static String TaxonNodeWizardPage_new;
public static String TaxonNodeWizardPage_no_classification;
public static String TaxonPreference_local_not_allowed;
public static String TaxonPreference_description;
-
+
public static String TermOrder_idInVoc;
public static String TermOrder_Title;
public static String TermOrder_natural;
public static String FactualData_showModifier;
public static String FactualData_showModifier_FreeText;
+ public static String FactualData_showSpecimenAsSource;
+
public static String FactualData_description;
public static String FactualData_showIdInVocabulary;
public static String FactualData_showIdInVocabulary_tooltip;
public static String SecundumPreference_description;
public static String SecundumPreferenceSwap_description;
+ public static String MediaMetadataPreferenceDescription;
+ public static String Show;
+ public static String OriginalLabel;
+ public static String DisplayedLabel;
+
public static String Tree;
public static String Computed_factualData_handling_description;
CommonNameLanguageMenuPreferences_configure=Choose available languages for common names
LanguageRepresentationPreferencePage_global=Choose the global language that will be used throughout the editor to get representations in
LanguageRepresentationPreferencePage_enable=Enable Multiple Language Editing Capability
+LanguageRepresentationPreferencePage_not_available=Changing the term language is not possible in local preferences. \nIf you want to change the preference, please contact an administrator.
ListComponent_ADD_PROVIDER=Add Provider
ListComponent_NO_PROVIDER_AVAILABLE=No Providers available
ListComponent_REMOVE_PROVIDER=Remove Provider
EditPasswordElement_PLEASE_CREATE_OR_SAVE_USER=Please create or save user '%s' before changing password
EditPasswordElement_USERNAME_DOES_NOT_EXIST=Username does not exist
EmptySection_NO_VIEW_IMPLEMENTED=Unknown element. Details can not be shown.
+More_than_one_distribution=More than one distributions exist for this area. Please edit it in the taxon editor.
PasswordWizard_COULD_NOT_CHANGE_PWD=Could not change password
PasswordWizard_OLD_PWD_INCORRECT=The old password is not correct.
PasswordWizard_PROBLEM_WITH_CHANGING_PWD=Problem with changing password
DefinedTermDropAdapterE4_MOVE_FAILED_SAVE_MESSAGE=Moving the term failed. Try saving before.
DefinedTermDropAdapterE4_TERM_TYPE_ERROR_MESSAGE=The term type of the dropped term does not match the target term type.
DefinedTermDropAdapterE4_TERM_TYPE_ERROR_TITLE=Term types do not match
+DefinedTermDropAdapterE4_MOVE_FAILED_STANDARD_TERM=Standard terms are not allowed to be moved
+DefinedTermDropAdapterE4_MOVE_FAILED_TO_STANDARD_VOC=Terms are not allowed to be moved to standard vocabularies
+DefinedTermDropAdapterE4_MOVE_FAILED_MANAGED_TERM=Managed terms are not allowed to move
+DefinedTermDropAdapterE4_MOVE_FAILED_TO_MANAGED_VOC=Terms are not allowed to be moved to managed vocabularies
+
DebugPreferences_0=Show up widget is disposed error messages
DebugPreferences_1=Disable services api timestamp check
ImportFromFileAndChooseVocIdWizardOage_AreaVoc_toolTip=Please choose a vocabulary for the used areas.
ExcelDistributionUpdateWizard_ConfiguratorWizard_label=Configure Excel distribution update
AbstractImportWizard_ConfigurationLabel=Configure the Import
+TaxonNodeSelectionDialog_0=Create new factual data set (otherwise add to default description, if exists)
+TaxonNodeSelectionDialog_1=Select Classification
TaxonNodeWizardPage_edit=Edit Taxon Node
TaxonNodeWizardPage_new=New Taxon
TaxonNodeWizardPage_no_classification=No classification set.
NameDetailsViewComposite_Show_AtomisedEpithets=Atomised epithets
NameDetailsViewComposite_Show_AuthorCache=Authorship cache
NameDetailsViewComposite_Show_Author=Whole authorship section
+NameDetailsViewComposite_Show_In_Author=In-authors
NameDetailsViewComposite_Show_NomenclaturalReference=Nomenclatural reference section
NameDetailsViewComposite_Show_NomenclaturalStatus=Nomenclatural status section
NameDetailsViewComposite_Show_Protologue=Protologue section
ChecklistEditorGeneralPreference_show_title=Lable
ChecklistEditorGeneralPreference_show_symbol=Show symbol of the status, if existing
ChecklistEditorGeneralPreference_STATUS_DISPLAY_TEXT=Configure how the status should be displayed
-ChecklistEditorGeneralPreference_own_Description=Create own fact dataset for distributions created by the Distribution Editor
-ChecklistEditorGeneralPreference_own_DescriptionToolTip=Entries created with the Distribution Editor, saved in an own Taxon Description
+ChecklistEditorGeneralPreference_own_Description=Add to default factual data set
+ChecklistEditorGeneralPreference_own_DescriptionToolTip=Entries created with the Distribution Editor, always added to the default factual data set. If no default set exists, a new one is created.
GeneralPreference_override=Override
ChecklistEditorGeneralPreference_Configure_display_of_Areas=Display of areas in the header
ChecklistEditorGeneralPreference_Configure_display_of_Status=Display of distribution status in the table
Preference_update=Update
FactualData_showModifier=Show modifier
FactualData_showModifier_FreeText=Show modifier freetext
+FactualData_showSpecimenAsSource=Show specimen as source
FactualData_description=If a preference is not selectable, there is a serverside preference not allowed to override.
FactualData_showIdInVocabulary=Show id in vocabulary in area text field
FactualData_showIdInVocabulary_tooltip=Show id in vocabulary in area text field of details view
FactualData_EnableComputedFactualData=Handling of computed factual data
TextWithAddNull_ToolTip_null=Remove the value
-TextWithAddNull_ToolTip_NotNull=No value, to add a new value, uncheck the checkbox
\ No newline at end of file
+TextWithAddNull_ToolTip_NotNull=No value, to add a new value, uncheck the checkbox
+MediaMetadataPreferenceDescription=Define metadata shown in the universal viewer in the dataportal.\nAlternative attribute labels can be added in the right column.
+Show=Show
+OriginalLabel=Original label in metadata
+DisplayedLabel=Displayed label
\ No newline at end of file
CommonNameLanguageMenuPreferences_configure=Auswahl der für Trivialnamen zur Verf\u00FCgung stehenden Sprachen
LanguageRepresentationPreferencePage_global=Wählen Sie die Sprache, für die im gesamten Editor die Repräsentationen ausgewählt werden soll (sofern vorhanden).
LanguageRepresentationPreferencePage_enable=Aktiviere mehrsprachige Editierbarkeit
+LanguageRepresentationPreferencePage_not_available=Es dürfen keine lokalen Änderungen an der Term Sprache vorgenommen werden.\nWenn Sie die Präferenz dennoch ändern wollen, wenden Sie sich bitte an einen Administrator.
ListComponent_ADD_PROVIDER=Provider hinzufügen
ListComponent_NO_PROVIDER_AVAILABLE=Keine Provider verfügbar
ListComponent_REMOVE_PROVIDER=Provider entfernen
EditPasswordElement_PLEASE_CREATE_OR_SAVE_USER=Bitte erstellen oder speichern sie den Nutzer '%s', bevor Sie das Kennwort ändern
EditPasswordElement_USERNAME_DOES_NOT_EXIST=Nutzername existiert nicht
EmptySection_NO_VIEW_IMPLEMENTED=Unbekanntes Objekt. Details können nicht angezeigt werden.
+More_than_one_distribution=Es existieren mehr als eine Verbreitung für dieses Areal. Bitte bearbeiten Sie die Verbreitung im Taxon Editor.
PasswordWizard_COULD_NOT_CHANGE_PWD=Konnte das Kennwort nicht ändern
PasswordWizard_OLD_PWD_INCORRECT=Das alte Kennwort ist inkorrekt
PasswordWizard_PROBLEM_WITH_CHANGING_PWD=Fehler beim Ändern des Kennworts
DefinedTermDropAdapterE4_MOVE_FAILED_SAVE_MESSAGE=Das Verschieben des Terms ist fehlgeschlagen. Versuchen Sie vorher zu speichern.
DefinedTermDropAdapterE4_TERM_TYPE_ERROR_MESSAGE=Der Termtyp des verschobenen Terms stimmt nicht mit dem des Ziels überein.
DefinedTermDropAdapterE4_TERM_TYPE_ERROR_TITLE=Termtypen stimmen nicht überein
+DefinedTermDropAdapterE4_MOVE_FAILED_STANDARD_TERM=Standard Terme können nicht verschoben werden
+DefinedTermDropAdapterE4_MOVE_FAILED_TO_STANDARD_VOC=Terme dürfen nich in Standard Vokabulare verschoben werden
+DefinedTermDropAdapterE4_MOVE_FAILED_MANAGED_TERM=Externe Terme können nicht verschoben werden
+DefinedTermDropAdapterE4_MOVE_FAILED_TO_MANAGED_VOC=Terme dürfen nich in Externe Vokabulare verschoben werden
+
DebugPreferences_0=\"Widget is disposed\" Fehler Meldungen anzeigen
DebugPreferences_1=Deaktiviere die Überprüfung des API Timestamp
ImportFromFileAndChooseVocIdWizardOage_AreaVoc_toolTip=Bitte wählen Sie ein Vokabular für die genutzten Areas aus.
ExcelDistributionUpdateWizard_ConfiguratorWizard_label=Konfiguration des Excel Distribution Updates
AbstractImportWizard_ConfigurationLabel=Konfiguration des Imports
+TaxonNodeSelectionDialog_0=Erzeuge neues Faktendaten Set (sonst füge es dem default Set hinzu)
+TaxonNodeSelectionDialog_1=Wähle Klassifikation
TaxonNodeWizardPage_edit=Bearbeite Taxon Knoten
TaxonNodeWizardPage_new=Neues Taxon
TaxonNodeWizardPage_no_classification=Keine Klassifikation ausgewählt
NameDetailsViewComposite_Show_AtomisedEpithets=Atomisierte Epithete
NameDetailsViewComposite_Show_AuthorCache=Autoren Cache
NameDetailsViewComposite_Show_Author=Alle Autoreninformationen
+NameDetailsViewComposite_Show_In_Author=In-Autoren
NameDetailsViewComposite_Show_NomenclaturalReference=Nomenklatorische Referenz
NameDetailsViewComposite_Show_NomenclaturalStatus=Nomenklatorischer Status
NameDetailsViewComposite_Show_Protologue=Protologue
ChecklistEditorGeneralPreference_show_title=Label
ChecklistEditorGeneralPreference_show_symbol=Symbol des Status anzeigen, wenn es existiert
ChecklistEditorGeneralPreference_STATUS_DISPLAY_TEXT=Einstellung für die Anzeige des Status
-ChecklistEditorGeneralPreference_own_Description=Erstelle eigenes Fakten-Datenset für Verbreitungs-Editor Daten
-ChecklistEditorGeneralPreference_own_DescriptionToolTip=Einträge, die mit dem Distribution Editor erstellt werden, \nwerden in einer eigenen TaxonDescription gespeichert
+ChecklistEditorGeneralPreference_own_Description=Nutze die default Beschreibung
+ChecklistEditorGeneralPreference_own_DescriptionToolTip=Einträge, die mit dem Distribution Editor erstellt werden, \nwerden immer im default Taxon Fakten Set gespeichert, wenn noch kein default Set besteht, wird ein neues erstellt.
GeneralPreference_override=Ãœberschreiben
ChecklistEditorGeneralPreference_Configure_display_of_Areas=Darstellung der Areale in der Kopfzeile
ChecklistEditorGeneralPreference_Configure_display_of_Status=Darstellung der Verbreitung-Status in Tabelle
Preference_update=Aktualisieren
FactualData_showModifier=Zeige Modifier
FactualData_showModifier_FreeText=Zeige Freitext-Modifier
+FactualData_showSpecimenAsSource=Zeige Specimen als Quelle
FactualData_description=Wenn die Präferenz nicht ausgewählt werden kann, dann gibt es eine serverseitige Präferenz, die das Überschreiben nicht erlaubt.
FactualData_showIdInVocabulary=Zeige Id im Vokabular im Areal-Textfeld
FactualData_showIdInVocabulary_tooltip=Zeige die Id im Vokabular im Areal-Textfeld des Details View
FactualData_EnableComputedFactualData=Umgang mit berechneten Faktendaten
TextWithAddNull_ToolTip_null=Entferne den Wert aus dem Feld
-TextWithAddNull_ToolTip_NotNull=Kein Wert, um einen Wert einzufügen, bitte das Häkchen entfernen
\ No newline at end of file
+TextWithAddNull_ToolTip_NotNull=Kein Wert, um einen Wert einzufügen, bitte das Häkchen entfernen
+MediaMetadataPreferenceDescription=Definiere Metadaten, die im Universalviewer im Datenportal angezeigt werden sollen. \nIn der rechten Spalte können alternative Attributname eingetragen werden. \nMit den Buttons können weitere Attribute zugefügt oder entfernt werden.
+Show=Anzeigen
+OriginalLabel=Ursprüngliches Label in den Metadaten
+DisplayedLabel=Angezeigtes Label
\ No newline at end of file
+++ /dev/null
-/**
-* 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.model;
-
-import java.util.Vector;
-
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-
-/**
- * Reactions on specific EventyTypes are overridden here for convenience.
- *
- * @author n.hoffmann
- * @created 09.04.2009
- * @version 1.0
- */
-public abstract class AbstractDataChangeBehaviour implements IDataChangeBehavior {
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.store.model.IDataChangeBehavior#reactOnDataChange(java.lang.Object, java.util.List)
- */
- /** {@inheritDoc} */
- public abstract void reactOnDataChange(CdmDataChangeMap events);
-
- /**
- * {@inheritDoc}
- *
- * Implementors should overwrite this method if needed
- * @see eu.etaxonomy.taxeditor.model.IDataChangeBehavior#reactOnDelete(java.lang.Object, eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent)
- */
- public void reactOnDelete(Vector<CdmDataChangeEvent> event) {}
-
- /**
- * {@inheritDoc}
- *
- * Implementors should overwrite this method if needed
- * @see eu.etaxonomy.taxeditor.model.IDataChangeBehavior#reactOnInsert(java.lang.Object, eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent)
- */
- public void reactOnInsert(Vector<CdmDataChangeEvent> event) {}
-
- /**
- * {@inheritDoc}
- *
- * Implementors should overwrite this method if needed
- * @see eu.etaxonomy.taxeditor.model.IDataChangeBehavior#reactOnUpdate(java.lang.Object, eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent)
- */
- public void reactOnUpdate(Vector<CdmDataChangeEvent> event) {}
-}
import java.util.zip.ZipOutputStream;
import org.apache.commons.lang3.StringUtils;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.AbstractOperation;
import org.eclipse.core.commands.operations.IOperationHistory;
Calendar cal = Calendar.getInstance();
String fileEnding = ".csv";
- if (createZip){
+ if (createZip || urlString.endsWith("zip")){
// File file = new File(urlString+File.separator + sdf.format(cal.getTime())+ ".zip");
- File file = new File(urlString+ ".zip");
+ if (!urlString.endsWith("zip")) {
+ urlString += ".zip";
+ }
+ File file = new File(urlString);
FileOutputStream stream = new FileOutputStream(file);
ZipOutputStream zos = new ZipOutputStream(stream);
for (String key: keySet){
byte[] fileData = resultMap.get(key);
- ZipEntry entry = new ZipEntry( key + fileEnding);
+ if (!(key.endsWith("txt") || key.endsWith("xml"))) {
+ key += fileEnding;
+ }
+ ZipEntry entry = new ZipEntry(key);
zos.putNextEntry(entry);
zos.write(fileData);
zos.closeEntry();
}
} catch(Exception e){
logger.error(e.getStackTrace());
+ e.printStackTrace();
}
}
}
*
* @author n.hoffmann
* @date Jan 18, 2012
- *
*/
public class DefaultTermComparator<T extends DefinedTermBase> implements Comparator<T> {
- @Override
+
+ @Override
public int compare(T o1, T o2) {
if (o1 == o2){
return 0;
}
return result;
}
-};
+}
\ No newline at end of file
import org.apache.commons.lang3.StringUtils;
-import eu.etaxonomy.cdm.format.DescriptionElementFormatter;
import eu.etaxonomy.cdm.format.common.ExtendedTimePeriodFormatter;
import eu.etaxonomy.cdm.format.description.CategoricalDataFormatter;
+import eu.etaxonomy.cdm.format.description.DescriptionElementFormatter;
import eu.etaxonomy.cdm.format.description.QuantitativeDataFormatter;
import eu.etaxonomy.cdm.model.common.ExtendedTimePeriod;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
*/
public static void setCache(DescriptionElementBase element,
String value) {
- setCache(element, value, CdmStore.getDefaultLanguage());
+ setCache(element, value, PreferencesUtil.getGlobalLanguage());
}
// public static String getObjectClassname(Object element) {
public static String getFeatureNodeContainerText(FeatureNodeContainer element) {
String result = null;
if(element.getFeatureNode() != null && element.getFeatureNode().getTerm() != null){
-
- result = element.getFeatureNode().getTerm().getPreferredRepresentation(CdmStore.getDefaultLanguage()).getLabel();
-
+
+ result = element.getFeatureNode().getTerm().getPreferredRepresentation(PreferencesUtil.getGlobalLanguage()).getLabel();
} else{
return "No label set";
}
}
private static List<Language> getLanguageList(){
- return Arrays.asList(new Language[]{CdmStore.getDefaultLanguage()});
+ return Arrays.asList(new Language[]{PreferencesUtil.getGlobalLanguage()});
}
public static String getDistributionText(Distribution element) {
NamedArea area = distribution.getArea();
if(area != null){
- text = NamedArea.labelWithLevel(area, CdmStore.getDefaultLanguage());
+ text = NamedArea.labelWithLevel(area, PreferencesUtil.getGlobalLanguage());
PresenceAbsenceTerm status = distribution.getStatus();
if (status != null) {
- text += ", " + status.getPreferredRepresentation(CdmStore.getDefaultLanguage()).getLabel();
+ text += ", " + status.getPreferredRepresentation(PreferencesUtil.getGlobalLanguage()).getLabel();
}else{
text += ", NO STATUS";
}
}
public static String getImageText(Media media) {
- LanguageString title = media.getTitle(CdmStore.getDefaultLanguage());
+ LanguageString title = media.getTitle(PreferencesUtil.getGlobalLanguage());
if (title != null) {
return title.getText();
}
text = "No sources provided";
}
}else{
- List<Language> languages = Arrays.asList(new Language[]{CdmStore.getDefaultLanguage()});
+ List<Language> languages = Arrays.asList(new Language[]{PreferencesUtil.getGlobalLanguage()});
LanguageString languageString = element.getPreferredLanguageString(languages);
text = languageString != null ? languageString.getText() : null;
}
if (name == null || name.length() == 0) {
name = "No name provided";
}
+ if (commonName.getTransliteration()!= null && !StringUtils.isBlank(commonName.getTransliteration())) {
+ name += "/" +commonName.getTransliteration() + " ";
+ }
Language language = commonName.getLanguage();
NamedArea area = commonName.getArea();
String areaLabel = null;
String languageLabel = null;
if (area != null){
- areaLabel = area.getPreferredRepresentation(CdmStore.getDefaultLanguage()).getLabel();
- }
- if (language != null){
- languageLabel = language.getPreferredRepresentation(CdmStore.getDefaultLanguage()).getLabel();
+ areaLabel = area.getPreferredRepresentation(PreferencesUtil.getGlobalLanguage()).getLabel();
+ }
+ if (language != null){
+ languageLabel = language.getPreferredRepresentation(PreferencesUtil.getGlobalLanguage()).getLabel();
}
if (areaLabel != null || languageLabel != null){
name += " (" ;
}
name += ")";
}
-
-
+
+
return name;
}
if (text == null || text.length() == 0) {
text = "No label provided";
}
-
+
return text;
}
public class FeatureNodeContainerTree {
/** Constant <code>comparator</code> */
- // TODO we will do this with a ViewerSorter
+ // TODO we will do this with a ViewerComparator
public static Comparator<DescriptionElementBase> comparator = new Comparator<DescriptionElementBase>() {
@Override
*/
package eu.etaxonomy.taxeditor.model;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
*
* @author pplitzner
* @date Dec 3, 2014
- *
*/
public interface IDerivedUnitFacadePart {
* 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.model;
-
/**
* Interface for handling the current "dirty" state of an object. An object is
* dirty when changes are done but not saved/persisted yet.
- *
+ *
* @author n.hoffmann
* @created Mar 8, 2010
- * @version 1.0
*/
public interface IDirtyMarkable {
public static final String FUNNEL_ICON = "FUNNEL_ICON";
public static final String FUNNEL_ICON_EXCLAMATION = "FUNNEL_ICON_EXCLAMATION";
+ public static final String PROHIBITED = "prohibited";
+
/***************************************************************************
"funnel-icon.png");
registerImage(registry, FUNNEL_ICON_EXCLAMATION,
"funnel-exclamation-icon.png");
+ registerImage(registry, PROHIBITED,
+ "no_entry.png");
}
import java.util.List;
import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Platform;
LocalDateTime date = LocalDateTime.now();
String dateTimeStr = date.format(DateTimeFormatter.ISO_DATE_TIME);
- if(RemoteExecutionTimestampsUtil.getLastServiceMethod() != null){
- contextInfo.add("last remote method : " + RemoteExecutionTimestampsUtil.getLastServiceMethod());
+ if(RemoteExecutionTimestampsUtil.getLastService() != null){
+ contextInfo.add("last remote service : " + RemoteExecutionTimestampsUtil.getLastService());
+ }
+ if(RemoteExecutionTimestampsUtil.getLastMethod() != null){
+ contextInfo.add("last remote method : " + RemoteExecutionTimestampsUtil.getLastMethod());
}
if(RemoteExecutionTimestampsUtil.getLastRequestClientTime() != null){
contextInfo.add("last remote request client time : " + RemoteExecutionTimestampsUtil.getLastRequestClientTime());
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.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
/**
* @created Jun 1, 2010
*/
public abstract class AbstractNewEntityWizard<T>
- extends Wizard
- implements IConversationEnabled {
-
- protected ConversationHolder conversation;
+ extends Wizard {
protected CdmFormFactory formFactory;
@Override
public boolean performFinish() {
saveEntity();
-
- conversation.commit();
- conversation.close();
- conversation = null;
return true;
}
public void init(IWorkbench workbench, IStructuredSelection selection) {
formFactory = new CdmFormFactory(Display.getCurrent(), null);
- conversation = CdmStore.createConversation();
this.selection = selection;
entity = createNewEntity();
protected abstract T createNewEntity();
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
- @Override
- public void update(CdmDataChangeMap changeEvents) {}
-
public IStructuredSelection getSelection() {
return selection;
}
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.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
* @created Jun 1, 2010
* @version 1.0
*/
-public abstract class AbstractNewEntityWizardParentChild<T> extends Wizard implements
- IConversationEnabled {
-
- private ConversationHolder conversation;
+public abstract class AbstractNewEntityWizardParentChild<T> extends Wizard {
protected CdmFormFactory formFactory;
return true;
}
saveEntity();
-
- conversation.commit();
- conversation.close();
- conversation = null;
-
finished = true;
return true;
}
/** {@inheritDoc} */
public void init(IWorkbench workbench, IStructuredSelection selection) {
formFactory = new CdmFormFactory(Display.getCurrent(), null);
- conversation = CdmStore.createConversation();
this.selection = selection;
createParentEntity();
}
-
-
protected abstract void createParentEntity();
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
- /** {@inheritDoc} */
- @Override
- public void update(CdmDataChangeMap changeEvents) {}
-
public IStructuredSelection getSelection() {
return selection;
}
*/
package eu.etaxonomy.taxeditor.newWizard;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.molecular.Amplification;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
* @param conversation
* @param entity
*/
- public AmplificationGeneralWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, Amplification entity) {
- super(formFactory, conversation, entity);
+ public AmplificationGeneralWizardPage(CdmFormFactory formFactory, Amplification entity) {
+ super(formFactory, entity);
setTitle("General Amplification Data");
}
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* 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 java.util.List;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
-import eu.etaxonomy.cdm.api.application.ICdmRepository;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.ext.ipni.IIpniService;
import eu.etaxonomy.cdm.ext.ipni.IpniService;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
/**
- * <p>ExternalReferenceServiceWizardPage class.</p>
- *
* @author n.hoffmann
* @created Sep 16, 2010
- * @version 1.0
*/
public class ExternalReferenceServiceWizardPage extends WizardPage implements SelectionListener, ISelectionChangedListener {
- private ConversationHolder conversation;
private CdmFormFactory formFactory;
private Reference entity;
private Composite control;
private ListViewer viewer;
-
+
private IIpniService ipniService;
private Text text_query;
private Button button_search;
- /**
- * <p>Constructor for ExternalReferenceServiceWizardPage.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param entity a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
- */
- protected ExternalReferenceServiceWizardPage(CdmFormFactory formFactory, ConversationHolder conversation, Reference entity) {
+ protected ExternalReferenceServiceWizardPage(CdmFormFactory formFactory, Reference entity) {
super("ExternalReferenceServiceWizardPage");
this.formFactory = formFactory;
this.entity = entity;
- this.conversation = conversation;
ipniService = new IpniService();
-
+
setDescription("Query IPNI service for references");
}
-
- /** {@inheritDoc} */
+
@Override
public void createControl(Composite parent) {
control = formFactory.createComposite(parent);
-
+
control.setLayout(LayoutConstants.LAYOUT(2, false));
-
+
text_query = new Text(control, SWT.SINGLE | SWT.BORDER);
text_query.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
-
+
button_search = new Button(control, SWT.PUSH);
button_search.setLayoutData(LayoutConstants.RIGHT());
button_search.setText("Search");
-
+
button_search.addSelectionListener(this);
-
+
viewer = new ListViewer(control);
viewer.getControl().setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
-
+
viewer.setContentProvider(new IStructuredContentProvider(){
@Override
}
return null;
}
-
+
@Override
public void inputChanged(Viewer viewer, Object oldInput,
Object newInput) {}
-
+
@Override
public void dispose() {}
-
+
});
viewer.setLabelProvider(new LabelProvider(){
@Override
return "Element is not a reference";
}
});
-
+
viewer.addSelectionChangedListener(this);
-
+
setControl(control);
}
- /** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
String query = text_query.getText();
- List<Reference> publications = ipniService.getPublications(query, null, (ICdmRepository) CdmStore.getCurrentApplicationConfiguration(), null);
+ List<Reference> publications = ipniService.getPublications(query, null, CdmStore.getCurrentApplicationConfiguration(), null);
viewer.setInput(publications);
}
- /** {@inheritDoc} */
@Override
public void widgetDefaultSelected(SelectionEvent e) {}
- /** {@inheritDoc} */
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
-
+
Reference selectedReference = (Reference) selection.getFirstElement();
if(selectedReference != null){
((AbstractNewEntityWizard) getWizard()).setEntity(selectedReference);
}
}
-
-
-}
+}
\ No newline at end of file
/** {@inheritDoc} */
@Override
public void addPages() {
- amplificationGeneralPage = new AmplificationGeneralWizardPage(formFactory, getConversationHolder(), getEntity());
+ amplificationGeneralPage = new AmplificationGeneralWizardPage(formFactory, getEntity());
addPage(amplificationGeneralPage);
}
@Override
public void addPages() {
- classificationWizardPage = new ClassificationWizardPage(formFactory, getConversationHolder(), getEntity());
+ classificationWizardPage = new ClassificationWizardPage(formFactory, getEntity());
addPage(classificationWizardPage);
}
/** {@inheritDoc} */
@Override
public void addPages() {
- addPage(new CollectionWizardPage(formFactory, getConversationHolder(), getEntity()));
+ addPage(new CollectionWizardPage(formFactory, getEntity()));
}
/* (non-Javadoc)
* 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.facade.DerivedUnitFacade;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacadeNotSupportedException;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
/**
* @author n.hoffmann
* @created Jun 16, 2010
- * @version 1.0
*/
-public class NewDerivedUnitBaseWizard extends AbstractNewEntityWizard<SpecimenOrObservationBase> implements IDerivedUnitFacadePart{
+public class NewDerivedUnitBaseWizard
+ extends AbstractNewEntityWizard<SpecimenOrObservationBase>
+ implements IDerivedUnitFacadePart{
+
private SpecimenOrObservationType specOrObsType = null;
public NewDerivedUnitBaseWizard() {
super();
this.specOrObsType = specOrObsType;
}
- /** {@inheritDoc} */
+
@Override
public void addPages() {
DerivedUnitFacade facade = null;
try {
if(getEntity() instanceof DerivedUnit) {
facade = DerivedUnitFacade.NewInstance((DerivedUnit)getEntity(), PreferencesUtil.getDerivedUnitConfigurator());
- addPage(new DerivedUnitGeneralWizardPage(formFactory, getConversationHolder(), facade));
- addPage(new GatheringEventWizardPage(formFactory, getConversationHolder(), facade));
- addPage(new FieldUnitWizardPage(formFactory, getConversationHolder(), facade));
- addPage(new DerivedUnitBaseWizardPage(formFactory, getConversationHolder(), facade));
+ addPage(new DerivedUnitGeneralWizardPage(formFactory, facade));
+ addPage(new GatheringEventWizardPage(formFactory, facade));
+ addPage(new FieldUnitWizardPage(formFactory, facade));
+ addPage(new DerivedUnitBaseWizardPage(formFactory, facade));
}
else if(getEntity() instanceof FieldUnit){
facade = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit)getEntity(), PreferencesUtil.getDerivedUnitConfigurator());
- addPage(new FieldUnitGeneralWizardPage(formFactory, getConversationHolder(), facade));
- addPage(new GatheringEventWizardPage(formFactory, getConversationHolder(), facade));
- addPage(new FieldUnitWizardPage(formFactory, getConversationHolder(), facade));
+ addPage(new FieldUnitGeneralWizardPage(formFactory, facade));
+ addPage(new GatheringEventWizardPage(formFactory, facade));
+ addPage(new FieldUnitWizardPage(formFactory, facade));
}
} catch (DerivedUnitFacadeNotSupportedException e) {
// we should never get here
}
}
- /** {@inheritDoc} */
@Override
- protected SpecimenOrObservationBase createNewEntity() {
+ protected SpecimenOrObservationBase<?> createNewEntity() {
if (specOrObsType == null) {
return DerivedUnit.NewInstance(SpecimenOrObservationType.PreservedSpecimen);
} else {
}
}
-
- /** {@inheritDoc} */
@Override
protected void saveEntity() {
setEntity(CdmStore.getService(IOccurrenceService.class).merge(getEntity()));
-
}
-
@Override
protected String getEntityName() {
return "Specimen";
}
-
-}
+}
\ No newline at end of file
@Override
public void addPages() {
- vocabularyPage = new VocabularyWizardPage(formFactory, getConversationHolder(), getEntity());
+ vocabularyPage = new VocabularyWizardPage(formFactory, getEntity());
addPage(vocabularyPage);
}
@Override
public void addPages() {
- authorityPage = new GrantedAuthorityDetailWizardPage(formFactory, getConversationHolder(), getEntity());
+ authorityPage = new GrantedAuthorityDetailWizardPage(formFactory, getEntity());
super.addPage(authorityPage);
}
*/
@Override
public void addPages() {
- groupPage = new GroupDetailWizardPage(formFactory, getConversationHolder(), getEntity());
+ groupPage = new GroupDetailWizardPage(formFactory, getEntity());
super.addPage(groupPage);
}
@Override
public void addPages() {
- addPage(new InstitutionWizardPage(formFactory, getConversationHolder(), getEntity()));
+ addPage(new InstitutionWizardPage(formFactory, getEntity()));
}
@Override
/** {@inheritDoc} */
@Override
public void addPages() {
- addPage(new NonViralNameWizardPage(formFactory, getConversationHolder(), getEntity()));
+ addPage(new NonViralNameWizardPage(formFactory, getEntity()));
}
/** {@inheritDoc} */
/** {@inheritDoc} */
@Override
public void addPages() {
- addPage(new PersonWizardPage(formFactory, getConversationHolder(), getEntity()));
+ addPage(new PersonWizardPage(formFactory, getEntity()));
}
/** {@inheritDoc} */
@Override
public void addPages() {
- polytomousKeyPage = new PolytomousKeyWizardPage(formFactory, getConversationHolder(), getEntity());
+ polytomousKeyPage = new PolytomousKeyWizardPage(formFactory, getEntity());
super.addPage(polytomousKeyPage);
}
/** {@inheritDoc} */
@Override
public void addPages() {
- primerPage = new PrimerWizardPage(formFactory, getConversationHolder(), getEntity());
+ primerPage = new PrimerWizardPage(formFactory, getEntity());
addPage(primerPage);
}
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
formFactory = new CdmFormFactory(Display.getCurrent(), null);
- conversation = CdmStore.createConversation();
this.selection = selection;
setEntity(createNewEntity());
@Override
public void addPages() {
// TODO disabling external service wizard page for now
-// addPage(new ExternalReferenceServiceWizardPage(formFactory, getConversationHolder(), entity));
- referencePage = new ReferenceWizardPage(formFactory, getConversationHolder(), getEntity(), false);
+// addPage(new ExternalReferenceServiceWizardPage(formFactory, entity));
+ referencePage = new ReferenceWizardPage(formFactory, getEntity(), false);
addPage(referencePage);
}
@Override
public void addPages() {
- taxonNodePage = new TaxonNodeWizardPage(formFactory, getConversationHolder(), getParentEntity(), wizardPageListener, true);
+ taxonNodePage = new TaxonNodeWizardPage(formFactory, getParentEntity(), wizardPageListener, true);
addPage(taxonNodePage);
}
if(taxon == null ){
openEmptyEditor = true;
}else{
- getConversationHolder().bind();
- try{
+ try{
UpdateResult result;
TaxonNode parent = getParentEntity();
/** {@inheritDoc} */
@Override
public void addPages() {
- addPage(new TaxonWizardPage(formFactory, getConversationHolder(), getEntity()));
- addPage(new NonViralNameWizardPage(formFactory, getConversationHolder(), getEntity().getName()));
+ addPage(new TaxonWizardPage(formFactory, getEntity()));
+ addPage(new NonViralNameWizardPage(formFactory, getEntity().getName()));
}
/** {@inheritDoc} */
Set<TaxonName> namesToSave = new HashSet<>();
for (HybridRelationship hybridRelationship: taxon.getName().getHybridChildRelations()){
if (hybridRelationship.getParentName() != taxon.getName()){
- if (!hybridRelationship.getParentName().isPersited()){
+ if (!hybridRelationship.getParentName().isPersisted()){
namesToSave.add(hybridRelationship.getParentName());
}
}else if (hybridRelationship.getHybridName() != taxon.getName()){
- if (!hybridRelationship.getHybridName().isPersited()){
+ if (!hybridRelationship.getHybridName().isPersisted()){
namesToSave.add(hybridRelationship.getHybridName());
}
}
for (HybridRelationship hybridRelationship: taxon.getName().getHybridParentRelations()){
if (hybridRelationship.getParentName() != taxon.getName()){
- if (!hybridRelationship.getParentName().isPersited()){
+ if (!hybridRelationship.getParentName().isPersisted()){
namesToSave.add(hybridRelationship.getParentName());
}
}else if (hybridRelationship.getHybridName() != taxon.getName()){
- if (!hybridRelationship.getHybridName().isPersited()){
+ if (!hybridRelationship.getHybridName().isPersisted()){
namesToSave.add(hybridRelationship.getHybridName());
}
}
/** {@inheritDoc} */
@Override
public void addPages() {
- addPage(new TeamWizardPage(formFactory, getConversationHolder(), getEntity(), isNomenclaturalTeam, isCollectorTeam));
+ addPage(new TeamWizardPage(formFactory, getEntity(), isNomenclaturalTeam, isCollectorTeam));
}
/* (non-Javadoc)
@Override
public void addPages() {
- userPage = new UserDetailWizardPage(formFactory, getConversationHolder(), getEntity());
+ userPage = new UserDetailWizardPage(formFactory, getEntity());
addPage(userPage);
}
*/
package eu.etaxonomy.taxeditor.newWizard;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
*/
public class PolytomousKeyWizardPage extends AbstractCdmEntityWizardPage<PolytomousKey> {
- public PolytomousKeyWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, PolytomousKey entity) {
- super(formFactory, conversation, entity);
+ public PolytomousKeyWizardPage(CdmFormFactory formFactory, PolytomousKey entity) {
+ super(formFactory, entity);
}
@Override
*/
package eu.etaxonomy.taxeditor.newWizard;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.molecular.Primer;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
* @param conversation
* @param entity
*/
- public PrimerWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, Primer entity) {
- super(formFactory, conversation, entity);
+ public PrimerWizardPage(CdmFormFactory formFactory, Primer entity) {
+ super(formFactory, entity);
setTitle("General Primer Data");
}
*/
package eu.etaxonomy.taxeditor.newWizard;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
*/
public class VocabularyWizardPage extends AbstractCdmEntityWizardPage<TermVocabulary> {
- public VocabularyWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, TermVocabulary entity) {
- super(formFactory, conversation, entity);
+ public VocabularyWizardPage(CdmFormFactory formFactory, TermVocabulary entity) {
+ super(formFactory, entity);
setTitle("General Vocabulary Data");
}
package eu.etaxonomy.taxeditor.operation;
import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
* @version 1.0
*/
public abstract class AbstractPersistentPostOperation extends AbstractPostTaxonOperation {
- private final IConversationEnabled conversationEnabled;
-
protected TaxonNodeDto parentNode;
/**
* @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.
*/
protected AbstractPersistentPostOperation(String label, IUndoContext undoContext,
- IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled) {
- this(label, undoContext, postOperationEnabled, conversationEnabled, null);
+ IPostOperationEnabled postOperationEnabled) {
+ this(label, undoContext, postOperationEnabled, null);
}
/**
* @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.
*/
protected AbstractPersistentPostOperation(String label, IUndoContext undoContext,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled,
ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
- this.conversationEnabled = conversationEnabled;
}
/**
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
* @param taxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
*/
public AbstractPersistentPostOperation(String label,
IUndoContext undoContext, TaxonNodeDto taxonNode,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled,
ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
super(label, undoContext, taxonNode, postOperationEnabled, cdmEntitySessionEnabled);
- this.conversationEnabled = conversationEnabled;
-
}
/**
* @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 parentNode a {@link eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode} object.
*/
public AbstractPersistentPostOperation(String label,
IUndoContext undoContext,
IPostOperationEnabled postOperationEnabled,
- IConversationEnabled conversationEnabled,
- ICdmEntitySessionEnabled cdmEntitySessionEnabled, TaxonNodeDto parentNode) {
+ ICdmEntitySessionEnabled cdmEntitySessionEnabled, TaxonNodeDto parentNode) {
super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
this.parentNode = parentNode;
- this.conversationEnabled = conversationEnabled;
-
}
/* (non-Javadoc)
/** {@inheritDoc} */
@Override
protected IStatus postExecute(Object objectAffectedByOperation) {
- Assert.isNotNull(conversationEnabled, "Operation has to have a valid conversation attached.");
-
-
- if (!conversationEnabled.getConversationHolder().isClosed()){
- conversationEnabled.getConversationHolder().bind();
- conversationEnabled.getConversationHolder().commit(true);
- }
IStatus status = super.postExecute(objectAffectedByOperation);
-
return status;
}
* Binds the conversation that was attached to this operation.
*/
public void bind(){
- conversationEnabled.getConversationHolder().bind();
if(getCdmEntitySessionEnabled() != null && getCdmEntitySessionEnabled().getCdmEntitySession()!=null) {
getCdmEntitySessionEnabled().getCdmEntitySession().bind();
}
Status[] childStatus = new Status[exceptions.size()];
int count = 0;
- Set<String> messages = new HashSet<>();
+ //Set<String> messages = new HashSet<>();
for(Exception ex : exceptions) {
Status status = new Status(statusFlag,
"unknown",
statusFlag,
- ex.getLocalizedMessage(),
+ null,
ex);
- messages.add(ex.getLocalizedMessage());
+ // messages.add(ex.getLocalizedMessage());
childStatus[count] = status;
count++;
}
ErrorDialog.openError(null, "Operation successful but with warnings", null, status);
break;
case IStatus.ERROR:
- ErrorDialog.openError(null, "Error executing operation", null, status);
+ //MessagingUtils.error(null, "Error executing operation", null, status);
break;
default:
}
import eu.etaxonomy.cdm.api.service.INameService;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
+import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
import eu.etaxonomy.cdm.model.name.INonViralName;
import eu.etaxonomy.cdm.model.name.ITaxonNameBase;
import eu.etaxonomy.cdm.model.name.Rank;
checkBoxAddIndividualsAssociations.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- configurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(!configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
+ configurator.setAddIndividualsAssociations(!configurator.isAddIndividualsAssociations());
setApply(true);
}
});
checkBoxRemoveCountry.setSelection(configurator.isRemoveCountryFromLocalityText());
checkBoxImportSiblings.setSelection(configurator.isGetSiblings());
- checkBoxAddIndividualsAssociations.setSelection(configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
+ checkBoxAddIndividualsAssociations.setSelection(configurator.isAddIndividualsAssociations());
checkBoxReuseDescriptiveGroups.setSelection(configurator.isReuseExistingDescriptiveGroups());
checkBoxReuseExistingTaxa.setSelection(configurator.isReuseExistingTaxaWhenPossible());
/**
* @author k.luther
* @since 05.06.2019
- *
*/
-abstract public class AbstractGeneralTermPreference<T extends AbstractTermDto> extends CdmPreferencePage implements ISelectionChangedListener, SelectionListener{
+public abstract class AbstractGeneralTermPreference<T extends AbstractTermDto> extends CdmPreferencePage
+ implements ISelectionChangedListener, SelectionListener {
protected CheckBoxTreeComposite treeComposite;
protected List<TermVocabularyDto> vocabularies = new ArrayList<>();
- protected Combo useLocalOrAdmin ;
+ protected Combo useLocalOrAdmin;
protected boolean isOverride;
protected boolean allowOverride;
protected CdmPreference pref;
protected IPreferencePredicate predicate;
-
- public AbstractGeneralTermPreference(){
+ public AbstractGeneralTermPreference() {
super();
}
- /**
- * @param title
- */
public AbstractGeneralTermPreference(String title) {
super(title);
}
return !isAdminPreference;
}
-
protected TermType type;
public List<TermVocabularyDto> getVocabularies() {
return treeComposite;
}
- /**
- * {@inheritDoc}
- */
@Override
protected Control createContents(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
getPreferenceValues();
- if (isLocalPref() && !allowOverride){
+ if (isLocalPref() && !allowOverride) {
final CLabel description = new CLabel(parent, SWT.NULL);
description.setText(Messages.NameDetailsViewConfiguration_description_not_available);
this.setDefaultButtonActivated(false);
container.setLayout(gridLayout);
parent.setLayout(new GridLayout());
useLocalOrAdmin = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
- if (!isAdminPreference){
+ if (!isAdminPreference) {
useLocalOrAdmin.add(LocalOrDefaultEnum.Default.getLabel(), 0);
useLocalOrAdmin.add(LocalOrDefaultEnum.Local.getLabel(), 1);
- }else{
+ } else {
useLocalOrAdmin.add(LocalOrDefaultEnum.AllowOverride.getLabel(), 0);
useLocalOrAdmin.add(LocalOrDefaultEnum.Database.getLabel(), 1);
}
-
- treeComposite = new CheckBoxTreeComposite(container, new TermDtoContentProvider(), new TermDtoLabelProvider(), SWT.SCROLL_PAGE);
+ treeComposite = new CheckBoxTreeComposite(container, new TermDtoContentProvider(), new TermDtoLabelProvider(),
+ SWT.SCROLL_PAGE);
treeComposite.getViewer().setComparator(new DefinedTermSorter());
rememberCheckedValues(getCheckedValuesFromPreferences());
- if (isLocalPref()){
- if (isOverride){
+ if (isLocalPref()) {
+ if (isOverride) {
useLocalOrAdmin.select(1);
- }else{
+ } else {
useLocalOrAdmin.select(0);
- if (treeComposite.getViewer().getTree() != null && treeComposite.getViewer().getTree().getTopItem() != null) {
+ if (treeComposite.getViewer().getTree() != null
+ && treeComposite.getViewer().getTree().getTopItem() != null) {
treeComposite.getViewer().getTree().setSelection(treeComposite.getViewer().getTree().getTopItem());
}
treeComposite.setEnabled(false);
- //treeComposite.getViewer().getTree().getVerticalBar().setEnabled(true);
+ // treeComposite.getViewer().getTree().getVerticalBar().setEnabled(true);
}
- }else{
- if (allowOverride){
+ } else {
+ if (allowOverride) {
useLocalOrAdmin.select(0);
- }else{
+ } else {
useLocalOrAdmin.select(1);
}
}
treeComposite.getViewer().addSelectionChangedListener(this);
return container;
-
}
- public String getCheckedValuesFromPreferences(){
+ public String getCheckedValuesFromPreferences() {
String values;
- if (!isAdminPreference && isOverride){
+ if (!isAdminPreference && isOverride) {
values = PreferencesUtil.getStringValue(predicate.getKey(), true);
- }else{
- values = pref != null ?pref.getValue(): null;
+ } else {
+ values = pref != null ? pref.getValue() : null;
}
return values;
}
protected void rememberCheckedValues(String checkedValues) {
initialiseVocabularies();
- treeComposite.getViewer().getTree().deselectAll();
- treeComposite.getViewer().refresh();
- treeComposite.getViewer().setInput(getVocabularies());
- Object o =treeComposite.getViewer().getInput();
-
+ setInput();
if (checkedValues != null && checkedValues != "") { //$NON-NLS-1$
String[] listChecked = checkedValues.split(";"); //$NON-NLS-1$
String[] listCheckedComma = checkedValues.split(","); //$NON-NLS-1$
List<String> checked = new ArrayList<>();
- if (listChecked != null ){
+ if (listChecked != null) {
checked = Arrays.asList(listChecked);
}
- if (listCheckedComma != null && checkedValues.contains(",")){ //$NON-NLS-1$
+ if (listCheckedComma != null && checkedValues.contains(",")) { //$NON-NLS-1$
checked = Arrays.asList(listCheckedComma);
}
List<T> termsFromStringValues = getTermsFromStringValues(checked);
treeComposite.setCheckedElements(termsFromStringValues.toArray());
- }else{
+ } else {
List<T> termsFromStringValues = getTermsFromStringValues(new ArrayList<String>());
treeComposite.setCheckedElements(termsFromStringValues.toArray());
treeComposite.getViewer().refresh();
}
}
+ protected void setInput() {
+ treeComposite.getViewer().getTree().deselectAll();
+ treeComposite.getViewer().refresh();
+ treeComposite.getViewer().setInput(getVocabularies());
+ }
+
protected abstract List<T> getTermsFromStringValues(List<String> listValue);
protected void initialiseVocabularies() {
setVocabularies(vocs);
}
- protected void getPreferenceValues(){
+ protected void getPreferenceValues() {
pref = PreferencesUtil.getPreferenceFromDB(predicate);
- this.allowOverride = pref!= null?pref.isAllowOverride():true;
+ this.allowOverride = pref != null ? pref.isAllowOverride() : true;
this.isOverride = PreferencesUtil.getOverrideForPreference(predicate.getKey());
- if (pref == null){
+ if (pref == null) {
pref = CdmPreference.NewTaxEditorInstance(predicate, null);
}
}
- /**
- * {@inheritDoc}
- */
@Override
public void selectionChanged(SelectionChangedEvent event) {
this.setApply(true);
}
- /**
- * {@inheritDoc}
- */
@Override
public void widgetSelected(SelectionEvent e) {
- if (e.getSource().equals(useLocalOrAdmin)&& !isAdminPreference){
- if (useLocalOrAdmin.getText().equals(LocalOrDefaultEnum.Default.getLabel())){
+ if (e.getSource().equals(useLocalOrAdmin) && !isAdminPreference) {
+ if (useLocalOrAdmin.getText().equals(LocalOrDefaultEnum.Default.getLabel())) {
treeComposite.setEnabled(false);
isOverride = false;
- }else{
+ } else {
treeComposite.setEnabled(true);
isOverride = true;
}
this.setApply(true);
}
- /**
- * {@inheritDoc}
- */
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// TODO Auto-generated method stub
-
}
@Override
- protected void performDefaults(){
- if (!isLocalPref()){
+ protected void performDefaults() {
+ if (!isLocalPref()) {
rememberCheckedValues("");
treeComposite.setEnabled(true);
- }else{
+ } else {
isOverride = false;
rememberCheckedValues(getCheckedValuesFromPreferences());
treeComposite.setEnabled(false);
}
- pref = null;
- useLocalOrAdmin.select(0);
+ pref = null;
+ useLocalOrAdmin.select(0);
- setApply(true);
- super.performDefaults();
+ setApply(true);
+ super.performDefaults();
}
@Override
public boolean performOk() {
- if (!isApply()){
+ if (!isApply()) {
return true;
}
Object[] checkedElements = treeComposite.getViewer().getCheckedElements();
Collection<TermDto> preferredTermDtos = new ArrayList<>();
List<DefinedTermBase> preferredTerms = new ArrayList<>();
for (Object o : checkedElements) {
- if(o instanceof TermDto){
+ if (o instanceof TermDto) {
TermDto termDto = (TermDto) o;
listUIIDChecked.add(termDto.getUuid());
preferredTermDtos.add(termDto);
- if (vocabularies.size() > 1){
+ if (vocabularies.size() > 1) {
preferredTerms.add(CdmStore.getService(ITermService.class).load(termDto.getUuid()));
}
}
String saveCheckedElements = StringUtils.join(listUIIDChecked, ";"); //$NON-NLS-1$
-
String text = this.useLocalOrAdmin.getText();
- if (text.equals(LocalOrDefaultEnum.Database.getLabel()) || text.equals(LocalOrDefaultEnum.Default.getLabel())){
+ if (text.equals(LocalOrDefaultEnum.Database.getLabel()) || text.equals(LocalOrDefaultEnum.Default.getLabel())) {
PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(predicate.getKey()), false);
- }else if (text.equals(LocalOrDefaultEnum.Local.getLabel())){
+ } else if (text.equals(LocalOrDefaultEnum.Local.getLabel())) {
PreferencesUtil.setStringValue(predicate.getKey(), saveCheckedElements);
PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(predicate.getKey()), true);
}
- if (type == null){
+ if (type == null) {
CdmStore.getTermManager().setPreferredTermsByDto(preferredTermDtos, vocabularies.get(0));
- }else{
+ } else {
CdmStore.getTermManager().setPreferredTermsByType(preferredTermDtos, type);
}
PreferencesUtil.firePreferencesChanged(this.getClass());
}
protected boolean performOkAdmin() {
- Object[] checkedElements = treeComposite.getViewer().getCheckedElements();
- List<UUID> listUIIDChecked = new ArrayList<>();
- List<DefinedTermBase> preferredTerms = new ArrayList<>();
- for (Object o : checkedElements) {
- if(o instanceof TermDto){
- TermDto termDto = (TermDto) o;
- listUIIDChecked.add(termDto.getUuid());
- preferredTerms.add(CdmStore.getService(ITermService.class).load(termDto.getUuid()));
+ CdmPreference savePref = CdmPreference.NewTaxEditorInstance(predicate, null);
+
+ if (pref != null) {
+
+ Object[] checkedElements = treeComposite.getCheckedElements();
+ List<UUID> listUIIDChecked = new ArrayList<>();
+ List<DefinedTermBase> preferredTerms = new ArrayList<>();
+ for (Object o : checkedElements) {
+ if (o instanceof TermDto) {
+ TermDto termDto = (TermDto) o;
+ listUIIDChecked.add(termDto.getUuid());
+ preferredTerms.add(CdmStore.getService(ITermService.class).load(termDto.getUuid()));
+ }
+ }
+ String saveCheckedElements = StringUtils.join(listUIIDChecked, ";"); //$NON-NLS-1$
+ if (StringUtils.isBlank(saveCheckedElements)) {
+ saveCheckedElements = null;
+ }
+ savePref = CdmPreference.NewTaxEditorInstance(predicate, saveCheckedElements);
+ String text = this.useLocalOrAdmin.getText();
+ if (text.equals(LocalOrDefaultEnum.Database.getLabel())) {
+ savePref.setAllowOverride(false);
+ } else if (text.equals(LocalOrDefaultEnum.AllowOverride.getLabel())) {
+ savePref.setAllowOverride(true);
}
- }
- String saveCheckedElements = StringUtils.join(listUIIDChecked, ";"); //$NON-NLS-1$
- if (StringUtils.isBlank(saveCheckedElements)){
- saveCheckedElements = null;
- }
- CdmPreference savePref = CdmPreference.NewTaxEditorInstance(predicate, saveCheckedElements);
- String text = this.useLocalOrAdmin.getText();
- if (text.equals(LocalOrDefaultEnum.Database.getLabel()) ){
- savePref.setAllowOverride(false);
- }else if (text.equals(LocalOrDefaultEnum.AllowOverride.getLabel())){
- savePref.setAllowOverride(true);
}
PreferencesUtil.setPreferenceToDB(savePref);
PreferencesUtil.firePreferencesChanged(this.getClass());
return true;
}
-
-}
+}
\ No newline at end of file
/**
*
*/
- protected void refresh() {
- //getValues();
- if (table != null){
- table.removeAll();
- if (pref != null){
- createTableRow(pref);
- }
- table.redraw();
- table.pack();
+ protected void refresh() {
+ // getValues();
+ if (table != null) {
+ table.removeAll();
+ if (pref != null) {
+ createTableRow(pref);
+ }
+ table.redraw();
+ table.pack();
- }
+ }
- }
+ }
- public abstract void createTableRow(CdmPreference pref) ;
- // public abstract String getUUIDFromSubject(CdmPreference pref);
+ public abstract void createTableRow(CdmPreference pref);
+ // public abstract String getUUIDFromSubject(CdmPreference pref);
- protected void fillVocabularies(CdmPreference vocPref){
- List<UUID> uuids = null;
- if (isAdminPreference){
- uuids = PreferencesUtil.createUuidList(vocPref.getValue());
- }else{
- uuids = PreferencesUtil.createUUIDListFromStringPref(vocPref.getPredicate(), false);
- }
- if (uuids == null || uuids.isEmpty()){
- vocabularies = new ArrayList();
- vocabularies = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermType(type);
- }else{
- vocabularies = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByVocabularyUuids(uuids);
- }
- }
+ protected void fillVocabularies(CdmPreference vocPref) {
+ List<UUID> uuids = null;
+ if (isAdminPreference) {
+ uuids = PreferencesUtil.createUuidList(vocPref.getValue());
+ } else {
+ uuids = PreferencesUtil.createUUIDListFromStringPref(vocPref.getPredicate(), false);
+ }
+ if (uuids == null || uuids.isEmpty()) {
+ vocabularies = new ArrayList();
+ vocabularies = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermType(type);
+ } else {
+ vocabularies = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByVocabularyUuids(uuids);
+ }
+ }
}
--- /dev/null
+/**
+* Copyright (C) 2023 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.preference;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.Widget;
+
+import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
+import eu.etaxonomy.taxeditor.preference.wizard.CheckBoxTreeComposite;
+
+/**
+ * @author katjaluther
+ * @since 18.10.2023
+ */
+public class AreaCheckBoxTreeComposite extends CheckBoxTreeComposite {
+ Map<TermDto, Set<TermNodeDto>> mapTermsToNodes = new HashMap<>();
+
+ /**
+ * @param parent
+ * @param contentProvider
+ * @param labelProvider
+ * @param style
+ */
+ public AreaCheckBoxTreeComposite(Composite parent, ITreeContentProvider contentProvider, IBaseLabelProvider labelProvider,
+ int style) {
+ super(parent, contentProvider, labelProvider, style);
+
+ }
+
+ @Override
+ protected Tree createTree() {
+ Tree tree = new Tree(this, SWT.BORDER | SWT.CHECK);
+ tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ tree.addListener(SWT.Selection, event -> {
+ if (event.detail == SWT.CHECK) {
+ TreeItem item = (TreeItem) event.item;
+ if(!allowTopLevelSelection && item.getParentItem()==null){
+ // top level selection not allowed
+ item.setChecked(false);
+ return;
+ }
+ if (item.getChecked()){
+ updateAfterCheckElement(item);
+ }else{
+ if (checkedElements != null){
+ updateAfterUnCheckElement(item);
+ }
+ }
+ }
+ });
+ return tree;
+ }
+
+
+
+ /**
+ * @return the mapTermsToNodes
+ */
+ public Map<TermDto, Set<TermNodeDto>> getMapTermsToNodes() {
+ return mapTermsToNodes;
+ }
+
+ /**
+ * @param mapTermsToNodes the mapTermsToNodes to set
+ */
+ public void setMapTermsToNodes(Map<TermDto, Set<TermNodeDto>> mapTermsToNodes) {
+ this.mapTermsToNodes = mapTermsToNodes;
+ }
+
+ /**
+ * @param item
+ */
+ private void updateAfterCheckElement(Object item) {
+ List<Object> tempList = new ArrayList<>();
+ if (checkedElements != null) {
+ Collections.addAll(tempList, checkedElements);
+ }
+
+ TermNodeDto checkedNode = null;
+ TermDto checkedTerm = null;
+ TreeItem treeItem = null;
+ if (item instanceof TreeItem) {
+ treeItem = (TreeItem) item;
+ if (treeItem.getData() instanceof TermNodeDto) {
+ checkedNode = (TermNodeDto)treeItem.getData();
+ checkedTerm = checkedNode.getTerm();
+ }else if (treeItem.getData() instanceof TermDto) {
+ checkedTerm = (TermDto)treeItem.getData();
+ }else {
+ return;
+ }
+ }else if (item instanceof TermNodeDto) {
+ checkedNode = (TermNodeDto)item;
+ checkedTerm = checkedNode.getTerm();
+ }else if (item instanceof TermDto) {
+ checkedTerm = (TermDto)item;
+ }else {
+ return;
+ }
+
+
+ Set<TermNodeDto> allRelevantNodes = this.mapTermsToNodes.get(checkedTerm);
+ if (allRelevantNodes != null) {
+ tempList.addAll(allRelevantNodes);
+ }
+ tempList.add(checkedTerm);
+
+ setCheckedElements(tempList.toArray());
+
+ }
+
+
+ @Override
+ protected void updateAfterUnCheckElement(Object item) {
+ List<Object> tempList = new ArrayList<>();
+ List<Object> elementsToUpdate = new ArrayList<>();
+ Collections.addAll(tempList, checkedElements);
+ TermNodeDto checkedNode = null;
+ TermDto checkedTerm = null;
+ if (item instanceof TreeItem) {
+ if (((TreeItem)item).getData() instanceof TermNodeDto) {
+ checkedNode = (TermNodeDto)((TreeItem)item).getData();
+ checkedTerm = checkedNode.getTerm();
+ }else if (((TreeItem)item).getData() instanceof TermDto) {
+ checkedTerm = (TermDto)((TreeItem)item).getData();
+ }else {
+ return;
+ }
+ }else if (item instanceof TermNodeDto) {
+ checkedNode = (TermNodeDto)item;
+ checkedTerm = checkedNode.getTerm();
+ }else if (item instanceof TermDto) {
+ checkedTerm = (TermDto) item;
+ }
+
+ for (Object o:checkedElements){
+ //o can be a termnode dto or a term dto
+ //check whether item.getData is a termDto or a termNodeDto
+ TermNodeDto toCheckNode = null;
+ TermDto toCheckTerm = null;
+ if (o instanceof TermNodeDto) {
+ toCheckNode = (TermNodeDto) o;
+ toCheckTerm = toCheckNode.getTerm();
+ }else if (o instanceof TermDto) {
+ toCheckTerm = (TermDto)o;
+ }else {
+ continue;
+ }
+
+ if (toCheckNode != null && checkedNode != null && toCheckNode.equals(checkedNode)){
+ tempList.remove(toCheckNode);
+ elementsToUpdate.add(toCheckNode);
+
+ }
+ if (toCheckNode != null && checkedTerm != null && toCheckTerm.equals(checkedTerm)){
+ tempList.remove(toCheckNode);
+ elementsToUpdate.add(toCheckNode);
+
+ }
+ if (toCheckTerm != null && checkedTerm != null && toCheckTerm.equals(checkedTerm)){
+ tempList.remove(toCheckTerm);
+ elementsToUpdate.add(toCheckTerm);
+
+ }
+ }
+ setCheckedElements(tempList.toArray());
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ ITreeSelection structuredSelection = viewer.getStructuredSelection();
+ Object firstElement = structuredSelection.getFirstElement();
+ if(e.widget == btnCollapse){
+ viewer.collapseAll();
+ }
+ else if(e.widget == btnExpand){
+ viewer.expandToLevel(firstElement, AbstractTreeViewer.ALL_LEVELS);
+ }
+ else if(e.widget == btnSelectDirectChildren){
+ Widget item = viewer.testFindItem(firstElement);
+ if(item instanceof TreeItem){
+ viewer.expandToLevel(firstElement, 1);
+ TreeItem treeItem = (TreeItem) item;
+ TreeItem[] childItems = treeItem.getItems();
+ List<TreeItem> childItemList = Arrays.asList(childItems);
+ boolean allChecked = childItemList.stream().allMatch(childItem->childItem.getChecked());
+ childItemList.stream().forEach(childItem->childItem.setChecked(!allChecked));
+ if (!allChecked) {
+ for (TreeItem updateItem: childItemList) {
+ updateAfterCheckElement(updateItem);
+ }
+
+ }else {
+ for (TreeItem updateItem: childItemList) {
+ updateAfterUnCheckElement(updateItem);
+ }
+ }
+
+ }
+ }
+ else if(e.widget == btnSelectAllChildren){
+ Widget item = viewer.testFindItem(firstElement);
+ if(item instanceof TreeItem){
+ viewer.expandToLevel(firstElement, AbstractTreeViewer.ALL_LEVELS);
+ Set<TreeItem> childrenSet = getSubTreeItems((TreeItem)item);
+ Object[] children = childrenSet.toArray();
+ boolean checked = true;
+ if (children == null) {
+ return;
+ }
+ if (children != null && ((TreeItem)children[0]).getChecked()) {
+ checked = false;
+ }
+ viewer.setSubtreeChecked(firstElement, checked);
+ ((TreeItem) item).setChecked(false);
+ Object[] checkedElements = viewer.getCheckedElements();
+
+ for (Object updateItem: children) {
+ if (((TreeItem)children[0]).getChecked()) {
+ updateAfterCheckElement(updateItem);
+ }else {
+ updateAfterUnCheckElement(updateItem);
+ }
+ }
+
+ }
+ }
+ }
+
+ private Set<TreeItem> getSubTreeItems(TreeItem parent) {
+ Set<TreeItem> children = new HashSet<>();
+
+ if (parent.getItems() != null) {
+ children.addAll(Arrays.asList(parent.getItems()));
+ for(TreeItem child : parent.getItems()) {
+ children.addAll(getSubTreeItems(child));
+ }
+ }
+ return children;
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2023 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.preference;
+
+import java.util.LinkedHashMap;
+
+/**
+ * @author K.Luther
+ * @date 14.06.2023
+ *
+ */
+public class BiocaseProvideConfig {
+
+ private String[] datasets;
+ private String service_url;
+
+
+ public BiocaseProvideConfig() {
+ }
+
+ public BiocaseProvideConfig(Object[] datasets, String service_url) {
+ this.setDatasets(datasets);
+ this.service_url = service_url;
+ }
+
+
+ public String[] getDatasets() {
+ return datasets;
+ }
+ public void setDatasets(Object[] datasets) {
+ this.datasets = new String[datasets.length];
+ int index = 0;
+ for (Object o:datasets) {
+ LinkedHashMap<String,String> map = (LinkedHashMap<String, String>)o;
+ this.datasets[index] = map.get("title");
+ index++;
+ }
+
+ }
+ public String getService_url() {
+ return service_url;
+ }
+ public void setService_url(String service_url) {
+ this.service_url = service_url;
+ }
+
+
+
+}
*/
package eu.etaxonomy.taxeditor.preference;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.widgets.Label;
import eu.etaxonomy.cdm.api.application.ICdmRepository;
-import eu.etaxonomy.cdm.ext.geo.CondensedDistributionRecipe;
+import eu.etaxonomy.cdm.format.description.distribution.CondensedDistributionRecipe;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import java.util.Map;
import java.util.UUID;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import eu.etaxonomy.cdm.api.application.ICdmRepository;
import eu.etaxonomy.cdm.api.service.ITermService;
private static CdmPreferenceCache instance;
- private final static Logger logger = LogManager.getLogger(CdmPreferenceCache.class);
+ private final static Logger logger = LogManager.getLogger();
public static CdmPreferenceCache instance(){
if(instance == null){
* 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.preference;
import org.eclipse.core.expressions.PropertyTester;
/**
* @author n.hoffmann
* @created Jan 26, 2011
- * @version 1.0
*/
public class CdmStorePropertyTester extends PropertyTester {
private static final String EDITOR_IS_CONNECTED_TO_DB = "isCdmStoreConnected";
private static final String IS_REMOTING = "isRemoting";
- private static final String IS_STANDALONE = "isStandAlone";
private static final String IS_CONNECTED_AND_NOT_LOCAL_ACTIVATED = "isCdmStoreConnectedAndNotLocalActivated";
private static final String IS_CONNECTED_AND_LOCAL_ACTIVATED = "isCdmStoreConnectedAndLocalActive";
if(!isCdmStoreConnected()) {
return false;
} else {
- return isRemoting();
+ return true;
}
}
- if(IS_STANDALONE.equals(property)){
- if(!isCdmStoreConnected()) {
- return false;
- } else {
- return !isRemoting();
- }
- }
if(IS_CONNECTED_AND_NOT_LOCAL_ACTIVATED.equals(property)){
return isCdmStoreConnectedAndNotLocalActive();
}
active = active & PreferencesUtil.getLocalActive();
return active;
}
-
- private boolean isRemoting() {
- return CdmStore.getCurrentSessionManager().isRemoting();
- }
}
import org.eclipse.swt.widgets.Text;\r
\r
import eu.etaxonomy.cdm.model.metadata.CdmPreference;\r
+import eu.etaxonomy.cdm.model.metadata.DistributionDescription;\r
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;\r
import eu.etaxonomy.cdm.model.metadata.TermComboEnum;\r
import eu.etaxonomy.cdm.model.metadata.TermDisplayEnum;\r
protected TermDisplayEnum displayStatus;\r
protected TermComboEnum displayStatusCombo;\r
protected TermDisplayEnum displayArea;\r
- protected Boolean ownDescriptionForDistributionEditor;\r
+ protected DistributionDescription descriptionForDistributionEditor;\r
protected Integer numberOfStatus;\r
\r
- protected boolean overrideOwnDescriptionForDistributionEditor;\r
+ protected boolean overrideDescriptionForDistributionEditor;\r
protected boolean overrideAreaVoc;\r
protected boolean overrideRank;\r
protected boolean overrideOrderAreas;\r
protected Button allowOverrideAreaDisplayButton;\r
protected Combo statusSortSelectionCombo;\r
protected Button allowOverrideStatusSortButton;\r
-\r
+ protected Combo descriptionSelectionCombo;\r
+ protected Button allowOverrideDescriptionSelectionButton;\r
\r
protected Text numberOfStatusText;\r
protected Button allowOverrideNumberOfStatusButton;\r
protected CdmPreference prefStatusDisplayInCombo;\r
protected CdmPreference prefAreaSort;\r
protected CdmPreference prefRank;\r
- protected CdmPreference prefOwnDescription;\r
+ protected CdmPreference prefDescription;\r
protected CdmPreference prefNumberStatus;\r
protected CdmPreference prefStatusSort;\r
Composite child;\r
});\r
}\r
\r
+ //===\r
+ descriptionSelectionCombo = createCombo(child, DistributionDescription.values(),\r
+ PreferencePredicate.DescriptionForDistributionEditor, Messages.ChecklistEditorGeneralPreference_own_Description, isAdminPreference);\r
+ index = 0;\r
+ for (String itemLabel : descriptionSelectionCombo.getItems()) {\r
+ if (descriptionForDistributionEditor == null && itemLabel.startsWith(Messages.Preference_Use_Default)) {\r
+ descriptionSelectionCombo.select(index);\r
+ break;\r
+ }\r
+ if (descriptionForDistributionEditor != null && descriptionForDistributionEditor.getLabel().equals(itemLabel)){\r
+ descriptionSelectionCombo.select(index);\r
+ break;\r
+ }\r
+ \r
+ index++;\r
+ }\r
+ descriptionSelectionCombo.addSelectionListener(this);\r
+ if (isAdminPreference) {\r
+ allowOverrideDescriptionSelectionButton = createAllowOverrideButton(child);\r
+ allowOverrideDescriptionSelectionButton.setSelection(prefDescription != null? prefDescription.isAllowOverride():true);\r
+ allowOverrideDescriptionSelectionButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ setApply(true);\r
+ if (prefDescription == null){\r
+ prefDescription = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DescriptionForDistributionEditor, PreferencePredicate.DescriptionForDistributionEditor.getDefaultValue() != null ? PreferencePredicate.DescriptionForDistributionEditor.getDefaultValue().toString(): null);\r
+ }\r
+ prefDescription.setAllowOverride(allowOverrideDescriptionSelectionButton.getSelection());\r
+ }\r
+ });\r
+ }\r
+\r
+\r
+ \r
+ //====\r
+ \r
+ \r
\r
\r
final CLabel description = new CLabel(child, SWT.NULL);\r
if (prefNumberStatus != null && !prefNumberStatus.isAllowOverride()){\r
numberOfStatusText.setEnabled(false);\r
}\r
+ if (prefDescription != null && !prefDescription.isAllowOverride()){\r
+ descriptionSelectionCombo.setEnabled(false);\r
+ }\r
}\r
\r
}\r
}\r
PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(\r
PreferencePredicate.NumberOfVisibleStatusInDropDown.getKey()), override);\r
+ \r
+ override = false;\r
+ if (descriptionForDistributionEditor != null) {\r
+ override = true;\r
+ PreferencesUtil.setStringValue(PreferencePredicate.DescriptionForDistributionEditor.getKey(), descriptionForDistributionEditor.getKey());\r
+ }\r
+ PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(\r
+ PreferencePredicate.DescriptionForDistributionEditor.getKey()), override);\r
\r
\r
PreferencesUtil.firePreferencesChanged(this.getClass());\r
isShowRank = false;\r
}\r
}\r
+ \r
+ if (e.getSource().equals(this.descriptionSelectionCombo)) {\r
+ String text = descriptionSelectionCombo.getText();\r
+ if(text.startsWith(Messages.Preference_Use_Default)){\r
+ descriptionForDistributionEditor = null;\r
+ return;\r
+ }\r
+ \r
+ if (text.equals(DistributionDescription.AlwaysDefault.getLabel())){\r
+ descriptionForDistributionEditor = DistributionDescription.AlwaysDefault;\r
+ }else{\r
+ descriptionForDistributionEditor = DistributionDescription.UseAlreadyExisting;\r
+ }\r
+ }\r
\r
\r
if (e.getSource().equals(this.activateCombo)) {\r
\r
}\r
\r
- prefOwnDescription = PreferencesUtil\r
- .getPreferenceFromDB(PreferencePredicate.OwnDescriptionForDistributionEditor);\r
- if (prefOwnDescription != null) {\r
- if (prefOwnDescription.isAllowOverride()) {\r
- ownDescriptionForDistributionEditor = PreferencesUtil.isOwnDescriptionForChecklistEditor();\r
+ prefDescription = PreferencesUtil\r
+ .getPreferenceFromDB(PreferencePredicate.DescriptionForDistributionEditor);\r
+ overrideDescriptionForDistributionEditor = PreferencesUtil.getBooleanValue(\r
+ PreferencesUtil.prefOverrideKey(PreferencePredicate.DescriptionForDistributionEditor.getKey()), true) != null? PreferencesUtil.getBooleanValue(\r
+ PreferencesUtil.prefOverrideKey(PreferencePredicate.DescriptionForDistributionEditor.getKey()), true): false;\r
+ if (prefDescription != null) {\r
+ if (prefDescription.isAllowOverride()) {\r
+ if (overrideDescriptionForDistributionEditor) {\r
+ String str = PreferencesUtil.getStringValue(PreferencePredicate.DescriptionForDistributionEditor.getKey());\r
+ if (str == null) {\r
+ descriptionForDistributionEditor = null;\r
+ }else {\r
+ descriptionForDistributionEditor = DistributionDescription.byKey(str);\r
+ } \r
+ }\r
} else {\r
- ownDescriptionForDistributionEditor = prefOwnDescription.getValue() != null? Boolean.valueOf(prefOwnDescription.getValue().toString()): null;\r
+ descriptionForDistributionEditor = prefDescription.getValue() != null? DistributionDescription.byKey(prefDescription.getValue().toString()): null;\r
}\r
} else {\r
- ownDescriptionForDistributionEditor = PreferencesUtil.isShowRankInChecklistEditor();\r
- // allowOverrideOwnDescriptionForDistributionEditor = true;\r
- overrideOwnDescriptionForDistributionEditor = PreferencesUtil.getBooleanValue(\r
- PreferencesUtil.prefOverrideKey(PreferencePredicate.OwnDescriptionForDistributionEditor.getKey()), true) != null? PreferencesUtil.getBooleanValue(\r
- PreferencesUtil.prefOverrideKey(PreferencePredicate.OwnDescriptionForDistributionEditor.getKey()), true): false;\r
- //prefOwnDescription = CdmPreference.NewTaxEditorInstance(PreferencePredicate.OwnDescriptionForDistributionEditor, PreferencePredicate.OwnDescriptionForDistributionEditor.getDefaultValue() != null ? PreferencePredicate.OwnDescriptionForDistributionEditor.getDefaultValue().toString(): null);\r
+ if (overrideDescriptionForDistributionEditor) {\r
+ String str = PreferencesUtil.getStringValue(PreferencePredicate.DescriptionForDistributionEditor.getKey());\r
+ if (str == null) {\r
+ descriptionForDistributionEditor = null;\r
+ }else {\r
+ descriptionForDistributionEditor = DistributionDescription.byKey(str);\r
+ }\r
+ }else {\r
+ descriptionForDistributionEditor = null;\r
+ }\r
+ \r
}\r
\r
\r
index++;\r
}\r
\r
- ownDescriptionForDistributionEditor = null;\r
+ descriptionForDistributionEditor = null;\r
+ descriptionSelectionCombo.select(0);\r
+ \r
if (prefNumberStatus == null){\r
numberOfStatusText.setText(PreferencePredicate.NumberOfVisibleStatusInDropDown.getDefaultValue().toString());\r
}else{\r
allowOverrideOrderAreasButton.setSelection(true);\r
allowOverrideRankButton.setSelection(true);\r
allowOverrideNumberOfStatusButton.setSelection(true);\r
+ allowOverrideDescriptionSelectionButton.setSelection(true);\r
}\r
overrideActivated = true;\r
overrideAreaDisplay = true;\r
overrideStatusDisplay = true;\r
overrideOrderAreas = true;\r
overrideRank = true;\r
- overrideOwnDescriptionForDistributionEditor = true;\r
+ overrideDescriptionForDistributionEditor = true;\r
overrideNumberOfStatus = true;\r
\r
if (!isAdminPreference) {\r
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.taxeditor.l10n.Messages;
-import eu.etaxonomy.taxeditor.preference.wizard.GeneralVocabularyPreferencePage;
/**
* @author k.luther
* @since 05.10.2018
*
*/
-public class CommonNameVocabularyPreferencePage extends GeneralVocabularyPreferencePage implements IE4PreferencePage {
+public class CommonNameVocabularyPreferencePage extends NamedAreaVocabularyPreferencePage{//GeneralVocabularyPreferencePage implements IE4PreferencePage {
public CommonNameVocabularyPreferencePage(){
*/
package eu.etaxonomy.taxeditor.preference;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Control;
import eu.etaxonomy.cdm.api.application.ICdmRepository;
-import eu.etaxonomy.cdm.ext.geo.CondensedDistributionRecipe;
+import eu.etaxonomy.cdm.format.description.distribution.CondensedDistributionRecipe;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
/**
* @author k.luther
* @since 02.07.2019
- *
*/
public class DistributionGeneralPreference extends CdmPreferencePage implements SelectionListener {
protected CdmPreference preferenceCondensedDistribtionRecipe;
*/
package eu.etaxonomy.taxeditor.preference;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
protected boolean allowOverrideFreeText;
private boolean isOverrideFreeText = true;
+
+ protected Boolean isShowSpecimenAsSource;
+
+ protected Combo comboShowSpecimenAsSource;
+ protected CdmPreference prefShowSpecimenAsSource = null;
+ Button allowOverrideShowSpecimenButton;
+
+ protected boolean allowOverrideSpecimen;
+ private boolean isOverrideSpecimen = true;
comboShowModifierFreeText.setEnabled(allowOverrideFreeText);
}
+ //Show specimen as source
+ comboShowSpecimenAsSource = createBooleanCombo(composite, SHOW, DO_NOT_SHOW, PreferencePredicate.ShowSpecimenInFactSource, Messages.FactualData_showSpecimenAsSource, isAdminPreference);
+ comboShowSpecimenAsSource.addSelectionListener(this);
+ if (this.isAdminPreference){
+ allowOverrideShowSpecimenButton = createAllowOverrideButton(composite);
+ allowOverrideShowSpecimenButton.setSelection(allowOverrideSpecimen);
+ allowOverrideShowSpecimenButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ allowOverrideSpecimen = !allowOverrideSpecimen;
+ setApply(true);
+ }
+ });
+ }
+ index = 0;
+ if(isShowSpecimenAsSource==null){
+ comboShowSpecimenAsSource.select(0);
+ } else{
+ for (String itemLabel : comboShowSpecimenAsSource.getItems()){
+ if (itemLabel.startsWith(this.SHOW) && isShowSpecimenAsSource){
+ comboShowSpecimenAsSource.select(index);
+ break;
+ }
+ if (itemLabel.startsWith(DO_NOT_SHOW) && !isShowSpecimenAsSource){
+ comboShowSpecimenAsSource.select(index);
+ break;
+ }
+ index++;
+ }
+ }
+ if (!isAdminPreference){
+ comboShowSpecimenAsSource.setEnabled(allowOverrideSpecimen);
+ }
return composite;
}else{
PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowModifierFreeText.getKey()), false);
}
+
+ if (isShowSpecimenAsSource != null){
+ PreferencesUtil.setStringValue(PreferencePredicate.ShowSpecimenInFactSource.getKey(), Boolean.toString(isShowSpecimenAsSource));
+ PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowSpecimenInFactSource.getKey()), true);
+
+ }else{
+ PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowSpecimenInFactSource.getKey()), false);
+ }
}
return true;
isShowModifier = Boolean.valueOf(showModifierString);
}
- isOverride = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowModifier.getKey()));
+ isOverride = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowModifier.getKey()), true);
if (!isOverride){
isShowModifier = null;
}
isShowModifierFreeText = Boolean.valueOf(showModifierStringFreeText);
}
- isOverrideFreeText = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowModifierFreeText.getKey()));
+ isOverrideFreeText = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowModifierFreeText.getKey()), true);
if (!isOverrideFreeText){
isShowModifierFreeText = null;
}
+
+ // get specimen values
+ prefShowSpecimenAsSource = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowSpecimenInFactSource);
+ if (prefShowSpecimenAsSource == null){
+ prefShowSpecimenAsSource = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowSpecimenInFactSource, PreferencePredicate.ShowSpecimenInFactSource.getDefaultValue().toString());
+ }
+ allowOverrideSpecimen = prefShowSpecimenAsSource.isAllowOverride();
+ isShowSpecimenAsSource = null;
+ String showSpecimenString = PreferencesUtil.getStringValue(PreferencePredicate.ShowSpecimenInFactSource.getKey(), true);
+ if (showSpecimenString != null){
+ isShowSpecimenAsSource = Boolean.valueOf(showSpecimenString);
+ }
+
+ isOverrideSpecimen = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowSpecimenInFactSource.getKey()), true);
+ if (!isOverrideSpecimen){
+ isShowSpecimenAsSource = null;
+ }
}
if (isAdminPreference){
allowOverrideFreeTextButton.setSelection(allowOverrideFreeText);
}
+
+ isShowSpecimenAsSource = null;
+ allowOverrideSpecimen = true;
+
+ comboShowSpecimenAsSource.select(0);
+ if (isAdminPreference){
+ allowOverrideShowSpecimenButton.setSelection(allowOverrideSpecimen);
+ }
setApply(true);
super.performDefaults();
}
}
}
+
+ if (e.getSource().equals(this.comboShowSpecimenAsSource)) {
+ String text = comboShowSpecimenAsSource.getText();
+ if (text.startsWith(Messages.Preference_Use_Default)){
+ isOverrideSpecimen = false;
+ isShowSpecimenAsSource = null;
+
+ }else if (text.equals(SHOW)){
+ isShowSpecimenAsSource = true;
+ isOverrideSpecimen = true;
+ }else{
+ isShowSpecimenAsSource = false;
+ isOverrideSpecimen = true;
+ }
+
+ }
+
setApply(true);
}
package eu.etaxonomy.taxeditor.preference;
import java.io.IOException;
-import java.util.Locale;
-import org.apache.commons.lang3.StringUtils;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.PlatformUI;
-import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.metadata.IKeyLabel;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
+import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @author n.hoffmann
public class LanguageEditorPreferencePage extends CdmPreferencePage {
private CCombo combo;
- PreferencesUtil preferencesUtil = new PreferencesUtil();
+
private boolean isSelectionChanged = false;
private int initalSelectionIndex;
// preferencesUtil.writePropertyToConfigFile(combo.getSelectionIndex());
if(initalSelectionIndex != combo.getSelectionIndex()) {
isSelectionChanged = true;
+
}else{
isSelectionChanged = false;
}
combo.select(0);
}
}else{
- Locale locale = Locale.getDefault();
- if(locale.getLanguage().equals(new Locale("de").getLanguage())){
+ eu.etaxonomy.cdm.model.common.Language defaultLanguage = CdmStore.getDefaultLanguage();
+ if(defaultLanguage.equals(eu.etaxonomy.cdm.model.common.Language.GERMAN())){
initalSelectionIndex = 0;
combo.select(0);
- }else if(locale.getLanguage().equals(new Locale("en").getLanguage())){
+ }else if(defaultLanguage.equals(eu.etaxonomy.cdm.model.common.Language.ENGLISH())){
initalSelectionIndex = 1;
combo.select(1);
}
/**
* @return the label
*/
+ @Override
public String getLabel() {
return label;
}
@Override
public boolean performOk() {
- try {
- if(isSelectionChanged){
- int i = combo.getSelectionIndex();
- preferencesUtil.writePropertyToConfigFile(combo.getSelectionIndex());
- String test = combo.getItem(combo.getSelectionIndex());
-
- boolean result = MessageDialog.openConfirm(getShell(), Messages.LanguageEditorPreferencePage_PleaseRestart, Messages.LanguageEditorPreferencePage_EditorHasToRestart);
- if(result){
- //Press Ok
- PlatformUI.getWorkbench().restart();
- }
+
+ if (isSelectionChanged) {
+
+ try {
+ PreferencesUtil.writePropertyToConfigFile(combo.getSelectionIndex());
+ }catch(IOException e) {
+ e.printStackTrace();
+ }
+
+
+ boolean result = MessageDialog.openConfirm(getShell(), Messages.LanguageEditorPreferencePage_PleaseRestart, Messages.LanguageEditorPreferencePage_EditorHasToRestart);
+ if(result){
+ //Press Ok
+ PlatformUI.getWorkbench().restart();
}
- } catch (IOException e) {
- e.printStackTrace();
}
+
+
return super.performOk();
}
}
\ No newline at end of file
package eu.etaxonomy.taxeditor.preference;\r
\r
import java.util.List;\r
+import java.util.UUID;\r
\r
import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.custom.CLabel;\r
import org.eclipse.swt.events.SelectionAdapter;\r
import org.eclipse.swt.events.SelectionEvent;\r
import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.layout.RowLayout;\r
+import org.eclipse.swt.widgets.Button;\r
import org.eclipse.swt.widgets.Combo;\r
import org.eclipse.swt.widgets.Composite;\r
import org.eclipse.swt.widgets.Control;\r
import org.eclipse.swt.widgets.Label;\r
\r
import eu.etaxonomy.cdm.model.common.Language;\r
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;\r
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;\r
+import eu.etaxonomy.cdm.model.term.DefinedTermBase;\r
+import eu.etaxonomy.cdm.model.term.TermType;\r
import eu.etaxonomy.taxeditor.l10n.Messages;\r
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
public class LanguageRepresentationPreferencePage extends CdmPreferencePage{\r
\r
\r
- private Language globalLanguage;\r
+ protected Language globalLanguage;\r
+ public final static String ID = "eu.etaxonomy.taxeditor.preferences.termLanguages"; //$NON-NLS-1$\r
+\r
+ protected CdmPreference termLanguagePref =null;\r
+ protected boolean overrideActivated;\r
+ protected Button allowOverrideOrderButton;\r
+ private String defaultSettings = "Default settings";\r
+ protected Combo combo_globalLanguage;\r
\r
// private Composite createComposite(Composite parent){\r
// Composite composite = new Composite(parent, SWT.NULL);\r
}\r
\r
private void createSetDefaultLanguage(Composite parent) {\r
- globalLanguage = PreferencesUtil.getGlobalLanguage();\r
-\r
- if(globalLanguage == null) {\r
- return;\r
- }\r
+ getValues();\r
\r
int curentSelectionIndex = 0;\r
\r
final Composite composite = createComposite(parent);\r
- composite.setLayout(new RowLayout(1));\r
-\r
- final Label label = new Label(composite, SWT.NONE);\r
- label.setText(Messages.LanguageRepresentationPreferencePage_global);\r
-\r
- final Combo combo_globalLanguage = new Combo(composite, SWT.NONE);\r
-\r
- List<Language> preferredLanguages = CdmStore.getTermManager().getPreferredTerms(Language.class);\r
-\r
- for(int i = 0; i < preferredLanguages.size(); i++){\r
- Language language = preferredLanguages.get(i);\r
- combo_globalLanguage.add(language.getLabel(), i);\r
- if(language.equals(globalLanguage)){\r
- curentSelectionIndex = i;\r
- }\r
- }\r
-\r
- combo_globalLanguage.select(curentSelectionIndex);\r
+ GridLayout layout = new GridLayout();\r
+ layout.numColumns = 2;\r
+ composite.setLayout(layout);\r
+\r
+ if (isAdminPreference || !isAdminPreference && this.termLanguagePref.isAllowOverride()) {\r
+ final Label label = new Label(composite, SWT.NONE);\r
+ label.setText(Messages.LanguageRepresentationPreferencePage_global);\r
+ final Label labelFree = new Label(composite, SWT.NONE);\r
+ // label.setText(Messages.LanguageRepresentationPreferencePage_global);\r
+\r
+ //combo_globalLanguage = new Combo(composite, SWT.NONE);\r
+ \r
+ List<DefinedTermBase> preferredLanguages = CdmStore.getTermManager().getPreferredTerms(TermType.Language);\r
+ combo_globalLanguage = createComboTerms(composite, preferredLanguages, PreferencePredicate.TermLanguage, "Term Language", Language.getDefaultLanguage() , isAdminPreference);\r
+\r
+\r
+\r
+ for(int i = 0; i < preferredLanguages.size(); i++){\r
+ Language language = (Language)preferredLanguages.get(i);\r
+ \r
+ if(language.equals(globalLanguage)){\r
+ curentSelectionIndex = i;\r
+ }\r
+ }\r
+\r
+ if (curentSelectionIndex != 0) {\r
+ curentSelectionIndex ++;\r
+ }\r
+ combo_globalLanguage.select(curentSelectionIndex);\r
+\r
+ combo_globalLanguage.addSelectionListener(new SelectionAdapter() {\r
+ /* (non-Javadoc)\r
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)\r
+ */\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+\r
+ int selectionIndex = combo_globalLanguage.getSelectionIndex();\r
+ if (combo_globalLanguage.getItem(selectionIndex).startsWith(Messages.Preference_Use_Default)){\r
+ if (isAdminPreference) {\r
+ globalLanguage = null;\r
+ }\r
+ overrideActivated = false;\r
+ }else {\r
+ globalLanguage = (Language)combo_globalLanguage.getData(combo_globalLanguage.getItem(selectionIndex));\r
+ overrideActivated = true;\r
+ }\r
+ setApply(true);\r
+ }\r
+ });\r
+ }else {\r
+ //changing the Term Language locally is not allowed\r
+ final CLabel description = new CLabel(parent, SWT.NULL);\r
+ description.setText(Messages.LanguageRepresentationPreferencePage_not_available);\r
+ this.setDefaultButtonActivated(false);\r
+ }\r
\r
- combo_globalLanguage.addSelectionListener(new SelectionAdapter() {\r
- /* (non-Javadoc)\r
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)\r
- */\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
\r
- int selectionIndex = combo_globalLanguage.getSelectionIndex();\r
- globalLanguage = CdmStore.getCurrentApplicationConfiguration().getTermService().getLanguageByLabel(combo_globalLanguage.getItem(selectionIndex));\r
- setApply(true);\r
- }\r
- });\r
+ if (isAdminPreference) {\r
+ allowOverrideOrderButton = createAllowOverrideButton(composite);\r
+ allowOverrideOrderButton.setSelection(termLanguagePref != null? termLanguagePref.isAllowOverride(): true);\r
+ //allowOverrideOrderAreasButton.setEnabled(prefAreaSort != null);\r
+ allowOverrideOrderButton.addSelectionListener(new SelectionAdapter() {\r
+ @Override\r
+ public void widgetSelected(SelectionEvent e) {\r
+ setApply(true);\r
+ if (termLanguagePref == null){\r
+ termLanguagePref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.TermLanguage, PreferencePredicate.TermLanguage.getDefaultValue() != null ? PreferencePredicate.TermLanguage.getDefaultValue().toString(): null);\r
+ }\r
+ termLanguagePref.setAllowOverride(allowOverrideOrderButton.getSelection());\r
+ }\r
+ });\r
+ }\r
}\r
\r
-// private void createSetMultiLanguageTextEditingCapability(Composite parent) {\r
-// isMultilanguageTextEditingCapability = PreferencesUtil.getBooleanValue(IPreferenceKeys.MULTILANGUAGE_TEXT_EDITING_CAPABILITY);\r
-//\r
-// final Composite composite = createComposite(parent);\r
-//\r
-// final Button button_toggle = new Button(composite, SWT.CHECK);\r
-//\r
-//\r
-// button_toggle.setText(Messages.LanguageRepresentationPreferencePage_enable);\r
-//\r
-// button_toggle.setSelection(isMultilanguageTextEditingCapability);\r
-//\r
-//\r
-// button_toggle.addSelectionListener(new SelectionAdapter(){\r
-// /* (non-Javadoc)\r
-// * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)\r
-// */\r
-// @Override\r
-// public void widgetSelected(SelectionEvent e) {\r
-// setApply(true);\r
-// isMultilanguageTextEditingCapability = button_toggle.getSelection();\r
-// }\r
-// });\r
-// }\r
+\r
+ @Override\r
+ public void getValues() {\r
+ isAdminPreference = false;\r
+ setPreferenceStore(PreferencesUtil.getPreferenceStore());\r
+ termLanguagePref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.TermLanguage);\r
+ overrideActivated = PreferencesUtil.getBooleanValue(\r
+ PreferencesUtil.prefOverrideKey(PreferencePredicate.TermLanguage.getKey()), true) != null? PreferencesUtil.getBooleanValue(\r
+ PreferencesUtil.prefOverrideKey(PreferencePredicate.TermLanguage.getKey()), true):false;\r
+ if (termLanguagePref != null) {\r
+ if (termLanguagePref.isAllowOverride() && overrideActivated) {\r
+ String globalLanguageUUIDString = PreferencesUtil.getStringValue(PreferencePredicate.TermLanguage.getKey(), true);\r
+ if (globalLanguageUUIDString != null) {\r
+ globalLanguage = Language.getLanguageFromUuid(UUID.fromString( globalLanguageUUIDString));\r
+ }else {\r
+ globalLanguage = Language.getDefaultLanguage();\r
+ }\r
+ //globalLanguage = Language.getLanguageFromUuid(UUID.fromString(PreferencesUtil.getStringValue(PreferencePredicate.TermLanguage.getKey(), true)));\r
+ } else {\r
+ if(!overrideActivated){\r
+ globalLanguage = null;\r
+ }else{\r
+ globalLanguage = termLanguagePref.getValue() != null? Language.getLanguageFromUuid(UUID.fromString(termLanguagePref.getValue())): CdmStore.getDefaultLanguage();\r
+ }\r
+ }\r
+\r
+ } else {\r
+ if(!overrideActivated){\r
+ globalLanguage = null;\r
+ }else{\r
+ String globalLanguageUUIDString = PreferencesUtil.getStringValue(PreferencePredicate.TermLanguage.getKey(), true);\r
+ if (globalLanguageUUIDString != null) {\r
+ globalLanguage = Language.getLanguageFromUuid(UUID.fromString( globalLanguageUUIDString));\r
+ }else {\r
+ globalLanguage = Language.getDefaultLanguage();\r
+ }\r
+ }\r
+ termLanguagePref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.TermLanguage, PreferencePredicate.TermLanguage.getDefaultValue() != null ? PreferencePredicate.TermLanguage.getDefaultValue().toString(): null);\r
+ }\r
+ }\r
\r
@Override\r
public boolean performOk() {\r
if (!isApply()){\r
return true;\r
}\r
+ //check whether a language or the option to use the db selection was chosen\r
PreferencesUtil.setGlobalLanguage(globalLanguage);\r
+ // if (overrideActivated) {\r
+ PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.TermLanguage.getKey()), overrideActivated);\r
+ // }\r
return super.performOk();\r
}\r
+ \r
+ @Override\r
+ protected void performDefaults() {\r
+\r
+ globalLanguage = null;\r
+ \r
+ combo_globalLanguage.select(0);\r
+ overrideActivated = false;\r
+ \r
+ setApply(true);\r
+\r
+ }\r
+ \r
}\r
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Iterator;
import javax.swing.event.DocumentEvent;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Text;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
CdmPreferencePage preferencePage;
CdmPreference providerListPreference;
String providerList;
- String[] items;
+ java.util.List<String> items;
public CdmPreference getProviderListPreference() {
return providerListPreference;
// TODO Auto-generated catch block
e.printStackTrace();
}
-
- JSONArray jsonResponseArray;
+ java.util.List<BiocaseProvideConfig> listProvider = null;
+ ObjectMapper mapper = new ObjectMapper();
try {
- jsonResponseArray =new JSONArray(response);
-
- int i = 0;
- String service_url = null;
- JSONArray dataSets = null;
- items = new String[jsonResponseArray.length()];
- while (i<jsonResponseArray.length()){
- JSONObject object = jsonResponseArray.getJSONObject(i);
- service_url = (String) object.get("service_url");
- dataSets = (JSONArray) object.get("datasets");
- if (service_url != null){
- providerURI.add(service_url);
- items[i] = service_url;
- }
- i++;
- }
-
- } catch (JSONException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ listProvider = mapper.readValue(response, new TypeReference<java.util.List<BiocaseProvideConfig>>(){});
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ items = new ArrayList<>();
+ for (BiocaseProvideConfig conf: listProvider) {
+ items.add(conf.getService_url());
+ providerURI.add(conf.getService_url());
}
GridData dataProviderUri = new GridData();
@Override
public IContentProposal[] getProposals(String contents, int position) {
//String[] items = getStringItems();
- if (contents.length() == 0 || items.length == 0) {
+ if (contents.length() == 0 || items.isEmpty()) {
return new IContentProposal[0];
}
StringMatcher matcher = new StringMatcher("*" + contents + "*", true, false); //$NON-NLS-1$ //$NON-NLS-2$
- ArrayList<String> matches = new ArrayList<String>();
- for (int i = 0; i < items.length; i++) {
- if (matcher.match(items[i])) {
- matches.add(items[i]);
+ java.util.List<String> matches = new ArrayList<>();
+ Iterator<String> itemsIterator = items.iterator();
+ String nextItem = null;
+ while (itemsIterator.hasNext()) {
+ nextItem = itemsIterator.next();
+ if (matcher.match(nextItem) ) {
+ matches.add(nextItem);
}
}
boolean isRankActivated = true;
boolean isAtomisedEpithetsActivated = true;
boolean isAuthorshipSectionActivated = true;
+ boolean isInAuthorshipActivated = false;
boolean isAuthorCacheActivated = true;
boolean isNomenclaturalReferenceSectionActivated = true;
boolean isNomenclaturalStatusSectionActivated = true;
this.isAuthorshipSectionActivated = isAuthorshipSectionActivated;
}
+ public boolean isInAuthorshipActivated() {
+ return isInAuthorshipActivated;
+ }
+
+ public void setInAuthorshipActivated(boolean isInAuthorshipActivated) {
+ this.isInAuthorshipActivated = isInAuthorshipActivated;
+ }
+
public boolean isNomenclaturalReferenceSectionActivated() {
return isNomenclaturalReferenceSectionActivated;
}
protected boolean isShowNomenclaturalStatusRuleConsideredCodeEdition;
protected boolean isShowNomenclaturalRef;
protected boolean isShowAuthorship;
+ protected boolean isShowInAuthors;
protected boolean isShowAuthorCache;
protected boolean isShowEpithets;
protected boolean isShowRank;
protected Button showEpithets;
protected Button showAuthorCache;
protected Button showAuthorship;
+ protected Button showInAuthors;
protected Button showNomenclaturalRef;
protected Button showNomenclaturalStatus;
protected Button showNomenclaturalStatusRuleConsidered;
setApply(true);
isShowAuthorship = showAuthorship.getSelection();
nameDetailsConfig.setAuthorshipSectionActivated(isShowAuthorship);
+ showInAuthors.setEnabled(isShowAuthorship);
}
});
+ showInAuthors = new Button(dbSettings, SWT.CHECK);
+ isShowInAuthors = nameDetailsConfig.isInAuthorshipActivated();
+ showInAuthors.setText(Messages.NameDetailsViewComposite_Show_In_Author);
+ showInAuthors.setSelection(isShowInAuthors);
+ showInAuthors.addSelectionListener(this);
+ showInAuthors.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setApply(true);
+ isShowInAuthors = showInAuthors.getSelection();
+ nameDetailsConfig.setInAuthorshipActivated(isShowInAuthors);
+ }
+ });
+ showInAuthors.setEnabled(isShowAuthorship);
+
showNomenclaturalRef = new Button(dbSettings, SWT.CHECK);
isShowNomenclaturalRef = nameDetailsConfig.isNomenclaturalReferenceSectionActivated();
showNomenclaturalRef.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalReference);
showEpithets.setSelection(isShowEpithets);
showAuthorCache.setSelection(isShowAuthorCache);
showAuthorship.setSelection(isShowAuthorship);
+ showInAuthors.setSelection(isShowInAuthors);
showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
isShowAppendedPhrase = nameDetailsConfig.isAppendedPhraseActivated();
isShowEpithets = nameDetailsConfig.isAtomisedEpithetsActivated();
isShowAuthorship = nameDetailsConfig.isAuthorshipSectionActivated();
+ isShowInAuthors = nameDetailsConfig.isInAuthorshipActivated();
isShowAuthorCache = nameDetailsConfig.isAuthorCacheActivated();
isShowLSID = nameDetailsConfig.isLSIDActivated();
isShowNameApprobiation = nameDetailsConfig.isNameApprobiationActivated();
*/
package eu.etaxonomy.taxeditor.preference;
+import java.util.ArrayList;
+import java.util.List;
+
+import eu.etaxonomy.cdm.api.service.ITermCollectionService;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
+import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.preference.wizard.GeneralVocabularyPreferencePage;
+import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @author k.luther
* @since 12.09.2019
*/
public class NamedAreaVocabularyPreferencePage extends GeneralVocabularyPreferencePage {
+ List<TermCollectionDto> collList = new ArrayList<>();
- public NamedAreaVocabularyPreferencePage(){
+ public NamedAreaVocabularyPreferencePage() {
isAdminPreference = false;
setPredicate(PreferencePredicate.AvailableDistributionAreaVocabularies);
type = TermType.NamedArea;
-
}
+ @Override
+ protected void initialiseVocabularies() {
+ List<TermVocabularyDto> vocs = new ArrayList<>();
+ collList = CdmStore.getService(ITermCollectionService.class).findCollectionDtoByTermType(type);
+ }
-// @Override
-// protected void performDefaults() {
-// if (!isAdminPreference){
-// if (!pref.isAllowOverride()) {
-// button_openSelectAreaVocabularies.setButtonEnabled(false);
-// }
-//
-// }
-//
-// prefAreaVoc = null;
-// refresh();
-// setApply(true);
-//
-// }
-
+ protected List<TermCollectionDto> getCollections() {
+ return collList;
+ }
+ @Override
+ protected void setInput() {
+ treeComposite.getViewer().getTree().deselectAll();
+ treeComposite.getViewer().refresh();
+ List<TermCollectionDto> collList = new ArrayList<>(getCollections());
+ treeComposite.getViewer().setInput(collList);
+ }
-}
+}
\ No newline at end of file
return isChecklistEditorEnabled();
}
if(SHOW_IO_MENU.equals(property)){
- boolean test = isShowIOMenuEnabled();
+// boolean test = isShowIOMenuEnabled();
return isShowIOMenuEnabled();
}
if(SHOW_SPECIMEN_MENU.equals(property)){
* 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.preference;
import java.io.File;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.equinox.internal.p2.ui.model.MetadataRepositoryElement;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.application.ICdmRepository;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeConfigurator;
-import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.api.service.ITermTreeService;
import eu.etaxonomy.cdm.api.service.IVocabularyService;
import eu.etaxonomy.cdm.api.service.config.FindTaxaAndNamesConfiguratorImpl;
import eu.etaxonomy.cdm.api.service.config.SecundumForSubtreeConfigurator;
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.common.URI;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacadeConfigurator;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
-import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
+import eu.etaxonomy.cdm.model.metadata.DistributionDescription;
import eu.etaxonomy.cdm.model.metadata.EnabledComputedDescription;
import eu.etaxonomy.cdm.model.metadata.IPreferencePredicate;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.metadata.SecReferenceHandlingSwapEnum;
import eu.etaxonomy.cdm.model.metadata.TermDisplayEnum;
import eu.etaxonomy.cdm.model.metadata.TermOrder;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
import eu.etaxonomy.cdm.model.term.IDefinedTerm;
import eu.etaxonomy.cdm.model.term.ISimpleTerm;
-import eu.etaxonomy.cdm.model.term.TermBase;
import eu.etaxonomy.cdm.model.term.TermTree;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.cdm.strategy.match.MatchException;
import eu.etaxonomy.cdm.strategy.match.MatchMode;
import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;
import eu.etaxonomy.taxeditor.remoting.source.ICdmRemoteSource;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.TermStore;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
-import eu.etaxonomy.taxeditor.ui.dialog.DefaultLanguageDialog;
/**
- * <p>
- * PreferencesUtil class.
- * </p>
- *
* @author p.ciardelli
* @author n.hoffmann
* @created 05.12.2008
*/
public class PreferencesUtil implements IPreferenceKeys {
+
+ private final static Logger logger = LogManager.getLogger(PreferencesUtil.class);
+
private final static String EDITOR_PREFERENCES_NODE = "eu.etaxonomy.taxeditor";
public static final String PREFERRED_TERMS_CHANGE = "preferred_terms";
private static TermTree<Feature> preferredTaxonFeatureTree;
-
- private final static Logger logger = LogManager.getLogger(PreferencesUtil.class);
-
public static IPreferenceStore getPreferenceStore() {
return TaxeditorStorePlugin.getDefault().getPreferenceStore();
}
}
}
- public static String getPreferredDefaultLangugae(){
- String preferredLanguage = getStringValue(DEFAULT_LANGUAGE_EDITOR, true);
- if(StringUtils.isNotEmpty(preferredLanguage) && StringUtils.isNotBlank(preferredLanguage)){
- return preferredLanguage;
- }
- return null;
- }
public static Language getPreferredDefaultLanguage(){
- String preferredLanguage = getStringValue(DEFAULT_LANGUAGE_EDITOR, true);
- if(StringUtils.isNotEmpty(preferredLanguage) && StringUtils.isNotBlank(preferredLanguage)){
- if (preferredLanguage.equals(Language.uuidEnglish.toString())) {
- return Language.ENGLISH();
- }else if (preferredLanguage.equals(Language.uuidGerman.toString())) {
- return Language.GERMAN();
- }else {
- return Language.ENGLISH();
- }
+
+
+ String prop = System.getProperty("osgi.nl");
+ if (prop.startsWith("de")) {
+ return Language.GERMAN();
+ }else {
+ return Language.ENGLISH();
}
- return Language.getDefaultLanguage();
+
+
+
}
-
+
public static boolean isShowMediaPreview(){
boolean isShowMediaPreview = getBooleanValue(SHOW_MEDIA_PREVIEW, true);
return isShowMediaPreview;
return pattern;
}
- public static <T extends TermBase> void addTermToPreferredTerms(T term) {
-
- // VocabularyEnum vocabulary =
- // VocabularyEnum.getVocabularyEnum(term.getClass());
- //
- // getPreferenceStore().setValue(getPreferenceKey(term),
- // VocabularyStore.getTermVocabulary(vocabulary).getTerms().contains(term));
- //
- // firePreferencesChanged(term.getClass());
- }
-
/**
* Construct a unique key using the CdmBase object's uuid
- *
- * @param cdmBase
- * @return
*/
public static String getPreferenceKey(ISimpleTerm<?> simpleTerm) {
simpleTerm = HibernateProxyHelper.deproxy(simpleTerm);
getPreferenceKey(preferredCode));
}
- public static void checkDefaultLanguage(){
- if(PreferencesUtil.getPreferredDefaultLangugae() == null){
- Shell shell = AbstractUtility.getShell();
- int open = new DefaultLanguageDialog(shell).open();
- if(open == Window.OK){
- PlatformUI.getWorkbench().restart();
- }
- }else{
- //TODO:In case of a reinstall, the config.ini will be overwritten
- // here you create config.ini with the stored key from preferences
- }
- }
-
public static String getMapServiceAccessPoint() {
return getStringValue(PreferencePredicate.EditMapServiceAccessPoint.getKey());
}
public static Language getGlobalLanguage() {
String languageUuidString = getStringValue(
- GLOBAL_LANGUAGE_UUID, true);
+ PreferencePredicate.TermLanguage.getKey(), true);
- if(!CdmStore.isActive()) {
- MessagingUtils.noDataSourceWarningDialog(languageUuidString);
- return null;
- }
+ CdmPreference dbPref = getDBPreferenceValue(PreferencePredicate.TermLanguage.getKey());
- if (CdmUtils.isBlank(languageUuidString)) {
- return Language.getDefaultLanguage();
+ if (dbPref == null || (dbPref != null && dbPref.isAllowOverride() && getOverrideForPreference(PreferencePredicate.TermLanguage.getKey()))) {
+ if (CdmUtils.isBlank(languageUuidString)) {
+ return Language.getDefaultLanguage();
+ }else {
+ return Language.getLanguageFromUuid(UUID.fromString(languageUuidString));
+ }
+ }else {
+ languageUuidString = dbPref.getValue();
}
-
UUID languageUuid = UUID.fromString(languageUuidString);
- return (Language) CdmStore.getService(ITermService.class).load(
- languageUuid);
+ Language language = (Language)CdmApplicationState.getTermProxy().load(languageUuid);
+ if (language != null){
+ return language;
+ }else{
+ MessagingUtils.noDataSourceWarningDialog(languageUuidString);
+ return null;
+ }
}
public static void setGlobalLanguage(Language language) {
if(language != null) {
- setStringValue(GLOBAL_LANGUAGE_UUID,language.getUuid().toString());
+ setStringValue(PreferencePredicate.TermLanguage.getKey(),language.getUuid().toString());
CdmStore.setDefaultLanguage(language);
+ }else {
+ CdmStore.setDefaultLanguage(Language.getDefaultLanguage());
}
}
* @param setLanguage 0 is for german and 1 for english.
* @throws IOException
*/
- public void writePropertyToConfigFile(int setLanguage) throws IOException {
+ public static void writePropertyToConfigFile(int setLanguage) throws IOException {
File file = org.eclipse.core.runtime.preferences.ConfigurationScope.INSTANCE.getLocation().toFile();
//give warning to user if the directory has no write access
if(file == null){
throw new IOException();
}
- Properties properties = load(file.getAbsolutePath()+"/config.ini");
+ Properties properties;
+ properties = load(file.getAbsolutePath()+"/config.ini");
switch(setLanguage){
case 0:
properties.setProperty("osgi.nl", "de");
break;
}
save(file+"/config.ini", properties);
+
+
}
/**
* @return
* @throws IOException
*/
- private Properties load(String filename) throws IOException {
+ private static Properties load(String filename) throws IOException {
FileInputStream in = new FileInputStream(filename);
Properties prop = new Properties();
prop.load(in);
* @param properties
* @throws IOException
*/
- private void save(String filename, Properties properties) throws IOException{
+ private static void save(String filename, Properties properties) throws IOException{
FileOutputStream fos = new FileOutputStream(filename);
properties.store(fos, "");
fos.close();
setStringValue(PreferencePredicate.DisplayOfAreasInDistributionEditor.getKey(), selection);
}
- public static void setOwnDescriptionForChecklistEditor(boolean selection) {
- setBooleanValue(PreferencePredicate.OwnDescriptionForDistributionEditor.getKey(), selection);
+ public static void setDescriptionForChecklistEditor(DistributionDescription selection) {
+ setStringValue(PreferencePredicate.DescriptionForDistributionEditor.getKey(), selection.getKey());
}
- public static boolean isOwnDescriptionForChecklistEditor() {
- return getBooleanValue(PreferencePredicate.OwnDescriptionForDistributionEditor.getKey());
+ public static DistributionDescription getDescriptionForChecklistEditor() {
+ String str = getStringValue(PreferencePredicate.DescriptionForDistributionEditor.getKey());
+
+ DistributionDescription result = null;
+ try {
+ result = DistributionDescription.byKey(str);
+ }catch(IllegalArgumentException e) {
+ result = (DistributionDescription)PreferencePredicate.DescriptionForDistributionEditor.getDefaultValue();
+ }
+ return result;
}
public static TermDisplayEnum displayAreaInChecklistEditor() {
PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.NameDetailsView);
preference = getPreferenceFromDB(PreferencePredicate.NameDetailsView);
if (preference == null){
- return null;
+ return new NameDetailsConfigurator();
}
// setBooleanValue(ALLOW_OVERRIDE_NAME_DETAILS, preference.isAllowOverride());
}
if (value!= null){
fillNameDetailsConfigurator(config, value);
-
-
}else {
- return null;
+ return new NameDetailsConfigurator();
}
return config;
}
if (value != null){
fillNameDetailsConfigurator(config, value);
}else {
- return null;
+ return new NameDetailsConfigurator();
}
return config;
}
}
if (keyString.equals("ignoreImportOfExistingSpecimen")){
config.setIgnoreImportOfExistingSpecimen(Boolean.valueOf(valueString));
- }else if (keyString.equals("addIndividualsAssociationsSuchAsSpecimenAndObservations")){
- config.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(Boolean.valueOf(valueString));
+ }else if (keyString.equals("addIndividualsAssociations")){
+ config.setAddIndividualsAssociations(Boolean.valueOf(valueString));
+ }else if (keyString.equals("addDeterminations")){
+ config.setAddDeterminations(Boolean.valueOf(valueString));
}else if (keyString.equals("reuseExistingTaxaWhenPossible")){
config.setReuseExistingTaxaWhenPossible(Boolean.valueOf(valueString));
}else if (keyString.equals("ignoreAuthorship")){
public static Abcd206ImportConfigurator getLastUsedAbcdImportConfigurator(){
Abcd206ImportConfigurator config = Abcd206ImportConfigurator.NewInstance(null,null);
- String configString = PreferencesUtil.getStringValue(IPreferenceKeys.LAST_USED_ABCD_CONFIG, true);
- if (configString != null){
- extractAbcdConfiguratorFromPreferenceString(config, configString);
- if (config != null){
- if (config.getNomenclaturalCode() == null){
- config.setNomenclaturalCode(getPreferredNomenclaturalCode());
- }
- }
- }else{
- config = PreferencesUtil.getLocalAbcdImportConfigurator(false);
- }
+ String configString = PreferencesUtil.getStringValue(IPreferenceKeys.LAST_USED_ABCD_CONFIG, true);
+ if (configString != null){
+ extractAbcdConfiguratorFromPreferenceString(config, configString);
+ if (config != null){
+ if (config.getNomenclaturalCode() == null){
+ config.setNomenclaturalCode(getPreferredNomenclaturalCode());
+ }
+ }
+ }else{
+ config = PreferencesUtil.getLocalAbcdImportConfigurator(false);
+ }
return config;
-
}
public static void updateAbcdImportConfigurationPreference() {
if (!getBooleanValue(prefOverrideKey(PreferencePredicate.AbcdImportConfig.getKey())) || !pref.isAllowOverride()){
resetToDBPreferenceAbcdCOnfigurator();
-
}
}
saveCheckedElements);
preference = CdmPreference.NewInstance(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AvailableDistributionAreaTerms, saveCheckedElements);
setPreferenceToDB(preference);
-
}
} else{
preference = CdmPreference.NewInstance(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AvailableDistributionAreaTerms, saveCheckedElements);
setPreferenceToDB(preference);
setStringValue(PreferencePredicate.AvailableDistributionAreaTerms.getKey(),
saveCheckedElements);
-
}
}
}
//Name Details
NameDetailsConfigurator config = getPreferredNameDetailsConfiguration(false);
-
}
public static void setPreferencesToDB(List<CdmPreference> preferences) {
for (CdmPreference preference: preferences){
if (preference.getValue() == null && preference.isAllowOverride()){
controller.getPreferenceService().remove(preference.getKey());
-
}else{
controller.getPreferenceService().set(preference);
-
}
-
}
CdmPreferenceCache.instance().getAllTaxEditorDBPreferences();
}
return getPreferenceStore().contains(prefKey(prefKey));
}
- /**
- *
- */
- public static TermTree<?> getPreferredFeatureTreeForNameDescription(boolean createNew) {
+ public static TermTree<Feature> getPreferredFeatureTreeForNameDescription(boolean createNew) {
if(preferredNameFeatureTree != null && !createNew){
return preferredNameFeatureTree;
}
if (terms.isEmpty()){
preferredNameFeatureTree = TermEditorInput.getDefaultNameFeatureTree();
}else{
- preferredNameFeatureTree = TermTree.NewInstance(terms);
+ preferredNameFeatureTree = TermTree.NewFeatureInstance(terms);
}
}
if (terms.isEmpty()){
preferredTaxonFeatureTree = TermEditorInput.getDefaultFeatureTree();
}else{
- preferredTaxonFeatureTree = TermTree.NewInstance(terms);
+ preferredTaxonFeatureTree = TermTree.NewFeatureInstance(terms);
}
}
*/
public class RankPreference extends GeneralTermPreferencePage {
- public RankPreference(){
+ public RankPreference() {
super();
isAdminPreference = false;
setPredicate(PreferencePredicate.AvailableRanks);
@Override
public boolean performOk() {
- if (!isApply()){
+ if (!isApply()) {
return true;
}
Object[] checkedElements = treeComposite.getViewer().getCheckedElements();
List<UUID> listUIIDChecked = new ArrayList<>();
List<TermDto> preferredTerms = new ArrayList<>();
for (Object o : checkedElements) {
- if(o instanceof TermDto){
+ if (o instanceof TermDto) {
TermDto termDto = (TermDto) o;
listUIIDChecked.add(termDto.getUuid());
preferredTerms.add(termDto);
PreferencesUtil.setStringValue(PreferencePredicate.AvailableRanks.getKey(), saveCheckedElements);
String text = this.useLocalOrAdmin.getText();
- if (text.equals(LocalOrDefaultEnum.Database.getLabel()) || text.equals(LocalOrDefaultEnum.Default.getLabel())){
- PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.AvailableRanks.getKey()), false);
- }else if (text.equals(LocalOrDefaultEnum.Local.getLabel())){
- PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.AvailableRanks.getKey()), true);
+ if (text.equals(LocalOrDefaultEnum.Database.getLabel()) || text.equals(LocalOrDefaultEnum.Default.getLabel())) {
+ PreferencesUtil.setBooleanValue(
+ PreferencesUtil.createOverridePreferenceString(PreferencePredicate.AvailableRanks.getKey()), false);
+ } else if (text.equals(LocalOrDefaultEnum.Local.getLabel())) {
+ PreferencesUtil.setBooleanValue(
+ PreferencesUtil.createOverridePreferenceString(PreferencePredicate.AvailableRanks.getKey()), true);
}
CdmStore.getTermManager().setPreferredTermsByType(preferredTerms, TermType.Rank);
}
-
-
-
-
-
}
*/
package eu.etaxonomy.taxeditor.preference.menu;
+import java.util.List;
+
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.IKeyLabel;
import eu.etaxonomy.cdm.model.metadata.IPreferencePredicate;
+import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.preference.IE4PreferencePage;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
return booleanCombo;
}
+
+ public Combo createComboTerms(Composite parent, List<DefinedTermBase> values, IPreferencePredicate predicate, String labelText, DefinedTermBase defaultTerm, boolean isAdminPage) {
+ final CLabel description = new CLabel(parent, SWT.NULL);
+ description.setText(labelText);
+ GridData textGrid = createTextGridData();
+ textGrid.verticalSpan = 2;
+ description.setLayoutData(textGrid);
+
+ Combo booleanCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
+
+ CdmPreference dbPref = PreferencesUtil.getPreferenceFromDB(predicate);
+ String defaultValue = " - ";
+ if (dbPref != null && !isAdminPage && dbPref.getValue() != null){
+ defaultValue = dbPref.getValue();
+ if (values != null && !values.isEmpty()){
+ for (DefinedTermBase value: values){
+ if (value.getUuid().toString().equals(defaultValue)){
+ defaultValue = value.getLabel();
+ }
+ }
+ }
+ }else {
+ try{
+ Object defaultObject = predicate.getDefaultValue();
+ if (defaultObject != null){
+ if (defaultObject instanceof DefinedTermBase){
+ defaultValue = ((DefinedTermBase)defaultObject).getLabel();
+ }else{
+ defaultValue = defaultObject.toString();
+ }
+ }else if (defaultTerm != null) {
+ defaultValue = defaultTerm.getLabel();
+ }
+ }catch(NullPointerException e){
+ defaultValue = "";
+ }
+ }
+
+ booleanCombo.add(Messages.Preference_Use_Default + " ("+defaultValue+")");
+ if (values != null){
+ for (DefinedTermBase value: values){
+ booleanCombo.add(value.getLabel());
+ booleanCombo.setData(value.getLabel(), value);
+ }
+ }
+
+ return booleanCombo;
+ }
public Boolean getBooleanPrefValue(CdmPreference pref) {
return pref != null? (pref.getValue()!= null?Boolean.valueOf(pref.getValue()): null): null;
import eu.etaxonomy.cdm.model.common.CdmClass;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermSorter;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>FeatureMenuPreferences class.</p>
+ * <p>
+ * FeatureMenuPreferences class.
+ * </p>
*
* @author p.ciardelli
* @author n.hoffmann
* @created 17.09.2008
* @version 1.0
*/
-public class FeatureMenuPreferences extends GeneralTermPreferencePage{
+public class FeatureMenuPreferences extends GeneralTermPreferencePage {
- /** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.preferences.feat"{trunked}</code> */
+ /**
+ * Constant
+ * <code>PLUGIN_ID="eu.etaxonomy.taxeditor.preferences.feat"{trunked}</code>
+ */
public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.preferences.taxonFeature"; //$NON-NLS-1$
/**
- * <p>Constructor for FeatureMenuPreference.</p>
+ * <p>
+ * Constructor for FeatureMenuPreference.
+ * </p>
*/
public FeatureMenuPreferences() {
super();
protected Control createContents(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
getPreferenceValues();
- if (isLocalPref() && !allowOverride){
+ if (isLocalPref() && !allowOverride) {
final CLabel description = new CLabel(parent, SWT.NULL);
description.setText(Messages.NameDetailsViewConfiguration_description_not_available);
this.setDefaultButtonActivated(false);
container.setLayout(gridLayout);
parent.setLayout(new GridLayout());
useLocalOrAdmin = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
- if (!isAdminPreference){
+ if (!isAdminPreference) {
useLocalOrAdmin.add(LocalOrDefaultEnum.Default.getLabel(), 0);
useLocalOrAdmin.add(LocalOrDefaultEnum.Local.getLabel(), 1);
- }else{
+ } else {
useLocalOrAdmin.add(LocalOrDefaultEnum.AllowOverride.getLabel(), 0);
useLocalOrAdmin.add(LocalOrDefaultEnum.Database.getLabel(), 1);
}
-
- treeComposite = new CheckBoxTreeComposite(container, new FeatureDtoContentProvider(true, false, false), new TermDtoLabelProvider(), SWT.SCROLL_PAGE);
+ treeComposite = new CheckBoxTreeComposite(container, new FeatureDtoContentProvider(true, false, false),
+ new TermDtoLabelProvider(), SWT.SCROLL_PAGE);
treeComposite.getViewer().setComparator(new DefinedTermSorter());
rememberCheckedValues(getCheckedValuesFromPreferences());
- if (isLocalPref()){
- if (isOverride){
+ if (isLocalPref()) {
+ if (isOverride) {
useLocalOrAdmin.select(1);
- }else{
+ } else {
useLocalOrAdmin.select(0);
- if (treeComposite.getViewer().getTree() != null && treeComposite.getViewer().getTree().getTopItem() != null) {
+ if (treeComposite.getViewer().getTree() != null
+ && treeComposite.getViewer().getTree().getTopItem() != null) {
treeComposite.getViewer().getTree().setSelection(treeComposite.getViewer().getTree().getTopItem());
}
treeComposite.setEnabled(false);
- //treeComposite.getViewer().getTree().getVerticalBar().setEnabled(true);
+ // treeComposite.getViewer().getTree().getVerticalBar().setEnabled(true);
}
- }else{
- if (allowOverride){
+ } else {
+ if (allowOverride) {
useLocalOrAdmin.select(0);
- }else{
+ } else {
useLocalOrAdmin.select(1);
}
}
}
-
-
@Override
- public boolean performOk(){
- if (isApply()){
+ public boolean performOk() {
+ if (isApply()) {
boolean result = super.performOk();
- if (result){
+ if (result) {
TermEditorInput.getPreferredTaxonFeatureTree(true);
}
}
Set<CdmClass> availableFor = new HashSet<>();
availableFor.add(CdmClass.TAXON);
vocs = CdmStore.getService(IVocabularyService.class).findFeatureVocabularyDtoByTermTypes(availableFor);
+
setVocabularies(vocs);
-// super.initialiseVocabularies();
-
+ // super.initialiseVocabularies();
-
-// List<TermVocabularyDto> vocs = new ArrayList<>();
-// vocs.add(CdmStore.getService(IVocabularyService.class).findVocabularyDtoByVocabularyUuid(VocabularyEnum.NameFeature.getUuid()));
-// this.getVocabularies().removeAll(vocs);
+ // List<TermVocabularyDto> vocs = new ArrayList<>();
+ // vocs.add(CdmStore.getService(IVocabularyService.class).findVocabularyDtoByVocabularyUuid(VocabularyEnum.NameFeature.getUuid()));
+ // this.getVocabularies().removeAll(vocs);
}
ITermService termService = CdmStore.getService(ITermService.class);
List<UUID> uuidList = new ArrayList();
for (String s : listValue) {
- if (!StringUtils.isBlank(s)){
+ if (!StringUtils.isBlank(s)) {
UUID uuid = UUID.fromString(s);
uuidList.add(uuid);
}
}
- if (!uuidList.isEmpty()){
+ if (!uuidList.isEmpty()) {
termlist = termService.findFeatureByUUIDsAsDto(uuidList);
}
- if (listValue == null || listValue.isEmpty() ){
+ if (listValue == null || listValue.isEmpty()) {
termlist = termService.findFeatureByTitleAsDto("");
+ Collection<TermDto> tempTermlist = new ArrayList<>();
+ for (TermDto dto: termlist) {
+ if (((FeatureDto)dto).isAvailableForTaxon()) {
+ tempTermlist.add(dto);
+ }
+ }
+ termlist = tempTermlist;
}
return new ArrayList(termlist);
}
-
-
}
*
*/
public class NameFeatureMenuPreference extends GeneralTermPreferencePage {
- /** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.preferences.feat"{trunked}</code> */
+ /**
+ * Constant
+ * <code>PLUGIN_ID="eu.etaxonomy.taxeditor.preferences.feat"{trunked}</code>
+ */
public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.preferences.nameFeature"; //$NON-NLS-1$
@Inject
private IEventBroker eventBroker;
+
/**
- * <p>Constructor for NameFeatureMenuPreference.</p>
+ * <p>
+ * Constructor for NameFeatureMenuPreference.
+ * </p>
*/
public NameFeatureMenuPreference() {
super();
protected Control createContents(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
getPreferenceValues();
- if (isLocalPref() && !allowOverride){
+ if (isLocalPref() && !allowOverride) {
final CLabel description = new CLabel(parent, SWT.NULL);
description.setText(Messages.NameDetailsViewConfiguration_description_not_available);
this.setDefaultButtonActivated(false);
container.setLayout(gridLayout);
parent.setLayout(new GridLayout());
useLocalOrAdmin = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
- if (!isAdminPreference){
+ if (!isAdminPreference) {
useLocalOrAdmin.add(LocalOrDefaultEnum.Default.getLabel(), 0);
useLocalOrAdmin.add(LocalOrDefaultEnum.Local.getLabel(), 1);
- }else{
+ } else {
useLocalOrAdmin.add(LocalOrDefaultEnum.AllowOverride.getLabel(), 0);
useLocalOrAdmin.add(LocalOrDefaultEnum.Database.getLabel(), 1);
}
-
- treeComposite = new CheckBoxTreeComposite(container, new FeatureDtoContentProvider(false, true, false), new TermDtoLabelProvider(), SWT.SCROLL_PAGE);
+ treeComposite = new CheckBoxTreeComposite(container, new FeatureDtoContentProvider(false, true, false),
+ new TermDtoLabelProvider(), SWT.SCROLL_PAGE);
treeComposite.getViewer().setComparator(new DefinedTermSorter());
rememberCheckedValues(getCheckedValuesFromPreferences());
- if (isLocalPref()){
- if (isOverride){
+ if (isLocalPref()) {
+ if (isOverride) {
useLocalOrAdmin.select(1);
- }else{
+ } else {
useLocalOrAdmin.select(0);
- if (treeComposite.getViewer().getTree() != null && treeComposite.getViewer().getTree().getTopItem() != null) {
+ if (treeComposite.getViewer().getTree() != null
+ && treeComposite.getViewer().getTree().getTopItem() != null) {
treeComposite.getViewer().getTree().setSelection(treeComposite.getViewer().getTree().getTopItem());
}
treeComposite.setEnabled(false);
- //treeComposite.getViewer().getTree().getVerticalBar().setEnabled(true);
+ // treeComposite.getViewer().getTree().getVerticalBar().setEnabled(true);
}
- }else{
- if (allowOverride){
+ } else {
+ if (allowOverride) {
useLocalOrAdmin.select(0);
- }else{
+ } else {
useLocalOrAdmin.select(1);
}
}
}
-
@Override
- public boolean performOk(){
- if (isApply()){
+ public boolean performOk() {
+ if (isApply()) {
boolean result = super.performOk();
- if (result){
+ if (result) {
PreferencesUtil.getPreferredFeatureTreeForNameDescription(true);
}
}
ITermService termService = CdmStore.getService(ITermService.class);
List<UUID> uuidList = new ArrayList();
for (String s : listValue) {
- if (!StringUtils.isBlank(s)){
+ if (!StringUtils.isBlank(s)) {
UUID uuid = UUID.fromString(s);
uuidList.add(uuid);
}
}
- if (!uuidList.isEmpty()){
+ if (!uuidList.isEmpty()) {
termlist = termService.findFeatureByUUIDsAsDto(uuidList);
}
- if (listValue == null || listValue.isEmpty() ){
+ if (listValue == null || listValue.isEmpty()) {
termlist = termService.findFeatureByTitleAsDto("");
}
return new ArrayList(termlist);
}
-
}
*/
package eu.etaxonomy.taxeditor.preference.wizard;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import eu.etaxonomy.cdm.api.service.IVocabularyService;
+import eu.etaxonomy.cdm.api.service.ITermCollectionService;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.persistence.dto.AbstractTermDto;
-import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermSorter;
import eu.etaxonomy.taxeditor.editor.definedterm.TermDtoContentProvider;
import eu.etaxonomy.taxeditor.editor.definedterm.TermDtoLabelProvider;
public abstract class AbstractTermSelectionWizardPage<T extends AbstractTermDto> extends WizardPage {
protected CheckBoxTreeComposite treeComposite;
- private List<TermVocabularyDto> vocabularies = new ArrayList<>();
+ private List<TermCollectionDto> vocabularies = new ArrayList<>();
+
boolean localPref;
protected CdmPreference pref;
protected boolean override;
}
@Override
- public void createControl(Composite parent){
+ public void createControl(Composite parent) {
parent.setLayout(new GridLayout());
- treeComposite = new CheckBoxTreeComposite(parent, new TermDtoContentProvider(), new TermDtoLabelProvider(), SWT.NONE);
+ treeComposite = new CheckBoxTreeComposite(parent, new TermDtoContentProvider(), new TermDtoLabelProvider(),
+ SWT.NONE);
treeComposite.getViewer().setComparator(new DefinedTermSorter());
rememberCheckedValues(getCheckedValuesFromPreferences());
treeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
protected abstract String getCheckedValuesFromPreferences();
- public CheckboxTreeViewer getViewer(){
+ public CheckboxTreeViewer getViewer() {
return treeComposite.getViewer();
}
- public List<TermVocabularyDto> getVocabularies() {
+ public List<TermCollectionDto> getVocabularies() {
return vocabularies;
}
- public void addVocabularies(TermVocabularyDto vocabulary) {
+ public void addVocabularies(TermCollectionDto vocabulary) {
this.vocabularies.add(vocabulary);
}
- protected void setVocabularies(List<TermVocabularyDto> vocs) {
+ protected void setVocabularies(List<TermCollectionDto> vocs) {
vocabularies = vocs;
}
initialiseVocabularies();
treeComposite.getViewer().setInput(getVocabularies());
+
List<T> termsFromStringValues = null;
if (checkedValues != null && checkedValues != "") { //$NON-NLS-1$
String[] listChecked = checkedValues.split(";"); //$NON-NLS-1$
String[] listCheckedComma = checkedValues.split(","); //$NON-NLS-1$
List<String> checked = new ArrayList<>();
- if (listChecked != null ){
+ if (listChecked != null) {
checked = Arrays.asList(listChecked);
}
- if (listCheckedComma != null && checkedValues.contains(",")){ //$NON-NLS-1$
+ if (listCheckedComma != null && checkedValues.contains(",")) { //$NON-NLS-1$
checked = Arrays.asList(listCheckedComma);
}
termsFromStringValues = getTermsFromStringValues(checked);
- if (termsFromStringValues != null){
+ if (termsFromStringValues != null) {
treeComposite.setCheckedElements(termsFromStringValues.toArray());
}
}
- if (termsFromStringValues == null){
+ if (termsFromStringValues == null) {
termsFromStringValues = getTermsFromStringValues(new ArrayList<String>());
- if (termsFromStringValues != null){
+ if (termsFromStringValues != null) {
treeComposite.setCheckedElements(termsFromStringValues.toArray());
}
}
}
-
-
protected void initialiseVocabularies() {
if (getVocabularies() != null) {
getVocabularies().clear();
}
- List<TermVocabularyDto> vocs = new ArrayList<>();
- vocs = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermType(type);
+
+ List<TermCollectionDto> vocs = new ArrayList<>();
+ vocs = CdmStore.getService(ITermCollectionService.class).findCollectionDtoByTermType(type);
setVocabularies(vocs);
+
}
- protected abstract List<TermVocabularyDto> getVocabulariesFromPreference();
+ protected abstract List<TermCollectionDto> getVocabulariesFromPreference();
/**
* @param listValue
protected abstract List<T> getTermsFromStringValues(List<String> listValue);
protected Button createAllowOverrideButton(Composite parent) {
- Button activateCheckButton = new Button(parent, SWT.CHECK);
- if (localPref){
- activateCheckButton.setText("Override");
- activateCheckButton.setSelection(override);
- }else{
- activateCheckButton.setText("Allow Override");
- activateCheckButton.setSelection(override);
- }
-
-
+ Button activateCheckButton = new Button(parent, SWT.CHECK);
+ if (localPref) {
+ activateCheckButton.setText("Override");
+ activateCheckButton.setSelection(override);
+ } else {
+ activateCheckButton.setText("Allow Override");
+ activateCheckButton.setSelection(override);
+ }
- activateCheckButton.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- pref.setAllowOverride(activateCheckButton.getSelection());
- override = activateCheckButton.getSelection();
+ activateCheckButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ pref.setAllowOverride(activateCheckButton.getSelection());
+ override = activateCheckButton.getSelection();
- }
- });
+ }
+ });
return activateCheckButton;
}
import org.apache.commons.lang3.StringUtils;
import org.eclipse.swt.widgets.Composite;
-import eu.etaxonomy.cdm.api.service.IVocabularyService;
+import eu.etaxonomy.cdm.api.service.ITermCollectionService;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.taxeditor.editor.definedterm.RootElementsOnlyTreeContentProvider;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
-
/**
* @author k.luther
* @since 04.06.2018
*
*/
-public class AvailableAreaVocabulariesPage extends AbstractTermSelectionWizardPage<TermVocabularyDto>{
+public class AvailableAreaVocabulariesPage extends AbstractTermSelectionWizardPage<TermCollectionDto> {
String featureTitle;
this.featureTitle = featureTitle;
this.pref = pref;
-
}
-// public AvailableAreaVocabulariesPage(String pageName, boolean localPref, CdmPreference pref, String featureTitle) {
-// this(pageName, localPref, pref, featureTitle);
-//
-// }
+ // public AvailableAreaVocabulariesPage(String pageName, boolean localPref,
+ // CdmPreference pref, String featureTitle) {
+ // this(pageName, localPref, pref, featureTitle);
+ //
+ // }
@Override
public void createControl(Composite parent) {
setTitle(String.format(Messages.AvailableAreaVocabulariesPage_PAGE_TITLE, featureTitle));
setDescription(String.format(Messages.AvailableAreaVocabulariesPage_PAGE_DESCRIPTION, featureTitle));
- if (!localPref){
+ if (!localPref) {
createAllowOverrideButton(parent);
}
treeComposite.setAllowTopLevelSelection(true);
}
-
-
@Override
protected String getCheckedValuesFromPreferences() {
String vocString = null;
- if (localPref){
+ if (localPref) {
vocString = PreferencesUtil.getPreferredVocabulariesForDistributionEditor(localPref);
- if (StringUtils.isBlank(vocString) && pref != null){
+ if (StringUtils.isBlank(vocString) && pref != null) {
vocString = pref.getValue();
}
this.override = PreferencesUtil.getOverrideForPreference(pref.getPredicate());
- }else if (pref != null){
+ } else if (pref != null) {
vocString = pref.getValue();
}
return vocString;
}
-
-
-
-
/**
* {@inheritDoc}
*/
@Override
- protected List<TermVocabularyDto> getVocabulariesFromPreference() {
+ protected List<TermCollectionDto> getVocabulariesFromPreference() {
// TODO Auto-generated method stub
return null;
}
+
@Override
protected void rememberCheckedValues(String checkedValues) {
initialiseVocabularies();
String[] listChecked = checkedValues.split(";"); //$NON-NLS-1$
String[] listCheckedComma = checkedValues.split(","); //$NON-NLS-1$
List<String> checked = new ArrayList<>();
- if (listChecked != null ){
+ if (listChecked != null) {
checked = Arrays.asList(listChecked);
}
- if (listCheckedComma != null && checkedValues.contains(",")){ //$NON-NLS-1$
+ if (listCheckedComma != null && checkedValues.contains(",")) { //$NON-NLS-1$
checked = Arrays.asList(listCheckedComma);
}
- List<TermVocabularyDto> termsFromStringValues = getTermsFromStringValues(checked);
+ List<TermCollectionDto> termsFromStringValues = getTermsFromStringValues(checked);
treeComposite.setCheckedElements(termsFromStringValues.toArray());
- }else{
+ } else {
treeComposite.getViewer().setAllChecked(true);
}
}
@Override
- protected List<TermVocabularyDto> getTermsFromStringValues(List<String> listValue) {
- List<TermVocabularyDto> termlist = new ArrayList<>();
+ protected List<TermCollectionDto> getTermsFromStringValues(List<String> listValue) {
+ List<TermCollectionDto> termlist = new ArrayList<>();
List<UUID> uuidList = new ArrayList<>();
for (String s : listValue) {
- if (!StringUtils.isBlank(s)){
+ if (!StringUtils.isBlank(s)) {
UUID uuid = UUID.fromString(s);
uuidList.add(uuid);
}
}
- IVocabularyService vocabularyService = CdmStore.getService(IVocabularyService.class);
-
- termlist = vocabularyService.findVocabularyDtoByVocabularyUuids(uuidList);
-
-
+ ITermCollectionService vocabularyService = CdmStore.getService(ITermCollectionService.class);
+ // ITermTreeService treeService =
+ // CdmStore.getService(ITermTreeService.class);
+ termlist = vocabularyService.findTermCollectionDtoByUuids(uuidList);
return termlist;
}
-
-
-
}
import java.util.UUID;
import org.apache.commons.lang3.StringUtils;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import eu.etaxonomy.cdm.api.service.ITermCollectionService;
import eu.etaxonomy.cdm.api.service.ITermService;
-import eu.etaxonomy.cdm.api.service.IVocabularyService;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
-import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
+import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
+import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
+import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermSorter;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermDtoContentProvider;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermDtoLabelProvider;
import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.preference.AreaCheckBoxTreeComposite;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
*
*/
public class AvailableDistributionPage extends AbstractTermSelectionWizardPage<TermDto> {
-
-
+
+
public AvailableDistributionPage(String pageName) {
super(pageName, TermType.NamedArea);
this.localPref = true;
-
}
-
@Override
public void createControl(Composite parent) {
setTitle(Messages.AvailableDistributionPage_PAGE_TITLE);
setDescription(Messages.AvailableDistributionPage_PAGE_DESCRIPTION);
+ parent.setLayout(new GridLayout());
+ treeComposite = new AreaCheckBoxTreeComposite(parent, new TermDtoContentProvider(), new TermDtoLabelProvider(),
+ SWT.NONE);
+ treeComposite.getViewer().setComparator(new DefinedTermSorter());
+ rememberCheckedValues(getCheckedValuesFromPreferences());
+ treeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ setControl(treeComposite);
+ parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ ((GridData)parent.getLayoutData()).minimumHeight= 400;
+
- super.createControl(parent);
}
+
@Override
protected String getCheckedValuesFromPreferences() {
- String checkedValues = PreferencesUtil.getStringValue(PreferencePredicate.AvailableDistributionAreaTerms.getKey(), true);
+ String checkedValues = PreferencesUtil
+ .getStringValue(PreferencePredicate.AvailableDistributionAreaTerms.getKey(), true);
return checkedValues;
}
@Override
protected void rememberCheckedValues(String checkedValues) {
initialiseVocabularies();
+ List<TermCollectionDto> collections = new ArrayList<>();
+ collections.addAll(getVocabularies());
- treeComposite.getViewer().setInput(getVocabularies());
+ treeComposite.getViewer().setInput(collections);
if (checkedValues != null && checkedValues != "") { //$NON-NLS-1$
String[] listChecked = checkedValues.split(";"); //$NON-NLS-1$
String[] listCheckedComma = checkedValues.split(","); //$NON-NLS-1$
List<String> checked = new ArrayList<>();
- if (listChecked != null ){
+ if (listChecked != null) {
checked = Arrays.asList(listChecked);
}
- if (listCheckedComma != null && checkedValues.contains(",")){ //$NON-NLS-1$
+ if (listCheckedComma != null && checkedValues.contains(",")) { //$NON-NLS-1$
checked = Arrays.asList(listCheckedComma);
}
List<TermDto> termsFromStringValues = getTermsFromStringValues(checked);
- treeComposite.setCheckedElements(termsFromStringValues.toArray());
+ List<TermNodeDto> nodes = new ArrayList<>();
+ //check whether the term is contained in tree(s)
+ Map<TermDto, Set<TermNodeDto>> mapTermsToNodes = new HashMap<>();
+ for (TermCollectionDto coll: collections) {
+ if (coll instanceof TermTreeDto) {
+ for (TermDto term:coll.getTerms()) {
+ TermNodeDto node = ((TermTreeDto)coll).getNodeWithTerm(term, ((TermTreeDto)coll).getRoot());
+ if (node != null) {
+ if (mapTermsToNodes.get(term) == null) {
+ mapTermsToNodes.put(term, new HashSet<>());
+ }
+ mapTermsToNodes.get(term).add(node);
+ }
+ }
+ }
+ }
+
+ for (TermDto term: termsFromStringValues) {
+ for (TermCollectionDto coll: collections) {
+ if(coll.getTerms().contains(term) && coll instanceof TermTreeDto) {
+ TermNodeDto node = ((TermTreeDto)coll).getNodeWithTerm(term, ((TermTreeDto)coll).getRoot());
+ if(node!= null) {
+ nodes.add(node);
+ }
+ }
+ }
+ }
+ List<Object> termsAndNodesList = new ArrayList<>();
+ termsAndNodesList.addAll(termsFromStringValues);
+ termsAndNodesList.addAll(nodes);
+
+ Object[] termsAndNodes = termsAndNodesList.toArray();
+ treeComposite.setCheckedElements(termsAndNodes);
+ ((AreaCheckBoxTreeComposite)treeComposite).setMapTermsToNodes(mapTermsToNodes);
+
}
}
@Override
public void dispose() {
- // CdmStore.getCurrentSessionManager().dispose(this);
+ // CdmStore.getCurrentSessionManager().dispose(this);
super.dispose();
}
-// @Override
-// public ICdmEntitySession getCdmEntitySession() {
-// return CdmStore.getCurrentSessionManager().getNullSession();
-// }
-//
-// @Override
-// public <T extends CdmBase> Collection<T> getRootEntities() {
-// return null;
-// }
-//
-// @Override
+ // @Override
+ // public ICdmEntitySession getCdmEntitySession() {
+ // return CdmStore.getCurrentSessionManager().getNullSession();
+ // }
+ //
+ // @Override
+ // public <T extends CdmBase> Collection<T> getRootEntities() {
+ // return null;
+ // }
+ //
+ // @Override
public Map<Object, List<String>> getPropertyPathsMap() {
Map<Object, List<String>> propertyPathsMap = new HashMap<Object, List<String>>();
- List<String> termsPropertyPaths = Arrays.asList(new String[] {
- "includes" //$NON-NLS-1$
+ List<String> termsPropertyPaths = Arrays.asList(new String[] { "includes" //$NON-NLS-1$
});
propertyPathsMap.put("includes", termsPropertyPaths); //$NON-NLS-1$
propertyPathsMap.put("terms", termsPropertyPaths); //$NON-NLS-1$
}
@Override
- protected List<TermVocabularyDto> getVocabulariesFromPreference(){
- List<TermVocabularyDto> vocs = new ArrayList<>();
-
- if (PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies) == null && PreferencesUtil.getStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey()) == null){
- vocs = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermType(type);
- }else{
- String vocString = PreferencesUtil.getStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey());
- if (vocString == null || vocString.equals("")){
- vocs = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermType(type);
+ protected List<TermCollectionDto> getVocabulariesFromPreference() {
+ List<TermCollectionDto> vocs = new ArrayList<>();
+
+ if (PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies) == null
+ && PreferencesUtil
+ .getStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey()) == null) {
+ vocs = CdmStore.getService(ITermCollectionService.class).findCollectionDtoByTermType(type);
+ } else {
+ String vocString = PreferencesUtil
+ .getStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey());
+ if (vocString == null || vocString.equals("")) {
+ vocs = CdmStore.getService(ITermCollectionService.class).findCollectionDtoByTermType(type, true);
return vocs;
}
String[] arrayVocs = vocString.split(";"); //$NON-NLS-1$
- Set<UUID> uuidVocs = new HashSet<>();
- for (String voc: arrayVocs){
- if (!StringUtils.isBlank(voc)){
+ List<UUID> uuidVocs = new ArrayList<>();
+ for (String voc : arrayVocs) {
+ if (!StringUtils.isBlank(voc)) {
uuidVocs.add(UUID.fromString(voc));
}
}
- List<TermVocabulary> tempVocs = CdmStore.getService(IVocabularyService.class).find(uuidVocs);
- for (TermVocabulary<?> voc: tempVocs){
- vocs.add(new TermVocabularyDto(voc.getUuid(), voc.getRepresentations(), voc.getTermType(), voc.getTitleCache(), voc.isAllowDuplicates(), voc.isOrderRelevant(), voc.isFlat()));
- }
+ List<TermCollectionDto> tempVocs = CdmStore.getService(ITermCollectionService.class)
+ .findTermCollectionDtoByUuids(uuidVocs);
+ vocs.addAll(tempVocs);
+ // tempVocs =
+ // CdmStore.getService(ITermTreeService.class).getTermTreeDtosByUuids(uuidVocs);
+ // for (TermVocabulary<?> voc : tempVocs) {
+ // vocs.add(new TermVocabularyDto(voc.getUuid(),
+ // voc.getRepresentations(), voc.getTermType(),
+ // voc.getTitleCache(), voc.isAllowDuplicates(),
+ // voc.isOrderRelevant(), voc.isFlat()));
+ // }
}
return vocs;
}
+
@Override
protected void initialiseVocabularies() {
if (getVocabularies() != null) {
getVocabularies().clear();
}
- List<TermVocabularyDto> vocs = new ArrayList<>();
+
+ List<TermCollectionDto> vocs = new ArrayList<>();
vocs = getVocabulariesFromPreference();
+ List<TermCollectionDto> trees = new ArrayList<>();
+ // trees =
+ // CdmStore.getService(ITermTreeService.class).listTermTreeDtosByTermType(type);
+ // vocs
setVocabularies(vocs);
+
}
@Override
protected List<TermDto> getTermsFromStringValues(List<String> listValue) {
- List<TermDto> termlist = new ArrayList<>();
- ITermService termService = CdmStore.getService(ITermService.class);
- List<UUID> uuidList = new ArrayList<>();
- for (String s : listValue) {
- if (!StringUtils.isBlank(s)){
- UUID uuid = UUID.fromString(s);
- uuidList.add(uuid);
- }
+ List<TermDto> termlist = new ArrayList<>();
+ ITermService termService = CdmStore.getService(ITermService.class);
+ List<UUID> uuidList = new ArrayList<>();
+ for (String s : listValue) {
+ if (!StringUtils.isBlank(s)) {
+ UUID uuid = UUID.fromString(s);
+ uuidList.add(uuid);
}
- termlist = new ArrayList<>(termService.findByUUIDsAsDto(uuidList));
-
+ }
+ termlist = new ArrayList<>(termService.findByUUIDsAsDto(uuidList));
- if (listValue.isEmpty()){
- List<DefinedTermBase> terms = CdmStore.getTermManager().getAllTerms(type, null);
- for (DefinedTermBase<?> term: terms){
- termlist.add(TermDto.fromTerm(term, true));
- }
+ if (listValue.isEmpty()) {
+ List<DefinedTermBase> terms = CdmStore.getTermManager().getAllTerms(type, null);
+ for (DefinedTermBase<?> term : terms) {
+ termlist.add(TermDto.fromTerm(term, true));
}
+ }
- return termlist;
-
+ return termlist;
}
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
+import eu.etaxonomy.cdm.api.service.ITermCollectionService;
import eu.etaxonomy.cdm.api.service.ITermService;
-import eu.etaxonomy.cdm.api.service.IVocabularyService;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
import eu.etaxonomy.cdm.model.metadata.PreferenceResolver;
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
-import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.ImageResources;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
* @since 05.10.2018
*
*/
-public class AvailableDistributionPerAreaStatusPage extends AvailableDistributionStatusPage implements IPropertyChangeListener{
+public class AvailableDistributionPerAreaStatusPage extends AvailableDistributionStatusPage
+ implements IPropertyChangeListener {
List<CdmPreference> perAreaPreferences = new ArrayList();
List<CdmPreference> perAreaPreferencesDeleteList = new ArrayList();
- List<TermVocabularyDto> vocs;
+ List<TermCollectionDto> vocs;
NamedArea actualArea;
CdmPreference actualPref;
Text areaText;
String namedAreaString;
-
-
Button btnSelectArea;
Button btnRemove;
Label status;
int countTerms;
-
public AvailableDistributionPerAreaStatusPage(String pageName, List<CdmPreference> prefs, boolean localPref) {
super(pageName, null, localPref);
perAreaPreferences = prefs;
- if(PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies) == null && PreferencesUtil.getStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey()) == null){
- vocs = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermType(type);
+ if (PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies) == null
+ && PreferencesUtil
+ .getStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey()) == null) {
+ vocs = CdmStore.getService(ITermCollectionService.class).findCollectionDtoByTermType(type);
}
pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionStatus);
- if (pref == null){
+ if (pref == null) {
pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionStatus, null);
}
initialiseVocabularies();
countTerms = CdmStore.getTermManager().getPreferredTerms(type).size();
}
-
-
@Override
public void createControl(Composite parent) {
setTitle(Messages.AvailableDistributionStatusPage_PAGE_TITLE);
super.createControl(parent);
-
-
}
+
@Override
protected Button createAllowOverrideButton(Composite parent) {
Button activateCheckButton = new Button(parent, SWT.CHECK);
- if (localPref){
+ if (localPref) {
activateCheckButton.setText("Override");
activateCheckButton.setSelection(override);
- }else{
+ } else {
activateCheckButton.setText("Allow Override");
activateCheckButton.setSelection(override);
}
- activateCheckButton.addSelectionListener(new SelectionAdapter(){
+ activateCheckButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- if (actualPref != null){
- actualPref.setAllowOverride(activateCheckButton.getSelection());
+ if (actualPref != null) {
+ actualPref.setAllowOverride(activateCheckButton.getSelection());
}
override = activateCheckButton.getSelection();
}
});
- return activateCheckButton;
- }
+ return activateCheckButton;
+ }
protected void createAreaSelectionCombo(Composite parent) {
GridData textData = new GridData();
textData.minimumWidth = 200;
textData.widthHint = 200;
- areaText = new Text(toolbar, SWT.NONE);
+ areaText = new Text(toolbar, SWT.NONE);
areaText.setEditable(false);
- areaText.setBackground(StoreUtil
- .getColor(Resources.COLOR_TEXT_DISABLED_BACKGROUND));
+ areaText.setBackground(StoreUtil.getColor(Resources.COLOR_TEXT_DISABLED_BACKGROUND));
areaText.setLayoutData(textData);
- if (actualArea != null){
+ if (actualArea != null) {
areaText.setText(actualArea.getLabel());
areaText.setEnabled(false);
}
- btnSelectArea = new Button(toolbar, SWT.PUSH | SWT.FLAT );
- btnSelectArea.setImage(ImageResources
- .getImage(ImageResources.BROWSE_ICON));
+ btnSelectArea = new Button(toolbar, SWT.PUSH | SWT.FLAT);
+ btnSelectArea.setImage(ImageResources.getImage(ImageResources.BROWSE_ICON));
btnSelectArea.setToolTipText("Browse Area");
- btnSelectArea.addSelectionListener(new SelectionListener(){
+ btnSelectArea.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
refreshActualPrefernce();
- NamedArea selection = SelectionDialogFactory.getSelectionFromDialog(NamedArea.class, getShell(), //getConversationHolder(),
+ NamedArea selection = SelectionDialogFactory.getSelectionFromDialog(NamedArea.class, getShell(),
actualArea, null);
actualArea = selection;
PrefKey key;
- if (actualArea != null){
+ if (actualArea != null) {
areaText.setText(actualArea.getLabel());
key = newAreaSpecificStatusPreference();
actualPref = PreferenceResolver.resolve(perAreaPreferences, key);
- if (actualPref == null){
+ if (actualPref == null) {
actualPref = CdmPreference.NewInstance(key, null);
perAreaPreferences.add(actualPref);
}
override = actualPref.isAllowOverride();
- }else{
+ } else {
actualPref = null;
}
}
});
-// btnRemove = new Button(toolbar, SWT.NONE);
-// btnRemove.addSelectionListener(new SelectionListener(){
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-//
-// PrefKey key = newAreaSpecificStatusPreference();
-// actualPref = PreferenceResolver.resolve(perAreaPreferences, key);
-// actualPref = CdmPreference.NewInstance(key, null);
-// if (actualPref.getKey().equals(pref.getKey())){
-// pref = actualPref;
-// }
-//
-// perAreaPreferences.add(actualPref);
-// if (actualArea != null){
-// status.setText("Preference for area " + actualArea.getLabel() + " removed. Now the status defined for all areas are displayed");
-// }else{
-// status.setText("Preference for all areas is removed. Now all status will be displayed");
-// }
-// status.setVisible(true);
-//
-// actualArea = null;
-//
-// areaText.setText("");
-// rememberCheckedValues(getCheckedValuesFromPreferences());
-//
-// }
-//
-// @Override
-// public void widgetDefaultSelected(SelectionEvent e) {
-// // TODO Auto-generated method stub
-//
-// }
-//
-// });
-// btnRemove.setImage(ImageResources.getImage(ImageResources.ACTIVE_DELETE_ICON));
-// btnRemove.setToolTipText("");
+ // btnRemove = new Button(toolbar, SWT.NONE);
+ // btnRemove.addSelectionListener(new SelectionListener(){
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ //
+ // PrefKey key = newAreaSpecificStatusPreference();
+ // actualPref = PreferenceResolver.resolve(perAreaPreferences, key);
+ // actualPref = CdmPreference.NewInstance(key, null);
+ // if (actualPref.getKey().equals(pref.getKey())){
+ // pref = actualPref;
+ // }
+ //
+ // perAreaPreferences.add(actualPref);
+ // if (actualArea != null){
+ // status.setText("Preference for area " + actualArea.getLabel() + "
+ // removed. Now the status defined for all areas are displayed");
+ // }else{
+ // status.setText("Preference for all areas is removed. Now all status
+ // will be displayed");
+ // }
+ // status.setVisible(true);
+ //
+ // actualArea = null;
+ //
+ // areaText.setText("");
+ // rememberCheckedValues(getCheckedValuesFromPreferences());
+ //
+ // }
+ //
+ // @Override
+ // public void widgetDefaultSelected(SelectionEvent e) {
+ // // TODO Auto-generated method stub
+ //
+ // }
+ //
+ // });
+ // btnRemove.setImage(ImageResources.getImage(ImageResources.ACTIVE_DELETE_ICON));
+ // btnRemove.setToolTipText("");
status = new Label(toolbar, SWT.NONE);
status.setVisible(false);
}
-
@Override
public void propertyChange(PropertyChangeEvent event) {
- if(event == null){
+ if (event == null) {
return;
}
Object eventSource = event.getSource();
- if(eventSource != this && btnSelectArea.equals(eventSource)){
- if (actualArea != null){
+ if (eventSource != this && btnSelectArea.equals(eventSource)) {
+ if (actualArea != null) {
PrefKey key = newAreaSpecificStatusPreference();
actualPref = PreferenceResolver.resolve(perAreaPreferences, key);
areaText.setText(actualArea.getLabel());
override = actualPref.isAllowOverride();
- }else{
+ } else {
actualPref = null;
}
@Override
protected String getCheckedValuesFromPreferences() {
- String checkedValues = null;
- if (actualArea == null){
- checkedValues = pref.getValue();
- override = pref.isAllowOverride();
- }else{
- if (actualPref == null){
- PrefKey key = newAreaSpecificStatusPreference();
- actualPref = PreferenceResolver.resolve(perAreaPreferences, key);
-
- if (actualPref == null){
- actualPref = CdmPreference.NewInstance(key, null);
- checkedValues = PreferencesUtil.getStringValue(PreferencePredicate.AvailableDistributionStatus.getKey(), true);
-
- }
- }
- checkedValues = actualPref.getValue();
- override = actualPref.isAllowOverride();
- }
-
- return checkedValues;
+ String checkedValues = null;
+ if (actualArea == null) {
+ checkedValues = pref.getValue();
+ override = pref.isAllowOverride();
+ } else {
+ if (actualPref == null) {
+ PrefKey key = newAreaSpecificStatusPreference();
+ actualPref = PreferenceResolver.resolve(perAreaPreferences, key);
+
+ if (actualPref == null) {
+ actualPref = CdmPreference.NewInstance(key, null);
+ checkedValues = PreferencesUtil
+ .getStringValue(PreferencePredicate.AvailableDistributionStatus.getKey(), true);
+
+ }
+ }
+ checkedValues = actualPref.getValue();
+ override = actualPref.isAllowOverride();
+ }
+
+ return checkedValues;
}
- protected void refreshActualPrefernce(){
+ protected void refreshActualPrefernce() {
String saveCheckedElements;
getViewer().expandAll();
-
- if (countTerms == getViewer().getCheckedElements().length){
+ if (countTerms == getViewer().getCheckedElements().length) {
saveCheckedElements = null;
- }else{
+ } else {
Object[] checkedElements = getViewer().getCheckedElements();
List<UUID> listUIIDChecked = new ArrayList<>();
List<DefinedTermBase> preferredTerms = new ArrayList<>();
for (Object o : checkedElements) {
- if(o instanceof TermDto){
- TermDto termDto = (TermDto) o;
- listUIIDChecked.add(termDto.getUuid());
- preferredTerms.add(CdmStore.getService(ITermService.class).load(termDto.getUuid()));
- }
- }
- saveCheckedElements = StringUtils.join(listUIIDChecked, ";"); //$NON-NLS-1$
- if (StringUtils.isBlank(saveCheckedElements)){
- saveCheckedElements = null;
- }
+ if (o instanceof TermDto) {
+ TermDto termDto = (TermDto) o;
+ listUIIDChecked.add(termDto.getUuid());
+ preferredTerms.add(CdmStore.getService(ITermService.class).load(termDto.getUuid()));
+ }
+ }
+ saveCheckedElements = StringUtils.join(listUIIDChecked, ";"); //$NON-NLS-1$
+ if (StringUtils.isBlank(saveCheckedElements)) {
+ saveCheckedElements = null;
+ }
}
- if (actualArea == null){
- CdmPreference savePref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionStatus, saveCheckedElements);
+ if (actualArea == null) {
+ CdmPreference savePref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionStatus,
+ saveCheckedElements);
savePref.setAllowOverride(override);
pref = savePref;
- }else{
+ } else {
PrefKey key = newAreaSpecificStatusPreference();
actualPref = PreferenceResolver.resolve(perAreaPreferences, key);
- CdmPreference savePref = CdmPreference.NewInstance(PreferenceSubject.fromKey(key), PreferencePredicate.AvailableDistributionStatus, saveCheckedElements);
- if (actualPref != null){
- perAreaPreferences.remove(actualPref);
+ CdmPreference savePref = CdmPreference.NewInstance(PreferenceSubject.fromKey(key),
+ PreferencePredicate.AvailableDistributionStatus, saveCheckedElements);
+ if (actualPref != null) {
+ perAreaPreferences.remove(actualPref);
}
perAreaPreferences.add(savePref);
savePref.setAllowOverride(override);
}
@Override
- protected List<TermVocabularyDto> getVocabulariesFromPreference(){
- return null;
+ protected List<TermCollectionDto> getVocabulariesFromPreference() {
+ return null;
}
- private PrefKey newAreaSpecificStatusPreference(){
+ private PrefKey newAreaSpecificStatusPreference() {
PrefKey prefKey;
- if (actualArea != null){
- prefKey = CdmPreference.NewKey(PreferenceSubject.NewInstance(PreferenceSubject.ROOT+"NamedArea["+actualArea.getUuid().toString()+"]"+PreferenceSubject.SEP), PreferencePredicate.AvailableDistributionStatus);
- }else{
- prefKey = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.AvailableDistributionStatus);
+ if (actualArea != null) {
+ prefKey = CdmPreference.NewKey(
+ PreferenceSubject.NewInstance(PreferenceSubject.ROOT + "NamedArea["
+ + actualArea.getUuid().toString() + "]" + PreferenceSubject.SEP),
+ PreferencePredicate.AvailableDistributionStatus);
+ } else {
+ prefKey = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(),
+ PreferencePredicate.AvailableDistributionStatus);
}
return prefKey;
}
-
- public void setActualPreference(CdmPreference pref){
+ public void setActualPreference(CdmPreference pref) {
this.actualPref = pref;
- if (actualPref != null){
+ if (actualPref != null) {
override = actualPref.isAllowOverride();
- }else{
+ } else {
override = true;
}
}
-
}
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
* @since 05.10.2018
*
*/
-public class AvailableDistributionPerAreaStatusWizard extends Wizard implements IConversationEnabled{
- private ConversationHolder conversation;
+public class AvailableDistributionPerAreaStatusWizard extends Wizard {
private final AvailableDistributionPerAreaStatusPage aPage;
List<CdmPreference> prefs;
private boolean isAdmin;
return true;
}
- @Override
- public void update(CdmDataChangeMap changeEvents) {
-
- }
-
- @Override
- public ConversationHolder getConversationHolder() {
- if (conversation == null) {
- conversation = CdmStore.createConversation();
- }
- return conversation;
- }
-
}
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @since 19.11.2018
*
*/
-public class AvailableDistributionStatusAdminWizard extends Wizard implements IConversationEnabled{
- private ConversationHolder conversation;
+public class AvailableDistributionStatusAdminWizard extends Wizard {
+
private final AvailableDistributionStatusPage aPage;
CdmPreference pref;
return true;
}
- @Override
- public void update(CdmDataChangeMap changeEvents) {
-
- }
-
- @Override
- public ConversationHolder getConversationHolder() {
- if (conversation == null) {
- conversation = CdmStore.createConversation();
- }
- return conversation;
- }
+
}
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-
-
/**
* @author k.luther
* @since 05.10.2018
public void createControl(Composite parent) {
setTitle(Messages.AvailableDistributionStatusPage_PAGE_TITLE);
setDescription(Messages.AvailableDistributionStatusPage_PAGE_DESCRIPTION);
- if (localPref){
- override = PreferencesUtil.getOverrideForPreference(PreferencePredicate.AvailableDistributionStatus.getKey());
+ if (localPref) {
+ override = PreferencesUtil
+ .getOverrideForPreference(PreferencePredicate.AvailableDistributionStatus.getKey());
}
overrideButton = createAllowOverrideButton(parent);
-
super.createControl(parent);
overrideButton.setSelection(override);
}
@Override
protected String getCheckedValuesFromPreferences() {
- String checkedValues = null;
- if (localPref){
- checkedValues = PreferencesUtil.getStringValue(PreferencePredicate.AvailableDistributionStatus.getKey(), true);
- }else if(pref != null){
+ String checkedValues = null;
+ if (localPref) {
+ checkedValues = PreferencesUtil.getStringValue(PreferencePredicate.AvailableDistributionStatus.getKey(),
+ true);
+ } else if (pref != null) {
checkedValues = pref.getValue();
}
return checkedValues;
}
@Override
- protected List<TermVocabularyDto> getVocabulariesFromPreference() {
+ protected List<TermCollectionDto> getVocabulariesFromPreference() {
// TODO Auto-generated method stub
return null;
}
-
-
-
-
-
}
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.term.TermType;
* @since 05.10.2018
*
*/
-public class AvailableDistributionStatusWizard extends Wizard implements IConversationEnabled{
- private ConversationHolder conversation;
+public class AvailableDistributionStatusWizard extends Wizard {
+
private final AvailableDistributionStatusPage aPage;
CdmPreference pref;
return true;
}
- @Override
- public void update(CdmDataChangeMap changeEvents) {
-
- }
-
- @Override
- public ConversationHolder getConversationHolder() {
- if (conversation == null) {
- conversation = CdmStore.createConversation();
- }
- return conversation;
- }
-
+
}
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
*/
public class AvailableDistributionWizard extends Wizard {
- // private ConversationHolder conversation;
private final AvailableDistributionPage aPage;
public AvailableDistributionWizard() {
public boolean performFinish() {
// TODO: get Selection and save in EditorPreferences
if (!checkNoneChecked()) {
- Object[] checkedElements = aPage.getViewer().getCheckedElements();
+ //Object[] checkedElements = aPage.getViewer().getCheckedElements();
+ Object[] checkedElements = aPage.treeComposite.getCheckedElements();
Object[] grayedElements = aPage.getViewer().getGrayedElements();
ArrayList<Object> checkedList = new ArrayList<>(Arrays.asList(checkedElements));
ArrayList<Object> grayedList = new ArrayList<>(Arrays.asList(grayedElements));
}else if(o instanceof TermVocabularyDto){
TermVocabularyDto termVocDto = (TermVocabularyDto) o;
listUIIDGrayed.add(termVocDto.getUuid());
+ }else if(o instanceof TermNodeDto){
+ TermNodeDto termNodeDto = (TermNodeDto) o;
+ listUIIDChecked.add(termNodeDto.getTerm().getUuid());
}
}
for (Object o : grayedList) {
}
private boolean checkNoneChecked() {
-
- if (aPage.getViewer().getCheckedElements().length == 0) {
+ if (aPage.treeComposite.getCheckedElements() == null || aPage.treeComposite.getCheckedElements().length == 0) {
aPage.setMessage(Messages.AvailableDistributionWizard_CHECK_MESSAGE, aPage.WARNING);
return true;
} else {
return false;
}
}
-//
-// @Override
-// public ConversationHolder getConversationHolder() {
-// if (conversation == null) {
-// conversation = CdmStore.createConversation();
-// }
-// return conversation;
-// }
-//
-// @Override
-// public void update(CdmDataChangeMap changeEvents) {
-// }
}
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @author k.luther
* @since 04.06.2018
*
*/
-public class AvailableVocabularyWizard extends Wizard implements IConversationEnabled {
+public class AvailableVocabularyWizard extends Wizard {
- private ConversationHolder conversation;
private final AvailableAreaVocabulariesPage aPage;
private boolean localPref = true;
private CdmPreference pref;
return true;
}
- @Override
- public void update(CdmDataChangeMap changeEvents) {
- }
-
- @Override
- public ConversationHolder getConversationHolder() {
- if (conversation == null) {
- conversation = CdmStore.createConversation();
- }
- return conversation;
- }
-
+
}
package eu.etaxonomy.taxeditor.preference.wizard;
import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;
+import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.ImageResources;
private static final Font FONT_DEFAULT = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
private static final Font FONT_ITALIC = JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT);
- private static final Font FONT_BOLD = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
- private CheckboxTreeViewer viewer;
- private Button btnCollapse;
- private Button btnExpand;
- private Button btnSelectAllChildren;
- private Button btnSelectDirectChildren;
+ protected static final Font FONT_BOLD = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
+ protected CheckboxTreeViewer viewer;
+ protected Button btnCollapse;
+ protected Button btnExpand;
+ protected Button btnSelectAllChildren;
+ protected Button btnSelectDirectChildren;
protected Object[] checkedElements;
- private boolean allowTopLevelSelection = false;
+ protected boolean allowTopLevelSelection = false;
+
public CheckBoxTreeComposite(Composite parent, ITreeContentProvider contentProvider, IBaseLabelProvider labelProvider, int style) {
super(parent, style);
btnSelectAllChildren.setImage(ImageResources.getImage(ImageResources.HIERARCHICAL));
btnSelectAllChildren.setToolTipText(""); //$NON-NLS-1$
+ Tree tree = createTree();
+
+ viewer = new CdmCheckBoxTreeViewer(tree);
+ viewer.setContentProvider(contentProvider);
+ viewer.setLabelProvider(labelProvider);
+ }
+
+
+ /**
+ * @return
+ */
+ protected Tree createTree() {
Tree tree = new Tree(this, SWT.BORDER | SWT.CHECK);
tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
tree.addListener(SWT.Selection, event -> {
checkedElements = tempArray;
}
}else{
-
+
if (checkedElements != null){
- Object[] tempArray = new Object[checkedElements.length -1];
- int index = 0;
- for (Object o:checkedElements){
- if (o != null && !o.equals(item.getData())){
- tempArray[index] = o;
- index++;
- }
- }
- checkedElements = tempArray;
+ updateAfterUnCheckElement(item);
}
}
updateItem(item);
}
});
+ return tree;
+ }
- viewer = new CdmCheckBoxTreeViewer(tree);
- viewer.setContentProvider(contentProvider);
- viewer.setLabelProvider(labelProvider);
+
+ protected void updateAfterUnCheckElement(Object item) {
+ Object[] tempArray = new Object[checkedElements.length -1];
+
+ int index = 0;
+ for (Object o:checkedElements){
+ Object element = null;
+ if (item instanceof TreeItem) {
+ element = ((TreeItem)item).getData();
+ }else {
+ element = item;
+ }
+ if (o != null && !o.equals(element)){
+ tempArray[index] = o;
+ index++;
+ }
+ }
+ checkedElements = tempArray;
}
- private void updateItem(TreeItem treeItem){
+ protected void updateItem(TreeItem treeItem){
TreeItem parentItem = treeItem.getParentItem();
if(parentItem!=null){
updateItem(parentItem);
treeItem.setFont(FONT_DEFAULT);
}
}
+
}
for (TreeItem rootItem : rootItems) {
updateItem(rootItem);
}
+
}
/**
List<TreeItem> childItemList = Arrays.asList(childItems);
boolean allChecked = childItemList.stream().allMatch(childItem->childItem.getChecked());
childItemList.stream().forEach(childItem->childItem.setChecked(!allChecked));
- TreeItem parent = getRoot(treeItem);
- updateItem(parent);
+ if (!allChecked) {
+ for (TreeItem updateItem: childItemList) {
+ updateAfterCheckElement(updateItem);
+ }
+
+ }else {
+ for (TreeItem updateItem: childItemList) {
+ updateAfterUnCheckElement(updateItem);
+ }
+ }
+
+
}
}
else if(e.widget == btnSelectAllChildren){
Widget item = viewer.testFindItem(firstElement);
if(item instanceof TreeItem){
viewer.expandToLevel(firstElement, AbstractTreeViewer.ALL_LEVELS);
- viewer.setSubtreeChecked(firstElement, !((TreeItem) item).getFont().equals(FONT_BOLD));
- TreeItem parent = getRoot((TreeItem) item);
- updateItem(parent);
+ Set<TreeItem> childrenSet = getSubTreeItems((TreeItem)item);
+ Object[] children = childrenSet.toArray();
+ boolean checked = true;
+ if (children == null) {
+ return;
+ }
+ if (children != null && ((TreeItem)children[0]).getChecked()) {
+ checked = false;
+ }
+ viewer.setSubtreeChecked(firstElement, checked);
((TreeItem) item).setChecked(false);
+ Object[] checkedElements = viewer.getCheckedElements();
+
+ for (Object updateItem: children) {
+ if (((TreeItem)children[0]).getChecked()) {
+ updateAfterCheckElement(updateItem);
+ }else {
+ updateAfterUnCheckElement(updateItem);
+ }
+ }
+
}
}
}
- private TreeItem getRoot(TreeItem treeItem) {
+ private void updateAfterCheckElement(Object item) {
+ Set<Object> tempList = new HashSet<>();
+ if (checkedElements != null) {
+ Collections.addAll(tempList, checkedElements);
+ }
+ TermNodeDto checkedNode = null;
+ TermDto checkedTerm = null;
+ TreeItem treeItem = null;
+ if (item instanceof TreeItem) {
+ treeItem = (TreeItem) item;
+ if (treeItem.getData() instanceof TermNodeDto) {
+ checkedNode = (TermNodeDto)treeItem.getData();
+ checkedTerm = checkedNode.getTerm();
+ }else if (treeItem.getData() instanceof TermDto) {
+ checkedTerm = (TermDto)treeItem.getData();
+ }else {
+ return;
+ }
+ }else if (item instanceof TermNodeDto) {
+ checkedNode = (TermNodeDto)item;
+ checkedTerm = checkedNode.getTerm();
+ }else if (item instanceof TermDto) {
+ checkedTerm = (TermDto)item;
+ }else {
+ return;
+ }
+ if (checkedTerm != null) {
+ tempList.add(checkedTerm);
+ }
+
+ setCheckedElements(tempList.toArray());
+
+ }
+
+ protected TreeItem getRoot(TreeItem treeItem) {
TreeItem parent = treeItem;
while(parent.getParentItem()!=null){
parent = parent.getParentItem();
return parent;
}
+ public Object[] getCheckedElements() {
+ return checkedElements;
+ }
+ private Set<TreeItem> getSubTreeItems(TreeItem parent) {
+ Set<TreeItem> children = new HashSet<>();
+
+ if (parent.getItems() != null) {
+ children.addAll(Arrays.asList(parent.getItems()));
+ for(TreeItem child : parent.getItems()) {
+ children.addAll(getSubTreeItems(child));
+ }
+ }
+ return children;
+ }
+
+
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
import java.util.UUID;
import org.apache.commons.lang3.StringUtils;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import eu.etaxonomy.cdm.api.service.IVocabularyService;
+import eu.etaxonomy.cdm.api.service.ITermCollectionService;
+import eu.etaxonomy.cdm.api.service.ITermTreeService;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
-import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermSorter;
import eu.etaxonomy.taxeditor.editor.definedterm.RootElementsOnlyTreeContentProvider;
import eu.etaxonomy.taxeditor.editor.definedterm.TermDtoLabelProvider;
* @author k.luther
* @since 13.09.2019
*/
-public class GeneralVocabularyPreferencePage extends AbstractGeneralTermPreference<TermVocabularyDto> implements ISelectionChangedListener, SelectionListener{
-
-
- protected List<TermVocabularyDto> getVocabulariesFromPreference() {
-
- return null;
- }
+public class GeneralVocabularyPreferencePage extends AbstractGeneralTermPreference<TermCollectionDto> {
@Override
protected Control createContents(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
- // getValues();
+ // getValues();
getPreferenceValues();
- if (!isAdminPreference && !allowOverride){
+ if (!isAdminPreference && !allowOverride) {
final CLabel description = new CLabel(parent, SWT.NULL);
description.setText(Messages.NameDetailsViewConfiguration_description_not_available);
this.setDefaultButtonActivated(false);
container.setLayout(gridLayout);
parent.setLayout(new GridLayout());
useLocalOrAdmin = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
- if (!isAdminPreference){
+ if (!isAdminPreference) {
useLocalOrAdmin.add(LocalOrDefaultEnum.Default.getLabel(), 0);
useLocalOrAdmin.add(LocalOrDefaultEnum.Local.getLabel(), 1);
- }else{
+ } else {
useLocalOrAdmin.add(LocalOrDefaultEnum.AllowOverride.getLabel(), 0);
useLocalOrAdmin.add(LocalOrDefaultEnum.Database.getLabel(), 1);
}
-
- treeComposite = new CheckBoxTreeComposite(container, new RootElementsOnlyTreeContentProvider(), new TermDtoLabelProvider(), SWT.NONE);
+ treeComposite = new CheckBoxTreeComposite(container, new RootElementsOnlyTreeContentProvider(),
+ new TermDtoLabelProvider(), SWT.NONE);
treeComposite.getViewer().setComparator(new DefinedTermSorter());
treeComposite.setAllowTopLevelSelection(true);
rememberCheckedValues(getCheckedValuesFromPreferences());
- if (!isAdminPreference){
- if (isOverride){
+ if (!isAdminPreference) {
+ if (isOverride) {
useLocalOrAdmin.select(1);
- }else{
+ } else {
useLocalOrAdmin.select(0);
treeComposite.setEnabled(false);
}
- }else{
- if (allowOverride){
+ } else {
+ if (allowOverride) {
useLocalOrAdmin.select(0);
- }else{
+ } else {
useLocalOrAdmin.select(1);
}
}
@Override
protected void rememberCheckedValues(String checkedValues) {
initialiseVocabularies();
- treeComposite.getViewer().getTree().deselectAll();
- treeComposite.getViewer().refresh();
- treeComposite.getViewer().setInput(getVocabularies());
+ setInput();
- if (checkedValues != null && checkedValues != "") { //$NON-NLS-1$
+ if (checkedValues != null && !checkedValues.equals("")) { //$NON-NLS-1$
String[] listChecked = checkedValues.split(";"); //$NON-NLS-1$
String[] listCheckedComma = checkedValues.split(","); //$NON-NLS-1$
List<String> checked = new ArrayList<>();
- if (listChecked != null ){
+ if (listChecked != null) {
checked = Arrays.asList(listChecked);
}
- if (listCheckedComma != null && checkedValues.contains(",")){ //$NON-NLS-1$
+ if (listCheckedComma != null && checkedValues.contains(",")) { //$NON-NLS-1$
checked = Arrays.asList(listCheckedComma);
}
- List<TermVocabularyDto> termsFromStringValues = getTermsFromStringValues(checked);
+ List<TermCollectionDto> termsFromStringValues = getTermsFromStringValues(checked);
treeComposite.setCheckedElements(termsFromStringValues.toArray());
- }else{
- List<TermVocabularyDto> termsFromStringValues = getTermsFromStringValues(new ArrayList<String>());
+ } else {
+ List<TermCollectionDto> termsFromStringValues = getTermsFromStringValues(new ArrayList<>());
treeComposite.setCheckedElements(termsFromStringValues.toArray());
treeComposite.getViewer().refresh();
treeComposite.redraw();
-
}
}
-
@Override
- protected List<TermVocabularyDto> getTermsFromStringValues(List<String> listValue) {
- List<TermVocabularyDto> vocList = new ArrayList<>();
- List<UUID> uuids = new ArrayList();
- IVocabularyService vocService = CdmStore.getService(IVocabularyService.class);
+ protected List<TermCollectionDto> getTermsFromStringValues(List<String> listValue) {
+ List<TermCollectionDto> vocList = new ArrayList<>();
+ List<TermCollectionDto> treeList = new ArrayList<>();
+ List<TermCollectionDto> collList = new ArrayList<>();
+ List<UUID> uuids = new ArrayList<>();
+ ITermCollectionService vocService = CdmStore.getService(ITermCollectionService.class);
+ ITermTreeService treeService = CdmStore.getService(ITermTreeService.class);
for (String s : listValue) {
- if (!StringUtils.isBlank(s)){
+ if (!StringUtils.isBlank(s)) {
UUID uuid = UUID.fromString(s);
uuids.add(uuid);
}
}
- vocList = vocService.findVocabularyDtoByVocabularyUuids(uuids);
-
-
- if (listValue.isEmpty()){
- vocList =vocService.findVocabularyDtoByTermType(type);
+ vocList = vocService.findCollectionDtoByTermType(type);
+ // treeList = treeService.listTermTreeDtosByTermType(type);
+ if (listValue.isEmpty()) {
+ // vocList = vocService.findVocabularyDtoByTermType(type);
+ }
+ // if (vocList != null && !vocList.isEmpty()) {
+ // collList.addAll(vocList);
+ // }
+ if (!vocList.isEmpty()) {
+ for (TermCollectionDto dto : vocList) {
+ if (uuids.contains(dto.getUuid())) {
+ collList.add(dto);
+ }
+ }
}
- return vocList;
+ return collList;
}
@Override
public boolean performOk() {
- if (!isApply()){
+ if (!isApply()) {
return true;
}
Object[] checkedElements = treeComposite.getViewer().getCheckedElements();
List<UUID> listUIIDChecked = new ArrayList<>();
for (Object o : checkedElements) {
- if(o instanceof TermVocabularyDto){
- TermVocabularyDto termDto = (TermVocabularyDto) o;
+ if (o instanceof TermCollectionDto) {
+ TermCollectionDto termDto = (TermCollectionDto) o;
listUIIDChecked.add(termDto.getUuid());
- }
+ }
}
String saveCheckedElements = StringUtils.join(listUIIDChecked, ";"); //$NON-NLS-1$
- if (isAdminPreference){
+ if (isAdminPreference) {
CdmPreference savePref = CdmPreference.NewTaxEditorInstance(predicate, saveCheckedElements);
String text = this.useLocalOrAdmin.getText();
- if (text.equals(LocalOrDefaultEnum.Database.getLabel()) ){
+ if (text.equals(LocalOrDefaultEnum.Database.getLabel())) {
savePref.setAllowOverride(false);
- }else if (text.equals(LocalOrDefaultEnum.AllowOverride.getLabel())){
+ } else if (text.equals(LocalOrDefaultEnum.AllowOverride.getLabel())) {
savePref.setAllowOverride(true);
}
PreferencesUtil.setPreferenceToDB(savePref);
PreferencesUtil.updateDBPreferences();
- }else{
+ } else {
PreferencesUtil.setStringValue(predicate.getKey(), saveCheckedElements);
String text = this.useLocalOrAdmin.getText();
- if (text.equals(LocalOrDefaultEnum.Database.getLabel()) || text.equals(LocalOrDefaultEnum.Default.getLabel())){
- PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(predicate.getKey()), false);
- }else if (text.equals(LocalOrDefaultEnum.Local.getLabel())){
- PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(predicate.getKey()), true);
+ if (text.equals(LocalOrDefaultEnum.Database.getLabel())
+ || text.equals(LocalOrDefaultEnum.Default.getLabel())) {
+ PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(predicate.getKey()),
+ false);
+ } else if (text.equals(LocalOrDefaultEnum.Local.getLabel())) {
+ PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(predicate.getKey()),
+ true);
}
}
}
@Override
- protected void performDefaults(){
- if (isAdminPreference){
+ protected void performDefaults() {
+ if (isAdminPreference) {
rememberCheckedValues("");
treeComposite.setEnabled(true);
- }else{
+ } else {
isOverride = false;
rememberCheckedValues(getCheckedValuesFromPreferences());
treeComposite.setEnabled(false);
}
- pref = null;
- useLocalOrAdmin.select(0);
-
- setApply(true);
- super.performDefaults();
+ pref = null;
+ useLocalOrAdmin.select(0);
+ setApply(true);
+ super.performDefaults();
}
-
-}
+}
\ No newline at end of file
import org.eclipse.jface.wizard.Wizard;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.term.Representation;
* @created 12.06.2009
* @version 1.0
*/
-public class VocabularyTermWizard<T extends DefinedTermBase> extends Wizard implements IConversationEnabled {
+public class VocabularyTermWizard<T extends DefinedTermBase> extends Wizard {
public T term = null;
private Class<T> termClass;
- private ConversationHolder conversation;
-
/**
* <p>Constructor for VocabularyTermWizard.</p>
*
* @param vocabularyClass a {@link java.lang.Class} object.
*/
- public VocabularyTermWizard(Class<T> vocabularyClass, ConversationHolder conversation){
- this.conversation = conversation;
+ public VocabularyTermWizard(Class<T> vocabularyClass){
termClass = vocabularyClass;
}
* @param vocabularyClass a {@link java.lang.Class} object.
* @param selectedTerm a T object.
*/
- public VocabularyTermWizard(Class<T> vocabularyClass, T selectedTerm, ConversationHolder conversation){
- this(vocabularyClass, conversation);
+ public VocabularyTermWizard(Class<T> vocabularyClass, T selectedTerm){
+ this(vocabularyClass);
term = (T) CdmStore.getService(ITermService.class).load(selectedTerm.getUuid());
editMode = true;
}
}else{
TermStore.saveTerm(getTerm());
}
-
- getConversationHolder().commit(true);
-
+
return true;
}
*/
public Class<T> getTermClass() {
return termClass;
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
- */
- @Override
- public void update(CdmDataChangeMap changeEvents) {
- // not needed
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
- */
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
+ }
}
public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_OUT_CSV_OPENCSVEXPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.out.csv.OpenCsvExportWizard";
public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_OUT_CSV_PRINT_OPENCSVPRINTEXPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.out.csv.print.OpenCsvPrintExportWizard";
public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_OUT_DWCA_OPENDWCAEXPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.out.dwca.OpenDwcaExportWizard";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_OUT_DWCA_OPENWFOBACKBONEEXPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.out.dwca.OpenWfoBackboneExportWizard";
public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_OUT_JAXB_OPENJAXBEXPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.out.jaxb.OpenJaxbExportWizard";
public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_OUT_OWL_OPENOWLTERMEXPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.out.owl.OpenOwlTermExportWizard";
public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_OUT_SDD_OPENSDDEXPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.out.sdd.OpenSddExportWizard";
public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_DATAIMPORT_E4_GBIFRESPONSEIMPORTVIEWE4 = "eu.etaxonomy.taxeditor.view.dataimport.e4.GbifResponseImportView";
public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_DATAIMPORT_E4_SPECIMENIMPORTVIEWE4 = "eu.etaxonomy.taxeditor.view.dataimport.e4.SpecimenImportView";
public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_DATASOURCE = "eu.etaxonomy.taxeditor.view.datasource";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_REMOTESEERVER = "eu.etaxonomy.taxeditor.view.remoteserver";
public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_E4_DETAILS_DETAILSPARTE4 = "eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4";
public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_E4_SUPPLEMENTALDATA_SUPPLEMENTALDATAPARTE4 = "eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4";
public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_SESSIONS_SESSIONSVIEWPART = "eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart";
* 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.store;
import java.util.EnumSet;
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.application.ICdmRepository;
-import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
import eu.etaxonomy.cdm.api.service.IAgentService;
import eu.etaxonomy.cdm.api.service.IAnnotationService;
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
-import eu.etaxonomy.taxeditor.session.mock.MockCdmEntitySessionManager;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
import eu.etaxonomy.taxeditor.util.ProgressMonitorClientManager;
* Only methods that either get or manipulate data are exposed here. So this
* class acts as a facade for the methods in cdmlib-service.
*
+ * NOTE by AM: TODO this description is outdated since we use remoting now.
+ *
* @author n.hoffmann
* @created 17.03.2009
*/
private static CdmStoreConnector job;
-// private static CdmServer managedServer;
-
private Language language;
private ICdmSource cdmSource;
RemotingLoginDialog loginDialog = remotingLoginDialog;
if(isActive()) {
// before we connect we clear the entity caches and the sessions
- CdmRemoteCacheManager.removeEntityCaches();
+ CdmRemoteCacheManager.removeEntityCaches();
if(getCurrentSessionManager(true) != null) {
getCurrentSessionManager(true).disposeAll();
}
CdmApplicationState.dispose();
}
- public static void setInstance(ICdmRepository applicationController,
+ public static void setInstance(CdmApplicationRemoteController applicationController,
ICdmSource cdmSource) {
instance = new CdmStore(applicationController, cdmSource);
- CdmApplicationState.setCdmServiceCacher(new CdmServiceCacher());
+ CdmApplicationState.setTermProxy(new CdmServiceCachingProxy());
}
- protected CdmStore(ICdmRepository repository,
+ protected CdmStore(CdmApplicationRemoteController repository,
ICdmSource cdmSource) {
CdmApplicationState.setCurrentAppConfig(repository);
CdmApplicationState.setCurrentDataChangeService(new CdmUIDataChangeService());
/**
* All calls to the datastore require
- *
- * @return
*/
- private ICdmRepository getApplicationConfiguration() {
+ private CdmApplicationRemoteController getApplicationConfiguration() {
try {
return CdmApplicationState.getCurrentAppConfig();
} catch (Exception e) {
return null;
}
- public static ICdmRepository getCurrentApplicationConfiguration() {
- if (getDefault() != null) {
- return getDefault().getApplicationConfiguration();
+ public static CdmApplicationRemoteController getCurrentApplicationConfiguration() {
+ CdmStore defaultStore = getDefault();
+ if (defaultStore != null) {
+ return defaultStore.getApplicationConfiguration();
}
return null;
}
- /*
- * CONVERSATIONS
- */
-
- /**
- * Creates a new conversation, binds resources to the conversation and start
- * a transaction for this conversation.
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
- * object.
- */
- public static ConversationHolder createConversation() {
- ConversationHolder conversation = getCurrentApplicationConfiguration()
- .NewConversation();
- try {
- conversation.startTransaction();
- }catch(Exception e){
- MessagingUtils.messageDialog("No database connection", CdmStore.class, "No database connection available", e);
- }
- return conversation;
- }
-
- //FIXME:Remoting should be removed after moving completely to remoting
- private MockCdmEntitySessionManager mockCdmEntitySessionManager;
-
private ICdmEntitySessionManager getSessionManager() {
- //FIXME:Remoting we should only have CdmApplicationRemoteConfiguration after move to remoting
- // bad hack which should be finally removed
- if(getCurrentApplicationConfiguration() instanceof CdmApplicationRemoteController) {
- return ((CdmApplicationRemoteController)getCurrentApplicationConfiguration()).getCdmEntitySessionManager();
- } else {
- if(mockCdmEntitySessionManager == null) {
- mockCdmEntitySessionManager = new MockCdmEntitySessionManager();
- }
- return mockCdmEntitySessionManager;
- }
+ return getCurrentApplicationConfiguration().getCdmEntitySessionManager();
}
- public static ICdmEntitySessionManager getCurrentSessionManager() {
+
+ public static ICdmEntitySessionManager getCurrentSessionManager() {
return getCurrentSessionManager(false);
}
public static ICdmEntitySessionManager getCurrentSessionManager(boolean connecting) {
- if (getDefault(connecting) != null) {
- return getDefault(connecting).getSessionManager();
+ CdmStore cdmStore = getDefault(connecting);
+ if (cdmStore != null) {
+ return cdmStore.getSessionManager();
}
return null;
}
return service;
}
-//
-// public static void setManagedServer(ICdmServer server) {
-// managedServer = server;
-// }
-//
-// public static ICdmServer getManagedServer() {
-// return managedServer;
-
public boolean isConnected() {
return isConnected;
}
public void setConnected(boolean isConnected) {
this.isConnected = isConnected;
-
}
-
-
-}
+}
\ No newline at end of file
import org.eclipse.swt.widgets.Display;
import org.springframework.core.io.Resource;
-import eu.etaxonomy.cdm.api.application.CdmApplicationController;
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
import eu.etaxonomy.cdm.api.application.ICdmRepository;
import eu.etaxonomy.cdm.config.CdmSourceException;
import eu.etaxonomy.cdm.config.ICdmSource;
import eu.etaxonomy.cdm.database.DbSchemaValidation;
-import eu.etaxonomy.cdm.database.ICdmDataSource;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.metadata.CdmMetaData;
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
}
});
- ICdmRepository applicationController = null;
+ CdmApplicationRemoteController applicationController = null;
if (!monitor.isCanceled()) {
CdmProgressMonitorAdapter subprogressMonitor = CdmProgressMonitorAdapter
.CreateSubMonitor(monitor, 3);
// genrerate new application controller
- applicationController = getApplicationController(cdmSource,subprogressMonitor);
+ applicationController = getApplicationController(cdmSource, subprogressMonitor);
}
if (!monitor.isCanceled()) {
//loginDialog.onComplete();
CdmStore.getContextManager().notifyContextStart();
loginDialog.onComplete();
- //TODO AM: is this necessary to be done on display thread?
+ //TODO AM: is this necessary to be done on display thread?
new TermLoader().unloadAllTerms();
Rank.initDefaultTerms();
NomenclaturalStatusType.initDefaultTerms();
}
}
- private ICdmRepository getApplicationController(ICdmSource cdmSource, CdmProgressMonitorAdapter subprogressMonitor) {
- if(cdmSource instanceof ICdmDataSource) {
- return CdmApplicationController.NewInstance(applicationContextBean,
- (ICdmDataSource)cdmSource,
- dbSchemaValidation,
- false,
- subprogressMonitor);
- } else if(cdmSource instanceof ICdmRemoteSource) {
+ private CdmApplicationRemoteController getApplicationController(ICdmSource cdmSource, CdmProgressMonitorAdapter subprogressMonitor) {
+ if(cdmSource instanceof ICdmRemoteSource) {
return CdmApplicationRemoteController.NewInstance((ICdmRemoteSource)cdmSource,
subprogressMonitor,
null);
import java.util.Observable;
import java.util.Set;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.ui.IMemento;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.core.context.SecurityContextHolder;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.util.CdmUserHelper;
import eu.etaxonomy.cdm.api.util.RoleProberImpl;
import eu.etaxonomy.cdm.api.util.UserHelper;
import eu.etaxonomy.cdm.model.permission.Group;
import eu.etaxonomy.cdm.model.permission.User;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.cdm.persistence.permission.Role;
import eu.etaxonomy.taxeditor.model.IContextListener;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
*
* @author n.hoffmann
* @created 03.07.2009
- * @version 1.0
*/
-public class LoginManager extends Observable implements IConversationEnabled, IContextListener{
+public class LoginManager extends Observable implements IContextListener{
- public static final Logger logger = LogManager.getLogger(LoginManager.class);
-
- private ConversationHolder conversation;
+ public static final Logger logger = LogManager.getLogger();
public static final String INCORRECT_CREDENTIALS_MESSAGE = "Login and/or Password incorrect";
public static final String ACCOUNT_LOCKED_MESSAGE = "Account is locked";
e.printStackTrace();
throw new CdmAuthenticationException(EMPTY_CREDENTIALS_MESSAGE, e);
}
-
}
-
private void _logGrantedAuthotities(StringBuilder gaText, String indent,
Set<GrantedAuthority> gaSet) {
for(GrantedAuthority ga : gaSet){
}
}
- /**
- * <p>getAuthenticatedUser</p>
- *
- * @return a {@link eu.etaxonomy.cdm.model.common.User} object.
- */
public User getAuthenticatedUser(){
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
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;
- }
/**
* Whether the current user has the role admin
@Override
public void contextStart(IMemento memento, IProgressMonitor monitor){
- conversation = CdmStore.createConversation();
}
@Override
public void contextRefresh(IProgressMonitor monitor) {
- conversation = CdmStore.createConversation();
}
@Override
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.IAgentService;
import eu.etaxonomy.cdm.api.service.IGroupService;
import eu.etaxonomy.cdm.api.service.IMediaService;
import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.api.service.IUserService;
+import eu.etaxonomy.cdm.api.service.config.FindOccurrencesConfigurator;
import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator;
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.permission.User;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
+import eu.etaxonomy.cdm.model.term.TermCollection;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
private static final int MAX_RESULTS_BEFORE_WARNING = 500;
- public List<TaxonName> findNames(IIdentifiableEntityServiceConfigurator configurator, ConversationHolder conversation){
+ public List<TaxonName> findNames(IIdentifiableEntityServiceConfigurator configurator){
List<TaxonName> records = CdmStore.getService(INameService.class).findByFullTitle(configurator.getClazz(), configurator.getTitleSearchStringSqlized(), configurator.getMatchMode(), configurator.getCriteria(), configurator.getPageSize(), configurator.getPageNumber(), configurator.getOrderHints(), configurator.getPropertyPaths());
return records;
}
* @param configurator the configurator to use for the search
* @return a list of the SpecimenOrObservationBases matching the search parameters found
*/
- public List<SpecimenOrObservationBase> findOccurrences(IIdentifiableEntityServiceConfigurator configurator, boolean showCountWarning){
+ public List<SpecimenOrObservationBase> findOccurrences(FindOccurrencesConfigurator configurator, boolean showCountWarning){
// by default we do not show field units. This may be configured via preferences
return findOccurrences(configurator, PreferencesUtil.getBooleanValue(IPreferenceKeys.BULK_EDITOR_OCCURRENCE_SHOW_FIELD_UNITS), showCountWarning);
}
* @param showFieldUnits if <code>true</code> then also FieldUnits are searched
* @return
*/
- public List<SpecimenOrObservationBase> findOccurrences(IIdentifiableEntityServiceConfigurator<SpecimenOrObservationBase> configurator, boolean showFieldUnits,
+ public List<SpecimenOrObservationBase> findOccurrences(FindOccurrencesConfigurator configurator, boolean showFieldUnits,
boolean showCountWarning){
- List<SpecimenOrObservationBase> records = new ArrayList<SpecimenOrObservationBase>();
+ List<SpecimenOrObservationBase> records = new ArrayList<>();
final List<String> BASE_OCCURRENCE_INIT_STRATEGY = Arrays.asList(new String[] {
"collection", //$NON-NLS-1$
"descriptions", //$NON-NLS-1$
* @return
*/
public List<UuidAndTitleCache<NamedArea>> findNamedAreas(
- IIdentifiableEntityServiceConfigurator searchConfigurator, List<TermVocabulary> vocs) {
- List<UuidAndTitleCache<NamedArea>> entities = CdmStore.getService(ITermService.class).getUuidAndTitleCacheNamedArea(vocs, null, searchConfigurator.getTitleSearchString(), PreferencesUtil.getGlobalLanguage());
+ IIdentifiableEntityServiceConfigurator searchConfigurator, List<TermCollection> vocs) {
+ List<UuidAndTitleCache<NamedArea>> entities = CdmStore.getService(ITermService.class).getUuidAndTitleCache(NamedArea.class, vocs, null, searchConfigurator.getTitleSearchString(), PreferencesUtil.getGlobalLanguage(), null);
return entities;
}
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.ScrolledForm;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.term.TermNode;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
/**
- * <p>StoreUtil class.</p>
- *
* @author n.hoffmann
* @created 11.05.2009
*/
* </ol>
*/
public static int compareBySearchString(String searchString, String string1, String string2) {
- string1 = string1.toLowerCase();
- string2 = string2.toLowerCase();
+ string1 = CdmUtils.Nz(string1).toLowerCase();
+ string2 = CdmUtils.Nz(string2).toLowerCase();
//1. search string at the beginning
if(string1.startsWith(searchString)){
if(!string2.startsWith(searchString)){
}
return t;
}
-}
+}
\ No newline at end of file
* 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.store;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.UUID;
import org.apache.commons.lang3.StringUtils;
import eu.etaxonomy.cdm.api.service.ITermService;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.term.TermBase;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.model.term.TermVocabulary;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.model.DefaultTermComparator;
-import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-import eu.etaxonomy.taxeditor.ui.combo.InverseTermWrapper;
/**
* @author n.hoffmann
private Map<Object, List> cachedTermMap = new HashMap<>();
- //new cache for features!!
- //dinstinguish preferences for both
- //load at start
-
- public TermManager(){
- }
-
- public void reset(){
- cachedTermMap = new HashMap<>();
- }
-
- public <T extends DefinedTermBase> List<T> getPreferredTerms(TermType termType){
- List<?> terms = cachedTermMap.get(termType.getUuid());
- List<T> termBaseList = new ArrayList<>();
- if(terms==null || terms.isEmpty()){
- termBaseList = getFilteredTerms(TermStore.<T>getTerms(termType, null));
- if (termBaseList != null){
- cachedTermMap.put(termType.getUuid(), termBaseList);
- }
- }else{
- Iterator<?> iterator = terms.iterator();
+ // new cache for features!!
+ // dinstinguish preferences for both
+ // load at start
+
+ public TermManager() {
+ }
+
+ public void reset() {
+ cachedTermMap = new HashMap<>();
+ }
+
+ public <T extends DefinedTermBase> List<T> getPreferredTerms(TermType termType) {
+ List<?> terms = cachedTermMap.get(termType.getUuid());
+ List<T> termBaseList = new ArrayList<>();
+ if (terms == null || terms.isEmpty()) {
+ termBaseList = getFilteredTerms(TermStore.<T> getTerms(termType, null));
+ if (termBaseList != null) {
+ cachedTermMap.put(termType.getUuid(), termBaseList);
+ }
+ } else {
+ Iterator<?> iterator = terms.iterator();
List<UUID> uuids = new ArrayList<>();
- while (iterator.hasNext()){
+ while (iterator.hasNext()) {
Object term = iterator.next();
- if (term instanceof TermDto){
- TermDto dto = (TermDto)term;
+ if (term instanceof TermDto) {
+ TermDto dto = (TermDto) term;
uuids.add(dto.getUuid());
- }else {
- termBaseList.add((T)term);
+ } else {
+ termBaseList.add((T) term);
}
-
}
- if (!uuids.isEmpty()){
+ if (!uuids.isEmpty()) {
termBaseList.addAll(getTerms(uuids, termType));
}
- }
+ }
return termBaseList;
- }
+ }
+
+ public <T extends DefinedTermBase>List<TermDto> getPreferredTermsAsDto(TermType termType) {
+ List<?> terms = cachedTermMap.get(termType.getUuid());
+ List<TermDto> termsAsDto = new ArrayList<>();
+ if (terms == null || terms.isEmpty()) {
+ List<T> termBaseList = new ArrayList<>();
+ termBaseList = getFilteredTerms(TermStore.<T> getTerms(termType, null));
+ if (termBaseList != null) {
+ cachedTermMap.put(termType.getUuid(), termBaseList);
+ }
+ for (T term:termBaseList) {
+ termsAsDto.add(TermDto.fromTerm(term));
+ }
+ } else {
+ List<TermDto> termBaseList = new ArrayList<>();
+ Iterator<?> iterator = terms.iterator();
+ List<UUID> uuids = new ArrayList<>();
+ while (iterator.hasNext()) {
+ Object term = iterator.next();
+ if (term instanceof TermDto) {
+ TermDto dto = (TermDto) term;
+ termsAsDto.add(dto);
+ } else {
+ termsAsDto.add(TermDto.fromTerm((T)term));
+ }
+ }
+
+ }
+ return termsAsDto;
+ }
- public <T extends DefinedTermBase> List<T> getPreferredTerms(TermVocabulary<T> termVocabulary){
- @SuppressWarnings("unchecked")
+ public <T extends DefinedTermBase> List<T> getPreferredTerms(TermVocabulary<T> termVocabulary) {
+ @SuppressWarnings("unchecked")
List<T> terms = cachedTermMap.get(termVocabulary.getUuid());
- if(terms==null){
- terms = getFilteredTerms(new ArrayList<>(TermStore.getTerms(termVocabulary,null)));
- cachedTermMap.put(termVocabulary.getUuid(), terms);
- }
- return terms;
- }
-
- public List<TermDto> getPreferredTerms(TermVocabularyDto termVocabularyDto){
- @SuppressWarnings("unchecked")
- List<TermDto> terms = cachedTermMap.get(termVocabularyDto.getUuid());
- if(terms==null || terms.isEmpty()){
- terms = getFilteredTermDtos(new ArrayList<>(termVocabularyDto.getTerms()));
- cachedTermMap.put(termVocabularyDto.getUuid(), terms);
- }
- return terms;
- }
-
- public <T extends DefinedTermBase> List<T> getPreferredTerms(TermVocabulary<T> termVocabulary,
- Comparator comp){
- if (comp == null){
- comp = new DefaultTermComparator<T>();
- }
- @SuppressWarnings("unchecked")
- List<T> terms = cachedTermMap.get(termVocabulary.getUuid());
- List<T> termBaseList = new ArrayList<>();
- if(terms==null){
- termBaseList = getFilteredTerms(new ArrayList<T>(TermStore.getTerms(termVocabulary, comp)));
- cachedTermMap.put(termVocabulary.getUuid(), termBaseList);
- }else{
- Iterator<?> iterator = terms.iterator();
- List<UUID> uuids = new ArrayList<>();
- while (iterator.hasNext()){
- Object term = iterator.next();
- if (term instanceof TermDto){
- TermDto dto = (TermDto)term;
- uuids.add(dto.getUuid());
- }else {
- termBaseList.add((T)term);
- }
- }
-
- if (!uuids.isEmpty()){
- termBaseList.addAll(this.getTerms(uuids, DefinedTermBase.class));
- }
-
- }
- termBaseList.sort(comp);
- terms = termBaseList;
- return terms;
- }
-
- public <T extends DefinedTermBase> List<T> getPreferredTerms(Class<T> clazz){
- @SuppressWarnings("unchecked")
+ if (terms == null) {
+ terms = getFilteredTerms(new ArrayList<>(TermStore.getTerms(termVocabulary, null)));
+ cachedTermMap.put(termVocabulary.getUuid(), terms);
+ }
+ return terms;
+ }
+
+ public List<TermDto> getPreferredTerms(TermVocabularyDto termVocabularyDto) {
+ @SuppressWarnings("unchecked")
+ List<TermDto> terms = cachedTermMap.get(termVocabularyDto.getUuid());
+ if (terms == null || terms.isEmpty()) {
+ terms = getFilteredTermDtos(new ArrayList<>(termVocabularyDto.getTerms()));
+ cachedTermMap.put(termVocabularyDto.getUuid(), terms);
+ }
+ return terms;
+ }
+
+ public List<TermDto> getPreferredTerms(TermCollectionDto termVocabularyDto) {
+ @SuppressWarnings("unchecked")
+ List<TermDto> terms = cachedTermMap.get(termVocabularyDto.getUuid());
+ if (terms == null || terms.isEmpty()) {
+ terms = getFilteredTermDtos(new ArrayList<>(termVocabularyDto.getTerms()));
+ cachedTermMap.put(termVocabularyDto.getUuid(), terms);
+ }
+ return terms;
+ }
+
+ public <T extends DefinedTermBase> List<T> getPreferredTerms(TermVocabulary<T> termVocabulary, Comparator comp) {
+ if (comp == null) {
+ comp = new DefaultTermComparator<>();
+ }
+ @SuppressWarnings("unchecked")
+ List<T> terms = cachedTermMap.get(termVocabulary.getUuid());
+ List<T> termBaseList = new ArrayList<>();
+ if (terms == null) {
+ termBaseList = getFilteredTerms(new ArrayList<>(TermStore.getTerms(termVocabulary, comp)));
+ cachedTermMap.put(termVocabulary.getUuid(), termBaseList);
+ } else {
+ Iterator<?> iterator = terms.iterator();
+ List<UUID> uuids = new ArrayList<>();
+ while (iterator.hasNext()) {
+ Object term = iterator.next();
+ if (term instanceof TermDto) {
+ TermDto dto = (TermDto) term;
+ uuids.add(dto.getUuid());
+ } else {
+ termBaseList.add((T) term);
+ }
+ }
+
+ if (!uuids.isEmpty()) {
+ termBaseList.addAll(this.getTerms(uuids, DefinedTermBase.class));
+ }
+
+ }
+ termBaseList.sort(comp);
+ terms = termBaseList;
+ return terms;
+ }
+
+ public <T extends DefinedTermBase> List<T> getPreferredTerms(Class<T> clazz) {
+ @SuppressWarnings("unchecked")
+ List<T> terms = cachedTermMap.get(clazz);
+ if (terms == null) {
+ terms = getFilteredTerms(TermStore.getTerms(clazz));
+ cachedTermMap.put(clazz, terms);
+ }
+ return terms;
+ }
+
+ public <T extends DefinedTermBase> List<TermDto> getPreferredTermsAsDto(Class<T> clazz) {
+ @SuppressWarnings("unchecked")
List<T> terms = cachedTermMap.get(clazz);
- if(terms==null){
- terms = getFilteredTerms(TermStore.getTerms(clazz));
- cachedTermMap.put(clazz, terms);
- }
- return terms;
- }
-
- /**
- * Generic method to get term preferences for a term vocabulary
- *
- * @param initialTerms a {@link java.util.List} object.
- * @return a {@link java.util.List} object.
- */
- public <T extends DefinedTermBase> List<T> getFilteredTerms(List<T> initialTerms){
- List<T> filteredTerms = new ArrayList<>();
- if (initialTerms == null || initialTerms.isEmpty()){
- return filteredTerms;
- }
-
- for (T term : initialTerms){
-// if (term instanceof InverseTermWrapper){
-// if(!PreferencesUtil.getBooleanValue(getPrefName(term), true)){
-// T type = (T)((TaxonRelationshipTypeInverseContainer) term).getType();
-// filteredTerms.add(type);
-// }
-// }
-
- if(PreferencesUtil.getBooleanValue(getPrefName(term), true)){
- filteredTerms.add(term);
- }
- }
- if (filteredTerms.isEmpty()){
- //check for dtos
- List<TermDto> preferredTerms = null;
- if (initialTerms.get(0).getVocabulary() != null){
- preferredTerms = cachedTermMap.get(initialTerms.get(0).getVocabulary().getUuid());
- }
- if (preferredTerms == null){
- preferredTerms = cachedTermMap.get(initialTerms.get(0).getTermType().getUuid());
- }
- if (preferredTerms == null){
- return initialTerms;
- }
- for (T term : initialTerms){
- if (preferredTerms.contains(TermDto.fromTerm(term))){
- filteredTerms.add(term);
- }
- }
- if (filteredTerms.isEmpty()){
- return initialTerms;
- }
- }
-
- return filteredTerms;
- }
-
- public <T extends DefinedTermBase>List<T> createTermListFromString(String stringValue, TermType type){
- List<String> checked = new ArrayList<>();
-
- if (stringValue != null){
- String[] listChecked = stringValue.split(";"); //$NON-NLS-1$
- String[] listCheckedComma = stringValue.split(","); //$NON-NLS-1$
- if (listChecked != null ){
- checked = Arrays.asList(listChecked);
- }
- if (listCheckedComma != null && stringValue.contains(",")){ //$NON-NLS-1$
- checked = Arrays.asList(listCheckedComma);
- }
- }
+ List<TermDto> termsAsDto = new ArrayList<>();
+ if (terms == null) {
+ terms = getFilteredTerms(TermStore.getTerms(clazz));
+ cachedTermMap.put(clazz, terms);
+ }
+ for (T term: terms) {
+ termsAsDto.add(TermDto.fromTerm(term));
+ }
+ return termsAsDto;
+ }
+
+ /**
+ * Generic method to get term preferences for a term vocabulary
+ *
+ * @param initialTerms
+ * a {@link java.util.List} object.
+ * @return a {@link java.util.List} object.
+ */
+ public <T extends DefinedTermBase> List<T> getFilteredTerms(List<T> initialTerms) {
+ List<T> filteredTerms = new ArrayList<>();
+ if (initialTerms == null || initialTerms.isEmpty()) {
+ return filteredTerms;
+ }
+
+ for (T term : initialTerms) {
+ // if (term instanceof InverseTermWrapper){
+ // if(!PreferencesUtil.getBooleanValue(getPrefName(term), true)){
+ // T type = (T)((TaxonRelationshipTypeInverseContainer)
+ // term).getType();
+ // filteredTerms.add(type);
+ // }
+ // }
+
+ List<UUID> availableLanguages = PreferencesUtil.createUUIDListFromStringPref(PreferencePredicate.AvailableLanguages.getKey(), false);
+ if (availableLanguages != null && availableLanguages.contains(term.getUuid())) {
+ filteredTerms.add(term);
+ }
+ }
+ if (filteredTerms.isEmpty()) {
+ // check for dtos
+ List<TermDto> preferredTerms = null;
+ if (initialTerms.get(0).getVocabulary() != null) {
+ preferredTerms = cachedTermMap.get(initialTerms.get(0).getVocabulary().getUuid());
+ }
+ if (preferredTerms == null) {
+ preferredTerms = cachedTermMap.get(initialTerms.get(0).getTermType().getUuid());
+ }
+ if (preferredTerms == null) {
+ return initialTerms;
+ }
+ for (T term : initialTerms) {
+ if (preferredTerms.contains(TermDto.fromTerm(term))) {
+ filteredTerms.add(term);
+ }
+ }
+ if (filteredTerms.isEmpty()) {
+ return initialTerms;
+ }
+ }
+
+ return filteredTerms;
+ }
+
+ /**
+ * Generic method to get term preferences for a term vocabulary
+ *
+ * @param initialTerms
+ * a {@link java.util.List} object.
+ * @return a {@link java.util.List} object.
+ */
+ public <T extends DefinedTermBase> List<TermDto> getFilteredTermsAsDto(List<TermDto> initialTerms) {
+ List<TermDto> filteredTerms = new ArrayList<>();
+ if (initialTerms == null || initialTerms.isEmpty()) {
+ return filteredTerms;
+ }
+
+ for (TermDto term : initialTerms) {
+ if (PreferencesUtil.getBooleanValue(getPrefNameByDto(term), true)) {
+ filteredTerms.add(term);
+ }
+ }
+ if (filteredTerms.isEmpty()) {
+ // check for dtos
+ List<TermDto> preferredTerms = null;
+ if (initialTerms.get(0).getVocabularyUuid() != null) {
+ preferredTerms = cachedTermMap.get(initialTerms.get(0).getVocabularyUuid());
+ }
+ if (preferredTerms == null) {
+ preferredTerms = cachedTermMap.get(initialTerms.get(0).getTermType().getUuid());
+ }
+ if (preferredTerms == null) {
+ return initialTerms;
+ }
+ for (TermDto term : initialTerms) {
+ if (preferredTerms.contains(term)) {
+ filteredTerms.add(term);
+ }
+ }
+ if (filteredTerms.isEmpty()) {
+ return initialTerms;
+ }
+ }
+
+ return filteredTerms;
+ }
+
+
+ public <T extends DefinedTermBase> List<T> createTermListFromString(String stringValue, TermType type) {
+ List<String> checked = new ArrayList<>();
+
+ if (stringValue != null) {
+ String[] listChecked = stringValue.split(";"); //$NON-NLS-1$
+ String[] listCheckedComma = stringValue.split(","); //$NON-NLS-1$
+ if (listChecked != null) {
+ checked = Arrays.asList(listChecked);
+ }
+ if (listCheckedComma != null && stringValue.contains(",")) { //$NON-NLS-1$
+ checked = Arrays.asList(listCheckedComma);
+ }
+ }
List<T> termsFromStringValues = getTermsFromStringValues(checked, type);
return termsFromStringValues;
- }
-
- protected <T extends DefinedTermBase> List<T> getTermsFromStringValues(List<String> listValue, TermType type) {
- List<DefinedTermBase> termlist = new ArrayList<>();
- ITermService termService = CdmStore.getService(ITermService.class);
- Set<UUID> uuidList = new HashSet<>();
- for (String s : listValue) {
- if (StringUtils.isNotBlank(s)){
- UUID uuid = UUID.fromString(s);
- uuidList.add(uuid);
- }
- }
- if (!uuidList.isEmpty()){
- termlist = termService.find(uuidList);
- }else{
- termlist = termService.listByTermType(type, null, null, null, null);
- }
-
- return new ArrayList(termlist);
- }
-
- /**
+ }
+
+ protected <T extends DefinedTermBase> List<T> getTermsFromStringValues(List<String> listValue, TermType type) {
+ List<DefinedTermBase> termlist = new ArrayList<>();
+ ITermService termService = CdmStore.getService(ITermService.class);
+ List<UUID> uuidList = new ArrayList<>();
+
+ for (String s : listValue) {
+ if (StringUtils.isNotBlank(s)) {
+ UUID uuid = UUID.fromString(s);
+ uuidList.add(uuid);
+ }
+ }
+
+ List<T> allTerms = getTerms(uuidList, type);
+ if (!allTerms.isEmpty()) {
+ return allTerms;
+ }
+
+ if (!uuidList.isEmpty() && allTerms.isEmpty()) {
+ termlist = termService.find(new HashSet(uuidList));
+ } else {
+ termlist = termService.listByTermType(type, null, null, null, null);
+ }
+
+ return new ArrayList(termlist);
+ }
+
+ /**
* Generic method to get term preferences for a term vocabulary
*
- * @param initialTerms a {@link java.util.List} object.
+ * @param initialTerms
+ * a {@link java.util.List} object.
* @return a {@link java.util.List} object.
*/
- public List<TermDto> getFilteredTermDtos(List<TermDto> initialTerms){
+ public List<TermDto> getFilteredTermDtos(List<TermDto> initialTerms) {
List<TermDto> filteredTerms = new ArrayList<>();
- for (TermDto term : initialTerms){
- //TODO:inverse terms!!
- if(PreferencesUtil.getBooleanValue(getPrefNameByDto(term))){
+ for (TermDto term : initialTerms) {
+ // TODO:inverse terms!!
+ if (PreferencesUtil.getBooleanValue(getPrefNameByDto(term))) {
filteredTerms.add(term);
}
}
- if (filteredTerms.isEmpty()){
+ if (filteredTerms.isEmpty()) {
return initialTerms;
}
}
private <T extends TermBase> String getPrefName(T term) {
- return term.getTermType()!=null?term.getTermType().toString()+term.getUuid().toString():""+term.getUuid().toString();
+ return term.getTermType() != null ? term.getTermType().toString() + term.getUuid().toString()
+ : "" + term.getUuid().toString();
}
private String getPrefNameByDto(TermDto term) {
- return term.getTermType()!=null?term.getTermType().toString()+term.getUuid().toString():""+term.getUuid().toString();
+ return term.getTermType() != null ? term.getTermType().toString() + term.getUuid().toString()
+ : "" + term.getUuid().toString();
+ }
+
+ private <T extends DefinedTermBase> TermVocabulary<T> getTermVocabulary(Collection<T> initialTerms) {
+
+ if (!initialTerms.isEmpty()) {
+ T entity = initialTerms.iterator().next();
+ return entity.getVocabulary();
+ }
+ return null;
}
- private <T extends DefinedTermBase> TermVocabulary<T> getTermVocabulary(Collection<T> initialTerms){
-
- if(!initialTerms.isEmpty()){
- T entity = initialTerms.iterator().next();
- return entity.getVocabulary();
- }
- return null;
- }
-
- /**
- * Generic method to set term preferences
- *
- * @param preferredTerms a {@link java.util.List} object.
- * @param initialTerms a {@link java.util.List} object.
- * @param <T> a T object.
- */
- public <T extends DefinedTermBase> void setPreferredTerms(Collection<T> preferredTerms, Collection<T> initialTerms){
- TermVocabulary<T> voc = getTermVocabulary(initialTerms);
- Collection<UUID> undesiredTermUuids = new ArrayList<>();
- for(TermBase term : initialTerms){
- if(! preferredTerms.contains(term)){
- undesiredTermUuids.add(term.getUuid());
- PreferencesUtil.setBooleanValue(getPrefName(term), false);
- }else{
- PreferencesUtil.setBooleanValue(getPrefName(term), true);
- }
- }
- clearTermMapForTermVoc(voc.getUuid());
- }
-
- /**
+ /**
* Generic method to set term preferences
*
- * @param preferredTerms a {@link java.util.List} object.
- * @param initialTerms a {@link java.util.List} object.
- * @param <T> a T object.
+ * @param preferredTerms
+ * a {@link java.util.List} object.
+ * @param initialTerms
+ * a {@link java.util.List} object.
+ * @param <T>
+ * a T object.
*/
- public void setPreferredTermsByType(Collection<TermDto> preferredTerms, TermType type){
- List<?> oldValues = getPreferredTerms(type);
- if (oldValues != null){
- for (Object term: oldValues){
- if (term instanceof TermDto){
- PreferencesUtil.setBooleanValue(getPrefNameByDto((TermDto)term), false);
- }else{
- PreferencesUtil.setBooleanValue(getPrefName((DefinedTermBase)term), false);
- }
+ public <T extends DefinedTermBase> void setPreferredTerms(Collection<T> preferredTerms,
+ Collection<T> initialTerms) {
+ TermVocabulary<T> voc = getTermVocabulary(initialTerms);
+ Collection<UUID> undesiredTermUuids = new ArrayList<>();
+ for (TermBase term : initialTerms) {
+ if (!preferredTerms.contains(term)) {
+ undesiredTermUuids.add(term.getUuid());
+ PreferencesUtil.setBooleanValue(getPrefName(term), false);
+ } else {
+ PreferencesUtil.setBooleanValue(getPrefName(term), true);
}
}
-// for(TermDto term : preferredTerms){
-// PreferencesUtil.setBooleanValue(getPrefNameByDto(term), true);
-//
-// }
+ clearTermMapForTermVoc(voc.getUuid());
+ }
+ /**
+ * Generic method to set term preferences
+ *
+ * @param preferredTerms
+ * a {@link java.util.List} object.
+ * @param initialTerms
+ * a {@link java.util.List} object.
+ * @param <T>
+ * a T object.
+ */
+ public void setPreferredTermsByType(Collection<TermDto> preferredTerms, TermType type) {
clearTermMapForTermType(type);
List<TermDto> list = new ArrayList<>(preferredTerms);
cachedTermMap.put(type.getUuid(), list);
/**
* Generic method to set term preferences
*
- * @param preferredTerms a {@link java.util.List} object.
- * @param initialTerms a {@link java.util.List} object.
- * @param <T> a T object.
+ * @param preferredTerms
+ * a {@link java.util.List} object.
+ * @param initialTerms
+ * a {@link java.util.List} object.
+ * @param <T>
+ * a T object.
*/
- public void setPreferredTermsByDto(Collection<TermDto> preferredTerms, TermVocabularyDto vocDto){
+ public void setPreferredTermsByDto(Collection<TermDto> preferredTerms, TermCollectionDto termCollectionDto) {
- List<TermDto> oldValues = getPreferredTerms(vocDto);
- for (TermDto term: oldValues){
+ List<TermDto> oldValues = getPreferredTerms(termCollectionDto);
+ for (TermDto term : oldValues) {
PreferencesUtil.setBooleanValue(getPrefNameByDto(term), false);
}
TermType type = null;
boolean allSameType = true;
- for(TermDto term : preferredTerms){
+ for (TermDto term : preferredTerms) {
PreferencesUtil.setBooleanValue(getPrefNameByDto(term), true);
- if (type == null){
- type = term.getTermType();
- }else if (!type.equals(term.getTermType())){
- allSameType = false;
- }
+ if (type == null) {
+ type = term.getTermType();
+ } else if (!type.equals(term.getTermType())) {
+ allSameType = false;
+ }
}
- //if (initialTerms.iterator().hasNext()){
- clearTermMapForTermVoc(vocDto.getUuid());
- List<TermDto> list = new ArrayList<>(preferredTerms);
- cachedTermMap.put(vocDto.getUuid(), list);
- if (allSameType){
- cachedTermMap.put(type, list);
- }
- //}
+ // if (initialTerms.iterator().hasNext()){
+ clearTermMapForTermVoc(termCollectionDto.getUuid());
+ List<TermDto> list = new ArrayList<>(preferredTerms);
+ cachedTermMap.put(termCollectionDto.getUuid(), list);
+ if (allSameType) {
+ cachedTermMap.put(type, list);
+ }
+ // }
}
+ public <T extends DefinedTermBase> void clearTermMapForTermVoc(UUID vocUuid) {
+ cachedTermMap.remove(vocUuid);
+ }
- public <T extends DefinedTermBase> void clearTermMapForTermVoc(UUID vocUuid){
- cachedTermMap.remove(vocUuid);
- }
-
- public void clearTermMapForTermType(TermType termType){
+ public void clearTermMapForTermType(TermType termType) {
cachedTermMap.remove(termType.getUuid());
}
- /**
+ /**
* Generic method to get term preferences for a term vocabulary
*
- * @param initialTerms a {@link java.util.List} object.
+ * @param initialTerms
+ * a {@link java.util.List} object.
* @return a {@link java.util.List} object.
*/
- public <T extends DefinedTermBase> List<T> getTerms(List<UUID> uuidList, Class clazz){
+ public <T extends DefinedTermBase> List<T> getTerms(List<UUID> uuidList, Class clazz) {
List<T> filteredTerms = new ArrayList<>();
@SuppressWarnings("unchecked")
- List<T> terms = TermStore.getTerms(clazz);
- if (uuidList == null || uuidList.isEmpty()){
+ List<T> terms = TermStore.getTerms(clazz);
+ if (uuidList == null || uuidList.isEmpty()) {
return terms;
}
- for (T term : terms){
- if(uuidList.contains(term.getUuid())){
+ for (T term : terms) {
+ if (uuidList.contains(term.getUuid())) {
filteredTerms.add(term);
}
}
/**
* Generic method to get term preferences for a term vocabulary
*
- * @param initialTerms a {@link java.util.List} object.
+ * @param initialTerms
+ * a {@link java.util.List} object.
* @return a {@link java.util.List} object.
*/
- public <T extends DefinedTermBase> List<T> getTerms(List<UUID> uuidList, TermType type){
+ public <T extends DefinedTermBase> List<T> getTerms(List<UUID> uuidList, TermType type) {
List<T> filteredTerms = new ArrayList<>();
List<T> terms = TermStore.getTerms(type, null);
- if (uuidList == null || uuidList.isEmpty()){
+ if (uuidList == null || uuidList.isEmpty()) {
return terms;
}
- for (T term : terms){
- if(uuidList.contains(term.getUuid())){
+
+ for (T term : terms) {
+ if (uuidList.contains(term.getUuid())) {
filteredTerms.add(term);
}
}
-
return filteredTerms;
}
/**
* Generic method to get term preferences for a term vocabulary
*
- * @param initialTerms a {@link java.util.List} object.
+ * @param initialTerms
+ * a {@link java.util.List} object.
* @return a {@link java.util.List} object.
*/
- public <T extends DefinedTermBase> List<T> getAllTerms(TermType type, Comparator comparator){
+ public <T extends DefinedTermBase> List<T> getAllTerms(TermType type, Comparator comparator) {
List<T> terms = TermStore.getTerms(type, comparator);
return terms;
}
* 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.store;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
-import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.common.MarkerType;
-import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
import eu.etaxonomy.cdm.model.name.Rank;
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
+import eu.etaxonomy.cdm.model.term.DefinedTermBase;
+import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.taxeditor.model.DefaultTermComparator;
-import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
/**
*
* @author n.hoffmann
* @created 25.06.2009
- * @version 1.0
*/
public class TermStore {
}
/**
- * Handingling of special cases
+ * Handling of special cases
*/
private static Set<ITermStoreEdgeCase<? extends DefinedTermBase>> termStoreEdgeCases = new HashSet<>();
public abstract List<TERM> getTerms();
}
-}
+}
\ No newline at end of file
/**\r
* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
-* \r
+*\r
* The contents of this file are subject to the Mozilla protected License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
import eu.etaxonomy.cdm.model.term.VocabularyEnum;\r
\r
public class UsageTermCollection {\r
- protected final static UUID uuidMarkersVocabulary = UUID.fromString("19dffff7-e142-429c-a420-5d28e4ebe305");\r
- \r
+\r
+ protected final static UUID uuidMarkersVocabulary = UUID.fromString("19dffff7-e142-429c-a420-5d28e4ebe305");\r
+\r
public final static UUID uuidUseMarkerType = UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039");\r
- \r
+\r
protected final static UUID uuidFeatureVocabulary = VocabularyEnum.Feature.getUuid(); // UUID.fromString("b187d555-f06f-4d65-9e53-da7c93f8eaa8");\r
protected final static UUID uuidPalmWebFeatureTree = UUID.fromString("72ccce05-7cc8-4dab-8e47-bf3f5fd848a0");\r
- \r
- \r
+\r
+\r
protected final static UUID uuidUseRecordFeature = UUID.fromString("8125a59d-b4d5-4485-89ea-67306297b599");\r
- \r
+\r
protected final static UUID uuidUseSummaryFeature = UUID.fromString("6acb0348-c070-4512-a37c-67bcac016279");\r
- \r
+\r
public final static UUID uuidUseCategoryVocabulary = UUID.fromString("67430d7c-fd43-4e9d-af5e-d0dca3f74931");\r
protected final static UUID uuidUseCategoryDummy = UUID.fromString("983a7184-6a51-489e-aca1-f21fc4fdbae3");\r
protected final static UUID uuidUseSubCategoryDummy = UUID.fromString("a8d80223-5c79-4063-8c6b-4dc8681e9c62");\r
- \r
+\r
protected final static UUID uuidCountryVocabulary = UUID.fromString("116c51f1-e63a-46f7-a258-e1149a42868b");\r
protected final static UUID uuidCountryDummy = UUID.fromString("761dddee-bfa2-41f4-82df-3a19c71adee0");\r
- \r
+\r
protected final static UUID uuidPlantPartVocabulary = UUID.fromString("369914fe-d54b-4063-99ce-abc81d30ad35");\r
protected final static UUID uuidPlantPartDummy = UUID.fromString("30150a82-a12f-4278-96ad-7ce708efa082");\r
- \r
+\r
protected final static UUID uuidHumanGroupVocabulary = UUID.fromString("ca46cea5-bdf7-438d-9cd8-e2793d2178dc");\r
protected final static UUID uuidHumanGroupDummy = UUID.fromString("c4b63327-2548-429d-8d55-81fdba5900a5");\r
protected final static UUID uuidEthnicGroupDummy = UUID.fromString("3ca851e5-d0d4-41cd-9066-f79e246c36c2");\r
public final static String humanGroupLabel = "Human Group";\r
public final static String ethnicGroupLabel = "Ethnic Group";\r
public final static String notAvailableLabel = "N/A";\r
- \r
- \r
- \r
- \r
- \r
- \r
\r
\r
- \r
- \r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
}\r
import org.eclipse.core.runtime.IProgressMonitor;\r
import org.eclipse.core.runtime.NullProgressMonitor;\r
\r
-import eu.etaxonomy.cdm.common.URI;\r
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
import eu.etaxonomy.cdm.api.service.ITermService;\r
import eu.etaxonomy.cdm.api.service.IVocabularyService;\r
+import eu.etaxonomy.cdm.common.URI;\r
import eu.etaxonomy.cdm.model.common.MarkerType;\r
import eu.etaxonomy.cdm.model.description.Feature;\r
import eu.etaxonomy.cdm.model.description.State;\r
import eu.etaxonomy.cdm.model.term.DefinedTerm;\r
+import eu.etaxonomy.cdm.model.term.OrderedTermVocabulary;\r
import eu.etaxonomy.cdm.model.term.TermType;\r
import eu.etaxonomy.cdm.model.term.TermVocabulary;\r
\r
monitor = new NullProgressMonitor();\r
}\r
\r
- ConversationHolder conversation = CdmStore.createConversation();\r
+ //TODO remove ConversationHolder as we do not use it anymore since remoting\r
+ ConversationHolder conversation = null; //CdmStore.createConversation();\r
\r
//retrieve terms and vocabularies from db\r
useRecordFeature = (Feature) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseRecordFeature);\r
// if (palmWebFeatureTree != null){\r
// CdmStore.getService(ITermTreeService.class).saveOrUpdate(palmWebFeatureTree);\r
// }\r
- conversation.commit(true);\r
+\r
+// conversation.commit(true);\r
\r
}\r
- conversation.close();\r
+// conversation.close();\r
}\r
\r
private static void createHumanGroupVocabulary(IProgressMonitor monitor,ConversationHolder conversation) {\r
- TermVocabulary<DefinedTerm> humanGroupVocabulary = CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidHumanGroupVocabulary);\r
+ TermVocabulary<DefinedTerm> humanGroupVocabulary = CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidHumanGroupVocabulary);\r
if (humanGroupVocabulary == null){\r
monitor.subTask("create human group vocabulary");\r
URI termSourceUri = null;\r
e.printStackTrace();\r
}\r
\r
- humanGroupVocabulary = TermVocabulary.NewInstance(TermType.Modifier, UsageTermCollection.humanGroupLabel, UsageTermCollection.humanGroupLabel, null, termSourceUri);\r
+ humanGroupVocabulary = TermVocabulary.NewInstance(TermType.Modifier, DefinedTerm.class, UsageTermCollection.humanGroupLabel, UsageTermCollection.humanGroupLabel, null, termSourceUri);\r
humanGroupVocabulary.setUuid(UsageTermCollection.uuidHumanGroupVocabulary);\r
\r
DefinedTerm newDummyModifier = DefinedTerm.NewInstance(TermType.Modifier, UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
}\r
\r
private static void createPlantVocabulary(IProgressMonitor monitor, ConversationHolder conversation) {\r
- TermVocabulary<DefinedTerm> plantPartVocabulary = CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidPlantPartVocabulary);\r
+ TermVocabulary<DefinedTerm> plantPartVocabulary = CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidPlantPartVocabulary);\r
if (plantPartVocabulary == null){\r
monitor.subTask("create plant part vocabulary");\r
URI termSourceUri = null;\r
} catch (URISyntaxException e) {\r
e.printStackTrace();\r
}\r
- plantPartVocabulary = TermVocabulary.NewInstance(TermType.Modifier, UsageTermCollection.plantPartLabel, UsageTermCollection.plantPartLabel, null, termSourceUri);\r
+ plantPartVocabulary = TermVocabulary.NewInstance(TermType.Modifier, DefinedTerm.class, UsageTermCollection.plantPartLabel, UsageTermCollection.plantPartLabel, null, termSourceUri);\r
plantPartVocabulary.setUuid(UsageTermCollection.uuidPlantPartVocabulary);\r
\r
DefinedTerm newDummyModifier = DefinedTerm.NewInstance(TermType.Modifier, UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
}\r
\r
private static void createCountryVocabulary(IProgressMonitor monitor, ConversationHolder conversation) {\r
- TermVocabulary<DefinedTerm> countryVocabulary = CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidCountryVocabulary);\r
+ TermVocabulary<DefinedTerm> countryVocabulary = CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidCountryVocabulary);\r
if (countryVocabulary == null){\r
monitor.subTask("create country vocabulary");\r
URI termSourceUri = null;\r
} catch (URISyntaxException e) {\r
e.printStackTrace();\r
}\r
- countryVocabulary = TermVocabulary.NewInstance(TermType.Modifier, UsageTermCollection.countryLabel, UsageTermCollection.countryLabel, null, termSourceUri);\r
+ countryVocabulary = TermVocabulary.NewInstance(TermType.Modifier, DefinedTerm.class, UsageTermCollection.countryLabel, UsageTermCollection.countryLabel, null, termSourceUri);\r
countryVocabulary.setUuid(UsageTermCollection.uuidCountryVocabulary);\r
\r
DefinedTerm newDummyModifier = DefinedTerm.NewInstance(TermType.Modifier, UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
}\r
\r
private static void createStateVocabulary(IProgressMonitor monitor, ConversationHolder conversation) {\r
- TermVocabulary<State> stateVocabulary = CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidUseCategoryVocabulary);\r
+ TermVocabulary<State> stateVocabulary = CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidUseCategoryVocabulary);\r
if (stateVocabulary == null){\r
monitor.subTask("create state vocabulary");\r
URI termSourceUri = null;\r
e.printStackTrace();\r
}\r
\r
- stateVocabulary = TermVocabulary.NewInstance(TermType.State, UsageTermCollection.useCategoryVocabularyLabel, UsageTermCollection.useCategoryVocabularyLabel, null, termSourceUri);\r
+ stateVocabulary = OrderedTermVocabulary.NewOrderedInstance(TermType.State, State.class, UsageTermCollection.useCategoryVocabularyLabel, UsageTermCollection.useCategoryVocabularyLabel, null, termSourceUri);\r
stateVocabulary.setUuid(UsageTermCollection.uuidUseCategoryVocabulary);\r
\r
State newDummyState = State.NewInstance(UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>AvailableFeaturesWizard class.</p>
+ * <p>
+ * AvailableFeaturesWizard class.
+ * </p>
*
* @author n.hoffmann
* @created Aug 5, 2010
*/
public class AvailableTermsWizard extends Wizard {
- private AvailableTermsWizardPage page;
+ private AvailableTermsWizardPage page;
- private Set<DefinedTermBase> additionalFeatures;
+ private Set<DefinedTermBase> additionalFeatures;
private List<TermVocabularyDto> vocabularyDtos;
private boolean singleSelection = false;
- public AvailableTermsWizard(TermType termType){
+ public AvailableTermsWizard(TermType termType) {
vocabularyDtos = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermType(termType);
- }
+ }
- public AvailableTermsWizard(List<TermVocabularyDto> vocabularyDtos){
- this.vocabularyDtos = vocabularyDtos;
- }
+ public AvailableTermsWizard(List<TermVocabularyDto> vocabularyDtos) {
+ this.vocabularyDtos = vocabularyDtos;
+ }
- /** {@inheritDoc} */
- @Override
- public void addPages() {
- page = new AvailableTermsWizardPage(vocabularyDtos,singleSelection);
- addPage(page);
- }
+ /** {@inheritDoc} */
+ @Override
+ public void addPages() {
+ page = new AvailableTermsWizardPage(vocabularyDtos, singleSelection);
+ addPage(page);
+ }
- @Override
- public boolean canFinish() {
+ @Override
+ public boolean canFinish() {
int size = page.getSelectedFeatures().size();
- return singleSelection?size==1:size>0;
- }
-
- /** {@inheritDoc} */
- @Override
- public boolean performFinish() {
- additionalFeatures = page.getSelectedFeatures();
- if(singleSelection && additionalFeatures.size()>1){
- MessagingUtils.warningDialog("Too many terms selected", this, "You can only select 1 term");
- }
- return additionalFeatures.size() > 0;
- }
-
- public Set<DefinedTermBase> getAdditionalFeatures() {
- return additionalFeatures;
- }
+ return singleSelection ? size == 1 : size > 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean performFinish() {
+ additionalFeatures = page.getSelectedFeatures();
+ if (singleSelection && additionalFeatures.size() > 1) {
+ MessagingUtils.warningDialog("Too many terms selected", this, "You can only select 1 term");
+ }
+ return additionalFeatures.size() > 0;
+ }
+
+ public Set<DefinedTermBase> getAdditionalFeatures() {
+ return additionalFeatures;
+ }
public void setSingleSelection(boolean singleSelection) {
this.singleSelection = singleSelection;
private CheckBoxTreeComposite treeComposite;
private List<TermVocabularyDto> vocabularies;
- protected AvailableTermsWizardPage(List<TermVocabularyDto> vocabularies, boolean singleSelection) {
- super("Available Terms Wizard Page");
- this.vocabularies = vocabularies;
- setTitle("Available Terms");
- if(singleSelection){
- setDescription("Please select one single term");
- }
- else{
- setDescription("Please select terms.");
- }
- }
+ protected AvailableTermsWizardPage(List<TermVocabularyDto> vocabularies, boolean singleSelection) {
+ super("Available Terms Wizard Page");
+ this.vocabularies = vocabularies;
+ setTitle("Available Terms");
+ if (singleSelection) {
+ setDescription("Please select one single term");
+ } else {
+ setDescription("Please select terms.");
+ }
+ }
- /** {@inheritDoc} */
- @Override
- public void createControl(Composite parent) {
- treeComposite = new CheckBoxTreeComposite(parent, new TermDtoContentProvider(), new TermDtoLabelProvider(), SWT.NONE);
+ /** {@inheritDoc} */
+ @Override
+ public void createControl(Composite parent) {
+ treeComposite = new CheckBoxTreeComposite(parent, new TermDtoContentProvider(), new TermDtoLabelProvider(),
+ SWT.NONE);
treeComposite.getViewer().setComparator(new DefinedTermSorter());
treeComposite.getViewer().setInput(vocabularies);
treeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
- treeComposite.getViewer().addSelectionChangedListener(e->getWizard().getContainer().updateButtons());
+ treeComposite.getViewer().addSelectionChangedListener(e -> getWizard().getContainer().updateButtons());
- setControl(treeComposite);
- }
+ setControl(treeComposite);
+ }
- public Set<DefinedTermBase> getSelectedFeatures() {
+ public Set<DefinedTermBase> getSelectedFeatures() {
List<Object> checkedElements = Arrays.asList(treeComposite.getViewer().getCheckedElements());
- checkedElements = checkedElements.stream().filter(element->element instanceof TermDto).collect(Collectors.toList());
+ checkedElements = checkedElements.stream().filter(element -> element instanceof TermDto)
+ .collect(Collectors.toList());
- Set<DefinedTermBase> terms = new HashSet<>();
+ Set<DefinedTermBase> terms = new HashSet<>();
- for(Object element : checkedElements){
- if(element instanceof TermDto){
- DefinedTermBase term = CdmStore.getService(ITermService.class).load(((TermDto) element).getUuid());
- terms.add(term);
- }
- }
- return terms;
- }
+ for (Object element : checkedElements) {
+ if (element instanceof TermDto) {
+ DefinedTermBase term = CdmStore.getService(ITermService.class).load(((TermDto) element).getUuid());
+ terms.add(term);
+ }
+ }
+ return terms;
+ }
}
private List<AbstractTermDto> selectedTerms;
private TermDto term;
+ private boolean skipStandartVocs = false;
+ private boolean skipManagedColls = true;
public TermChooseWizard(TermDto term){
this.term = term;
-
-
}
+ public TermChooseWizard(TermDto term, boolean skipStandartVocs, boolean skipManagedColl){
+ this.term = term;
+ this.skipStandartVocs = skipStandartVocs;
+ this.skipManagedColls = skipManagedColl;
+ }
+
public List<AbstractTermDto> getSelectedTerms() {
return selectedTerms;
}
+ public boolean isSkipStandartVocs() {
+ return skipStandartVocs;
+ }
+
+ public void setSkipStandartVocs(boolean skipStandartVocs) {
+ this.skipStandartVocs = skipStandartVocs;
+ }
@Override
public void addPages() {
- page = new TermChooseWizardPage(term);
+ page = new TermChooseWizardPage(term, skipStandartVocs, skipManagedColls);
page.setPageComplete(false);
addPage(page);
}
private TermSearchController controller;
private TermDto term;
+ private boolean skipStandartVocs;
+ private boolean skipManagedColls = true;
- protected TermChooseWizardPage(TermDto term) {
+ protected TermChooseWizardPage(TermDto term, boolean skipStandardVocs) {
super("Term Choose Wizard");
setTitle("Choose Parent");
setDescription("Please search and select the parent term or vocabulary (if you want to move the term as root).");
this.term = term;
+ this.skipStandartVocs = skipStandardVocs;
}
+
+ protected TermChooseWizardPage(TermDto term, boolean skipStandardVocs, boolean skipManagedColls) {
+ super("Term Choose Wizard");
+ setTitle("Choose Parent");
+ setDescription("Please search and select the parent term or vocabulary (if you want to move the term as root).");
+ this.term = term;
+ this.skipStandartVocs = skipStandardVocs;
+ this.skipManagedColls = skipManagedColls;
+ }
+
+ public boolean isSkipStandartVocs() {
+ return skipStandartVocs;
+ }
+
+ public void setSkipStandartVocs(boolean skipStandartVocs) {
+ this.skipStandartVocs = skipStandartVocs;
+ }
+
+ public boolean isSkipManagedColls() {
+ return skipManagedColls;
+ }
+
+ public void setSkipManagedColls(boolean skipManagedColls) {
+ this.skipManagedColls = skipManagedColls;
+ }
@Override
public void createControl(Composite parent) {
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.term.TermNode;
import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
* @author pplitzner
* @since Nov 22, 2018
*/
-public interface ITermTreeEditor<T extends DefinedTermBase>
- extends IPostOperationEnabled, IE4SavablePart, ICdmEntitySessionEnabled {
+public interface ITermTreeEditor<T extends DefinedTermBase>
+ extends IPostOperationEnabled, IE4SavablePart, ICdmEntitySessionEnabled {
public TermType getTermType();
public TermNodeDto getNodeDtoForUuid(UUID nodeUuid);
- public TermTreeDto getTreeDtoForUuid(UUID treeUuid);
+
+ public TermCollectionDto getTreeDtoForUuid(UUID treeUuid);
+
public void setNodeDtoForUuid(TermNodeDto node);
+
public void setTreeDtoForUuid(TermTreeDto tree);
- public boolean checkDuplicates(UUID termUuid, UUID treeUuid) ;
+ public boolean checkDuplicates(UUID termUuid, UUID treeUuid);
public void addOperation(AbstractPostOperation<TermNode> operation);
public void setDirty();
public TreeViewer getViewer();
+
public void refresh();
}
\ No newline at end of file
public class TermNodeDragListener extends DragSourceAdapter {
- private final TreeViewer viewer;
+ private final TreeViewer viewer;
- public TermNodeDragListener(TreeViewer viewer) {
- this.viewer = viewer;
- }
+ public TermNodeDragListener(TreeViewer viewer) {
+ this.viewer = viewer;
+ }
/**
* Method declared on DragSourceListener
@Override
public void dragSetData(DragSourceEvent event) {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- if(selection!=null && !selection.isEmpty()){
+ if (selection != null && !selection.isEmpty()) {
TermNode[] featureNodes = (TermNode[]) selection.toList().toArray(new TermNode[selection.size()]);
+ for (TermNode node : featureNodes) {
+ // if the termgraph is managed, it is not allowed to edit it.
+ if (node.getGraph().isManaged()) {
+ return;
+ }
+
+ }
if (TermNodeTransfer.getInstance().isSupportedType(event.dataType)) {
event.data = featureNodes;
}
}
- /**
- * Method declared on DragSourceListener
- */
- @Override
- public void dragStart(DragSourceEvent event) {
- ISelection sel = viewer.getSelection();
- event.doit = !viewer.getSelection().isEmpty()
- && ((IStructuredSelection) viewer.getSelection()).toList()
+ /**
+ * Method declared on DragSourceListener
+ */
+ @Override
+ public void dragStart(DragSourceEvent event) {
+ ISelection sel = viewer.getSelection();
+ event.doit = !viewer.getSelection().isEmpty() && ((IStructuredSelection) viewer.getSelection()).toList()
.stream().allMatch(element -> element instanceof TermNode);
- }
+ }
}
\ No newline at end of file
}
}
}
-
}
/**
if (sel instanceof TreeSelection && ((TreeSelection)sel).getFirstElement() instanceof TermNodeDto){
event.doit = !viewer.getSelection().isEmpty()
&& ((IStructuredSelection) viewer.getSelection()).toList()
- .stream().allMatch(element -> element instanceof TermNodeDto);
+ .stream().allMatch(element -> element instanceof TermNodeDto)
+ && ((IStructuredSelection) viewer.getSelection()).toList()
+ .stream().allMatch(element -> !((TermNodeDto)element).isExternallyManaged());
}else {
event.doit = !viewer.getSelection().isEmpty()
&& ((IStructuredSelection) viewer.getSelection()).toList()
Object currentTarget = getCurrentTarget();
TermNodeDto target = null;
if(currentTarget instanceof TermTreeDto){
+ if (((TermTreeDto) currentTarget).isManaged()) {
+ return false;
+ }
target = ((TermTreeDto) currentTarget).getRoot();
}
else if(currentTarget instanceof TermNodeDto){
+ if (((TermNodeDto) currentTarget).isExternallyManaged() ) {
+ return false;
+ }
target = (TermNodeDto) currentTarget;
}
-
+
int position = 0;
int location = getCurrentLocation();
UUID parentUuid = target.getParentUuid();
AddFeatureOperation operation = new AddFeatureOperation(
termDto.getUuid(),
target.getUuid(), position, editor, editor);
- TermNodeDto newDto = new TermNodeDto(termDto, target, position, target.getTree(), null, null, null);
+ TermNodeDto newDto = new TermNodeDto(termDto, target, position, null, null, 0, null, null);
editor.setDirty();
editor.addOperation(operation);
TermTreeDto rootTree = null;
if (getSelectedObject() instanceof TermNodeDto){
TermNodeDto selectedNode = (TermNodeDto)getSelectedObject();
- rootTree = selectedNode.getTree();
+ rootTree = (TermTreeDto) editor.getTreeDtoForUuid(selectedNode.getTreeUuid());
+
}
if(target instanceof TermTreeDto && getCurrentLocation()!=ViewerDropAdapter.LOCATION_ON){
return false;
if (target == null){
return false;
}
- if (target instanceof TermNodeDto && ((TermNodeDto)target).getTree().isFlat() && getCurrentLocation() == LOCATION_ON){
+ if (target instanceof TermNodeDto && ((TermNodeDto)target).isFlat() && getCurrentLocation() == LOCATION_ON){
return false;
}
TermDto term = null;
private boolean checkDuplication(Object target, TermTreeDto rootTree, TermDto term) {
TermTreeDto targetTree = null;
if (target instanceof TermNodeDto){
- targetTree = ((TermNodeDto)target).getTree();
+ targetTree = (TermTreeDto) editor.getTreeDtoForUuid(((TermNodeDto)target).getTreeUuid());
}else if (target instanceof TermTreeDto){
targetTree = (TermTreeDto)target;
}
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.term.TermTree;
import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
import eu.etaxonomy.taxeditor.editor.definedterm.TermTransfer;
* @author pplitzner
* @since Jun 19, 2017
*/
-public class TermTreeDtoEditorComposite <T extends DefinedTermBase> extends Composite{
+public class TermTreeDtoEditorComposite<T extends DefinedTermBase> extends Composite {
- private TermTreeDto featureTree;
+ private TermCollectionDto featureTree;
private Label label_title;
private Text text_title;
setLayout(new GridLayout(1, false));
Composite composite_treeTitle = new Composite(this, SWT.NULL);
- composite_treeTitle.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true,
- false));
+ composite_treeTitle.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
GridLayout gl_composite_treeTitle = new GridLayout(3, false);
gl_composite_treeTitle.marginWidth = 0;
composite_treeTitle.setLayout(gl_composite_treeTitle);
viewer = new TreeViewer(new Tree(this, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI));
Tree tree = viewer.getTree();
tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
- viewer.getControl().setLayoutData(
- new GridData(SWT.FILL, SWT.FILL, true, true));
+ viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
}
- public void init(String label,
- DragSourceListener dragSourceListener,
- DropTargetListener dropTargetListener,
- ISelectionChangedListener viewerSelectionChangedListener,
- IDirtyMarkable dirtyMarkable,
+ public void init(String label, DragSourceListener dragSourceListener, DropTargetListener dropTargetListener,
+ ISelectionChangedListener viewerSelectionChangedListener, IDirtyMarkable dirtyMarkable,
ModifyListener textModifyListener) {
- init(label,
- null,
- dragSourceListener,
- dropTargetListener,
- null,
- viewerSelectionChangedListener,
- null,
- dirtyMarkable,
- textModifyListener);
+ init(label, null, dragSourceListener, dropTargetListener, null, viewerSelectionChangedListener, null,
+ dirtyMarkable, textModifyListener);
}
- public void init(String label, TermType termType,
- DragSourceListener dragSourceListener,
- DropTargetListener dropTargetListener,
- ISelectionChangedListener viewerSelectionChangedListener,
- IDirtyMarkable dirtyMarkable,
- ModifyListener textModifyListener) {
- this.init(label,
- termType,
- dragSourceListener,
- dropTargetListener,
- null,
- viewerSelectionChangedListener,
- null,
- dirtyMarkable,
- textModifyListener);
+ public void init(String label, TermType termType, DragSourceListener dragSourceListener,
+ DropTargetListener dropTargetListener, ISelectionChangedListener viewerSelectionChangedListener,
+ IDirtyMarkable dirtyMarkable, ModifyListener textModifyListener) {
+ this.init(label, termType, dragSourceListener, dropTargetListener, null, viewerSelectionChangedListener, null,
+ dirtyMarkable, textModifyListener);
}
- public void init(DragSourceListener dragSourceListener,
- DropTargetListener dropTargetListener,
- Transfer[] transfers,
+
+ public void init(DragSourceListener dragSourceListener, DropTargetListener dropTargetListener, Transfer[] transfers,
ISelectionChangedListener viewerSelectionChangedListener,
- SelectionListener openFeatureTreeSelectionListener,
- ModifyListener textModifyListener) {
- init(null,
- null,
- dragSourceListener,
- dropTargetListener,
- transfers,
- viewerSelectionChangedListener,
- openFeatureTreeSelectionListener,
- null,
- textModifyListener);
+ SelectionListener openFeatureTreeSelectionListener, ModifyListener textModifyListener) {
+ init(null, null, dragSourceListener, dropTargetListener, transfers, viewerSelectionChangedListener,
+ openFeatureTreeSelectionListener, null, textModifyListener);
}
- private void init(String label,
- TermType termType,
- DragSourceListener dragSourceListener,
- DropTargetListener dropTargetListener,
- Transfer[] transfers,
+
+ private void init(String label, TermType termType, DragSourceListener dragSourceListener,
+ DropTargetListener dropTargetListener, Transfer[] transfers,
ISelectionChangedListener viewerSelectionChangedListener,
- SelectionListener openFeatureTreeSelectionListener,
- IDirtyMarkable dirtyMarkable,
+ SelectionListener openFeatureTreeSelectionListener, IDirtyMarkable dirtyMarkable,
ModifyListener textModifyListener) {
- if(label!=null){
+ if (label != null) {
label_title.setText(label);
}
viewer.setLabelProvider(new TermTreeLabelProvider());
int ops = DND.DROP_COPY | DND.DROP_MOVE;
- if(transfers==null){
- transfers = new Transfer[] {
- CharacterNodeDtoTransfer.getInstance(),
- TermTransfer.getInstance(),
- };
+ if (transfers == null) {
+ transfers = new Transfer[] { CharacterNodeDtoTransfer.getInstance(), TermTransfer.getInstance(), };
}
- if(dragSourceListener!=null){
+ if (dragSourceListener != null) {
viewer.addDragSupport(ops, transfers, dragSourceListener);
}
- if(dropTargetListener!=null){
+ if (dropTargetListener != null) {
viewer.addDropSupport(ops, transfers, dropTargetListener);
}
- if(viewerSelectionChangedListener!=null){
+ if (viewerSelectionChangedListener != null) {
viewer.addSelectionChangedListener(viewerSelectionChangedListener);
}
- if(textModifyListener!=null){
+ if (textModifyListener != null) {
text_title.addModifyListener(textModifyListener);
}
- //add specific selection listener
- if(openFeatureTreeSelectionListener!=null){
+ // add specific selection listener
+ if (openFeatureTreeSelectionListener != null) {
btnOpenFeatureTree.addSelectionListener(openFeatureTreeSelectionListener);
- }
- else{
- //add default selection listener
- btnOpenFeatureTree.addSelectionListener(new SelectionAdapter(){
+ } else {
+ // add default selection listener
+ btnOpenFeatureTree.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- TermTree<T> tree = FeatureTreeSelectionDialog.select(getDisplay().getActiveShell(),
- null, termType);
- if(tree!=null){
+ TermTree<T> tree = FeatureTreeSelectionDialog.select(getDisplay().getActiveShell(), null, termType);
+ if (tree != null) {
setSelectedTree(tree);
- if(dirtyMarkable!=null){
+ if (dirtyMarkable != null) {
dirtyMarkable.forceDirty();
}
}
public void setSelectedTree(TermTree<T> featureTree) {
this.featureTree = CdmStore.getService(ITermTreeService.class).getTermTreeDtoByUuid(featureTree.getUuid());
- addChildNodesToMap(this.featureTree.getRoot());
+ addChildNodesToMap(((TermTreeDto) this.featureTree).getRoot());
viewer.setInput(this.featureTree);
- StoreUtil.setTextWithoutModifyListeners(text_title, featureTree!=null?featureTree.getTitleCache():"");
+ StoreUtil.setTextWithoutModifyListeners(text_title, featureTree != null ? featureTree.getTitleCache() : "");
}
private void addChildNodesToMap(TermNodeDto root) {
this.nodeUuidMap.put(root.getUuid(), root);
- if (root.getTerm() != null){
+ if (root.getTerm() != null) {
this.featureTree.addTerm(root.getTerm());
}
- for (TermNodeDto child: root.getChildren()){
+ for (TermNodeDto child : root.getChildren()) {
addChildNodesToMap(child);
}
}
- public TermTreeDto getFeatureTree() {
+ public TermCollectionDto getFeatureTree() {
return featureTree;
}
*/
public void refresh() {
getViewer().setInput(getViewer().getInput());
- addChildNodesToMap(this.featureTree.getRoot());
+ addChildNodesToMap(((TermTreeDto) this.featureTree).getRoot());
}
-
-
}
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IMemento;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.ITermNodeService;
import eu.etaxonomy.cdm.api.service.ITermTreeService;
import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.term.TermNode;
import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.persistence.dto.AnnotationDto;
+import eu.etaxonomy.cdm.persistence.dto.MarkerDto;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.definedterm.TermTransfer;
import eu.etaxonomy.taxeditor.editor.definedterm.TermTreeViewerComparator;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
* @author pplitzner
* @date 06.06.2017
*/
-public class TermTreeEditor<T extends DefinedTermBase>
- implements ITermTreeEditor, ISelectionChangedListener,
- IE4ViewerPart, IPartContentHasDetails, IPartContentHasSupplementalData,
- IContextListener, IConversationEnabled, IDirtyMarkable {
+public class TermTreeEditor<T extends DefinedTermBase> implements ITermTreeEditor, ISelectionChangedListener,
+ IE4ViewerPart, IPartContentHasDetails, IPartContentHasSupplementalData, IContextListener, IDirtyMarkable {
public static final String OPEN_COMMAND_ID = "eu.etaxonomy.taxeditor.store.openTermTreeEditor";
- public static final List<String> TREE_PROPERTY_PATH = Arrays.asList(new String[] {
- "root", //$NON-NLS-1$
+ public static final List<String> TREE_PROPERTY_PATH = Arrays.asList(new String[] { "root", //$NON-NLS-1$
"root.children", //$NON-NLS-1$
"root.children.inapplicableIf", //$NON-NLS-1$
"root.children.inapplicableIf.term", //$NON-NLS-1$
"root.children.onlyApplicableIf.state", //$NON-NLS-1$
});
- private ConversationHolder conversation;
-
private ICdmEntitySession cdmEntitySession;
@Inject
private TreeViewer viewer;
- Map<UUID,TermTreeDto> trees;
+ Map<UUID, TermCollectionDto> trees;
Map<UUID, TermNodeDto> uuidTermMap = new HashMap<>();
Map<UUID, CreateFeatureTreeOperation> createOperationList = new HashMap<>();
}
@PostConstruct
- public void createControl(Composite parent, EMenuService menuService){
- if (CdmStore.isActive()){
+ public void createControl(Composite parent, EMenuService menuService) {
+ if (CdmStore.isActive()) {
initSession();
- }
- else{
+ } else {
return;
}
parent.setLayout(new FillLayout());
viewer.setLabelProvider(new TermTreeLabelProvider());
int ops = DND.DROP_COPY | DND.DROP_MOVE;
- Transfer[] transfers = new Transfer[] {
- TermNodeDtoTransfer.getInstance(),
- TermTransfer.getInstance(),
- LocalSelectionTransfer.getTransfer()};
+ Transfer[] transfers = new Transfer[] { TermNodeDtoTransfer.getInstance(), TermTransfer.getInstance(),
+ LocalSelectionTransfer.getTransfer() };
viewer.addDragSupport(ops, transfers, new TermNodeDtoDragListener(viewer));
viewer.addDropSupport(ops, transfers, new TermTreeDtoDropAdapter(this, viewer, sync));
viewer.addSelectionChangedListener(this);
viewer.getTree().addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
- if(e.stateMask == SWT.MOD1 && e.keyCode == 'c'){
+ if (e.stateMask == SWT.MOD1 && e.keyCode == 'c') {
copy(viewer.getStructuredSelection());
- }
- else if(e.stateMask == SWT.MOD1 && e.keyCode == 'v'){
+ } else if (e.stateMask == SWT.MOD1 && e.keyCode == 'v') {
paste(viewer.getStructuredSelection());
}
}
viewer.setComparator(new TermTreeViewerComparator());
viewer.setInput(getTrees());
contentProvider.setUuidTermMap(uuidTermMap);
- //create context menu
- menuService.registerContextMenu(viewer.getControl(), AppModelId.POPUPMENU_EU_ETAXONOMY_TAXEDITOR_STORE_POPUPMENU_FEATURETREEEDITOR);
+ // create context menu
+ menuService.registerContextMenu(viewer.getControl(),
+ AppModelId.POPUPMENU_EU_ETAXONOMY_TAXEDITOR_STORE_POPUPMENU_FEATURETREEEDITOR);
}
- public void init(TermType type, String label){
+ public void init(TermType type, String label) {
this.termType = type;
updateTrees();
viewer.setComparator(new TermTreeViewerComparator());
viewer.setInput(getTrees());
- ((TermTreeContentProvider)viewer.getContentProvider()).setUuidTermMap(uuidTermMap);
+ ((TermTreeContentProvider) viewer.getContentProvider()).setUuidTermMap(uuidTermMap);
thisPart.setLabel(label);
}
-// protected abstract List<TermTreeDto> getTrees();
+ // protected abstract List<TermTreeDto> getTrees();
public void paste(IStructuredSelection selection) {
ISelection clipBoardSelection = LocalSelectionTransfer.getTransfer().getSelection();
Object firstElement = selection.getFirstElement();
TermNodeDto parentNode = null;
- if(firstElement instanceof TermNodeDto){
+ if (firstElement instanceof TermNodeDto) {
parentNode = (TermNodeDto) firstElement;
+ } else if (firstElement instanceof TermTreeDto) {
+ parentNode = ((TermTreeDto) firstElement).getRoot();
}
- else if(firstElement instanceof TermTreeDto){
- parentNode = ((TermTreeDto)firstElement).getRoot();
- }
- if(parentNode!=null){
-
- TermNodeDto copiedNode = (TermNodeDto) ((IStructuredSelection)clipBoardSelection).getFirstElement();
- boolean isDuplicate = this.checkDuplicates(copiedNode.getTerm().getUuid(), parentNode.getTree().getUuid());
- if (isDuplicate && !parentNode.getTree().isAllowDuplicate()){
- MessagingUtils.informationDialog(Messages.AddFeatureHandler_Duplicates_not_allowed, Messages.AddFeatureHandler_Duplicates_not_allowed_message + "\n"+copiedNode.getTerm().getTitleCache());
+ if (parentNode != null) {
+
+ TermNodeDto copiedNode = (TermNodeDto) ((IStructuredSelection) clipBoardSelection).getFirstElement();
+ boolean isDuplicate = this.checkDuplicates(copiedNode.getTerm().getUuid(), parentNode.getTreeUuid());
+ if (isDuplicate && !parentNode.isAllowsDuplicats()) {
+ MessagingUtils.informationDialog(Messages.AddFeatureHandler_Duplicates_not_allowed,
+ Messages.AddFeatureHandler_Duplicates_not_allowed_message + "\n"
+ + copiedNode.getTerm().getTitleCache());
return;
}
- TermNodeDto newDto = new TermNodeDto(copiedNode.getTerm(), parentNode, 0, parentNode.getTree(), null, null, null);
- this.refresh();
- this.setDirty();
- AddFeatureOperation operation = new AddFeatureOperation(copiedNode.getTerm().getUuid(), parentNode, this, this);
-// AbstractUtility.executeOperation(operation, sync);
+ TermNodeDto newDto = new TermNodeDto(copiedNode.getTerm(), parentNode, 0, null, null, 0,
+ null, null);
+ this.refresh();
+ this.setDirty();
+ AddFeatureOperation operation = new AddFeatureOperation(copiedNode.getTerm().getUuid(), parentNode, this,
+ this);
+ // AbstractUtility.executeOperation(operation, sync);
this.addOperation(operation);
}
}
LocalSelectionTransfer.getTransfer().setSelection(selection);
}
- private void initSession(){
- if(conversation == null){
- conversation = CdmStore.createConversation();
- }
- if(cdmEntitySession==null){
+ private void initSession() {
+ if (cdmEntitySession == null) {
cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
}
}
private void clearSession() {
- if(conversation!=null){
- conversation.close();
- conversation = null;
- }
- if(cdmEntitySession != null) {
+ if (cdmEntitySession != null) {
cdmEntitySession.dispose();
cdmEntitySession = null;
}
}
@Override
- public boolean isDirty(){
+ public boolean isDirty() {
return dirty.isDirty();
}
- public void setDirty(boolean isDirty){
- this.dirty.setDirty(isDirty);
- }
- @Override
- public void setDirty(){
+
+ public void setDirty(boolean isDirty) {
+ this.dirty.setDirty(isDirty);
+ }
+
+ @Override
+ public void setDirty() {
this.dirty.setDirty(true);
}
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- //propagate selection
- selService.setSelection(event.getSelection());
- }
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ // propagate selection
+ selService.setSelection(event.getSelection());
+ }
- @Focus
- public void focus(){
- if(viewer!=null){
- viewer.getControl().setFocus();
- }
- if(conversation!=null && !conversation.isBound()){
- conversation.bind();
+ @Focus
+ public void focus() {
+ if (viewer != null) {
+ viewer.getControl().setFocus();
}
- if(cdmEntitySession != null) {
+ if (cdmEntitySession != null) {
cdmEntitySession.bind();
}
- if (viewer.getSelection().isEmpty()){
+ if (viewer.getSelection().isEmpty()) {
viewer.setSelection(null);
}
- }
-
- @Override
- public void refresh(){
- viewer.refresh();
- }
+ }
- @Override
- public TreeViewer getViewer(){
- return viewer;
- }
+ @Override
+ public void refresh() {
+ viewer.refresh();
+ }
- @Override
- public IStructuredSelection getSelection() {
- return (IStructuredSelection) viewer.getSelection();
- }
+ @Override
+ public TreeViewer getViewer() {
+ return viewer;
+ }
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
+ @Override
+ public IStructuredSelection getSelection() {
+ return (IStructuredSelection) viewer.getSelection();
+ }
- @Override
+ @Override
@Persist
- public void save(IProgressMonitor monitor){
- if (!conversation.isBound()) {
- conversation.bind();
- }
+ public void save(IProgressMonitor monitor) {
- // commit the conversation and start a new transaction immediately
ISelection sel = this.viewer.getSelection();
- conversation.commit(true);
- if (createOperationList != null && !createOperationList.isEmpty()){
- for (CreateFeatureTreeOperation operation: createOperationList.values()){
- TermTreeDto termDto = getTreeDtoForUuid(operation.getElementUuid());
+
+ if (createOperationList != null && !createOperationList.isEmpty()) {
+ for (CreateFeatureTreeOperation operation : createOperationList.values()) {
+ TermCollectionDto termDto = getTreeDtoForUuid(operation.getElementUuid());
operation.getElement().setTitleCache(termDto.getTitleCache(), true);
operation.getElement().setAllowDuplicates(termDto.isAllowDuplicate());
operation.getElement().setFlat(termDto.isFlat());
createOperationList.clear();
}
- if (operationList != null && !operationList.isEmpty()){
- for (AbstractPostOperation<TermNode> operation: operationList){
+ if (operationList != null && !operationList.isEmpty()) {
+ for (AbstractPostOperation<TermNode> operation : operationList) {
AbstractUtility.executeOperation(operation, sync);
}
operationList.clear();
listToUpdate.clear();
List<TermTreeDto> rootEntities = getRootEntities();
UpdateResult result = CdmStore.getService(ITermTreeService.class).saveOrUpdateTermTreeDtoList(rootEntities);
- conversation.commit(true);
+
this.setDirty(false);
initializeTrees();
this.viewer.setSelection(sel);
-// this.viewer.setExpandedElements(expandedElements);
- }
+ // this.viewer.setExpandedElements(expandedElements);
+ }
private void initializeTrees() {
Object[] expandedElements = viewer.getExpandedElements();
viewer.setExpandedElements(expandedElements);
}
- @PreDestroy
- public void dispose(){
- selService.setSelection(null);
- clearSession();
- }
+ @PreDestroy
+ public void dispose() {
+ selService.setSelection(null);
+ clearSession();
+ }
@Override
public ICdmEntitySession getCdmEntitySession() {
@Override
public Map<Object, List<String>> getPropertyPathsMap() {
- List<String> propertyPaths = Arrays.asList(new String[] {
- "children", //$NON-NLS-1$
+ List<String> propertyPaths = Arrays.asList(new String[] { "children", //$NON-NLS-1$
"term", //$NON-NLS-1$
"termTree", //$NON-NLS-1$
});
Map<Object, List<String>> propertyPathMap = new HashMap<>();
- propertyPathMap.put(TermNode.class,propertyPaths);
+ propertyPathMap.put(TermNode.class, propertyPaths);
return propertyPathMap;
}
@Override
public void contextStop(IMemento memento, IProgressMonitor monitor) {
- //close view when workbench closes
- try{
+ // close view when workbench closes
+ try {
thisPart.getContext().get(EPartService.class).hidePart(thisPart);
- }
- catch(Exception e){
- //nothing
+ } catch (Exception e) {
+ // nothing
}
}
public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
}
- @Override
- public void update(CdmDataChangeMap arg0) {
- }
-
@Override
public void changed(Object element) {
dirty.setDirty(true);
public boolean postOperation(Object objectAffectedByOperation) {
initializeTrees();
viewer.refresh();
- if(objectAffectedByOperation instanceof TermNodeDto){
- TermNodeDto node = (TermNodeDto)objectAffectedByOperation;
-// viewer.expandToLevel(((TermRelationBase) node).getGraph(), 1); find a solution for dto editor
+ if (objectAffectedByOperation instanceof TermNodeDto) {
+ TermNodeDto node = (TermNodeDto) objectAffectedByOperation;
+ // viewer.expandToLevel(((TermRelationBase) node).getGraph(), 1);
+ // find a solution for dto editor
}
- if(objectAffectedByOperation!=null){
+ if (objectAffectedByOperation != null) {
StructuredSelection selection = new StructuredSelection(objectAffectedByOperation);
viewer.setSelection(selection);
}
}
@Override
- public TermNodeDto getNodeDtoForUuid(UUID nodeUuid){
+ public TermNodeDto getNodeDtoForUuid(UUID nodeUuid) {
return uuidTermMap.get(nodeUuid);
}
- protected void addAllNodesToMap(TermNodeDto root){
- if (!uuidTermMap.containsKey(root.getUuid())){
+ protected void addAllNodesToMap(TermNodeDto root) {
+ if (!uuidTermMap.containsKey(root.getUuid())) {
uuidTermMap.put(root.getUuid(), root);
-// if (root.getTerm() != null){
-// getTreeDtoForUuid(root.getTree().getUuid()).addTerm(root.getTerm());
-// }
+ // if (root.getTerm() != null){
+ // getTreeDtoForUuid(root.getTree().getUuid()).addTerm(root.getTerm());
+ // }
}
- for (TermNodeDto child: root.getChildren()){
+ for (TermNodeDto child : root.getChildren()) {
uuidTermMap.put(child.getUuid(), child);
-// if (child.getTerm() != null){
-// getTreeDtoForUuid(child.getTree().getUuid()).addTerm(child.getTerm());
-// }
- if (child.getChildren() != null && !child.getChildren().isEmpty()){
+ // if (child.getTerm() != null){
+ // getTreeDtoForUuid(child.getTree().getUuid()).addTerm(child.getTerm());
+ // }
+ if (child.getChildren() != null && !child.getChildren().isEmpty()) {
addAllNodesToMap(child);
}
}
@Override
public boolean checkDuplicates(UUID termUuid, UUID treeUuid) {
- TermTreeDto tree = this.getTreeDtoForUuid(treeUuid);
- if (tree != null){
- for (TermDto dto: tree.getTerms()){
+ TermCollectionDto tree = this.getTreeDtoForUuid(treeUuid);
+ if (tree != null) {
+ for (TermDto dto : tree.getTerms()) {
if (dto != null && dto.getUuid().equals(termUuid)) {
return true;
}
return false;
}
- protected void updateTrees(){
+ protected void updateTrees() {
uuidTermMap.clear();
- if (trees != null && !trees.isEmpty()){
+ if (trees != null && !trees.isEmpty()) {
trees.clear();
}
- if (trees == null){
+ if (trees == null) {
trees = new HashMap<>();
}
- List<TermTreeDto> treeList = CdmStore.getService(ITermTreeService.class).listTermTreeDtosByTermType(getTermType());
+ List<TermTreeDto> treeList = CdmStore.getService(ITermTreeService.class)
+ .listTermTreeDtosByTermType(getTermType());
treeList.stream().forEach(tree -> trees.put(tree.getUuid(), tree));
-// trees.addAll(CdmStore.getService(ITermTreeService.class).listTermTreeDtosByTermType(getTermType()));
- for (TermTreeDto tree: trees.values()){
- addAllNodesToMap(tree.getRoot());
+ // trees.addAll(CdmStore.getService(ITermTreeService.class).listTermTreeDtosByTermType(getTermType()));
+ for (TermCollectionDto tree : trees.values()) {
+ addAllNodesToMap(((TermTreeDto) tree).getRoot());
}
- ((TermTreeContentProvider<T>)viewer.getContentProvider()).setUuidTermMap(uuidTermMap);
+ ((TermTreeContentProvider<T>) viewer.getContentProvider()).setUuidTermMap(uuidTermMap);
}
- public List<TermTreeDto> getTrees(){
- List<TermTreeDto> treeList = new ArrayList<>(trees.values());
+ public List<TermCollectionDto> getTrees() {
+ List<TermCollectionDto> treeList = new ArrayList<>(trees.values());
return treeList;
}
- public void putTree(TermTreeDto tree){
- trees.put(tree.getUuid(), tree);
+ public void putTree(TermTreeDto tree) {
+ trees.put(tree.getUuid(), tree);
}
- public void removeTree(TermTreeDto tree){
+ public void removeTree(TermTreeDto tree) {
trees.remove(tree.getUuid());
- }
+ }
@Override
- public TermTreeDto getTreeDtoForUuid(UUID treeUuid){
+ public TermCollectionDto getTreeDtoForUuid(UUID treeUuid) {
return trees.get(treeUuid);
}
@Override
- public void setTreeDtoForUuid(TermTreeDto tree){
+ public void setTreeDtoForUuid(TermTreeDto tree) {
trees.put(tree.getUuid(), tree);
}
@Override
- public void setNodeDtoForUuid(TermNodeDto node){
+ public void setNodeDtoForUuid(TermNodeDto node) {
this.uuidTermMap.put(node.getUuid(), node);
}
@Override
public void addOperation(AbstractPostOperation operation) {
- if (operation instanceof CreateFeatureTreeOperation){
- createOperationList.put(((CreateFeatureTreeOperation)operation).getElementUuid(), (CreateFeatureTreeOperation)operation);
- }else{
+ if (operation instanceof CreateFeatureTreeOperation) {
+ createOperationList.put(((CreateFeatureTreeOperation) operation).getElementUuid(),
+ (CreateFeatureTreeOperation) operation);
+ } else {
operationList.add(operation);
}
}
@Inject
@Optional
private void addSaveCandidate(@UIEventTopic(WorkbenchEventConstants.ADD_SAVE_CANDIDATE) UUID cdmbaseUuid) {
- for (UUID uuid: uuidTermMap.keySet()) {
- if (uuid.equals(cdmbaseUuid)){
- listToUpdate.add(uuidTermMap.get(uuid));
+ ISelection sel = viewer.getSelection();
+ Object obj = ((StructuredSelection) sel).getFirstElement();
+ if (obj instanceof TermNodeDto) {
+ if (listToUpdate.contains(obj)) {
+ listToUpdate.remove(obj);
+ }
+ listToUpdate.add((TermNodeDto) obj);
+ }
+ }
+
+ @Inject
+ @Optional
+ private void addSaveCandidate(@UIEventTopic(WorkbenchEventConstants.ADD_SAVE_CANDIDATE) AnnotationDto anDto) {
+
+ ISelection sel = viewer.getSelection();
+ Object obj = ((StructuredSelection) sel).getFirstElement();
+ if (obj instanceof TermNodeDto) {
+ if (listToUpdate.contains(obj)) {
+ listToUpdate.remove(obj);
+ }
+ if (((TermNodeDto) obj).getAnnotations().contains(anDto)) {
+ ((TermNodeDto) obj).getAnnotations().remove(anDto);
+ }
+
+ ((TermNodeDto) obj).addAnnotation(anDto);
+
+ listToUpdate.add((TermNodeDto) obj);
+ }
+ }
+
+ @Inject
+ @Optional
+ private void removeElement(@UIEventTopic(WorkbenchEventConstants.REMOVE_ELEMENT) AnnotationDto anDto) {
+
+ ISelection sel = viewer.getSelection();
+ Object obj = ((StructuredSelection) sel).getFirstElement();
+ if (obj instanceof TermNodeDto) {
+ if (listToUpdate.contains(obj)) {
+ listToUpdate.remove(obj);
}
+ if (((TermNodeDto) obj).getAnnotations().contains(anDto)) {
+ ((TermNodeDto) obj).getAnnotations().remove(anDto);
+ }
+ listToUpdate.add((TermNodeDto) obj);
+ }
+ }
+
+ @Inject
+ @Optional
+ private void addSaveCandidate(@UIEventTopic(WorkbenchEventConstants.ADD_SAVE_CANDIDATE) MarkerDto markerDto) {
+
+ ISelection sel = viewer.getSelection();
+ Object obj = ((StructuredSelection) sel).getFirstElement();
+ if (obj instanceof TermNodeDto) {
+ if (listToUpdate.contains(obj)) {
+ listToUpdate.remove(obj);
+ }
+ if (((TermNodeDto) obj).getMarkers().contains(markerDto)) {
+ ((TermNodeDto) obj).getMarkers().remove(markerDto);
+ }
+ ((TermNodeDto) obj).addMarker(markerDto);
+
+ listToUpdate.add((TermNodeDto) obj);
+ }
+ }
+
+ @Inject
+ @Optional
+ private void removeMarker(@UIEventTopic(WorkbenchEventConstants.REMOVE_ELEMENT) MarkerDto markerDto) {
+
+ ISelection sel = viewer.getSelection();
+ Object obj = ((StructuredSelection) sel).getFirstElement();
+ if (obj instanceof TermNodeDto) {
+ if (listToUpdate.contains(obj)) {
+ listToUpdate.remove(obj);
+ }
+ if (((TermNodeDto) obj).getMarkers().contains(markerDto)) {
+ ((TermNodeDto) obj).getMarkers().remove(markerDto);
+ }
+
+ listToUpdate.add((TermNodeDto) obj);
}
}
import eu.etaxonomy.cdm.persistence.dto.CharacterNodeDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
+import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.termtree.AvailableTermsWizard;
TermNodeDto parent = getParent(selection);
TermType type = null;
if (parent.getTerm() == null){
- type = parent.getTree().getTermType();
+ type = parent.getType();
}else{
type = parent.getTerm().getTermType();
}
for (DefinedTermBase term : additionalTerms) {
boolean isDuplicate = false;
- if (!parent.getTree().isAllowDuplicate()){
- isDuplicate = editor.checkDuplicates(term.getUuid(), parent.getTree().getUuid());
+ if (!parent.isAllowsDuplicats()){
+ isDuplicate = editor.checkDuplicates(term.getUuid(), parent.getTreeUuid());
if (isDuplicate){
duplicates.add(term);
}
editor.setDirty();
if (editor instanceof ICharacterEditor){
- CharacterNodeDto newDto = new CharacterNodeDto(CharacterDto.fromCharacter((Character)term), parent, 0, parent.getTree(), null, null, null);
+ CharacterNodeDto newDto = new CharacterNodeDto(CharacterDto.fromCharacter((Character)term), parent, 0, (TermTreeDto) ((ICharacterEditor)editor).getTreeDtoForUuid(parent.getTreeUuid()), null, 0, null, null);
}else{
- TermNodeDto newDto = new TermNodeDto(TermDto.fromTerm(term), parent, 0, parent.getTree(), null, null, null);
+ TermNodeDto newDto = new TermNodeDto(TermDto.fromTerm(term), parent, 0, (TermTreeDto)editor.getTreeDtoForUuid(parent.getTreeUuid()), null, 0, null, null);
}
// ((AbstractTermTreeEditor)editor).getViewer().refresh();
&& selection!=null
&& selection.size()==1
&& selection.getFirstElement() instanceof TermNodeDto
- && !((TermNodeDto)selection.getFirstElement()).getTree().isFlat();
+ && !((TermNodeDto)selection.getFirstElement()).isFlat()
+ && !((TermNodeDto)selection).isExternallyManaged();
menuItem.setVisible(canExecute);
return canExecute;
}
@Named(IServiceConstants.ACTIVE_PART)MPart thisPart,
MHandledMenuItem menuItem) {
boolean canExecute = false;
+ boolean isManaged = false;
+
canExecute = thisPart.getObject() instanceof ITermTreeEditor
&& selection!=null
&& selection.size()==1
- && selection.getFirstElement() instanceof TermTreeDto;
+ && selection.getFirstElement() instanceof TermTreeDto
+ && !((TermTreeDto)selection.getFirstElement()).isManaged();
menuItem.setVisible(canExecute);
return canExecute;
}
canExecute =part.getObject() instanceof TermTreeEditor
&& selection!=null
&& selection.size()==1
- && selection.getFirstElement() instanceof TermNodeDto;
+ && selection.getFirstElement() instanceof TermNodeDto
+ && !((TermNodeDto)selection.getFirstElement()).isExternallyManaged();
menuItem.setVisible(canExecute);
return canExecute;
}
term = ((TermNodeDto)((IStructuredSelection)transferSelection).getFirstElement()).getTerm();
}
TermNodeDto selectedNode = null;
+ TermTreeEditor editor = null;
+ if (part.getObject() instanceof TermTreeEditor) {
+ editor = (TermTreeEditor)part.getObject();
+ }
+
if (selection.getFirstElement() instanceof TermNodeDto){
selectedNode = (TermNodeDto)selection.getFirstElement();
- moveToTree = selectedNode.getTree();
+ moveToTree = (TermTreeDto) editor.getTreeDtoForUuid(selectedNode.getTreeUuid());
}else if (selection.getFirstElement() instanceof TermTreeDto){
moveToTree = (TermTreeDto)selection.getFirstElement();
}
for (Object selectedObject : selection.toArray()) {
TermNodeDto featureNode = (TermNodeDto) selectedObject;
- TermTreeDto tree = featureNode.getTree();
+ TermTreeDto tree = (TermTreeDto) editor.getTreeDtoForUuid(featureNode.getTreeUuid());
if (featureNode.getUuid() != null){
RemoveFeatureOperation operation = new RemoveFeatureOperation(featureNode.getUuid(), editor, editor);
editor.addOperation(operation);
boolean canExecute = selection!=null && !selection.isEmpty();
if(selection!=null){
for(Object object:selection.toArray()){
- canExecute &= object instanceof TermNodeDto;
+ canExecute &= object instanceof TermNodeDto && !((TermNodeDto)object).isExternallyManaged();
+
}
}
canExecute &= thisPart.getObject() instanceof ITermTreeEditor;
-// $Id$
/**
* Copyright (C) 2017 EDIT
* European Distributed Institute of Taxonomy
/**
* @author pplitzner
* @date 12.12.2017
- *
*/
public class UuidAndTitleCacheLabelProvider extends LabelProvider{
- /**
- * {@inheritDoc}
- */
@Override
public String getText(Object element) {
if(element instanceof UuidAndTitleCache){
}
return super.getText(element);
}
-
-}
+}
\ No newline at end of file
@SuppressWarnings("unchecked")
@Override
public void proposalAccepted(IContentProposal proposal) {
- setSelection((T)combo.getData(proposal.getContent()));
+ setSelection((T)combo.getData(proposal.getContent()));
firePropertyChangeEvent(new CdmPropertyChangeEvent(getComboElement(), null));
}
});
import org.eclipse.swt.widgets.Combo;
import org.eclipse.ui.forms.widgets.TableWrapData;
+import eu.etaxonomy.cdm.model.description.NoDescriptiveDataStatus;
import eu.etaxonomy.cdm.model.media.ExternalLinkType;
import eu.etaxonomy.cdm.model.name.NameRelationship;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
return Arrays.asList(TaxonNodeStatus.values());
}
- @Override
- public Class<TaxonNodeStatus> getClazz() {
- return TaxonNodeStatus.class;
- }
+ @Override
+ public Class<TaxonNodeStatus> getClazz() {
+ return TaxonNodeStatus.class;
+ }
+
+ }, new CdmEnumDataHolder<NoDescriptiveDataStatus>() {
+ @Override
+ public String getName() {
+ return "No Data Status";
}
+ @Override
+ public Collection<NoDescriptiveDataStatus> getElements() {
+ return Arrays.asList(NoDescriptiveDataStatus.values());
+ }
+ @Override
+ public Class<NoDescriptiveDataStatus> getClazz() {
+ return NoDescriptiveDataStatus.class;
+ }
+ }
+
};
protected List<T> elementTypeList = new ArrayList<>();
return "Code Edition";
}else if(enumType.equals(TaxonNodeStatus.class)) {
return Messages.EnumCombo_Placement_status;
+ }else if (enumType.equals(NoDescriptiveDataStatus.class)) {
+ return "No Data";
}
return "No Label";
}
for (NomenclaturalCodeEdition codeEdition: elements){
elementTypeList.add((T)codeEdition);
combo.add(codeEdition.getLabel(), index);
- combo.setData(codeEdition.getLabel(), (T)codeEdition);
+ combo.setData(codeEdition.getLabel(), codeEdition);
index++;
}
}
if(o2==null){
return 1;
}
+ if(o1.equals(o2)) {
+ return 0;
+ }
//both are either taxonomic or media
- else if(o1.equals(OriginalSourceType.PrimaryTaxonomicSource)
+ if(o1.equals(OriginalSourceType.PrimaryTaxonomicSource)
&& o2.equals(OriginalSourceType.PrimaryMediaSource)){
if(entity != null && entity.getType().equals(OriginalSourceType.PrimaryMediaSource)){
return 1;
return -1;
}
}
- else if(o2.equals(OriginalSourceType.PrimaryTaxonomicSource)
+ if(o2.equals(OriginalSourceType.PrimaryTaxonomicSource)
&& o1.equals(OriginalSourceType.PrimaryMediaSource)){
if(entity != null && entity.getType().equals(OriginalSourceType.PrimaryMediaSource)){
return -1;
}
}
//one is not taxonomic or media
- else if(o1.equals(OriginalSourceType.PrimaryTaxonomicSource)
+ if(o1.equals(OriginalSourceType.PrimaryTaxonomicSource)
||o1.equals(OriginalSourceType.PrimaryMediaSource)){
return -1;
}
- else if(o2.equals(OriginalSourceType.PrimaryTaxonomicSource)
+ if(o2.equals(OriginalSourceType.PrimaryTaxonomicSource)
|| o2.equals(OriginalSourceType.PrimaryMediaSource)){
return 1;
}
- //The last two are always "Other" followed by "Unknown"
- else if(o1.equals(OriginalSourceType.Other)){
- if(o2.equals(OriginalSourceType.Unknown)){
- return -11;
- }
- else{
+ //The last two are always "Unknown" followed by "Other"
+ if(o1.equals(OriginalSourceType.Unknown)){
+ if(o2.equals(OriginalSourceType.Other)){
return 1;
+ }else {
+ return -1;
}
}
- if(o2.equals(OriginalSourceType.Other)){
+ //Other is always the later
+ if(o1.equals(OriginalSourceType.Other)){
return 1;
}
- else{
- String message1 = o1.getKey();
- String message2 = o2.getKey();
- return message1.compareTo(message2);
+ //o1 can not be Other or Unknown, so o1 must be before o2
+ if (o2.equals(OriginalSourceType.Unknown)) {
+ return -1;
}
+ String message1 = o1.getLabel();
+ String message2 = o2.getLabel();
+ return message1.compareTo(message2);
+
}
}
\ No newline at end of file
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
+import java.util.EnumSet;
import java.util.List;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Listener;
-import eu.etaxonomy.cdm.api.service.IVocabularyService;
+import eu.etaxonomy.cdm.api.service.ITermCollectionService;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
+import eu.etaxonomy.cdm.model.term.TermCollection;
import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
-import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @author n.hoffmann
* @created Nov 5, 2009
*/
-public class VocabularyComboElement<TERM extends DefinedTermBase<TERM>, VOC extends TermVocabulary<TERM>>
- extends AbstractComboElement<VOC> {
+public class TermCollectionComboElement<TERM extends DefinedTermBase<TERM>, TC extends TermCollection<TERM,?>>
+ extends AbstractComboElement<TC> {
- private VOC emptyElement;
+ private TC emptyElement;
private static String EMPTY_ELEMENT_LABEL = "";
- private ArrayList<VOC> terms;
+ private ArrayList<TC> terms;
- private Comparator<VOC> vocComparator;
+ private Comparator<TC> vocComparator;
- private final TermType termType;
+ private final EnumSet<TermType> termTypes;
- public VocabularyComboElement(CdmFormFactory formFactory,
- ICdmFormElement parentElement, TermType termType, String labelString,
- VOC selection, int style) {
+ public TermCollectionComboElement(CdmFormFactory formFactory,
+ ICdmFormElement parentElement, TermType termType, String labelString,
+ TC selection, int style){
+ this(formFactory, parentElement, EnumSet.of(termType), labelString, selection, style);
+ }
+
+ public TermCollectionComboElement(CdmFormFactory formFactory,
+ ICdmFormElement parentElement, EnumSet<TermType> termTypes, String labelString,
+ TC selection, int style) {
super(formFactory, parentElement);
- this.termType = termType;
+ this.termTypes = termTypes;
populateTerms(getVocabularies());
}
}
- public VocabularyComboElement(CdmFormFactory formFactory,
- ICdmFormElement parentElement, TermType termType, String labelString,
- TermVocabularyDto selection, int style) {
+ public TermCollectionComboElement(CdmFormFactory formFactory,
+ ICdmFormElement parentElement, EnumSet<TermType> termTypes, String label,
+ TermCollectionDto selection, int style) {
super(formFactory, parentElement);
- this.termType = termType;
+ this.termTypes = termTypes;
populateTerms(getVocabularies());
* a T object or <code>null</code> to clear the selection
*/
@Override
- public void setSelection(VOC selection) {
+ public void setSelection(TC selection) {
this.selection = selection;
Listener[] listeners = combo.getListeners(SWT.Selection);
// }
}
- public void setSelectionDto(TermVocabularyDto selection) {
+ public void setSelectionDto(TermCollectionDto selection) {
Listener[] listeners = combo.getListeners(SWT.Selection);
// for (Listener listener : listeners) {
// set selection to the emptyElement
selectedIndex = 0;
}else{
- for (VOC voc: terms){
+ for (TC voc: terms){
if (voc != null && voc.getUuid().equals(selection.getUuid())){
selectedIndex = terms.indexOf(voc);
*
* @param preferredTerms
*/
- private void populateTerms(List<VOC> preferredTerms) {
+ private void populateTerms(List<TC> preferredTerms) {
combo.removeAll();
- terms = new ArrayList<VOC>();
+ terms = new ArrayList<>();
int i = 1;
int index = 0;
if (vocComparator != null) {
Collections.sort(preferredTerms, vocComparator);
}else{
- Collections.sort(preferredTerms, new Comparator<VOC>() {
-
- @Override
- public int compare(VOC o1, VOC o2) {
- if (o1.equals(o2)){
+ Collections.sort(preferredTerms, (o1,o2)->{
+ if (o1.equals(o2)){
return 0;
}
- int result = ((TermVocabulary) o1).getTitleCache().toLowerCase().compareTo(((TermVocabulary)o2).getTitleCache().toLowerCase());
+ int result = o1.getTitleCache().toLowerCase().compareTo(o2.getTitleCache().toLowerCase());
return result;
}
- });
+ );
}
- for (VOC term : preferredTerms) {
+
+ for (TC term : preferredTerms) {
String label = getLabel(term);
if (label == null) {
if (term.getTitleCache() != null) {
combo.select(index);
}
- protected List<VOC> getVocabularies(){
- List<TermVocabulary<TERM>> list = CdmStore.getService(IVocabularyService.class).<TERM>findByTermType(termType, null);
- return (List<VOC>) list;
+ protected List<TC> getVocabularies(){
+ List<TermCollection> list = CdmStore.getService(ITermCollectionService.class).list(termTypes, null, null, null, null);
+ return (List<TC>) list;
}
/**
* May be overridden by derived classes if the desired label string does not
* reside in term.getLabel();
- *
- * @param term
- * a T object.
- * @return a {@link java.lang.String} object.
*/
- protected String getLabel(VOC term) {
+ protected String getLabel(TC term) {
if (term == null){
return "";
}else{
}
}
- private void createTermNotInPreferredTerms(VOC term) {
- List<VOC> preferredTerms = getVocabularies();
+ private void createTermNotInPreferredTerms(TC term) {
+ List<TC> preferredTerms = getVocabularies();
preferredTerms.add(term);
/**
- *
- */
+* Copyright (C) 2017 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.combo.term;
import java.util.ArrayList;
/**
* @author n.hoffmann
* @created Nov 5, 2009
- * @version 1.0
- * @param <T>
*/
public class TermComboElement<T extends DefinedTermBase>
extends AbstractComboElement<T> {
private ArrayList<T> terms;
- public ArrayList<T> getTerms() {
+ public List<T> getTerms() {
return terms;
}
public void setTermComparator(Comparator<T> termComparator) {
this.termComparator = termComparator;
populateTerms();
-
}
private final TermType termType;
- private final TermVocabulary termVocabulary;
+ @SuppressWarnings("rawtypes")
+ private final TermVocabulary termVocabulary;
private final Class<T> termClass;
private List<T> customPreferredTerms;
int style) {
this(formFactory, parentElement, termClass, null, null, null, labelString, selection, addEmptyElement, style, false, null);
}
+
public TermComboElement(CdmFormFactory formFactory,
ICdmFormElement parentElement, Class<T> termClass, String labelString, T selection, boolean addEmptyElement,
int style, boolean useAbbrevLabel) {
- this(formFactory, parentElement, termClass, null, null, null,labelString, selection, addEmptyElement, style, useAbbrevLabel, null);
-
+ this(formFactory, parentElement, termClass, null, null, null, labelString, selection, addEmptyElement, style, useAbbrevLabel, null);
}
public TermComboElement(CdmFormFactory formFactory,
ICdmFormElement parentElement, List<T> terms, String labelString, T selection, boolean addEmptyElement,
int style, boolean useAbbrevLabel, Comparator<T> comparator) {
this(formFactory, parentElement, null, null, null, terms,labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
-
}
private TermComboElement(CdmFormFactory formFactory,
- ICdmFormElement parentElement, Class<T> termClass, TermType termType, TermVocabulary<?> termVocabulary, List<T> terms,String labelString, T selection, boolean addEmptyElement,
+ ICdmFormElement parentElement, Class<T> termClass, TermType termType, TermVocabulary<?> termVocabulary, List<T> terms, String labelString, T selection, boolean addEmptyElement,
int style, boolean useAbbrevLabel, Comparator<T> comparator) {
- super(formFactory, parentElement);
+
+ super(formFactory, parentElement);
this.termVocabulary = termVocabulary;
this.termClass = termClass;
this.addEmptyElement = addEmptyElement;
this.useAbbrevLabel = useAbbrevLabel;
- this.termComparator = comparator;
+
if (labelString != null) {
label.setText(labelString);
}
this.selection = selection;
-
+ if (comparator == null) {
+ this.termComparator = new DefaultTermComparator<>();
+ }else {
+ this.termComparator = comparator;
+ }
if(termType!=null){
//TODO try to remove generic T and avoid classes to be used
- addTerms((List<T>) getTermManager().getPreferredTerms(termType));
+ addTerms((List<T>) getTermManager().getPreferredTerms(termType));
}
else if(termVocabulary!=null){
addTerms((List<T>) getTermManager().getPreferredTerms(termVocabulary));
addContentProposalAdapter();
combo.addSelectionListener(this);
combo.addDisposeListener(this);
- if (comparator == null){
- setTermComparator(new DefaultTermComparator<T>());
- }else{
- populateTerms();
- }
-
+
+ populateTerms();
+
PreferencesUtil.getPreferenceStore().addPropertyChangeListener(this);
if (selection != null) {
}
protected void addTerms(List<T> preferredTerms) {
- terms = new ArrayList<T>();
+ terms = new ArrayList<>();
Collections.sort(preferredTerms, termComparator);
if(addEmptyElement){
// Add an empty element for when nothing was selected yet
}
for (T term: preferredTerms){
terms.add(term);
- }
+ }
}
private TermComboElement(CdmFormFactory formFactory,
this.termClass = termClass;
this.addEmptyElement = addEmptyElement;
this.useAbbrevLabel = useAbbrevLabel;
- this.termComparator = comparator;
+ if (comparator == null) {
+ this.termComparator = new DefaultTermComparator<T>();
+ }else {
+ this.termComparator = comparator;
+ }
if (labelString != null) {
label.setText(labelString);
}
addTerms(getPreferredTerms());
}else if (terms != null && !terms.isEmpty()){
addTerms(terms);
-
+
}
if (termType == null){
this.termType = terms.get(0).getTermType();
addContentProposalAdapter();
combo.addSelectionListener(this);
combo.addDisposeListener(this);
- if (comparator == null){
- setTermComparator(new DefaultTermComparator<T>());
- }else{
- populateTerms();
- }
+
+ populateTerms();
+
PreferencesUtil.getPreferenceStore().addPropertyChangeListener(this);
if (this.terms != null && selection != null){
for (T term: this.terms){
selectedIndex = terms.indexOf(selection);
}
}
-
+
for (Listener listener : listeners) {
- combo.addListener(SWT.Selection, listener);
+ combo.addListener(SWT.Selection, listener);
}
combo.select(selectedIndex);
-
+
}
public void setSelectionDto(TermDto selection) {
combo.add(EMPTY_ELEMENT_LABEL);
}
List<T> withoutNull = new ArrayList<>(terms);
-
+
if (termComparator != null) {
if (addEmptyElement){
withoutNull = terms.subList(1, terms.size());
}
combo.select(index);
-
}
protected List<T> getPreferredTerms(){
- List<T> preferredTerms = new ArrayList<T>();
+ List<T> preferredTerms = new ArrayList<>();
if (customPreferredTerms != null){
return customPreferredTerms;
}
}
}
if (termLabel == null){
- termLabel = term.getLabel(CdmStore.getDefaultLanguage());
+ termLabel = term.getLabel(PreferencesUtil.getGlobalLanguage());
}
if (termLabel == null){
termLabel = term.getLabel();
}
if(PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_VOCABULARY_ID_FOR_TERM_LABELS)
&& term.getVocabulary()!=null){
- String vocLabel = term.getVocabulary().getLabel(CdmStore.getDefaultLanguage());
+ String vocLabel = term.getVocabulary().getLabel(PreferencesUtil.getGlobalLanguage());
if (vocLabel == null){
vocLabel = term.getVocabulary().getLabel();
}
}
}
- /**
- *
- *
- * @param term
- */
private void createTermNotInPreferredTerms(T term, List<T> preferredTerms) {
terms.add(term);
populateTerms();
}
- /** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
if (e.getSource().equals(combo) && combo.getSelectionIndex() >= 0){
selection = terms.get(combo.getSelectionIndex());
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
}
-
}
- /** {@inheritDoc} */
@Override
public void propertyChange(PropertyChangeEvent event) {
super.propertyChange(event);
}
}
}
-
-}
+}
\ No newline at end of file
protected void createControls(ICdmFormElement formElement, Classification entity, int style) {
txtClassificationName = formFactory.createTextWithLabelElement(formElement, "Classification name", null, style);
comboRelationType = formFactory.createDefinedTermComboElement(TermType.TaxonRelationshipType, formElement, "Taxon relation", null, style);
- selectReference = formFactory.createSelectionElement(Reference.class, //getConversationHolder(),
+ selectReference = formFactory.createSelectionElement(Reference.class,
formElement, "Reference", null, EntitySelectionElement.SELECTABLE, style);
}
return selectReference.getSelection();
}
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
+
}
*
* @author n.hoffmann
* @created 16.06.2009
- * @version 1.0
+
*/
public class LoginDialog extends Dialog {
title = Messages.LoginDialog_LOGIN;
}
-
- /** {@inheritDoc} */
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
protected Shell shlConnect;
protected Text txtCdmServerStatus;
protected Text txtCdmInstanceStatus;
+
protected Combo comboCdmServer;
+ protected boolean allowServerChange = true;
protected Combo comboCdmInstance;
- protected Button btnConnect;
+ protected boolean allowInstanceChange = true;
+ public Button btnConnect;
protected Composite remotingComposite;
protected Button btnCdmServerRefresh;
/**
* Create the dialog.
- * @param parent
- * @param style
*/
public RemotingLoginDialog(Shell parent, int style) {
super(parent, style);
String contextPath = source.getContext();
this.setInstanceName(contextPath == null? "" : contextPath.substring(contextPath.lastIndexOf("/") + 1)); //$NON-NLS-1$
}
+ //disable datasource selection if datasource is given, see #10463
+
+ allowServerChange = false;
+ allowInstanceChange = false;
+
return open(getServerName(), getInstanceName(), loadLoginPrefs, autoConnect);
}
txtServerCdmlibVersion = new Text(compAdvanced, SWT.BORDER);
txtServerCdmlibVersion.setEditable(false);
txtServerCdmlibVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
-/*
- btnStopServer = new Button(compAdvanced, SWT.FLAT);
- btnStopServer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
- btnStopServer.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseUp(MouseEvent e) {
- onStopManagedServer();
- }
- });
- btnStopServer.setText(Messages.RemotingLoginDialog_LABEL_STOP_MANAGED_SERVER);
-*/
+
lblEditorCdmlibVersion = new Label(compAdvanced, SWT.CENTER);
lblEditorCdmlibVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblEditorCdmlibVersion.setText(Messages.RemotingLoginDialog_LABEL_EDITOR_CDMLIB_VERSION);
}
- @SuppressWarnings("unused")
- private void addEmptyCells(int cnt) {
+ protected void addEmptyCells(int cnt) {
for (int i = 0; i < cnt; i++) {
new Label(compAdvanced, SWT.NONE);
}
}
protected void onConnectButtonPressed() {
- /*if(selectedServerInfo.isLocalhostMgd() && !isSelectedCdmInstanceRunningInManagedServer()) {
- startManagedServer();
- } else {*/
- connect();
- if (CdmStore.isActive() && CdmStore.currentAuthentiationHasOneOfRoles(Role.ROLE_REMOTING)){
- PreferencesUtil.setNomenclaturalCodePreferences();
- }
-// }
+ connect();
+ if (CdmStore.isActive() && CdmStore.currentAuthentiationHasOneOfRoles(Role.ROLE_REMOTING)){
+ PreferencesUtil.setNomenclaturalCodePreferences();
+ }
+
}
protected void populateCdmServerCombo() {
getServerInfoMap().put(csii.getName(), csii);
}
public void onRefreshCdmServer() {
- try{
+ try{
txtCdmServerStatus.setText(STATUS_CHECKING_AVAILABILITY);
clearOnServerChange();
emptyCredentials();
txtCdmInstanceStatus.setText(STATUS_RETRIEVING);
txtCdmInstanceStatus.setToolTipText(""); //$NON-NLS-1$
+
serverJob = new Job(Messages.RemotingLoginDialog_RETRIEVE_SERVER_INSTANCES) {
@Override
protected IStatus run(IProgressMonitor monitor) {
comboCdmInstance.select(instanceIndex);
}
onRefreshCdmInstance();
- comboCdmInstance.setEnabled(true);
+ comboCdmInstance.setEnabled(allowInstanceChange);
if(isAutoConnect()) {
connect();
}
}
}
}
-/*
- private void updateManagedServerControls() {
- if(selectedServerInfo.isLocalhostMgd()) {
- if(isSelectedCdmInstanceRunningInManagedServer()) {
- txtCdmInstanceStatus.setText(STATUS_STARTED);
- } else {
- txtCdmInstanceStatus.setText(STATUS_NOT_STARTED);
- }
- btnConnect.setEnabled(true);
- selectedServerInfo.setPort(getManagedServerPort());
- updatePort();
- }
-
- if(isManagedServerRunning()) {
- btnStopServer.setEnabled(true);
- } else {
- btnStopServer.setEnabled(false);
- }
- }
-
- private boolean isManagedServerRunning() {
- return CdmStore.getManagedServer() != null && CdmStore.getManagedServer().isAlive();
- }
-
- private boolean isSelectedCdmInstanceRunningInManagedServer() {
- return CdmStore.getManagedServer() != null &&
- CdmStore.getManagedServer().isAlive() &&
- selectedServerInfo.isLocalhostMgd() &&
- CdmStore.getManagedServer().getDataSourceName().equals(selectedCdmInstance.getName());
- }
-
- private void startManagedServer() {
- /*if(isManagedServerRunning()) {
- if(CdmStore.getManagedServer().getDataSourceName().equals(selectedCdmInstance.getName())) {
- return;
- } else {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- onStopManagedServer();
- }
- });
- }
- }
- boolean forceSchemaCreate = !schemaExists(selectedCdmInstance);
- boolean forceSchemaUpdate = LABEL_UPDATE_SCHEMA_VERSION.equals(btnConnect.getText());
-
- Job job = new Job(Messages.RemotingLoginDialog_JOB_SERVER_LAUNCH) {
- @Override
- public IStatus run(IProgressMonitor monitor) {
- String mgdServerConfigFileName = "mgd.datasources.xml"; //$NON-NLS-1$
- String config = CdmServerUtils.convertEditorToServerConfig();
- int maxUnits = 50;
- monitor.beginTask(Messages.RemotingLoginDialog_TASK_LAUNCHING_SERVER, maxUnits);
- try {
- monitor.subTask(String.format(Messages.RemotingLoginDialog_GENERATING_CONFIG_FILE, selectedCdmInstance.getName()));
- File managedServerConfigFile = CdmServerUtils.writeManagedServerConfig(config, mgdServerConfigFileName);
- monitor.worked(1);
- CdmServer cdmServer = new CdmServer(selectedCdmInstance.getName(), managedServerConfigFile);
- cdmServer.setForceSchemaCreate(forceSchemaCreate);
- cdmServer.setForceSchemaUpdate(forceSchemaUpdate);
- CdmStore.setManagedServer(cdmServer);
- monitor.subTask(Messages.RemotingLoginDialog_STARTING_MGD_SERVER);
- cdmServer.start(false, RemotingLoginDialog.this);
- int serverUnits = 0;
-
- // the following loop is a 'fake' progress monitoring where the progress
- // bar is advanced by one unit every second until maxUnits -2
- while(!CdmStore.getManagedServer().isStarted() && !CdmStore.getManagedServer().isFailed()) {
- if(serverUnits < maxUnits - 2) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
- monitor.worked(1);
- serverUnits++;
- }
- }
- Display.getDefault().syncExec(()->{
- hide(false);
- updateManagedServerControls();
- connect();
- });
- } catch (IOException ioe) {
- MessagingUtils.errorDialog(Messages.RemotingLoginDialog_ERROR_GENERATING_CONFIG_FILE,
- this,
- ioe.getMessage(),
- TaxeditorStorePlugin.PLUGIN_ID,
- ioe,
- true);
- } catch (CdmEmbeddedServerException cese) {
- MessagingUtils.errorDialog(Messages.RemotingLoginDialog_ERROR_STARTING_SERVER,
- this,
- cese.getMessage(),
- TaxeditorStorePlugin.PLUGIN_ID,
- cese,
- true);
- } finally {
- monitor.done();
- }
- // NOTE: Errors thrown during server startup are passed to the handleError() implementation
- // TODO: is the above catch clause for CdmEmbeddedServerException still valuable?
-
- return Status.OK_STATUS;
- }
- };
-
- // configure the job
- job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
- job.setUser(true);
- // schedule job
- hide(true);
- job.schedule();
- }
- */
private boolean schemaExists(CdmInstanceInfo instanceInfo) {
if (instanceInfo.getDataSource() != null){
try {
private int compareSchemaVersion(CdmInstanceInfo instanceInfo) throws CdmSourceException {
return CdmMetaData.compareVersion(managedSchemaVersion(instanceInfo), CdmMetaData.getDbSchemaVersion(), 3, null);
}
-/*
- @Override
- public void handleError(final Throwable t) {
-
- Display.getDefault().syncExec(()-> {
- serverJob.cancel();
- String title = Messages.RemotingLoginDialog_SERVER_LAUNCH_ERROR;
- String message = t.getMessage();
-
- MessagingUtils.errorDialog(title,
- this,
- message,
- TaxeditorStorePlugin.PLUGIN_ID,
- t,
- true);
- });
- }
-
- private void onStopManagedServer() {
- try {
- CdmStore.getManagedServer().stop();
- } catch (Exception e) {
- MessagingUtils.errorDialog(Messages.RemotingLoginDialog_ERROR_STOPPING_SERVER,
- this,
- String.format(Messages.RemotingLoginDialog_COULD_NOT_STOP_SERVER, CdmStore.getManagedServer().getPort()),
- TaxeditorStorePlugin.PLUGIN_ID,
- e,
- true);
- }
- CdmStore.setManagedServer(null);
- updateManagedServerControls();
- }
-
- private int getManagedServerPort() {
- return CdmStore.getManagedServer() == null ? CdmServerInfo.NULL_PORT : CdmStore.getManagedServer().getPort();
- }
-*/
protected void checkSelectedCdmInstance() {
try {
if (selectedCdmInstance != null && selectedCdmInstance.getDataSource() != null){
}
}
-// private void checkManagedSelectedInstance() {
-// boolean available = false;
-// String instanceStatus = STATUS_NOT_AVAILABLE;
-// String message = null;
-// String connect = LABEL_CONNECT;
-// Integer color = null;
-// String schemaVersion = CdmMetaData.getDbSchemaVersion();
-//
-// if (!schemaExists(selectedCdmInstance)){
-// message = MESG_SCHEMA_MISSING;
-// connect = LABEL_CREATE_SCHEMA;
-// color = BTN_COLOR_ATTENTION;
-// schemaVersion = MESG_NO_SCHEMA;
-// } else {
-// int compare;
-// try {
-// schemaVersion = managedSchemaVersion(selectedCdmInstance);
-// compare = compareSchemaVersion(selectedCdmInstance);
-// if (compare > 0){
-// instanceStatus = STATUS_NOT_COMPATIBLE;
-// message = MESG_COMPATIBLE_EDITOR_OLD;
-// available = false;
-// }else if (compare < 0){
-// instanceStatus = STATUS_NOT_COMPATIBLE;
-// message = MESG_UPDATE_SCHEMA_VERSION;
-// available = true;
-// connect = LABEL_UPDATE_SCHEMA_VERSION;
-// color = BTN_COLOR_ATTENTION;
-// }else{
-// available = true;
-// instanceStatus = STATUS_AVAILABLE;
-// }
-// } catch (CdmSourceException e) {
-// available = false;
-// }
-// }
-//
-// setManagedValues(available, instanceStatus, connect, color, schemaVersion);
-// setMessage(message);
-// }
-//
-// private void setManagedValues(boolean available, String instanceStatus, String connect, Integer color,
-// String schemaVersion) {
-// Display.getDefault().syncExec(()->{
-// btnConnect.setEnabled(available);
-// btnConnect.setText(connect);
-// Color systemColor = null;
-// if(color != null) {
-// systemColor = Display.getCurrent().getSystemColor(color);
-// }
-// btnConnect.setBackground(systemColor);
-// btnConnect.requestLayout();
-// txtCdmInstanceStatus.setText(instanceStatus);
-// txtServerSchemaVersion.setText(schemaVersion);
-// lblDefaultLogin.setVisible(true);
-// });
-// }
public void connect() {
checkSelectedCdmInstance();
}
}
-// private int getHeightWithoutMessage() {
-// if(xpndblcmpstAdvanced.isExpanded()) {
-// return MIN_EXP_HEIGHT;
-// } else {
-// return MIN_HEIGHT;
-// }
-// }
public void hide(boolean isHidden) {
if (!shlConnect.isDisposed()){
private void updateControls(){
//server
-// comboCdmServer; //nothing to change
String strServerStatus = this.selectedServerInfo != null? STATUS_NOT_AVAILABLE : STATUS_AVAILABLE;
txtCdmServerStatus.setText(strServerStatus);
-// btnCdmServerRefresh; //nothing to change
+
//database
// comboCdmInstance
String strInstanceStatus = this.selectedCdmInstance != null? STATUS_NOT_AVAILABLE : STATUS_AVAILABLE;
txtCdmInstanceStatus.setText(strInstanceStatus);
-// btnCdmInstanceRefresh; //nothing to change
+
//login + connect
txtLogin.setText(Nz(login));
btnConnect.setText(LABEL_CONNECT); //TODO
btnConnect.setEnabled(true);
- //rememberMe + defaultValues
-// btnRememberMe;
-// lblDefaultLogin;
-
- //message
-// styledTxtMessage;
-
- //Advanced
-// txtPort
-// btnStopServer;
-
-// txtServerCdmlibVersion;
-// txtEditorCdmlibVersion;
-// txtServerSchemaVersion;
-// txtEditorCdmVersion;
}
private String Nz(String value) {
*/
public class SuperAreaSelectionWizard extends Wizard {
- private final SuperAreaPage aPage;
- DistributionAggregationConfiguration configurator;
+ private final SuperAreaPage aPage;
+ DistributionAggregationConfiguration configurator;
- public SuperAreaSelectionWizard(DistributionAggregationConfiguration configurator, NamedAreaLevel level) {
- setWindowTitle(Messages.AvailableDistributionWizard_WINDOW_TITLE);
- // TODO if preferenceStore has elements checked load elements in wizard
- aPage = new SuperAreaPage(Messages.AvailableDistributionWizard_PAGE_TITLE, level);
- this.configurator = configurator;
- }
+ public SuperAreaSelectionWizard(DistributionAggregationConfiguration configurator, NamedAreaLevel level) {
+ setWindowTitle(Messages.AvailableDistributionWizard_WINDOW_TITLE);
+ // TODO if preferenceStore has elements checked load elements in wizard
+ aPage = new SuperAreaPage(Messages.AvailableDistributionWizard_PAGE_TITLE, level);
+ this.configurator = configurator;
+ }
- @Override
- public boolean performFinish() {
- // TODO: get Selection and save in EditorPreferences
- if (!checkNoneChecked()) {
- Object[] checkedElements = aPage.getViewer().getCheckedElements();
- Object[] grayedElements = aPage.getViewer().getGrayedElements();
- List<Object> checkedList = new ArrayList<>(Arrays.asList(checkedElements));
- List<Object> grayedList = new ArrayList<>(Arrays.asList(grayedElements));
- checkedList = (ArrayList) CollectionUtils.subtract(checkedList, grayedList);
- ArrayList<UUID> listUIIDChecked = new ArrayList<>();
- ArrayList<UUID> listUIIDGrayed = new ArrayList<>();
- for (Object o : checkedList) {
- if (o instanceof TermDto) {
- listUIIDChecked.add(((TermDto) o).getUuid());
+ @Override
+ public boolean performFinish() {
+ // TODO: get Selection and save in EditorPreferences
+ if (!checkNoneChecked()) {
+ Object[] checkedElements = aPage.getViewer().getCheckedElements();
+ Object[] grayedElements = aPage.getViewer().getGrayedElements();
+ List<Object> checkedList = new ArrayList<>(Arrays.asList(checkedElements));
+ List<Object> grayedList = new ArrayList<>(Arrays.asList(grayedElements));
+ checkedList = (ArrayList) CollectionUtils.subtract(checkedList, grayedList);
+ ArrayList<UUID> listUIIDChecked = new ArrayList<>();
+ ArrayList<UUID> listUIIDGrayed = new ArrayList<>();
+ for (Object o : checkedList) {
+ if (o instanceof TermDto) {
+ listUIIDChecked.add(((TermDto) o).getUuid());
- }else if(o instanceof TermVocabularyDto){
- TermVocabularyDto termVocDto = (TermVocabularyDto) o;
- listUIIDGrayed.add(termVocDto.getUuid());
- }
+ }else if(o instanceof TermVocabularyDto){
+ TermVocabularyDto termVocDto = (TermVocabularyDto) o;
+ listUIIDGrayed.add(termVocDto.getUuid());
}
+ }
// for (Object o : grayedList) {
// if (o instanceof TermDto) {
// listUIIDChecked.add(((TermDto) o).getUuid());
// }
// }
- configurator.setSuperAreas(listUIIDChecked);
+ configurator.setSuperAreas(listUIIDChecked);
- return true;
- } else {
- return false;
- }
+ return true;
+ } else {
+ return false;
}
+ }
- @Override
- public void addPages() {
- addPage(aPage);
- }
+ @Override
+ public void addPages() {
+ addPage(aPage);
+ }
- private boolean checkNoneChecked() {
+ private boolean checkNoneChecked() {
- if (aPage.getViewer().getCheckedElements().length == 0) {
- aPage.setMessage(Messages.AvailableDistributionWizard_CHECK_MESSAGE, aPage.WARNING);
- return true;
- } else {
- aPage.setMessage(null);
- return false;
- }
+ if (aPage.getViewer().getCheckedElements().length == 0) {
+ aPage.setMessage(Messages.AvailableDistributionWizard_CHECK_MESSAGE, aPage.WARNING);
+ return true;
+ } else {
+ aPage.setMessage(null);
+ return false;
}
- //
-// @Override
-// public ConversationHolder getConversationHolder() {
-// if (conversation == null) {
-// conversation = CdmStore.createConversation();
-// }
-// return conversation;
-// }
- //
-// @Override
-// public void update(CdmDataChangeMap changeEvents) {
-// }
}
-
+}
\ No newline at end of file
// new Label(compositeRef, SWT.NONE);
// new Label(compositeRef, SWT.NONE);
- // selectReference = toolkit.createSelectionElement(Rights.class, getConversationHolder(), composite, "Rights", null, EntitySelectionElement.SELECTABLE);
+ // selectReference = toolkit.createSelectionElement(Rights.class, composite, "Rights", null, EntitySelectionElement.SELECTABLE);
final Composite control = new Composite(composite, SWT.WRAP);
GridLayout gridLayoutControl = new GridLayout();
import java.util.Collection;
import eu.etaxonomy.cdm.api.service.IVocabularyService;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
-import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.editor.definedterm.TermDtoContentProvider;
import eu.etaxonomy.taxeditor.store.CdmStore;
public class NamedAreaTermDtoContentProvider extends TermDtoContentProvider {
@Override
- public Collection<? extends TermDto> getChildTerms(TermVocabularyDto voc) {
+ public Collection<? extends TermDto> getChildTerms(TermCollectionDto voc) {
Collection<TermDto> children = getVocabularyToChildTermMap().get(voc);
- if(children==null){
+ if (children == null) {
children = new ArrayList<>(CdmStore.getService(IVocabularyService.class).getCompleteTermHierarchy(voc));
getVocabularyToChildTermMap().put(voc, children);
}
import org.eclipse.ui.IMemento;
import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.term.IEnumTerm;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
* @created 18.07.2013
*/
public abstract class AbstractFilteredCdmEnumSelectionDialog<T extends IEnumTerm> extends
- FilteredItemsSelectionDialog implements IConversationEnabled {
-
- private ConversationHolder conversation;
+ FilteredItemsSelectionDialog {
protected List<T> model;
private String settings;
* @param <T> a T object.
*/
protected AbstractFilteredCdmEnumSelectionDialog(Shell shell,
- ConversationHolder conversation,
String title,
boolean multi,
String settings,
setTitle(title);
setMessage("Use * for wildcard, or ? to see all entries");
this.settings = settings;
-
- this.conversation = conversation;
-
init();
initModel();
T entity = (T) wizard.getEntity();
refresh();
- setPattern(entity);
- getConversationHolder().bind();
+ setPattern(entity);
}
}
};
}
- /**
- * <p>getConversationHolder</p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
- @Override
- public void update(CdmDataChangeMap changeEvents) {}
+
}
\ No newline at end of file
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import eu.etaxonomy.cdm.api.service.dto.EntityDTOBase;
import eu.etaxonomy.cdm.api.service.dto.IdentifiedEntityDTO;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.persistence.dto.EntityDTOBase;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
/**
- * Abstract AbstractFilteredCdmResourceSelectionDialog class.
- *
* @author n.hoffmann
* @created 04.06.2009
*/
T entity = (T) wizard.getEntity();
refresh();
setPattern(entity);
-
-// if (getConversationHolder() != null){
-// getConversationHolder().bind();
-// }
}
- //FIXME : Need to make sure this is a stable fix (ticket 3822)
-// if (getConversationHolder() != null){
-// getConversationHolder().commit();
-// }
}
}
}
import eu.etaxonomy.cdm.api.service.dto.IdentifiedEntityDTO;
import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
-import eu.etaxonomy.cdm.model.term.DefinedTerm;
+import eu.etaxonomy.cdm.model.term.IdentifierType;
import eu.etaxonomy.cdm.persistence.query.MatchMode;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
public abstract class AbstractFilteredIdentifierSelectionDialog<T extends ICdmBase>
extends AbstractFilteredCdmResourceSelectionDialog<T> {
- private DefinedTerm identifierType;
+ private IdentifierType identifierType;
private MatchMode matchMode;
private Class<T> type;
import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.service.IAgentService;
-import eu.etaxonomy.cdm.api.service.dto.EntityDTOBase;
import eu.etaxonomy.cdm.api.service.dto.IdentifiedEntityDTO;
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.persistence.dto.EntityDTOBase;
import eu.etaxonomy.cdm.persistence.dto.TeamOrPersonUuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
* select
*
* @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
* @param entity a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
* @return a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
*/
* @param shell a {@link org.eclipse.swt.widgets.Shell} object.
* @param title a {@link java.lang.String} object.
* @param agent a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
* @param multi a boolean.
* @param settings a {@link java.lang.String} object.
*/
public class AmplificationSelectionDialog extends
AbstractFilteredCdmResourceSelectionDialog<Amplification> {
- public static Amplification select(Shell shell, //ConversationHolder conversation,
+ public static Amplification select(Shell shell,
Amplification amplification){
AmplificationSelectionDialog dialog = new AmplificationSelectionDialog(shell, //conversation,
"Choose Amplification", false, AmplificationSelectionDialog.class.getCanonicalName(), amplification);
/**
* <p>Constructor for FilteredDerivedUnitSelectionDialog.</p>
*/
- protected AmplificationSelectionDialog(Shell shell, //ConversationHolder conversation,
+ protected AmplificationSelectionDialog(Shell shell,
String title,
boolean multi, String settings, Amplification cdmObject) {
super(shell, //conversation,
public class ClassificationSelectionDialog extends
AbstractFilteredCdmResourceSelectionDialog<Classification> {
- /**
- * <p>
- * select
- * </p>
- *
- * @param shell
- * a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation
- * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
- * object.
- * @param curentSelection
- * @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonomicTree} object.
- */
- public static Classification select(Shell shell,//ConversationHolder conversation,
+ public static Classification select(Shell shell,
Classification curentSelection) {
- ClassificationSelectionDialog dialog = new ClassificationSelectionDialog(shell, //conversation,
+ ClassificationSelectionDialog dialog = new ClassificationSelectionDialog(shell,
"Choose a Classification", false, "", null);
return getSelectionFromDialog(dialog);
}
- /**
- * <p>
- * Constructor for FilteredClassificationSelectionDialog.
- * </p>
- *
- * @param shell
- * a {@link org.eclipse.swt.widgets.Shell} object.
- * @param title
- * a {@link java.lang.String} object.
- * @param multi
- * a boolean.
- * @param settings
- * a {@link java.lang.String} object.
- * @param conversation
- * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
- * object.
- * @param classification
- * a {@link eu.etaxonomy.cdm.model.taxon.TaxonomicTree} object.
- */
- protected ClassificationSelectionDialog(Shell shell,//ConversationHolder conversation,
+ protected ClassificationSelectionDialog(Shell shell,
String title, boolean multi,
String settings, Classification classification) {
- super(shell, //conversation,
- title, multi, settings, classification);
+ super(shell, title, multi, settings, classification);
}
- /** {@inheritDoc} */
@Override
protected Classification getPersistentObject(UUID cdmUuid) {
return CdmStore.getService(IClassificationService.class).load(cdmUuid);
}
- /** {@inheritDoc} */
@Override
protected void callService(String pattern) {
model = CdmStore.getService(IClassificationService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
}
- /** {@inheritDoc} */
@Override
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
return null;
}
- /** {@inheritDoc} */
@Override
protected String[] getNewWizardText() {
return null;
* 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.dialog.selection;
import java.util.UUID;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>FilteredCollectionSelectionDialog class.</p>
- *
* @author n.hoffmann
* @created Oct 13, 2010
- * @version 1.0
*/
public class CollectionSelectionDialog extends
AbstractFilteredCdmResourceSelectionDialog<Collection> {
- /**
- * <p>select</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param collection a {@link eu.etaxonomy.cdm.model.occurrence.Collection} object.
- * @return a {@link eu.etaxonomy.cdm.model.occurrence.Collection} object.
- */
- public static Collection select(Shell shell, //ConversationHolder conversation,
+ public static Collection select(Shell shell,
Collection collection){
CollectionSelectionDialog dialog = new CollectionSelectionDialog(shell, //conversation,
"Choose Collection", false, CollectionSelectionDialog.class.getCanonicalName(), collection);
return getSelectionFromDialog(dialog);
}
- /**
- * <p>Constructor for FilteredCollectionSelectionDialog.</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param title a {@link java.lang.String} object.
- * @param multi a boolean.
- * @param settings a {@link java.lang.String} object.
- * @param cdmObject a {@link eu.etaxonomy.cdm.model.occurrence.Collection} object.
- */
- protected CollectionSelectionDialog(Shell shell,//ConversationHolder conversation,
+ protected CollectionSelectionDialog(Shell shell,
String title, boolean multi,
String settings, Collection cdmObject) {
super(shell, //conversation,
title, multi, settings, cdmObject);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
- */
- /** {@inheritDoc} */
@Override
protected Collection getPersistentObject(UUID uuid) {
return CdmStore.getService(ICollectionService.class).load(uuid);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#search
- */
- /** {@inheritDoc} */
@Override
protected void callService(String pattern) {
model = CdmStore.getService(ICollectionService.class).getUuidAndTitleCache(limitOfInitialElements,pattern);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewWizardLinkText()
- */
- /** {@inheritDoc} */
@Override
protected String[] getNewWizardText() {
return new String[]{ "New Collection"};
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getNewEntityWizard()
- */
- /** {@inheritDoc} */
@Override
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
return new NewCollectionWizard();
}
-
-
-}
+}
\ No newline at end of file
import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.service.IAgentService;
-import eu.etaxonomy.cdm.api.service.dto.EntityDTOBase;
import eu.etaxonomy.cdm.api.service.dto.IdentifiedEntityDTO;
import eu.etaxonomy.cdm.model.agent.AgentBase;
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.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.persistence.dto.EntityDTOBase;
import eu.etaxonomy.cdm.persistence.dto.TeamOrPersonUuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.swt.widgets.Shell;
+import eu.etaxonomy.cdm.api.service.ITermCollectionService;
import eu.etaxonomy.cdm.api.service.IVocabularyService;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
+import eu.etaxonomy.cdm.model.term.TermCollection;
+import eu.etaxonomy.cdm.model.term.TermTree;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.taxeditor.preference.CdmPreferenceCache;
}
@Override
protected void init() {
- vocabularies = getAvailableVocabularies();
+ allVocabularies = getAvailableVocabularies();
}
protected List<TermVocabulary> getAvailableVocabularies(){
PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.CommonNameAreaVocabularies);
CdmPreference pref = cache.findBestMatching(key);
if (preselectedVocabularyUuids != null){
- for(int i=0;i<preselectedVocabularyUuids.length;i++){
- TermVocabulary<?> preselectedVocabulary = CdmStore.getService(IVocabularyService.class).find(preselectedVocabularyUuids[i]);
- vocabularies.add(preselectedVocabulary);
+ for(UUID preselectedVocabularyUuid : preselectedVocabularyUuids){
+ TermCollection<?,?> preselectedVocabulary = CdmStore.getService(ITermCollectionService.class).find(preselectedVocabularyUuid);
+ if (preselectedVocabulary instanceof TermVocabulary) {
+ vocabularies.add((TermVocabulary)preselectedVocabulary);
+ }else {
+ if (allTrees == null) {
+ allTrees = new ArrayList<>();
+ }
+ allTrees.add((TermTree)preselectedVocabulary);
+ }
+ }
+ selectedTermCollections = new ArrayList<>();
+ selectedTermCollections.addAll(vocabularies);
+ if (allTrees != null) {
+ selectedTermCollections.addAll(allTrees);
}
}
if ((pref != null && !pref.isAllowOverride()) && preselectedVocabularyUuids!=null) {
return vocabularies;
}else{
- selectedVocabularies = vocabularies;
- return CdmStore.getService(IVocabularyService.class).listByTermType(TermType.NamedArea, true, null, null, null, null);
+ if (allVocabularies == null) {
+ allVocabularies = new ArrayList<>();
+ }
+ allVocabularies.addAll(CdmStore.getService(IVocabularyService.class).listByTermType(TermType.NamedArea, true, null, null, null, null));
+
+ return allVocabularies;
}
}
* The shell for displaying this widget
* @param namedArea
* A namedArea that should be selected when the dialog opens
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
* @param preferenceId a class which is used for generating the preference key so that every
- * dialogs can be grouped to have their own preferences depending on this id
+ * dialogs can be grouped to have their own preferences depending on this id
* @param preselectedVocabularyUuids the {@link UUID}s of the pre-selected vocabularies
* @return a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
*/
- public static NamedArea select(Shell shell, //ConversationHolder conversation,
+ public static NamedArea select(Shell shell,
NamedArea namedArea, String preferenceId) {
- CommonNameNamedAreaSelectionDialog dialog = new CommonNameNamedAreaSelectionDialog(shell, //conversation,
+ CommonNameNamedAreaSelectionDialog dialog = new CommonNameNamedAreaSelectionDialog(shell,
"Choose an area", false, namedArea, preferenceId);
return getSelectionFromDialog(dialog);
}
/**
* @author k.luther
* @since 26.09.2018
- *
*/
public class CommonNameReferenceSelectionDialog extends ReferenceSelectionDialog {
- /**
- * @param shell
- * @param title
- * @param multi
- * @param reference
- */
protected CommonNameReferenceSelectionDialog(Shell shell, String title, boolean multi, Reference reference) {
super(shell, title, multi, reference, null);
-
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#search
- */
- /** {@inheritDoc} */
@Override
protected void callService(String pattern) {
-
model = CdmStore.getService(IReferenceService.class).findUuidAndTitleCacheByMarker(100, pattern, MarkerType.COMMON_NAME_REFERENCE());
-
-
}
- /**
- * <p>select</p>
- *
- * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @return a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
- */
-
- public static Reference select(Shell shell, //ConversationHolder conversation,
+ public static Reference select(Shell shell,
Reference reference) {
CommonNameReferenceSelectionDialog dialog = new CommonNameReferenceSelectionDialog(shell,// conversation,
"Choose a common name reference", isInReference, reference);
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
return new NewCommonNameReferenceWizard(null);
}
-
-}
+}
\ No newline at end of file
* 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.dialog.selection;
import java.util.UUID;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>FilteredDerivedUnitSelectionDialog class.</p>
- *
* @author n.hoffmann
* @created Jun 17, 2010
- * @version 1.0
*/
public class DerivedUnitSelectionDialog extends
AbstractFilteredCdmResourceSelectionDialog<DerivedUnit> {
- /**
- * <p>select</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param unit a {@link eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase} object.
- * @return a {@link eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase} object.
- */
- public static DerivedUnit select(Shell shell, //ConversationHolder conversation,
+ public static DerivedUnit select(Shell shell,
DerivedUnit unit){
DerivedUnitSelectionDialog dialog = new DerivedUnitSelectionDialog(shell, //conversation,
"Choose Unit", false, DerivedUnitSelectionDialog.class.getCanonicalName(), unit);
return getSelectionFromDialog(dialog);
}
- /**
- * <p>Constructor for FilteredDerivedUnitSelectionDialog.</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param title a {@link java.lang.String} object.
- * @param multi a boolean.
- * @param settings a {@link java.lang.String} object.
- * @param cdmObject a {@link eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase} object.
- */
- protected DerivedUnitSelectionDialog(Shell shell, //ConversationHolder conversation,
+ protected DerivedUnitSelectionDialog(Shell shell,
String title,
boolean multi, String settings, DerivedUnit cdmObject) {
- super(shell, //conversation,
- title, multi, settings, cdmObject);
+ super(shell, title, multi, settings, cdmObject);
}
- /** {@inheritDoc} */
@Override
protected DerivedUnit getPersistentObject(UUID uuid) {
Object object = CdmStore.getService(IOccurrenceService.class).load(uuid);
return null;
}
- /** {@inheritDoc} */
@Override
protected void callService(String pattern) {
model = CdmStore.getService(IOccurrenceService.class).getDerivedUnitUuidAndTitleCache(limitOfInitialElements,pattern);
}
- /** {@inheritDoc} */
@Override
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
return new NewDerivedUnitBaseWizard();
}
- /** {@inheritDoc} */
@Override
protected String[] getNewWizardText() {
return new String[]{ "New Unit"};
}
-}
+}
\ No newline at end of file
public class FeatureSelectionDialog extends
AbstractFilteredCdmResourceSelectionDialog<Feature> {
- public static Feature select(Shell shell, //ConversationHolder conversation,
+ public static Feature select(Shell shell,
Feature feature){
FeatureSelectionDialog dialog = new FeatureSelectionDialog(shell, //conversation,
"Choose Feature", false, FeatureSelectionDialog.class.getCanonicalName(), feature);
* @param settings
* @param cdmObject
*/
- protected FeatureSelectionDialog(Shell shell,//ConversationHolder conversation,
+ protected FeatureSelectionDialog(Shell shell,
String title, boolean multi,
String settings, Feature cdmObject) {
super(shell,//conversation,
tree = TermTree.NewInstance(termType);
}
else{
- tree = TermTree.NewInstance();
+ tree = TermTree.NewFeatureInstance();
}
tree.setTitleCache(dialog.getValue(), true);
CdmStore.getService(ITermTreeService.class).merge(tree,true);
* 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.dialog.selection;
import java.util.UUID;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>FilteredFieldUnitSelectionDialog class.</p>
- *
* @author n.hoffmann
* @created Jun 17, 2010
- * @version 1.0
*/
public class FieldUnitSelectionDialog extends
AbstractFilteredCdmResourceSelectionDialog<FieldUnit> {
- /**
- * <p>select</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param observation a {@link eu.etaxonomy.cdm.model.occurrence.FieldUnit} object.
- * @return a {@link eu.etaxonomy.cdm.model.occurrence.FieldUnit} object.
- */
- public static FieldUnit select(Shell shell, //ConversationHolder conversation,
+ public static FieldUnit select(Shell shell,
FieldUnit observation){
FieldUnitSelectionDialog dialog = new FieldUnitSelectionDialog(shell, //conversation,
"Choose Derived Unit", false, FieldUnitSelectionDialog.class.getCanonicalName(), observation);
return getSelectionFromDialog(dialog);
}
- /**
- * <p>Constructor for FilteredFieldUnitSelectionDialog.</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param title a {@link java.lang.String} object.
- * @param multi a boolean.
- * @param settings a {@link java.lang.String} object.
- * @param cdmObject a {@link eu.etaxonomy.cdm.model.occurrence.FieldUnit} object.
- */
- protected FieldUnitSelectionDialog(Shell shell, //ConversationHolder conversation,
+ protected FieldUnitSelectionDialog(Shell shell,
String title, boolean multi, String settings,
FieldUnit cdmObject) {
- super(shell, //conversation,
- title, multi, settings, cdmObject);
+ super(shell, title, multi, settings, cdmObject);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
- */
- /** {@inheritDoc} */
@Override
protected FieldUnit getPersistentObject(UUID uuid) {
Object object = CdmStore.getService(IOccurrenceService.class).load(uuid);
return null;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#search
- */
- /** {@inheritDoc} */
@Override
protected void callService(String pattern) {
model = CdmStore.getService(IOccurrenceService.class).getUuidAndTitleCache(FieldUnit.class, limitOfInitialElements, pattern);
-
}
- /** {@inheritDoc} */
@Override
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
return new NewFieldUnitWizard();
}
- /** {@inheritDoc} */
@Override
protected String[] getNewWizardText() {
return new String[]{"New Field Unit"};
}
-}
+}
\ No newline at end of file
-// $Id$
/**
* Copyright (C) 2017 EDIT
* European Distributed Institute of Taxonomy
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
+import eu.etaxonomy.cdm.model.term.TermCollection;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
/**
* @author k.luther
* @date 21.11.2017
- *
*/
public class FilterDialog extends Dialog {
- List<TermVocabulary> vocabularies = new ArrayList<TermVocabulary>();
+ @SuppressWarnings("rawtypes")
+ private List<TermCollection> vocabularies = new ArrayList<>();
- List<TermVocabulary> selectedVocabularies = new ArrayList<TermVocabulary>();
- List<TermVocabulary> tempSelectedVocabularies = new ArrayList<TermVocabulary>();
- boolean performOk = true;
+ @SuppressWarnings("rawtypes")
+ private List<TermCollection> selectedVocabularies = new ArrayList<>();
+ @SuppressWarnings("rawtypes")
+ private List<TermCollection> tempSelectedVocabularies = new ArrayList<>();
- Object preferenceId;
+ private Object preferenceId;
- /**
- * @param parentShell
- */
- protected FilterDialog(Shell parentShell, Object preferenceId, List<TermVocabulary> selectedVocabularies, List<TermVocabulary> vocabularies) {
+ protected FilterDialog(Shell parentShell, Object preferenceId, List<TermCollection> selectedVocabularies, List<TermCollection> vocabularies) {
super(parentShell);
this.vocabularies = vocabularies;
this.preferenceId = preferenceId;
this.selectedVocabularies = selectedVocabularies;
- this.tempSelectedVocabularies = new ArrayList();
+ this.tempSelectedVocabularies = new ArrayList<>();
this.tempSelectedVocabularies.addAll(selectedVocabularies);
-
-
}
@Override
protected Control createDialogArea(Composite parent) {
Composite dialogArea = new Composite(parent, SWT.NULL);
dialogArea.setLayout(new GridLayout(1, false));
- for (TermVocabulary voc: vocabularies){
+ for (TermCollection voc: vocabularies){
Button btnCheckButton = new Button(dialogArea, SWT.CHECK);
btnCheckButton.setText(voc.getLabel());
btnCheckButton.setData(voc);
public void widgetSelected(SelectionEvent e) {
if (btnCheckButton.getSelection()){
if (!tempSelectedVocabularies.contains(btnCheckButton.getData())){
- tempSelectedVocabularies.add((TermVocabulary)btnCheckButton.getData());
+ tempSelectedVocabularies.add((TermCollection)btnCheckButton.getData());
if (!tempSelectedVocabularies.isEmpty()) {
getButton(IDialogConstants.OK_ID).setEnabled(true);
}
}
}
}
-
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// TODO Auto-generated method stub
-
}
-
});
}
gd_table.widthHint = 543;
return dialogArea;
-
}
@Override
protected void okPressed(){
- for (TermVocabulary voc: vocabularies){
+ for (TermCollection voc: vocabularies){
if (tempSelectedVocabularies.contains(voc)){
PreferencesUtil.setBooleanValue(getPrefKey(voc), false);
selectedVocabularies.add(voc);
super.okPressed();
}
- private String getPrefKey(TermVocabulary vocabulary){
+ private String getPrefKey(TermCollection vocabulary){
return "hide_"+NamedAreaSelectionDialog.class.getCanonicalName()+vocabulary.getUuid()+preferenceId;
}
-
-}
+}
\ No newline at end of file
public class GrantedAuthoritySelectionDialog
extends AbstractFilteredCdmResourceSelectionDialog<GrantedAuthorityImpl> {
- public static GrantedAuthority select(Shell shell, //ConversationHolder conversation,
+ public static GrantedAuthority select(Shell shell,
GrantedAuthorityImpl authority){
GrantedAuthoritySelectionDialog dialog = new GrantedAuthoritySelectionDialog(shell,//conversation,
return getSelectionFromDialog(dialog);
}
- protected GrantedAuthoritySelectionDialog(Shell shell,//ConversationHolder conversation,
+ protected GrantedAuthoritySelectionDialog(Shell shell,
String title, boolean multi,
String settings, GrantedAuthorityImpl cdmObject) {
super(shell, //conversation,
User user;
- public static Group select(Shell shell, //ConversationHolder conversation,
+ public static Group select(Shell shell,
Group group, User user){
GroupSelectionDialog dialog = new GroupSelectionDialog(shell, //conversation,
"Choose Group", false, GroupSelectionDialog.class.getCanonicalName(), group, user);
* @param settings
* @param cdmObject
*/
- protected GroupSelectionDialog(Shell shell,//ConversationHolder conversation,
+ protected GroupSelectionDialog(Shell shell,
String title, boolean multi,
String settings, Group cdmObject, User user) {
super(shell, //conversation,
public class MediaSelectionDialog extends
AbstractFilteredCdmResourceSelectionDialog<Media> {
- public static Media select(Shell shell, //ConversationHolder conversation,
+ public static Media select(Shell shell,
Media media){
MediaSelectionDialog dialog = new MediaSelectionDialog(shell, //conversation,
"Choose Media", false, MediaSelectionDialog.class.getCanonicalName(), media);
/**
* <p>Constructor for FilteredDerivedUnitSelectionDialog.</p>
*/
- protected MediaSelectionDialog(Shell shell, //ConversationHolder conversation,
+ protected MediaSelectionDialog(Shell shell,
String title,
boolean multi, String settings, Media cdmObject) {
super(shell, //conversation,
import org.eclipse.swt.widgets.Composite;\r
import org.eclipse.swt.widgets.Shell;\r
\r
+import eu.etaxonomy.cdm.api.service.ITermCollectionService;\r
import eu.etaxonomy.cdm.api.service.ITermService;\r
+import eu.etaxonomy.cdm.api.service.ITermTreeService;\r
import eu.etaxonomy.cdm.api.service.IVocabularyService;\r
import eu.etaxonomy.cdm.model.location.NamedArea;\r
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;\r
import eu.etaxonomy.cdm.model.metadata.TermSearchField;\r
import eu.etaxonomy.cdm.model.term.DefinedTermBase;\r
+import eu.etaxonomy.cdm.model.term.TermCollection;\r
+import eu.etaxonomy.cdm.model.term.TermTree;\r
import eu.etaxonomy.cdm.model.term.TermType;\r
import eu.etaxonomy.cdm.model.term.TermVocabulary;\r
import eu.etaxonomy.taxeditor.model.ImageResources;\r
import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;\r
-import eu.etaxonomy.taxeditor.preference.CdmPreferenceCache;\r
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
\r
public class NamedAreaSelectionDialog extends\r
AbstractFilteredCdmResourceSelectionDialog<NamedArea> {\r
\r
-// private class IncludeNamedAreaVocabulary extends Action {\r
-// private final TermVocabulary<NamedArea> vocabulary;\r
-//\r
-// /**\r
-// * Creates a new instance of the class.\r
-// */\r
-// public IncludeNamedAreaVocabulary(TermVocabulary<NamedArea> vocabulary) {\r
-// super(vocabulary.getTitleCache(), IAction.AS_CHECK_BOX);\r
-// this.vocabulary = vocabulary;\r
-// }\r
-//\r
-// @Override\r
-// public void run(){\r
-// if(isChecked()){\r
-// selectedVocabularies.add(vocabulary);\r
-// }else{\r
-// selectedVocabularies.remove(vocabulary);\r
-// }\r
-// PreferencesUtil.setBooleanValue(getPrefKey(vocabulary), !isChecked());\r
-// search();\r
-// }\r
-// }\r
-\r
protected List<NamedArea> selectedAreas;\r
- protected List<TermVocabulary> selectedVocabularies;\r
- protected List<TermVocabulary> vocabularies;\r
+ @SuppressWarnings("rawtypes")\r
+ protected List<TermCollection> selectedTermCollections;\r
+ @SuppressWarnings("rawtypes")\r
+ protected List<TermVocabulary> allVocabularies;\r
+ protected List<TermTree> allTrees;\r
\r
/**\r
* Creates a filtered selection dialog to select a named area.\r
* The shell for displaying this widget\r
* @param namedArea\r
* A namedArea that should be selected when the dialog opens\r
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.\r
* @param preferenceId a class which is used for generating the preference key so that every\r
- * dialogs can be grouped to have their own preferences depending on this id\r
+ * dialogs can be grouped to have their own preferences depending on this id\r
* @param preselectedVocabularyUuids the {@link UUID}s of the pre-selected vocabularies\r
* @return a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.\r
*/\r
\r
protected NamedAreaSelectionDialog(Shell shell,\r
String title, boolean multi, NamedArea namedArea, Object preferenceId, UUID... preselectedVocabularyUuids) {\r
- super(shell,\r
- title, multi, NamedAreaSelectionDialog.class.getCanonicalName(), namedArea);\r
\r
- selectedVocabularies = new ArrayList<TermVocabulary>();\r
+ super(shell, title, multi, NamedAreaSelectionDialog.class.getCanonicalName(), namedArea);\r
+\r
+ selectedTermCollections = new ArrayList<>();\r
this.preferenceID = preferenceId;\r
\r
if (preselectedVocabularyUuids != null && preselectedVocabularyUuids.length > 0){\r
- for(int i=0;i<preselectedVocabularyUuids.length;i++){\r
- TermVocabulary preselectedVocabulary = CdmStore.getService(IVocabularyService.class).find(preselectedVocabularyUuids[i]);\r
- selectedVocabularies.add(preselectedVocabulary);\r
+ for(UUID preselectedVocabularyUuid : preselectedVocabularyUuids){\r
+ TermCollection<?,?> preselectedVocabulary = CdmStore.getService(ITermCollectionService.class).find(preselectedVocabularyUuid);\r
+ selectedTermCollections.add(preselectedVocabulary);\r
}\r
}else{\r
- selectedVocabularies = createSelectedVocabularies();\r
+ selectedTermCollections = createSelectedVocabularies();\r
}\r
}\r
\r
- protected List<TermVocabulary> createSelectedVocabularies() {\r
- List<TermVocabulary> tempSelectedVocabularies = new ArrayList<TermVocabulary>();\r
- for(TermVocabulary vocabulary:vocabularies){\r
- if((selectedVocabularies.contains(vocabulary) && !PreferencesUtil.getBooleanValue(getPrefKey(vocabulary)))\r
+ protected List<TermCollection> createSelectedVocabularies() {\r
+ @SuppressWarnings("rawtypes")\r
+ List<TermCollection> tempSelectedVocabularies = new ArrayList<>();\r
+ for(TermCollection<?,?> vocabulary: allVocabularies){\r
+ if((selectedTermCollections.contains(vocabulary) && !PreferencesUtil.getBooleanValue(getPrefKey(vocabulary)))\r
|| !PreferencesUtil.getBooleanValue(getPrefKey(vocabulary))){\r
tempSelectedVocabularies.add(vocabulary);\r
}\r
return tempSelectedVocabularies;\r
}\r
\r
-// private static UUID[] createVocabularyUuidList() {\r
-// String preselectedVocString = PreferencesUtil.getStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey());\r
-// if (StringUtils.isBlank(preselectedVocString)){\r
-// return null;\r
-// }\r
-// String[] preselectedVocArray = preselectedVocString.split(";");\r
-// UUID[] uuidList = new UUID[preselectedVocArray.length];\r
-// int i = 0;\r
-// for (String uuidString: preselectedVocArray){\r
-// uuidList[i]= UUID.fromString(uuidString);\r
-// i++;\r
-// }\r
-// return uuidList;\r
-// }\r
-\r
- private String getPrefKey(TermVocabulary vocabulary){\r
- return "hide_"+NamedAreaSelectionDialog.class.getCanonicalName()+vocabulary.getUuid()+preferenceID;\r
+ private String getPrefKey(TermCollection<?,?> termCollection){\r
+ return "hide_"+NamedAreaSelectionDialog.class.getCanonicalName()+termCollection.getUuid()+preferenceID;\r
}\r
\r
@Override\r
protected NamedArea getPersistentObject(UUID uuid) {\r
\r
- DefinedTermBase area = CdmStore.getService(ITermService.class).find(uuid);\r
+ DefinedTermBase<?> area = CdmStore.getService(ITermService.class).find(uuid);\r
if (area instanceof NamedArea){\r
return (NamedArea) area;\r
}\r
\r
@Override\r
protected void init() {\r
- vocabularies = getAvailableVocabularies();\r
+ getAvailableVocabularies();\r
}\r
\r
- private List<TermVocabulary> getAvailableVocabularies(){\r
- vocabularies = new ArrayList<>();\r
- CdmPreferenceCache cache = CdmPreferenceCache.instance();\r
- vocabularies = CdmStore.getService(IVocabularyService.class).listByTermType(TermType.NamedArea, true, null, null, null, null);\r
- return vocabularies;\r
+ private void getAvailableVocabularies(){\r
+ allVocabularies = new ArrayList<>();\r
+ allVocabularies.addAll(CdmStore.getService(IVocabularyService.class).listByTermType(TermType.NamedArea, true, null, null, null, null));\r
+\r
+ allTrees = CdmStore.getService(ITermTreeService.class).list(TermType.NamedArea, null, null, null, null);\r
+ if (allTrees == null) {\r
+ allTrees = new ArrayList<>();\r
+ }\r
}\r
\r
@Override\r
@Override\r
void createFilterButton(Composite searchAndFilter){\r
filterButton = new Button(searchAndFilter, SWT.NONE);\r
-// filterButton.setText("Filter");\r
filterButton.setImage(ImageResources.getImage(ImageResources.FUNNEL_ICON));\r
-// SelectionListener filterSelectionListener = new FilterSelectionListener(preferenceID, this);\r
filterButton.addSelectionListener(new SelectionListener(){\r
@Override\r
public void widgetSelected(SelectionEvent e) {\r
Object source = e.getSource();\r
if (source instanceof Button){\r
- Dialog dialog = new FilterDialog(getShell(), preferenceID, selectedVocabularies, vocabularies);\r
+ List<TermCollection> allCollections = new ArrayList<>();\r
+ allCollections.addAll(allVocabularies);\r
+ if (allTrees!= null) {\r
+ allCollections.addAll(allTrees);\r
+ }\r
+\r
+ Dialog dialog = new FilterDialog(getShell(), preferenceID, selectedTermCollections, allCollections);\r
dialog.open();\r
createSelectedVocabularies();\r
search();\r
\r
@Override\r
protected void callService(String pattern) {\r
+ //label type\r
String abbrevTypeString = PreferencesUtil.getStringValue(PreferencePredicate.NamedAreaSearchForAbbrev.getKey());\r
TermSearchField abbrevType;\r
try{\r
}catch(IllegalArgumentException e){\r
abbrevType = null;\r
}\r
- if (selectedVocabularies == null || selectedVocabularies.size() == 0){\r
- if (abbrevType != null && !abbrevType.equals(TermSearchField.NoAbbrev)){\r
- model = CdmStore.getService(ITermService.class).getUuidAndTitleCacheNamedAreaByAbbrev(vocabularies, limitOfInitialElements, pattern, PreferencesUtil.getGlobalLanguage(), abbrevType);\r
- }else{\r
- model = CdmStore.getService(ITermService.class).getUuidAndTitleCacheNamedArea(vocabularies, limitOfInitialElements, pattern, PreferencesUtil.getGlobalLanguage());\r
- }\r
- }else{\r
- if (abbrevType != null && !abbrevType.equals(TermSearchField.NoAbbrev)){\r
- model = CdmStore.getService(ITermService.class).getUuidAndTitleCacheNamedAreaByAbbrev(selectedVocabularies, limitOfInitialElements, pattern, PreferencesUtil.getGlobalLanguage(), abbrevType);\r
- }else{\r
- model = CdmStore.getService(ITermService.class).getUuidAndTitleCacheNamedArea(selectedVocabularies, limitOfInitialElements, pattern, PreferencesUtil.getGlobalLanguage());\r
- }\r
- }\r
+\r
+ model = CdmStore.getService(ITermService.class).getUuidAndTitleCache(NamedArea.class, selectedTermCollections, limitOfInitialElements, pattern, PreferencesUtil.getGlobalLanguage(), abbrevType);\r
}\r
}
\ No newline at end of file
import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.service.IAgentService;
-import eu.etaxonomy.cdm.api.service.dto.EntityDTOBase;
import eu.etaxonomy.cdm.api.service.dto.IdentifiedEntityDTO;
import eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor;
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.persistence.dto.EntityDTOBase;
import eu.etaxonomy.cdm.persistence.dto.TeamOrPersonUuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
// return new FilteredCdmResourceAbbrevLabelProvider();
// }
- /**
- * <p>select</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param entity a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
- * @return a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
- */
public static TeamOrPersonBase<?> select(Shell shell,
TeamOrPersonBase<?> entity, boolean teamMemberSelection) {
NomenclaturalAuthorSelectionDialog dialog = new NomenclaturalAuthorSelectionDialog(shell, //conversation,
}
};
}
-
-
-}
+}
\ No newline at end of file
public class NomenclaturalAuthorTeamSelectionDialog
extends AbstractFilteredCdmResourceSelectionDialog<Team> {
- /**
- * <p>select</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param team a {@link eu.etaxonomy.cdm.model.agent.Team} object.
- * @return a {@link eu.etaxonomy.cdm.model.agent.Team} object.
- */
public static Team select(Shell shell,
Team team){
NomenclaturalAuthorTeamSelectionDialog dialog = new NomenclaturalAuthorTeamSelectionDialog(shell, //conversation,
return getSelectionFromDialog(dialog);
}
- /**
- * <p>Constructor for FilteredNomenclaturalAuthorTeamSelectionDialog.</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param title a {@link java.lang.String} object.
- * @param multi a boolean.
- * @param settings a {@link java.lang.String} object.
- * @param agent a {@link eu.etaxonomy.cdm.model.agent.Team} object.
- */
protected NomenclaturalAuthorTeamSelectionDialog(Shell shell,
String title,
boolean multi, String settings, Team agent) {
return new String[]{"new Team"};
}
-// @Override
-// protected void search() {
-// Control control =getSearchField();
-// String pattern = null;
-// if (control != null){
-// pattern = ((Text)control).getText();
-// }
-//
-// model = CdmStore.getService(IAgentService.class).getUuidAndAbbrevTitleCache(limitOfInitialElements, pattern, Team.class);
-// }
-
@Override
protected Team getPersistentObject(UUID uuid) {
return CdmBase.deproxy(CdmStore.getService(IAgentService.class).load(uuid), Team.class) ;
/**
* @author k.luther
* @date 21.06.2016
- *
*/
public class NomenclaturalPersonAuthorSelectionDialog extends PersonSelectionDialog {
- /**
- * @param shell
- * @param conversation
- * @param title
- * @param multi
- * @param settings
- * @param agent
- */
- protected NomenclaturalPersonAuthorSelectionDialog(Shell shell, //ConversationHolder conversation,
+ protected NomenclaturalPersonAuthorSelectionDialog(Shell shell,
String title, boolean multi,
String settings, Person agent) {
- super(shell, //conversation,
- title, multi, settings, agent);
- // TODO Auto-generated constructor stub
+ super(shell, title, multi, settings, agent);
}
-
- /**
- * <p>select</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param entity a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
- * @return a {@link eu.etaxonomy.cdm.model.agent.AgentBase} object.
- */
- public static Person select(Shell shell, //ConversationHolder conversation,
+ public static Person select(Shell shell,
Person entity, boolean teamMemberSelection) {
NomenclaturalPersonAuthorSelectionDialog dialog = new NomenclaturalPersonAuthorSelectionDialog(shell,
"Choose Agent", false, NomenclaturalAuthorSelectionDialog.class.getCanonicalName(), entity);
protected void callService(String pattern) {
model = (List)CdmStore.getService(IAgentService.class).getUuidAndAbbrevTitleCache(Person.class, limitOfInitialElements, pattern);
}
-
-}
+}
\ No newline at end of file
import org.eclipse.swt.widgets.Text;
import eu.etaxonomy.cdm.api.service.IReferenceService;
-import eu.etaxonomy.cdm.api.service.dto.EntityDTOBase.CdmEntity;
import eu.etaxonomy.cdm.api.service.dto.IdentifiedEntityDTO;
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.cdm.persistence.dto.EntityDTOBase.CdmEntity;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.query.MatchMode;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
private TeamOrPersonBase author;
private boolean firstCall = true;
- protected NomenclaturalReferenceSelectionDialog(Shell shell,//ConversationHolder conversation,
+ protected NomenclaturalReferenceSelectionDialog(Shell shell,
String title, boolean multi,
Reference reference, boolean inReference, TeamOrPersonBase author) {
super(shell, //conversation,
protected ILabelProvider createListLabelProvider() {
return new FilteredCdmResourceAbbrevLabelProvider();
}
-// @Override
-// protected void addIdentifierCheckButton(Composite searchAndFilter) {
-// Button btnCheckButton = new Button(searchAndFilter, SWT.CHECK);
-// btnCheckButton.setText("Use Identifier");
-// btnCheckButton.addSelectionListener(new SelectionAdapter() {
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// useIdentifier = btnCheckButton.getSelection();
-// }
-// });
-// }
- /**
- * <p>select</p>
- *
- * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @return a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
- */
-
- public static Reference select(Shell shell, //ConversationHolder conversation,
+ public static Reference select(Shell shell,
Reference reference, TeamOrPersonBase author) {
NomenclaturalReferenceSelectionDialog dialog = new NomenclaturalReferenceSelectionDialog(shell,// conversation,
"Choose a reference", isInReference, reference, false, author);
return getSelectionFromDialog(dialog);
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#createFilter()
- */
- /** {@inheritDoc} */
-// @Override
-// protected ItemsFilter createFilter() {
-// return new ItemsFilter() {
-//
-// /**
-// * Always returns false to enforce refiltering even if the pattern is equal
-// */
-// @Override
-// public boolean equalsFilter(ItemsFilter filter) {
-// return false;
-// }
-//
-// @Override
-// public boolean isConsistentItem(Object item) {
-// return false;
-// }
-//
-// @Override
-// public boolean matchItem(Object item) {
-// return true;
-//// String text = null;
-//// if(item instanceof UuidAndTitleCache){
-//// if (((UuidAndTitleCache) item).getAbbrevTitleCache() != null){
-//// text = ((UuidAndTitleCache) item).getAbbrevTitleCache();
-//// } else{
-//// text = ((UuidAndTitleCache) item).getTitleCache();
-//// }
-//// }else if(item instanceof String){
-//// text = (String) item;
-//// }
-//// return text != null ? matches(text) : false;
-// }
-//
-// };
-// }
-
-
-
public class FilteredCdmResourceAbbrevLabelProvider extends LabelProvider {
@Override
public String getText(Object element) {
}
return abbrevTitleCache;
}
- };
+ }
@Override
protected Comparator getItemsComparator() {
* 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.dialog.selection;
import java.util.ArrayList;
import org.eclipse.swt.widgets.Shell;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
/**
- * <p>OriginalSourceTypeSelectionDialog class.</p>
- *
* @author c.mathew
* @created 18.07.2013
- * @version 1.0
*/
public class OriginalSourceTypeSelectionDialog extends
AbstractFilteredCdmEnumSelectionDialog<OriginalSourceType> {
- /**
- * <p>select</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @return a {@link eu.etaxonomy.cdm.model.reference.OriginalSourceType} object.
- */
- public static OriginalSourceType select(Shell shell, ConversationHolder conversation){
+ public static OriginalSourceType select(Shell shell){
OriginalSourceTypeSelectionDialog dialog =
new OriginalSourceTypeSelectionDialog(shell,
- conversation,
"Choose Original Source Type",
false,
OriginalSourceTypeSelectionDialog.class.getCanonicalName());
return getSelectionFromDialog(dialog);
}
- /**
- * <p>Constructor for FilteredDerivedUnitSelectionDialog.</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param title a {@link java.lang.String} object.
- * @param multi a boolean.
- * @param settings a {@link java.lang.String} object.
- */
protected OriginalSourceTypeSelectionDialog(Shell shell,
- ConversationHolder conversation,
String title,
boolean multi,
String settings) {
- super(shell, conversation, title, multi, settings, OriginalSourceType.PrimaryTaxonomicSource);
+ super(shell, title, multi, settings, OriginalSourceType.PrimaryTaxonomicSource);
}
-
- /** {@inheritDoc} */
@Override
protected void initModel() {
- model = new ArrayList<OriginalSourceType>();
+ model = new ArrayList<>();
model.addAll(EnumSet.allOf(OriginalSourceType.class));
}
- /** {@inheritDoc} */
@Override
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
return null;
}
- /** {@inheritDoc} */
@Override
protected String getNewWizardLinkText() {
return null;
}
-}
+}
\ No newline at end of file
* 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.dialog.selection;
-import java.util.List;
import java.util.UUID;
import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>FilteredPersonSelectionDialog class.</p>
- *
* @author n.hoffmann
* @created Sep 24, 2009
- * @version 1.0
*/
public class PersonSelectionDialog extends
AgentSelectionDialog<Person> {
- /**
- * <p>select</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param person a {@link eu.etaxonomy.cdm.model.agent.Person} object.
- * @return a {@link eu.etaxonomy.cdm.model.agent.Person} object.
- */
- public static Person select(Shell shell, //onversationHolder conversation,
- Person person){
- PersonSelectionDialog dialog = new PersonSelectionDialog(shell, //conversation,
+ public static Person select(Shell shell, Person person){
+ PersonSelectionDialog dialog = new PersonSelectionDialog(shell,
"Choose a person", false, PersonSelectionDialog.class.getCanonicalName(), person);
return getSelectionFromDialog(dialog);
}
- /**
- * <p>Constructor for FilteredPersonSelectionDialog.</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param title a {@link java.lang.String} object.
- * @param multi a boolean.
- * @param settings a {@link java.lang.String} object.
- * @param cdmObject a {@link eu.etaxonomy.cdm.model.agent.Person} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- protected PersonSelectionDialog(Shell shell,// ConversationHolder conversation,
- String title,
+ protected PersonSelectionDialog(Shell shell, String title,
boolean multi, String settings, Person cdmObject) {
super(shell, title, multi, settings, cdmObject, true);
}
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
- */
- /** {@inheritDoc} */
@Override
protected Person getPersistentObject(UUID uuid) {
return (Person) CdmStore.getService(IAgentService.class).load(uuid);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#search
- */
- /** {@inheritDoc} */
@Override
protected void callService(String pattern) {
model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Person.class, limitOfInitialElements, pattern);
}
- /** {@inheritDoc} */
@Override
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
return new NewPersonWizard();
}
- /** {@inheritDoc} */
@Override
protected String[] getNewWizardText() {
return new String[]{"New Person"};
}
-}
+}
\ No newline at end of file
public class PolytomousKeySelectionDialog extends
AbstractFilteredCdmResourceSelectionDialog<PolytomousKey> {
- public static PolytomousKey select(Shell shell, //ConversationHolder conversation,
+ public static PolytomousKey select(Shell shell,
PolytomousKey key){
PolytomousKeySelectionDialog dialog = new PolytomousKeySelectionDialog(shell, //conversation,
"Choose Polytomous Key", false, PolytomousKeySelectionDialog.class.getCanonicalName(), key);
* @param settings
* @param cdmObject
*/
- protected PolytomousKeySelectionDialog(Shell shell,//ConversationHolder conversation,
+ protected PolytomousKeySelectionDialog(Shell shell,
String title, boolean multi,
String settings, PolytomousKey cdmObject) {
super(shell, //conversation,
public class PrimerSelectionDialog extends
AbstractFilteredCdmResourceSelectionDialog<Primer> {
- public static Primer select(Shell shell, //ConversationHolder conversation,
+ public static Primer select(Shell shell,
Primer primer){
PrimerSelectionDialog dialog = new PrimerSelectionDialog(shell, //conversation,
"Choose Primer", false, PrimerSelectionDialog.class.getCanonicalName(), primer);
/**
* <p>Constructor for FilteredDerivedUnitSelectionDialog.</p>
*/
- protected PrimerSelectionDialog(Shell shell, //ConversationHolder conversation,
+ protected PrimerSelectionDialog(Shell shell,
String title,
boolean multi, String settings, Primer cdmObject) {
super(shell, //conversation,
* 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.dialog.selection;
import java.util.ArrayList;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>FilteredReferenceSelectionDialog class.</p>
- *
* @author n.hoffmann
* @created 04.06.2009
- * @version 1.0
*/
public class ReferenceSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<Reference> {
Map<UUID, AlternativeIdentifier> identifierMap;
Set<Reference> preSelectedReferences = new HashSet<>();
- /**
- * <p>select</p>
- *
- * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @return a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
- */
- public static Reference select(Shell shell, //ConversationHolder conversation,
+ public static Reference select(Shell shell,
Reference reference, boolean isInReference) {
ReferenceSelectionDialog dialog = new ReferenceSelectionDialog(shell, //conversation,
"Choose a reference", false, reference, isInReference);
return getSelectionFromDialog(dialog);
}
- /**
- * <p>select</p>
- *
- * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @return a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
- */
- public static Reference select(Shell shell, //ConversationHolder conversation,
+ public static Reference select(Shell shell,
Reference reference) {
ReferenceSelectionDialog dialog = new ReferenceSelectionDialog(shell, //conversation,
"Choose a reference", false, reference, null);
return getSelectionFromDialog(dialog);
}
-
-
-
- /**
- * <p>Constructor for FilteredReferenceSelectionDialog.</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param title a {@link java.lang.String} object.
- * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param multi a boolean.
- */
- protected ReferenceSelectionDialog(Shell shell, //ConversationHolder conversation,
+ protected ReferenceSelectionDialog(Shell shell,
String title, boolean multi, Reference reference, Set<Reference> preSelectedReferences) {
- super(shell, //conversation,
+ super(shell,
title, multi, ReferenceSelectionDialog.class.getCanonicalName(), reference);
this.currentReference = reference;
this.preSelectedReferences = preSelectedReferences;
-
}
-
-
-
-
- /**
- * <p>Constructor for FilteredReferenceSelectionDialog.</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param title a {@link java.lang.String} object.
- * @param reference a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param multi a boolean.
- */
- protected ReferenceSelectionDialog(Shell shell, //ConversationHolder conversation,
+ protected ReferenceSelectionDialog(Shell shell,
String title, boolean multi, Reference reference, boolean isInReference) {
super(shell, //conversation,
title, multi, ReferenceSelectionDialog.class.getCanonicalName());
- this.isInReference = isInReference;
+ ReferenceSelectionDialog.isInReference = isInReference;
this.currentReference = reference;
-
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#getPersistentObject(java.util.UUID)
- */
- /** {@inheritDoc} */
@Override
protected Reference getPersistentObject(UUID cdmUuid) {
if (lastSelectedReferences == null){
return CdmStore.getService(IReferenceService.class).load(cdmUuid);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.AbstractFilteredCdmResourceSelectionDialog#search
- */
- /** {@inheritDoc} */
@Override
protected void callService(String pattern) {
}else{
model = CdmStore.getService(IReferenceService.class).getUuidAndTitleCacheForUUIDS(uuids);
}
-
}
} else if (isInReference && currentReference != null){
model.clear();
}
for (IdentifiedEntityDTO dto: list){
-
model.add(dto.getCdmEntity());
}
}else{
-
model = CdmStore.getService(IReferenceService.class).getUuidAndTitleCache(limitOfInitialElements,pattern, currentReference.getType());
}
if (model!= null){
model.clear();
}
- identifierMap = new HashMap();
+ identifierMap = new HashMap<>();
for (IdentifiedEntityDTO dto: list){
if (dto.getIdentifier() != null){
identifierMap.put(dto.getCdmEntity().getUuid(), dto.getIdentifier());
}
model.add(dto.getCdmEntity());
-
}
}else if (isUseIdentifier() ){
List<IdentifiedEntityDTO<Reference>> list = CdmStore.getService(IReferenceService.class).listByIdentifierAbbrev(pattern, null, MatchMode.BEGINNING, limitOfInitialElements);
if (model!= null){
model.clear();
}
- identifierMap = new HashMap();
+ identifierMap = new HashMap<>();
for (IdentifiedEntityDTO dto: list){
identifierMap.put(dto.getCdmEntity().getUuid(), dto.getIdentifier());
model.add(dto.getCdmEntity());
-
}
}else {
model = CdmStore.getService(IReferenceService.class).getUuidAndTitleCache(limitOfInitialElements,pattern);
}
-
}
-
}
@Override
}
});
}
- /** {@inheritDoc} */
+
@Override
protected String getTitle(Reference cdmObject) {
if(cdmObject == null){
}else{
return super.getTitle(cdmObject);
}
-// }else{
-// return DefaultReferenceCacheStrategy.putAuthorToEndOfString(cdmObject.getTitleCache(), cdmObject.getAuthorship().getTitleCache());
-// }
}
- /** {@inheritDoc} */
@Override
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
if (isInReference){
return new NewReferenceWizard(null);
}
- /** {@inheritDoc} */
@Override
protected String[] getNewWizardText() {
return new String[]{"New Reference"};
}
- /** {@inheritDoc} */
@Override
protected void search() {
Control control =getSearchField();
titleCache += " (-)";
}
}
-
}
return titleCache;
}
- };
-
-}
+ }
+}
\ No newline at end of file
public class RightsSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<Rights> {
- public static Rights select(Shell shell, //ConversationHolder conversation,
+ public static Rights select(Shell shell,
Rights rights){
RightsSelectionDialog dialog = new RightsSelectionDialog(shell, //conversation,
"Choose Rights", false, RightsSelectionDialog.class.getCanonicalName(), rights);
/**
* <p>Constructor for FilteredDerivedUnitSelectionDialog.</p>
*/
- protected RightsSelectionDialog(Shell shell, //ConversationHolder conversation,
+ protected RightsSelectionDialog(Shell shell,
String title,
boolean multi, String settings, Rights rights) {
super(shell, //conversation,
* @author k.luther
* @date 15.11.2017d
*/
-public abstract class SearchDialog<T extends ICdmBase> extends Dialog{// implements IConversationEnabled{
+public abstract class SearchDialog<T extends ICdmBase> extends Dialog{
private TableViewer list;
private Text searchField;
\r
import org.eclipse.swt.widgets.Shell;\r
\r
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;\r
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;\r
import eu.etaxonomy.cdm.model.agent.AgentBase;\r
import eu.etaxonomy.cdm.model.agent.Institution;\r
import eu.etaxonomy.cdm.model.agent.Person;\r
if(clazz.equals(Team.class)){\r
return (T) TeamSelectionDialog.select(shell, (Team)currentSelection);\r
}\r
- if(clazz.equals(TeamOrPersonBase.class) && (parentElement instanceof AuthorshipDetailElement \r
+ if(clazz.equals(TeamOrPersonBase.class) && (parentElement instanceof AuthorshipDetailElement\r
|| (parentElement instanceof ReferenceDetailElement && ((ReferenceDetailElement)parentElement).isNomenclaturalReference()))){\r
return (T) NomenclaturalAuthorSelectionDialog.select(shell,\r
(TeamOrPersonBase) currentSelection, false);\r
public class SpecimenOrObservationBaseSelectionDialog extends
AbstractFilteredCdmResourceSelectionDialog<SpecimenOrObservationBase> {
- public static SpecimenOrObservationBase select(Shell shell, //ConversationHolder conversation,
+ public static SpecimenOrObservationBase select(Shell shell,
SpecimenOrObservationBase observation){
SpecimenOrObservationBaseSelectionDialog dialog = new SpecimenOrObservationBaseSelectionDialog(shell, //conversation,
"Choose field unit or derived unit", false, SpecimenOrObservationBaseSelectionDialog.class.getCanonicalName(), observation);
return getSelectionFromDialog(dialog);
}
- protected SpecimenOrObservationBaseSelectionDialog(Shell shell, //ConversationHolder conversation,
+ protected SpecimenOrObservationBaseSelectionDialog(Shell shell,
String title, boolean multi, String settings,
SpecimenOrObservationBase cdmObject) {
super(shell, //conversation,
-//$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.dialog.selection;
import java.util.ArrayList;
import org.eclipse.swt.widgets.Shell;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
/**
-* <p>OriginalSourceTypeSelectionDialog class.</p>
-*
* @author c.mathew
* @created 18.07.2013
-* @version 1.0
*/
public class SpecimenOrObservationTypeSelectionDialog extends
AbstractFilteredCdmEnumSelectionDialog<SpecimenOrObservationType> {
- /**
- * <p>select</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @return a {@link eu.etaxonomy.cdm.model.reference.OriginalSourceType} object.
- */
- public static SpecimenOrObservationType select(Shell shell, ConversationHolder conversation){
+ public static SpecimenOrObservationType select(Shell shell){
SpecimenOrObservationTypeSelectionDialog dialog =
new SpecimenOrObservationTypeSelectionDialog(shell,
- conversation,
"Choose Specimen / Observation Type",
false,
SpecimenOrObservationTypeSelectionDialog.class.getCanonicalName());
return getSelectionFromDialog(dialog);
}
- /**
- * <p>Constructor for FilteredDerivedUnitSelectionDialog.</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param title a {@link java.lang.String} object.
- * @param multi a boolean.
- * @param settings a {@link java.lang.String} object.
- */
protected SpecimenOrObservationTypeSelectionDialog(Shell shell,
- ConversationHolder conversation,
String title,
boolean multi,
String settings) {
- super(shell, conversation, title, multi, settings, SpecimenOrObservationType.Unknown);
+ super(shell, title, multi, settings, SpecimenOrObservationType.Unknown);
}
-
- /** {@inheritDoc} */
@Override
protected void initModel() {
model = new ArrayList<SpecimenOrObservationType>();
model.addAll(EnumSet.allOf(SpecimenOrObservationType.class));
}
- /** {@inheritDoc} */
@Override
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
return null;
}
- /** {@inheritDoc} */
@Override
protected String getNewWizardLinkText() {
return null;
}
-}
+}
\ No newline at end of file
* 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.dialog.selection;
import java.util.Collections;
/**
* @author n.hoffmann
* @created Sep 21, 2009
- * @version 1.0
*/
public class TaxonBaseSelectionDialog<T extends TaxonBase> extends AbstractFilteredCdmResourceSelectionDialog {
-
- public static TaxonBase selectTaxonBase(Shell shell){//, ConversationHolder conversation) {
- AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog(TaxonBase.class, shell, //conversation,
+ public static TaxonBase selectTaxonBase(Shell shell){
+ AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog<>(TaxonBase.class, shell,
"Choose a taxon/synonym", false, null, null);
return getSelectionFromDialog(dialog);
}
- public static Taxon selectTaxon(Shell shell, //ConversationHolder conversation,
+ public static Taxon selectTaxon(Shell shell,
Taxon taxonToBeFiltered) {
- AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog(Taxon.class, shell, //conversation,
+ AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog<>(Taxon.class, shell,
"Choose a taxon", false, null, taxonToBeFiltered);
return (Taxon) getSelectionFromDialog(dialog);
}
- public static Synonym selectSynonym(Shell shell){//, ConversationHolder conversation) {
- AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog(Synonym.class, shell, //conversation,
+ public static Synonym selectSynonym(Shell shell){
+ AbstractFilteredCdmResourceSelectionDialog<TaxonBase> dialog = new TaxonBaseSelectionDialog<>(Synonym.class, shell,
"Choose a synonym", false, null, null);
return (Synonym) getSelectionFromDialog(dialog);
}
private final Class<? extends TaxonBase> clazz;
- protected TaxonBaseSelectionDialog(Class<? extends TaxonBase> clazz, Shell shell, //ConversationHolder conversation,
+ protected TaxonBaseSelectionDialog(Class<? extends TaxonBase> clazz, Shell shell,
String title, boolean multi, TaxonBase taxon, TaxonBase taxonToBeFiltered) {
- super(shell, //conversation,
- title, multi, TaxonBaseSelectionDialog.class.getCanonicalName(), taxon);
+ super(shell, title, multi, TaxonBaseSelectionDialog.class.getCanonicalName(), taxon);
if (taxonToBeFiltered != null){
this.cdmBaseToBeFiltered = new HashSet<>();
this.cdmBaseToBeFiltered.add(taxonToBeFiltered.getUuid());
search();
}
- /** {@inheritDoc} */
@Override
protected TaxonBase getPersistentObject(UUID uuid) {
return CdmStore.getService(ITaxonService.class).load(uuid);
}
- /** {@inheritDoc} */
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings({ "unchecked"})
@Override
protected void callService(String pattern) {
-
model = CdmStore.getService(ITaxonService.class).getUuidAndTitleCache(limitOfInitialElements, pattern);
}
- /** {@inheritDoc} */
@Override
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
return new NewTaxonWizard();
}
- /** {@inheritDoc} */
@Override
protected String[] getNewWizardText() {
return new String[]{"New Taxon"};
}
// otherwise result is already sorted
}
-}
+}
\ No newline at end of file
--- /dev/null
+/**
+* Copyright (C) 2023 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.dialog.selection;
+
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+
+/**
+ * @author katjaluther
+ * @since 27.10.2023
+ */
+public class TaxonNodeAndBoolean {
+ private TaxonNode node;
+ private Boolean bool;
+
+
+ public TaxonNodeAndBoolean(TaxonNode node, Boolean bool) {
+ this.node = node;
+ this.bool = bool;
+
+ }
+
+ public TaxonNode getNode() {
+ return node;
+ }
+
+ public void setNode(TaxonNode node) {
+ this.node = node;
+ }
+
+ /**
+ * @return the bool
+ */
+ public Boolean getBool() {
+ return bool;
+ }
+
+ /**
+ * @param bool the bool to set
+ */
+ public void setBool(Boolean bool) {
+ this.bool = bool;
+ }
+
+}
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
+import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
*/
public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<TaxonNode> implements SelectionListener{
- public static TaxonNode select(Shell shell, //ConversationHolder conversation,
+ public static TaxonNode select(Shell shell,
String title, Set<UUID> excludeTaxa, TaxonNode node, UUID classificationUUID, boolean allowSelectClassification) {
TaxonNodeSelectionDialog dialog = new TaxonNodeSelectionDialog(shell,
//conversation,
excludeTaxa,
false,
node,
- classificationUUID, allowSelectClassification);
+ classificationUUID, allowSelectClassification, false);
return getSelectionFromDialog(dialog);
}
- public static TaxonNode select(Shell shell, //ConversationHolder conversation,
+ public static TaxonNode select(Shell shell,
String title, Set<UUID> excludeTaxa, TaxonNode node, UUID classificationUUID) {
TaxonNodeSelectionDialog dialog = new TaxonNodeSelectionDialog(shell,
//conversation,
classificationUUID);
return getSelectionFromDialog(dialog);
}
+
+ public static TaxonNodeAndBoolean select(Shell shell,
+ String title, Set<UUID> excludeTaxa, TaxonNode node, UUID classificationUUID, boolean allowClassification, boolean showDefaultDescription) {
+ TaxonNodeSelectionDialog dialog = new TaxonNodeSelectionDialog(shell,
+ //conversation,
+ title,
+ excludeTaxa,
+ false,
+ node,
+ classificationUUID, allowClassification, showDefaultDescription);
+ TaxonNode nodeResult = getSelectionFromDialog(dialog);
+ TaxonNodeAndBoolean result = new TaxonNodeAndBoolean(nodeResult,dialog.useDefaultDescription);
+
+ return result;
+ }
- public static UuidAndTitleCache<TaxonNode> selectUuidAndTitleCache(Shell shell, //ConversationHolder conversation,
+ public static UuidAndTitleCache<TaxonNode> selectUuidAndTitleCache(Shell shell,
String title, Set<UUID> excludeTaxa, TaxonNode node, UUID classificationUUID) {
TaxonNodeSelectionDialog dialog = new TaxonNodeSelectionDialog(shell,
//conversation,
excludeTaxa,
false,
node,
- classificationUUID, false);
+ classificationUUID, false, false);
return getUuidAndTitleCacheSelectionFromDialog(dialog);
}
private UUID selectedUuid;
// private final Set<UUID> excludeTaxa;
private boolean allowClassificationSelection = false;
+
+ private boolean useDefaultDescription = false;
+
+ Button checkDefaultDescription;
+ private boolean showDefaultDescriptionCheck = false;
- protected TaxonNodeSelectionDialog(Shell shell, //ConversationHolder conversation,
- String title, Set<UUID> excludeTaxa, boolean multi, TaxonNode node, UUID classificationUUID, boolean allowSelectClassification) {
+ protected TaxonNodeSelectionDialog(Shell shell,
+ String title, Set<UUID> excludeTaxa, boolean multi, TaxonNode node, UUID classificationUUID, boolean allowSelectClassification, boolean showDefaultDescription) {
super(shell, //conversation,
title, multi, TaxonNodeSelectionDialog.class.getCanonicalName(), node);
fillClassifications();
this.allowClassificationSelection = allowSelectClassification;
+ this.showDefaultDescriptionCheck = showDefaultDescription;
//createClassificationSelectionCombo(shell);
}
- protected TaxonNodeSelectionDialog(Shell shell, //ConversationHolder conversation,
+ protected TaxonNodeSelectionDialog(Shell shell,
String title, Set<UUID> excludeTaxa, boolean multi, TaxonNode node, UUID classificationUUID) {
- this(shell, title, excludeTaxa, multi, node, classificationUUID, false);
+ this(shell, title, excludeTaxa, multi, node, classificationUUID, false, false);
}
/** {@inheritDoc} */
@Override
- protected Control createDialogArea(Composite parent) {
+ protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
+
return createClassificationSelectionCombo(container);
}
// classifications = CdmStore.getTaxonTreeService().list(null, null, null, null, null);
Composite classificationSelection = new Composite(parent, SWT.NULL);
- classificationSelection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ classificationSelection.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));
+
GridLayout layout = new GridLayout();
classificationSelection.setLayout(layout);
-
+ layout.numColumns = 2;
+
+ if (showDefaultDescriptionCheck) {
+
+ Label labelDefault = new Label(classificationSelection, SWT.NULL);
+ labelDefault.setText(Messages.TaxonNodeSelectionDialog_0);
+ GridData labelDefaultLayout = new GridData(SWT.LEFT, SWT.TOP, false, false,1,1);
+ labelDefault.setLayoutData(labelDefaultLayout);
+ checkDefaultDescription = new Button(classificationSelection, SWT.CHECK);
+ checkDefaultDescription.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ useDefaultDescription = checkDefaultDescription.getSelection();
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+
+ }
+
Label label = new Label(classificationSelection, SWT.NULL);
// TODO not working is not really true but leave it here to remind everyone that this is under construction
- label.setText("Select Classification");
+ label.setText(Messages.TaxonNodeSelectionDialog_1);
+ GridData labelLayout = new GridData(SWT.LEFT, SWT.TOP, true, false,2,1);
+ label.setLayoutData(labelLayout);
classificationSelectionCombo = new Combo(classificationSelection, SWT.BORDER | SWT.READ_ONLY);
classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
return taxonNode.getTaxon().getTitleCache();
}
- return "";
+ return ""; //$NON-NLS-1$
}
@Override
public class TaxonNodeSelectionNaturalOrderDialog extends\r
TaxonNodeSelectionDialog {\r
\r
- protected TaxonNodeSelectionNaturalOrderDialog(Shell shell,//ConversationHolder conversation,\r
+ protected TaxonNodeSelectionNaturalOrderDialog(Shell shell,\r
String title,\r
Set<UUID> excludeTaxa, boolean multi, TaxonNode node,\r
Classification classification) {\r
// TODO Auto-generated constructor stub
}
- public static Taxon selectTaxon(Shell shell, //ConversationHolder conversation,
+ public static Taxon selectTaxon(Shell shell,
Taxon taxonToBeFiltered) {
AbstractFilteredCdmResourceSelectionDialog<Taxon> dialog = new TaxonSelectionDialog(Taxon.class, shell, //conversation,
"Choose a taxon", false, null, taxonToBeFiltered);
* 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.dialog.selection;
import java.util.UUID;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>FilteredTeamSelectionDialog class.</p>
- *
* @author n.hoffmann
* @created Sep 24, 2009
- * @version 1.0
*/
public class TeamSelectionDialog extends
AbstractFilteredCdmResourceSelectionDialog<Team> {
- /**
- * <p>select</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param team a {@link eu.etaxonomy.cdm.model.agent.Team} object.
- * @return a {@link eu.etaxonomy.cdm.model.agent.Team} object.
- */
- public static Team select(Shell shell, //ConversationHolder conversation,
+ public static Team select(Shell shell,
Team team){
- TeamSelectionDialog dialog = new TeamSelectionDialog(shell, //conversation,
+ TeamSelectionDialog dialog = new TeamSelectionDialog(shell,
"Choose Team", false, TeamSelectionDialog.class.getCanonicalName(), team);
return getSelectionFromDialog(dialog);
}
- /**
- * <p>Constructor for FilteredTeamSelectionDialog.</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param title a {@link java.lang.String} object.
- * @param multi a boolean.
- * @param settings a {@link java.lang.String} object.
- * @param cdmObject a {@link eu.etaxonomy.cdm.model.agent.Team} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- protected TeamSelectionDialog(Shell shell, //ConversationHolder conversation,
+ protected TeamSelectionDialog(Shell shell,
String title, boolean multi, String settings,
Team cdmObject) {
- super(shell, //conversation,
- title, multi, settings, cdmObject);
+ super(shell, title, multi, settings, cdmObject);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.dialogs.filteredSelection.AbstractFilteredCdmResourceSelectionDialog#search
- */
- /** {@inheritDoc} */
@Override
protected void callService(String pattern) {
model = CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Team.class, limitOfInitialElements, pattern);
}
- /** {@inheritDoc} */
@Override
protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
return new NewTeamWizard();
}
- /** {@inheritDoc} */
@Override
protected String[] getNewWizardText() {
return new String[]{"New Team"};
}
- /** {@inheritDoc} */
@Override
protected Team getPersistentObject(UUID uuid) {
return CdmBase.deproxy(CdmStore.getService(IAgentService.class).load(uuid), Team.class);
}
-}
+}
\ No newline at end of file
* @param user
* @return
*/
- public static User select(Shell shell, //ConversationHolder conversation,
+ public static User select(Shell shell,
User user, Group group){
UserSelectionDialog dialog = new UserSelectionDialog(shell, //conversation,
"Choose User", false, UserSelectionDialog.class.getCanonicalName(), user, group);
* @param settings
* @param cdmObject
*/
- protected UserSelectionDialog(Shell shell, //ConversationHolder conversation,
+ protected UserSelectionDialog(Shell shell,
String title, boolean multi, String settings, User cdmObject, Group group) {
super(shell, //conversation,
title, multi, settings, cdmObject);
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
- * <p>
- * Abstract AbstractCdmEntityWizardPage class.
- * </p>
- *
* @author n.hoffmann
* @created Jun 1, 2010
*/
public abstract class AbstractCdmEntityWizardPage<T> extends WizardPage
- implements IConversationEnabled, IPropertyChangeListener {
+ implements IPropertyChangeListener {
protected CdmFormFactory formFactory;
protected T entity;
AbstractCdmDetailElement<T> detailElement;
- private final ConversationHolder conversation;
- /**
- * <p>
- * Constructor for AbstractCdmEntityWizardPage.
- * </p>
- *
- * @param formFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param conversation
- * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
- * object.
- * @param entity
- * a T object.
- * @param <T>
- * a T object.
- */
- protected AbstractCdmEntityWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, T entity) {
+ protected AbstractCdmEntityWizardPage(CdmFormFactory formFactory, T entity) {
super("page");
this.formFactory = formFactory;
this.entity = entity;
- this.conversation = conversation;
setDescription(getEntityTitle());
formFactory.addPropertyChangeListener(this);
setPageComplete(false);
}
- /**
- * @return
- */
+
private String getEntityTitle() {
if (entity instanceof IIdentifiableEntity) {
((IIdentifiableEntity) entity).getTitleCache();
return "";
}
- /** {@inheritDoc} */
@Override
public void createControl(Composite parent) {
ScrolledForm scrolledForm = formFactory.createScrolledForm(parent);
layout.bottomMargin = 25;
control.setLayout(layout);
WizardPageRootElement rootElement = new WizardPageRootElement(
- formFactory, control, getConversationHolder());
+ formFactory, control);
Color bgColor = getShell().getBackground();
setControl(scrolledForm);
}
- /**
- * <p>
- * Getter for the field <code>entity</code>.
- * </p>
- *
- * @return a T object.
- */
public T getEntity() {
return entity;
}
- /**
- * Creates the detail element for this wizard page
- *
- * @param rootElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
- * object.
- */
public abstract AbstractCdmDetailElement<T> createElement(
ICdmFormElement rootElement);
- protected class WizardPageRootElement extends RootElement implements
- IConversationEnabled {
-
- private final ConversationHolder conversation;
+ protected class WizardPageRootElement extends RootElement {
- public WizardPageRootElement(CdmFormFactory formFactory,
- Composite layoutComposite, ConversationHolder conversation) {
+ public WizardPageRootElement(CdmFormFactory formFactory, Composite layoutComposite) {
super(formFactory, layoutComposite);
- this.conversation = conversation;
}
@Override
detailElement = createElement(this);
((Composite) getControl()).layout();
}
-
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
- @Override
- public void update(CdmDataChangeMap changeEvents) {
- }
}
@Override
return true;
}
- /**
- * <p>
- * getConversationHolder
- * </p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
- * object.
- */
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
- /** {@inheritDoc} */
@Override
public void dispose() {
if (detailElement != null) {
super.dispose();
}
- /**
- * <p>
- * Getter for the field <code>detailElement</code>.
- * </p>
- *
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
- * object.
- */
public AbstractCdmDetailElement<T> getDetailElement() {
return detailElement;
}
-
- /** {@inheritDoc} */
- @Override
- public void update(CdmDataChangeMap changeEvents) {
- }
-}
+}
\ No newline at end of file
import org.eclipse.ui.forms.widgets.TableWrapLayout;
import org.eclipse.ui.forms.widgets.ToggleHyperlink;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
//TODO shouldn't ENTITY be bound with super class ICdmBase for example (AbstractFormSection<ENTITY extends ICdmBase>)?
public abstract class AbstractFormSection<ENTITY>
extends Section
- implements ISelectionChangedListener, IEntityElement<ENTITY>, IConversationEnabled {
+ implements ISelectionChangedListener, IEntityElement<ENTITY> {
/**
* The default number of columns in detail sections
// empty default implementation
}
- @Override
- public ConversationHolder getConversationHolder() {
- if(AbstractUtility.getActivePart() instanceof IConversationEnabled){
- return ((IConversationEnabled) AbstractUtility.getActivePart()).getConversationHolder();
- }
- if(getParentElement() instanceof RootElement || getParentElement() == null){
-
- Object activeEditor = AbstractUtility.getActiveEditor();
- if(activeEditor instanceof IConversationEnabled){
- ConversationHolder conversation = ((IConversationEnabled) AbstractUtility.getActiveEditor()).getConversationHolder();
- return conversation;
- }
- }else if(getParentElement() instanceof IConversationEnabled){
- return ((IConversationEnabled) getParentElement()).getConversationHolder();
- }
- MessagingUtils.error(getClass(), "Could not get conversation for AbstractFormSection. There is an error in the implementation. There should have been an active editor but it wasn't",
- new IllegalArgumentException());
- return null;
-
- }
-
- @Override
- public void update(CdmDataChangeMap changeEvents) {
-
- }
-
}
import java.util.ArrayList;
import java.util.Comparator;
+import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import org.joda.time.Partial;
import org.springframework.security.core.GrantedAuthority;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.common.DOI;
import eu.etaxonomy.cdm.common.URI;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.agent.ORCID;
import eu.etaxonomy.cdm.model.common.Credit;
import eu.etaxonomy.cdm.model.common.ExtendedTimePeriod;
import eu.etaxonomy.cdm.model.common.Extension;
-import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
import eu.etaxonomy.cdm.model.common.Identifier;
import eu.etaxonomy.cdm.model.common.LSID;
import eu.etaxonomy.cdm.model.description.MeasurementUnit;
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
import eu.etaxonomy.cdm.model.description.QuantitativeData;
-import eu.etaxonomy.cdm.model.description.State;
import eu.etaxonomy.cdm.model.description.StateData;
import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
import eu.etaxonomy.cdm.model.term.IEnumTerm;
import eu.etaxonomy.cdm.model.term.Representation;
import eu.etaxonomy.cdm.model.term.TermBase;
+import eu.etaxonomy.cdm.model.term.TermCollection;
import eu.etaxonomy.cdm.model.term.TermTree;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.cdm.persistence.dto.AbstractTermDto;
+import eu.etaxonomy.cdm.persistence.dto.AnnotationDto;
import eu.etaxonomy.cdm.persistence.dto.FeatureStateDto;
+import eu.etaxonomy.cdm.persistence.dto.ICdmBaseDto;
+import eu.etaxonomy.cdm.persistence.dto.MarkerDto;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
-import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.combo.InverseTermWrapper;
import eu.etaxonomy.taxeditor.ui.combo.MisappliedRelationshipComboElement;
import eu.etaxonomy.taxeditor.ui.combo.RelationshipTypeCombo;
-import eu.etaxonomy.taxeditor.ui.combo.VocabularyComboElement;
+import eu.etaxonomy.taxeditor.ui.combo.TermCollectionComboElement;
import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
+//import eu.etaxonomy.taxeditor.ui.combo.term.TermDtoComboElement;
import eu.etaxonomy.taxeditor.ui.dialog.CloneClassificationDetailElement;
import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection.UnitType;
import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
import eu.etaxonomy.taxeditor.ui.section.reference.OriginalSourceElement;
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement;
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.reference.SecundumSourceDetailElement;
import eu.etaxonomy.taxeditor.ui.section.reference.SecundumSourceElement;
-import eu.etaxonomy.taxeditor.ui.section.reference.SecundumSourceSection;
import eu.etaxonomy.taxeditor.ui.section.reference.SingleSourceSection;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationDtoElement;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationDtoSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationElement;
import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseDtoElement;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseDtoSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseElement;
import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseSection;
-
import eu.etaxonomy.taxeditor.ui.section.supplemental.CreditElement;
import eu.etaxonomy.taxeditor.ui.section.supplemental.CreditSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.ExtensionElement;
import eu.etaxonomy.taxeditor.ui.section.supplemental.ExtensionSection;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineDtoSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.IdentifiableSourceElement;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.MarkerDtoElement;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.MarkerDtoSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.MarkerElement;
import eu.etaxonomy.taxeditor.ui.section.supplemental.MarkerSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsElement;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.MeasurementUnitDtoCollectionSection;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailSection;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.PresenceAbsenceTermDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierDtoVocabulariesElement;
-import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierVocabulariesCollectionSection;
-import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierVocabulariesDtoCollectionSection;
-import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierVocabulariesElement;
-import eu.etaxonomy.taxeditor.ui.section.vocabulary.StateVocabularyCollectionElement;
-import eu.etaxonomy.taxeditor.ui.section.vocabulary.StateVocabularyCollectionSection;
-import eu.etaxonomy.taxeditor.ui.section.vocabulary.StateVocabularyDtoCollectionElement;
-import eu.etaxonomy.taxeditor.ui.section.vocabulary.StateVocabularyDtoCollectionSection;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierCollectionsCollectionSection;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierCollectionsDtoCollectionSection;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierCollectionsElement;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierDtoCollectionsElement;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedStateCollectionElement;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedStateCollectionSection;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedStateCollectionsDtoElement;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedStateDtoCollectionSection;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.StatisticalMeasureCollectionElement;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.StatisticalMeasureCollectionSection;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.StatisticalMeasureDtoCollectionElement;
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);
+ public EditPasswordElement createEditPasswordElement(ICdmFormElement parentElement, String labelString, User user, int style) {
+ EditPasswordElement element = new EditPasswordElement(this, parentElement, labelString, user);
adapt(element);
parentElement.addElement(element);
return element;
}
- /**
- * <p>
- * createIntegerTextWithLabelElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param labelString
- * a {@link java.lang.String} object.
- * @param initialInteger
- * a {@link java.lang.Integer} object.
- * @param style
- * a int.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement}
- * object.
- */
public FloatWithLabelElement createFloatTextWithLabelElement(
ICdmFormElement parentElement, String labelString,
Number initialNumber, int style) {
return element;
}
- /**
- * <p>
- * createKeyValueViewerElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param keyHeading
- * a {@link java.lang.String} object.
- * @param valueHeading
- * a {@link java.lang.String} object.
- * @param map
- * a {@link java.util.Map} object.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.KeyValueViewerElement}
- * object.
- */
public KeyValueViewerElement createKeyValueViewerElement(ICdmFormElement parentElement, String keyHeading,
String valueHeading, Map<Object, Object> map) {
KeyValueViewerElement element = new KeyValueViewerElement(this, parentElement, keyHeading, valueHeading, map);
return element;
}
- /**
- * @deprecated Use {@link #createDefinedTermComboElement(TermType, ICdmFormElement, String, DefinedTermBase, int)} instead
- */
- @Deprecated
- public <T extends DefinedTermBase> TermComboElement<T> createTermComboElement(Class<T> termComboType,
- ICdmFormElement parentElement, String labelString, T selection, int style) {
- TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termComboType, labelString, selection, true, style);
- adapt(element);
- parentElement.addElement(element);
- return element;
- }
-
public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
TermType termType,
ICdmFormElement parentElement,
return this.createDefinedTermComboElement(termType, null, null, parentElement, labelString, selection, true, style, false, null);
}
- public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
+ public <T extends DefinedTermBase<?>> TermComboElement<T> createDefinedTermComboElement(
List<T> terms,
ICdmFormElement parentElement,
String labelString,
int style) {
return this.createDefinedTermComboElement(null, null, terms, parentElement, labelString, selection, true, style, false, null);
}
+// public TermDtoComboElement createDefinedTermDtoComboElement(
+// List<TermDto> terms,
+// ICdmFormElement parentElement,
+// String labelString,
+// TermDto selection,
+// int style) {
+// return this.createDefinedTermDtoComboElement(null, null, terms, parentElement, labelString, selection, false, style, false, null);
+// }
- public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
+ public <T extends DefinedTermBase<?>> TermComboElement<T> createDefinedTermComboElement(
List<T> terms,
ICdmFormElement parentElement,
String labelString,
boolean useAbbrevLabel) {
return createDefinedTermComboElement(termType, null, null, parentElement, labelString, selection, addEmptyElement, style, useAbbrevLabel, null);
}
-
+
+// public TermDtoComboElement createDefinedTermDtoComboElement(
+// TermType termType,
+// ICdmFormElement parentElement,
+// String labelString,
+// TermDto selection,
+// boolean addEmptyElement,
+// int style,
+// boolean useAbbrevLabel) {
+// return createDefinedTermDtoComboElement(termType, null, null, parentElement, labelString, selection, addEmptyElement, style, useAbbrevLabel, null);
+// }
public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
TermVocabulary<?> termVocabulary,
Comparator<T> comparator) {
if(termType!=null){
- TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termType, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
+ TermComboElement<T> element = new TermComboElement<>(this, parentElement, termType, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
adapt(element);
parentElement.addElement(element);
return element;
}
- else if(termVocabulary!=null){
- TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termVocabulary, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
+ else if(termVocabulary != null){
+ TermComboElement<T> element = new TermComboElement<>(this, parentElement, termVocabulary, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
// if (comparator!= null){
// element.setTermComparator(comparator);
// }
return element;
}else if (terms != null){
- TermComboElement<T> element = new TermComboElement<T>(this, parentElement, terms, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
+ TermComboElement<T> element = new TermComboElement<>(this, parentElement, terms, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
adapt(element);
parentElement.addElement(element);
return null;
}
}
+// private TermDtoComboElement createDefinedTermDtoComboElement(
+// TermType termType,
+// TermVocabulary<?> termVocabulary,
+// List<TermDto> terms,
+// ICdmFormElement parentElement,
+// String labelString,
+// TermDto selection,
+// boolean addEmptyElement,
+// int style,
+// boolean useAbbrevLabel,
+// Comparator<TermDto> comparator) {
+//
+// if(termType!=null){
+// TermDtoComboElement element = new TermDtoComboElement<>(this, parentElement, termType, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
+// adapt(element);
+// parentElement.addElement(element);
+// return element;
+// }
+// else if(termVocabulary != null){
+// TermDtoComboElement element = new TermDtoComboElement<>(this, parentElement, termVocabulary, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
+//// if (comparator!= null){
+//// element.setTermComparator(comparator);
+//// }
+// adapt(element);
+// parentElement.addElement(element);
+// return element;
+// }else if (terms != null){
+//
+// TermDtoComboElement element = new TermDtoComboElement<>(this, parentElement, terms, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
+//
+// adapt(element);
+// parentElement.addElement(element);
+// return element;
+// }
+// else {
+// //this should never happen
+// return null;
+// }
+// }
private <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
TermType termType,
int style,
boolean useAbbrevLabel,
Comparator<T> comparator) {
- if(termType!=null){
- TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termType, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
+
+ if(termType!=null){
+ TermComboElement<T> element = new TermComboElement<>(this, parentElement, termType, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
adapt(element);
parentElement.addElement(element);
return element;
}
-
else {
//this should never happen
return null;
return element;
}
- public <TERM extends DefinedTermBase<TERM>, VOC extends TermVocabulary<TERM>> VocabularyComboElement<TERM, VOC> createVocabularyComboElement(
+ public <TERM extends DefinedTermBase<TERM>, VOC extends TermCollection<TERM,?>> TermCollectionComboElement<TERM, VOC> createTermCollectionComboElement(
TermType termType, String label, VOC selection, ICdmFormElement parentElement, int style) {
- VocabularyComboElement<TERM, VOC> element = new VocabularyComboElement<TERM, VOC>(this, parentElement, termType, label, selection, style);
+
+ TermCollectionComboElement<TERM, VOC> element = new TermCollectionComboElement<TERM, VOC>(this, parentElement, termType, label, selection, style);
adapt(element);
parentElement.addElement(element);
return element;
}
- public <TERM extends DefinedTermBase<TERM>, VOC extends TermVocabulary<TERM>> VocabularyComboElement<TERM, VOC> createVocabularyDtoComboElement(
- TermType termType, String label, TermVocabularyDto selection, ICdmFormElement parentElement, int style) {
- VocabularyComboElement<TERM, VOC> element = new VocabularyComboElement<TERM, VOC>(this, parentElement, termType, label, selection, style);
+ public <TERM extends DefinedTermBase<TERM>, VOC extends TermCollection<TERM,?>> TermCollectionComboElement<TERM, VOC> createTermCollectionDtoComboElement(
+ EnumSet<TermType> termTypes, String label, TermCollectionDto selection, ICdmFormElement parentElement, int style) {
+ TermCollectionComboElement<TERM, VOC> element = new TermCollectionComboElement<TERM, VOC>(this, parentElement, termTypes, label, selection, style);
adapt(element);
parentElement.addElement(element);
return element;
}
- /**
- * <p>
- * createBrowserElement
- * </p>
- *
- * @param imageUri
- * a {@link eu.etaxonomy.cdm.common.URI} object.
- * @param style
- * a int.
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.BrowserElement}
- * object.
- */
public BrowserElement createBrowserElement(ICdmFormElement parentElement, URI imageUri, int style) {
BrowserElement element = new BrowserElement(this, parentElement, imageUri, style);
adapt(element);
return element;
}
- /**
- * <p>
- * createImageElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param imageUri
- * a {@link eu.etaxonomy.cdm.common.URI} object.
- * @param style
- * a int.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.ImageElement} object.
- */
public ImageElement createImageElement(ICdmFormElement parentElement, URI imageUri, int style) {
ImageElement element = new ImageElement(this, parentElement, imageUri, style);
adapt(element);
return element;
}
- /**
- * <p>
- * createTextActionElement
- * </p>
- *
- * @param labelString
- * a {@link java.lang.String} object.
- * @param initialText
- * a {@link java.lang.String} object.
- * @param style
- * a int.
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param buttonLabel
- * a {@link java.lang.String} object.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextActionElement}
- * object.
- */
public TextActionElement createTextActionElement(ICdmFormElement parentElement, String labelString,
String buttonLabel, String initialText, int style) {
TextActionElement element = new TextActionElement(this, parentElement, labelString, buttonLabel, initialText,
return element;
}
- /**
- * <p>
- * createCheckbox
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param label
- * a {@link java.lang.String} object.
- * @param initialState
- * a boolean.
- * @param style
- * a int.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.CheckboxElement}
- * object.
- */
public CheckboxElement createCheckbox(ICdmFormElement parentElement, String label, Boolean initialState, int style) {
if(initialState==null){
initialState = Boolean.FALSE;
return section;
}
- /**
- * <p>
- * createDateDetailSection
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param style
- * a int.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.DateDetailSection}
- * object.
- */
public DateDetailSection<TimePeriod> createDateDetailSection(ICdmFormElement parentElement, int style) {
DateDetailSection<TimePeriod> section = new DateDetailSection<TimePeriod>(this, parentElement, false, style);
parentElement.addElement(section);
return section;
}
- /**
- * <p>
- * createVerbatimDateDetailSection
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param style
- * a int.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.VerbatimDateDetailSection}
- * object.
- */
public DateDetailSection<VerbatimTimePeriod> createVerbatimDateDetailSection(ICdmFormElement parentElement, int style) {
DateDetailSection<VerbatimTimePeriod> section
= new DateDetailSection<VerbatimTimePeriod>(this, parentElement, true, style);
return section;
}
- /**
- * <p>
- * createDateDetailSection
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param style
- * a int.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection}
- * object.
- */
public MinMaxTextSection createMinMaxTextSection(ICdmFormElement parentElement, UnitType unitType, int style) {
MinMaxTextSection section = new MinMaxTextSection(this, parentElement, unitType, style);
parentElement.addElement(section);
return section;
}
- /**
- * <p>
- * createPartialElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param labelString
- * a {@link java.lang.String} object.
- * @param partial
- * a {@link org.joda.time.Partial} object.
- * @param style
- * a int.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.PartialElement}
- * object.
- */
public PartialElement createPartialElement(ICdmFormElement parentElement, String labelString, Partial partial,
int style) {
PartialElement element = new PartialElement(this, parentElement, labelString, style);
return element;
}
- /**
- * <p>
- * addSelectionListener
- * </p>
- *
- * @param listener
- * a {@link org.eclipse.swt.events.SelectionListener} object.
- */
public void addSelectionListener(SelectionListener listener) {
selectionListenerList.add(listener);
}
- /**
- * <p>
- * removeSelectionListener
- * </p>
- *
- * @param listener
- * a {@link org.eclipse.swt.events.SelectionListener} object.
- */
public void removeSelectionListener(SelectionListener listener) {
if (listener == null) {
MessagingUtils.error(this.getClass(),
}
}
- /**
- * <p>
- * addPropertyChangeListener
- * </p>
- *
- * @param listener
- * a {@link org.eclipse.jface.util.IPropertyChangeListener}
- * object.
- */
public void addPropertyChangeListener(IPropertyChangeListener listener) {
if (propertyChangeListeners.contains(listener)) {
return;
propertyChangeListeners.add(0, listener);
}
- /**
- * <p>
- * removePropertyChangeListener
- * </p>
- *
- * @param listener
- * a {@link org.eclipse.jface.util.IPropertyChangeListener}
- * object.
- */
public void removePropertyChangeListener(IPropertyChangeListener listener) {
propertyChangeListeners.remove(listener);
}
- /**
- * @return the propertyChangeListeners
- */
public List<IPropertyChangeListener> getPropertyChangeListeners() {
return propertyChangeListeners;
}
- /**
- * <p>
- * createHorizontalSeparator
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param style
- * a int.
- * @return a {@link org.eclipse.swt.widgets.Label} object.
- */
public Label createHorizontalSeparator(ICdmFormElement parentElement, int style) {
Label separator = this.createSeparator(parentElement.getLayoutComposite(), SWT.HORIZONTAL | style);
separator.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
return separator;
}
- /**
- * <p>
- * createVersionElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param entity
- * a {@link eu.etaxonomy.cdm.model.common.VersionableEntity}
- * object.
- * @param style
- * a int.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionElement}
- * object.
- */
public VersionElement createVersionElement(ICdmFormElement parentElement, VersionableEntity entity, int style) {
VersionElement element = new VersionElement(this, parentElement, entity, style);
adapt(element);
return element;
}
- /**
- * @param cdmBaseSection
- * @param object
- * @param style
- * @return
- */
public CdmBaseElement createCdmBaseElement(ICdmFormElement parentElement, CdmBase entity, int style) {
CdmBaseElement element = new CdmBaseElement(this, parentElement, entity, style);
adapt(element);
return element;
}
- /**
- * <p>
- * createVersionSection
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param style
- * a int.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.VersionSection}
- * object.
- */
+ public CdmBaseDtoElement createCdmBaseDtoElement(ICdmFormElement parentElement, ICdmBaseDto entity, int style) {
+ CdmBaseDtoElement element = new CdmBaseDtoElement(this, parentElement, entity, style);
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
+
public VersionSection createVersionSection(ICdmFormElement parentElement, int style) {
VersionSection section = new VersionSection(this, parentElement, style);
parentElement.addElement(section);
adapt(section);
return section;
}
-
-
- /**
- * @param parent
- * @param i
- * @return
- */
+
public CdmBaseSection createCdmBaseSection(ICdmFormElement parentElement, int style) {
CdmBaseSection section = new CdmBaseSection(this, parentElement, style);
parentElement.addElement(section);
adapt(section);
return section;
}
+ public CdmBaseDtoSection createCdmBaseDtoSection(ICdmFormElement parentElement, int style) {
+ CdmBaseDtoSection section = new CdmBaseDtoSection(this, parentElement, style);
+ parentElement.addElement(section);
+ adapt(section);
+ return section;
+ }
- /**
- * <p>
- * createEmptyElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @return a {@link eu.etaxonomy.taxeditor.ui.section.EmptyElement} object.
- */
public EmptyElement createEmptyElement(ICdmFormElement parentElement, String emptyText) {
EmptyElement element = new EmptyElement(this, parentElement, emptyText, SWT.NULL);
adapt(element);
return element;
}
- /**
- * <p>
- * createHeadlineSection
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection}
- * object.
- */
public HeadlineSection createHeadlineSection(ICdmFormElement parentElement) {
HeadlineSection section = new HeadlineSection(this, parentElement, SWT.NULL);
parentElement.addElement(section);
return section;
}
- /**
- * <p>
- * createParsingMessageElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param parserProblem
- * a {@link eu.etaxonomy.cdm.strategy.parser.ParserProblem}
- * object.
- * @param style
- * a int.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessageElement}
- * object.
- */
+ public HeadlineDtoSection createHeadlineDtoSection(ICdmFormElement parentElement) {
+ HeadlineDtoSection section = new HeadlineDtoSection(this, parentElement, SWT.NULL);
+ parentElement.addElement(section);
+ adapt(section);
+ return section;
+ }
+
public ParsingMessageElement createParsingMessageElement(ICdmFormElement parentElement,
ParserProblem parserProblem, int style) {
ParsingMessageElement element = new ParsingMessageElement(this, parentElement, parserProblem, style);
return element;
}
- public DefinedTermDetailSection createDefinedTermDetailSection(Class definedTermClass, ConversationHolder conversation,
+ public <T extends DefinedTermBase> DefinedTermDetailSection<T> createDefinedTermDetailSection(Class clazz,
ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
-
- DefinedTermDetailSection section = new DefinedTermDetailSection(this, definedTermClass, conversation, parentElement,
+ @SuppressWarnings("unchecked")
+ Class<T> definedTermClass = clazz;
+ DefinedTermDetailSection<T> section = new DefinedTermDetailSection<>(this, definedTermClass, parentElement,
selectionProvider, style);
parentElement.addElement(section);
adapt(section);
return section;
-
}
- public TermMediaSection createTermMediaSection(ConversationHolder conversation,
+ public TermMediaSection createTermMediaSection(
ICdmFormElement parentElement, int style) {
- TermMediaSection section = new TermMediaSection(this, conversation, parentElement, style);
+ TermMediaSection section = new TermMediaSection(this, parentElement, style);
parentElement.addElement(section);
adapt(section);
return section;
-
}
- public DerivedUnitMediaSection createDerivedUnitMediaSection(ConversationHolder conversation,
+ public DerivedUnitMediaSection createDerivedUnitMediaSection(
ICdmFormElement parentElement, int style) {
- DerivedUnitMediaSection section = new DerivedUnitMediaSection(this, conversation, parentElement, style);
+ DerivedUnitMediaSection section = new DerivedUnitMediaSection(this, parentElement, style);
parentElement.addElement(section);
adapt(section);
return section;
-
}
- /**
- * @param definedTermClass
- * @param formElement
- * @param style
- * @return
- */
public AbstractCdmDetailElement createDefinedTermDetailElement(Class definedTermClass,
ICdmFormElement parentElement, int style) {
- AbstractCdmDetailElement element = null;
+ AbstractCdmDetailElement<?> element = null;
if (NamedArea.class.isAssignableFrom(definedTermClass)) {
element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
} else if(definedTermClass.equals(Language.class)){
element = new LanguageDetailElement(this, parentElement);
} else {
- element = new DefinedTermDetailElement(this, parentElement);
+ element = new DefinedTermDetailElement<>(this, parentElement);
}
-
adapt(element);
parentElement.addElement(element);
return element;
}
- public CharacterNodeDetailSection createCharacterNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- CharacterNodeDetailSection section = new CharacterNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public CharacterNodeDetailSection createCharacterNodeDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ CharacterNodeDetailSection section = new CharacterNodeDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public CharacterNodeDtoDetailSection createCharacterNodeDtoDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- CharacterNodeDtoDetailSection section = new CharacterNodeDtoDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public CharacterNodeDtoDetailSection createCharacterNodeDtoDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ CharacterNodeDtoDetailSection section = new CharacterNodeDtoDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public CharacterDetailSection createCharacterDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- CharacterDetailSection section = new CharacterDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public CharacterDetailSection createCharacterDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ CharacterDetailSection section = new CharacterDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public CharacterDtoDetailSection createCharacterDtoDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- CharacterDtoDetailSection section = new CharacterDtoDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public CharacterDtoDetailSection createCharacterDtoDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ CharacterDtoDetailSection section = new CharacterDtoDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
return element;
}
- /**
- * @param parentElement
- * @param style
- * @return
- */
public AbstractCdmDetailElement<TermTree> createFeatureTreeDetailElementForTree(
AbstractCdmDetailSection<TermTree> parentElement, int style) {
TermTreeDetailElementForNode element = new TermTreeDetailElementForNode(this, parentElement);
//--------DetailSections---------
- public NameDetailSection createNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- NameDetailSection section = new NameDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public NameDetailSection createNameDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ NameDetailSection section = new NameDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public TermNodeDetailSection createFeatureNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- TermNodeDetailSection section = new TermNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public TermNodeDetailSection createFeatureNodeDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ TermNodeDetailSection section = new TermNodeDetailSection(this, parentElement, selectionProvider, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+ public TermNodeDetailSection createTermNodeDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ TermNodeDetailSection section = new TermNodeDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public TermTreeDetailSection createFeatureTreeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- TermTreeDetailSection section = new TermTreeDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public TermTreeDetailSection createFeatureTreeDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ TermTreeDetailSection section = new TermTreeDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public TermTreeDetailSectionForNode createFeatureTreeDetailSectionForTree(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- TermTreeDetailSectionForNode section = new TermTreeDetailSectionForNode(this, conversation, parentElement, selectionProvider, style);
+ public TermTreeDetailSectionForNode createFeatureTreeDetailSectionForTree(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ TermTreeDetailSectionForNode section = new TermTreeDetailSectionForNode(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public ReferenceDetailSection createReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- ReferenceDetailSection section = new ReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public ReferenceDetailSection createReferenceDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ ReferenceDetailSection section = new ReferenceDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public NomenclaturalSourceDetailSection createNomenclaturalReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- NomenclaturalSourceDetailSection section = new NomenclaturalSourceDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public NomenclaturalSourceDetailSection createNomenclaturalReferenceDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ NomenclaturalSourceDetailSection section = new NomenclaturalSourceDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public OriginalSourceAdvancedSection createOriginalSourceAdvancedSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- OriginalSourceAdvancedSection section = new OriginalSourceAdvancedSection(this, conversation, parentElement, selectionProvider, style);
+ public OriginalSourceAdvancedSection createOriginalSourceAdvancedSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ OriginalSourceAdvancedSection section = new OriginalSourceAdvancedSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
return element;
}
- public SingleSourceSection createSingleSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, CdmBase cdmEntity, ISelectionProvider selectionProvider, String label, int style){
- SingleSourceSection section = new SingleSourceSection(this, conversation, parentElement, cdmEntity, selectionProvider, style, label);
+ public SingleSourceSection createSingleSourceSection(ICdmFormElement parentElement, CdmBase cdmEntity, ISelectionProvider selectionProvider, String label, int style){
+ SingleSourceSection section = new SingleSourceSection(this, parentElement, cdmEntity, selectionProvider, style, label);
addAndAdaptSection(parentElement, section);
return section;
}
- public TaxonBaseDetailSection createTaxonBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- TaxonBaseDetailSection section = new TaxonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public TaxonBaseDetailSection createTaxonBaseDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ TaxonBaseDetailSection section = new TaxonBaseDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
-// public SecundumSourceSection createSecundumDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
-// SecundumSourceSection section = new SecundumSourceSection(this, conversation, parentElement, selectionProvider, style);
-// addAndAdaptSection(parentElement, section);
-// return section;
-// }
-
- public AuthorshipDetailSection createAuthorshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- AuthorshipDetailSection section = new AuthorshipDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public AuthorshipDetailSection createAuthorshipDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ AuthorshipDetailSection section = new AuthorshipDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public TeamOrPersonBaseDetailSection createTeamOrPersonBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- TeamOrPersonBaseDetailSection section = new TeamOrPersonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public TeamOrPersonBaseDetailSection createTeamOrPersonBaseDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ TeamOrPersonBaseDetailSection section = new TeamOrPersonBaseDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public TeamDetailSection createTeamDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- TeamDetailSection section = new TeamDetailSection(this, conversation, parentElement, null, style);
+ public TeamDetailSection createTeamDetailSection(ICdmFormElement parentElement, int style){
+ TeamDetailSection section = new TeamDetailSection(this, parentElement, null, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public PersonDetailSection createPersonDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- PersonDetailSection section = new PersonDetailSection(this, conversation, parentElement, null, style);
+ public PersonDetailSection createPersonDetailSection(ICdmFormElement parentElement, int style){
+ PersonDetailSection section = new PersonDetailSection(this, parentElement, null, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public DescriptionDetailSection createDescriptionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- DescriptionDetailSection section = new DescriptionDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public DescriptionDetailSection createDescriptionDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ DescriptionDetailSection section = new DescriptionDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public DescriptionElementDetailSection createDescriptionElementDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- DescriptionElementDetailSection section = new DescriptionElementDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public DescriptionElementDetailSection createDescriptionElementDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ DescriptionElementDetailSection section = new DescriptionElementDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public ParsingMessagesSection createParsingMessagesSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- ParsingMessagesSection section = new ParsingMessagesSection(this, conversation, parentElement, selectionProvider, style);
+ public ParsingMessagesSection createParsingMessagesSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ ParsingMessagesSection section = new ParsingMessagesSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public NonViralNameDetailSection createNonViralNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, boolean nameChoosable, int style){
- NonViralNameDetailSection section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, nameChoosable, style);
+ public NonViralNameDetailSection createNonViralNameDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, boolean nameChoosable, int style){
+ NonViralNameDetailSection section = new NonViralNameDetailSection(this, parentElement, selectionProvider, nameChoosable, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public MediaDetailsSection createMediaDetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- MediaDetailsSection section = new MediaDetailsSection(this, conversation, parentElement, selectionProvider, style);
+ public MediaDetailsSection createMediaDetailsSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ MediaDetailsSection section = new MediaDetailsSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public FieldUnitFacadeDetailSection createFieldUnitFacadeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- FieldUnitFacadeDetailSection section = new FieldUnitFacadeDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public FieldUnitFacadeDetailSection createFieldUnitFacadeDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ FieldUnitFacadeDetailSection section = new FieldUnitFacadeDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public GatheringEventDetailSection createGatheringEventDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public GatheringEventDetailSection createGatheringEventDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ GatheringEventDetailSection section = new GatheringEventDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public DerivedUnitBaseDetailSection createDerivedUnitBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- DerivedUnitBaseDetailSection section = new DerivedUnitBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public DerivedUnitBaseDetailSection createDerivedUnitBaseDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ DerivedUnitBaseDetailSection section = new DerivedUnitBaseDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public DerivedUnitTypeDesignationSection createDerivedUnitTypeDesignationSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- DerivedUnitTypeDesignationSection section = new DerivedUnitTypeDesignationSection(this, conversation, parentElement, style);
+ public DerivedUnitTypeDesignationSection createDerivedUnitTypeDesignationSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ DerivedUnitTypeDesignationSection section = new DerivedUnitTypeDesignationSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public TaxonAssociationDetailSection createTaxonAssociationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- TaxonAssociationDetailSection section = new TaxonAssociationDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public TaxonAssociationDetailSection createTaxonAssociationDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ TaxonAssociationDetailSection section = new TaxonAssociationDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public OriginalLabelDataSection createOriginalLabelDataSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- OriginalLabelDataSection section = new OriginalLabelDataSection(this, conversation, parentElement, selectionProvider, style);
+ public OriginalLabelDataSection createOriginalLabelDataSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ OriginalLabelDataSection section = new OriginalLabelDataSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public NaturalLanguageSection createNaturalLanguageSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- NaturalLanguageSection section = new NaturalLanguageSection(this, conversation, parentElement, selectionProvider, style);
+ public NaturalLanguageSection createNaturalLanguageSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ NaturalLanguageSection section = new NaturalLanguageSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public FeatureDistributionDetailSection createFeatureDistributionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- FeatureDistributionDetailSection section = new FeatureDistributionDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public FeatureDistributionDetailSection createFeatureDistributionDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ FeatureDistributionDetailSection section = new FeatureDistributionDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public ClassificationDetailSection createClassificationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- ClassificationDetailSection section = new ClassificationDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public ClassificationDetailSection createClassificationDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ ClassificationDetailSection section = new ClassificationDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public TaxonNodeDetailSection createTaxonNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- TaxonNodeDetailSection section = new TaxonNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public TaxonNodeDetailSection createTaxonNodeDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ TaxonNodeDetailSection section = new TaxonNodeDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public PolytomousKeyDetailSection createPolytomousKeyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- PolytomousKeyDetailSection section = new PolytomousKeyDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public PolytomousKeyDetailSection createPolytomousKeyDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ PolytomousKeyDetailSection section = new PolytomousKeyDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public PolytomousKeyNodeDetailSection createPolytomousKeyNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- PolytomousKeyNodeDetailSection section = new PolytomousKeyNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public PolytomousKeyNodeDetailSection createPolytomousKeyNodeDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ PolytomousKeyNodeDetailSection section = new PolytomousKeyNodeDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public InstitutionDetailSection createInstitutionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- InstitutionDetailSection section = new InstitutionDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public InstitutionDetailSection createInstitutionDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ InstitutionDetailSection section = new InstitutionDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public FieldUnitFacadeGeneralDetailSection createFieldUnitFacadeGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- FieldUnitFacadeGeneralDetailSection section = new FieldUnitFacadeGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public FieldUnitFacadeGeneralDetailSection createFieldUnitFacadeGeneralDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ FieldUnitFacadeGeneralDetailSection section = new FieldUnitFacadeGeneralDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public DerivedUnitGeneralDetailSection createDerivedUnitGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- DerivedUnitGeneralDetailSection section = new DerivedUnitGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public DerivedUnitGeneralDetailSection createDerivedUnitGeneralDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ DerivedUnitGeneralDetailSection section = new DerivedUnitGeneralDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public PreservedSpecimenGeneralDetailSection createPreservedSpecimenGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- PreservedSpecimenGeneralDetailSection section = new PreservedSpecimenGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public PreservedSpecimenGeneralDetailSection createPreservedSpecimenGeneralDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ PreservedSpecimenGeneralDetailSection section = new PreservedSpecimenGeneralDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public TissueSampleGeneralDetailSection createTissueSampleGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- TissueSampleGeneralDetailSection section = new TissueSampleGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public TissueSampleGeneralDetailSection createTissueSampleGeneralDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ TissueSampleGeneralDetailSection section = new TissueSampleGeneralDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public DnaSampleGeneralDetailSection createDnaSampleGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- DnaSampleGeneralDetailSection section = new DnaSampleGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public DnaSampleGeneralDetailSection createDnaSampleGeneralDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ DnaSampleGeneralDetailSection section = new DnaSampleGeneralDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public DnaSamplePreparationPreservationSection createDnaSamplePreparationPreservationSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- DnaSamplePreparationPreservationSection section = new DnaSamplePreparationPreservationSection(this, conversation, parentElement, selectionProvider, style);
+ public DnaSamplePreparationPreservationSection createDnaSamplePreparationPreservationSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ DnaSamplePreparationPreservationSection section = new DnaSamplePreparationPreservationSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public DnaQualityDetailSection createDnaQualityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- DnaQualityDetailSection section = new DnaQualityDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public DnaQualityDetailSection createDnaQualityDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ DnaQualityDetailSection section = new DnaQualityDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public SequenceGeneralDetailSection createSequenceGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- SequenceGeneralDetailSection section = new SequenceGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public SequenceGeneralDetailSection createSequenceGeneralDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ SequenceGeneralDetailSection section = new SequenceGeneralDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public SequenceContigFileCollectionDetailSection createSequenceContigFileCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- SequenceContigFileCollectionDetailSection section = new SequenceContigFileCollectionDetailSection(this, conversation, parentElement, style);
+ public SequenceContigFileCollectionDetailSection createSequenceContigFileCollectionDetailSection(ICdmFormElement parentElement, int style){
+ SequenceContigFileCollectionDetailSection section = new SequenceContigFileCollectionDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public SingleReadPherogramCollectionDetailSection createSingleReadPherogramCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- SingleReadPherogramCollectionDetailSection section = new SingleReadPherogramCollectionDetailSection(this, conversation, parentElement, style);
+ public SingleReadPherogramCollectionDetailSection createSingleReadPherogramCollectionDetailSection(ICdmFormElement parentElement, int style){
+ SingleReadPherogramCollectionDetailSection section = new SingleReadPherogramCollectionDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public SequenceReferenceCollectionDetailSection createSequenceReferenceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- SequenceReferenceCollectionDetailSection section = new SequenceReferenceCollectionDetailSection(this, conversation, parentElement, style);
+ public SequenceReferenceCollectionDetailSection createSequenceReferenceCollectionDetailSection(ICdmFormElement parentElement, int style){
+ SequenceReferenceCollectionDetailSection section = new SequenceReferenceCollectionDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public SingleReadGeneralDetailSection createSingleReadGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- SingleReadGeneralDetailSection section = new SingleReadGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public SingleReadGeneralDetailSection createSingleReadGeneralDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ SingleReadGeneralDetailSection section = new SingleReadGeneralDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public AmplificationGeneralDetailSection createAmplificationGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- AmplificationGeneralDetailSection section = new AmplificationGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public AmplificationGeneralDetailSection createAmplificationGeneralDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ AmplificationGeneralDetailSection section = new AmplificationGeneralDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public AmplificationPrimerDetailSection createAmplificationPrimerDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- AmplificationPrimerDetailSection section = new AmplificationPrimerDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public AmplificationPrimerDetailSection createAmplificationPrimerDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ AmplificationPrimerDetailSection section = new AmplificationPrimerDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public AmplificationCloningDetailSection createAmplificationCloningDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- AmplificationCloningDetailSection section = new AmplificationCloningDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public AmplificationCloningDetailSection createAmplificationCloningDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ AmplificationCloningDetailSection section = new AmplificationCloningDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public AmplificationGelPhotoCollectionDetailSection createAmplificationGelPhotoCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- AmplificationGelPhotoCollectionDetailSection section = new AmplificationGelPhotoCollectionDetailSection(this, conversation, parentElement, style);
+ public AmplificationGelPhotoCollectionDetailSection createAmplificationGelPhotoCollectionDetailSection(ICdmFormElement parentElement, int style){
+ AmplificationGelPhotoCollectionDetailSection section = new AmplificationGelPhotoCollectionDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public MediaSpecimenGeneralDetailSection createMediaSpecimenGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- MediaSpecimenGeneralDetailSection section = new MediaSpecimenGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public MediaSpecimenGeneralDetailSection createMediaSpecimenGeneralDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ MediaSpecimenGeneralDetailSection section = new MediaSpecimenGeneralDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public HybridDetailSection createHybridDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- HybridDetailSection section = new HybridDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public HybridDetailSection createHybridDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ HybridDetailSection section = new HybridDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public UserDetailSection createUserDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- UserDetailSection section = new UserDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public UserDetailSection createUserDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ UserDetailSection section = new UserDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public GroupDetailSection createGroupDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- GroupDetailSection section = new GroupDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public GroupDetailSection createGroupDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ GroupDetailSection section = new GroupDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public DeterminationDetailSection createDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- DeterminationDetailSection section = new DeterminationDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public DeterminationDetailSection createDeterminationDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ DeterminationDetailSection section = new DeterminationDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public SampleDesignationDetailSection createSampleDesignationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- SampleDesignationDetailSection section = new SampleDesignationDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public SampleDesignationDetailSection createSampleDesignationDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ SampleDesignationDetailSection section = new SampleDesignationDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public TaxonRelationshipDetailSection createTaxonRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- TaxonRelationshipDetailSection section = new TaxonRelationshipDetailSection(this, conversation, parentElement, selectionProvider, style, true);
+ public TaxonRelationshipDetailSection createTaxonRelationshipDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ TaxonRelationshipDetailSection section = new TaxonRelationshipDetailSection(this, parentElement, selectionProvider, style, true);
addAndAdaptSection(parentElement, section);
return section;
}
- public ReferencedEntityDetailSection createReferencedEntityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- ReferencedEntityDetailSection section = new ReferencedEntityDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public ReferencedEntityDetailSection createReferencedEntityDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ ReferencedEntityDetailSection section = new ReferencedEntityDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public TermVocabularyDetailSection createTermVocabularyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- TermVocabularyDetailSection section = new TermVocabularyDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public TermVocabularyDetailSection createTermVocabularyDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ TermVocabularyDetailSection section = new TermVocabularyDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public GatheringEventDetailSection createGatheringSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public GatheringEventDetailSection createGatheringSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ GatheringEventDetailSection section = new GatheringEventDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public NamedAreaDetailSection createNamedAreaDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- NamedAreaDetailSection section = new NamedAreaDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public NamedAreaDetailSection createNamedAreaDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ NamedAreaDetailSection section = new NamedAreaDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public UseRecordDetailSection createUseRecordDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- UseRecordDetailSection section = new UseRecordDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public UseRecordDetailSection createUseRecordDetailSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ UseRecordDetailSection section = new UseRecordDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
return element;
}
-// public SecundumSourceDetailElement createSecundumSourceDetailElement(ICdmFormElement parentElement){
-// SecundumSourceDetailElement element = new SecundumSourceDetailElement(this, parentElement);
-// addAndAdaptElement(parentElement, element);
-// return element;
-// }
-
public SecundumSourceElement createSecundumSourceElement(ICdmFormElement parentElement, CdmBase cdmEntity, String label){
SecundumSourceElement element = new SecundumSourceElement(this, parentElement, cdmEntity, label);
addAndAdaptElement(parentElement, element);
return element;
}
- public TaxonNodeAgentRelationCollectionSection createTaxonNodeAgentRelationCollectionElement(ICdmFormElement parentElement, ConversationHolder conversation, int style){
- TaxonNodeAgentRelationCollectionSection element = new TaxonNodeAgentRelationCollectionSection(this, conversation, parentElement, style);
+ public TaxonNodeAgentRelationCollectionSection createTaxonNodeAgentRelationCollectionElement(ICdmFormElement parentElement, int style){
+ TaxonNodeAgentRelationCollectionSection element = new TaxonNodeAgentRelationCollectionSection(this, parentElement, style);
adapt(element);
parentElement.addElement(element);
return element;
}
- /**
- * @param parentElement
- * @param element
- */
private void addAndAdaptElement(ICdmFormElement parentElement, AbstractCdmDetailElement<?> element) {
adapt(element);
parentElement.addElement(element);
}
//--------EntityCollectionSection----------
- public TeamMemberSection createTeamMemberSection(ConversationHolder conversation, ICdmFormElement parentElement, int style, boolean isNomenclatural, boolean isCollector){
- TeamMemberSection section = new TeamMemberSection(this, conversation, parentElement, style, isNomenclatural, isCollector);
+ public TeamMemberSection createTeamMemberSection(ICdmFormElement parentElement, int style, boolean isNomenclatural, boolean isCollector){
+ TeamMemberSection section = new TeamMemberSection(this, parentElement, style, isNomenclatural, isCollector);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+
+ public InapplicableIfEntityCollectionSection createInapplicableIfEntityCollectionSection(ICdmFormElement parentElement, int style){
+ InapplicableIfEntityCollectionSection section = new InapplicableIfEntityCollectionSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public InapplicableIfEntityCollectionSection createInapplicableIfEntityCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- InapplicableIfEntityCollectionSection section = new InapplicableIfEntityCollectionSection(this, conversation, parentElement, style);
+ public OnlyApplicableIfEntityCollectionSection createOnlyApplicableIfEntityCollectionSection(ICdmFormElement parentElement, int style){
+ OnlyApplicableIfEntityCollectionSection section = new OnlyApplicableIfEntityCollectionSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public OnlyApplicableIfEntityCollectionSection createOnlyApplicableIfEntityCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- OnlyApplicableIfEntityCollectionSection section = new OnlyApplicableIfEntityCollectionSection(this, conversation, parentElement, style);
+ public InapplicableIfEntityCollectionSectionForNode createInapplicableIfEntityCollectionSectionForNode(ICdmFormElement parentElement, int style){
+ InapplicableIfEntityCollectionSectionForNode section = new InapplicableIfEntityCollectionSectionForNode(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public InapplicableIfEntityCollectionSectionForNode createInapplicableIfEntityCollectionSectionForNode(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- InapplicableIfEntityCollectionSectionForNode section = new InapplicableIfEntityCollectionSectionForNode(this, conversation, parentElement, style);
+ public OnlyApplicableIfEntityCollectionSectionForNode createOnlyApplicableIfEntityCollectionSectionForNode(ICdmFormElement parentElement, int style){
+ OnlyApplicableIfEntityCollectionSectionForNode section = new OnlyApplicableIfEntityCollectionSectionForNode(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public OnlyApplicableIfEntityCollectionSectionForNode createOnlyApplicableIfEntityCollectionSectionForNode(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- OnlyApplicableIfEntityCollectionSectionForNode section = new OnlyApplicableIfEntityCollectionSectionForNode(this, conversation, parentElement, style);
+ public AnnotationSection createAnnotationSection(ICdmFormElement parentElement, int style){
+ AnnotationSection section = new AnnotationSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public AnnotationSection createAnnotationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- AnnotationSection section = new AnnotationSection(this, conversation, parentElement, style);
+ public AnnotationDtoSection createAnnotationDtoSection(ICdmFormElement parentElement, int style){
+ AnnotationDtoSection section = new AnnotationDtoSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public CreditSection createCreditSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- CreditSection section = new CreditSection(this, conversation, parentElement, style);
+ public CreditSection createCreditSection(ICdmFormElement parentElement, int style){
+ CreditSection section = new CreditSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public DescriptionElementSourceSection createDescriptionElementSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- DescriptionElementSourceSection section = new DescriptionElementSourceSection(this, conversation, parentElement, style);
+ public DescriptionElementSourceSection createDescriptionElementSourceSection(ICdmFormElement parentElement, int style){
+ DescriptionElementSourceSection section = new DescriptionElementSourceSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public DescriptionElementSourceSection createDescriptionElementSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, Reference defaultSource, int style){
- DescriptionElementSourceSection section = new DescriptionElementSourceSection(this, conversation, parentElement, defaultSource, style);
+ public DescriptionElementSourceSection createDescriptionElementSourceSection(ICdmFormElement parentElement, Reference defaultSource, int style){
+ DescriptionElementSourceSection section = new DescriptionElementSourceSection(this, parentElement, defaultSource, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public ExtensionSection createExtensionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- ExtensionSection section = new ExtensionSection(this, conversation, parentElement, style);
+ public ExtensionSection createExtensionSection(ICdmFormElement parentElement, int style){
+ ExtensionSection section = new ExtensionSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public MarkerSection createMarkerSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- MarkerSection section = new MarkerSection(this, conversation, parentElement, style);
+ public MarkerSection createMarkerSection(ICdmFormElement parentElement, int style){
+ MarkerSection section = new MarkerSection(this, parentElement, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+ public MarkerDtoSection createMarkerDtoSection(ICdmFormElement parentElement, int style){
+ MarkerDtoSection section = new MarkerDtoSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public MediaSection createMediaSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- MediaSection section = new MediaSection(this, conversation, parentElement, style);
+ public MediaSection createMediaSection(ICdmFormElement parentElement, int style){
+ MediaSection section = new MediaSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public DescriptionElementMediaSection createDescriptionElementMediaSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- DescriptionElementMediaSection section = new DescriptionElementMediaSection(this, conversation, parentElement, style);
+ public DescriptionElementMediaSection createDescriptionElementMediaSection(ICdmFormElement parentElement, int style){
+ DescriptionElementMediaSection section = new DescriptionElementMediaSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public MediaRepresentationSection createMediaRepresentationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- MediaRepresentationSection section = new MediaRepresentationSection(this, conversation, parentElement, style);
+ public MediaRepresentationSection createMediaRepresentationSection(ICdmFormElement parentElement, int style){
+ MediaRepresentationSection section = new MediaRepresentationSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public MediaRepresentationPartSection createMediaRepresentationPartSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- MediaRepresentationPartSection section = new MediaRepresentationPartSection(this, conversation, parentElement, style);
+ public MediaRepresentationPartSection createMediaRepresentationPartSection(ICdmFormElement parentElement, int style){
+ MediaRepresentationPartSection section = new MediaRepresentationPartSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public ModifierSection createModifierSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- ModifierSection section = new ModifierSection(this, conversation, parentElement, style);
+ public ModifierSection createModifierSection(ICdmFormElement parentElement, int style){
+ ModifierSection section = new ModifierSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public NomenclaturalStatusSection createNomenclaturalStatusSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- NomenclaturalStatusSection section = new NomenclaturalStatusSection(this, conversation, parentElement, style);
+ public NomenclaturalStatusSection createNomenclaturalStatusSection(ICdmFormElement parentElement, int style){
+ NomenclaturalStatusSection section = new NomenclaturalStatusSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public NameRelationshipDetailSection createNameRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- NameRelationshipDetailSection section = new NameRelationshipDetailSection(this, conversation, parentElement, style);
+ public NameRelationshipDetailSection createNameRelationshipDetailSection(ICdmFormElement parentElement, int style){
+ NameRelationshipDetailSection section = new NameRelationshipDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
-// public ProtologueSection createProtologueSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
-// ProtologueSection section = new ProtologueSection(this, conversation, parentElement, style);
-// addAndAdaptSection(parentElement, section);
-// return section;
-// }
- public ExternalLinksSection createExternalLinksSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- ExternalLinksSection section = new ExternalLinksSection(this, conversation, parentElement, style);
+ public ExternalLinksSection createExternalLinksSection(ICdmFormElement parentElement, int style){
+ ExternalLinksSection section = new ExternalLinksSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public ExternalLinksSection createExternalLinksSection(ConversationHolder conversation, ICdmFormElement parentElement, String label, int style){
- ExternalLinksSection section = new ExternalLinksSection(this, conversation, parentElement, true, label, style);
+ public ExternalLinksSection createExternalLinksSection(ICdmFormElement parentElement, String label, int style){
+ ExternalLinksSection section = new ExternalLinksSection(this, parentElement, true, label, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public ExternalLinksSection createExternalLinksSection(ConversationHolder conversation, ICdmFormElement parentElement, String label, boolean isWithTypeAndDesc, int style){
- ExternalLinksSection section = new ExternalLinksSection(this, conversation, parentElement, isWithTypeAndDesc, label, style);
+ public ExternalLinksSection createExternalLinksSection(ICdmFormElement parentElement, String label, boolean isWithTypeAndDesc, int style){
+ ExternalLinksSection section = new ExternalLinksSection(this, parentElement, isWithTypeAndDesc, label, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public RightsSection createRightsSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- RightsSection section = new RightsSection(this, conversation, parentElement, style);
+ public RightsSection createRightsSection(ICdmFormElement parentElement, int style){
+ RightsSection section = new RightsSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public SourceSection createSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- SourceSection section = new SourceSection(this, conversation, parentElement, style);
+ public SourceSection createSourceSection(ICdmFormElement parentElement, int style){
+ SourceSection section = new SourceSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public ScopeSection createScopeSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- ScopeSection section = new ScopeSection(this, conversation, parentElement, style);
+ public ScopeSection createScopeSection(ICdmFormElement parentElement, int style){
+ ScopeSection section = new ScopeSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public DescriptionSourceSection createDescriptionSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- DescriptionSourceSection section = new DescriptionSourceSection(this, conversation, parentElement, style);
+ public DescriptionSourceSection createDescriptionSourceSection(ICdmFormElement parentElement, int style){
+ DescriptionSourceSection section = new DescriptionSourceSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public TypeDesignationSection createTypeDesignationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- TypeDesignationSection section = new TypeDesignationSection(this, conversation, parentElement, style);
+ public TypeDesignationSection createTypeDesignationSection(ICdmFormElement parentElement, int style){
+ TypeDesignationSection section = new TypeDesignationSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public StateDataSection createStateDataSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- StateDataSection section = new StateDataSection(this, conversation, parentElement, style);
+ public StateDataSection createStateDataSection(ICdmFormElement parentElement, int style){
+ StateDataSection section = new StateDataSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public StatisticalMeasurementValueSection createStatisticalMeasurementValueSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- StatisticalMeasurementValueSection section = new StatisticalMeasurementValueSection(this, conversation, parentElement, style);
+ public StatisticalMeasurementValueSection createStatisticalMeasurementValueSection(ICdmFormElement parentElement, int style){
+ StatisticalMeasurementValueSection section = new StatisticalMeasurementValueSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public DescribedSpecimenSection createDescribedSpecimenSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- DescribedSpecimenSection section = new DescribedSpecimenSection(this, conversation, parentElement, style);
+ public DescribedSpecimenSection createDescribedSpecimenSection(ICdmFormElement parentElement, int style){
+ DescribedSpecimenSection section = new DescribedSpecimenSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public StateVocabularyCollectionSection createStateVocabulariesSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- StateVocabularyCollectionSection section = new StateVocabularyCollectionSection(this, conversation, parentElement, style);
+ public RecommendedStateCollectionSection createStateVocabulariesSection(ICdmFormElement parentElement, int style){
+ RecommendedStateCollectionSection section = new RecommendedStateCollectionSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
-
- public StateVocabularyDtoCollectionSection createStateVocabulariesDtoSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- StateVocabularyDtoCollectionSection section = new StateVocabularyDtoCollectionSection(this, conversation, parentElement, style);
+ public RecommendedStateCollectionSection createStateVocabulariesSection(ICdmFormElement parentElement, int style, Integer maxStates){
+ RecommendedStateCollectionSection section = new RecommendedStateCollectionSection(this, parentElement, style, maxStates);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
+ public RecommendedStateDtoCollectionSection createStateVocabulariesDtoSection(ICdmFormElement parentElement, int style){
+ RecommendedStateDtoCollectionSection section = new RecommendedStateDtoCollectionSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public RecommendedModifierVocabulariesCollectionSection createRecommendedModifierVocabulariesCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- RecommendedModifierVocabulariesCollectionSection section = new RecommendedModifierVocabulariesCollectionSection(this, conversation, parentElement, style);
+ public RecommendedModifierCollectionsCollectionSection createRecommendedModifierVocabulariesCollectionSection(ICdmFormElement parentElement, int style){
+ RecommendedModifierCollectionsCollectionSection section = new RecommendedModifierCollectionsCollectionSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public RecommendedModifierVocabulariesDtoCollectionSection createRecommendedModifierVocabulariesDtoCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- RecommendedModifierVocabulariesDtoCollectionSection section = new RecommendedModifierVocabulariesDtoCollectionSection(this, conversation, parentElement, style);
+ public RecommendedModifierCollectionsDtoCollectionSection createRecommendedModifierVocabulariesDtoCollectionSection(ICdmFormElement parentElement, int style){
+ RecommendedModifierCollectionsDtoCollectionSection section = new RecommendedModifierCollectionsDtoCollectionSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public MeasurementUnitCollectionSection createMeasurementUnitCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- MeasurementUnitCollectionSection section = new MeasurementUnitCollectionSection(this, conversation, parentElement, style);
+ public MeasurementUnitCollectionSection createMeasurementUnitCollectionSection(ICdmFormElement parentElement, int style){
+ MeasurementUnitCollectionSection section = new MeasurementUnitCollectionSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public MeasurementUnitDtoCollectionSection createMeasurementUnitDtoCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- MeasurementUnitDtoCollectionSection section = new MeasurementUnitDtoCollectionSection(this, conversation, parentElement, style);
+ public MeasurementUnitDtoCollectionSection createMeasurementUnitDtoCollectionSection(ICdmFormElement parentElement, int style){
+ MeasurementUnitDtoCollectionSection section = new MeasurementUnitDtoCollectionSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public StatisticalMeasureCollectionSection createStatisticalMeasureCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- StatisticalMeasureCollectionSection section = new StatisticalMeasureCollectionSection(this, conversation, parentElement, style);
+ public StatisticalMeasureCollectionSection createStatisticalMeasureCollectionSection(ICdmFormElement parentElement, int style){
+ StatisticalMeasureCollectionSection section = new StatisticalMeasureCollectionSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public StatisticalMeasureDtoCollectionSection createStatisticalMeasureDtoCollectionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- StatisticalMeasureDtoCollectionSection section = new StatisticalMeasureDtoCollectionSection(this, conversation, parentElement, style);
+ public StatisticalMeasureDtoCollectionSection createStatisticalMeasureDtoCollectionSection(ICdmFormElement parentElement, int style){
+ StatisticalMeasureDtoCollectionSection section = new StatisticalMeasureDtoCollectionSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public CollectingAreasDetailSection createCollectingAreasDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- CollectingAreasDetailSection section = new CollectingAreasDetailSection(this, conversation, parentElement, style);
+ public CollectingAreasDetailSection createCollectingAreasDetailSection(ICdmFormElement parentElement, int style){
+ CollectingAreasDetailSection section = new CollectingAreasDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public GeoScopeDetailSection createGeoScopeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- GeoScopeDetailSection section = new GeoScopeDetailSection(this, conversation, parentElement, style);
+ public GeoScopeDetailSection createGeoScopeDetailSection(ICdmFormElement parentElement, int style){
+ GeoScopeDetailSection section = new GeoScopeDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public GeoScopePolyKeyDetailSection createGeoScopePolyKeyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- GeoScopePolyKeyDetailSection section = new GeoScopePolyKeyDetailSection(this, conversation, parentElement, style);
+ public GeoScopePolyKeyDetailSection createGeoScopePolyKeyDetailSection(ICdmFormElement parentElement, int style){
+ GeoScopePolyKeyDetailSection section = new GeoScopePolyKeyDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public IdentifierSection createIdentifierDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- IdentifierSection section = new IdentifierSection(this, conversation, parentElement, style);
+ public IdentifierSection createIdentifierDetailSection(ICdmFormElement parentElement, int style){
+ IdentifierSection section = new IdentifierSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public DerivedUnitFacadeIdentifierSection createDerivedUnitFacadeIdentifierSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- DerivedUnitFacadeIdentifierSection section = new DerivedUnitFacadeIdentifierSection(this, conversation, parentElement, style);
+ public DerivedUnitFacadeIdentifierSection createDerivedUnitFacadeIdentifierSection(ICdmFormElement parentElement, int style){
+ DerivedUnitFacadeIdentifierSection section = new DerivedUnitFacadeIdentifierSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public CurrentSampleDesignationDetailSection createCurrentSampleDesignationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- CurrentSampleDesignationDetailSection section = new CurrentSampleDesignationDetailSection(this, conversation, parentElement, style);
+ public CurrentSampleDesignationDetailSection createCurrentSampleDesignationDetailSection(ICdmFormElement parentElement, int style){
+ CurrentSampleDesignationDetailSection section = new CurrentSampleDesignationDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public CurrentDeterminationDetailSection createCurrentDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- CurrentDeterminationDetailSection section = new CurrentDeterminationDetailSection(this, conversation, parentElement, style);
+ public CurrentDeterminationDetailSection createCurrentDeterminationDetailSection(ICdmFormElement parentElement, int style){
+ CurrentDeterminationDetailSection section = new CurrentDeterminationDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public PreservedSpecimenCurrentDeterminationDetailSection createPreservedSpecimenCurrentDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- PreservedSpecimenCurrentDeterminationDetailSection section = new PreservedSpecimenCurrentDeterminationDetailSection(this, conversation, parentElement, style);
+ public PreservedSpecimenCurrentDeterminationDetailSection createPreservedSpecimenCurrentDeterminationDetailSection(ICdmFormElement parentElement, int style){
+ PreservedSpecimenCurrentDeterminationDetailSection section = new PreservedSpecimenCurrentDeterminationDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public SampleDesignationHistoryDetailSection createSampleDesignationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- SampleDesignationHistoryDetailSection section = new SampleDesignationHistoryDetailSection(this, conversation, parentElement, style);
+ public SampleDesignationHistoryDetailSection createSampleDesignationHistoryDetailSection(ICdmFormElement parentElement, int style){
+ SampleDesignationHistoryDetailSection section = new SampleDesignationHistoryDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public DeterminationHistoryDetailSection createDeterminationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- DeterminationHistoryDetailSection section = new DeterminationHistoryDetailSection(this, conversation, parentElement, style);
+ public DeterminationHistoryDetailSection createDeterminationHistoryDetailSection(ICdmFormElement parentElement, int style){
+ DeterminationHistoryDetailSection section = new DeterminationHistoryDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public SpecimenCollectionDetailSection createSpecimenCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- SpecimenCollectionDetailSection section = new SpecimenCollectionDetailSection(this, conversation, parentElement, style);
+ public SpecimenCollectionDetailSection createSpecimenCollectionDetailSection(ICdmFormElement parentElement, int style){
+ SpecimenCollectionDetailSection section = new SpecimenCollectionDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public PreservedSpecimenSourceCollectionDetailSection createPreservedSpecimenSourceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- PreservedSpecimenSourceCollectionDetailSection section = new PreservedSpecimenSourceCollectionDetailSection(this, conversation, parentElement, style);
+ public PreservedSpecimenSourceCollectionDetailSection createPreservedSpecimenSourceCollectionDetailSection(ICdmFormElement parentElement, int style){
+ PreservedSpecimenSourceCollectionDetailSection section = new PreservedSpecimenSourceCollectionDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public SourceCollectionDetailSection createSourceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- SourceCollectionDetailSection section = new SourceCollectionDetailSection(this, conversation, parentElement, style);
+ public SourceCollectionDetailSection createSourceCollectionDetailSection(ICdmFormElement parentElement, int style){
+ SourceCollectionDetailSection section = new SourceCollectionDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public StatusCollectionDetailSection createStatusCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- StatusCollectionDetailSection section = new StatusCollectionDetailSection(this, conversation, parentElement, style);
+ public StatusCollectionDetailSection createStatusCollectionDetailSection(ICdmFormElement parentElement, int style){
+ StatusCollectionDetailSection section = new StatusCollectionDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public ScopeRestrictionSection createScopeRestrictionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- ScopeRestrictionSection section = new ScopeRestrictionSection(this, conversation, parentElement, style);
+ public ScopeRestrictionSection createScopeRestrictionSection(ICdmFormElement parentElement, int style){
+ ScopeRestrictionSection section = new ScopeRestrictionSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public MemberDetailSection createMemberDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- MemberDetailSection section = new MemberDetailSection(this, conversation, parentElement, style);
+ public MemberDetailSection createMemberDetailSection(ICdmFormElement parentElement, int style){
+ MemberDetailSection section = new MemberDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public GrantedAuthorityDetailSection createGrantedAuthorityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- GrantedAuthorityDetailSection section = new GrantedAuthorityDetailSection(this, conversation, parentElement, style);
+ public GrantedAuthorityDetailSection createGrantedAuthorityDetailSection(ICdmFormElement parentElement, int style){
+ GrantedAuthorityDetailSection section = new GrantedAuthorityDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public GroupsByUserDetailSection createGroupsByUserDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- GroupsByUserDetailSection section = new GroupsByUserDetailSection(this, conversation, parentElement, style);
+ public GroupsByUserDetailSection createGroupsByUserDetailSection(ICdmFormElement parentElement, int style){
+ GroupsByUserDetailSection section = new GroupsByUserDetailSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
- public TaxonomicScopeSection createTaxonomicScopeSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
- TaxonomicScopeSection section = new TaxonomicScopeSection(this, conversation, parentElement, style);
+ public TaxonomicScopeSection createTaxonomicScopeSection(ICdmFormElement parentElement, int style){
+ TaxonomicScopeSection section = new TaxonomicScopeSection(this, parentElement, style);
addAndAdaptSection(parentElement, section);
return section;
}
if (entity instanceof Annotation) {
element = new AnnotationElement(this, parentElement, (Annotation) entity, removeListener, style);
+ }else if (entity instanceof AnnotationDto) {
+ element = new AnnotationDtoElement(this, parentElement, (AnnotationDto) entity, removeListener, style);
}else if (entity instanceof Person ) {
boolean isNomenclatural = false;
if (parentElement instanceof TeamMemberSection){
element = new ExternalLinksElement(this, parentElement, (ExternalLink) entity, isAdvanced, removeListener, style);
} else if (entity instanceof Marker) {
element = new MarkerElement(this, parentElement, (Marker) entity, removeListener, style);
+ } else if (entity instanceof MarkerDto) {
+ element = new MarkerDtoElement(this, parentElement, (MarkerDto) entity, removeListener, style);
} else if (entity instanceof TaxonNodeAgentRelation) {
element = new TaxonNodeAgentRelationCollectionElement(this, parentElement, (TaxonNodeAgentRelation) entity, removeListener, backgroundColor, style);
}else if (entity instanceof Media) {
else{
element = new IdentifierElement(this, parentElement, (Identifier) entity, removeListener, style);
}
- } else if (entity instanceof TermVocabulary) {
- TermVocabulary<?> termVocabulary = (TermVocabulary<?>)entity;
- switch (termVocabulary.getTermType()) {
+ } else if (entity instanceof TermCollection) {
+ TermCollection<DefinedTermBase,?> termCollection = (TermCollection<DefinedTermBase,?>)entity;
+ switch (termCollection.getTermType()) {
+ case Structure:
case State:
- element = new StateVocabularyCollectionElement(this, parentElement, (TermVocabulary<State>) entity, removeListener, backgroundColor, style);
+ element = new RecommendedStateCollectionElement<>(this, parentElement, termCollection, removeListener, backgroundColor, style);
break;
case Modifier:
- element = new RecommendedModifierVocabulariesElement(this, parentElement, (TermVocabulary<DefinedTerm>) entity, removeListener, backgroundColor, style);
+ element = new RecommendedModifierCollectionsElement(this, parentElement, (TermCollection)termCollection, removeListener, backgroundColor, style);
+ break;
+ case DeterminationModifier:
+ element = new RecommendedModifierCollectionsElement(this, parentElement, (TermCollection)termCollection, removeListener, backgroundColor, style);
+ break;
+ case KindOfUnit:
+ element = new RecommendedModifierCollectionsElement(this, parentElement, (TermCollection)termCollection, removeListener, backgroundColor, style);
+ break;
+ case Scope:
+ element = new RecommendedModifierCollectionsElement(this, parentElement, (TermCollection)termCollection, removeListener, backgroundColor, style);
+ break;
+ case Sex:
+ element = new RecommendedModifierCollectionsElement(this, parentElement, (TermCollection)termCollection, removeListener, backgroundColor, style);
+ break;
+ case Stage:
+ element = new RecommendedModifierCollectionsElement(this, parentElement, (TermCollection)termCollection, removeListener, backgroundColor, style);
break;
default:
break;
}
- }else if (entity instanceof TermVocabularyDto) {
- TermVocabularyDto termVocabulary = (TermVocabularyDto)entity;
- switch (termVocabulary.getTermType()) {
+ }else if (entity instanceof TermCollectionDto) {
+ TermCollectionDto termCollectionDto = (TermCollectionDto)entity;
+ TermType type = termCollectionDto.getTermType();
+ if (type.isKindOf(TermType.Modifier)) {
+ type = TermType.Modifier;
+ }
+ switch (type) {
case State:
- element = new StateVocabularyDtoCollectionElement(this, parentElement, termVocabulary, removeListener, backgroundColor, style);
+ element = new RecommendedStateCollectionsDtoElement<>(this, parentElement, termCollectionDto, removeListener, backgroundColor, style);
break;
- case Modifier:
- element = new RecommendedModifierDtoVocabulariesElement(this, parentElement, termVocabulary, removeListener, backgroundColor, style);
+ case Structure:
+ element = new RecommendedStateCollectionsDtoElement<>(this, parentElement, termCollectionDto, removeListener, backgroundColor, style);
break;
+ case Modifier:
+ element = new RecommendedModifierDtoCollectionsElement(this, parentElement, termCollectionDto, removeListener, backgroundColor, style);
+ break;
default:
+
break;
}
}else if (entity instanceof MeasurementUnit) {
element = new MeasurementUnitCollectionElement(this, parentElement, (MeasurementUnit) entity, removeListener, backgroundColor, style);
}else if (entity instanceof TermDto) {
- if(((TermDto)entity).getTermType().equals(TermType.MeasurementUnit)){
- element = new MeasurementUnitDtoCollectionElement(this, parentElement, (TermDto) entity, removeListener, backgroundColor, style);
- }else if (((TermDto)entity).getTermType().equals(TermType.StatisticalMeasure)){
- element = new StatisticalMeasureDtoCollectionElement(this, parentElement, (TermDto) entity, removeListener, backgroundColor, style);
+ if (((TermDto)entity).getTermType() != null) {
+ if(((TermDto)entity).getTermType().equals(TermType.MeasurementUnit)){
+ element = new MeasurementUnitDtoCollectionElement(this, parentElement, (TermDto) entity, removeListener, backgroundColor, style);
+ }else if (((TermDto)entity).getTermType().equals(TermType.StatisticalMeasure)){
+ element = new StatisticalMeasureDtoCollectionElement(this, parentElement, (TermDto) entity, removeListener, backgroundColor, style);
+ }
}
}else if (entity instanceof StatisticalMeasure) {
element = new StatisticalMeasureCollectionElement(this, parentElement, (StatisticalMeasure) entity, removeListener, backgroundColor, style);
this,
String.format("Could not generate collection element for entity of class %s."
+ " Looks like the case is not yet handled. Check implementation.\n"
- + "Entity: %s", entity.getClass(), entity.toString()), null);
+ + "Entity: %s", entity.getClass().getName(), entity.toString()), null);
}
else{
* <strong>Selection elements not handled by this method:</strong>
* <ul>
* <li>{@link TaxonNodeSelectionElement} see
- * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
+ * {@link #createTaxonNodeSelectionElement(ICdmFormElement, String, TaxonNode, int, int)}
* </li>
* <li>{@link NomenclaturalAuthorTeamSelectionElement} see
- * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
+ * {@link #createNomenclaturalAuthorTeamSelectionElement(ICdmFormElement, String, Team, int, int)}
* </li>
* </ul>
* </p>
- *
- * @param clazz
- * a {@link Class} object of the type that you want the selection
- * element to handle
- * @param parentElement
- * a {@link ICdmFormElement} object.
- * @param labelString
- * a {@link String} object.
- * @param selectionType
- * @param selection
- * a {@link ICdmBase} object.
- * @param style
- * a int.
- * @param conversation
- * a {@link ConversationHolder} object.
- * @return a {@link EntitySelectionElement} object.
*/
public <T extends CdmBase> EntitySelectionElement<T> createSelectionElement(Class<T> clazz,
ICdmFormElement parentElement, String labelString, T selection, int mode,
public <T extends CdmBase> EntitySelectionElement<T> createSelectionElement(Class<T> clazz,
ICdmFormElement parentElement, String labelString, T selection, int mode,
int style, boolean filterElement) {
- EntitySelectionElement<T> element = new EntitySelectionElement<T>(this, //conversation,
+ EntitySelectionElement<T> element = new EntitySelectionElement<T>(this,
parentElement, clazz,
labelString, selection, mode, style, filterElement);
adapt(element);
}
public <T extends CdmBase> EntitySelectionElement<T> createSelectionElement(Class<T> clazz,
-// ConversationHolder conversation,
ICdmFormElement parentElement, String labelString, T selection, int mode,
int style) {
EntitySelectionElement<T> element = new EntitySelectionElement<T>(this,
parentElement.addElement(element);
return element;
}
+
public CollectorSelectionElement createCollectorSelectionElement(ICdmFormElement parentElement, String labelString, AgentBase selection, int mode,
int style) {
CollectorSelectionElement element = new CollectorSelectionElement(this, parentElement,
* <strong>Selection elements not handled by this method:</strong>
* <ul>
* <li>{@link TaxonNodeSelectionElement} see
- * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
+ * {@link #createTaxonNodeSelectionElement(ICdmFormElement, String, TaxonNode, int, int)}
* </li>
* <li>{@link NomenclaturalAuthorTeamSelectionElement} see
- * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, ICdmFormElement, String, Team, int, int)}
+ * {@link #createNomenclaturalAuthorTeamSelectionElement(ICdmFormElement, String, Team, int, int)}
* </li>
* </ul>
* </p>
- *
- * @param clazz
- * a {@link Class} object of the type that you want the selection
- * element to handle
- * @param parentElement
- * a {@link ICdmFormElement} object.
- * @param labelString
- * a {@link String} object.
- * @param selectionType
- * @param selection
- * a {@link ICdmBase} object.
- * @param style
- * a int.
- * @param conversation
- * a {@link ConversationHolder} object.
- * @return a {@link EntitySelectionElement} object.
*/
public <T extends CdmBase> EntitySelectionElementWithAbbreviatedTitle<T> createSelectionElementWithAbbreviatedTitle(
- Class<T> clazz, ConversationHolder conversation, ICdmFormElement parentElement, String labelString,
+ Class<T> clazz, ICdmFormElement parentElement, String labelString,
T selection, int mode, int style) {
- EntitySelectionElementWithAbbreviatedTitle<T> element = new EntitySelectionElementWithAbbreviatedTitle<T>(this, //conversation,
+ EntitySelectionElementWithAbbreviatedTitle<T> element = new EntitySelectionElementWithAbbreviatedTitle<T>(this,
parentElement, clazz,
labelString, selection, mode, style);
adapt(element);
return element;
}
- public TaxonNodeSelectionElement createTaxonNodeSelectionElement(ConversationHolder conversation,
+ public TaxonNodeSelectionElement createTaxonNodeSelectionElement(
ICdmFormElement parentElement, String labelString, TaxonNode selection, int mode, int style) {
TaxonNodeSelectionElement element = new TaxonNodeSelectionElement(this,
parentElement,
parentElement.addElement(element);
return element;
}
- public TaxonNodeSelectionElement createTaxonNodeSelectionElement(ConversationHolder conversation,
+
+ public TaxonNodeSelectionElement createTaxonNodeSelectionElement(
ICdmFormElement parentElement, String labelString, TaxonNode selection, int mode, int style, Integer limit) {
- TaxonNodeSelectionElement element = new TaxonNodeSelectionElement(this, //conversation,
+ TaxonNodeSelectionElement element = new TaxonNodeSelectionElement(this,
parentElement,
labelString, selection, mode, style, limit);
adapt(element);
return element;
}
-
// public NomenclaturalAuthorTeamSelectionElement createNomenclaturalAuthorTeamSelectionElement(
-// ConversationHolder conversation, ICdmFormElement parentElement, String labelString, Team selection,
+// ICdmFormElement parentElement, String labelString, Team selection,
// int mode, int style) {
// NomenclaturalAuthorTeamSelectionElement element = new NomenclaturalAuthorTeamSelectionElement(this,
-// conversation, parentElement, labelString, selection, mode, style);
+// parentElement, labelString, selection, mode, style);
// adapt(element);
// parentElement.addElement(element);
// return element;
// }
- /** {@inheritDoc} */
public LabelElement createLabel(ICdmFormElement parentElement, String text) {
LabelElement labelElement = new LabelElement(this, parentElement, text);
adapt(labelElement);
return labelElement;
}
-
-
// public DateElementFormElement createDateElementForm(ICdmFormElement formElement, String labelText, DateTime dateTime, int style){
// Label label = new Label(formElement.getLayoutComposite(), style);
// label.setText(labelText+" (yyyy-MM-dd)");
return dateElement;
}
- /**
- * <p>
- * Getter for the field <code>selectionProvider</code>.
- * </p>
- *
- * @return a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
- */
public ISelectionProvider getSelectionProvider() {
return selectionProvider;
}
- /**
- * <p>
- * createDetailedDescriptionDetailElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param entity
- * a
- * {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase}
- * object.
- * @param style
- * a int.
- * @return a
- * {@link eu.etaxonomy.taxeditor.ui.section.description.detail.AbstractDetailedDescriptionDetailElement}
- * object.
- */
- public AbstractDetailedDescriptionDetailElement createDetailedDescriptionDetailElement(
+ public AbstractDetailedDescriptionDetailElement<?> createDetailedDescriptionDetailElement(
ICdmFormElement parentElement, DescriptionElementBase entity, int style, boolean enabled) {
- AbstractDetailedDescriptionDetailElement detailedDescriptionElement = null;
+ AbstractDetailedDescriptionDetailElement<?> detailedDescriptionElement = null;
if (entity instanceof CategoricalData) {
detailedDescriptionElement = new CategoricalDataDetailElement(this, parentElement,
adapt(detailedDescriptionElement);
parentElement.addElement(detailedDescriptionElement);
return detailedDescriptionElement;
-
}
- /**
- * Creates a styled text as a part of the form.
- *
- * @param parent
- * the text parent
- * @param value
- * the text initial value
- * @param style
- * the text style
- * @return the text widget
- */
public StyledText createStyledText(Composite parent, String value, int style) {
StyledText text = new StyledText(parent, getBorderStyle() | style | getOrientation());
if (value != null) {
return text;
}
- public PreservedSpecimenDetailSection createPreservedSpecimenDetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
- PreservedSpecimenDetailSection section = new PreservedSpecimenDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public PreservedSpecimenDetailSection createPreservedSpecimenDetailsSection(ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+ PreservedSpecimenDetailSection section = new PreservedSpecimenDetailSection(this, parentElement, selectionProvider, style);
addAndAdaptSection(parentElement, section);
return section;
}
- /**
- * @param formElement
- * @param conversationHolder
- * @param style
- * @return
- */
public TaxonNodeAgentRelationCollectionSection createTaxonNodeAgentRelationCollectionSection(
- ICdmFormElement formElement, ConversationHolder conversationHolder, int style) {
- TaxonNodeAgentRelationCollectionSection section = new TaxonNodeAgentRelationCollectionSection(this, conversationHolder, formElement, style);
+ ICdmFormElement formElement, int style) {
+ TaxonNodeAgentRelationCollectionSection section = new TaxonNodeAgentRelationCollectionSection(this, formElement, style);
addAndAdaptSection(formElement, section);
return section;
}
-
public TaxonOfRelationshipElement createTaxonOfRelationshipDetailElement(
ICdmFormElement parentElement, int style) {
TaxonOfRelationshipElement section = new TaxonOfRelationshipElement(this, parentElement, style);
return section;
}
- public TaxonDetailSection createTaxonDetailSection(ConversationHolder conversationHolder,
+ public TaxonDetailSection createTaxonDetailSection(
ICdmFormElement formElement, ISelectionProvider selectionProvider, int style) {
- TaxonDetailSection section = new TaxonDetailSection(this, conversationHolder, formElement, selectionProvider, style);
+ TaxonDetailSection section = new TaxonDetailSection(this, formElement, selectionProvider, style);
addAndAdaptSection(formElement, section);
return section;
}
-
- /**
- * <p>
- * createTextWithLabelElement
- * </p>
- *
- * @param parentElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param labelString
- * a {@link java.lang.String} object.
- * @param initialText
- * a {@link java.lang.String} object.
- * @param textLimit maximal number of characters allowed
- * @param style
- * a int.
- * @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement}
- * object.
- */
public RuleConsideredElement createRuleConsideredElement(ICdmFormElement parentElement, String labelString, boolean isShowCodeEdition, int style) {
RuleConsideredElement element = new RuleConsideredElement(this, parentElement, labelString, isShowCodeEdition, style);
adapt(element);
return element;
}
- /**
- * @param class1
- * @param formElement
- * @param string
- * @param area
- * @param nothing
- * @param style
- * @return
- */
public EntitySelectionElementWithIdInVocabulary createSelectionElementWithIdInVocabulary(Class<NamedArea> clazz,
ICdmFormElement formElement, String labelString, NamedArea area, int mode, int style) {
EntitySelectionElementWithIdInVocabulary element = new EntitySelectionElementWithIdInVocabulary(this,
return element;
}
- /**
- * @param extendedTimePeriodElement
- * @param twistie
- * @return
- */
public ExtendedTimeDetailSection createExtendedTimeDetailSection(
ExtendedTimePeriodElement parentElement, int style) {
ExtendedTimeDetailSection section = new ExtendedTimeDetailSection(this, parentElement, style);
adapt(section);
return section;
}
+
public ExtendedTimePeriodElement createExtendedTimePeriodElement(
ICdmFormElement parentElement, String labelString, ExtendedTimePeriod timePeriod, int style) {
ExtendedTimePeriodElement section = new ExtendedTimePeriodElement(this, parentElement, labelString, timePeriod, style);
return section;
}
-
-
// public RichTextWithLabelElement createRichTextLabelElement(ICdmFormElement parentElement, String labelString, String initialText, int textHeight, int style) {
// RichTextWithLabelElement element = new RichTextWithLabelElement(this, parentElement, labelString,
// initialText, textHeight, style);
// parentElement.addElement(element);
// return element;
// }
-
-
-
-
-
-
-
-}
+}
\ No newline at end of file
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.forms.widgets.Section;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
/**
* <p>
public void setLabel(String string) {
label.setText(string);
}
+
+ public void setExpanded(boolean isExpanded) {
+ this.section_minMaxText.setExpanded(isExpanded);
+ }
}
* 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.element;
import org.eclipse.jface.util.PropertyChangeEvent;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
/**
- * <p>
- * MinMaxTextSection class.
- * </p>
*
* @author c.mathew
* @created 23 Jul 2013
- * @version 1.0
*/
public class MinMaxTextSection extends AbstractFormSection<DerivedUnitFacade> {
formFactory.addPropertyChangeListener(this);
}
- /**
- * <p>
- * Setter for the field <code>timePeriod</code>.
- * </p>
- *
- * @param timePeriod
- * a {@link eu.etaxonomy.cdm.model.common.TimePeriod} object.
- */
@Override
public void setEntity(DerivedUnitFacade gatheringEvent) {
super.setEntity(gatheringEvent);
combo_language = formFactory.createDefinedTermComboElement(TermType.Language, formElement,
"", null, false, style);
combo_language.addSelectionListener(this);
-
+
button = formFactory.createButton(getLayoutComposite(),
"Open In Translation Editor", SWT.PUSH);
addControl(button);
*/
package eu.etaxonomy.taxeditor.ui.element;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
* @author pplitzner
* @date 17.06.2014
- *
*/
public class OriginalLabelDataElement extends AbstractCdmDetailElement<DerivedUnitFacade> {
private TextWithLabelElement textOriginalLabel;
- /**
- * @param formFactory
- * @param formElement
- */
public OriginalLabelDataElement(CdmFormFactory formFactory,
ICdmFormElement formElement) {
super(formFactory, formElement);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
- * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
- */
@Override
protected void createControls(ICdmFormElement formElement,
DerivedUnitFacade entity, int style) {
textOriginalLabel.setText(entity.getOriginalLabelInfo());
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
- * .lang.Object)
- */
@Override
public void handleEvent(Object eventSource) {
if(eventSource==textOriginalLabel){
}
}
-}
+ @Override
+ public void fillFields() {
+ textOriginalLabel.setText(getEntity().getOriginalLabelInfo());
+ }
+}
\ No newline at end of file
import eu.etaxonomy.cdm.model.term.TermBase;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.persistence.dto.AbstractTermDto;
-import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.taxeditor.model.DefaultTermComparator;
import eu.etaxonomy.taxeditor.model.ImageResources;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
super(formFactory, formElement);
formFactory.addPropertyChangeListener(this);
-
+ setSelectedRepresentation(representation);
element_Label = this.formFactory.createTextWithLabelElement(formElement, "Label", null, style);
element_abbrevLabel = this.formFactory.createTextWithLabelElement(formElement, "abbrev. Label", null, style);
element_plural = this.formFactory.createTextWithLabelElement(formElement, "Plural", null, style);
}
setTerm(term, fill);
//if(representation!=null){
- setSelectedRepresentation(representation);
+
//}
}
super(formFactory, formElement);
formFactory.addPropertyChangeListener(this);
-
+ if(representation!=null){
+ setSelectedRepresentation(representation);
+ }
element_Label = this.formFactory.createTextWithLabelElement(formElement, "Label", null, style);
element_abbrevLabel = this.formFactory.createTextWithLabelElement(formElement, "abbrev. Label", null, style);
element_plural = this.formFactory.createTextWithLabelElement(formElement, "Plural", null, style);
element_text = this.formFactory.createMultiLineTextWithLabel(formElement, "Description", textHeight, style);
if (PreferencesUtil.isMultilanguageTextEditingCapability()) {
createRepresentationEditingElements(formElement, style);
+
}
setTermDto(term, fill);
if(representation!=null){
removeRepresentation.setToolTipText("Remove representation");
removeRepresentation.addSelectionListener(new DeleteListener(this));
addControl(removeRepresentation);
-
+ boolean addNullValue = false;
+ if (this.selectedRepresentation == null) {
+ addNullValue = true;
+ }
combo_language = formFactory.createDefinedTermComboElement(TermType.Language, formElement,
- "", null, false, style);
+ "", null, addNullValue, style);
}
term.addRepresentation(rep);
}
- if (selectedRepresentation != null) {
+ if (selectedRepresentation != null && combo_language != null) {
combo_language.setTerms(getLanguages());
}
setEnabledControls(false);
removeRepresentation.setEnabled(false);
}
- firePropertyChangeEvent(new CdmPropertyChangeEvent(this, event));
+ //firePropertyChangeEvent(new CdmPropertyChangeEvent(this, event));
+ firePropertyChangeEvent(event);
}
}
}
public void setSelectedRepresentation(Representation selectedRepresentation) {
- if (selectedRepresentation == null){
- selectedRepresentation = Representation.NewInstance("", "", "", null);
- }
+// if (selectedRepresentation == null){
+// selectedRepresentation = Representation.NewInstance("", "", "", null);
+// }
this.selectedRepresentation = selectedRepresentation;
+
}
private class DeleteListener extends SelectionAdapter {
updateControls();
}
}
+
+ /**
+ * @param isEnabled
+ */
+ public void setLanguageComboEnabled(boolean isEnabled) {
+ this.combo_language.setEnabled(isEnabled);
+ }
}
text.setEditable(editable);
String symbolicName = editable ? Resources.COLOR_FONT_DEFAULT : Resources.COLOR_TEXT_DISABLED;
text.setForeground(getColor(symbolicName));
+ if (!editable) {
+ text.setBackground(getColor(Resources.COLOR_TEXT_DISABLED_BACKGROUND));
+ }else {
+ text.setBackground(getPersistentBackground());
+ }
}
@Override
public void updateCacheRelevance() {
Color color = cacheRelevance().getColor();
- text.setBackground(color);
+ if (text.getEditable()) {
+ text.setBackground(color);
+ }
}
@Override
public boolean isEnabled() {
return isEnabled;
}
+
+ public void setExpanded(boolean isExpanded) {
+ this.section_dateDetails.setExpanded(isExpanded);
+ }
}
\ No newline at end of file
import java.util.Set;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTException;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.ModifyEvent;
public void setText(String text){
if(text != null){
// store current caret position
- int caretPosition = text_cache.getCaretPosition();
+ try {
+ int caretPosition = text_cache.getCaretPosition();
- StoreUtil.setTextWithoutModifyListeners(text_cache, text != null? text.trim(): text);
-// text_cache.removeModifyListener(this);
-// text_cache.setText(text);
-// text_cache.addModifyListener(this);
+ StoreUtil.setTextWithoutModifyListeners(text_cache, text != null? text.trim(): text);
- // restore caret position
- text_cache.setSelection(caretPosition);
+ // restore caret position
+ text_cache.setSelection(caretPosition);
+ }catch(SWTException e) {
+ //if the text field is deprecated we do not want to set the text, so we can ignore this exception.
+ }
}
}
* 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.password;
import org.eclipse.jface.wizard.WizardDialog;
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.api.service.IUserService;
import eu.etaxonomy.cdm.model.permission.User;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
/**
* @author n.hoffmann
* @created Mar 10, 2011
- * @version 1.0
*/
-public class EditPasswordElement extends AbstractCdmFormElement implements SelectionListener, IConversationEnabled{
+public class EditPasswordElement
+ extends AbstractCdmFormElement
+ implements SelectionListener{
private User user;
private Button button;
- private ConversationHolder conversation;
-
public EditPasswordElement(CdmFormFactory formFactory,
- ICdmFormElement formElement, String labelString, User user, ConversationHolder conversation) {
+ ICdmFormElement formElement, String labelString, User user) {
super(formFactory, formElement);
- this.conversation = conversation;
this.user = user;
Label label = formFactory.createLabel(getLayoutComposite(), null);
if(!CdmStore.getService(IUserService.class).userExists(user.getUsername())) {
MessagingUtils.warningDialog(Messages.EditPasswordElement_USERNAME_DOES_NOT_EXIST, this, String.format(Messages.EditPasswordElement_PLEASE_CREATE_OR_SAVE_USER, user.getUsername()));
} else {
- PasswordWizard wizard = new PasswordWizard(user, conversation);
+ PasswordWizard wizard = new PasswordWizard(user);
WizardDialog dialog = new WizardDialog(getLayoutComposite().getShell(), wizard);
dialog.open();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {}
- @Override
- public void update(CdmDataChangeMap arg0) {}
-
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
-
-}
+
+}
\ No newline at end of file
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.core.AuthenticationException;
-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.permission.User;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @created Mar 10, 2011
* @version 1.0
*/
-public class PasswordWizard extends Wizard implements IConversationEnabled{
+public class PasswordWizard extends Wizard {
private PasswordWizardPage passwordPage;
private final User user;
- private final ConversationHolder conversation;
-
+
/**
* @param user the user to change the password for
* @param conversation this optional parameter can be null. Only supply conversation if you
* need to run this wizard is a nested conversation
*/
- public PasswordWizard(User user, ConversationHolder conversation){
- this.conversation = conversation;
+ public PasswordWizard(User user){
this.user = user;
setWindowTitle(Messages.PasswordWizardPage_CHANGE_PASSWORD);
}
public void addPages() {
CdmFormFactory formFactory = new CdmFormFactory(Display.getDefault());
- passwordPage = new PasswordWizardPage(formFactory, getConversationHolder(), user);
+ passwordPage = new PasswordWizardPage(formFactory, user);
addPage(passwordPage);
}
@Override
public boolean performFinish() {
- ConversationHolder internalConversation = CdmStore.getCurrentApplicationConfiguration().NewConversation();
- internalConversation.bind();
- internalConversation.startTransaction();
String warningTitle = Messages.PasswordWizard_COULD_NOT_CHANGE_PWD;
String warningMessage = Messages.PasswordWizard_OLD_PWD_INCORRECT;
try{
if (user.equals(CdmStore.getLoginManager().getAuthenticatedUser())){
CdmStore.getLoginManager().authenticate(user.getUsername(), passwordPage.getNewPassword());
}
- internalConversation.commit(false);
- internalConversation.unbind();
- internalConversation.close();
- return true;
+ return true;
}catch(AccessDeniedException e){
MessagingUtils.warningDialog(warningTitle, this, warningMessage);
return false;
}catch(Exception e){
MessagingUtils.warningDialog(Messages.PasswordWizard_PROBLEM_WITH_CHANGING_PWD, this, Messages.PasswordWizard_PWD_COULD_NOT_BE_CHANGED + e.getMessage());
return false;
- }finally{
- if(conversation != null){
- conversation.bind();
- }
}
}
- @Override
- public void update(CdmDataChangeMap arg0) {
- }
-
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
+
}
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.permission.User;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.store.CdmStore;
private TextWithLabelElement text_passwordRepeat;
private final PasswordValidator passwordValidator;
- protected PasswordWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, User entity) {
- super(formFactory, conversation, entity);
+ protected PasswordWizardPage(CdmFormFactory formFactory, User entity) {
+ super(formFactory, entity);
passwordValidator = new PasswordValidator();
setPageComplete(false);
control.setLayout(LayoutConstants.LAYOUT(2, false));
- WizardPageRootElement rootElement = new WizardPageRootElement(formFactory, control, getConversationHolder());
+ WizardPageRootElement rootElement = new WizardPageRootElement(formFactory, control);
if(isChangingOwnPassword()) {
text_oldPassword = formFactory.createTextWithLabelElement(rootElement, Messages.PasswordWizardPage_OLD_PASSWORD, null, SWT.PASSWORD);
public String passwordsMatch(String password1, String password2){
+ if (password1 == null || password2 == null) {
+ //empty passwords not allowed
+ setPageComplete(false);
+ return NO_MATCH;
+ }
+
if(! password1.equals(password2)){
setPageComplete(false);
return NO_MATCH;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.name.TaxonName;
public void setEntityWithoutUpdate(T entity){
this.entity = entity;
- // the id is always 0 if the entity was not yet saved, so it is new in this case
- if(getEntity() == null || (getEntity() instanceof CdmBase && StoreUtil.getCdmEntity(getEntity()).getId() == 0)) {
- // new entity, not yet saved
- requiredCrud = EnumSet.of(CRUD.CREATE);
- } else {
- requiredCrud = EnumSet.of(CRUD.UPDATE);
- }
+ fillFields();
}
+
+ public abstract void fillFields();
@Override
public T getEntity() {
MessagingUtils.error(event.getSource().getClass(), event.getException());
}
- @Override
- public ConversationHolder getConversationHolder() {
- if (getParentElement() instanceof IConversationEnabled) {
- return ((IConversationEnabled) getParentElement())
- .getConversationHolder();
- }
- throw new IllegalArgumentException(
- "Parent element should be IConversationEnabled");
- }
- @Override
- public void update(CdmDataChangeMap changeEvents) {
- }
@Override
public void update(Observable o, Object arg){
import org.eclipse.ui.forms.widgets.TableWrapData;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
protected AbstractCdmDetailElement<ENTITY> detailElement;
public AbstractCdmDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- this(formFactory, null, conversation, parentElement, selectionProvider, style);
+ this(formFactory, null, parentElement, selectionProvider, style);
}
- //TODO remove conversation
public AbstractCdmDetailSection(CdmFormFactory formFactory, Class<ENTITY> clazz,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
super(formFactory, parentElement, selectionProvider,
ExpandableComposite.CLIENT_INDENT | style);
setSectionTitle();
layout();
}
+
+ public void setEntityWithoutUpdate(ENTITY entity) {
+
+ if (detailElement != null) {
+ detailElement.fillFields();
+
+ }
+ super.setEntity(entity);
+ setSectionTitle();
+
+ }
protected void setSectionTitle() {
String title = "";
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.model.ImageResources;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
*/
public abstract class AbstractEntityCollectionElement<ENTITY>
extends AbstractCdmFormElement
- implements IEntityElement<ENTITY>, SelectionListener,
- IConversationEnabled, IEnableableFormElement {
+ implements IEntityElement<ENTITY>, SelectionListener, IEnableableFormElement {
protected ENTITY entity;
return box;
}
- @Override
- public ConversationHolder getConversationHolder() {
- if (getParentElement() instanceof IConversationEnabled) {
- return ((IConversationEnabled) getParentElement())
- .getConversationHolder();
- }
- throw new IllegalArgumentException(
- "Parent element should be IConversationEnabled");
- }
-
- @Override
- public void update(CdmDataChangeMap changeEvents) {
- }
-
public void setWarnForReferencedObjects(LabelElement warnForReferencedObjects) {
this.warnForReferencedObjects = warnForReferencedObjects;
}
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.ui.forms.events.IExpansionListener;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.permission.CRUD;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.ImageResources;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.preference.Resources;
private String title;
private AbstractEntityCollectionElement<ENTITY> entityCollectionElement;
-
+
private boolean isEnabled = true;
- public AbstractEntityCollectionSection(CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, String title, int style) {
+ public AbstractEntityCollectionSection(CdmFormFactory formFactory, ICdmFormElement parentElement, String title, int style) {
super(formFactory, parentElement, ExpandableComposite.CLIENT_INDENT | style);
this.title = title;
this.setText(getTitleString());
addExpansionListener(this);
CdmStore.getLoginManager().addObserver(this);
- addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
+ addDisposeListener(e-> {
CdmStore.getLoginManager().deleteObserver(AbstractEntityCollectionSection.this);
}
- });
+ );
}
protected Control createToolbar() {
getSection().setExpanded(true);
}
internalUpdateSection(true);
+
}
}
};
protected void setSectionTitle() {
ENTITY entity = getEntity();
Collection<ELEMENT> collection = getCollection(entity);
- if(collection != null && collection.size() > 0){
+ if(!CdmUtils.isNullSafeEmpty(collection)){
this.setText(getTitleString() + " +");
}else{
this.setText(getTitleString());
protected void internalUpdateSection(boolean changed){
setSectionTitle();
destroyDynamicContent();
+ updateToolbar();
if(isExpanded() || expandSectionWhenContentAvailable()) {
renderContent(isExpanded());
}
/**
* Creates the widgets for the collection
*/
- protected void createDynamicContents(Collection<ELEMENT> elements)
- {
+ protected void createDynamicContents(Collection<ELEMENT> elements){
int i = 0;
for(final ELEMENT element : elements){
SelectionAdapter removeListener = new SelectionAdapter(){
}
protected void updateToolbar() {
- if( !(getEntity() instanceof CdmBase) || (getEntity() != null && CdmStore.currentAuthentiationHasPermission(StoreUtil.getCdmEntity(getEntity()), UPDATE)) && isEnabled){
+ if( !(getEntity() instanceof CdmBase) || (getEntity() != null && CdmStore.currentAuthentiationHasPermission(StoreUtil.getCdmEntity(getEntity()), getUpdate())) && isEnabled){
showToolbar();
} else {
removeToolbar();
* @return String to display when hovering the add button
*/
protected abstract String getTooltipString();
-
- public boolean isEnabled(){
+
+ @Override
+ public boolean isEnabled(){
return isEnabled;
}
-
- public void setEnabled(boolean enabled){
+
+ @Override
+ public void setEnabled(boolean enabled){
isEnabled=enabled;
if (!isEnabled){
removeToolbar();
}
-
+
for (ICdmFormElement element: getElements()){
if (element instanceof IEnableableFormElement){
((IEnableableFormElement)element).setEnabled(isEnabled);
}
}
-
+
}
+
+ public static EnumSet<CRUD> getUpdate() {
+ return UPDATE;
+ }
}
protected void registerCacheRelevance(ICacheRelevantFormElement element) {
registerCacheRelevance(element, toggleable_cache);
}
+
+ @Override
+ public void fillFields() {
+ if (!getEntity().getTitleCache().equals(toggleable_cache.getText())) {
+ toggleable_cache.setText(getEntity().getTitleCache());
+ toggleable_cache.setSelected(getEntity().isProtectedTitleCache());
+ }
+ }
}
\ No newline at end of file
public void setEntity(Object entity) {
// nothing
}
+
+ @Override
+ public void fillFields() {
+ // do nothing
+ }
}
*/
package eu.etaxonomy.taxeditor.ui.section;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
* @date 30.07.2013
*/
public interface ICdmDetailElement<T>
- extends IEntityElement<T>, IEnableableFormElement, IConversationEnabled{
+ extends IEntityElement<T>, IEnableableFormElement{
public abstract void setEntity(T entity);
}
\ No newline at end of file
* @param taxon a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.
*/
public abstract void setTaxonBase(TaxonBase<?> taxon);
+
+ public abstract void setTaxonBaseWithoutUpdate(TaxonBase<?> taxon);
public abstract TaxonBase<?> getTaxonBase();
}
* 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.agent;
import eu.etaxonomy.cdm.model.agent.Institution;
/**
* @author n.hoffmann
* @created Dec 15, 2010
- * @version 1.0
*/
public class InstitutionDetailElement extends
AbstractCdmDetailElement<Institution> {
private EntitySelectionElement<Institution> selection_partOfInstitution;
- /**
- * @param formFactory
- * @param formElement
- */
public InstitutionDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement) {
super(formFactory, formElement);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
- * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
- */
@Override
protected void createControls(ICdmFormElement formElement,
Institution entity, int style) {
// section_institutionTypes
selection_partOfInstitution = formFactory
.createSelectionElement(Institution.class,
- //getConversationHolder(),
formElement, "Is Part Of",
entity.getIsPartOf(),
EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE | EntitySelectionElement.DELETABLE,
style);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
- * .lang.Object)
- */
@Override
public void handleEvent(Object eventSource) {
if (eventSource == text_name) {
}
}
-}
+ @Override
+ public void fillFields() {
+ if (getEntity() != null) {
+ text_name.setText(getEntity().getName());
+ text_code.setText(getEntity().getCode());
+ selection_partOfInstitution.setEntity(getEntity().getIsPartOf());
+ }
+
+ }
+}
\ No newline at end of file
* 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.agent;
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.agent.Institution;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author n.hoffmann
* @created Dec 15, 2010
- * @version 1.0
*/
public class InstitutionDetailSection extends AbstractCdmDetailSection<Institution> {
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param selectionProvider
- * @param style
- */
public InstitutionDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
@Override
public String getHeading() {
return "Institution";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<Institution> createCdmDetailElement(AbstractCdmDetailSection<Institution> parentElement, int style) {
return formFactory.createInstitutionDetailElement(parentElement);
}
-
-}
+}
\ No newline at end of file
package eu.etaxonomy.taxeditor.ui.section.agent;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.agent.Institution;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
* @param conversation
* @param entity
*/
- public InstitutionWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, Institution entity) {
- super(formFactory, conversation, entity);
+ public InstitutionWizardPage(CdmFormFactory formFactory, Institution entity) {
+ super(formFactory, entity);
}
/*
public NomenclaturalTeamMemberElement(CdmFormFactory cdmFormFactory, AbstractFormSection section, Person entity,
SelectionListener removeListener, int style) {
super(cdmFormFactory, section, entity, removeListener, style);
-
+
}
@Override
public void createControls(ICdmFormElement element, int style) {
selection_person = formFactory
- .createSelectionElementWithAbbreviatedTitle(Person.class,getConversationHolder(),
+ .createSelectionElementWithAbbreviatedTitle(Person.class,
this, "Person", null,
EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE,
style);
*/
package eu.etaxonomy.taxeditor.ui.section.agent;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.eclipse.swt.SWT;
import eu.etaxonomy.cdm.model.agent.Person;
updateCacheRelevance();
updateToggleableCacheField();
}
+
+ @Override
+ public void fillFields() {
+ if (getEntity() != null) {
+ text_nomenclaturalTitle.setText(getEntity().getNomenclaturalTitle());
+ toggleable_cache.setText(getEntity().getTitleCache());
+ toggleable_cache.setCacheEnabled(getEntity().isProtectedTitleCache());
+ text_collectorTitle.setText(getEntity().getCollectorTitle());
+ text_firstname.setText(getEntity().getGivenName());
+ text_lastname.setText(getEntity().getFamilyName());
+ text_prefix.setText(getEntity().getPrefix());
+ text_suffix.setText(getEntity().getSuffix());
+ text_initials.setText(getEntity().getInitials());
+ time_lifespan.setTimePeriod(getEntity().getLifespan()!= null? getEntity().getLifespan(): null);
+ text_orcid.setText(getEntity().getOrcid() != null? getEntity().getOrcid().toString(): null);
+ text_lsid.setText(getEntity().getLsid()!= null? getEntity().getLsid().toString(): null);
+ }
+
+ }
}
\ No newline at end of file
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
*/
public class PersonDetailSection extends AbstractCdmDetailSection<Person>{
- public PersonDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
+ public PersonDetailSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
+ super(cdmFormFactory, parentElement, selectionProvider, style);
}
@Override
protected AbstractCdmDetailElement<Person> createCdmDetailElement(AbstractCdmDetailSection<Person> parentElement, int style) {
return formFactory.createPersonDetailElement(parentElement, style);
}
-
-
-}
+}
\ No newline at end of file
* 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.agent;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.swt.SWT;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
- * <p>PersonWizardPage class.</p>
- *
* @author n.hoffmann
* @created Jun 1, 2010
- * @version 1.0
*/
public class PersonWizardPage extends AbstractCdmEntityWizardPage<Person> {
- PersonDetailElement personElement;
-
+ private PersonDetailElement personElement;
- /**
- * <p>Constructor for PersonWizardPage.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param entity a {@link eu.etaxonomy.cdm.model.agent.Person} object.
- */
- public PersonWizardPage(CdmFormFactory formFactory, ConversationHolder conversation,
- Person entity) {
- super(formFactory, conversation, entity);
+ public PersonWizardPage(CdmFormFactory formFactory, Person entity) {
+ super(formFactory, entity);
setTitle("Person");
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.CdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
- */
- /** {@inheritDoc} */
@Override
public AbstractCdmDetailElement<Person> createElement(ICdmFormElement rootElement) {
personElement = formFactory.createPersonDetailElement(rootElement, SWT.NULL);
@Override
protected boolean titleCacheIsNotEmpty() {
- if (getEntity() instanceof AgentBase) {
- return !StringUtils.isEmpty(entity.getTitleCache());
- }
- return true;
+ return !StringUtils.isEmpty(entity.getTitleCache());
}
-}
+}
\ No newline at end of file
private TeamMemberSection section_teamMembers;
private boolean isNomenclaturalTeam;
private boolean isCollectorTeam;
-
+
/**
* Constructor for TeamDetailElement.
*/
"Collector Title", entity.getCollectorTitleCache(), entity.isProtectedCollectorTitleCache(),
CacheRelevance.CACHE2, style);
hasAdditionalMembers = formFactory.createCheckbox(formElement, "Additional Members", entity.isHasMoreMembers(), style);
- section_teamMembers = formFactory.createTeamMemberSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(TeamMemberSection.class, entity.getClass().getCanonicalName(), true), isNomenclaturalTeam, isCollectorTeam);
+ section_teamMembers = formFactory.createTeamMemberSection(formElement, StoreUtil.getSectionStyle(TeamMemberSection.class, entity.getClass().getCanonicalName(), true), isNomenclaturalTeam, isCollectorTeam);
section_teamMembers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
//cache relevance
public void setNomenclaturalTeam(boolean isNomenclaturalTeam) {
this.isNomenclaturalTeam = isNomenclaturalTeam;
}
+
+ @Override
+ public void fillFields() {
+ if (getEntity()!= null) {
+ toggleable_nomenclaturalTitleCache.setText(getEntity().getNomenclaturalTitleCache());
+ toggleable_collectorTitleCache.setText(getEntity().getCollectorTitleCache());
+ hasAdditionalMembers.setEnabled(getEntity().isHasMoreMembers());
+
+ section_teamMembers.setEntity(getEntity());
+
+ }
+
+ }
}
\ No newline at end of file
* 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.agent;
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.agent.Team;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
*
* @author n.hoffmann
* @created Mar 4, 2010
- * @version 1.0
*/
public class TeamDetailSection extends AbstractCdmDetailSection<Team>{
private boolean isNomenclaturalTeam;
private boolean isCollectorTeam;
-
+
/**
* <p>Constructor for TeamDetailSection.</p>
*
* @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
* @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
* @param style a int.
*/
- public TeamDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
+ public TeamDetailSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
+ super(cdmFormFactory, parentElement, selectionProvider, style);
}
- /** {@inheritDoc} */
@Override
public String getHeading() {
return "Team";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<Team> createCdmDetailElement(AbstractCdmDetailSection<Team> parentElement, int style) {
return formFactory.createTeamDetailElement(parentElement, style, isNomenclaturalTeam, isCollectorTeam);
public void setIsNomenclaturalTeam(boolean isNomenclaturalTeam){
this.isNomenclaturalTeam = isNomenclaturalTeam;
}
-
+
public boolean isCollectorTeam() {
return isCollectorTeam;
}
import org.eclipse.swt.graphics.Color;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.cdm.model.agent.Team;
import eu.etaxonomy.taxeditor.ui.dialog.selection.CollectorSelectionDialog;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
- * TeamMemberSection class.
- *
* @author n.hoffmann
* @created Apr 30, 2010
*/
private CacheRelevanceHelper cacheRelevanceHelper = new CacheRelevanceHelper();
- /**
- * <p>Constructor for TeamMemberSection.</p>
- *
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
- public TeamMemberSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style, boolean isNomenclatural, boolean isCollectorTeam) {
- super(cdmFormFactory, conversation, parentElement, null, style);
+ public TeamMemberSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, int style, boolean isNomenclatural, boolean isCollectorTeam) {
+ super(cdmFormFactory, parentElement, null, style);
isNomenclaturalTeam = isNomenclatural;
this.isCollectorTeam = isCollectorTeam;
}
* 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.agent;
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.cdm.model.agent.Team;
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
*
* @author n.hoffmann
* @created Apr 26, 2010
- * @version 1.0
*/
public class TeamOrPersonBaseDetailSection extends AbstractCdmDetailSection<TeamOrPersonBase> {
* <p>Constructor for TeamOrPersonBaseDetailSection.</p>
*
* @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
* @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
* @param style a int.
*/
- public TeamOrPersonBaseDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
- ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
- super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
+ public TeamOrPersonBaseDetailSection(CdmFormFactory cdmFormFactory,
+ ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+ super(cdmFormFactory, parentElement, selectionProvider, style);
}
- /** {@inheritDoc} */
@Override
public String getHeading() {
if (getEntity() != null){
//TODO DetailElement missing??
return null;
}
-}
+}
\ No newline at end of file
* 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.agent;
import org.eclipse.swt.SWT;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.agent.Team;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
- * <p>
- * TeamWizardPage class.
- * </p>
- *
* @author n.hoffmann
* @created Jun 1, 2010
- * @version 1.0
*/
public class TeamWizardPage extends AbstractCdmEntityWizardPage<Team> {
private boolean isNomenclaturalTeam = false;
private boolean isCollectorTeam = false;
- /**
- * <p>
- * Constructor for TeamWizardPage.
- * </p>
- *
- * @param formFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param conversation
- * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
- * object.
- * @param entity
- * a {@link eu.etaxonomy.cdm.model.agent.Team} object.
- */
- public TeamWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, Team entity, boolean isNomenclaturalTeam, boolean isCollectorTeam) {
- super(formFactory, conversation, entity);
+ public TeamWizardPage(CdmFormFactory formFactory, Team entity, boolean isNomenclaturalTeam, boolean isCollectorTeam) {
+ super(formFactory, entity);
setTitle("Team");
setIsNomenclaturalTeam(isNomenclaturalTeam);
setIsCollectorTeam(isCollectorTeam);
}
- /** {@inheritDoc} */
@Override
public AbstractCdmDetailElement<Team> createElement(
ICdmFormElement rootElement) {
return teamElement;
}
- /**
- * @return the isNomenclaturalTeam
- */
public boolean isNomenclaturalTeam() {
return isNomenclaturalTeam;
}
public void setIsNomenclaturalTeam(boolean isNomenclaturalTeam){
this.isNomenclaturalTeam = isNomenclaturalTeam;
}
-
+
public boolean isCollectorTeam() {
return isCollectorTeam;
}
public void setIsCollectorTeam(boolean isCollectorTeam){
this.isCollectorTeam = isCollectorTeam;
}
-}
+}
\ No newline at end of file
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
/**
* @author k.luther
* @date 23.03.2016
*
*/
-public abstract class AbstractEditWizard<T> extends Wizard implements
-INewWizard, IConversationEnabled{
-
- private ConversationHolder conversation;
+public abstract class AbstractEditWizard<T> extends Wizard implements INewWizard{
protected CdmFormFactory formFactory;
@Override
public boolean performFinish() {
saveEntity();
-
- conversation.commit();
- conversation.close();
return true;
}
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
formFactory = new CdmFormFactory(context.get(Shell.class).getDisplay());
- conversation = CdmStore.createConversation();
}
-
-
-
- /**
- * <p>getConversationHolder</p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
- /** {@inheritDoc} */
- @Override
- public void update(CdmDataChangeMap changeEvents) {}
+
}
* 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.classification;
import org.eclipse.swt.SWT;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
- * <p>
- * ClassificationDetailElement class.
- * </p>
- *
* @author n.hoffmann
* @created Sep 27, 2010
- * @version 1.0
*/
public class ClassificationDetailElement extends
AbstractCdmDetailElement<Classification> {
private GeoScopeDetailSection section_collectingAreas;
-
-
- /**
- * <p>
- * Constructor for ClassificationDetailElement.
- * </p>
- *
- * @param formFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param formElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- */
public ClassificationDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement) {
super(formFactory, formElement);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
- * (eu.etaxonomy.taxeditor.forms.ICdmFormElement,
- * eu.etaxonomy.cdm.model.common.IAnnotatableEntity, int)
- */
- /** {@inheritDoc} */
@Override
protected void createControls(ICdmFormElement formElement,
Classification entity, int style) {
text_treeLabel = formFactory.createTextWithLabelElement(formElement, "Label", entity != null ? entity.getName().getText() : null, SWT.NULL);
- selection_reference = formFactory.createSelectionElement(Reference.class, //getConversationHolder(),
+ selection_reference = formFactory.createSelectionElement(Reference.class,
formElement, "Reference",
entity != null ? entity.getReference() : null, EntitySelectionElement.ALL, SWT.NULL);
text_microReference = formFactory.createTextWithLabelElement(formElement, "Reference Detail",
entity != null ? entity.getMicroReference() : null, SWT.NULL);
element_date = formFactory.createTimePeriodElement(formElement, "Date",
entity != null ? entity.getTimeperiod() : null, style);
- section_collectingAreas = formFactory.createGeoScopeDetailSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(GeoScopeDetailSection.class, entity.getClass().getCanonicalName()));
+ section_collectingAreas = formFactory.createGeoScopeDetailSection(formElement, StoreUtil.getSectionStyle(GeoScopeDetailSection.class, entity.getClass().getCanonicalName()));
section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_collectingAreas.setEntity(entity);
-
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
- * .lang.Object)
- */
- /** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
if (eventSource == text_treeLabel) {
getEntity().setTimeperiod(element_date.getTimePeriod());
}
}
-}
+
+ @Override
+ public void fillFields() {
+ if (getEntity()!= null) {
+ text_treeLabel.setText(getEntity().getName().getText());
+ selection_reference.setEntity(getEntity().getReference());
+ text_microReference.setText(getEntity().getMicroReference());
+ element_date.setEntity(getEntity().getTimeperiod()!= null? getEntity().getTimeperiod(): null);;
+ section_collectingAreas.setEntity(getEntity());
+ }
+
+ }
+}
\ No newline at end of file
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
*
* @author n.hoffmann
* @created Sep 27, 2010
- * @version 1.0
*/
public class ClassificationDetailSection extends AbstractCdmDetailSection<Classification> {
* <p>Constructor for ClassificationDetailSection.</p>
*
* @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
* @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
* @param style a int.
*/
public ClassificationDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.IEnableableFormElement#setEnabled(boolean)
- */
- /** {@inheritDoc} */
@Override
public void setEnabled(boolean enabled) {
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
- /** {@inheritDoc} */
@Override
public String getHeading() {
return null;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<Classification> createCdmDetailElement(AbstractCdmDetailSection<Classification> parentElement, int style) {
return formFactory.createClassificationDetailElement(parentElement);
}
-}
+}
\ No newline at end of file
* 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.classification;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
- * <p>
- * ClassificationWizardPage class.
- * </p>
- *
* @author n.hoffmann
* @created 23.06.2009
- * @version 1.0
*/
public class ClassificationWizardPage extends
AbstractCdmEntityWizardPage<Classification> {
- /**
- * <p>
- * Constructor for ClassificationWizardPage.
- * </p>
- *
- * @param formFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param conversation
- * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
- * object.
- * @param entity
- * a {@link eu.etaxonomy.cdm.model.taxon.TaxonomicTree} object.
- */
public ClassificationWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, Classification entity) {
- super(formFactory, conversation, entity);
+ Classification entity) {
+ super(formFactory, entity);
setTitle("Classification");
-
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement
- * (eu.etaxonomy.taxeditor.forms.ICdmFormElement)
- */
- /** {@inheritDoc} */
@Override
public ClassificationDetailElement createElement(ICdmFormElement rootElement) {
ClassificationDetailElement detailElement = formFactory.createClassificationDetailElement(rootElement);
detailElement.setEntity(getEntity());
return detailElement;
}
-
-}
+}
\ No newline at end of file
* 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.classification;
import javax.inject.Inject;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.swt.widgets.Shell;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
/**
- *
* @author pplitzner
* @date Nov 6, 2016
- *
*/
-
public class CloneClassificationWizard extends Wizard{
private CloneClassificationWizardPage cloneClassificationWizardPage;
- private ConversationHolder conversationHolder;
-
private CdmFormFactory formFactory;
private String classificationName;
@Inject
public CloneClassificationWizard() {
super();
- conversationHolder = CdmStore.createConversation();
-
}
public void init(Classification classification){
formFactory = new CdmFormFactory(context.get(Shell.class).getDisplay());
- cloneClassificationWizardPage = new CloneClassificationWizardPage(formFactory, conversationHolder, classification);
+ cloneClassificationWizardPage = new CloneClassificationWizardPage(formFactory, classification);
addPage(cloneClassificationWizardPage);
}
-
@Override
public boolean canFinish() {
return cloneClassificationWizardPage.getClassificationName()!=null
return true;
}
-
public String getClassificationName(){
return classificationName;
}
public Reference getReference(){
return reference;
}
-
-}
+}
\ No newline at end of file
package eu.etaxonomy.taxeditor.ui.section.classification;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
private CloneClassificationDetailElement detailElement;
- public CloneClassificationWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, Classification entity) {
- super(formFactory, conversation, entity);
+ public CloneClassificationWizardPage(CdmFormFactory formFactory, Classification entity) {
+ super(formFactory, entity);
setTitle("Clone Classification");
}
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.persistence.dto.MergeResult;
+import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.newWizard.IWizardPageListener;
@Override
protected void saveEntity() {
- getConversationHolder().bind();
TaxonNode node = getEntity();
if (node.getSource().checkEmpty()){
node.setSource(null);
}
MergeResult result = CdmStore.getService(ITaxonNodeService.class).merge(node, true);
EventUtility.postEvent(WorkbenchEventConstants.REFRESH_NAME_EDITOR, node.getTaxon().getUuid());
+ EventUtility.postEvent(WorkbenchEventConstants.REFRESH_NAVIGATOR, new TaxonNodeDto(node.getParent()));
+
}
@Override
public void addPages() {
- taxonNodePage = new TaxonNodeWizardPage(formFactory, getConversationHolder(), getEntity(), wizardPageListener, false);
+ taxonNodePage = new TaxonNodeWizardPage(formFactory, getEntity(), wizardPageListener, false);
addPage(taxonNodePage);
}
import org.eclipse.swt.graphics.Color;
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
+import eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation;
import eu.etaxonomy.cdm.model.term.DefinedTerm;
import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation;
import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
combo_relationshipType.setSelection(entity.getType());
selection_toPerson.setEntity(entity.getAgent());
}
-
+
}
@Override
if (entity != null){
selection_toPerson = formFactory
.createSelectionElement(TeamOrPersonBase.class,
- //getConversationHolder(),
element, "Agent", entity.getAgent(),
EntitySelectionElement.ALL, style);
} else{
selection_toPerson = formFactory
.createSelectionElement(TeamOrPersonBase.class,
- //getConversationHolder(),
element, "Agent", null,
EntitySelectionElement.ALL, style);
}
import org.eclipse.ui.forms.widgets.TableWrapData;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
/**
* @author k.luther
* @date 22.03.2016
- *
*/
public class TaxonNodeAgentRelationCollectionSection extends AbstractEntityCollectionSection<TaxonNode, TaxonNodeAgentRelation> {
-
-
- public TaxonNodeAgentRelationCollectionSection (CdmFormFactory formFactory, ConversationHolder conversation,
+ public TaxonNodeAgentRelationCollectionSection (CdmFormFactory formFactory,
ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Related persons or teams", style);
-
+ super(formFactory, parentElement, "Related persons or teams", style);
}
@Override
@Override
public void addElement(TaxonNodeAgentRelation element) {
-
-
}
@Override
return false;
}
- /**
- * {@inheritDoc}
- */
@Override
public TaxonNodeAgentRelation addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
- /**
- * @param i
- */
public void setIndent(int i) {
TableWrapData tableWrapData = (TableWrapData)getLayoutData();
if (tableWrapData == null){
}
tableWrapData.indent = i;
setLayoutData(tableWrapData);
-
}
-
-}
+}
\ No newline at end of file
textNewTaxonName.setIndent(10);
selection_reuseExistingTaxon = formFactory
- .createSelectionElement(Taxon.class,//getConversationHolder(),
+ .createSelectionElement(Taxon.class,
formElement,
REUSE_EXISTING_TAXON, null,
EntitySelectionElement.SELECTABLE, style);
selection_reuseExistingTaxon.setIndent(10);
selection_reuseExistingName = formFactory
- .createSelectionElement(TaxonName.class,//getConversationHolder(),
+ .createSelectionElement(TaxonName.class,
formElement,
REUSE_EXISTING_NAME, taxon != null? taxon.getName(): null,
EntitySelectionElement.DELETABLE, style);
selection_reuseExistingName.setIndent(10);
selection_SecRef = formFactory
- .createSelectionElement(Reference.class,//getConversationHolder(),
+ .createSelectionElement(Reference.class,
formElement, SECUNDUM_REFERENCE, taxon != null? taxon.getSec(): null,
EntitySelectionElement.DELETABLE, style, 100);
selection_SecRef.setIndent(10);
// nodeTitle.setBold();
selection_parentTaxonNode = formFactory
- .createTaxonNodeSelectionElement(getConversationHolder(), formElement, Messages.TaxonNodeWizardPage_PARENT, parentNode,
+ .createTaxonNodeSelectionElement(formElement, Messages.TaxonNodeWizardPage_PARENT, parentNode,
EntitySelectionElement.SELECTABLE, style, 100);
selection_parentTaxonNode.setIndent(10);
selection_parentTaxonNode.setEnabled(false);
setSourceLabel(Messages.TaxonNodeWizardPage_PLACEMENT_SOURCE);
- selectionNodeAgentRelation = formFactory.createTaxonNodeAgentRelationCollectionSection(formElement, getConversationHolder(), StoreUtil.getSectionStyle(TaxonNodeAgentRelationCollectionSection.class, entity.getClass().getCanonicalName()));
+ selectionNodeAgentRelation = formFactory.createTaxonNodeAgentRelationCollectionSection(formElement, StoreUtil.getSectionStyle(TaxonNodeAgentRelationCollectionSection.class, entity.getClass().getCanonicalName()));
selectionNodeAgentRelation.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
selectionNodeAgentRelation.setEntity(entity);
selectionNodeAgentRelation.setIndent(10);
}
}
if (checkbox_publish != null){
- checkbox_publish.setSelected(getTaxon().isPublish());
+ checkbox_publish.setSelection(getTaxon().isPublish());
}
}else{
if (isCreateNew()){
// TODO Auto-generated method stub
return null;
}
+
+ @Override
+ public void fillFields() {
+ if (getEntity()!= null) {
+ if (selection_parentTaxonNode!= null) {
+ selection_parentTaxonNode.setEntity(getEntity().getParent());
+ }
+ if (selection_reuseExistingTaxon != null) {
+ selection_reuseExistingTaxon.setEntity(getEntity().getTaxon());
+ }
+ if (selection_reuseExistingName!= null) {
+ selection_reuseExistingName.setEntity(getEntity().getTaxon() != null?getEntity().getTaxon().getName(): null);
+ }
+ if (selection_SecRef != null) {
+ selection_SecRef.setEntity(getEntity().getTaxon() != null?getEntity().getTaxon().getSec(): null);
+ }else {
+ textTaxonSec.setText(getEntity().getTaxon() != null?getEntity().getTaxon().getSec().getTitle():null);
+ }
+ microReference.setText(getEntity().getTaxon() != null? getEntity().getTaxon().getSecMicroReference(): null);
+ textNewTaxonName.setText(getEntity().getTaxon() != null? getEntity().getTaxon().getName().getTitleCache():null);
+ selectionNodeAgentRelation.setEntity(getEntity());
+ combo_status.setSelection(getEntity().getStatus());
+ this.set_publish(taxon.isPublish());
+ multiLanguageTextPlacementNotes.setMultilanguageText(getEntity().getStatusNote());
+ }
+
+ }
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
* <p>Constructor for TaxonNodeDetailSection.</p>
*
* @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
* @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
* @param style a int.
*/
public TaxonNodeDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
- /** {@inheritDoc} */
@Override
public String getHeading() {
return null;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.dto.CreateTaxonDTO;
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.taxon.Taxon;
private final boolean isCreateNew;
public TaxonNodeWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, TaxonNode entity, IWizardPageListener closeOnEnterListener, boolean isCreateNew) {
- super(formFactory, conversation, entity);
+ TaxonNode entity, IWizardPageListener closeOnEnterListener, boolean isCreateNew) {
+ super(formFactory, entity);
this.wizardPageListener = closeOnEnterListener;
if (isCreateNew){
import org.eclipse.ui.forms.widgets.TableWrapData;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.common.URI;
import eu.etaxonomy.cdm.model.media.ExternalLink;
import eu.etaxonomy.cdm.model.media.ExternalLinkType;
private boolean isShowDescription = true;
- public ExternalLinksSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(cdmFormFactory, conversation, parentElement, "External Links", style);
+ public ExternalLinksSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, int style) {
+ super(cdmFormFactory, parentElement, "External Links", style);
}
- public ExternalLinksSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
+ public ExternalLinksSection(CdmFormFactory cdmFormFactory,
ICdmFormElement parentElement, boolean isAdvanced, String string, int style) {
- super(cdmFormFactory, conversation, parentElement, string, style);
+ super(cdmFormFactory, parentElement, string, style);
this.isShowDescription = isAdvanced;
}
protected void createControls(ICdmFormElement formElement,
SingleSourcedEntityBase entity, int style) {
selection_reference = formFactory
- .createSelectionElement(Reference.class,//getConversationHolder(),
+ .createSelectionElement(Reference.class,
formElement, "Reference",
entity.getCitation(),
EntitySelectionElement.ALL, style);
}
}
+ @Override
+ public void fillFields() {
+ selection_reference.setEntity(getEntity().getCitation());
+ text_referenceDetail.setText(getEntity().getCitationMicroReference());
+
+ }
+
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.SingleSourcedEntityBase;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
public class ReferencedEntityDetailSection extends AbstractCdmDetailSection<SingleSourcedEntityBase>{
public ReferencedEntityDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
@Override
public void createControls(ICdmFormElement element, int style) {
selection_derivedUnit = formFactory.createSelectionElement(
- DerivedUnit.class, //getConversationHolder(),
+ DerivedUnit.class,
element, "Specimen", null,
EntitySelectionElement.SELECTABLE | EntitySelectionElement.EDITABLE,
style);
* 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.description;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- * <p>DescribedSpecimenSection class.</p>
- *
* @author n.hoffmann
* @created Sep 16, 2010
- * @version 1.0
*/
public class DescribedSpecimenSection extends AbstractEntityCollectionSection<TaxonDescription, SpecimenOrObservationBase> {
- /**
- * <p>Constructor for DescribedSpecimenSection.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
public DescribedSpecimenSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
int style) {
- super(formFactory, conversation, parentElement, "Described Specimen", style);
+ super(formFactory, parentElement, "Described Specimen", style);
}
- /** {@inheritDoc} */
@Override
public Collection<SpecimenOrObservationBase> getCollection(
TaxonDescription entity) {
return new DefaultCdmBaseComparator<>();
}
- /** {@inheritDoc} */
@Override
public SpecimenOrObservationBase createNewElement() {
- DerivedUnit selection = DerivedUnitSelectionDialog.select(getShell(), //getConversationHolder(),
+ DerivedUnit selection = DerivedUnitSelectionDialog.select(getShell(),
null);
return selection;
}
- /** {@inheritDoc} */
@Override
public void addElement(SpecimenOrObservationBase element) {
getEntity().setDescribedSpecimenOrObservation(element);
}
- /** {@inheritDoc} */
@Override
public void removeElement(SpecimenOrObservationBase element) {
getEntity().setDescribedSpecimenOrObservation(null);
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No described specimen yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a described specimen.";
}
- /**
- * {@inheritDoc}
- */
@Override
public SpecimenOrObservationBase addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-}
+}
\ No newline at end of file
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptionType;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
// private EntitySelectionElement<FeatureTree> selection_featureTree;
private TextWithLabelElement txtDescriptionTypes;
+ private CheckboxElement isPublish;
public DescriptionDetailElement(CdmFormFactory cdmFormFactory,
ICdmFormElement formElement, int style) {
// Since descriptiveSystem is a Set of Features that are present or allowed for the current description,
// it is similar to a FeatureTree (you can get this information from a feature tree) but not the same.
// Please correct this once it is clear what descriptive system will be used for in CDM
-// selection_featureTree = formFactory.createSelectionElement(FeatureTree.class, getConversationHolder(), formElement, "Feature Tree", null, EntitySelectionElement.ALL, style);
+// selection_featureTree = formFactory.createSelectionElement(FeatureTree.class, formElement, "Feature Tree", null, EntitySelectionElement.ALL, style);
Object typesString = entity.getTypes().stream().filter(type->type instanceof DescriptionType)
.map(type->((DescriptionType)type).getLabel())
.collect(Collectors.joining(","));
txtDescriptionTypes = formFactory.createTextWithLabelElement(formElement, "Types", typesString, style);
txtDescriptionTypes.setEnabled(false);
-
+ isPublish = formFactory.createCheckbox(formElement, "Publish", entity.isPublish(), style);
+
}
@Override
getEntity().setTitleCache(toggleable_cache.getText(), toggleable_cache.getState());
updateCacheRelevance();
}
+ if (eventSource == isPublish) {
+ getEntity().setPublish(isPublish.getSelection());
+ }
+
}
* 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.description;
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
/**
- * <p>DescriptionDetailSection class.</p>
- *
* @author n.hoffmann
* @created Mar 5, 2010
*/
public class DescriptionDetailSection extends AbstractCdmDetailSection<DescriptionBase<?>> {
- /**
- * <p>Constructor for DescriptionDetailSection.</p>
- *
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
- * @param style a int.
- */
- public DescriptionDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
+ public DescriptionDetailSection(CdmFormFactory cdmFormFactory,
ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
- super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
-
+ super(cdmFormFactory, parentElement, selectionProvider, style);
}
@Override
this.getDetailElement().setEnabled(false);
}
}
-}
+}
\ No newline at end of file
}
setEnabled(enabled, except);
}
+
+ @Override
+ public void fillFields() {
+ // TODO actually not used
+
+ }
}
* 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.description;
import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Control;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.TextData;
import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
import eu.etaxonomy.taxeditor.ui.section.description.operation.ChangeDescriptionElementType;
import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
*
* @author n.hoffmann
* @created Mar 5, 2010
- * @version 1.0
*/
public class DescriptionElementDetailSection extends
AbstractCdmDetailSection<DescriptionElementBase> {
-
- /**
- * <p>Constructor for DescriptionElementDetailSection.</p>
- *
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
- * @param style a int.
- */
- public DescriptionElementDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
+ public DescriptionElementDetailSection(CdmFormFactory cdmFormFactory,
ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
- super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
+ super(cdmFormFactory, parentElement, selectionProvider, style);
}
-
@Override
protected Control createToolbar() {
final String label = "Change to " + destinationString;
Action addAction = new Action("Change Type", IAction.AS_PUSH_BUTTON) {
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
+
@Override
public void run() {
boolean confirmed = MessagingUtils.confirmDialog("Confirmation", "Do you really want to change to "
return toolBarManager.createControl(this);
}
- /** {@inheritDoc} */
@Override
public String getHeading() {
return "Description Element";
}
- /** {@inheritDoc} */
@Override
protected void setSectionTitle() {
this.setText(getHeading() + ": " + getEntity().getFeature().getPreferredRepresentation(CdmStore.getDefaultLanguage()));
return count > 1;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<DescriptionElementBase> createCdmDetailElement(AbstractCdmDetailSection<DescriptionElementBase> parentElement, int style) {
return formFactory.createDescriptionElementDetailElement(parentElement, style);
isEnabled = false;
}
setEnabled(isEnabled);
-
}
-
-
-}
+}
\ No newline at end of file
* 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.description;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- * <p>DescriptionElementMediaSection class.</p>
- *
* @author n.hoffmann
* @created Mar 18, 2010
- * @version 1.0
*/
public class DescriptionElementMediaSection extends
AbstractEntityCollectionSection<DescriptionElementBase, Media> {
- public DescriptionElementMediaSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
+ public DescriptionElementMediaSection(CdmFormFactory cdmFormFactory,
ICdmFormElement parentElement, int style) {
- super(cdmFormFactory, conversation, parentElement, "Media", style);
+ super(cdmFormFactory, parentElement, "Media", style);
}
- /** {@inheritDoc} */
@Override
public void setEntity(DescriptionElementBase entity) {
if(entity.getFeature().equals(Feature.IMAGE())){
}
}
- /** {@inheritDoc} */
@Override
public void addElement(Media element) {
getEntity().addMedia(element);
}
- /** {@inheritDoc} */
@Override
public Media createNewElement() {
return Media.NewInstance();
}
- /** {@inheritDoc} */
@Override
public Collection<Media> getCollection(DescriptionElementBase entity) {
return entity.getMedia();
return new DefaultCdmBaseComparator<>();
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No media yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Create new media";
}
- /** {@inheritDoc} */
@Override
public void removeElement(Media element) {
getEntity().removeMedia(element);
}
- /**
- * {@inheritDoc}
- */
@Override
public Media addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-
-
-}
+}
\ No newline at end of file
*/
package eu.etaxonomy.taxeditor.ui.section.description;
+import java.util.Iterator;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Control;
import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
+import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
import eu.etaxonomy.taxeditor.ui.section.common.ExternalLinksSection;
+import eu.etaxonomy.taxeditor.ui.section.reference.OriginalSourceElement;
import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractOriginalSourceElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
.createSelectionElement(TaxonName.class,
formElement, "Name in Source",
null, EntitySelectionElement.ALL, SWT.NULL);
-
- externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
+
+ externalLinks = formFactory.createExternalLinksSection(formElement, StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
if (getEntity() != null){
setEntity(entity);
@Override
public void setEntity(DescriptionElementSource entity) {
super.setEntity(entity);
- if (selection_reference != null){
+ if (selection_reference != null ){
if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSource.getKey())){
text_idInSource.setText(entity.getIdInSource());
}
text_referenceDetail.setText(entity.getCitationMicroReference());
text_originalInfo.setText(entity.getOriginalInfo());
selection_name.setEntity(entity.getNameUsedInSource());
+
combo_origsourcetype.setSelection(entity.getType());
externalLinks.setEntity(entity);
}
+ if (selection_specimen != null) {
+ selection_specimen.setEnabled(selection_reference.getEntity()== null);
+ selection_reference.setEnabled(selection_specimen.getEntity()== null);
+ }
}
@Override
super.handleEvent(eventSource);
if (eventSource == selection_name) {
getEntity().setNameUsedInSource(selection_name.getSelection());
+
+ }
+ if (eventSource == selection_specimen) {
+ getEntity().setSpecimen(selection_specimen.getSelection());
+ this.selection_reference.setEnabled(selection_specimen.getSelection() == null);
+ }
+ if (eventSource == selection_reference) {
+
+ this.selection_specimen.setEnabled(selection_reference.getSelection() == null);
}
}
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
externalLinks.setEnabled(isEnabled);
+ if (selection_specimen != null) {
+ selection_specimen.setEnabled(selection_reference.getEntity()== null);
+ selection_reference.setEnabled(selection_specimen.getEntity()== null);
+ }
}
+
}
\ No newline at end of file
import java.util.HashSet;
import java.util.List;
-import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
- * DescriptionElementSourceSection class.
- *
* @author n.hoffmann
* @created Nov 17, 2009
*/
private Reference defaultSource;
- public DescriptionElementSourceSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
+ public DescriptionElementSourceSection(CdmFormFactory cdmFormFactory,
ICdmFormElement parentElement, int style) {
- super(cdmFormFactory, conversation, parentElement, "Sources", style);
+ super(cdmFormFactory, parentElement, "Sources", style);
}
- public DescriptionElementSourceSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
+ public DescriptionElementSourceSection(CdmFormFactory cdmFormFactory,
ICdmFormElement parentElement, Reference defaultSource, int style) {
- super(cdmFormFactory, conversation, parentElement, "Sources", style);
+ super(cdmFormFactory, parentElement, "Sources", style);
this.defaultSource = defaultSource;
}
}
@Override
protected void renderContent(boolean forceExpansion){
-
+
Collection<OriginalSourceBase> collectionElement = getCollectionElement(getEntity());
Collection<OriginalSourceBase> collectionDescription = getCollectionDescription(getEntity());
}
this.setExpanded(forceExpansion);
-
-
-
+
+
+
if(collectionDescription != null && !collectionDescription.isEmpty()){
List<OriginalSourceBase> elements = new ArrayList<>(collectionDescription);
Collections.sort(elements, getComparator());
- createDynamicContentsDisabled(elements);
+ createDynamicContentsDisabled(elements);
forceExpansion = true;
}
}
public Collection<OriginalSourceBase> getCollectionElement(DescriptionElementBase entity) {
Collection<OriginalSourceBase> sources = new HashSet<>();
- sources.addAll(entity.getSources());
+ if (entity != null) {
+ sources.addAll(entity.getSources());
+ }
// sources.addAll(entity.getInDescription().getSources());
return sources;
sources.addAll(entity.getSources());
sources.addAll(entity.getInDescription().getSources());
return sources;
-
+
}
-
-
+
+
private void createDynamicContentsDisabled(Collection<OriginalSourceBase> elements)
{
int i = 0;
* 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.description;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
-import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
+import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- * <p>DescriptionSourceSection class.</p>
- *
* @author n.hoffmann
* @created Mar 18, 2010
- * @version 1.0
*/
public class DescriptionSourceSection extends
AbstractEntityCollectionSection<DescriptionBase, IdentifiableSource>{
- /**
- * <p>Constructor for DescriptionSourceSection.</p>
- *
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
- public DescriptionSourceSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
+ public DescriptionSourceSection(CdmFormFactory cdmFormFactory,
ICdmFormElement parentElement, int style) {
- super(cdmFormFactory, conversation, parentElement, "Sources", style);
+ super(cdmFormFactory, parentElement, "Sources", style);
}
-
-
- /** {@inheritDoc} */
@Override
public void addElement(IdentifiableSource element) {
getEntity().addSource(element);
}
- /** {@inheritDoc} */
@Override
public IdentifiableSource createNewElement() {
OriginalSourceType ost = OriginalSourceType.PrimaryTaxonomicSource;
return IdentifiableSource.NewInstance(ost);
-
}
- /** {@inheritDoc} */
@Override
public Collection<IdentifiableSource> getCollection(DescriptionBase entity) {
return entity.getSources();
return new DefaultCdmBaseComparator<>();
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No description sources yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a reference as source for this description";
}
- /** {@inheritDoc} */
@Override
public void removeElement(IdentifiableSource element) {
getEntity().removeSource(element);
}
-
-
- /**
- * {@inheritDoc}
- */
@Override
public IdentifiableSource addExisting() {
return null;
}
-
-
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-}
+}
\ No newline at end of file
* 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.description;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- * <p>GeoScopeSection class.</p>
- *
* @author n.hoffmann
* @created Sep 17, 2010
- * @version 1.0
*/
public class GeoScopeSection extends AbstractEntityCollectionSection<TaxonDescription, NamedArea> {
- /**
- * <p>Constructor for GeoScopeSection.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
public GeoScopeSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Geo Scope", style);
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Geo Scope", style);
}
- /** {@inheritDoc} */
@Override
public Collection<NamedArea> getCollection(TaxonDescription entity) {
return entity.getGeoScopes();
return new DefaultCdmBaseComparator<>();
}
- /** {@inheritDoc} */
@Override
public NamedArea createNewElement() {
return NamedArea.NewInstance();
}
- /** {@inheritDoc} */
@Override
public void addElement(NamedArea element) {
getEntity().addGeoScope(element);
}
- /** {@inheritDoc} */
@Override
public void removeElement(NamedArea element) {
getEntity().removeGeoScope(element);
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No geo scopes yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a new geo scope.";
}
- /**
- * {@inheritDoc}
- */
@Override
public NamedArea addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-}
+}
\ No newline at end of file
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.media.MediaViewSwitch;
/**
- * MediaDetailsSection class.
- *
* @author n.hoffmann
* @created Jun 15, 2010
*/
private MediaMetaElement mediaMetaElement;
- public MediaDetailsSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ public MediaDetailsSection(CdmFormFactory formFactory,
ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
package eu.etaxonomy.taxeditor.ui.section.description;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.swt.events.SelectionListener;
+import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.cdm.model.description.IModifiable;
import eu.etaxonomy.cdm.model.description.StateData;
import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
import eu.etaxonomy.cdm.model.term.DefinedTerm;
+import eu.etaxonomy.cdm.model.term.TermCollection;
import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
+import eu.etaxonomy.taxeditor.model.DefaultTermComparator;
import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
@Override
public void setEntity(DefinedTerm entity) {
this.entity = entity;
- if (combo_modifier != null){
- if(getParentElement() instanceof ModifierSection){
- ModifierSection parentSection = (ModifierSection) getParentElement();
- List<DefinedTerm> modifierTerms = new ArrayList<DefinedTerm>();
- Set<TermVocabulary<DefinedTerm>> recommendedModifierEnumeration = new HashSet<TermVocabulary<DefinedTerm>>();
- if(parentSection.getEntity() instanceof StateData){
- StateData stateData = (StateData) parentSection.getEntity();
- recommendedModifierEnumeration = stateData.getCategoricalData().getFeature().getRecommendedModifierEnumeration();
- }else if(parentSection.getEntity() instanceof StatisticalMeasurementValue){
- StatisticalMeasurementValue statisticalMeasurementValue = (StatisticalMeasurementValue)parentSection.getEntity();
- recommendedModifierEnumeration = statisticalMeasurementValue.getQuantitativeData().getFeature().getRecommendedModifierEnumeration();
- }
- if (!(parentSection.getParentElement() instanceof DescriptionElementBase) && parentSection.getEntity() instanceof DescriptionElementBase){
- DescriptionElementBase element = (DescriptionElementBase) parentSection.getEntity();
- recommendedModifierEnumeration = element.getFeature().getRecommendedModifierEnumeration();
-
- }
-
- for (TermVocabulary<DefinedTerm> termVocabulary : recommendedModifierEnumeration) {
- modifierTerms.addAll(termVocabulary.getTerms());
- }
- combo_modifier.setTerms(modifierTerms);
- }
- if(entity!=null && entity.getId()>0){
- combo_modifier.setSelection(entity);
- combo_modifier.removeEmptyElement();
- }
- }
}
@Override
public void createControls(ICdmFormElement element, int style) {
- combo_modifier = formFactory.createDefinedTermComboElement(TermType.Modifier, element, "Modifier", getEntity(), style);
+ ICdmFormElement parent = getParentElement();
+ Set<TermCollection<DefinedTerm, ?>> recommendedModifiers = null;
+ if (parent instanceof ModifierSection){
+ IModifiable modifiableEntity = ((ModifierSection)parent).getEntity();
+ if (modifiableEntity.isInstanceOf(StateData.class)){
+ StateData stateData = CdmBase.deproxy(modifiableEntity, StateData.class);
+ recommendedModifiers = stateData.getCategoricalData().getFeature().getRecommendedModifierEnumeration();
+ }
+ }
+ String labelString = "Modifier";
+ if (recommendedModifiers != null){
+ //TODO is there already a method somewhere that creates such a list
+ Set<DefinedTerm> terms = new HashSet<>();
+ for (TermCollection<DefinedTerm, ?> collection: recommendedModifiers){
+ terms.addAll(collection.getDistinctTerms());
+ }
+ List<DefinedTerm> termList = new ArrayList<>(terms);
+ Collections.sort(termList, new DefaultTermComparator<>());
+ if (getEntity() == null) {
+ combo_modifier = formFactory.createDefinedTermComboElement(termList, element, labelString, getEntity(), true, style);
+ }else {
+ combo_modifier = formFactory.createDefinedTermComboElement(termList, element, labelString, getEntity(), false, style);
+ }
+ }else{
+ if (getEntity() == null) {
+ combo_modifier = formFactory.createDefinedTermComboElement(TermType.Modifier, element, labelString, getEntity(), true, style);
+ }else {
+ combo_modifier = formFactory.createDefinedTermComboElement(TermType.Modifier, element, labelString, getEntity(), false, style);
+ }
+ }
}
@Override
* 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.description;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.model.term.DefinedTerm;
import eu.etaxonomy.cdm.model.description.IModifiable;
+import eu.etaxonomy.cdm.model.term.DefinedTerm;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
/**
- * <p>ModifierSection class.</p>
- *
* @author n.hoffmann
* @created Sep 15, 2010
- * @version 1.0
*/
public class ModifierSection extends AbstractUnboundEntityCollectionSection<IModifiable, DefinedTerm> {
- /**
- * <p>Constructor for ModifierSection.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
public ModifierSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
int style) {
- super(formFactory, conversation, parentElement, "Modifiers", style);
+ super(formFactory, parentElement, "Modifiers", style);
}
- /** {@inheritDoc} */
@Override
public DefinedTerm createNewElement() {
return null;
}
- /** {@inheritDoc} */
@Override
public void addElement(DefinedTerm element) {
getEntity().addModifier(element);
}
- /** {@inheritDoc} */
@Override
public void removeElement(DefinedTerm element) {
getEntity().removeModifier(element);
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No modifiers yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a modifier.";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection#getEntityCollection(java.lang.Object)
- */
@Override
protected Collection<DefinedTerm> getEntityCollection(IModifiable entity) {
return entity.getModifiers();
return new DefaultCdmBaseComparator<>();
}
- /**
- * {@inheritDoc}
- */
@Override
public DefinedTerm addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-}
+}
\ No newline at end of file
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
- * <p>NaturalLanguageDetailElement class.</p>
- *
* @author n.hoffmann
* @created Sep 16, 2010
*/
public class NaturalLanguageDetailElement extends AbstractCdmDetailElement<TaxonDescription> {
- private static final Logger logger = LogManager.getLogger(NaturalLanguageDetailElement.class);
+ private static final Logger logger = LogManager.getLogger();
private LabelElement label;
}
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
- */
- /** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
// nothing gets edited, nothing gets updated
String text = "";
if(featureTree != null){
- CdmStore.createConversation();
try{
List<TextData> naturalLanguageDescription = generator.generateNaturalLanguageDescription(featureTree, entity, CdmStore.getDefaultLanguage());
}
}
+
+ @Override
+ public void fillFields() {
+ if(getEntity().hasStructuredData()){
+ FetchNaturalLanguageDescriptionJob job = new FetchNaturalLanguageDescriptionJob("Retrieving Natural Language Description", getEntity());
+ job.schedule();
+ }else{
+ label.setText("Taxon Description does not contain structured data.");
+ }
+
+ }
}
* 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.description;
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
/**
- * <p>NaturalLanguageSection class.</p>
- *
* @author n.hoffmann
* @created Sep 16, 2010
- * @version 1.0
*/
public class NaturalLanguageSection extends AbstractCdmDetailSection<TaxonDescription> {
* <p>Constructor for NaturalLanguageSection.</p>
*
* @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
* @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
* @param style a int.
*/
public NaturalLanguageSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
- /** {@inheritDoc} */
@Override
public String getHeading() {
return "Natural Language Description";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<TaxonDescription> createCdmDetailElement(AbstractCdmDetailSection<TaxonDescription> parentElement, int style) {
return formFactory.createNaturalLanguageDetailElement(parentElement);
}
-}
+}
\ No newline at end of file
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.cdm.model.term.DefinedTerm;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
/**
- * <p>ScopeSection class.</p>
- *
* @author n.hoffmann
* @created Mar 18, 2010
- * @version 1.0
*/
public class ScopeSection extends AbstractUnboundEntityCollectionSection<TaxonDescription, DefinedTerm> {
- /**
- * <p>Constructor for ScopeSection.</p>
- *
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
- public ScopeSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(cdmFormFactory, conversation, parentElement, "Scope", style);
+ public ScopeSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, int style) {
+ super(cdmFormFactory, parentElement, "Scope", style);
}
@Override
getEntity().addScope(element);
}
- /** {@inheritDoc} */
@Override
public DefinedTerm createNewElement() {
return null;
}
// the newly created should always be on top
- if (!o1.isPersited() && o2.isPersited()) {
+ if (!o1.isPersisted() && o2.isPersisted()) {
return -1;
- } else if(o1.isPersited() && !o2.isPersited()){
+ } else if(o1.isPersisted() && !o2.isPersisted()){
return 1;
}
import java.util.List;
import java.util.Set;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
+import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.common.LanguageString;
-import eu.etaxonomy.cdm.model.description.State;
import eu.etaxonomy.cdm.model.description.StateData;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.model.term.DefinedTermBase;
+import eu.etaxonomy.cdm.model.term.TermCollection;
import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.StoreUtil;
*/
public class StateDataElement extends AbstractEntityCollectionElement<StateData> {
- private TermComboElement<State> combo_state;
- private ModifierSection section_modifiers;
- private TextWithLabelElement text_modifyingText;
+ private TermComboElement<DefinedTermBase<?>> combo_state;
+ private ModifierSection section_modifiers;
+ private TextWithLabelElement text_modifyingText;
- public StateDataElement(CdmFormFactory formFactory,
- AbstractFormSection section, StateData entity,
- SelectionListener removeListener, int style) {
- super(formFactory, section, entity, removeListener, null, style);
- }
+ public StateDataElement(CdmFormFactory formFactory, AbstractFormSection<?> section, StateData entity,
+ SelectionListener removeListener, int style) {
+ super(formFactory, section, entity, removeListener, null, style);
+ }
- @Override
- public void setEntity(StateData entity) {
- this.entity = entity;
- if (combo_state != null){
-
- combo_state.setSelection(entity.getState());
- if (section_modifiers != null){
- section_modifiers.setEntity(entity);
- section_modifiers.setExpanded(!entity.getModifiers().isEmpty());
- }
- if(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()) != null && text_modifyingText != null) {
- text_modifyingText.setText(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()).getText());
- }
- if(getEntity().getId()>0){
- combo_state.removeEmptyElement();
- }
- }
- }
+ @Override
+ public void setEntity(StateData entity) {
+ this.entity = entity;
+ if (combo_state != null) {
- @Override
- public void createControls(ICdmFormElement element, int style) {
- if (getEntity() != null){
- List<State> stateTerms = new ArrayList<>();
- Set<TermVocabulary<State>> stateVocabularies = getEntity().getCategoricalData().getFeature().getSupportedCategoricalEnumerations();
- for (TermVocabulary<State> termVocabulary : stateVocabularies) {
- stateTerms.addAll(termVocabulary.getTerms());
- }
- combo_state = formFactory.createDefinedTermComboElement(stateTerms, element, "State", null, style);
- }else{
- combo_state = formFactory.createDefinedTermComboElement(TermType.State, element, "State", null, style);
- }
-// combo_state.setTermComparator(new DefaultTermComparator<State>());
- if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowModifier.getKey())){
- section_modifiers = formFactory.createModifierSection(getConversationHolder(), element, StoreUtil.getSectionStyle(ModifierSection.class, StateData.class.getCanonicalName(), true));
- section_modifiers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- }
- if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowModifierFreeText.getKey())){
- text_modifyingText = formFactory.createTextWithLabelElement(element, "Modifying Text", null, style);
- }
- if (entity != null){
- setEntity(entity);
- }
+ combo_state.setSelection(entity.getState());
+ if (section_modifiers != null) {
+ section_modifiers.setEntity(entity);
+ section_modifiers.setExpanded(!entity.getModifiers().isEmpty());
+ }
+ if (getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()) != null
+ && text_modifyingText != null) {
+ text_modifyingText.setText(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()).getText());
+ }
+ if (getEntity().getId() > 0) {
+ combo_state.removeEmptyElement();
+ }
+ }
+ }
- }
+ @Override
+ public void createControls(ICdmFormElement element, int style) {
+ if (getEntity() != null) {
+ List<DefinedTermBase<?>> stateTerms = new ArrayList<>();
+ Set<TermCollection<?, ?>> recommendedStateCollections = getEntity().getCategoricalData().getFeature()
+ .getSupportedCategoricalEnumerations();
+ for (TermCollection<?, ?> stateCollection : recommendedStateCollections) {
+ stateTerms.addAll((Set) stateCollection.getDistinctTerms());
+ }
+ // stateTerms.add(null)
+ combo_state = formFactory.createDefinedTermComboElement(stateTerms, element, "State", null, style);
+ } else {
+ combo_state = formFactory.createDefinedTermComboElement(TermType.State, element, "State", null, style);
+ }
+ // combo_state.setTermComparator(new DefaultTermComparator<State>());
- @Override
- public void handleEvent(Object eventSource) {
- if(eventSource == combo_state){
- getEntity().setState(combo_state.getSelection());
- combo_state.removeEmptyElement();
- }
- if(eventSource == text_modifyingText){
- getEntity().putModifyingText(LanguageString.NewInstance(text_modifyingText.getText(), CdmStore.getDefaultLanguage()));
- }
- }
+ if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowModifier.getKey()) && (!CdmUtils.isNullSafeEmpty(entity.getCategoricalData().getFeature().getRecommendedModifierEnumeration()))) {
+ section_modifiers = formFactory.createModifierSection(element,
+ StoreUtil.getSectionStyle(ModifierSection.class, StateData.class.getCanonicalName(), true));
+ section_modifiers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ }else if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowModifier.getKey()) && CdmUtils.isNullSafeEmpty(entity.getCategoricalData().getFeature().getRecommendedModifierEnumeration()) && !CdmUtils.isNullSafeEmpty(entity.getModifiers())) {
+ List<DefinedTermBase> terms = new ArrayList<>();
+ terms.addAll(entity.getModifiers());
+ for(DefinedTermBase term: terms) {
+ List<DefinedTermBase> termList = new ArrayList<>();
+ termList.add(term);
+ TermComboElement<DefinedTermBase> combo_modifier= formFactory.createDefinedTermComboElement(termList, element, "Modifier", term, style);
+ combo_modifier.addSelectionListener(new SelectionListener() {
- @Override
- public void setEnabled(boolean enable){
- if (combo_state != null){
- combo_state.setEnabled(enable);
- }
- if (section_modifiers != null){
- section_modifiers.setEnabled(enable);
- }
- if (text_modifyingText != null){
- text_modifyingText.setEnabled(enable);
- }
- super.setEnabled(enable);
- }
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (combo_modifier.getSelection() == null) {
+ getEntity().getModifiers().remove(term);
+ }
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ }
+ }
+ if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowModifierFreeText.getKey())) {
+ text_modifyingText = formFactory.createTextWithLabelElement(element, "Modifying Text", null, style);
+ }
+ if (entity != null) {
+ setEntity(entity);
+ }
+
+ }
+
+ @Override
+ public void handleEvent(Object eventSource) {
+ if (eventSource == combo_state) {
+ getEntity().setState(combo_state.getSelection());
+ combo_state.removeEmptyElement();
+ }
+ if (eventSource == text_modifyingText) {
+ getEntity().putModifyingText(
+ LanguageString.NewInstance(text_modifyingText.getText(), CdmStore.getDefaultLanguage()));
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean enable) {
+ if (combo_state != null) {
+ combo_state.setEnabled(enable);
+ }
+ if (section_modifiers != null) {
+ section_modifiers.setEnabled(enable);
+ }
+ if (text_modifyingText != null) {
+ text_modifyingText.setEnabled(enable);
+ }
+ super.setEnabled(enable);
+ }
}
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.description.CategoricalData;
import eu.etaxonomy.cdm.model.description.StateData;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
public class StateDataSection extends AbstractEntityCollectionSection<CategoricalData, StateData> implements IEnableableFormElement {
public StateDataSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
int style) {
- super(formFactory, conversation, parentElement, "State Data", style);
+ super(formFactory, parentElement, "State Data", style);
}
@Override
public boolean allowAddExisting() {
return false;
}
+ @Override
+ protected void updateToolbar() {
+
+ if( !(getEntity() instanceof CdmBase) || (getEntity() != null && CdmStore.currentAuthentiationHasPermission(StoreUtil.getCdmEntity(getEntity()), getUpdate())) && isEnabled()
+ && (this.getEntity().getFeature().getMaxStates() == null || this.getEntity().getFeature().getMaxStates() > this.getEntity().getStateData().size())){
+ showToolbar();
+ } else {
+ removeToolbar();
+ }
+ }
}
\ No newline at end of file
import org.eclipse.swt.events.SelectionListener;
+import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.taxeditor.ui.element.BigDecimalWithLabelElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
combo_type.setTerms(new ArrayList<StatisticalMeasure>(statisiticalMeasures));
combo_type.setSelection(entity.getType());
number_value.setNumber(entity.getValue());
- section_modifiers.setEntity(entity);
+ if (section_modifiers != null) {
+ section_modifiers.setEntity(entity);
+ }
}
}
public void createControls(ICdmFormElement element, int style) {
number_value = formFactory.createBigDecimalTextWithLabelElement(element, "Value", 0, style);
combo_type = formFactory.createDefinedTermComboElement(TermType.StatisticalMeasure, element, "Statistical Measure", null, style);
- section_modifiers = formFactory.createModifierSection(getConversationHolder(), element, StoreUtil.getSectionStyle(ModifierSection.class, StatisticalMeasurementValue.class.getCanonicalName()));
- section_modifiers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ if (!CdmUtils.isNullSafeEmpty(entity.getQuantitativeData().getFeature().getRecommendedModifierEnumeration()) || !CdmUtils.isNullSafeEmpty(entity.getModifiers())){
+ section_modifiers = formFactory.createModifierSection(element, StoreUtil.getSectionStyle(ModifierSection.class, StatisticalMeasurementValue.class.getCanonicalName()));
+ section_modifiers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ }
if (entity != null){
setEntity(entity);
}
// }
//
// @Override
-// public boolean isEnabled() {
+// public boolean isEnabled() {
// return combo_type.isEnabled();
// }
}
* 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.description;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.QuantitativeData;
import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
*
* @author n.hoffmann
* @created Sep 15, 2010
- * @version 1.0
*/
public class StatisticalMeasurementValueSection extends
AbstractEntityCollectionSection<QuantitativeData, StatisticalMeasurementValue> implements IEnableableFormElement{
- /**
- * <p>Constructor for StatisticalMeasurementValueSection.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
public StatisticalMeasurementValueSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
int style) {
- super(formFactory, conversation, parentElement, "Statistical Measurement Value", style);
+ super(formFactory, parentElement, "Statistical Measurement Value", style);
}
- /** {@inheritDoc} */
@Override
public Collection<StatisticalMeasurementValue> getCollection(
QuantitativeData entity) {
return new DefaultCdmBaseComparator<>();
}
- /** {@inheritDoc} */
@Override
public StatisticalMeasurementValue createNewElement() {
return StatisticalMeasurementValue.NewInstance();
}
- /** {@inheritDoc} */
@Override
public void addElement(StatisticalMeasurementValue element) {
getEntity().addStatisticalValue(element);
}
- /** {@inheritDoc} */
@Override
public void removeElement(StatisticalMeasurementValue element) {
getEntity().removeStatisticalValue(element);
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No statistical values yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Create new statistical value";
}
- /**
- * {@inheritDoc}
- */
@Override
public StatisticalMeasurementValue addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-}
+}
\ No newline at end of file
*/
public abstract class AbstractDetailedDescriptionDetailElement<T extends DescriptionElementBase> extends AbstractCdmDetailElement<T>{
- TimePeriodElement timePeriod;
- ModifierSection section_modifiers;
- TextWithLabelElement text_modifyingText;
+ private TimePeriodElement timePeriod;
+ private ModifierSection section_modifiers;
+ private TextWithLabelElement text_modifyingText;
/**
* <p>Constructor for AbstractDetailedDescriptionDetailElement.</p>
ICdmFormElement formElement, T entity, int style) {
super(formFactory, formElement);
setEntity(entity);
-
- }
+ }
protected void createTimePeriod(ICdmFormElement formElement, DescriptionElementBase entity,
int style) {
int style) {
if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowModifier.getKey())){
- section_modifiers = formFactory.createModifierSection(getConversationHolder(), this, StoreUtil.getSectionStyle(ModifierSection.class, entity.getClass().getCanonicalName(), true));
+ section_modifiers = formFactory.createModifierSection(this, StoreUtil.getSectionStyle(ModifierSection.class, entity.getClass().getCanonicalName(), true));
section_modifiers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_modifiers.setEntity(entity);
section_modifiers.setEnabled(enabled);
}
}
+
+ @Override
+ public void fillFields() {
+ timePeriod.setEntity(getEntity().getTimeperiod());
+ if (section_modifiers != null) {
+ section_modifiers.setEntity(getEntity());
+ }
+ if (text_modifyingText!= null) {
+ if(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()) != null) {
+ text_modifyingText.setText(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()).getText());
+ }
+ }
+ }
+
+
+
}
\ No newline at end of file
*/
package eu.etaxonomy.taxeditor.ui.section.description.detail;
+import java.util.Comparator;
+
+import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.description.CategoricalData;
+import eu.etaxonomy.cdm.model.description.NoDescriptiveDataStatus;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
private CheckboxElement checkbox_orderRelevant;
private StateDataSection section_stateData;
+ private EnumComboElement<NoDescriptiveDataStatus> noDataStatusCombo;
+ private CategoricalData tempData;
/**
* <p>Constructor for CategoricalDataDetailElement.</p>
*
public CategoricalDataDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement, CategoricalData entity, boolean enabled, int style) {
super(formFactory, formElement, entity, enabled, style);
-
+
}
@Override
protected void createControls(ICdmFormElement formElement,
CategoricalData entity, int style) {
+ Comparator<NoDescriptiveDataStatus> comp = new Comparator<NoDescriptiveDataStatus>() {
+
+ @Override
+ public int compare(NoDescriptiveDataStatus o1, NoDescriptiveDataStatus o2) {
+ return o1.getLabel(PreferencesUtil.getGlobalLanguage()).compareTo(o2.getLabel(PreferencesUtil.getGlobalLanguage()));
+ }
+ };
+ noDataStatusCombo = formFactory.createEnumComboElement(NoDescriptiveDataStatus.class, formElement, comp, style, true);
+ noDataStatusCombo.setSelection(entity.getNoDataStatus());
checkbox_orderRelevant = formFactory.createCheckbox(formElement, "Order Relevant", entity.getOrderRelevant(), style);
- section_stateData = formFactory.createStateDataSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(StateDataSection.class, entity.getClass().getCanonicalName(), true));
+ section_stateData = formFactory.createStateDataSection(formElement, StoreUtil.getSectionStyle(StateDataSection.class, entity.getClass().getCanonicalName(), true));
section_stateData.setEntity(entity);
section_stateData.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_stateData.setEnabled(enabled);
createTimePeriod(formElement, entity, style);
- if (entity.getFeature().getRecommendedModifierEnumeration() != null && !entity.getFeature().getRecommendedModifierEnumeration().isEmpty()){
+ if (!CdmUtils.isNullSafeEmpty(entity.getFeature().getRecommendedModifierEnumeration()) || !CdmUtils.isNullSafeEmpty(entity.getModifiers())){
createModifier(formElement, entity, style);
}else{
createFreetextModifier(formElement, entity, style);
super.handleEvent(eventSource);
if(eventSource == checkbox_orderRelevant){
getEntity().setOrderRelevant(checkbox_orderRelevant.getSelection());
+ } else if (eventSource == noDataStatusCombo) {
+ getEntity().setNoDataStatus(noDataStatusCombo.getSelection());
+ if (noDataStatusCombo.getSelection() != null) {
+ this.setEnabled(false);
+ if (!this.getEntity().getStateData().isEmpty()) {
+ tempData = this.getEntity().clone();
+ }
+ this.getEntity().getStateData().clear();
+ } else {
+ if (tempData != null) {
+ this.getEntity().getStateData().addAll(tempData.getStateData());
+ }
+ this.setEnabled(true);
+ }
+ noDataStatusCombo.setEnabled(true);
+ }
+ }
+
+ @Override
+ public void fillFields() {
+ if (getEntity()!= null) {
+ super.fillFields();
+ checkbox_orderRelevant.setEnabled(getEntity().getOrderRelevant());
+ section_stateData.setEntity(getEntity());
+ noDataStatusCombo.setSelection(getEntity().getNoDataStatus());
}
}
}
* 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.description.detail;
import java.util.List;
import org.eclipse.swt.SWT;
+import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.description.CommonTaxonName;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
- * <p>CommonNameDetailElement class.</p>
- *
* @author n.hoffmann
* @created Jun 10, 2010
- * @version 1.0
*/
public class CommonNameDetailElement extends AbstractDetailedDescriptionDetailElement<CommonTaxonName> {
private TermComboElement<Language> combo_language;
private EntitySelectionElement<NamedArea> selection_namedArea;
private TextWithLabelElement commonName;
-
+ private TextWithLabelElement transliteration;
/**
* <p>Constructor for CommonNameDetailElement.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param entity a {@link eu.etaxonomy.cdm.model.description.CommonTaxonName} object.
- * @param style a int.
*/
public CommonNameDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement, CommonTaxonName entity, boolean enabled, int style) {
super(formFactory, formElement, entity, enabled, style);
}
- /** {@inheritDoc} */
@Override
protected void createControls(ICdmFormElement formElement,
CommonTaxonName entity, int style) {
commonName = formFactory.createTextWithLabelElement(this, "Common Name", entity.getName(), SWT.WRAP);
+ transliteration = formFactory.createTextWithLabelElement(this, "Transliteration", entity.getTransliteration(), SWT.WRAP);
// combo_language = formFactory.createDefinedTermComboElement(TermType.Language, this, "Language", entity.getLanguage(), style);
List<UUID> uuidList = PreferencesUtil.createUUIDListFromStringPref(PreferencePredicate.CommonNameLanguages.getKey(), false);
combo_language = formFactory.createDefinedTermComboElement(TermType.Language, this, "Language", entity.getLanguage(), style);
combo_language.setTerms(languages);
combo_language.setSelection(entity.getLanguage());
- selection_namedArea = formFactory.createSelectionElement(NamedArea.class, //getConversationHolder(),
+ selection_namedArea = formFactory.createSelectionElement(NamedArea.class,
formElement, "Area",
entity.getArea(), EntitySelectionElement.NOTHING, style);
createTimePeriod(formElement, entity, style);
- if (entity.getFeature().getRecommendedModifierEnumeration() != null && !entity.getFeature().getRecommendedModifierEnumeration().isEmpty()){
+ if (!(CdmUtils.isNullSafeEmpty(entity.getFeature().getRecommendedModifierEnumeration())) && !entity.getFeature().getRecommendedModifierEnumeration().isEmpty()){
createModifier(formElement, entity, style);
}else{
createFreetextModifier(formElement, entity, style);
}
-
}
-
-
- /** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
super.handleEvent(eventSource);
getEntity().setArea(selection_namedArea.getEntity());
}else if(eventSource == commonName){
getEntity().setName(commonName.getText());
- }
+ }else if(eventSource == transliteration){
+ getEntity().setTransliteration(transliteration.getText());
+ }
}
-}
+ @Override
+ public void fillFields() {
+ if (getEntity()!= null) {
+ super.fillFields();
+ combo_language.setSelection(getEntity().getLanguage());
+ selection_namedArea.setEntity(getEntity().getArea());
+ commonName.setText(getEntity().getName());
+ transliteration.setText(getEntity().getTransliteration());
+ }
+ }
+}
\ No newline at end of file
import org.apache.commons.lang3.StringUtils;
+import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.description.Distribution;
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
import eu.etaxonomy.cdm.model.location.NamedArea;
public DistributionDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement, Distribution entity, boolean enabled, int style) {
super(formFactory, formElement, entity, enabled, style);
-
+
}
@Override
List<DefinedTermBase> inputList = getStatusListForArea(area);
combo_presenceAbsence = formFactory.createDefinedTermComboElement(inputList, this, "Distribution Status", entity.getStatus(), style);
createTimePeriod(formElement, entity, style);
- if (entity.getFeature().getRecommendedModifierEnumeration() != null && !entity.getFeature().getRecommendedModifierEnumeration().isEmpty()){
+ if (!CdmUtils.isNullSafeEmpty(entity.getFeature().getRecommendedModifierEnumeration()) || !CdmUtils.isNullSafeEmpty(entity.getModifiers())){
createModifier(formElement, entity, style);
}else{
createFreetextModifier(formElement, entity, style);
public void setName(String nameCache){
taxonOfDistribtion.setText(nameCache);
}
+
+ @Override
+ public void fillFields() {
+ if (getEntity() != null) {
+ super.fillFields();
+ selection_namedArea.setEntity(getEntity().getArea());
+ combo_presenceAbsence.setSelection(getEntity().getStatus());
+ String nameCache = null;
+ nameCache = ((IDistributionEditorPart)AbstractUtility.getActivePart()).getEditor().getActualNameCache();
+ taxonOfDistribtion.setText(nameCache);
+ }
+ }
}
\ No newline at end of file
* 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.description.detail;
import java.util.Map;
+import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.common.LanguageString;
/**
* @author n.hoffmann
* @created Jun 10, 2010
- * @version 1.0
*/
public class IndividualsAssociationDetailElement extends
AbstractDetailedDescriptionDetailElement<IndividualsAssociation> {
private EntitySelectionElement<SpecimenOrObservationBase> selection_derivedUnit;
public IndividualsAssociationDetailElement(CdmFormFactory formFactory,
- ICdmFormElement formElement, IndividualsAssociation entity, boolean enabled,
+ ICdmFormElement formElement, IndividualsAssociation entity, boolean enabled,
int style) {
super(formFactory, formElement, entity, enabled, style);
}
- /** {@inheritDoc} */
@Override
protected void createControls(ICdmFormElement formElement,
IndividualsAssociation entity, int style) {
selection_derivedUnit = formFactory
.createSelectionElement(SpecimenOrObservationBase.class,
- //getConversationHolder(),
formElement, "Occurrence/Unit",
CdmBase.deproxy(entity.getAssociatedSpecimenOrObservation(),SpecimenOrObservationBase.class),
EntitySelectionElement.ALL, style);
}
createTimePeriod(formElement, entity, style);
- if (entity.getFeature().getRecommendedModifierEnumeration() != null && !entity.getFeature().getRecommendedModifierEnumeration().isEmpty()){
+ if (!CdmUtils.isNullSafeEmpty(entity.getFeature().getRecommendedModifierEnumeration()) || !CdmUtils.isNullSafeEmpty(entity.getModifiers())){
createModifier(formElement, entity, style);
}else{
createFreetextModifier(formElement, entity, style);
}
}
- /** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
super.handleEvent(eventSource);
} else if (eventSource == text_description) {
getEntity().putDescription(CdmStore.getDefaultLanguage(), text_description.getText());
}
+ }
+
+ @Override
+ public void fillFields() {
+ if (getEntity()!= null) {
+ super.fillFields();
+ if (getEntity().getDescription() != null && getEntity().getDescription().get(CdmStore.getDefaultLanguage()) != null) {
+ text_description.setText(getEntity().getDescription().get(
+ CdmStore.getDefaultLanguage()).getText());
+ }
+ selection_derivedUnit.setEntity(getEntity().getAssociatedSpecimenOrObservation());
+ }
}
-}
+}
\ No newline at end of file
package eu.etaxonomy.taxeditor.ui.section.description.detail;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.description.MeasurementUnit;
+import eu.etaxonomy.cdm.model.description.NoDescriptiveDataStatus;
import eu.etaxonomy.cdm.model.description.QuantitativeData;
import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.section.description.StatisticalMeasurementValueSection;
public class QuantitativeDataDetailElement extends
AbstractDetailedDescriptionDetailElement<QuantitativeData> {
- private TermComboElement<MeasurementUnit> comboMeasurementUnit;
- private StatisticalMeasurementValueSection section_statisticalMeasurementValues;
+ private TermComboElement<MeasurementUnit> comboMeasurementUnit;
+ private StatisticalMeasurementValueSection section_statisticalMeasurementValues;
+ private EnumComboElement<NoDescriptiveDataStatus> noDataStatusCombo;
+ private QuantitativeData tempData;
/**
* <p>Constructor for QuantitativeDataDetailElement.</p>
public QuantitativeDataDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement, QuantitativeData entity, boolean enabled, int style) {
super(formFactory, formElement, entity, enabled, style);
+ updateControlStates();
}
@Override
protected void createControls(ICdmFormElement formElement,
QuantitativeData entity, int style) {
- comboMeasurementUnit = formFactory.createDefinedTermComboElement(TermType.MeasurementUnit, formElement, "Measurement Unit", null, style);
+ Comparator<NoDescriptiveDataStatus> comp = new Comparator<NoDescriptiveDataStatus>() {
+
+ @Override
+ public int compare(NoDescriptiveDataStatus o1, NoDescriptiveDataStatus o2) {
+
+ return o1.getLabel(PreferencesUtil.getGlobalLanguage()).compareTo(o2.getLabel(PreferencesUtil.getGlobalLanguage()));
+ }
+ };
+ noDataStatusCombo = formFactory.createEnumComboElement(NoDescriptiveDataStatus.class, formElement,comp, style, true);
+ noDataStatusCombo.setSelection(entity.getNoDataStatus());
+ comboMeasurementUnit = formFactory.createDefinedTermComboElement(TermType.MeasurementUnit, formElement, "Measurement Unit", null, style);
comboMeasurementUnit.setTerms(new ArrayList<MeasurementUnit>(entity.getFeature().getRecommendedMeasurementUnits()));
comboMeasurementUnit.setSelection(entity.getUnit());
- section_statisticalMeasurementValues = formFactory.createStatisticalMeasurementValueSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(StatisticalMeasurementValueSection.class, entity.getClass().getCanonicalName(), true));
+ section_statisticalMeasurementValues = formFactory.createStatisticalMeasurementValueSection(formElement, StoreUtil.getSectionStyle(StatisticalMeasurementValueSection.class, entity.getClass().getCanonicalName(), true));
section_statisticalMeasurementValues.setEntity(entity);
section_statisticalMeasurementValues.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- if (entity.getFeature().getRecommendedModifierEnumeration() != null && !entity.getFeature().getRecommendedModifierEnumeration().isEmpty()){
+ if (!CdmUtils.isNullSafeEmpty(entity.getFeature().getRecommendedModifierEnumeration()) || !CdmUtils.isNullSafeEmpty(entity.getModifiers())){
createModifier(formElement, entity, style);
}else{
createFreetextModifier(formElement, entity, style);
}
}
- @Override
- public void handleEvent(Object eventSource) {
- if(eventSource == comboMeasurementUnit){
- getEntity().setUnit(comboMeasurementUnit.getSelection());
- comboMeasurementUnit.removeEmptyElement();
- }else if (eventSource == section_statisticalMeasurementValues){
- // FIXME
- }
- }
+ @Override
+ public void handleEvent(Object eventSource) {
+ super.handleEvent(eventSource);
+ if (eventSource == comboMeasurementUnit) {
+ getEntity().setUnit(comboMeasurementUnit.getSelection());
+ comboMeasurementUnit.removeEmptyElement();
+ } else if (eventSource == section_statisticalMeasurementValues) {
+ // FIXME
+ } else if (eventSource == noDataStatusCombo) {
+ getEntity().setNoDataStatus(noDataStatusCombo.getSelection());
+ if (noDataStatusCombo.getSelection() != null) {
+ this.setEnabled(false);
+ if (!this.getEntity().getStatisticalValues().isEmpty()) {
+ tempData = this.getEntity().clone();
+ }
+ this.getEntity().getStatisticalValues().clear();
+ } else {
+ if (tempData != null) {
+ this.getEntity().getStatisticalValues().addAll(tempData.getStatisticalValues());
+ }
+ this.setEnabled(true);
+ }
+ noDataStatusCombo.setEnabled(true);
+ }
+ }
+
+ @Override
+ public void fillFields() {
+ if (getEntity() != null) {
+ super.fillFields();
+
+ comboMeasurementUnit.setSelection(getEntity().getUnit());
+ section_statisticalMeasurementValues.setEntity(getEntity());
+ noDataStatusCombo.setSelection(getEntity().getNoDataStatus());
+ if (getEntity().getNoDataStatus() != null) {
+ this.setEnabled(false);
+ noDataStatusCombo.setEnabled(true);
+ }
+
+ }
+
+ }
+
+ @Override
+ public void updateControlStates() {
+ Collection<Object> except = new ArrayList<Object>();
+ for (ICdmFormElement formElement : getElements()) {
+ if (formElement instanceof IEnableableFormElement && !((IEnableableFormElement) formElement).isEnabled()) {
+ except.add(formElement);
+ }
+ }
+
+ if ((getEntity().getInDescription() != null
+ && (getEntity().getInDescription().isComputed() || getEntity().getInDescription().isCloneForSource())
+ && PreferencesUtil.isComputedDesciptionHandlingDisabled())) {
+ enabled = false;
+ } else if (getEntity().getNoDataStatus() != null) {
+ enabled = false;
+ except.add(noDataStatusCombo);
+ } else {
+ enabled = true;
+ }
+ setEnabled(enabled, except);
+
+ }
}
import java.util.Map;
+import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.common.LanguageString;
TaxonInteraction entity, int style) {
taxonSelection = formFactory
- .createSelectionElement(Taxon.class,//getConversationHolder(),
+ .createSelectionElement(Taxon.class,
formElement, "Taxon",
CdmBase.deproxy(entity.getTaxon2(),Taxon.class),
EntitySelectionElement.ALL, style);
CdmStore.getDefaultLanguage()).getText());
}
createTimePeriod(formElement, entity, style);
- if (entity.getFeature().getRecommendedModifierEnumeration() != null && !entity.getFeature().getRecommendedModifierEnumeration().isEmpty()){
+ if (!CdmUtils.isNullSafeEmpty(entity.getFeature().getRecommendedModifierEnumeration()) || !CdmUtils.isNullSafeEmpty(entity.getModifiers())){
createModifier(formElement, entity, style);
}else{
createFreetextModifier(formElement, entity, style);
getEntity().putDescription(CdmStore.getDefaultLanguage(), interactionDescription.getText());
}
}
+
+ @Override
+ public void fillFields() {
+ if (getEntity()!= null) {
+ super.fillFields();
+ taxonSelection.setEntity(getEntity().getTaxon2());
+ interactionDescription.setText(getEntity().getDescription(CdmStore.getDefaultLanguage()));
+
+ }
+
+ }
}
}
+ @Override
+ public void fillFields() {
+ if (getEntity() != null) {
+ super.fillFields();
+ timePeriod.setTimePeriod(getEntity().getPeriod());
+ }
+
+ }
+
}
import eu.etaxonomy.cdm.model.description.TextData;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement;
public void handleEvent(Object eventSource) {
super.handleEvent(eventSource);
if(eventSource == multilanguageTextElement){
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
// getEntity().setMultiLanguageText(multilanguageTextElement.getMultilanguageText());
}
}
}
super.propertyChange(event);
}
+
+ @Override
+ public void fillFields() {
+ if (getEntity()!= null) {
+ super.fillFields();
+ multilanguageTextElement.setMultilanguageText(getEntity().getMultilanguageText());
+ }
+
+ }
}
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.FeatureState;
-import eu.etaxonomy.cdm.model.description.State;
+import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
/**
* @author pplitzner
* @since Aug 16, 2019
- *
*/
public abstract class AbstractApplicableElement extends AbstractEntityCollectionElement<FeatureState> {
- private TermComboElement<State> comboState;
+ private TermComboElement<DefinedTermBase<?>> comboState;
private EntitySelectionElement<Feature> selectFeature;
- public AbstractApplicableElement(CdmFormFactory formFactory, AbstractFormSection section, FeatureState entity,
+ public AbstractApplicableElement(CdmFormFactory formFactory, AbstractFormSection<?> section, FeatureState entity,
SelectionListener removeListener, Color backgroundColor, int style) {
super(formFactory, section, entity, removeListener, backgroundColor, style);
comboState = formFactory.createDefinedTermComboElement(Collections.EMPTY_LIST, element, getComboLabel(), null, style);
comboState.setEnabled(false);
selectFeature.setEnabled(false);
-
+
selectFeature.setEntity(entity.getFeature());
comboState.setSelection(entity.getState());
}
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.cdm.model.description.FeatureState;
-import eu.etaxonomy.cdm.model.description.State;
-import eu.etaxonomy.cdm.model.term.DefinedTerm;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.persistence.dto.FeatureStateDto;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.TermManager;
import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
/**
* @author pplitzner
* @since Aug 16, 2019
- *
*/
public abstract class AbstractApplicableElementForDto extends AbstractEntityCollectionElement<FeatureStateDto> {
- protected TermComboElement<State> comboState;
+ protected TermComboElement<DefinedTermBase> comboState;
protected EntitySelectionElement<Feature> selectFeature;
-
public AbstractApplicableElementForDto(CdmFormFactory formFactory, AbstractFormSection section, FeatureStateDto entity,
SelectionListener removeListener, Color backgroundColor, int style) {
super(formFactory, section, entity, removeListener, backgroundColor, style);
-
}
@Override
selectFeature.setEntity(feature);
List<UUID> termList = new ArrayList<>();
termList.add(entity.getState().getUuid());
- List<State> terms = CdmStore.getTermManager().getTerms(termList, TermType.State);
+ //FIXME 10196
+ List<DefinedTermBase> terms = CdmStore.getTermManager().getTerms(termList, TermType.State);
if (terms.size() == 1){
comboState.setSelection(terms.get(0));
}
-
}
protected abstract String getComboLabel();
@Override
public void handleEvent(Object eventSource) {
}
-
+
@Override
public void setEnabled(boolean enabled){
super.setEnabled(enabled);
this.comboState.setEnabled(false);
this.selectFeature.setEnabled(false);
}
-}
+}
\ No newline at end of file
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.description.Character;
-import eu.etaxonomy.cdm.model.term.DefinedTerm;
import eu.etaxonomy.cdm.model.term.Representation;
-import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.taxeditor.editor.definedterm.TermBasePropertyTester;
import eu.etaxonomy.taxeditor.model.ColorResources;
import eu.etaxonomy.taxeditor.preference.Resources;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.RepresentationElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.MeasurementUnitCollectionSection;
-import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierVocabulariesCollectionSection;
-import eu.etaxonomy.taxeditor.ui.section.vocabulary.StateVocabularyCollectionSection;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierCollectionsCollectionSection;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedStateCollectionSection;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.StatisticalMeasureCollectionSection;
/**
- *
* @author pplitzner
* @since Dec 21, 2017
- *
*/
public class CharacterDetailElement extends AbstractCdmDetailElement<Character> {
private ICdmFormElement parentFormElement;
- protected RepresentationElement element_Representation;
-
- private TermComboElement<DefinedTerm> comboStructuralModifier;
+ private RepresentationElement element_Representation;
private CheckboxElement supportsQuantitativeData;
private CheckboxElement supportsCategoricalData;
-
+
private CheckboxElement availableForTaxon;
private CheckboxElement availableForTaxonName;
private CheckboxElement availableForSpecimenOrObservation;
-
- private StateVocabularyCollectionSection sectionStateVocabularies;
+ private RecommendedStateCollectionSection sectionStateVocabularies;
private MeasurementUnitCollectionSection sectionMeasurementUnits;
private StatisticalMeasureCollectionSection sectionStatisticalMeasures;
- private RecommendedModifierVocabulariesCollectionSection sectionModifierVocabularies;
+ private RecommendedModifierCollectionsCollectionSection sectionModifierVocabularies;
private Label labelText_structure;
private Text text_structure;
private Text text_property;
private RemovableTextElement ratioTo;
-// private Label labelText_ratioTo;
-// private Text text_ratioTo;
-// private Button button_remove;
-
-
-// private TextWithLabelElement text_structure;
-// private TextWithLabelElement text_property;
-
-
- public CharacterDetailElement(CdmFormFactory formFactory,
- ICdmFormElement formElement) {
- super(formFactory, formElement);
- }
-
- @Override
- protected void createControls(ICdmFormElement formElement, Character entity, int style) {
- this.parentFormElement = formElement;
- element_Representation = formFactory.createTranslatableRepresentationElement(formElement, entity.getPreferredRepresentation(CdmStore.getDefaultLanguage()),entity, 100, style, true);
- if (labelText_property != null){
- labelText_structure.dispose();
- }
- labelText_structure = new Label(formElement.getLayoutComposite(), SWT.NONE);
- labelText_structure.setText("Structure");
- if (text_structure != null){
- text_structure.dispose();
- }
- text_structure = new Text(formElement.getLayoutComposite(), SWT.WRAP);
- text_structure.setText( CharacterNodeDetailElement.getStructureText(entity));
+
+ public CharacterDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
+ super(formFactory, formElement);
+ }
+
+ @Override
+ protected void createControls(ICdmFormElement formElement, Character entity, int style) {
+ this.parentFormElement = formElement;
+ element_Representation = formFactory.createTranslatableRepresentationElement(formElement,
+ entity.getPreferredRepresentation(CdmStore.getDefaultLanguage()), entity, 100, style, true);
+ if (labelText_property != null) {
+ labelText_structure.dispose();
+ }
+ labelText_structure = new Label(formElement.getLayoutComposite(), SWT.NONE);
+ labelText_structure.setText("Structure");
+ if (text_structure != null) {
+ text_structure.dispose();
+ }
+ text_structure = new Text(formElement.getLayoutComposite(), SWT.WRAP);
+ text_structure.setText(CharacterNodeDetailElement.getStructureText(entity));
text_structure.setEditable(false);
text_structure.setLayoutData(LayoutConstants.FILL());
text_structure.setForeground(ColorResources.getColor(Resources.BLACK));
- if (labelText_property != null){
+ if (labelText_property != null) {
labelText_property.dispose();
}
- labelText_property = new Label(formElement.getLayoutComposite(), SWT.NONE);
- labelText_property.setText("Property");
- if (text_property != null){
- text_property.dispose();
- }
- text_property = new Text(formElement.getLayoutComposite(), SWT.WRAP);
- text_property.setEditable(false);
- text_property.setText( CharacterNodeDetailElement.getPropertyText(entity));
- text_property.setLayoutData(LayoutConstants.FILL());
- text_property.setForeground(ColorResources.getColor(Resources.BLACK));
-
- comboStructuralModifier = formFactory.createDefinedTermComboElement(TermType.StructureModifier, formElement, "Structural Modifier", entity.getStructureModifier(), style);
+ labelText_property = new Label(formElement.getLayoutComposite(), SWT.NONE);
+ labelText_property.setText("Property");
+ if (text_property != null) {
+ text_property.dispose();
+ }
+ text_property = new Text(formElement.getLayoutComposite(), SWT.WRAP);
+ text_property.setEditable(false);
+ text_property.setText(CharacterNodeDetailElement.getPropertyText(entity));
+ text_property.setLayoutData(LayoutConstants.FILL());
+ text_property.setForeground(ColorResources.getColor(Resources.BLACK));
- ratioTo = formFactory.createRemovableTextField(formElement, "Ratio to", CharacterNodeDetailElement.getRatioToText(entity), style);
+ ratioTo = formFactory.createRemovableTextField(formElement, "Ratio to",
+ CharacterNodeDetailElement.getRatioToText(entity), style);
- supportsQuantitativeData = formFactory.createCheckbox(formElement, "Supports Quantitative Data", entity.isSupportsQuantitativeData(), style);
- supportsCategoricalData = formFactory.createCheckbox(formElement, "Supports Categorical Data", entity.isSupportsCategoricalData(), style);
+ supportsQuantitativeData = formFactory.createCheckbox(formElement, "Supports Quantitative Data",
+ entity.isSupportsQuantitativeData(), style);
+ supportsCategoricalData = formFactory.createCheckbox(formElement, "Supports Categorical Data",
+ entity.isSupportsCategoricalData(), style);
- LabelElement availableLabel = formFactory.createLabel(formElement, "Available for");
+ LabelElement availableLabel = formFactory.createLabel(formElement, "Available for");
availableLabel.setBold();
availableForTaxon = formFactory.createCheckbox(formElement, "Taxon", entity.isAvailableForTaxon(), style);
- availableForTaxonName = formFactory.createCheckbox(formElement, "Taxon Name", entity.isAvailableForTaxonName(), style);
- availableForSpecimenOrObservation = formFactory.createCheckbox(formElement, "Occurrence", entity.isAvailableForOccurrence(), style);
-
+ availableForTaxonName = formFactory.createCheckbox(formElement, "Taxon Name", entity.isAvailableForTaxonName(),
+ style);
+ availableForSpecimenOrObservation = formFactory.createCheckbox(formElement, "Occurrence",
+ entity.isAvailableForOccurrence(), style);
+
if (supportsCategoricalData.getSelection()) {
- sectionStateVocabularies = formFactory.createStateVocabulariesSection(getConversationHolder(),
- parentFormElement, StoreUtil.getSectionStyle(StateVocabularyCollectionSection.class, entity.getClass().getCanonicalName(), true));
+ sectionStateVocabularies = formFactory.createStateVocabulariesSection(parentFormElement,
+ StoreUtil.getSectionStyle(RecommendedStateCollectionSection.class,
+ entity.getClass().getCanonicalName(), true));
sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionStateVocabularies.setEntity(entity);
}
if (supportsQuantitativeData.getSelection()) {
- sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(getConversationHolder(),
- parentFormElement, StoreUtil.getSectionStyle(MeasurementUnitCollectionSection.class, entity.getClass().getCanonicalName(), true));
+ sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(parentFormElement,
+ StoreUtil.getSectionStyle(MeasurementUnitCollectionSection.class,
+ entity.getClass().getCanonicalName(), true));
sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionMeasurementUnits.setEntity(entity);
- sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection(getConversationHolder(),
- parentFormElement, StoreUtil.getSectionStyle(StatisticalMeasureCollectionSection.class, entity.getClass().getCanonicalName(), true));
+ sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection(parentFormElement,
+ StoreUtil.getSectionStyle(StatisticalMeasureCollectionSection.class,
+ entity.getClass().getCanonicalName(), true));
sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionStatisticalMeasures.setEntity(entity);
}
if (supportsCategoricalData.getSelection() || supportsQuantitativeData.getSelection()) {
sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(
- getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierVocabulariesCollectionSection.class, entity.getClass().getCanonicalName(), true));
+ parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierCollectionsCollectionSection.class,
+ entity.getClass().getCanonicalName(), true));
sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionModifierVocabularies.setEntity(entity);
}
-
}
-// public void createText(ICdmFormElement formElement, String label, String path) {
-// labelText = new Label(formElement.getLayoutComposite(), SWT.NONE);
-// labelText.setText(label);
-// Text text = new Text(formElement.getLayoutComposite(), SWT.WRAP);
-// text.setText(path);
-// text.setEditable(false);
-// text.setLayoutData(LayoutConstants.FILL());
-// text.setForeground(ColorResources.getColor(Resources.BLACK));
-// }
@Override
public void setEntity(Character entity) {
setEnabled(TermBasePropertyTester.isModifiable(entity));
}
- @Override
- public void handleEvent(Object eventSource) {
- if(eventSource == comboStructuralModifier){
- getEntity().setStructureModifier(comboStructuralModifier.getSelection());
- }
- if(eventSource == ratioTo){
- if (!ratioTo.isState()){
- getEntity().setRatioToStructure(null);
- }
+ @Override
+ public void handleEvent(Object eventSource) {
+ if (eventSource == ratioTo) {
+ if (!ratioTo.isState()) {
+ getEntity().setRatioToStructure(null);
+ this.getEntity().getTitleCache();
+ System.err.println(this.getEntity().getTitleCache());
+ }
}
-// if(eventSource == supportsQuantitativeData || eventSource == supportsCategoricalData){
-// //if any type is selected disable supportsTextData
-// getEntity().setSupportsTextData(false);
-// }
- if(eventSource == supportsQuantitativeData){
- getEntity().setSupportsQuantitativeData(supportsQuantitativeData.getSelection());
- if(supportsQuantitativeData.getSelection()){
- activateQuantitativeWidgets();
- }
- else{
- removeQuantitativeWidgets();
- }
+ if (eventSource == supportsQuantitativeData) {
+ getEntity().setSupportsQuantitativeData(supportsQuantitativeData.getSelection());
+ if (supportsQuantitativeData.getSelection()) {
+ activateQuantitativeWidgets();
+ } else {
+ removeQuantitativeWidgets();
+ }
StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
- }
- else if(eventSource == supportsCategoricalData){
- getEntity().setSupportsCategoricalData(supportsCategoricalData.getSelection());
+ } else if (eventSource == supportsCategoricalData) {
+ getEntity().setSupportsCategoricalData(supportsCategoricalData.getSelection());
if (supportsCategoricalData.getSelection()) {
activateCategoricalWidgets();
+ } else {
+ removeCategoricalWidgets();
}
- else{
- removeCategoricalWidgets();
- }
StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
- }
- else if (eventSource == element_Representation) {
+ } else if (eventSource == element_Representation) {
Representation selectedRepresentation = element_Representation.getSelectedRepresentation();
- if(selectedRepresentation!=null){
+ if (selectedRepresentation != null) {
Language representationLanguage = selectedRepresentation.getLanguage();
- if(representationLanguage==null){
+ if (representationLanguage == null) {
representationLanguage = Language.getDefaultLanguage();
}
- getEntity().setLabel(selectedRepresentation.getLabel(), representationLanguage);
- getEntity().getRepresentation(representationLanguage).setAbbreviatedLabel(selectedRepresentation.getAbbreviatedLabel());
+ getEntity().setLabel(selectedRepresentation.getLabel(), representationLanguage);
+ getEntity().getRepresentation(representationLanguage)
+ .setAbbreviatedLabel(selectedRepresentation.getAbbreviatedLabel());
getEntity().getRepresentation(representationLanguage).setText(selectedRepresentation.getDescription());
}
getEntity().setTitleCache(null);
- }
- else if(eventSource == availableForSpecimenOrObservation){
+ } else if (eventSource == availableForSpecimenOrObservation) {
getEntity().setAvailableForOccurrence(availableForSpecimenOrObservation.getSelection());
-
- }
- else if(eventSource == availableForTaxon){
+
+ } else if (eventSource == availableForTaxon) {
getEntity().setAvailableForTaxon(availableForTaxon.getSelection());
-
- }
- else if(eventSource == availableForTaxonName){
+
+ } else if (eventSource == availableForTaxonName) {
getEntity().setAvailableForTaxonName(availableForTaxonName.getSelection());
-
+
}
- }
-
- private void activateQuantitativeWidgets(){
- //disable categorical widgets
- supportsCategoricalData.setSelection(false);
- getEntity().setSupportsCategoricalData(false);
- removeCategoricalWidgets();
-
- //measurement units
- sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(getConversationHolder(),
- parentFormElement, StoreUtil.getSectionStyle(MeasurementUnitCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
- sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- sectionMeasurementUnits.setEntity(getEntity());
-
- //statistical measures
- sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection(
- getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(StatisticalMeasureCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
- sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- sectionStatisticalMeasures.setEntity(getEntity());
-
- //modifiers
- sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(
- getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierVocabulariesCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
- sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- sectionModifierVocabularies.setEntity(getEntity());
- }
-
- private void removeQuantitativeWidgets(){
- if(sectionMeasurementUnits!=null){
- removeElementsAndControls(sectionMeasurementUnits);
- removeElementsAndControls(sectionStatisticalMeasures);
- removeElementsAndControls(sectionModifierVocabularies);
- }
- }
-
- private void activateCategoricalWidgets(){
- //disable quantitative widgeets
- supportsQuantitativeData.setSelection(false);
- getEntity().setSupportsQuantitativeData(false);
- removeQuantitativeWidgets();
-
- //states
- sectionStateVocabularies = formFactory.createStateVocabulariesSection(getConversationHolder(),
- parentFormElement, StoreUtil.getSectionStyle(StateVocabularyCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
+ }
+
+ private void activateQuantitativeWidgets() {
+ // disable categorical widgets
+ supportsCategoricalData.setSelection(false);
+ getEntity().setSupportsCategoricalData(false);
+ removeCategoricalWidgets();
+
+ // measurement units
+ sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(parentFormElement,
+ StoreUtil.getSectionStyle(MeasurementUnitCollectionSection.class,
+ getEntity().getClass().getCanonicalName(), true));
+ sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ sectionMeasurementUnits.setEntity(getEntity());
+
+ // statistical measures
+ sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection(parentFormElement,
+ StoreUtil.getSectionStyle(StatisticalMeasureCollectionSection.class,
+ getEntity().getClass().getCanonicalName(), true));
+ sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ sectionStatisticalMeasures.setEntity(getEntity());
+
+ // modifiers
+ sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(
+ parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierCollectionsCollectionSection.class,
+ getEntity().getClass().getCanonicalName(), true));
+ sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ sectionModifierVocabularies.setEntity(getEntity());
+ }
+
+ private void removeQuantitativeWidgets() {
+ if (sectionMeasurementUnits != null) {
+ removeElementsAndControls(sectionMeasurementUnits);
+ removeElementsAndControls(sectionStatisticalMeasures);
+ removeElementsAndControls(sectionModifierVocabularies);
+ }
+ }
+
+ private void activateCategoricalWidgets() {
+ // disable quantitative widgeets
+ supportsQuantitativeData.setSelection(false);
+ getEntity().setSupportsQuantitativeData(false);
+ removeQuantitativeWidgets();
+
+ // states
+ sectionStateVocabularies = formFactory.createStateVocabulariesSection(parentFormElement,
+ StoreUtil.getSectionStyle(RecommendedStateCollectionSection.class,
+ getEntity().getClass().getCanonicalName(), true));
sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionStateVocabularies.setEntity(getEntity());
- //modifiers
+ // modifiers
sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(
- getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierVocabulariesCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
+ parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierCollectionsCollectionSection.class,
+ getEntity().getClass().getCanonicalName(), true));
sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionModifierVocabularies.setEntity(getEntity());
- }
-
- private void removeCategoricalWidgets(){
- if(sectionStateVocabularies!=null){
- removeElementsAndControls(sectionStateVocabularies);
- removeElementsAndControls(sectionModifierVocabularies);
- }
- }
+ }
+
+ private void removeCategoricalWidgets() {
+ if (sectionStateVocabularies != null) {
+ removeElementsAndControls(sectionStateVocabularies);
+ removeElementsAndControls(sectionModifierVocabularies);
+ }
+ }
+
+ @Override
+ public void fillFields() {
+ if (getEntity() != null) {
+ element_Representation.setTerm(getEntity(), isEnabled());
+ supportsQuantitativeData.setSelection(getEntity().isSupportsQuantitativeData());
+ supportsCategoricalData.setSelection(getEntity().isSupportsCategoricalData());
+ ;
+ availableForTaxon.setSelection(getEntity().isAvailableForTaxon());
+ availableForTaxonName.setSelection(getEntity().isAvailableForTaxonName());
+ availableForSpecimenOrObservation.setSelection(getEntity().isAvailableForOccurrence());
+ sectionStateVocabularies.setEntity(getEntity());
+ sectionMeasurementUnits.setEntity(getEntity());
+ sectionStatisticalMeasures.setEntity(getEntity());
+ sectionModifierVocabularies.setEntity(getEntity());
+
+ text_structure.setText(CharacterNodeDetailElement.getStructureText(getEntity()));
+ text_property.setText(CharacterNodeDtoDetailElement.getPropertyText(getEntity()));
+ ratioTo.setText(CharacterNodeDetailElement.getRatioToText(getEntity()));
+ }
+
+ }
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.Character;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
/**
- *
* @author pplitzner
* @since Dec 21, 2017
- *
*/
public class CharacterDetailSection extends AbstractCdmDetailSection<Character> {
public CharacterDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
return "Character";
}
- /**
- * {@inheritDoc}
- */
@Override
protected AbstractCdmDetailElement<Character> createCdmDetailElement(AbstractCdmDetailSection<Character> parentElement,
int style) {
return formFactory.createCharacterDetailElement(parentElement, style);
}
-
-}
+}
\ No newline at end of file
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.description.Character;
-import eu.etaxonomy.cdm.model.term.DefinedTerm;
import eu.etaxonomy.cdm.model.term.Representation;
-import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.persistence.dto.CharacterDto;
import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
-import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.taxeditor.editor.definedterm.TermBasePropertyTester;
import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.preference.Resources;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.MeasurementUnitCollectionSection;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.MeasurementUnitDtoCollectionSection;
-import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierVocabulariesCollectionSection;
-import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierVocabulariesDtoCollectionSection;
-import eu.etaxonomy.taxeditor.ui.section.vocabulary.StateVocabularyCollectionSection;
-import eu.etaxonomy.taxeditor.ui.section.vocabulary.StateVocabularyDtoCollectionSection;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierCollectionsCollectionSection;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierCollectionsDtoCollectionSection;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedStateCollectionSection;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedStateDtoCollectionSection;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.StatisticalMeasureCollectionSection;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.StatisticalMeasureDtoCollectionSection;
/**
- *
* @author pplitzner
* @since Dec 21, 2017
- *
*/
public class CharacterDtoDetailElement extends AbstractCdmDetailElement<CharacterDto> {
protected RepresentationElement element_Representation;
- private TermComboElement<DefinedTerm> comboStructuralModifier;
-
private CheckboxElement supportsQuantitativeData;
private CheckboxElement supportsCategoricalData;
-
+
private CheckboxElement availableForTaxon;
private CheckboxElement availableForTaxonName;
private CheckboxElement availableForSpecimenOrObservation;
- private StateVocabularyDtoCollectionSection sectionStateVocabularies;
+ private RecommendedStateDtoCollectionSection sectionStateVocabularies;
private MeasurementUnitDtoCollectionSection sectionMeasurementUnits;
private StatisticalMeasureDtoCollectionSection sectionStatisticalMeasures;
- private RecommendedModifierVocabulariesDtoCollectionSection sectionModifierVocabularies;
+ private RecommendedModifierCollectionsDtoCollectionSection sectionModifierVocabularies;
private Label labelText_structure;
private Text text_structure;
private RemovableTextElement ratioTo;
-// private TextWithLabelElement text_structure;
-// private TextWithLabelElement text_property;
-
-
- public CharacterDtoDetailElement(CdmFormFactory formFactory,
- ICdmFormElement formElement) {
- super(formFactory, formElement);
- }
-
- @Override
- protected void createControls(ICdmFormElement formElement, CharacterDto entity, int style) {
- this.parentFormElement = formElement;
-
- element_Representation = formFactory.createTranslatableRepresentationElementDto(formElement, entity.getPreferredRepresentation(CdmStore.getDefaultLanguage()),entity, 100, style, true);
- if (labelText_property != null){
- labelText_structure.dispose();
- }
- labelText_structure = new Label(formElement.getLayoutComposite(), SWT.NONE);
- labelText_structure.setText("Structure");
- if (text_structure != null){
- text_structure.dispose();
- }
- text_structure = new Text(formElement.getLayoutComposite(), SWT.WRAP);
- text_structure.setText( entity.getStructure().getPath());
+ public CharacterDtoDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
+ super(formFactory, formElement);
+ }
+
+ @Override
+ protected void createControls(ICdmFormElement formElement, CharacterDto entity, int style) {
+ this.parentFormElement = formElement;
+
+ element_Representation = formFactory.createTranslatableRepresentationElementDto(formElement,
+ entity.getPreferredRepresentation(CdmStore.getDefaultLanguage()), entity, 100, style, true);
+ if (labelText_property != null) {
+ labelText_structure.dispose();
+ }
+ labelText_structure = new Label(formElement.getLayoutComposite(), SWT.NONE);
+ labelText_structure.setText("Structure");
+ if (text_structure != null) {
+ text_structure.dispose();
+ }
+ text_structure = new Text(formElement.getLayoutComposite(), SWT.WRAP);
+ text_structure.setText(entity.getStructure().getPath());
text_structure.setEditable(false);
text_structure.setLayoutData(LayoutConstants.FILL());
text_structure.setForeground(ColorResources.getColor(Resources.BLACK));
- if (labelText_property != null){
+ if (labelText_property != null) {
labelText_property.dispose();
}
- labelText_property = new Label(formElement.getLayoutComposite(), SWT.NONE);
- labelText_property.setText("Property");
- if (text_property != null){
- text_property.dispose();
- }
- text_property = new Text(formElement.getLayoutComposite(), SWT.WRAP);
- text_property.setEditable(false);
- text_property.setText(entity.getProperty().getPath());
- text_property.setLayoutData(LayoutConstants.FILL());
- text_property.setForeground(ColorResources.getColor(Resources.BLACK));
-
- comboStructuralModifier = formFactory.createDefinedTermComboElementDto(TermType.StructureModifier, formElement, "Structural Modifier", entity.getStructureModifier(), style);
-
-// if (labelText_ratioTo != null){
-// labelText_ratioTo.dispose();
-// }
-// labelText_ratioTo = new Label(formElement.getLayoutComposite(), SWT.NONE);
-// labelText_ratioTo.setText("Ratio to");
-// if (text_ratioTo != null){
-// text_ratioTo.dispose();
-// }
-// text_ratioTo = new Text(formElement.getLayoutComposite(), SWT.WRAP);
-// text_ratioTo.setEditable(false);
-// if (entity.getRatioTo() != null){
-// text_ratioTo.setText(entity.getRatioTo().getPath());
-// }
-// text_ratioTo.setLayoutData(LayoutConstants.FILL());
-// text_ratioTo.setForeground(ColorResources.getColor(Resources.BLACK));
-
- ratioTo = formFactory.createRemovableTextField(formElement, "Ratio to", entity.getRatioTo() != null? entity.getRatioTo().getPath():null, style);
-
- supportsQuantitativeData = formFactory.createCheckbox(formElement, "Supports Quantitative Data", ((FeatureDto) entity).isSupportsQuantitativeData(), style);
- supportsCategoricalData = formFactory.createCheckbox(formElement, "Supports Categorical Data", ((FeatureDto) entity).isSupportsCategoricalData(), style);
- LabelElement availableLabel = formFactory.createLabel(formElement, "Available for");
+ labelText_property = new Label(formElement.getLayoutComposite(), SWT.NONE);
+ labelText_property.setText("Property");
+ if (text_property != null) {
+ text_property.dispose();
+ }
+ text_property = new Text(formElement.getLayoutComposite(), SWT.WRAP);
+ text_property.setEditable(false);
+ text_property.setText(entity.getProperty().getPath());
+ text_property.setLayoutData(LayoutConstants.FILL());
+ text_property.setForeground(ColorResources.getColor(Resources.BLACK));
+ ratioTo = formFactory.createRemovableTextField(formElement, "Ratio to",
+ entity.getRatioTo() != null ? entity.getRatioTo().getPath() : null, style);
+
+ supportsQuantitativeData = formFactory.createCheckbox(formElement, "Supports Quantitative Data",
+ ((FeatureDto) entity).isSupportsQuantitativeData(), style);
+ supportsCategoricalData = formFactory.createCheckbox(formElement, "Supports Categorical Data",
+ ((FeatureDto) entity).isSupportsCategoricalData(), style);
+ LabelElement availableLabel = formFactory.createLabel(formElement, "Available for");
availableLabel.setBold();
- availableForTaxon = formFactory.createCheckbox(formElement, "Taxon", entity.isAvailableForTaxon(), style);
- availableForTaxonName = formFactory.createCheckbox(formElement, "Taxon Name", entity.isAvailableForTaxonName(), style);
- availableForSpecimenOrObservation = formFactory.createCheckbox(formElement, "Occurrence", entity.isAvailableForOccurrence(), style);
+ availableForTaxon = formFactory.createCheckbox(formElement, "Taxon", entity.isAvailableForTaxon(), style);
+ availableForTaxonName = formFactory.createCheckbox(formElement, "Taxon Name", entity.isAvailableForTaxonName(),
+ style);
+ availableForSpecimenOrObservation = formFactory.createCheckbox(formElement, "Occurrence",
+ entity.isAvailableForOccurrence(), style);
if (supportsCategoricalData.getSelection()) {
- sectionStateVocabularies = formFactory.createStateVocabulariesDtoSection(getConversationHolder(),
- parentFormElement, StoreUtil.getSectionStyle(StateVocabularyCollectionSection.class, entity.getClass().getCanonicalName(), true));
+ sectionStateVocabularies = formFactory.createStateVocabulariesDtoSection(parentFormElement,
+ StoreUtil.getSectionStyle(RecommendedStateCollectionSection.class,
+ entity.getClass().getCanonicalName(), true));
sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionStateVocabularies.setEntity((entity));
}
if (supportsQuantitativeData.getSelection()) {
- sectionMeasurementUnits = formFactory.createMeasurementUnitDtoCollectionSection(getConversationHolder(),
- parentFormElement, StoreUtil.getSectionStyle(MeasurementUnitCollectionSection.class, entity.getClass().getCanonicalName(), true));
+ sectionMeasurementUnits = formFactory.createMeasurementUnitDtoCollectionSection(parentFormElement,
+ StoreUtil.getSectionStyle(MeasurementUnitCollectionSection.class,
+ entity.getClass().getCanonicalName(), true));
sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionMeasurementUnits.setEntity((entity));
- sectionStatisticalMeasures = formFactory.createStatisticalMeasureDtoCollectionSection(getConversationHolder(),
- parentFormElement, StoreUtil.getSectionStyle(StatisticalMeasureCollectionSection.class, entity.getClass().getCanonicalName(), true));
+ sectionStatisticalMeasures = formFactory.createStatisticalMeasureDtoCollectionSection(parentFormElement,
+ StoreUtil.getSectionStyle(StatisticalMeasureCollectionSection.class,
+ entity.getClass().getCanonicalName(), true));
sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionStatisticalMeasures.setEntity((entity));
}
if (supportsCategoricalData.getSelection() || supportsQuantitativeData.getSelection()) {
sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesDtoCollectionSection(
- getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierVocabulariesCollectionSection.class, entity.getClass().getCanonicalName(), true));
+ parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierCollectionsCollectionSection.class,
+ entity.getClass().getCanonicalName(), true));
sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionModifierVocabularies.setEntity((entity));
}
}
- public String getPropertyText() {
- return getEntity().getProperty()!=null?getEntity().getProperty().getPath():"[no property]";
+ public String getPropertyText() {
+ return getEntity().getProperty() != null ? getEntity().getProperty().getPath() : "[no property]";
}
public String getStructureText(Character entity) {
- return entity.getStructure()!=null?entity.getStructure().getPath():"[no structure]";
+ return entity.getStructure() != null ? entity.getStructure().getPath() : "[no structure]";
}
-// public void createText(ICdmFormElement formElement, String label, String path) {
-// labelText = new Label(formElement.getLayoutComposite(), SWT.NONE);
-// labelText.setText(label);
-// Text text = new Text(formElement.getLayoutComposite(), SWT.WRAP);
-// text.setText(path);
-// text.setEditable(false);
-// text.setLayoutData(LayoutConstants.FILL());
-// text.setForeground(ColorResources.getColor(Resources.BLACK));
-// }
@Override
public void setEntity(CharacterDto entity) {
setEnabled(TermBasePropertyTester.isModifiable(entity));
}
- @Override
- public void handleEvent(Object eventSource) {
- if(eventSource == comboStructuralModifier){
- getEntity().setStructureModifier(TermDto.fromTerm(comboStructuralModifier.getSelection()));
- }
- if(eventSource == ratioTo){
- if (!ratioTo.isState()){
- getEntity().setRatioTo(null);
- }
+ @Override
+ public void handleEvent(Object eventSource) {
+ if (eventSource == ratioTo) {
+ if (!ratioTo.isState()) {
+ getEntity().setRatioTo(null);
+ element_Representation.setTermDto(getEntity(), enabled);
+ }
}
-// if(eventSource == supportsQuantitativeData || eventSource == supportsCategoricalData){
-// //if any type is selected disable supportsTextData
-// getEntity().setSupportsCategoricalData(supportsCategoricalData.getSelection());
-// getEntity().setSupportsQuantitativeData(supportsQuantitativeData.getSelection());
-// }
- if(eventSource == supportsQuantitativeData){
- getEntity().setSupportsQuantitativeData(supportsQuantitativeData.getSelection());
- getEntity().setSupportsCategoricalData(supportsCategoricalData.getSelection());
- if(supportsQuantitativeData.getSelection()){
- activateQuantitativeWidgets();
- }
- else{
- removeQuantitativeWidgets();
- }
+ if (eventSource == supportsQuantitativeData) {
+ getEntity().setSupportsQuantitativeData(supportsQuantitativeData.getSelection());
+ getEntity().setSupportsCategoricalData(supportsCategoricalData.getSelection());
+ if (supportsQuantitativeData.getSelection()) {
+ activateQuantitativeWidgets();
+ } else {
+ removeQuantitativeWidgets();
+ }
StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
- }
- else if(eventSource == supportsCategoricalData){
- getEntity().setSupportsCategoricalData(supportsCategoricalData.getSelection());
- getEntity().setSupportsQuantitativeData(supportsQuantitativeData.getSelection());
+ } else if (eventSource == supportsCategoricalData) {
+ getEntity().setSupportsCategoricalData(supportsCategoricalData.getSelection());
+ getEntity().setSupportsQuantitativeData(supportsQuantitativeData.getSelection());
if (supportsCategoricalData.getSelection()) {
activateCategoricalWidgets();
+ } else {
+ removeCategoricalWidgets();
}
- else{
- removeCategoricalWidgets();
- }
StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
- }
- else if (eventSource == element_Representation) {
+ } else if (eventSource == element_Representation) {
Representation selectedRepresentation = element_Representation.getSelectedRepresentation();
- if(selectedRepresentation!=null){
+ if (selectedRepresentation != null) {
Language representationLanguage = selectedRepresentation.getLanguage();
- if(representationLanguage==null){
+ if (representationLanguage == null) {
representationLanguage = Language.getDefaultLanguage();
}
-// TODO:handle representations correctly
-// getEntity().setLabel(selectedRepresentation.getLabel(), representationLanguage);
-// getEntity().getRepresentation(representationLanguage).setAbbreviatedLabel(selectedRepresentation.getAbbreviatedLabel());
-// getEntity().getRepresentation(representationLanguage).setText(selectedRepresentation.getDescription());
}
-// getEntity().setTitleCache(null);
- }
- else if(eventSource == availableForSpecimenOrObservation){
+ } else if (eventSource == availableForSpecimenOrObservation) {
getEntity().setAvailableForOccurrence(availableForSpecimenOrObservation.getSelection());
-
- }
- else if(eventSource == availableForTaxon){
+
+ } else if (eventSource == availableForTaxon) {
getEntity().setAvailableForTaxon(availableForTaxon.getSelection());
-
- }
- else if(eventSource == availableForTaxonName){
+
+ } else if (eventSource == availableForTaxonName) {
getEntity().setAvailableForTaxonName(availableForTaxonName.getSelection());
-
+
+ }
+ }
+
+ private void activateQuantitativeWidgets() {
+ // disable categorical widgets
+ supportsCategoricalData.setSelection(false);
+ getEntity().setSupportsCategoricalData(false);
+ removeCategoricalWidgets();
+
+ // measurement units
+ sectionMeasurementUnits = formFactory.createMeasurementUnitDtoCollectionSection(parentFormElement,
+ StoreUtil.getSectionStyle(MeasurementUnitCollectionSection.class,
+ getEntity().getClass().getCanonicalName(), true));
+ sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ sectionMeasurementUnits.setEntity((getEntity()));
+
+ // statistical measures
+ sectionStatisticalMeasures = formFactory.createStatisticalMeasureDtoCollectionSection(parentFormElement,
+ StoreUtil.getSectionStyle(StatisticalMeasureCollectionSection.class,
+ getEntity().getClass().getCanonicalName(), true));
+ sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ sectionStatisticalMeasures.setEntity((getEntity()));
+
+ // modifiers
+ sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesDtoCollectionSection(
+ parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierCollectionsCollectionSection.class,
+ getEntity().getClass().getCanonicalName(), true));
+ sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ sectionModifierVocabularies.setEntity((getEntity()));
+ }
+
+ private void removeQuantitativeWidgets() {
+ if (sectionMeasurementUnits != null) {
+ removeElementsAndControls(sectionMeasurementUnits);
+ removeElementsAndControls(sectionStatisticalMeasures);
+ removeElementsAndControls(sectionModifierVocabularies);
}
- }
-
- private void activateQuantitativeWidgets(){
- //disable categorical widgets
- supportsCategoricalData.setSelection(false);
- getEntity().setSupportsCategoricalData(false);
- removeCategoricalWidgets();
-
- //measurement units
- sectionMeasurementUnits = formFactory.createMeasurementUnitDtoCollectionSection(getConversationHolder(),
- parentFormElement, StoreUtil.getSectionStyle(MeasurementUnitCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
- sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- sectionMeasurementUnits.setEntity((getEntity()));
-
- //statistical measures
- sectionStatisticalMeasures = formFactory.createStatisticalMeasureDtoCollectionSection(
- getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(StatisticalMeasureCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
- sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- sectionStatisticalMeasures.setEntity((getEntity()));
-
- //modifiers
- sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesDtoCollectionSection(
- getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierVocabulariesCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
- sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- sectionModifierVocabularies.setEntity((getEntity()));
- }
-
- private void removeQuantitativeWidgets(){
- if(sectionMeasurementUnits!=null){
- removeElementsAndControls(sectionMeasurementUnits);
- removeElementsAndControls(sectionStatisticalMeasures);
- removeElementsAndControls(sectionModifierVocabularies);
- }
- }
-
- private void activateCategoricalWidgets(){
- //disable quantitative widgeets
- supportsQuantitativeData.setSelection(false);
- getEntity().setSupportsQuantitativeData(false);
- removeQuantitativeWidgets();
-
- //states
- sectionStateVocabularies = formFactory.createStateVocabulariesDtoSection(getConversationHolder(),
- parentFormElement, StoreUtil.getSectionStyle(StateVocabularyCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
+ }
+
+ private void activateCategoricalWidgets() {
+ // disable quantitative widgeets
+ supportsQuantitativeData.setSelection(false);
+ getEntity().setSupportsQuantitativeData(false);
+ removeQuantitativeWidgets();
+
+ // states
+ sectionStateVocabularies = formFactory.createStateVocabulariesDtoSection(parentFormElement,
+ StoreUtil.getSectionStyle(RecommendedStateCollectionSection.class,
+ getEntity().getClass().getCanonicalName(), true));
sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionStateVocabularies.setEntity((getEntity()));
- //modifiers
+ // modifiers
sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesDtoCollectionSection(
- getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierVocabulariesCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
+ parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierCollectionsCollectionSection.class,
+ getEntity().getClass().getCanonicalName(), true));
sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionModifierVocabularies.setEntity((getEntity()));
- }
+ }
- private void removeCategoricalWidgets(){
- if(sectionStateVocabularies!=null){
- removeElementsAndControls(sectionStateVocabularies);
- removeElementsAndControls(sectionModifierVocabularies);
- }
- }
+ private void removeCategoricalWidgets() {
+ if (sectionStateVocabularies != null) {
+ removeElementsAndControls(sectionStateVocabularies);
+ removeElementsAndControls(sectionModifierVocabularies);
+ }
+ }
- @Override
+ @Override
public void propertyChange(PropertyChangeEvent event) {
- EventUtility.postEvent(WorkbenchEventConstants.ADD_SAVE_CANDIDATE, getEntity());
- super.propertyChange(event);
+ EventUtility.postEvent(WorkbenchEventConstants.ADD_SAVE_CANDIDATE, getEntity().getUuid());
+ super.propertyChange(event);
+
+ }
- }
+ @Override
+ public void fillFields() {
+ if (getEntity() != null) {
+ element_Representation.setTermDto(getEntity(), true);
+ supportsQuantitativeData.setSelection(getEntity().isSupportsQuantitativeData());
+ supportsCategoricalData.setSelection(getEntity().isSupportsCategoricalData());
+ availableForTaxon.setSelection(getEntity().isAvailableForTaxon());
+ availableForTaxonName.setSelection(getEntity().isAvailableForTaxonName());
+ availableForSpecimenOrObservation.setSelection(getEntity().isAvailableForOccurrence());
+ sectionStateVocabularies.setEntity(getEntity());
+ sectionMeasurementUnits.setEntity(getEntity());
+ sectionStatisticalMeasures.setEntity(getEntity());
+ sectionModifierVocabularies.setEntity(getEntity());
+ text_structure.setText(getEntity().getStructure().getPath());
+ text_property.setText(getEntity().getProperty().getPath());
+ ratioTo.setText(getEntity().getRatioTo() != null ? getEntity().getRatioTo().getPath() : null);
+ }
+
+ }
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.persistence.dto.CharacterDto;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
/**
- *
* @author pplitzner
* @since Dec 21, 2017
- *
*/
public class CharacterDtoDetailSection extends AbstractCdmDetailSection<CharacterDto> {
public CharacterDtoDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
return "Character";
}
- /**
- * {@inheritDoc}
- */
@Override
protected AbstractCdmDetailElement<CharacterDto> createCdmDetailElement(AbstractCdmDetailSection<CharacterDto> parentElement,
int style) {
return formFactory.createCharacterDtoDetailElement(parentElement, style);
}
-
-}
+}
\ No newline at end of file
private CharacterDetailSection characterDetails;
private ICdmFormElement parentFormElement;
-//
-// protected RepresentationElement element_Representation;
-//
-// private TermComboElement<DefinedTerm> comboStructuralModifier;
-//
-// private CheckboxElement supportsQuantitativeData;
-//
-// private CheckboxElement supportsCategoricalData;
-//
-// private StateVocabularyCollectionSection sectionStateVocabularies;
-//
-// private MeasurementUnitCollectionSection sectionMeasurementUnits;
-//
-// private StatisticalMeasureCollectionSection sectionStatisticalMeasures;
-//
-// private RecommendedModifierVocabulariesCollectionSection sectionModifierVocabularies;
-
private InapplicableIfEntityCollectionSectionForNode sectionInapplicableIf;
private OnlyApplicableIfEntityCollectionSectionForNode sectionOnlyApplicableIf;
protected void createControls(ICdmFormElement formElement, TermNode<Character> entity, int style) {
this.parentFormElement = formElement;
// characterDetails = formFactory.createCharacterDetailElement(formElement, style);
- characterDetails = formFactory.createCharacterDetailSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(CharacterDetailSection.class, entity.getClass().getCanonicalName(), true));
+ characterDetails = formFactory.createCharacterDetailSection(formElement, null, StoreUtil.getSectionStyle(CharacterDetailSection.class, entity.getClass().getCanonicalName(), true));
characterDetails.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
addElement(characterDetails);
addControl(characterDetails);
characterDetails.setEntity(entity.getTerm());
-// element_Representation = formFactory.createTranslatableRepresentationElement(formElement, entity.getTerm().getPreferredRepresentation(CdmStore.getDefaultLanguage()),entity.getTerm(), 100, style, true);
-//
-// createText(formElement, "Structure", getStructureText(entity.getTerm()));
-// createText(formElement, "Property", getPropertyText(entity.getTerm()));
-//
-// comboStructuralModifier = formFactory.createDefinedTermComboElement(TermType.StructureModifier, formElement, "Structural Modifier", entity.getTerm().getStructureModifier(), style);
-//
-// supportsQuantitativeData = formFactory.createCheckbox(formElement, "Supports Quantitative Data", entity.getTerm().isSupportsQuantitativeData(), style);
-// supportsCategoricalData = formFactory.createCheckbox(formElement, "Supports Categorical Data", entity.getTerm().isSupportsCategoricalData(), style);
-//
-// if (supportsCategoricalData.getSelection()) {
-// sectionStateVocabularies = formFactory.createStateVocabulariesSection(getConversationHolder(),
-// parentFormElement, StoreUtil.getSectionStyle(StateVocabularyCollectionSection.class, entity.getClass().getCanonicalName(), true));
-// sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-// sectionStateVocabularies.setEntity(entity.getTerm());
-// }
-// if (supportsQuantitativeData.getSelection()) {
-// sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(getConversationHolder(),
-// parentFormElement, StoreUtil.getSectionStyle(MeasurementUnitCollectionSection.class, entity.getClass().getCanonicalName(), true));
-// sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-// sectionMeasurementUnits.setEntity(entity.getTerm());
-//
-// sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection(getConversationHolder(),
-// parentFormElement, StoreUtil.getSectionStyle(StatisticalMeasureCollectionSection.class, entity.getClass().getCanonicalName(), true));
-// sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-// sectionStatisticalMeasures.setEntity(entity.getTerm());
-// }
-// if (supportsCategoricalData.getSelection() || supportsQuantitativeData.getSelection()) {
-// sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(
-// getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierVocabulariesCollectionSection.class, entity.getClass().getCanonicalName(), true));
-// sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-// sectionModifierVocabularies.setEntity(entity.getTerm());
-// }
-
// applicability
- sectionInapplicableIf = formFactory.createInapplicableIfEntityCollectionSectionForNode(getConversationHolder(),
+ sectionInapplicableIf = formFactory.createInapplicableIfEntityCollectionSectionForNode(
formElement, StoreUtil.getSectionStyle(InapplicableIfEntityCollectionSection.class, entity.getTerm().getClass().getCanonicalName()));
sectionInapplicableIf.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionInapplicableIf.setEntity(getEntity());
- sectionOnlyApplicableIf = formFactory.createOnlyApplicableIfEntityCollectionSectionForNode(getConversationHolder(),
- formElement, StoreUtil.getSectionStyle(OnlyApplicableIfEntityCollectionSection.class, entity.getTerm().getClass().getCanonicalName()));
+ sectionOnlyApplicableIf = formFactory.createOnlyApplicableIfEntityCollectionSectionForNode(formElement,
+ StoreUtil.getSectionStyle(OnlyApplicableIfEntityCollectionSection.class, entity.getTerm().getClass().getCanonicalName()));
sectionOnlyApplicableIf.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionOnlyApplicableIf.setEntity(entity);
-
}
-
-
public static String getPropertyText(Character entity) {
return entity.getProperty()!=null?StoreUtil.getPath(entity.getProperty()):"[no property]";
}
super.setEntity(entity);
characterDetails.setEntity(entity.getTerm());
setEnabled(TermBasePropertyTester.isModifiable(entity));
-
}
-
-
@Override
public void handleEvent(Object eventSource) {
-// if(eventSource == characterDetails){
-// getEntity().getTerm().setStructureModifier(comboStructuralModifier.getSelection());
-// }
-// if(eventSource == supportsQuantitativeData || eventSource == supportsCategoricalData){
-// //if any type is selected disable supportsTextData
-// getEntity().getTerm().setSupportsTextData(false);
-// }
-// if(eventSource == supportsQuantitativeData){
-// getEntity().getTerm().setSupportsQuantitativeData(supportsQuantitativeData.getSelection());
-// if(supportsQuantitativeData.getSelection()){
-// activateQuantitativeWidgets();
-// }
-// else{
-// removeQuantitativeWidgets();
-// }
-// StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
-// }
-// else if(eventSource == supportsCategoricalData){
-// getEntity().getTerm().setSupportsCategoricalData(supportsCategoricalData.getSelection());
-// if (supportsCategoricalData.getSelection()) {
-// activateCategoricalWidgets();
-// }
-// else{
-// removeCategoricalWidgets();
-// }
-// StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
-// }
-// else if (eventSource == element_Representation) {
-// Representation selectedRepresentation = element_Representation.getSelectedRepresentation();
-// if(selectedRepresentation!=null){
-// Language representationLanguage = selectedRepresentation.getLanguage();
-// if(representationLanguage==null){
-// representationLanguage = Language.getDefaultLanguage();
-// }
-// getEntity().getTerm().setLabel(selectedRepresentation.getLabel(), representationLanguage);
-// getEntity().getTerm().getRepresentation(representationLanguage).setAbbreviatedLabel(selectedRepresentation.getAbbreviatedLabel());
-// getEntity().getTerm().getRepresentation(representationLanguage).setText(selectedRepresentation.getDescription());
-// }
-// getEntity().getTerm().setTitleCache(null);
-// }
- }
-
-
-// private void activateQuantitativeWidgets(){
-// //disable categorical widgets
-// supportsCategoricalData.setSelection(false);
-// getEntity().getTerm().setSupportsCategoricalData(false);
-// removeCategoricalWidgets();
-//
-// //measurement units
-// sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(getConversationHolder(),
-// parentFormElement, StoreUtil.getSectionStyle(MeasurementUnitCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
-// sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-// sectionMeasurementUnits.setEntity(getEntity().getTerm());
-//
-// //statistical measures
-// sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection(
-// getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(StatisticalMeasureCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
-// sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-// sectionStatisticalMeasures.setEntity(getEntity().getTerm());
-//
-// //modifiers
-// sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(
-// getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierVocabulariesCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
-// sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-// sectionModifierVocabularies.setEntity(getEntity().getTerm());
-// }
-//
-// private void removeQuantitativeWidgets(){
-// if(sectionMeasurementUnits!=null){
-// removeElementsAndControls(sectionMeasurementUnits);
-// removeElementsAndControls(sectionStatisticalMeasures);
-// removeElementsAndControls(sectionModifierVocabularies);
-// }
-// }
-//
-// private void activateCategoricalWidgets(){
-// //disable quantitative widgeets
-// supportsQuantitativeData.setSelection(false);
-// getEntity().getTerm().setSupportsQuantitativeData(false);
-// removeQuantitativeWidgets();
-//
-// //states
-// sectionStateVocabularies = formFactory.createStateVocabulariesSection(getConversationHolder(),
-// parentFormElement, StoreUtil.getSectionStyle(StateVocabularyCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
-// sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-// sectionStateVocabularies.setEntity(getEntity().getTerm());
-//
-// //modifiers
-// sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(
-// getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierVocabulariesCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
-// sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-// sectionModifierVocabularies.setEntity(getEntity().getTerm());
-// }
-//
-// private void removeCategoricalWidgets(){
-// if(sectionStateVocabularies!=null){
-// removeElementsAndControls(sectionStateVocabularies);
-// removeElementsAndControls(sectionModifierVocabularies);
-// }
-// }
+ }
-}
+ @Override
+ public void fillFields() {
+ characterDetails.setEntity(getEntity().getTerm());
+ sectionInapplicableIf.setEntity(getEntity());
+ sectionOnlyApplicableIf.setEntity(getEntity());
+
+ }
+}
\ No newline at end of file
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.Character;
import eu.etaxonomy.cdm.model.term.TermNode;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
*
* @author pplitzner
* @since Aug 19, 2019
- *
*/
public class CharacterNodeDetailSection extends AbstractCdmDetailSection<TermNode<Character>> {
public CharacterNodeDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
return "Character Node";
}
- /**
- * {@inheritDoc}
- */
@Override
protected AbstractCdmDetailElement<TermNode<Character>> createCdmDetailElement(AbstractCdmDetailSection<TermNode<Character>> parentElement,
int style) {
return formFactory.createCharacterNodeDetailElement(parentElement, style);
}
-
-}
+}
\ No newline at end of file
protected void createControls(ICdmFormElement formElement, TermNodeDto entity, int style) {
this.parentFormElement = formElement;
// characterDetails = formFactory.createCharacterDetailElement(formElement, style);
- characterDetails = formFactory.createCharacterDtoDetailSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(CharacterDetailSection.class, entity.getClass().getCanonicalName(), true));
+ characterDetails = formFactory.createCharacterDtoDetailSection(formElement, null, StoreUtil.getSectionStyle(CharacterDetailSection.class, entity.getClass().getCanonicalName(), true));
characterDetails.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
addElement(characterDetails);
addControl(characterDetails);
characterDetails.setEntity((CharacterDto)entity.getTerm());
// applicability
- sectionInapplicableIf = formFactory.createInapplicableIfEntityCollectionSection(getConversationHolder(),
+ sectionInapplicableIf = formFactory.createInapplicableIfEntityCollectionSection(
formElement, StoreUtil.getSectionStyle(InapplicableIfEntityCollectionSection.class, entity.getTerm().getClass().getCanonicalName()));
sectionInapplicableIf.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionInapplicableIf.setEntity(getEntity());
- sectionOnlyApplicableIf = formFactory.createOnlyApplicableIfEntityCollectionSection(getConversationHolder(),
+ sectionOnlyApplicableIf = formFactory.createOnlyApplicableIfEntityCollectionSection(
formElement, StoreUtil.getSectionStyle(OnlyApplicableIfEntityCollectionSection.class, entity.getTerm().getClass().getCanonicalName()));
sectionOnlyApplicableIf.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionOnlyApplicableIf.setEntity(entity);
// }
}
+ @Override
+ public void fillFields() {
+ characterDetails.setEntity((CharacterDto)getEntity().getTerm());
+ sectionInapplicableIf.setEntity(getEntity());
+ sectionOnlyApplicableIf.setEntity(getEntity());
+
+ }
+
// private void activateQuantitativeWidgets(){
// //disable categorical widgets
// supportsCategoricalData.setSelection(false);
// removeCategoricalWidgets();
//
// //measurement units
-// sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(getConversationHolder(),
+// sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(
// parentFormElement, StoreUtil.getSectionStyle(MeasurementUnitCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
// sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
// sectionMeasurementUnits.setEntity(getEntity().getTerm());
//
// //statistical measures
// sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection(
-// getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(StatisticalMeasureCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
+// parentFormElement, StoreUtil.getSectionStyle(StatisticalMeasureCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
// sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
// sectionStatisticalMeasures.setEntity(getEntity().getTerm());
//
// //modifiers
// sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(
-// getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierVocabulariesCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
+// parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierVocabulariesCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
// sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
// sectionModifierVocabularies.setEntity(getEntity().getTerm());
// }
// removeQuantitativeWidgets();
//
// //states
-// sectionStateVocabularies = formFactory.createStateVocabulariesSection(getConversationHolder(),
+// sectionStateVocabularies = formFactory.createStateVocabulariesSection(
// parentFormElement, StoreUtil.getSectionStyle(StateVocabularyCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
// sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
// sectionStateVocabularies.setEntity(getEntity().getTerm());
//
// //modifiers
// sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(
-// getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierVocabulariesCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
+// parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierVocabulariesCollectionSection.class, getEntity().getClass().getCanonicalName(), true));
// sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
// sectionModifierVocabularies.setEntity(getEntity().getTerm());
// }
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
public class CharacterNodeDtoDetailSection extends AbstractCdmDetailSection<TermNodeDto> {
public CharacterNodeDtoDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Label;
-import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
+import eu.etaxonomy.cdm.api.service.geo.IDistributionService;
import eu.etaxonomy.cdm.common.URI;
import eu.etaxonomy.cdm.common.UriUtils;
-import eu.etaxonomy.cdm.ext.geo.IEditGeoService;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
// FIXME due to a bug in the rest map service we have to ensure that width will always be an even number
// image.calculateWidth() % 2 == 1 ? image.calculateWidth() + 1 :
int width = image.calculateWidth();
- IEditGeoService editGeoService;
- List<Language> languages = Arrays.asList(new Language[]{CdmStore.getDefaultLanguage()});
- editGeoService = ((CdmApplicationRemoteController)CdmStore.getCurrentApplicationConfiguration()).getEditGeoService();
- String parameter = editGeoService.getDistributionServiceRequestParameterString(
+ List<Language> languages = Arrays.asList(new Language[]{CdmStore.getDefaultLanguage()});
+ IDistributionService distributionService = CdmStore.getCurrentApplicationConfiguration().getDistributionService();
+ boolean includeUnpublished = true;
+
+ String parameter = distributionService.getDistributionServiceRequestParameterString(
getTaxonDescriptions(),
false,
false,
null,
presenceAbsenceTermColors,
- languages);
+ languages,
+ includeUnpublished);
String mapUriString = String.format("%s?%s&ms=1000&bbox=-180,-90,180,90&l=earth", accessPoint, parameter);
return mapUriString;
return false;
}
+ @Override
+ public void fillFields() {
+ String serviceUriString = PreferencesUtil.getStringValue(PreferencePredicate.EditMapServiceAccessPoint.getKey());
+ String message = null;
+ try {
+ URI serviceUri = new URI(serviceUriString);
+ if(UriUtils.isServiceAvailable(serviceUri, 500)){
+// image = formFactory.createBrowserElement(formElement, null, style);
+ // FIXME : This is a temporary workaround which ic
+ // waiting for #5357 to be fixed
+ if(!isUnsavedDistribution(getEntity())) {
+ String mapUriString = getMapUriString(getEntity());
+ image.setImageUriString(mapUriString);
+ message = mapUriString;
+ }
+ getParentElement().getLayoutComposite().layout();
+
+ return;
+ } else {
+ message = String.format("The service is not available: %s", serviceUriString);
+ }
+ } catch (URISyntaxException e) {
+ message = String.format("The URI has problems: %s", serviceUriString);
+ }
+
+ }
+
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
*
* @author n.hoffmann
* @created Sep 23, 2010
- * @version 1.0
*/
public class FeatureDistributionDetailSection extends AbstractCdmDetailSection<Feature> {
- /**
- * <p>Constructor for FeatureDistributionDetailSection.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
- * @param style a int.
- */
public FeatureDistributionDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
- /** {@inheritDoc} */
@Override
public String getHeading() {
return "Distribution Map";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection<Feature> parentElement, int style) {
//FIXME generic
return formFactory.createFeatureDistributionDetailElement(parentElement);
}
-}
+}
\ No newline at end of file
import eu.etaxonomy.cdm.api.service.ITermNodeService;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.FeatureState;
-import eu.etaxonomy.cdm.model.description.State;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
+import eu.etaxonomy.cdm.model.term.TermCollection;
import eu.etaxonomy.cdm.model.term.TermNode;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
import eu.etaxonomy.cdm.persistence.dto.FeatureStateDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
/**
* @author pplitzner
* @since Aug 16, 2019
- *
*/
public class FeatureStateWizardPage extends AbstractEntityCollectionElementWizardPage {
private Button btnSelectState;
private TermNodeDto termNode;
- private State selectedState = null;
+ private DefinedTermBase<?> selectedState = null;
private List<TermVocabularyDto> stateVocabulariesDtos = new ArrayList<>();
private Text text;
public void createControl(Composite parent) {
super.createControl(parent);
- comboFeature = formFactory.createDefinedTermComboElement(Collections.EMPTY_LIST, rootElement, "Parent Feature", null, SWT.NONE);
+ comboFeature = formFactory.createDefinedTermComboElement(Collections.EMPTY_LIST, rootElement, "Parent Feature",
+ null, SWT.NONE);
Label label = new Label(rootElement.getLayoutComposite(), SWT.NONE);
label.setText("State");
if (dialog.open() == IStatus.OK) {
Collection<DefinedTermBase> additionalTerms = wizard.getAdditionalFeatures();
- if(additionalTerms.size()==1){
- selectedState = (State) additionalTerms.iterator().next();
+ if (additionalTerms.size() == 1) {
+ selectedState = additionalTerms.iterator().next();
text.setText(selectedState.getLabel());
FeatureStateWizardPage.this.getWizard().getContainer().updateButtons();
}
updateFeatureCombo();
}
- FeatureStateDto getFeatureStateDto(){
- return new FeatureStateDto(null, FeatureDto.fromFeature(comboFeature.getSelection()), TermDto.fromTerm(selectedState));
+ FeatureStateDto getFeatureStateDto() {
+ return new FeatureStateDto(null, FeatureDto.fromFeature(comboFeature.getSelection()),
+ TermDto.fromTerm(selectedState));
}
- FeatureState getFeatureState(){
+
+ FeatureState getFeatureState() {
return FeatureState.NewInstance(comboFeature.getSelection(), selectedState);
}
- private void updateFeatureCombo(){
+
+ private void updateFeatureCombo() {
List<Feature> features = new ArrayList<>();
UUID parentUuid = termNode.getParentUuid();
- if (parentUuid != null){
+ if (parentUuid != null) {
TermNode<? extends Feature> parent = CdmStore.getService(ITermNodeService.class).load(parentUuid);
- while(parent!=null){
+ while (parent != null) {
Feature parentTerm = parent.getTerm();
- if(parentTerm!=null
- && parentTerm.isSupportsCategoricalData()
- && !parentTerm.getSupportedCategoricalEnumerations().isEmpty()){
+ if (parentTerm != null && parentTerm.isSupportsCategoricalData()
+ && !parentTerm.getSupportedCategoricalEnumerations().isEmpty()) {
features.add(parentTerm);
}
parent = parent.getParent();
}
}
comboFeature.setTerms(features);
- if(features.size()==1){
+ if (features.size() == 1) {
Feature feature = features.get(0);
comboFeature.setSelection(feature);
updateStateCombo(feature);
}
}
- private void updateStateCombo(Feature feature){
+ private void updateStateCombo(Feature feature) {
stateVocabulariesDtos.clear();
text.setText("");
selectedState = null;
- if(feature!=null){
- Set<TermVocabulary<State>> stateVocabularies = feature.getSupportedCategoricalEnumerations();
- for (TermVocabulary<State> termVocabulary : stateVocabularies) {
- stateVocabulariesDtos.add(new TermVocabularyDto(termVocabulary.getUuid(), termVocabulary.getRepresentations(), termVocabulary.getTermType(), termVocabulary.getTitleCache(), termVocabulary.isAllowDuplicates(), termVocabulary.isOrderRelevant(), termVocabulary.isFlat()));
+ if (feature != null) {
+ Set<TermCollection<? extends DefinedTermBase, ?>> stateVocabularies = feature
+ .getSupportedCategoricalEnumerations();
+ for (TermCollection<? extends DefinedTermBase, ?> termVocabulary : stateVocabularies) {
+ stateVocabulariesDtos.add(new TermVocabularyDto(termVocabulary.getUuid(),
+ termVocabulary.getRepresentations(), termVocabulary.getTermType(),
+ termVocabulary.getTitleCache(), termVocabulary.isAllowDuplicates(),
+ termVocabulary.isOrderRelevant(), termVocabulary.isFlat()));
}
}
}
@Override
public boolean isPageComplete() {
- return comboFeature.getSelection()!=null && selectedState!=null;
+ return comboFeature.getSelection() != null && selectedState != null;
}
@Override
public void propertyChange(PropertyChangeEvent event) {
- if(event.getSource()==comboFeature){
+ if (event.getSource() == comboFeature) {
Feature feature = comboFeature.getSelection();
updateStateCombo(feature);
comboFeature.removeEmptyElement();
}
getWizard().getContainer().updateButtons();
}
-
-}
+}
\ No newline at end of file
-// $Id$
/**
* Copyright (C) 2018 EDIT
* European Distributed Institute of Taxonomy
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.wizard.WizardDialog;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+
import eu.etaxonomy.cdm.persistence.dto.FeatureStateDto;
import eu.etaxonomy.cdm.persistence.dto.FeatureStateDtoComparator;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
-
/**
* @author pplitzner
* @date 06.03.2018
- *
*/
public class InapplicableIfEntityCollectionSection extends AbstractEntityCollectionSection<TermNodeDto, FeatureStateDto>{
- public InapplicableIfEntityCollectionSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ public InapplicableIfEntityCollectionSection(CdmFormFactory formFactory,
ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Inapplicable If", style);
-
+ super(formFactory, parentElement, "Inapplicable If", style);
}
- /**
- * {@inheritDoc}
- */
@Override
public Collection<FeatureStateDto> getCollection(TermNodeDto entity) {
return entity.getInapplicableIf();
}
- /**
- * {@inheritDoc}
- */
@Override
public Comparator<FeatureStateDto> getComparator() {
return new FeatureStateDtoComparator();
}
-
- /**
- * {@inheritDoc}
- */
@Override
public FeatureStateDto createNewElement() {
FeatureStateWizard wizard = new FeatureStateWizard(getEntity(), formFactory);
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public void addElement(FeatureStateDto element) {
getEntity().getInapplicableIf().add(element);
}
- /**
- * {@inheritDoc}
- */
@Override
public FeatureStateDto addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
- /**
- * {@inheritDoc}
- */
@Override
public void removeElement(FeatureStateDto element) {
getEntity().getInapplicableIf().remove(element);
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No feature state added yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a feature state";
}
-
-}
+}
\ No newline at end of file
-// $Id$
/**
* Copyright (C) 2018 EDIT
* European Distributed Institute of Taxonomy
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.wizard.WizardDialog;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.FeatureState;
import eu.etaxonomy.cdm.model.term.TermNode;
-import eu.etaxonomy.cdm.persistence.dto.FeatureStateDto;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author pplitzner
* @date 06.03.2018
- *
*/
public class InapplicableIfEntityCollectionSectionForNode extends AbstractEntityCollectionSection<TermNode, FeatureState>{
- public InapplicableIfEntityCollectionSectionForNode(CdmFormFactory formFactory, ConversationHolder conversation,
+ public InapplicableIfEntityCollectionSectionForNode(CdmFormFactory formFactory,
ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Inapplicable If", style);
+ super(formFactory, parentElement, "Inapplicable If", style);
}
- /**
- * {@inheritDoc}
- */
@Override
public Collection<FeatureState> getCollection(TermNode entity) {
return entity.getInapplicableIf();
}
- /**
- * {@inheritDoc}
- */
@Override
public Comparator<FeatureState> getComparator() {
return new DefaultCdmBaseComparator<>();
}
-
- /**
- * {@inheritDoc}
- */
@Override
public FeatureState createNewElement() {
FeatureStateWizard wizard = new FeatureStateWizard(TermNodeDto.fromNode(getEntity(), null), formFactory);
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public void addElement(FeatureState element) {
getEntity().getInapplicableIf().add(element);
}
- /**
- * {@inheritDoc}
- */
@Override
public FeatureState addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
- /**
- * {@inheritDoc}
- */
@Override
public void removeElement(FeatureState element) {
getEntity().getInapplicableIf().remove(element);
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No feature state added yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a feature state";
}
-
-}
+}
\ No newline at end of file
-// $Id$
/**
* Copyright (C) 2018 EDIT
* European Distributed Institute of Taxonomy
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.wizard.WizardDialog;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-
import eu.etaxonomy.cdm.persistence.dto.FeatureStateDto;
-import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.cdm.persistence.dto.FeatureStateDtoComparator;
+import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
* @author pplitzner
* @date 06.03.2018
- *
*/
public class OnlyApplicableIfEntityCollectionSection extends AbstractEntityCollectionSection<TermNodeDto, FeatureStateDto>{
- public OnlyApplicableIfEntityCollectionSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ public OnlyApplicableIfEntityCollectionSection(CdmFormFactory formFactory,
ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Only applicable if", style);
+ super(formFactory, parentElement, "Only applicable if", style);
}
- /**
- * {@inheritDoc}
- */
@Override
public Collection<FeatureStateDto> getCollection(TermNodeDto entity) {
return entity.getOnlyApplicableIf();
}
- /**
- * {@inheritDoc}
- */
@Override
public Comparator<FeatureStateDto> getComparator() {
return new FeatureStateDtoComparator();
-
}
- /**
- * {@inheritDoc}
- */
@Override
public FeatureStateDto createNewElement() {
FeatureStateWizard wizard = new FeatureStateWizard(getEntity(), formFactory);
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public void addElement(FeatureStateDto element) {
getEntity().getOnlyApplicableIf().add(element);
}
- /**
- * {@inheritDoc}
- */
@Override
public FeatureStateDto addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
- /**
- * {@inheritDoc}
- */
@Override
public void removeElement(FeatureStateDto element) {
getEntity().getOnlyApplicableIf().remove(element);
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No feature state added yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a feature state";
}
-
-}
+}
\ No newline at end of file
-// $Id$
/**
* Copyright (C) 2018 EDIT
* European Distributed Institute of Taxonomy
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.wizard.WizardDialog;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.FeatureState;
import eu.etaxonomy.cdm.model.term.TermNode;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
/**
* @author pplitzner
* @date 06.03.2018
- *
*/
public class OnlyApplicableIfEntityCollectionSectionForNode extends AbstractEntityCollectionSection<TermNode, FeatureState>{
- public OnlyApplicableIfEntityCollectionSectionForNode(CdmFormFactory formFactory, ConversationHolder conversation,
+ public OnlyApplicableIfEntityCollectionSectionForNode(CdmFormFactory formFactory,
ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Only applicable if", style);
+ super(formFactory, parentElement, "Only applicable if", style);
}
- /**
- * {@inheritDoc}
- */
@Override
public Collection<FeatureState> getCollection(TermNode entity) {
return entity.getOnlyApplicableIf();
}
- /**
- * {@inheritDoc}
- */
@Override
public Comparator<FeatureState> getComparator() {
return new DefaultCdmBaseComparator<>();
}
- /**
- * {@inheritDoc}
- */
@Override
public FeatureState createNewElement() {
FeatureStateWizard wizard = new FeatureStateWizard(TermNodeDto.fromNode(getEntity(), null), formFactory);
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public void addElement(FeatureState element) {
getEntity().getOnlyApplicableIf().add(element);
}
- /**
- * {@inheritDoc}
- */
@Override
public FeatureState addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
- /**
- * {@inheritDoc}
- */
@Override
public void removeElement(FeatureState element) {
getEntity().getOnlyApplicableIf().remove(element);
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No feature state added yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a feature state";
}
-
-}
+}
\ No newline at end of file
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
+import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermBasePropertyTester;
import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.store.CdmStore;
@Override
protected void createControls(ICdmFormElement formElement, TermNodeDto entity, int style) {
-
-
- sectionInapplicableIf = formFactory.createInapplicableIfEntityCollectionSection(getConversationHolder(),
- formElement, StoreUtil.getSectionStyle(InapplicableIfEntityCollectionSection.class, getEntity().getClass().getCanonicalName()));
- sectionInapplicableIf.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- sectionInapplicableIf.setEntity(getEntity());
- sectionOnlyApplicableIf = formFactory.createOnlyApplicableIfEntityCollectionSection(getConversationHolder(),
- formElement, StoreUtil.getSectionStyle(OnlyApplicableIfEntityCollectionSection.class, getEntity().getClass().getCanonicalName()));
- sectionOnlyApplicableIf.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
- sectionOnlyApplicableIf.setEntity(getEntity());
-
+
+ if (entity.getType().equals(TermType.Feature)) {
+ sectionInapplicableIf = formFactory.createInapplicableIfEntityCollectionSection(
+ formElement, StoreUtil.getSectionStyle(InapplicableIfEntityCollectionSection.class, getEntity().getClass().getCanonicalName()));
+ sectionInapplicableIf.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ sectionInapplicableIf.setEntity(getEntity());
+ sectionOnlyApplicableIf = formFactory.createOnlyApplicableIfEntityCollectionSection(
+ formElement, StoreUtil.getSectionStyle(OnlyApplicableIfEntityCollectionSection.class, getEntity().getClass().getCanonicalName()));
+ sectionOnlyApplicableIf.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ sectionOnlyApplicableIf.setEntity(getEntity());
+ }
DefinedTermBase term = CdmStore.getService(ITermService.class).load(getEntity().getTerm().getUuid());
AbstractCdmDetailElement termDetailElement = formFactory.createDefinedTermDetailElement(term.getClass(), formElement, style);
termDetailElement.setEntity(term);
termDetailElement.setEnabled(false);
+ if (!TermBasePropertyTester.isModifiable(entity)) {
+ this.setEnabled(false);
+ }
}
EventUtility.postEvent(WorkbenchEventConstants.ADD_SAVE_CANDIDATE, getEntity().getUuid());
}
+ @Override
+ public void fillFields() {
+ sectionInapplicableIf.setEntity(getEntity());
+ sectionOnlyApplicableIf.setEntity(getEntity());
+
+ }
+
}
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.term.TermNode;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
/**
- *
* @author pplitzner
* @since Dec 21, 2017
- *
*/
public class TermNodeDetailSection extends AbstractCdmDetailSection<TermNodeDto> {
public TermNodeDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
return header;
}
- /**
- * {@inheritDoc}
- */
@Override
protected AbstractCdmDetailElement<TermNodeDto> createCdmDetailElement(AbstractCdmDetailSection<TermNodeDto> parentElement,
int style) {
return formFactory.createFeatureNodeDetailElement(parentElement, style);
}
-
-}
+}
\ No newline at end of file
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.term.Representation;
import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermBasePropertyTester;
import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.model.ColorResources;
import eu.etaxonomy.taxeditor.preference.Resources;
-import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
private CheckboxElement orderRelevant;
private CheckboxElement isFlat;
- //private TextWithLabelElement titleCacheText;
+ private TextWithLabelElement titleCacheText;
protected RepresentationElement element_Representation;
public TermTreeDetailElement(CdmFormFactory formFactory,
lblStructureText.setText(entity.getTermType().getLabel());
lblStructureText.setForeground(ColorResources.getColor(Resources.BLACK));
-// titleCacheText = formFactory.createTextWithLabelElement(
-// formElement, "Title Cache", entity.getTitleCache(), style);
- element_Representation = formFactory.createTranslatableRepresentationElementDto(formElement, entity.getPreferredRepresentation(CdmStore.getDefaultLanguage()),entity, 100, style, true);
+ titleCacheText = formFactory.createTextWithLabelElement(
+ formElement, "Title Cache", entity.getTitleCache(), style);
+ //element_Representation = formFactory.createTranslatableRepresentationElementDto(formElement, entity.getPreferredRepresentation(CdmStore.getDefaultLanguage()),entity, 100, style, true);
allowDuplicates = formFactory.createCheckbox(formElement, "Allow duplicates", entity.isAllowDuplicate(), style);
if (entity.isContainsDuplicates() && entity.isAllowDuplicate()){
allowDuplicates.setEnabled(false);
if (entity.containsSubtrees()){
isFlat.setEnabled(false);
}
+ if (!TermBasePropertyTester.isModifiable(entity)) {
+ this.setEnabled(false);
+ }
}
@Override
- protected void updateControlStates() {
+ public void updateControlStates() {
super.updateControlStates();
}
@Override
public void handleEvent(Object eventSource) {
+ if (eventSource == titleCacheText) {
+ getEntity().setTitleCache(titleCacheText.getText());
+ }
if (eventSource == element_Representation) {
// getEntity().setTitleCache(titleCacheText.getText());
Representation selectedRepresentation = element_Representation.getSelectedRepresentation();
getEntity().getRepresentation(representationLanguage).setText(selectedRepresentation.getDescription());
}
}
- getEntity().setTitleCache(null);
+ //getEntity().setTitleCache(null);
}
else
if (eventSource == allowDuplicates) {
}
EventUtility.postEvent(WorkbenchEventConstants.ADD_SAVE_CANDIDATE, getEntity());
}
+
+ @Override
+ public void fillFields() {
+
+ allowDuplicates.setSelection(getEntity().isAllowDuplicate());
+ orderRelevant.setSelection(getEntity().isOrderRelevant());
+ isFlat.setSelection(getEntity().isFlat());
+ element_Representation.setTermDto(getEntity(), enabled);
+
+ }
}
\ No newline at end of file
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.RepresentationElement;
-import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
}
@Override
- protected void updateControlStates() {
+ public void updateControlStates() {
super.updateControlStates();
// toggleable_cache.setEnabled(getEntity().isProtectedTitleCache());
}
}
}
+
+ @Override
+ public void fillFields() {
+ allowDuplicates.setSelection(getEntity().isAllowDuplicates());
+ orderRelevant.setSelection(getEntity().isOrderRelevant());
+ isFlat.setSelection(getEntity().isFlat());
+
+ }
+
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.term.TermTree;
import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
/**
- *
* @author pplitzner
* @since Dec 21, 2017
- *
*/
public class TermTreeDetailSection extends AbstractCdmDetailSection<TermTreeDto> {
public TermTreeDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
return TermTree.class.getSimpleName();
}
- /**
- * {@inheritDoc}
- */
@Override
protected AbstractCdmDetailElement<TermTreeDto> createCdmDetailElement(AbstractCdmDetailSection<TermTreeDto> parentElement,
int style) {
return formFactory.createFeatureTreeDetailElement(parentElement, style);
}
-
-}
+}
\ No newline at end of file
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.term.TermTree;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
/**
- *
* @author pplitzner
* @since Dec 21, 2017
- *
*/
public class TermTreeDetailSectionForNode extends AbstractCdmDetailSection<TermTree> {
public TermTreeDetailSectionForNode(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
return header;
}
- /**
- * {@inheritDoc}
- */
@Override
protected AbstractCdmDetailElement<TermTree> createCdmDetailElement(AbstractCdmDetailSection<TermTree> parentElement,
int style) {
return formFactory.createFeatureTreeDetailElementForTree(parentElement, style);
}
-
-}
+}
\ No newline at end of file
@Override
public void createControls(ICdmFormElement element, int style) {
selection_authority = formFactory.createSelectionElement(
- GrantedAuthorityImpl.class, //getConversationHolder(),
+ GrantedAuthorityImpl.class,
element, "", getEntity(), EntitySelectionElement.SELECTABLE, style);
}
}
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
+
}
* 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.grantedAuthority;
import java.util.Collection;
import org.springframework.security.core.GrantedAuthority;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.permission.Group;
import eu.etaxonomy.taxeditor.ui.dialog.selection.GrantedAuthoritySelectionDialog;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
/**
* @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,
+ ICdmFormElement parentElement,
int style) {
- super(formFactory, conversation, parentElement, "Granted Authorities",
+ super(formFactory, 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() {
// StoreUtil
// .warningDialog("Not implemented yet", getClass(),
// "This functionality needs to be implemented in CDM Library first.");
- GrantedAuthority selection = GrantedAuthoritySelectionDialog.select(getLayoutComposite().getShell(), //getConversationHolder(),
+ GrantedAuthority selection = GrantedAuthoritySelectionDialog.select(getLayoutComposite().getShell(),
null);
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 Authorities yet.";
}
- /*
- * (non-Javadoc)
- *
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
- * getTooltipString()
- */
@Override
protected String getTooltipString() {
return "Add a Granted Authority";
}
- /**
- * {@inheritDoc}
- */
@Override
public GrantedAuthority addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-
-}
+}
\ No newline at end of file
*/
package eu.etaxonomy.taxeditor.ui.section.grantedAuthority;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.permission.GrantedAuthorityImpl;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
*/
public class GrantedAuthorityDetailWizardPage extends AbstractCdmEntityWizardPage<GrantedAuthorityImpl> {
- public GrantedAuthorityDetailWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, GrantedAuthorityImpl entity) {
- super(formFactory, conversation, entity);
+ public GrantedAuthorityDetailWizardPage(CdmFormFactory formFactory, GrantedAuthorityImpl entity) {
+ super(formFactory, entity);
setTitle("Granted Authority");
}
}
}
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
+
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.permission.Group;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @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,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading()
- */
@Override
public String getHeading() {
return "Group " + (getEntity() != null ? getEntity().getName() : "");
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<Group> createCdmDetailElement(AbstractCdmDetailSection<Group> parentElement, int style) {
return formFactory.createGroupDetailElement(parentElement);
}
-
-}
+}
\ No newline at end of file
package eu.etaxonomy.taxeditor.ui.section.group;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.permission.Group;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
* @param conversation
* @param entity
*/
- public GroupDetailWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, Group entity) {
- super(formFactory, conversation, entity);
+ public GroupDetailWizardPage(CdmFormFactory formFactory, Group entity) {
+ super(formFactory, entity);
setTitle("Group");
}
*/
public class GroupSelectionElement extends EntitySelectionElement<Group> {
- public GroupSelectionElement(CdmFormFactory formFactory,//ConversationHolder conversation,
+ public GroupSelectionElement(CdmFormFactory formFactory,
ICdmFormElement parentElement,
String labelString, Group entity, int mode,
int style) {
@Override
public void createControls(ICdmFormElement element, int style) {
selection_user = formFactory
- .createSelectionElement(User.class,//getConversationHolder(),
+ .createSelectionElement(User.class,
element, "", entity,
EntitySelectionElement.EDITABLE, style);
if (entity != null){
* 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 java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.permission.Group;
import eu.etaxonomy.cdm.model.permission.User;
import eu.etaxonomy.taxeditor.event.EventUtility;
/**
* @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,
+ ICdmFormElement parentElement,
int style) {
- super(formFactory, conversation, parentElement, "Members", style);
+ super(formFactory, 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();
return new DefaultCdmBaseComparator<>();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
- */
@Override
public User createNewElement() {
- User selection = UserSelectionDialog.select(getLayoutComposite().getShell(), //getConversationHolder(),
+ User selection = UserSelectionDialog.select(getLayoutComposite().getShell(),
null, this.getEntity());
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);
EventUtility.postEvent(WorkbenchEventConstants.REMOVE_USER, 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 member to this group";
}
- /**
- * {@inheritDoc}
- */
@Override
public User addExisting() {
// TODO Auto-generated method stub
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
// TODO Auto-generated method stub
return false;
}
-
-
-
-}
+}
\ No newline at end of file
numberStartNumber = formFactory.createFloatTextWithLabelElement(formElement, "Start Number", entity.getStartNumber(), style);
- sectionTaxonomicScope = formFactory.createTaxonomicScopeSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(TaxonomicScopeSection.class, entity.getClass().getCanonicalName()));
+ sectionTaxonomicScope = formFactory.createTaxonomicScopeSection(formElement, StoreUtil.getSectionStyle(TaxonomicScopeSection.class, entity.getClass().getCanonicalName()));
sectionTaxonomicScope.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionTaxonomicScope.setEntity(entity);
- sectionGeoScopes = formFactory.createGeoScopePolyKeyDetailSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(GeoScopePolyKeyDetailSection.class, entity.getClass().getCanonicalName()));
+ sectionGeoScopes = formFactory.createGeoScopePolyKeyDetailSection(formElement, StoreUtil.getSectionStyle(GeoScopePolyKeyDetailSection.class, entity.getClass().getCanonicalName()));
sectionGeoScopes.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionGeoScopes.setEntity(entity);
- sectionScopeRestriction = formFactory.createScopeRestrictionSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(ScopeRestrictionSection.class, entity.getClass().getCanonicalName()));
+ sectionScopeRestriction = formFactory.createScopeRestrictionSection(formElement, StoreUtil.getSectionStyle(ScopeRestrictionSection.class, entity.getClass().getCanonicalName()));
sectionScopeRestriction.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionScopeRestriction.setEntity(entity);
}
}
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
}
/**
- *
- */
+* Copyright (C) 2009 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.key;
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author n.hoffmann
- *
*/
public class PolytomousKeyDetailSection extends AbstractCdmDetailSection<PolytomousKey> {
public PolytomousKeyDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
@Override
public String getHeading() {
return "Polytomous Key";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<PolytomousKey> createCdmDetailElement(AbstractCdmDetailSection<PolytomousKey> parentElement, int style) {
return formFactory.createPolytomousKeyDetailElement(parentElement);
}
-
-}
+}
\ No newline at end of file
formElement, "Question", parent.getQuestion(), 50, style);
selection_feature = formFactory
- .createSelectionElement(Feature.class,//getConversationHolder(),
+ .createSelectionElement(Feature.class,
formElement, "Character",
parent.getFeature(),
EntitySelectionElement.EDITABLE | EntitySelectionElement.DELETABLE, style);
selection_taxon = formFactory
- .createSelectionElement(Taxon.class,//getConversationHolder(),
+ .createSelectionElement(Taxon.class,
formElement, "Taxon",
entity.getTaxon(), EntitySelectionElement.DELETABLE,
style);
selection_subkey = formFactory
- .createSelectionElement(PolytomousKey.class,//getConversationHolder(),
+ .createSelectionElement(PolytomousKey.class,
formElement, "Subkey",
entity.getSubkey(),
EntitySelectionElement.EDITABLE | EntitySelectionElement.DELETABLE, style);
selection_otherNode = formFactory
- .createSelectionElement(PolytomousKeyNode.class,//getConversationHolder(),
+ .createSelectionElement(PolytomousKeyNode.class,
formElement, "Other Node",
entity.getOtherNode(),
EntitySelectionElement.DELETABLE, style);
getEntity().setOtherNode(selection_otherNode.getEntity());
}
}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
}
/**
- *
- */
+* 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.key;
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author n.hoffmann
- *
*/
public class PolytomousKeyNodeDetailSection extends AbstractCdmDetailSection<PolytomousKeyNode> {
public PolytomousKeyNodeDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
@Override
public String getHeading() {
return "Polytomous Key Node";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<PolytomousKeyNode> createCdmDetailElement(AbstractCdmDetailSection<PolytomousKeyNode> parentElement, int style) {
return formFactory.createPolytomousKeyNodeDetailElement(parentElement);
}
-
-}
+}
\ No newline at end of file
/**
+ * 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.key;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.model.term.DefinedTerm;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.model.term.DefinedTerm;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
* @author n.hoffmann
- *
*/
public class ScopeRestrictionSection extends AbstractUnboundEntityCollectionSection<PolytomousKey, DefinedTerm> {
public ScopeRestrictionSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Scope Restriction", style);
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Scope Restriction", style);
}
-
@Override
protected Collection<DefinedTerm> getEntityCollection(PolytomousKey entity) {
return entity.getScopeRestrictions();
@Override
public DefinedTerm createNewElement() {
return null;
-
}
@Override
return "Add a scope restriction";
}
-
- /**
- * {@inheritDoc}
- */
@Override
public DefinedTerm addExisting() {
// TODO Auto-generated method stub
return null;
}
-
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
// TODO Auto-generated method stub
return false;
}
-
-}
+}
\ No newline at end of file
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonSelectionDialog;
public class TaxonomicScopeSection extends
AbstractEntityCollectionSection<PolytomousKey, Taxon> {
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param title
- * @param style
- */
public TaxonomicScopeSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
int style) {
- super(formFactory, conversation, parentElement, "Taxonomic Scope",
+ super(formFactory, parentElement, "Taxonomic Scope",
style);
}
- /*
- * (non-Javadoc)
- *
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
- * getCollection(java.lang.Object)
- */
@Override
public Collection<Taxon> getCollection(PolytomousKey entity) {
return entity.getTaxonomicScope();
return new DefaultCdmBaseComparator<>();
}
- /*
- * (non-Javadoc)
- *
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
- * createNewElement()
- */
@Override
public Taxon createNewElement() {
- Taxon selection = TaxonSelectionDialog.selectTaxon(getShell(),//getConversationHolder(),
- null);
-
+ Taxon selection = TaxonSelectionDialog.selectTaxon(getShell(), null);
return selection;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement
- * (java.lang.Object)
- */
@Override
public void addElement(Taxon element) {
getEntity().addTaxonomicScope(element);
}
- /*
- * (non-Javadoc)
- *
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
- * removeElement(java.lang.Object)
- */
@Override
public void removeElement(Taxon element) {
getEntity().removeTaxonomicScope(element);
}
- /*
- * (non-Javadoc)
- *
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
- * getEmptyString()
- */
@Override
public String getEmptyString() {
return "No taxonomic scope yet.";
}
- /*
- * (non-Javadoc)
- *
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#
- * getTooltipString()
- */
@Override
protected String getTooltipString() {
return "Add a taxon to the scope of this key";
}
- /**
- * {@inheritDoc}
- */
@Override
public Taxon addExisting() {
// TODO Auto-generated method stub
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
// TODO Auto-generated method stub
return false;
}
-
-}
+}
\ No newline at end of file
removeElementsAndControls(textUri);
}
disposeImage();
- section_mediaRepresentation = formFactory.createMediaRepresentationSection(getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(MediaRepresentationSection.class, getEntity().getClass().getCanonicalName()));
+ section_mediaRepresentation = formFactory.createMediaRepresentationSection(parentFormElement, StoreUtil.getSectionStyle(MediaRepresentationSection.class, getEntity().getClass().getCanonicalName()));
section_mediaRepresentation.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_mediaRepresentation.setEntity(getEntity());
//set buffered uri as text if uri had parsing problems in simple view
return uriBuffer;
}
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
+
}
setWarnForReferencingObjects(element, 2);
text_title = formFactory.createMultiLanguageTextElement(element, "Title", getEntity().getAllTitles(), 50, style);
- selection_artist = formFactory.createSelectionElement(AgentBase.class, //getConversationHolder(),
+ selection_artist = formFactory.createSelectionElement(AgentBase.class,
element, "Artist", null, EntitySelectionElement.ALL, style);
addElement(selection_artist);
public void createControls(ICdmFormElement element, int style) {
text_mimeType = formFactory.createTextWithLabelElement(element, "Mime Type", null, style);
text_suffix = formFactory.createTextWithLabelElement(element, "Suffix", null, style);
- section_mediaRepresentationPart = formFactory.createMediaRepresentationPartSection(getConversationHolder(), element, StoreUtil.getSectionStyle(MediaRepresentationPartSection.class, MediaRepresentation.class.getCanonicalName()));
+ section_mediaRepresentationPart = formFactory.createMediaRepresentationPartSection(element, StoreUtil.getSectionStyle(MediaRepresentationPartSection.class, MediaRepresentation.class.getCanonicalName()));
section_mediaRepresentationPart.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
if (entity != null){
setEntity(entity);
-
+/**
+* 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.media;
import java.util.Collection;
import org.eclipse.jface.util.PropertyChangeEvent;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.media.ImageFile;
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- * <p>MediaRepresentationPartSection class.</p>
- *
* @author n.hoffmann
*/
public class MediaRepresentationPartSection extends
AbstractEntityCollectionSection<MediaRepresentation, MediaRepresentationPart> {
- /**
- * <p>Constructor for MediaRepresentationPartSection.</p>
- *
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
- public MediaRepresentationPartSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
+ public MediaRepresentationPartSection(CdmFormFactory cdmFormFactory,
ICdmFormElement parentElement, int style) {
- super(cdmFormFactory, conversation, parentElement, "Media Representation Part", style);
+ super(cdmFormFactory, parentElement, "Media Representation Part", style);
formFactory.addPropertyChangeListener(this);
}
public void addElement(MediaRepresentationPart element) {
getEntity().addRepresentationPart(element);
}
+
@Override
public MediaRepresentationPart createNewElement() {
// FIXME we are supporting image only at the moment
public boolean allowAddExisting() {
return false;
}
-}
+}
\ No newline at end of file
* 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.media;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- * <p>MediaRepresentationSection class.</p>
- *
* @author n.hoffmann
* @created Mar 24, 2010
- * @version 1.0
*/
public class MediaRepresentationSection extends AbstractEntityCollectionSection<Media, MediaRepresentation> {
- /**
- * <p>Constructor for MediaRepresentationSection.</p>
- *
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
- public MediaRepresentationSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
+ public MediaRepresentationSection(CdmFormFactory cdmFormFactory,
ICdmFormElement parentElement, int style) {
- super(cdmFormFactory, conversation, parentElement, "Media Representation", style);
+ super(cdmFormFactory, parentElement, "Media Representation", style);
}
- /** {@inheritDoc} */
@Override
public void addElement(MediaRepresentation element) {
getEntity().addRepresentation(element);
}
- /** {@inheritDoc} */
@Override
public MediaRepresentation createNewElement() {
return MediaRepresentation.NewInstance();
}
- /** {@inheritDoc} */
@Override
public Collection<MediaRepresentation> getCollection(
Media entity) {
return new DefaultCdmBaseComparator<>();
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No media representations yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Create a new media representation";
}
- /** {@inheritDoc} */
@Override
public void removeElement(MediaRepresentation element) {
getEntity().removeRepresentation(element);
}
- /**
- * {@inheritDoc}
- */
@Override
public MediaRepresentation addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-
-
-}
+}
\ No newline at end of file
/**
- *
- */
+* 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.media;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.taxeditor.ui.dialog.selection.MediaSelectionDialog;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- * <p>MediaSection class.</p>
- *
* @author nho
*/
public class MediaSection extends AbstractEntityCollectionSection<IdentifiableMediaEntity, Media>{
- /**
- * <p>Constructor for MediaSection.</p>
- *
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- public MediaSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(cdmFormFactory, conversation, parentElement, "Media", style);
+ public MediaSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, int style) {
+ super(cdmFormFactory, parentElement, "Media", style);
}
@Override
public boolean allowAddExisting() {
return true;
}
-}
+}
\ No newline at end of file
removeSourcesControls();
removeNotDesignatedControls();
if (this.entity != null && this.entity.hasDesignationSource()){
- if (singleSourceElement == null){
-
+ if (singleSourceElement == null){
singleSourceElement = formFactory.createOriginalSourceElement(formElement, entity, "Status Reference");
-// selection_reference = formFactory
-// .createSelectionElement(Reference.class, formElement, "Status Reference",
-// entity.getCitation(), EntitySelectionElement.ALL, style);
-//
-// text_referenceDetail = formFactory.createTextWithLabelElement(
-// formElement, "Reference Detail", entity.getCitationMicroReference(), style);
-
}
+ singleSourceElement.setEntity(entity.getDesignationSource(true));
}else{
if (singleSourceElement != null){
removeReferenceControls();
this.entity.setCitationMicroReference(null);
}
}
- }
- if (entity.hasDesignationSource()){
- singleSourceElement.setEntity(entity.getDesignationSource(true));
- }
+ }
checkbox_notDesignated = formFactory.createCheckbox(formElement, "Not Designated", entity.isNotDesignated(), style);
- sourceSection = formFactory.createSourceSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(SourceSection.class, IdentifiableSource.class.getCanonicalName()));
+ sourceSection = formFactory.createSourceSection(formElement, StoreUtil.getSectionStyle(SourceSection.class, IdentifiableSource.class.getCanonicalName()));
sourceSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sourceSection.setEntity(entity);
StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
private EntitySelectionElement<TeamOrPersonBase> selectionExCombinationAuthor;
@SuppressWarnings("rawtypes")
private EntitySelectionElement<TeamOrPersonBase> selectionCombinationAuthor;
+ @SuppressWarnings("rawtypes")
+ private EntitySelectionElement<TeamOrPersonBase> selectionInCombinationAuthor;
+ @SuppressWarnings("rawtypes")
+ private EntitySelectionElement<TeamOrPersonBase> selectionInBasionymAuthor;
private NumberWithLabelElement text_publicationYear;
private NumberWithLabelElement text_originalPublicationYear;
if (config == null || config.isAuthorshipSectionActivated()){
selectionCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
- getConversationHolder(),
formElement, "Author",
entity.getCombinationAuthorship(),
EntitySelectionElement.DELETABLE | EntitySelectionElement.SELECTABLE | EntitySelectionElement.EDITABLE, style);
addElement(selectionCombinationAuthor);
selectionExCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
- getConversationHolder(),
formElement, "Ex Author",
entity.getExCombinationAuthorship(),
EntitySelectionElement.DELETABLE | EntitySelectionElement.SELECTABLE | EntitySelectionElement.EDITABLE, style);
addElement(selectionExCombinationAuthor);
+ if ((config == null || config.isInAuthorshipActivated())&& (getEntity().getNameType().isFungus() || getEntity().getNameType().isZoological())) {
+ selectionInCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
+ formElement, "In Author",
+ entity.getInCombinationAuthorship(),
+ EntitySelectionElement.DELETABLE | EntitySelectionElement.SELECTABLE | EntitySelectionElement.EDITABLE, style);
+ addElement(selectionInCombinationAuthor);
+ }
if (code != null){
if (code.equals(NomenclaturalCode.ICZN)){
text_publicationYear = formFactory.createFloatTextWithLabelElement(formElement, "Publication Year", ((IZoologicalName)entity).getPublicationYear(), style);
}
}
- selectionBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class, getConversationHolder(),
+ selectionBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
formElement, "Basionym Author", entity.getBasionymAuthorship(),
EntitySelectionElement.DELETABLE | EntitySelectionElement.SELECTABLE | EntitySelectionElement.EDITABLE, style);
addElement(selectionBasionymAuthor);
- selectionExBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class, getConversationHolder(),
+ selectionExBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
formElement, "Ex Basionym Author",entity.getExBasionymAuthorship(),
EntitySelectionElement.DELETABLE | EntitySelectionElement.SELECTABLE | EntitySelectionElement.EDITABLE, style);
addElement(selectionExBasionymAuthor);
+ if ((config == null || config.isInAuthorshipActivated()) && (getEntity().getNameType().isFungus() || getEntity().getNameType().isZoological())) {
+ selectionInBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
+ formElement, "In Basionym Author",
+ entity.getInBasionymAuthorship(),
+ EntitySelectionElement.DELETABLE | EntitySelectionElement.SELECTABLE | EntitySelectionElement.EDITABLE, style);
+ addElement(selectionInBasionymAuthor);
+ }
if (code != null && code.equals(NomenclaturalCode.ICZN)){
text_originalPublicationYear = formFactory.createFloatTextWithLabelElement(formElement, "Orig. Publication Year", ((IZoologicalName)entity).getOriginalPublicationYear(), style);
}
((IZoologicalName)getEntity()).setOriginalPublicationYear(text_originalPublicationYear.getInteger());
} else if (eventSource == text_publicationYear) {
((IZoologicalName)getEntity()).setPublicationYear(text_publicationYear.getInteger());
+ }else if (eventSource == selectionInCombinationAuthor) {
+ (getEntity()).setInCombinationAuthorship(selectionInCombinationAuthor.getEntity());
+ }else if (eventSource == selectionInBasionymAuthor) {
+ getEntity().setInBasionymAuthorship(selectionInBasionymAuthor.getEntity());
}
// if (eventSource != toggleable_cache) {
}
}
}
+
+ @Override
+ public void fillFields() {
+ /*
+ toggleable_cache.setText(getEntity().getAuthorshipCache());
+ toggleable_cache.setSelected(getEntity().isProtectedAuthorshipCache());
+ selectionExBasionymAuthor.setEntity(getEntity().getExBasionymAuthorship());
+ selectionBasionymAuthor.setEntity(getEntity().getBasionymAuthorship());
+ selectionExCombinationAuthor.setEntity(getEntity().getExCombinationAuthorship());
+ selectionCombinationAuthor.setEntity(getEntity().getCombinationAuthorship());
+ if (text_originalPublicationYear != null) {
+
+ }
+ if (text_publicationYear != null) {
+ text_publicationYear.setNumber(((IZoologicalName)getEntity()).getPublicationYear());
+ text_originalPublicationYear.setNumber(((IZoologicalName)getEntity()).getOriginalPublicationYear());
+ }
+
+ */
+
+
+ }
}
\ No newline at end of file
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.name.INonViralName;
import eu.etaxonomy.cdm.model.name.TaxonName;
private TaxonBase<?> taxonBase;
- public AuthorshipDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
+ public AuthorshipDetailSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
+ super(cdmFormFactory, parentElement, selectionProvider, style);
}
@Override
INonViralName name = HibernateProxyHelper.deproxy(entity.getName());
setEntity(name);
}
+ @Override
+ public void setTaxonBaseWithoutUpdate(TaxonBase entity) {
+ this.taxonBase = entity;
+ INonViralName name = HibernateProxyHelper.deproxy(entity.getName());
+ setEntityWithoutUpdate(name);
+ }
@Override
public String getHeading() {
}
}
}
+
+ @Override
+ public void fillFields() {
+ checkboxMonomHybrid.setSelection(getEntity().isMonomHybrid());
+ checkboxBinomHybrid.setSelection(getEntity().isBinomHybrid());
+ checkboxTrinomHybrid.setSelection(getEntity().isTrinomHybrid());
+ checkboxHybridFormula.setSelection(getEntity().isHybridFormula());
+
+ }
}
\ No newline at end of file
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
private TaxonBase<?> taxonBase;
public HybridDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
TaxonName name = HibernateProxyHelper.deproxy(taxon.getName());
setEntity(name);
}
+ @Override
+ public void setTaxonBaseWithoutUpdate(TaxonBase taxon) {
+ taxonBase = taxon;
+ TaxonName name = HibernateProxyHelper.deproxy(taxon.getName());
+ setEntityWithoutUpdate(name);
+ }
@Override
public TaxonBase getTaxonBase() {
updateCacheRelevance();
updateToggleableCacheField();
}
+
+ @Override
+ public void fillFields() {
+ super.fillFields();
+ if (combo_rank != null && (combo_rank.getSelection() == null || !combo_rank.getSelection().equals(getEntity().getRank())) ) {
+ combo_rank.setSelection(getEntity().getRank());
+ }
+ if(text_appendedPhrase != null && (text_appendedPhrase.getText() == null || !text_appendedPhrase.getText().equals(getEntity().getAppendedPhrase()))) {
+ text_appendedPhrase.setText(getEntity().getAppendedPhrase());
+ }
+ if (text_uninomial != null && (text_uninomial.getText() == null || !text_uninomial.getText().equals(getEntity().getGenusOrUninomial()))) {
+ text_uninomial.setText(getEntity().getGenusOrUninomial());
+ }
+ if (text_infragenericEpithet != null && (text_infragenericEpithet.getText() == null || !text_infragenericEpithet.getText().equals(getEntity().getInfraGenericEpithet()))) {
+ text_infragenericEpithet.setText(getEntity().getInfraGenericEpithet());
+ }
+ if (text_specificEpithet != null && (text_specificEpithet.getText() == null || !text_specificEpithet.getText().equals(getEntity().getSpecificEpithet()))) {
+ text_specificEpithet.setText(getEntity().getSpecificEpithet());
+ }
+ if (text_infraspecificEpithet != null && getEntity().getInfraSpecificEpithet() != null && !text_infraspecificEpithet.getText().equals(getEntity().getInfraSpecificEpithet())) {
+ text_infraspecificEpithet.setText(getEntity().getInfraSpecificEpithet());
+ }
+ if (checkbox_anamorphic != null && (checkbox_anamorphic.getSelection() != ((IFungusName)getEntity()).isAnamorphic())) {
+ checkbox_anamorphic.setSelection(((IFungusName)getEntity()).isAnamorphic());
+ }
+ if (text_cultivarName != null && ((ICultivarPlantName)getEntity()).getCultivarEpithet() != null && !text_cultivarName.getText().equals(((ICultivarPlantName)getEntity()).getCultivarEpithet())) {
+ text_cultivarName.setText(((ICultivarPlantName)getEntity()).getCultivarEpithet());
+ }
+ if (text_cultivarGroup != null && ((ICultivarPlantName)getEntity()).getCultivarGroupEpithet() != null && !text_cultivarGroup.getText().equals(((ICultivarPlantName)getEntity()).getCultivarGroupEpithet())) {
+ text_cultivarGroup.setText(((ICultivarPlantName)getEntity()).getCultivarGroupEpithet());
+ }
+ if (text_subGenusAuthorship != null && ((IBacterialName)getEntity()).getSubGenusAuthorship() != null && !text_subGenusAuthorship.getText().equals(((IBacterialName)getEntity()).getSubGenusAuthorship())) {
+ text_subGenusAuthorship.setText(((IBacterialName)getEntity()).getSubGenusAuthorship());
+ }
+ if (text_breed!= null && ((IZoologicalName)getEntity()).getBreed() != null && !text_breed.getText().equals(((IZoologicalName)getEntity()).getBreed())) {
+ text_breed.setText(((IZoologicalName)getEntity()).getBreed());
+ }
+ ((NameDetailSection)this.getParentElement()).setSectionTitle();
+
+
+ }
}
\ No newline at end of file
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.name.INonViralName;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
/**
- * <p>NameDetailSection class.</p>
- *
* @author n.hoffmann
* @created 05.06.2009
*/
-public class NameDetailSection
- extends AbstractCdmDetailSection<INonViralName>
+public class NameDetailSection
+ extends AbstractCdmDetailSection<INonViralName>
implements ITaxonBaseDetailSection{
private TaxonBase<?> taxonBase;
- /**
- * <p>Constructor for NameDetailSection.</p>
- *
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
- */
- public NameDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
+ public NameDetailSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
+ super(cdmFormFactory, parentElement, selectionProvider, style);
}
@Override
public void setTaxonBase(TaxonBase entity) {
this.taxonBase = entity;
- INonViralName name = (INonViralName) HibernateProxyHelper.deproxy(entity.getName());
+ INonViralName name = HibernateProxyHelper.deproxy(entity.getName());
setEntity(name);
}
return formFactory.createNameDetailElement(parentElement, style);
}
-
+
public void updateContent(){
((NameDetailElement)this.detailElement).updateContent();
}
+
+ @Override
+ public void setTaxonBaseWithoutUpdate(TaxonBase<?> taxon) {
+ this.taxonBase = taxon;
+ INonViralName name = HibernateProxyHelper.deproxy(taxon.getName());
+ setEntityWithoutUpdate(name);
+
+ }
+
+
}
LabelElement spacer = formFactory.createLabel(element, null);
spacer.getLayoutComposite().setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
addElement(spacer);
+ label = "Source";
super.createControls(element, style);
- setSourceLabel("Source");
+
if (entity != null){
setEntity(entity);
}
* 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.name;
import java.util.Collection;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.wizard.WizardDialog;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.name.NameRelationship;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
/**
- * <p>NameRelationshipDetailSection class.</p>
- *
* @author n.hoffmann
* @created Mar 18, 2010
*/
private TaxonBase taxonBase;
- /**
- * <p>Constructor for NameRelationshipDetailSection.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
- public NameRelationshipDetailSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ public NameRelationshipDetailSection(CdmFormFactory formFactory,
ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Name Relationships", style);
+ super(formFactory, parentElement, "Name Relationships", style);
}
- /** {@inheritDoc} */
@Override
public void addElement(NameRelationship element) {
//getEntity().addRelationship(element);
}
- /** {@inheritDoc} */
@Override
public NameRelationship createNewElement() {
return null;
}
- /** {@inheritDoc} */
@Override
public Collection<NameRelationship> getCollection(TaxonName entity) {
Collection<NameRelationship> allNameRelationships = entity.getRelationsFromThisName();
return new DefaultCdmBaseComparator<>();
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No name relationships yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a new name relationship from this name.";
}
- /** {@inheritDoc} */
@Override
public void removeElement(NameRelationship element) {
getEntity().removeNameRelationship(element);
}
- /** {@inheritDoc} */
@Override
public void setTaxonBase(TaxonBase entity) {
this.taxonBase = entity;
TaxonName name = HibernateProxyHelper.deproxy(entity.getName());
setEntity(name);
}
-
+ @Override
+ public void setTaxonBaseWithoutUpdate(TaxonBase entity) {
+ this.taxonBase = entity;
+ TaxonName name = HibernateProxyHelper.deproxy(entity.getName());
+ setEntity(name);
+ }
+
@Override
public TaxonBase getTaxonBase() {
return taxonBase;
}
- /**
- * {@inheritDoc}
- */
@Override
public NameRelationship addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-}
+}
\ No newline at end of file
import org.eclipse.jface.wizard.Wizard;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.name.NameRelationship;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
/**
* @created Jun 1, 2010
* @version 1.0
*/
-public class NameRelationshipWizard extends Wizard implements IConversationEnabled{
+public class NameRelationshipWizard extends Wizard {
private static NameRelationshipDetailSection callingSection;
public NameRelationship getNameRelationship() {
return page.getNameRelationship();
}
-
- /**
- * <p>getConversationHolder</p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- @Override
- public ConversationHolder getConversationHolder() {
- return callingSection.getConversationHolder();
- }
-
- /** {@inheritDoc} */
- @Override
- public void update(CdmDataChangeMap changeEvents) {}
-
-
}
checkbox_conservedType = formFactory.createCheckbox(formElement,
"Conserved Type", false, style); //$NON-NLS-1$
selection_typeName = formFactory
- .createSelectionElement(TaxonName.class,//getConversationHolder(),
+ .createSelectionElement(TaxonName.class,
formElement, "Name", null, //$NON-NLS-1$
EntitySelectionElement.ALL, style);
combo_typeStatus = formFactory.createDefinedTermComboElement(TermType.NameTypeDesignationStatus, formElement,
* 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.name;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
/**
- * <p>NomenclaturalStatusSection class.</p>
- *
* @author n.hoffmann
*/
-public class NomenclaturalStatusSection extends AbstractEntityCollectionSection<TaxonName, NomenclaturalStatus> implements ITaxonBaseDetailSection{
-
- private TaxonBase taxonBase;
-
- /**
- * <p>Constructor for NomenclaturalStatusSection.</p>
- *
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- public NomenclaturalStatusSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
+public class NomenclaturalStatusSection
+ extends AbstractEntityCollectionSection<TaxonName, NomenclaturalStatus>
+ implements ITaxonBaseDetailSection{
+
+ private TaxonBase<?> taxonBase;
+
+ public NomenclaturalStatusSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement,
int style) {
- super(cdmFormFactory, conversation, parentElement, "Nomenclatural Status", style);
+ super(cdmFormFactory, parentElement, "Nomenclatural Status", style);
}
- /** {@inheritDoc} */
@Override
public Collection<NomenclaturalStatus> getCollection(TaxonName entity) {
return entity.getStatus();
return new DefaultCdmBaseComparator<>();
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No nomenclatural status yet.";
}
- /** {@inheritDoc} */
@Override
public NomenclaturalStatus createNewElement() {
return NomenclaturalStatus.NewInstance(null);
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Create a new nomenclatural status";
}
- /** {@inheritDoc} */
@Override
public void addElement(NomenclaturalStatus element) {
getEntity().addStatus(element);
}
- /** {@inheritDoc} */
@Override
public void removeElement(NomenclaturalStatus element) {
getEntity().removeStatus(element);
}
- /** {@inheritDoc} */
@Override
public void setTaxonBase(TaxonBase entity) {
this.taxonBase = entity;
TaxonName nonViralName = HibernateProxyHelper.deproxy(entity.getName());
setEntity(nonViralName);
}
+
+ @Override
+ public void setTaxonBaseWithoutUpdate(TaxonBase entity) {
+ this.taxonBase = entity;
+ TaxonName nonViralName = HibernateProxyHelper.deproxy(entity.getName());
+ this.setEntity(nonViralName);
+ }
@Override
public TaxonBase getTaxonBase() {
return taxonBase;
}
- /**
- * {@inheritDoc}
- */
@Override
public NomenclaturalStatus addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-
-}
+}
\ No newline at end of file
}
}
- section_name = formFactory.createNameDetailSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(NameDetailSection.class, entity.getClass().getCanonicalName(), true));
+ section_name = formFactory.createNameDetailSection(formElement, null, StoreUtil.getSectionStyle(NameDetailSection.class, entity.getClass().getCanonicalName(), true));
section_name.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
addControl(section_name);
addElement(section_name);
// if (isAdvancedView || PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP)){
- section_author = formFactory.createAuthorshipDetailSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(AuthorshipDetailSection.class, entity.getClass().getCanonicalName(), true));
+ section_author = formFactory.createAuthorshipDetailSection(formElement, null, StoreUtil.getSectionStyle(AuthorshipDetailSection.class, entity.getClass().getCanonicalName(), true));
section_author.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
addControl(section_author);
addElement(section_author);
// }
//TODO RL
if (config == null || config.isHybridActivated()){
- section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(HybridDetailSection.class, entity.getClass().getCanonicalName()));
+ section_hybrid = formFactory.createHybridDetailSection(formElement, null, StoreUtil.getSectionStyle(HybridDetailSection.class, entity.getClass().getCanonicalName()));
section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
addControl(section_hybrid);
addElement(section_hybrid);
updateCacheRelevance();
updateToggleableCacheField();
}
+
+ @Override
+ public void fillFields() {
+ super.fillFields();
+
+ section_name.getDetailElement().fillFields();;
+ section_author.getDetailElement().fillFields();
+ combo_nomenclaturalCode.setSelection(getEntity().getNameType());
+ section_hybrid.getDetailElement().fillFields();
+ textLsid.setText(getEntity().getLsid()!= null? getEntity().getLsid().toString():null);
+ if (text_nameApprobation != null) {
+ text_nameApprobation.setText(getEntity().getNameApprobation());
+ }
+
+ }
}
\ No newline at end of file
* 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.name;
import org.eclipse.jface.action.Action;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Control;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.name.INonViralName;
import eu.etaxonomy.cdm.model.name.TaxonName;
private TaxonBase<?> taxonBase;
boolean nameChoosable = false;
- /**
- * <p>Constructor for NonViralNameDetailSection.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
- * @param nameChoosable if <code>true</code> adds a button to choose the displayed name
- * @param style a int.
- */
- public NonViralNameDetailSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ public NonViralNameDetailSection(CdmFormFactory formFactory,
ICdmFormElement parentElement, ISelectionProvider selectionProvider, boolean nameChoosable, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
this.nameChoosable = nameChoosable;
}
Action chooseNameAction = new Action("Choose Name", IAction.AS_PUSH_BUTTON){
@Override
public void run() {
- TaxonName taxonName = NameSelectionDialog.select(getShell(), //getConversationHolder(),
+ TaxonName taxonName = NameSelectionDialog.select(getShell(),
getEntity());
if(taxonName!=null){
TaxonName nonViralName = HibernateProxyHelper.deproxy(taxonName);
if(confirm){
TaxonName clonedName;
- clonedName = (TaxonName) getEntity().clone();
+ clonedName = getEntity().clone();
setEntity(clonedName);
taxonBase.setName(clonedName);
taxonBase.generateTitle();
AbstractCdmDetailSection<TaxonName> parentElement, int style) {
return formFactory.createNonViralNameDetailElement(parentElement);
}
+
+ @Override
+ public void setTaxonBaseWithoutUpdate(TaxonBase<?> taxon) {
+ taxonBase = taxon;
+ TaxonName name = HibernateProxyHelper.deproxy(taxon.getName());
+ setEntityWithoutUpdate(name);
+
+ }
}
* 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.name;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
- * <p>NonViralNameWizardPage class.</p>
- *
* @author n.hoffmann
* @created Jun 1, 2010
*/
private NonViralNameDetailElement nameElement;
- /**
- * <p>Constructor for NonViralNameWizardPage.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param entity a {@link eu.etaxonomy.cdm.model.name.NonViralName} object.
- */
- public NonViralNameWizardPage(CdmFormFactory formFactory, ConversationHolder conversation,
- TaxonName entity) {
- super(formFactory, conversation, entity);
+ public NonViralNameWizardPage(CdmFormFactory formFactory, TaxonName entity) {
+ super(formFactory, entity);
setTitle("Name");
}
- /** {@inheritDoc} */
@Override
public AbstractCdmDetailElement<TaxonName> createElement(ICdmFormElement rootElement) {
nameElement = formFactory.createNonViralNameDetailElement(rootElement);
return nameElement;
}
- /** {@inheritDoc} */
@Override
public void dispose() {
nameElement.removeElements();
super.dispose();
}
-}
+}
\ No newline at end of file
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.graphics.ImageData;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.INameService;
import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.compare.name.TypeDesignationComparator;
private TaxonBase<?> taxonBase;
- public TypeDesignationSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ public TypeDesignationSection(CdmFormFactory formFactory,
ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, Messages.TypeDesignationSection_TYPE_DESIGNATIONS, style);
+ super(formFactory, parentElement, Messages.TypeDesignationSection_TYPE_DESIGNATIONS, style);
}
@Override
}
boolean removeTypeDesignationFromAllTypifiedNames = PreferencesUtil.getBooleanValue(IPreferenceKeys.ADD_TYPES_TO_ALL_NAMES);
TaxonName entity = removeTypeDesignationFromAllTypifiedNames ? null : getEntity();
- if(!element.isPersited() && entity!=null){
+ if(!element.isPersisted() && entity!=null){
entity.removeTypeDesignation(element);
}
else if(detailsView!=null
setEntity(name);
}
+ @Override
+ public void setTaxonBaseWithoutUpdate(TaxonBase entity) {
+ this.setTaxonBase(entity);
+ }
+
private boolean isSpecimenType(){
Rank rank = getEntity() == null ? null : getEntity().getRank();
if(rank == null){
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
monitor.worked(20);
- if (typeDesignation != null && typeDesignation.isPersited()){
+ if (typeDesignation != null && typeDesignation.isPersisted()){
if(element==null){
CdmStore.getService(INameService.class).deleteTypeDesignation(null, typeDesignation);
}
package eu.etaxonomy.taxeditor.ui.section.occurrence;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
- * <p>DeterminationEventDetailSection class.</p>
- *
* @author n.hoffmann
* @created Oct 13, 2010
*/
extends AbstractEntityCollectionSection<SpecimenOrObservationBase, DeterminationEvent> {
public AbstractDeterminationEventDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
String title, int style) {
- super(formFactory, conversation, parentElement, title, style);
+ super(formFactory, parentElement, title, style);
}
@Override
@Override
public void createControls(ICdmFormElement element, int style) {
selection_agent = formFactory
- .createSelectionElement(AgentBase.class,//getConversationHolder(),
+ .createSelectionElement(AgentBase.class,
element, "Actor", null,
EntitySelectionElement.ALL, style);
element_timePeriod = formFactory.createTimePeriodElement(element,
*/
package eu.etaxonomy.taxeditor.ui.section.occurrence;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.term.DefinedTerm;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
@Override
public void createControls(ICdmFormElement formElement, int style) {
- selection_namedArea = formFactory.createSelectionElement(NamedArea.class, //getConversationHolder(),
+ selection_namedArea = formFactory.createSelectionElement(NamedArea.class,
formElement, "Area",
null, EntitySelectionElement.NOTHING, style);
if (entity != null){
* 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.occurrence;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog;
*/
public class CollectingAreasDetailSection extends AbstractEntityCollectionSection<DerivedUnitFacade, NamedArea> {
- /**
- * <p>Constructor for CollectingAreasDetailSection.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
public CollectingAreasDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Collecting Areas", style);
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Collecting Areas", style);
}
@Override
@Override
public NamedArea createNewElement() {
- NamedArea selection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(), //getConversationHolder(),
+ NamedArea selection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(),
null, FieldUnit.class.getCanonicalName());
return selection;
text_titleCache.setText(getEntity().getTitleCache());
}
}
+
+ @Override
+ public void fillFields() {
+ // TODO actually this is only used for taxa/names
+
+ }
}
\ No newline at end of file
*/
package eu.etaxonomy.taxeditor.ui.section.occurrence;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.occurrence.Collection;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
- * <p>CollectionWizardPage class.</p>
- *
* @author n.hoffmann
* @created Oct 13, 2010
*/
public class CollectionWizardPage extends AbstractCdmEntityWizardPage<Collection> {
- /**
- * <p>Constructor for CollectionWizardPage.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param entity a {@link eu.etaxonomy.cdm.model.occurrence.Collection} object.
- */
- public CollectionWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, Collection entity) {
- super(formFactory, conversation, entity);
+ public CollectionWizardPage(CdmFormFactory formFactory, Collection entity) {
+ super(formFactory, entity);
setPageComplete(true);
}
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.widgets.Control;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.taxeditor.model.ImageResources;
AbstractDeterminationEventDetailSection {
public CurrentDeterminationDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
int style) {
- super(formFactory, conversation, parentElement, "Current Determination", style);
+ super(formFactory, parentElement, "Current Determination", style);
}
@Override
* 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.occurrence;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.cdm.api.facade.MethodNotSupportedByDerivedUnitTypeException;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.MethodNotSupportedByDerivedUnitTypeException;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
import eu.etaxonomy.cdm.model.term.DefinedTerm;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
- * <p>
- * DerivedUnitBaseDetailElement class.
- * </p>
- *
* @author n.hoffmann
* @created Jun 24, 2010
- * @version 1.0
*/
public class DerivedUnitBaseDetailElement extends
AbstractSpecimenOrObservationDetailElement {
private DerivedUnitMediaSection mediaDetailElement;
-
-
- /**
- * <p>
- * Constructor for DerivedUnitBaseDetailElement.
- * </p>
- *
- * @param formFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param formElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- */
public DerivedUnitBaseDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement) {
super(formFactory, formElement);
// we ignore this
MessagingUtils.info(e.getMessage());
}
- selection_storedUnder = formFactory.createSelectionElement(TaxonName.class, //getConversationHolder(),
+ selection_storedUnder = formFactory.createSelectionElement(TaxonName.class,
formElement, "Stored Under", entity.getStoredUnder(), EntitySelectionElement.ALL, style);
try {
// section_duplicates = (SpecimenCollectionDetailSection) formFactory
// .createEntityDetailSection(
// EntityDetailType.SPECIMEN_COLLECTION,
-// getConversationHolder(), formElement, Section.TWISTIE);
+// formElement, Section.TWISTIE);
// section_duplicates
// .setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
// section_duplicates.setEntity(entity);
textOriginalLabel = formFactory.createOriginalLabelDataElement(formElement);
textOriginalLabel.setEntity(getEntity());
-
-
super.createControls(formElement, entity, style);
-
- section_source = formFactory.createSourceCollectionDetailSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(SourceCollectionDetailSection.class, entity.getClass().getCanonicalName()));
+ section_source = formFactory.createSourceCollectionDetailSection(formElement, StoreUtil.getSectionStyle(SourceCollectionDetailSection.class, entity.getClass().getCanonicalName()));
section_source.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_source.setEntity(entity);
if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart || !showOnlyDerivedUnitData){
- mediaDetailElement = formFactory.createDerivedUnitMediaSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(DerivedUnitMediaSection.class, entity.getClass().getCanonicalName()));
+ mediaDetailElement = formFactory.createDerivedUnitMediaSection(formElement, StoreUtil.getSectionStyle(DerivedUnitMediaSection.class, entity.getClass().getCanonicalName()));
mediaDetailElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
mediaDetailElement.setEntity(getEntity());
}
-
-
-
}
- /** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
super.handleEvent(eventSource);
}
}
}
-}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
+}
\ No newline at end of file
* 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.occurrence;
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
/**
- * <p>DerivedUnitBaseDetailSection class.</p>
*
* @author n.hoffmann
* @created Jun 24, 2010
- * @version 1.0
*/
public class DerivedUnitBaseDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
- /**
- * <p>Constructor for DerivedUnitBaseDetailSection.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
- * @param style a int.
- */
public DerivedUnitBaseDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
- /** {@inheritDoc} */
@Override
public String getHeading() {
return "Specimen Details";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
return formFactory.createDerivedUnitBaseDetailElement(parentElement);
}
-}
+}
\ No newline at end of file
* 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.occurrence;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author n.hoffmann
* @created Dec 15, 2010
- * @version 1.0
*/
public class DerivedUnitBaseWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
- public DerivedUnitBaseWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, DerivedUnitFacade entity) {
- super(formFactory, conversation, entity);
+ public DerivedUnitBaseWizardPage(CdmFormFactory formFactory, DerivedUnitFacade entity) {
+ super(formFactory, entity);
setTitle("Derived Unit Details");
setPageComplete(true);
}
return detailElement;
}
-
-}
+}
\ No newline at end of file
*/
package eu.etaxonomy.taxeditor.ui.section.occurrence;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.cdm.model.agent.Team;
import eu.etaxonomy.cdm.model.common.LanguageString;
entity.getCountry(), EntitySelectionElement.DELETABLE, style);
if(PreferencesUtil.isCollectingAreaInGeneralSection()){
- section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(CollectingAreasDetailSection.class, entity.getClass().getCanonicalName()));
+ section_collectingAreas = formFactory.createCollectingAreasDetailSection(formElement, StoreUtil.getSectionStyle(CollectingAreasDetailSection.class, entity.getClass().getCanonicalName()));
section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_collectingAreas.setEntity(entity);
}
entity.getExactLocation(), style);
element_elevation = formFactory.createGatheringEventUnitElement(
formElement, "Elevation : ", entity, MinMaxTextSection.UnitType.ELEVATION, style);
-
+ element_elevation.setExpanded(true);
element_date = formFactory.createTimePeriodElement(formElement, "Date",
entity.getGatheringPeriod(), style);
+ element_date.setExpanded(true);
selection_collector = formFactory
.createCollectorSelectionElement(
formElement, "Collector",
"Collecting number", entity.getFieldNumber(), style);
}
selection_collection = formFactory
- .createSelectionElement(Collection.class,//getConversationHolder(),
+ .createSelectionElement(Collection.class,
formElement, "Collection",
entity.getCollection(),
EntitySelectionElement.ALL, style);
text_barcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
uriPreferredStableUri = formFactory.createUriWithLabelElement(formElement, "Pref. Stable URI", entity.getPreferredStableUri(), style);
- section_status = formFactory.createStatusCollectionDetailSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(SourceCollectionDetailSection.class, entity.getClass().getCanonicalName()));
+ section_status = formFactory.createStatusCollectionDetailSection(formElement, StoreUtil.getSectionStyle(SourceCollectionDetailSection.class, entity.getClass().getCanonicalName()));
section_status.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_status.setEntity(entity);
- checkIsPublish = formFactory.createCheckbox(formElement, "Publish", entity.innerDerivedUnit().isPublish(), style);
+ checkIsPublish = formFactory.createCheckbox(formElement, "Publish", entity.baseUnit().isPublish(), style);
}
@Override
public void handleEvent(Object eventSource) {
if (eventSource == toggleableText_titleCache) {
-
+
getEntity().setTitleCache(toggleableText_titleCache.getText(),
toggleableText_titleCache.getState());
if (toggleableText_titleCache.getState()) {
return;
- }
+ }
} else if (eventSource == selection_country) {
getEntity().setCountry(selection_country.getSelection());
} else if (eventSource == languageText_locality) {
getEntity().setPreferredStableUri(uriPreferredStableUri.parseText());
} else if (eventSource == checkIsPublish) {
getEntity().innerDerivedUnit().setPublish(checkIsPublish.getSelection());
+ }else if (eventSource == section_status) {
+ firePropertyChangeEvent(this);
}
toggleableText_titleCache.setText(getEntity().getTitleCache());
this.showSpecimenType = showSpecimenType;
}
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
+
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
//TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
private DerivedUnitGeneralDetailElement derivedUnitGeneralDetailElement;
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param selectionProvider
- * @param style
- */
public DerivedUnitGeneralDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
@Override
public String getHeading() {
return "General";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
derivedUnitGeneralDetailElement = formFactory.createDerivedUnitGeneralDetailElement(parentElement);
public void setShowOnlyDerivedUnitData(boolean showOnlyDerivedUnitData){
derivedUnitGeneralDetailElement.setShowOnlyDerivedUnitData(showOnlyDerivedUnitData);
}
-
-}
+}
\ No newline at end of file
* 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.occurrence;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.cdm.model.occurrence.OccurrenceStatus;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author n.hoffmann
* @created Dec 17, 2010
- * @version 1.0
*/
public class DerivedUnitGeneralWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
- public DerivedUnitGeneralWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, DerivedUnitFacade entity) {
- super(formFactory, conversation, entity);
+ public DerivedUnitGeneralWizardPage(CdmFormFactory formFactory, DerivedUnitFacade entity) {
+ super(formFactory, entity);
setTitle("General Specimen Data");
}
@Override
protected void checkComplete() {
- setPageComplete(true);
+ SpecimenOrObservationBase<?> baseUnit = this.entity.baseUnit();
+ boolean complete = true;
+ if (baseUnit instanceof DerivedUnit) {
+ for (OccurrenceStatus status :((DerivedUnit)baseUnit).getStatus()) {
+ if (status.getType() == null) {
+ complete = false;
+ break;
+ }
+ }
+ }
+ setPageComplete(complete);
}
@Override
checkComplete();
return detailElement;
}
-
-}
+}
\ No newline at end of file
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.taxeditor.ui.dialog.selection.MediaSelectionDialog;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
*/
public class DerivedUnitMediaSection extends AbstractEntityCollectionSection<DerivedUnitFacade, Media> {
- public DerivedUnitMediaSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(cdmFormFactory, conversation, parentElement, "Media", style);
+ public DerivedUnitMediaSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, int style) {
+ super(cdmFormFactory, parentElement, "Media", style);
}
@Override
public boolean allowAddExisting() {
return true;
}
-
-}
+}
\ No newline at end of file
SpecimenOrObservationBase entity, int style) {
section_currentDetermination = formFactory.createCurrentDeterminationDetailSection(
- getConversationHolder(), formElement, StoreUtil.getSectionStyle(CurrentDeterminationDetailSection.class, entity.getClass().getCanonicalName(), true));
+ formElement, StoreUtil.getSectionStyle(CurrentDeterminationDetailSection.class, entity.getClass().getCanonicalName(), true));
section_currentDetermination.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_currentDetermination.setEntity(entity);
section_determinationHistory = formFactory.createDeterminationHistoryDetailSection(
- getConversationHolder(), formElement, StoreUtil.getSectionStyle(DeterminationHistoryDetailSection.class, entity.getClass().getCanonicalName()));
+ formElement, StoreUtil.getSectionStyle(DeterminationHistoryDetailSection.class, entity.getClass().getCanonicalName()));
section_determinationHistory.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_determinationHistory.setEntity(entity);
}
section_determinationHistory.refresh();
}
}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
}
\ No newline at end of file
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
implements IDerivedUnitFacadeDetailSection {
public DeterminationDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
@Override
public void createControls(ICdmFormElement element, int style) {
selectionTaxonNameBase = formFactory
- .createSelectionElement(TaxonName.class,//getConversationHolder(),
+ .createSelectionElement(TaxonName.class,
element, "Taxon Name", null,
EntitySelectionElement.ALL, style);
selection_taxonBase = formFactory
- .createSelectionElement(TaxonBase.class,//getConversationHolder(),
+ .createSelectionElement(TaxonBase.class,
element, "Taxon", null,
EntitySelectionElement.ALL, style);
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
AbstractDeterminationEventDetailSection {
public DeterminationHistoryDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
int style) {
- super(formFactory, conversation, parentElement, "Determination History", style);
+ super(formFactory, parentElement, "Determination History", style);
}
@Override
* 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.occurrence;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
/**
- * <p>FieldUnitDetailElement class.</p>
- *
* @author n.hoffmann
* @created Jun 17, 2010
- * @version 1.0
*/
public class FieldUnitFacadeDetailElement extends AbstractSpecimenOrObservationDetailElement {
//
// private TermComboElement<DefinedTerm> combo_sex;
- /**
- * <p>Constructor for FieldUnitDetailElement.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- */
public FieldUnitFacadeDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement) {
super(formFactory, formElement);
}
- /** {@inheritDoc} */
@Override
protected void createControls(ICdmFormElement formElement,
DerivedUnitFacade entity, int style) {
super.createControls(formElement, entity, style);
}
- /** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
super.handleEvent(eventSource);
else if(eventSource == number_individualCount){
getEntity().setIndividualCount(number_individualCount.getText());
}
+ }
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
}
-}
+}
\ No newline at end of file
* 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.occurrence;
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
/**
- * <p>FieldUnitDetailSection class.</p>
- *
* @author n.hoffmann
* @created Jun 17, 2010
*/
public class FieldUnitFacadeDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
- /**
- * <p>Constructor for FieldUnitDetailSection.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
- * @param style a int.
- */
- public FieldUnitFacadeDetailSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ public FieldUnitFacadeDetailSection(CdmFormFactory formFactory,
ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
- /** {@inheritDoc} */
@Override
public String getHeading() {
return "Field Unit Details";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
return formFactory.createFieldUnitFacadeDetailElement(parentElement);
*/
package eu.etaxonomy.taxeditor.ui.section.occurrence;
-import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.cdm.model.agent.Team;
-import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.LanguageString;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
combo_specorobstype.setSelection(entity.getType());
}
- selection_country = formFactory.createSelectionElement(NamedArea.class, //getConversationHolder(),
+ selection_country = formFactory.createSelectionElement(NamedArea.class,
formElement, "Country", entity.getCountry(), EntitySelectionElement.DELETABLE, style);
if(PreferencesUtil.isCollectingAreaInGeneralSection()){
- section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(CollectingAreasDetailSection.class, entity.getClass().getCanonicalName()));
+ section_collectingAreas = formFactory.createCollectingAreasDetailSection(formElement, StoreUtil.getSectionStyle(CollectingAreasDetailSection.class, entity.getClass().getCanonicalName()));
section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_collectingAreas.setEntity(entity);
}
getEntity().setGatheringPeriod(element_date.getTimePeriod());
} else if (eventSource == selection_collector) {
getEntity().setCollector(selection_collector.getSelection());
-
+
if (getEntity().getCollector() instanceof Team){
if (selection_primary_collector.getCollectorTeam() != null && selection_primary_collector.getEntity() != null ){
boolean collInNewTeam = false;
selection_primary_collector.setEntity(null);
}
selection_primary_collector.setEnabled((getEntity().getCollector() instanceof Team));
-
+
} else if (eventSource == selection_primary_collector) {
getEntity().setPrimaryCollector((Person)selection_primary_collector.getSelection());
} else if (eventSource == text_collectingNumber) {
toggleableText_titleCache.setText(getEntity().getTitleCache());
}
+ @Override
protected void updateControlStates(){
if (getEntity() != null ){
enabled = enabled && CdmStore.currentAuthentiationHasPermission(StoreUtil.getCdmEntity(getEntity()), requiredCrud);
}else{
enabled = true;
}
- Set<Object> except = new HashSet<>();
+ Set<Object> except = new HashSet<>();
if (!selection_primary_collector.isEnabled() && enabled){
except.add(selection_primary_collector);
}
setEnabled(enabled, except);
-
+
}
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
+
}
\ No newline at end of file
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
* @author pplitzner
* @date 05.11.2013
- *
*/
public class FieldUnitFacadeGeneralDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param selectionProvider
- * @param style
- */
public FieldUnitFacadeGeneralDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
@Override
public String getHeading() {
return "General";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
return formFactory.createFieldUnitFacadeGeneralDetailElement(parentElement);
}
-
-}
+}
\ No newline at end of file
*/
package eu.etaxonomy.taxeditor.ui.section.occurrence;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-/**
- *
- */
public class FieldUnitGeneralWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
- /**
- * @param formFactory
- * @param conversation
- * @param entity
- */
- public FieldUnitGeneralWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, DerivedUnitFacade entity) {
- super(formFactory, conversation, entity);
+ public FieldUnitGeneralWizardPage(CdmFormFactory formFactory, DerivedUnitFacade entity) {
+ super(formFactory, entity);
setTitle("General FieldUnit Data");
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#checkComplete()
- */
@Override
protected void checkComplete() {
setPageComplete(true);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
- */
@Override
public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
FieldUnitFacadeGeneralDetailElement detailElement = formFactory.createFieldUnitFacadeGeneralDetailElement(rootElement);
checkComplete();
return detailElement;
}
-
-}
+}
\ No newline at end of file
package eu.etaxonomy.taxeditor.ui.section.occurrence;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
*/
public class FieldUnitWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
- public FieldUnitWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, DerivedUnitFacade entity) {
- super(formFactory, conversation, entity);
+ public FieldUnitWizardPage(CdmFormFactory formFactory, DerivedUnitFacade entity) {
+ super(formFactory, entity);
setTitle("Field Unit Details");
setPageComplete(true);
}
package eu.etaxonomy.taxeditor.ui.section.occurrence;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
if(!PreferencesUtil.isCollectingAreaInGeneralSection()){
- section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(CollectingAreasDetailSection.class, entity.getClass().getCanonicalName()));
+ section_collectingAreas = formFactory.createCollectingAreasDetailSection(formElement, StoreUtil.getSectionStyle(CollectingAreasDetailSection.class, entity.getClass().getCanonicalName()));
section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_collectingAreas.setEntity(entity);
}
text_gatheringEventDescription.getText());
}
}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
*
* @author n.hoffmann
* @created Jun 24, 2010
- * @version 1.0
*/
public class GatheringEventDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
* <p>Constructor for GatheringEventDetailSection.</p>
*
* @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
* @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
* @param style a int.
*/
public GatheringEventDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
- /** {@inheritDoc} */
@Override
public String getHeading() {
return "Gathering Event Details";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
return formFactory.createGatheringEventDetailElement(parentElement);
* 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.occurrence;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author n.hoffmann
* @created Dec 15, 2010
- * @version 1.0
*/
public class GatheringEventWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
- public GatheringEventWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, DerivedUnitFacade entity) {
- super(formFactory, conversation, entity);
+ public GatheringEventWizardPage(CdmFormFactory formFactory, DerivedUnitFacade entity) {
+ super(formFactory, entity);
setTitle("Gathering Event Details");
setPageComplete(true);
}
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog;
*/
public class GeoScopeDetailSection extends AbstractEntityCollectionSection<Classification, NamedArea> {
- /**
- * <p>Constructor for CollectingAreasDetailSection.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
public GeoScopeDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Geo Scopes", style);
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Geo Scopes", style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
- */
- /** {@inheritDoc} */
@Override
public Collection<NamedArea> getCollection(Classification entity) {
return entity.getGeoScopes();
return new DefaultCdmBaseComparator<>();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
- */
- /** {@inheritDoc} */
@Override
public NamedArea createNewElement() {
- NamedArea selection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(), //getConversationHolder(),
+ NamedArea selection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(),
null, Classification.class.getCanonicalName());
return selection;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void addElement(NamedArea element) {
getEntity().addGeoScope(element);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void removeElement(NamedArea element) {
getEntity().removeGeoScope(element);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No geo scopes yet.";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a geo scope";
}
- /**
- * {@inheritDoc}
- */
@Override
public NamedArea addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
// TODO Auto-generated method stub
return false;
}
-
-}
+}
\ No newline at end of file
* 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.occurrence;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.taxeditor.ui.dialog.selection.NamedAreaSelectionDialog;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- *
* @author pplitzner
* @date Sep 21, 2015
- *
*/
public class GeoScopePolyKeyDetailSection extends AbstractEntityCollectionSection<PolytomousKey, NamedArea> {
public GeoScopePolyKeyDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Geo Scopes", style);
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Geo Scopes", style);
}
- /** {@inheritDoc} */
@Override
public Collection<NamedArea> getCollection(PolytomousKey entity) {
return entity.getGeographicalScope();
return new DefaultCdmBaseComparator<>();
}
- /** {@inheritDoc} */
@Override
public NamedArea createNewElement() {
- NamedArea selection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(), //getConversationHolder(),
+ NamedArea selection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(),
null, PolytomousKey.class.getCanonicalName());
return selection;
}
- /** {@inheritDoc} */
@Override
public void addElement(NamedArea element) {
getEntity().addGeographicalScope(element);
}
- /** {@inheritDoc} */
@Override
public void removeElement(NamedArea element) {
getEntity().removeGeographicalScope(element);
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No geo scopes yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a geo scope";
}
- /**
- * {@inheritDoc}
- */
@Override
public NamedArea addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-
-}
+}
\ No newline at end of file
+/**
+ * Copyright (C) 2022 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.occurrence;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Control;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.common.ExtensionType;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.OccurrenceStatus;
import eu.etaxonomy.cdm.model.term.DefinedTerm;
-import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
-import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
-import eu.etaxonomy.taxeditor.ui.section.reference.SingleSourceSection;
-import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractOriginalSourceElement;
-import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractSingleSourceElement;
-import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractSourcedEntityBaseElement;
import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractSourcedEntityElement;
-import eu.etaxonomy.taxeditor.ui.section.supplemental.IdentifiableSourceElement;
public class OccurrenceStatusElement extends AbstractSourcedEntityElement<OccurrenceStatus>{
- private TermComboElement<DefinedTerm> combo_statusType;
-
-// private IdentifiableSourceElement sourceElement;
+ private TermComboElement<DefinedTerm> combo_statusType;
+ private Color colorRedSWT = new Color(null, 255, 0, 0);
-
- public OccurrenceStatusElement(CdmFormFactory formFactory, AbstractFormSection section, OccurrenceStatus entity, SelectionListener removeListener, int style) {
+ public OccurrenceStatusElement(CdmFormFactory formFactory, AbstractFormSection<?> section, OccurrenceStatus entity, SelectionListener removeListener, int style) {
super(formFactory, section, entity, removeListener, "Status", style);
-
}
@Override
super.setEntity(entity);
if (combo_statusType != null){
DefinedTerm statusType = HibernateProxyHelper.deproxy(entity.getType());
- combo_statusType.setSelection(statusType);
+ combo_statusType.setSelection(statusType);
+ if (statusType == null) {
+ Color colorRedSWT = new Color(null, 255, 0, 0);
+ combo_statusType.setBackground(colorRedSWT);
+ }else {
+ combo_statusType.setBackground(NOT_SELECTED);
+ }
}
this.setSourceLabel("Source");
-
-
}
@Override
setEntity(entity);
}
super.createControls(element, style);
+ if (entity == null ^ entity.getType() == null) {
+ combo_statusType.setBackground(colorRedSWT);
+ }else {
+ combo_statusType.setBackground(NOT_SELECTED);
+ }
this.setSourceLabel("Source");
-
}
@Override
public void handleEvent(Object eventSource) {
if(eventSource == combo_statusType){
getEntity().setType(combo_statusType.getSelection());
+ firePropertyChangeEvent(new CdmPropertyChangeEvent(this.getParentElement(), eventSource));
+ if (getEntity().getType() == null) {
+ combo_statusType.setBackground(colorRedSWT);
+ }else {
+ combo_statusType.setBackground(NOT_SELECTED);
+ }
}
if (getParentElement() instanceof AbstractCdmDetailSection) {
((AbstractCdmDetailSection<?>) getParentElement()).updateTitle();
}
-
}
@Override
public SelectionArbitrator getSelectionArbitrator() {
- // TODO Auto-generated method stub
+ // actually this view is used in the specimen wizard, so there the selection arbitrator is not needed.
return null;
}
-
-}
+ @Override
+ public void setBackground(Color color) {
+
+ for(ICdmFormElement element : getElements()){
+ if (element != null) {
+ if (element != combo_statusType ^ (element == combo_statusType && combo_statusType.getSelection() != null)){
+ element.setBackground(color);
+ }else {
+ element.setBackground(colorRedSWT);
+ }
+ }
+ }
+ for(Control element : getControls()){
+ if (!element.isDisposed()){
+ element.setBackground(color);
+ }
+ }
+ }
+}
\ No newline at end of file
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
* @author pplitzner
* @date 17.06.2014
- *
*/
public class OriginalLabelDataSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection {
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param selectionProvider
- * @param style
- */
public OriginalLabelDataSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading()
- */
@Override
public String getHeading() {
return "Original Label Data";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
return formFactory.createOriginalLabelDataElement(parentElement);
}
-
-}
+}
\ No newline at end of file
* 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.occurrence;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- * <p>SourceCollectionDetailSection class.</p>
*
* @author n.hoffmann
* @created Oct 15, 2010
- * @version 1.0
*/
public class SourceCollectionDetailSection extends
AbstractEntityCollectionSection<DerivedUnitFacade, IdentifiableSource> {
- /**
- * <p>Constructor for SourceCollectionDetailSection.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
public SourceCollectionDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Sources", style);
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Sources", style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
- */
- /** {@inheritDoc} */
@Override
public Collection<IdentifiableSource> getCollection(DerivedUnitFacade entity) {
return entity.getSources();
return new DefaultCdmBaseComparator<>();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
- */
- /** {@inheritDoc} */
@Override
public IdentifiableSource createNewElement() {
return IdentifiableSource.NewInstance(OriginalSourceType.PrimaryTaxonomicSource);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void addElement(IdentifiableSource element) {
getEntity().addSource(element);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void removeElement(IdentifiableSource element) {
getEntity().removeSource(element);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No sources yet.";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add source";
}
- /**
- * {@inheritDoc}
- */
@Override
public IdentifiableSource addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-
-}
+}
\ No newline at end of file
@Override
public void createControls(ICdmFormElement element, int style) {
selection_derivedUnit = formFactory
- .createSelectionElement(DerivedUnit.class,//getConversationHolder(),
+ .createSelectionElement(DerivedUnit.class,
element, "Derived Unit", null,
EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE, style);
if (entity != null){
* 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.occurrence;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- * <p>SpecimenCollectionDetailSection class.</p>
- *
* @author n.hoffmann
* @created Oct 14, 2010
- * @version 1.0
*/
public class SpecimenCollectionDetailSection extends
AbstractEntityCollectionSection<DerivedUnitFacade, DerivedUnit> {
- /**
- * <p>Constructor for SpecimenCollectionDetailSection.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
public SpecimenCollectionDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Duplicates", style);
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Duplicates", style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
- */
- /** {@inheritDoc} */
@Override
public Collection<DerivedUnit> getCollection(DerivedUnitFacade entity) {
return entity.getDuplicates();
return new DefaultCdmBaseComparator<>();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
- */
- /** {@inheritDoc} */
@Override
public DerivedUnit createNewElement() {
return DerivedUnit.NewInstance(SpecimenOrObservationType.PreservedSpecimen);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void addElement(DerivedUnit element) {
getEntity().addDuplicate(element);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void removeElement(DerivedUnit element) {
getEntity().removeDuplicate(element);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No duplicates yet.";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a duplicate";
}
- /**
- * {@inheritDoc}
- */
@Override
public DerivedUnit addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-
-}
+}
\ No newline at end of file
* 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.occurrence;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.cdm.model.common.IdentifiableSource;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.OccurrenceStatus;
-import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- * <p>SourceCollectionDetailSection class.</p>
- *
* @author n.hoffmann
* @created Oct 15, 2010
- * @version 1.0
*/
public class StatusCollectionDetailSection extends
AbstractEntityCollectionSection<DerivedUnitFacade, OccurrenceStatus> {
- /**
- * <p>Constructor for SourceCollectionDetailSection.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
public StatusCollectionDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Status", style);
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Status", style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
- */
- /** {@inheritDoc} */
@Override
public Collection<OccurrenceStatus> getCollection(DerivedUnitFacade entity) {
if (entity.baseUnit() instanceof DerivedUnit){
return new DefaultCdmBaseComparator<>();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
- */
- /** {@inheritDoc} */
@Override
public OccurrenceStatus createNewElement() {
return OccurrenceStatus.NewInstance(null);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void addElement(OccurrenceStatus element) {
((DerivedUnit)getEntity().baseUnit()).addStatus(element);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void removeElement(OccurrenceStatus element) {
((DerivedUnit)getEntity().baseUnit()).removeStatus(element);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No status yet.";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add status";
}
- /**
- * {@inheritDoc}
- */
@Override
public OccurrenceStatus addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-
+
@Override
protected void setSectionTitle() {
DerivedUnitFacade entity = getEntity();
this.setText(getTitleString());
}
}
-
-}
+}
\ No newline at end of file
* 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.occurrence.association;
import java.util.Set;
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
private TermComboElement<SpecimenTypeDesignationStatus> combo_typeStatus;
-// private List<EntitySelectionElement<TaxonNameBase>> selectionTaxonNames;
private ICdmFormElement parentFormElement;
private int style;
else if(typifiedNames.size()>1){
formFactory.createLabel(getLayoutComposite(), "!!!!!!!!");
}
-
+
SpecimenTypeDesignationStatus typeStatus = HibernateProxyHelper
.deproxy(entity.getTypeStatus());
combo_typeStatus.setSelection(typeStatus);
checkbox_notDesignated.setSelection(entity.isNotDesignated());
}
-
-// for (TaxonNameBase taxonNameBase : typifiedNames) {
-// EntitySelectionElement<TaxonNameBase> selectionElement = formFactory.createSelectionElement(
-// TaxonNameBase.class, getConversationHolder(), parentFormElement, "Scientific Name", null,
-// EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE, style);
-// selectionElement.setEntity(taxonNameBase);
-// }
-
-
}
- /** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement element, int style) {
this.parentFormElement = element;
this.style = style;
selectionTaxonName = formFactory.createSelectionElement(
- TaxonName.class, //getConversationHolder(),
+ TaxonName.class,
parentFormElement, "Scientific Name", null,
EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE, style);
}
}
- /** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
if (eventSource == selectionTaxonName) {
} else if (eventSource == checkbox_notDesignated) {
getEntity().setNotDesignated(checkbox_notDesignated.getSelection());
}
-// else if (eventSource == selection_reference) {
-// getEntity().setCitation(selection_reference.getSelection());
-// } else if (eventSource == text_referenceDetail) {
-// getEntity().setCitationMicroReference(
-// text_referenceDetail.getText());
-// }
}
-
-}
+}
\ No newline at end of file
import java.util.List;
import java.util.Set;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
/**
* @author pplitzner
* @date Oct 29, 2015
- *
*/
public class DerivedUnitTypeDesignationSection extends AbstractEntityCollectionSection<DerivedUnitFacade, SpecimenTypeDesignation> {
private Collection<SpecimenTypeDesignation> typeDesignations;
public DerivedUnitTypeDesignationSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Type Designations", style);
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Type Designations", style);
}
@Override
return "No type designation yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a type designation";
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
/**
* @author pplitzner
* @date Dec 1, 2014
- *
*/
public class TaxonAssociationDetailElement extends AbstractCdmDetailElement<DerivedUnitFacade> implements IDoubleClickListener{
super(formFactory, formElement);
}
- /** {@inheritDoc} */
@Override
protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
- Collection<TaxonBase<?>> associatedTaxa = CdmStore.getService(IOccurrenceService.class).listIndividualsAssociationTaxa(entity.innerDerivedUnit(), null, null, null, null);
+ boolean includeUnpublished = true;
+ Collection<TaxonBase<?>> associatedTaxa = CdmStore.getService(IOccurrenceService.class).listIndividualsAssociationTaxa(entity.innerDerivedUnit(), includeUnpublished, null, null, null, null);
Collection<SpecimenTypeDesignation> typeDesignations = CdmStore.getService(IOccurrenceService.class).listTypeDesignations(entity.innerDerivedUnit(), null, null, null, null);
Collection<DeterminationEvent> determinationEvents = CdmStore.getService(IOccurrenceService.class).listDeterminationEvents(entity.innerDerivedUnit(), null, null, null, null);
}
openInItem.setData(cdmBase);
openInItem.addSelectionListener(new SelectionListener() {
-
+
@Override
public void widgetSelected(SelectionEvent e) {
new CdmViewerChooser(TaxonAssociationDetailElement.this.getLayoutComposite().getShell()).chooseViewer(e.widget.getData());
new CdmViewerChooser(event.getViewer().getControl().getShell()).chooseViewer(firstElement);
}
}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
}
* 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.occurrence.association;
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.IDerivedUnitFacadeDetailSection;
/**
- *
* @author pplitzner
* @date Dec 1, 2014
- *
*/
public class TaxonAssociationDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
public TaxonAssociationDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
- /** {@inheritDoc} */
@Override
public String getHeading() {
return "Taxon Associations";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
return formFactory.createTaxonAssociationDetailElement(parentElement);
* 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.occurrence.derivedUnit;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
/**
- * <p>DeterminationEventDetailSection class.</p>
- *
* @author n.hoffmann
* @created Oct 13, 2010
- * @version 1.0
*/
public abstract class PreservedSpecimenAbstractDeterminationEventDetailSection extends
AbstractEntityCollectionSection<DerivedUnit, DeterminationEvent> {
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param title
- * @param style
- */
public PreservedSpecimenAbstractDeterminationEventDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
String title, int style) {
- super(formFactory, conversation, parentElement, title, style);
+ super(formFactory, parentElement, title, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
- */
- /** {@inheritDoc} */
@Override
public DeterminationEvent createNewElement() {
DeterminationEvent instance = DeterminationEvent.NewInstance();
return instance;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void addElement(DeterminationEvent determination) {
getEntity().addDetermination(determination);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void removeElement(DeterminationEvent determination) {
getEntity().removeDetermination(determination);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No determinations yet.";
}
-
-}
+}
\ No newline at end of file
* 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.occurrence.derivedUnit;
import java.util.Arrays;
import java.util.Set;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.widgets.Control;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
import eu.etaxonomy.taxeditor.model.ImageResources;
/**
* @author n.hoffmann
* @created May 11, 2011
- * @version 1.0
*/
public class PreservedSpecimenCurrentDeterminationDetailSection extends
PreservedSpecimenAbstractDeterminationEventDetailSection {
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param style
- */
public PreservedSpecimenCurrentDeterminationDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
int style) {
- super(formFactory, conversation, parentElement, "Current Determination", style);
+ super(formFactory, parentElement, "Current Determination", style);
}
@Override
protected Control createToolbar() {
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
- Action addAction = new Action("add", Action.AS_PUSH_BUTTON){
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
+ Action addAction = new Action("add", IAction.AS_PUSH_BUTTON){
+
+ @Override
public void run() {
DeterminationEvent element = createNewElement();
internalUpdateSection(false);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
- */
@Override
public Collection<DeterminationEvent> getCollection(DerivedUnit entity) {
DeterminationEvent preferredDetermination = null;
return new DefaultCdmBaseComparator<>();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.occurrence.AbstractDeterminationEventDetailSection#createNewElement()
- */
@Override
public DeterminationEvent createNewElement() {
DeterminationEvent newElement = super.createNewElement();
return newElement;
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Create new current determination event";
}
- /**
- * {@inheritDoc}
- */
@Override
public DeterminationEvent addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-
-}
+}
\ No newline at end of file
PreservationMethod preservationMethod = entity.getPreservation();
combo_preservationMethod = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Preservation Method", preservationMethod==null?null:preservationMethod.getDefinedMaterialOrMethod(), style);
- selection_storedUnder = formFactory.createSelectionElement(TaxonName.class, //getConversationHolder(),
+ selection_storedUnder = formFactory.createSelectionElement(TaxonName.class,
formElement, "Stored Under", entity.getStoredUnder(), EntitySelectionElement.ALL, style);
text_exsicatum = formFactory.createTextWithLabelElement(formElement, "Exsiccatum", entity.getExsiccatum(), style);
- section_source = formFactory.createPreservedSpecimenSourceCollectionDetailSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(PreservedSpecimenSourceCollectionDetailSection.class, entity.getClass().getCanonicalName()));
+ section_source = formFactory.createPreservedSpecimenSourceCollectionDetailSection(formElement, StoreUtil.getSectionStyle(PreservedSpecimenSourceCollectionDetailSection.class, entity.getClass().getCanonicalName()));
section_source.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_source.setEntity(entity);
}
}
}
}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
* <p>Constructor for DerivedUnitBaseDetailSection.</p>
*
* @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
* @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
* @param style a int.
*/
public PreservedSpecimenDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
- /** {@inheritDoc} */
@Override
public String getHeading() {
return "Specimen Details";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<DerivedUnit> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnit> parentElement, int style) {
return formFactory.createPreservedSpecimenDetailElement(parentElement);
toggleableText_titleCache.setText(getEntity().getTitleCache());
}
}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author pplitzner
* @date 17.12.2013
- *
*/
public class PreservedSpecimenGeneralDetailSection extends AbstractCdmDetailSection<DerivedUnit> {
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param selectionProvider
- * @param style
- */
public PreservedSpecimenGeneralDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
@Override
public String getHeading() {
return "General Specimen";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<DerivedUnit> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnit> parentElement, int style) {
return formFactory.createPreservedSpecimenGeneralDetailElement(parentElement);
}
-}
+}
\ No newline at end of file
* 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.occurrence.derivedUnit;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
-import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- * <p>SourceCollectionDetailSection class.</p>
- *
* @author n.hoffmann
* @created Oct 15, 2010
- * @version 1.0
*/
public class PreservedSpecimenSourceCollectionDetailSection extends
AbstractEntityCollectionSection<DerivedUnit, IdentifiableSource> {
- /**
- * <p>Constructor for SourceCollectionDetailSection.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
public PreservedSpecimenSourceCollectionDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Sources", style);
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Sources", style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
- */
- /** {@inheritDoc} */
@Override
public Collection<IdentifiableSource> getCollection(DerivedUnit entity) {
return entity.getSources();
return new DefaultCdmBaseComparator<>();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
- */
- /** {@inheritDoc} */
@Override
public IdentifiableSource createNewElement() {
return IdentifiableSource.NewInstance(OriginalSourceType.PrimaryTaxonomicSource);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void addElement(IdentifiableSource element) {
getEntity().addSource(element);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void removeElement(IdentifiableSource element) {
getEntity().removeSource(element);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No sources yet.";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add source";
}
- /**
- * {@inheritDoc}
- */
@Override
public IdentifiableSource addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-
-}
+}
\ No newline at end of file
* 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.occurrence.dna;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.Identifier;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.view.search.derivative.DerivateLabelProvider;
/**
- *
* @author pplitzner
* @date Oct 16, 2014
- *
*/
public abstract class AbstractSampleDesignationDetailSection extends
AbstractEntityCollectionSection<IdentifiableEntity<?>, Identifier> {
public AbstractSampleDesignationDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
String title, int style) {
- super(formFactory, conversation, parentElement, title, style);
+ super(formFactory, parentElement, title, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#createNewElement()
- */
- /** {@inheritDoc} */
@Override
public Identifier createNewElement() {
return Identifier.NewInstance(getEntity(), null, DerivateLabelProvider.getSampleDesignationTerm());
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void removeElement(Identifier sampleDesignation) {
getEntity().removeIdentifier(sampleDesignation);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No sample designations yet.";
}
-
-}
+}
\ No newline at end of file
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.widgets.Control;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.taxeditor.model.ImageResources;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
public abstract class AbstractUnboundEntityCollectionSection<ENTITY, ELEMENT>
extends AbstractEntityCollectionSection<ENTITY, ELEMENT> {
- private boolean addUnboundElement = false;
+ protected boolean addUnboundElement = false;
- public AbstractUnboundEntityCollectionSection(CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, String title, int style) {
- super(formFactory, conversation, parentElement, title, style);
+ public AbstractUnboundEntityCollectionSection(CdmFormFactory formFactory, ICdmFormElement parentElement, String title, int style) {
+ super(formFactory, parentElement, title, style);
}
/**
Cloning cloning = entity.getCloning();
textCloningStrain = formFactory.createTextWithLabelElement(formElement, "Cloning Strain", cloning==null?"":cloning.getStrain(), style);
date = formFactory.createTimePeriodElement(formElement, "Cloning Date", cloning==null?null:cloning.getTimeperiod(), style);
- selectionCloningStaff = formFactory.createSelectionElement(AgentBase.class, //getConversationHolder(),
+ selectionCloningStaff = formFactory.createSelectionElement(AgentBase.class,
formElement, "Cloning Staff", cloning==null?null:cloning.getActor(), EntitySelectionElement.ALL, style);
comboCloningMaterialOrMethod = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Cloning Mat. & Meth.", cloning==null?null:cloning.getDefinedMaterialOrMethod(), style);
}
}
}
}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
}
\ No newline at end of file
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.molecular.AmplificationResult;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
extends AbstractCdmDetailSection<AmplificationResult> {
public AmplificationCloningDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
import java.util.Collections;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.molecular.AmplificationResult;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
/**
* @author pplitzner
* @date 26.02.2014
- *
*/
public class AmplificationGelPhotoCollectionDetailSection extends AbstractEntityCollectionSection<AmplificationResult, Media> {
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param title
- * @param style
- */
- public AmplificationGelPhotoCollectionDetailSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ public AmplificationGelPhotoCollectionDetailSection(CdmFormFactory formFactory,
ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Gel Photo", style);
+ super(formFactory, parentElement, "Gel Photo", style);
}
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
- */
@Override
public Collection<Media> getCollection(AmplificationResult entity) {
if(entity.getGelPhoto()!=null){
return new DefaultCdmBaseComparator<>();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
- */
@Override
public Media createNewElement() {
if(getEntity().getGelPhoto()==null){
return null;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(java.lang.Object)
- */
@Override
public void addElement(Media element) {
if(getEntity().getGelPhoto()==null){
getEntity().setGelPhoto(element);
}
-
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(java.lang.Object)
- */
@Override
public void removeElement(Media element) {
getEntity().setGelPhoto(null);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
- */
@Override
public String getEmptyString() {
return "No gel photo yet";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
- */
@Override
protected String getTooltipString() {
return "Add a gel photo";
}
-
-
- /**
- * {@inheritDoc}
- */
@Override
public Media addExisting() {
return null;
}
-
-
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-
-}
+}
\ No newline at end of file
/**
* @author pplitzner
* @date 15.01.2014
- *
*/
public class AmplificationGelPhotoDetailElement extends AbstractCdmDetailElement<AmplificationResult> {
private AmplificationGelPhotoCollectionDetailSection sectionGelPhoto;
- /**
- * @param formFactory
- * @param formElement
- */
public AmplificationGelPhotoDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
super(formFactory, formElement);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
- * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
- */
@Override
protected void createControls(ICdmFormElement formElement, AmplificationResult entity, int style) {
- sectionGelPhoto = formFactory.createAmplificationGelPhotoCollectionDetailSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(AmplificationGelPhotoCollectionDetailSection.class, entity.getClass().getCanonicalName()));
+ sectionGelPhoto = formFactory.createAmplificationGelPhotoCollectionDetailSection(formElement, StoreUtil.getSectionStyle(AmplificationGelPhotoCollectionDetailSection.class, entity.getClass().getCanonicalName()));
sectionGelPhoto.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionGelPhoto.setEntity(entity);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
- * .lang.Object)
- */
@Override
public void handleEvent(Object eventSource) {
}
-}
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
+}
\ No newline at end of file
textDesignation = formFactory.createTextWithLabelElement(formElement, "Designation", entity.getLabelCache(), style);
textDesignation.setEnabled(false);
textDesignation.setBackground(getPersistentBackground());
- selectionInstitution = formFactory.createSelectionElement(Institution.class, //getConversationHolder(),
+ selectionInstitution = formFactory.createSelectionElement(Institution.class,
formElement, "Institution", entity.getInstitution(), EntitySelectionElement.ALL, style);
- selectionAmplificationStaff = formFactory.createSelectionElement(AgentBase.class, //getConversationHolder(),
+ selectionAmplificationStaff = formFactory.createSelectionElement(AgentBase.class,
formElement, "Amplification staff", entity.getActor(), EntitySelectionElement.ALL, style);
dateAmplification = formFactory.createTimePeriodElement(formElement, "Date", entity.getTimeperiod(), style);
comboMarker = formFactory.createDefinedTermComboElement(TermType.DnaMarker, formElement, "DNA Marker", entity.getDnaMarker(), style);
- selectionPrimerFW = formFactory.createSelectionElement(Primer.class,// getConversationHolder(),
+ selectionPrimerFW = formFactory.createSelectionElement(Primer.class,
formElement, "Primer FW", entity.getForwardPrimer(), EntitySelectionElement.ALL, style);
- selectionPrimerRW = formFactory.createSelectionElement(Primer.class, //getConversationHolder(),
+ selectionPrimerRW = formFactory.createSelectionElement(Primer.class,
formElement, "Primer RW", entity.getReversePrimer(), EntitySelectionElement.ALL, style);
- AnnotationSection annotationSection = formFactory.createAnnotationSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(AnnotationSection.class, entity.getClass().getCanonicalName()));
+ AnnotationSection annotationSection = formFactory.createAnnotationSection(formElement, StoreUtil.getSectionStyle(AnnotationSection.class, entity.getClass().getCanonicalName()));
annotationSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
annotationSection.setEntity(entity);
}
getEntity().updateCache();
textDesignation.setText(getEntity().getLabelCache());
}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.molecular.Amplification;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author pplitzner
* @date 19.12.2013
- *
*/
public class AmplificationGeneralDetailSection extends AbstractCdmDetailSection<Amplification> {
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param selectionProvider
- * @param style
- */
public AmplificationGeneralDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
@Override
public String getHeading() {
return "General Amplification";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<Amplification> createCdmDetailElement(AbstractCdmDetailSection<Amplification> parentElement, int style) {
return formFactory.createAmplificationGeneralDetailElement(parentElement);
}
-}
+}
\ No newline at end of file
*/
@Override
protected void createControls(ICdmFormElement formElement, Amplification entity, int style) {
- selectionPrimerForward = formFactory.createSelectionElement(Primer.class, //getConversationHolder(),
+ selectionPrimerForward = formFactory.createSelectionElement(Primer.class,
formElement, "Forward Primer", entity.getForwardPrimer(), EntitySelectionElement.ALL, style);
- selectionPrimerReverse = formFactory.createSelectionElement(Primer.class, //getConversationHolder(),
+ selectionPrimerReverse = formFactory.createSelectionElement(Primer.class,
formElement, "Reverse Primer", entity.getReversePrimer(), EntitySelectionElement.ALL, style);
}
getEntity().setReversePrimer(selectionPrimerReverse.getSelection());
}
}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.molecular.Amplification;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author pplitzner
* @date 15.01.2014
- *
*/
public class AmplificationPrimerDetailSection extends AbstractCdmDetailSection<Amplification> {
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param selectionProvider
- * @param style
- */
public AmplificationPrimerDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
@Override
public String getHeading() {
return "Primer";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<Amplification> createCdmDetailElement(AbstractCdmDetailSection<Amplification> parentElement, int style) {
return formFactory.createAmplificationPrimerDetailElement(parentElement);
}
-
-}
+}
\ No newline at end of file
import java.util.Collections;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.Identifier;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
public class CurrentSampleDesignationDetailSection extends AbstractSampleDesignationDetailSection {
public CurrentSampleDesignationDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
int style) {
- super(formFactory, conversation, parentElement, "Current Sample Designation", style);
+ super(formFactory, parentElement, "Current Sample Designation", style);
}
@Override
dnaQuality.setQualityCheckDate(dateTime);
}
}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
}
\ No newline at end of file
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.molecular.DnaSample;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
public class DnaQualityDetailSection extends AbstractCdmDetailSection<DnaSample> {
public DnaQualityDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
@Override
protected void createControls(ICdmFormElement formElement, DnaSample entity, int style) {
selection_collection = formFactory
- .createSelectionElement(Collection.class,//getConversationHolder(),
+ .createSelectionElement(Collection.class,
formElement, "Collection",
entity.getCollection(),
EntitySelectionElement.ALL, style);
getEntity().setCollection(selection_collection.getSelection());
}
}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
}
\ No newline at end of file
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.molecular.DnaSample;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
public class DnaSampleGeneralDetailSection extends AbstractCdmDetailSection<DnaSample> {
public DnaSampleGeneralDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
-
@Override
public String getHeading() {
return "General";
protected AbstractCdmDetailElement<DnaSample> createCdmDetailElement(AbstractCdmDetailSection<DnaSample> parentElement, int style) {
return formFactory.createDnaSampleGeneralDetailElement(parentElement);
}
-}
+}
\ No newline at end of file
if(entity.getDerivedFrom()!=null){
materialOrMethodText = entity.getDerivedFrom().getDescription();
}
- selectionInstitution = formFactory.createSelectionElement(Institution.class, //getConversationHolder(),
+ selectionInstitution = formFactory.createSelectionElement(Institution.class,
formElement, "Institution", institution, EntitySelectionElement.ALL, style);
- selectionStaff = formFactory.createSelectionElement(AgentBase.class, //getConversationHolder(),
+ selectionStaff = formFactory.createSelectionElement(AgentBase.class,
formElement, "Staff", staff, EntitySelectionElement.ALL, style);
datePreparationDate = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
numberPreservationTemperature = formFactory.createFloatTextWithLabelElement(formElement, "Preservation Temp. [C°]", temperature, style);
}
return preservationMethod;
}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.molecular.DnaSample;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
public class DnaSamplePreparationPreservationSection extends AbstractCdmDetailSection<DnaSample> {
public DnaSamplePreparationPreservationSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
/**
* @author pplitzner
* @date 06.01.2014
- *
*/
public class PrimerGeneralDetailElement extends AbstractCdmDetailElement<Primer> {
private TermComboElement<DefinedTerm> comboMarker;
private EntitySelectionElement<Reference> selectionReference;
- /**
- * @param formFactory
- * @param formElement
- */
public PrimerGeneralDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
super(formFactory, formElement);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
- * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
- */
@Override
protected void createControls(ICdmFormElement formElement, Primer entity, int style) {
textPrimerName = formFactory.createTextWithLabelElement(formElement, "Primer Name", entity.getLabel(), style);
comboMarker = formFactory.createDefinedTermComboElement(TermType.DnaMarker, formElement, "DNA Marker", entity.getDnaMarker(), style);
selectionReference = formFactory
- .createSelectionElement(Reference.class,//getConversationHolder(),
+ .createSelectionElement(Reference.class,
formElement, "Reference",
entity.getPublishedIn(),
EntitySelectionElement.ALL, style);
- AnnotationSection annotationSection = formFactory.createAnnotationSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(AnnotationSection.class, entity.getClass().getCanonicalName()));
+ AnnotationSection annotationSection = formFactory.createAnnotationSection(formElement, StoreUtil.getSectionStyle(AnnotationSection.class, entity.getClass().getCanonicalName()));
annotationSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
annotationSection.setEntity(entity);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
- * .lang.Object)
- */
@Override
public void handleEvent(Object eventSource) {
if(eventSource==textPrimerName){
getEntity().setPublishedIn(selectionReference.getSelection());
}
}
-}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
+}
\ No newline at end of file
protected void createControls(ICdmFormElement formElement,
DerivedUnit facade, int style) {
DerivedUnit entity = getEntity();
- sectionCurrentSampleDesignation = formFactory.createCurrentSampleDesignationDetailSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(CurrentSampleDesignationDetailSection.class, entity.getClass().getCanonicalName(), true));
+ sectionCurrentSampleDesignation = formFactory.createCurrentSampleDesignationDetailSection(formElement, StoreUtil.getSectionStyle(CurrentSampleDesignationDetailSection.class, entity.getClass().getCanonicalName(), true));
sectionCurrentSampleDesignation.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionCurrentSampleDesignation.setEntity(entity);
- sectionSampleDesignationHistory = formFactory.createSampleDesignationHistoryDetailSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(SampleDesignationHistoryDetailSection.class, entity.getClass().getCanonicalName()));
+ sectionSampleDesignationHistory = formFactory.createSampleDesignationHistoryDetailSection(formElement, StoreUtil.getSectionStyle(SampleDesignationHistoryDetailSection.class, entity.getClass().getCanonicalName()));
sectionSampleDesignationHistory.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
sectionSampleDesignationHistory.setEntity(entity);
}
sectionSampleDesignationHistory.refresh();
}
}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
}
\ No newline at end of file
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
public class SampleDesignationDetailSection extends AbstractCdmDetailSection<DerivedUnit> {
public SampleDesignationDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
import java.util.Comparator;
import java.util.LinkedList;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.Identifier;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
public class SampleDesignationHistoryDetailSection extends AbstractSampleDesignationDetailSection {
public SampleDesignationHistoryDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
- int style) {
- super(formFactory, conversation, parentElement, "Sample Designation History", style);
+ ICdmFormElement parentElement,int style) {
+ super(formFactory, parentElement, "Sample Designation History", style);
}
@Override
import java.util.Collections;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.IMediaService;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.molecular.Sequence;
/**
* @author pplitzner
* @date 03.03.2014
- *
*/
public class SequenceContigFileCollectionDetailSection extends AbstractEntityCollectionSection<Sequence, Media> {
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param title
- * @param style
- */
- public SequenceContigFileCollectionDetailSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ public SequenceContigFileCollectionDetailSection(CdmFormFactory formFactory,
ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Contig File", style);
+ super(formFactory, parentElement, "Contig File", style);
}
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
- */
@Override
public Collection<Media> getCollection(Sequence entity) {
if(entity.getContigFile()!=null){
return new DefaultCdmBaseComparator<>();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
- */
@Override
public Media createNewElement() {
if(getEntity().getContigFile()==null){
return null;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(java.lang.Object)
- */
@Override
public void addElement(Media element) {
if(getEntity().getContigFile()==null){
}
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(java.lang.Object)
- */
@Override
public void removeElement(Media element) {
getEntity().setContigFile(null);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
- */
@Override
public String getEmptyString() {
return "No contig file yet";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
- */
@Override
protected String getTooltipString() {
return "Add a contig file";
}
-
-
- /**
- * {@inheritDoc}
- */
@Override
public Media addExisting() {
return null;
}
-
-
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-}
+}
\ No newline at end of file
}
}
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
+
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.molecular.Sequence;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author pplitzner
* @date 19.12.2013
- *
*/
public class SequenceGeneralDetailSection extends AbstractCdmDetailSection<Sequence>{
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param selectionProvider
- * @param style
- */
public SequenceGeneralDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
@Override
public String getHeading() {
return "General";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<Sequence> createCdmDetailElement(AbstractCdmDetailSection<Sequence> parentElement, int style) {
return formFactory.createSequenceGeneralDetailElement(parentElement);
}
-
-}
+}
\ No newline at end of file
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.molecular.Sequence;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
/**
* This section visualizes {@link Reference}s belonging to a {@link Sequence} and alllows adding/removing them.
+ *
* @author pplitzner
* @date 07.01.2014
- *
*/
public class SequenceReferenceCollectionDetailSection extends AbstractUnboundEntityCollectionSection<Sequence, Reference> {
public SequenceReferenceCollectionDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "References", style);
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "References", style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
- */
- /** {@inheritDoc} */
@Override
protected Collection<Reference> getEntityCollection(Sequence entity) {
return entity.getCitations();
return new DefaultCdmBaseComparator<>();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
- */
- /** {@inheritDoc} */
@Override
public Reference createNewElement() {
return ReferenceFactory.newGeneric();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void addElement(Reference element) {
//never gets called
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void removeElement(Reference element) {
getEntity().removeCitation(element);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No references yet.";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a reference";
}
- /**
- * {@inheritDoc}
- */
@Override
public Reference addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-
-
-}
+}
\ No newline at end of file
/**
* @author pplitzner
* @date 06.01.2014
- *
*/
public class SingleReadGeneralDetailElement extends AbstractCdmDetailElement<SingleRead> {
private EntitySelectionElement<Primer> selectionPrimer;
private EntitySelectionElement<Amplification> selectionAmplification;
- /**
- * @param formFactory
- * @param formElement
- */
public SingleReadGeneralDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
super(formFactory, formElement);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
- * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
- */
@Override
protected void createControls(ICdmFormElement formElement, SingleRead entity, int style) {
- selectionPrimer = formFactory.createSelectionElement(Primer.class, //getConversationHolder(),
+ selectionPrimer = formFactory.createSelectionElement(Primer.class,
formElement, "Primer", entity.getPrimer(), EntitySelectionElement.ALL, style);
AmplificationResult amplificationResult = entity.getAmplificationResult();
if(amplificationResult==null){
amplificationResult = AmplificationResult.NewInstance();
amplificationResult.addSingleRead(entity);
}
- selectionAmplification = formFactory.createSelectionElement(Amplification.class, //getConversationHolder(),
+ selectionAmplification = formFactory.createSelectionElement(Amplification.class,
formElement, "Amplification", amplificationResult.getAmplification(), EntitySelectionElement.ALL, style);
- AnnotationSection annotationSection = formFactory.createAnnotationSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(AnnotationSection.class, entity.getClass().getCanonicalName()));
+ AnnotationSection annotationSection = formFactory.createAnnotationSection(formElement, StoreUtil.getSectionStyle(AnnotationSection.class, entity.getClass().getCanonicalName()));
annotationSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
annotationSection.setEntity(entity);
- AmplificationCloningDetailSection cloningSection = formFactory.createAmplificationCloningDetailSection(getConversationHolder(), formElement, formFactory.getSelectionProvider(), StoreUtil.getSectionStyle(AmplificationCloningDetailSection.class, amplificationResult.getClass().getCanonicalName()));
+ AmplificationCloningDetailSection cloningSection = formFactory.createAmplificationCloningDetailSection(formElement, formFactory.getSelectionProvider(), StoreUtil.getSectionStyle(AmplificationCloningDetailSection.class, amplificationResult.getClass().getCanonicalName()));
cloningSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
cloningSection.setEntity(amplificationResult);
- AmplificationGelPhotoCollectionDetailSection gelPhotoSection = formFactory.createAmplificationGelPhotoCollectionDetailSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(AmplificationGelPhotoCollectionDetailSection.class, amplificationResult.getClass().getCanonicalName()));
+ AmplificationGelPhotoCollectionDetailSection gelPhotoSection = formFactory.createAmplificationGelPhotoCollectionDetailSection(formElement, StoreUtil.getSectionStyle(AmplificationGelPhotoCollectionDetailSection.class, amplificationResult.getClass().getCanonicalName()));
gelPhotoSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
gelPhotoSection.setEntity(amplificationResult);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
- * .lang.Object)
- */
@Override
public void handleEvent(Object eventSource) {
if(eventSource==selectionPrimer){
}
}
}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.molecular.SingleRead;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author pplitzner
* @date 06.01.2014
- *
*/
public class SingleReadGeneralDetailSection extends AbstractCdmDetailSection<SingleRead>{
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param selectionProvider
- * @param style
- */
public SingleReadGeneralDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
@Override
public String getHeading() {
return "General";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<SingleRead> createCdmDetailElement(AbstractCdmDetailSection<SingleRead> parentElement, int style) {
return formFactory.createSingleReadGeneralDetailElement(parentElement);
}
-
-}
+}
\ No newline at end of file
import java.util.Collections;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.IMediaService;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.molecular.SingleRead;
/**
* @author pplitzner
* @date 03.03.2014
- *
*/
public class SingleReadPherogramCollectionDetailSection extends AbstractEntityCollectionSection<SingleRead, Media> {
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param title
- * @param style
- */
- public SingleReadPherogramCollectionDetailSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ public SingleReadPherogramCollectionDetailSection(CdmFormFactory formFactory,
ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Read Chromatogram", style);
+ super(formFactory, parentElement, "Read Chromatogram", style);
}
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
- */
@Override
public Collection<Media> getCollection(SingleRead entity) {
if(entity.getPherogram()!=null){
return new DefaultCdmBaseComparator<>();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
- */
@Override
public Media createNewElement() {
if(getEntity().getPherogram()==null){
return null;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#addElement(java.lang.Object)
- */
@Override
public void addElement(Media element) {
if(getEntity().getPherogram()==null){
}
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#removeElement(java.lang.Object)
- */
@Override
public void removeElement(Media element) {
getEntity().setPherogram(null);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getEmptyString()
- */
@Override
public String getEmptyString() {
return "No read chromatogram yet";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getTooltipString()
- */
@Override
protected String getTooltipString() {
return "Add a read chromatogram";
}
-
-
- /**
- * {@inheritDoc}
- */
@Override
public Media addExisting() {
return null;
}
-
-
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-}
+}
\ No newline at end of file
*/
package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.api.service.IVocabularyService;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.agent.Institution;
import eu.etaxonomy.cdm.model.common.TimePeriod;
textAccessionNumber = formFactory.createTextWithLabelElement(formElement, "Accession Number", entity.getAccessionNumber(), style);
textBarcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
checkIsPublish = formFactory.createCheckbox(formElement, "Publish", entity.isPublish(), style);
-
}
@Override
}
return preservationMethod;
}
+
+ @Override
+ public void fillFields() {
+
+ //TODO: implement
+// comboKindOfTissue;
+// selectionInstitution;
+// selectionStaff;
+// datePreparation;
+// comboPreservationMedium;
+// selectionCollection;
+// textAccessionNumber;
+// textBarcode;
+// checkIsPublish;
+
+ }
}
\ No newline at end of file
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
public class TissueSampleGeneralDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> {
public TissueSampleGeneralDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
*/
package eu.etaxonomy.taxeditor.ui.section.occurrence.media;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.eclipse.swt.SWT;
import eu.etaxonomy.cdm.api.service.IVocabularyService;
LabelElement label1 = formFactory.createLabel(formElement, "");
- selectionArtist = formFactory.createSelectionElement(AgentBase.class, //getConversationHolder(),
+ selectionArtist = formFactory.createSelectionElement(AgentBase.class,
formElement, "Prepared by", media.getArtist(), EntitySelectionElement.ALL, style);
TimePeriod mediaCreated = entity.getMediaSpecimen().getMediaCreated();
return mediaDetailElement.isAdvancedMediaView();
}
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
+
}
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Control;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
private ITogglableMediaElement togglableMediaElement;
public MediaSpecimenGeneralDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
((NamedSourceBase)getEntity()).setNameUsedInSource(select_nameUsedInSource.getEntity());
}
}
+
+ @Override
+ public void fillFields() {
+ if (this.getEntity() != null) {
+ text_idInSource.setText(this.getEntity().getIdInSource());
+ text_idNamespace.setText(this.getEntity().getIdNamespace());;
+ text_originalInfo.setText(this.getEntity().getOriginalInfo());
+ select_nameUsedInSource.setEntity(((NamedSourceBase)getEntity()).getNameUsedInSource());;
+ }
+
+ }
}
\ No newline at end of file
@Override
public void handleEvent(Object eventSource) {
+ if (eventSource.equals(sourceElement)) {
+ getEntity().setNomenclaturalSource((NomenclaturalSource) sourceElement.getEntity());
+ }
+ }
+ @Override
+ public void fillFields() {
+ sourceElement.setEntity(getEntity().getNomenclaturalSource());
+
}
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.name.NomenclaturalSource;
import eu.etaxonomy.cdm.model.name.TaxonName;
* <p>Constructor for NomenclaturalReferenceDetailSection.</p>
*
* @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
* @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
* @param style a int.
*/
- public NomenclaturalSourceDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
+ public NomenclaturalSourceDetailSection(CdmFormFactory cdmFormFactory,
ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
- super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
+ super(cdmFormFactory, parentElement, selectionProvider, style);
}
@Override
TaxonName name = HibernateProxyHelper.deproxy(entity.getName());
setEntity(name);
}
+ @Override
+ public void setTaxonBaseWithoutUpdate(TaxonBase entity) {
+ this.taxonBase = entity;
+ TaxonName name = HibernateProxyHelper.deproxy(entity.getName());
+ setEntityWithoutUpdate(name);
+ }
@Override
protected void setSectionTitle() {
entity = HibernateProxyHelper.deproxy(entity);
selection_NomRef = formFactory.createSelectionElementWithAbbreviatedTitle(Reference.class,
- getConversationHolder(), formElement, "Reference",
+ formElement, "Reference",
null,
EntitySelectionElement.ALL, style);
select_nameUsedInSource = formFactory.createSelectionElement(TaxonName.class, formElement, "Original Spelling", entity != null? entity.getNameUsedInSource(): null, EntitySelectionElement.ALL, style);
- externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, "Protologue/Original Publication", false, StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
+ externalLinks = formFactory.createExternalLinksSection(formElement, "Protologue/Original Publication", false, StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
externalLinks.setEmptySectionString("No protologue yet.");
externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 3));
externalLinks.setEntity(entity);
externalLinks.setFont(AbstractUtility.getFont(Resources.COLOR_FONT_DEFAULT));
+
addControl(externalLinks);
addElement(externalLinks);
+ externalLinks.setExpanded(true);
-// advancedSection = formFactory.createOriginalSourceAdvancedSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(OriginalSourceAdvancedSection.class, INomenclaturalReference.class.getCanonicalName()));
+// advancedSection = formFactory.createOriginalSourceAdvancedSection(formElement, null, StoreUtil.getSectionStyle(OriginalSourceAdvancedSection.class, INomenclaturalReference.class.getCanonicalName()));
// TableWrapData layoutData = LayoutConstants.FILL_HORIZONTALLY(2, 1);
//
// advancedSection.setLayoutData(layoutData);
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
*/
public class OriginalSourceAdvancedSection extends AbstractCdmDetailSection<OriginalSourceBase> {
- public OriginalSourceAdvancedSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ public OriginalSourceAdvancedSection(CdmFormFactory formFactory,
ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
// setLayout(layout);
}
-
-
// protected ExternalLinksSection getExternalLinksElement(){
// return ((AdvancedSourceElement)this.getDetailElement()).getExternalLinks();
// }
import eu.etaxonomy.cdm.model.reference.NamedSourceBase;
import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.cdm.model.reference.ReferenceType;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.preference.Resources;
import eu.etaxonomy.taxeditor.store.StoreUtil;
extends AbstractCdmDetailElement<T>
implements IPropertyChangeListener{
+ protected ICdmFormElement composite;
protected EntitySelectionElement<Reference> selection_Ref;
protected TextWithLabelElement microReference;
protected TimePeriodElement accessed;
protected String label = "Source";
protected CdmBase cdmEntity;
protected ExternalLinksSection externalLinks;
+ protected ReferenceType refType;
public OriginalSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement, CdmBase cdmEntity, String label) {
super(formFactory, formElement);
if (entity != null){
selection_Ref.setEntity(entity.getCitation());
+ if (entity.getCitation() != null) {
+ refType = entity.getCitation().getType();
+ }
+
}
selection_Ref.setBackground(this.getPersistentBackground());
microReference = formFactory.createTextWithLabelElement(formElement, "Details", entity != null? entity.getCitationMicroReference(): "", style);
accessed = formFactory.createTimePeriodElement(formElement, "Accessed", acc, style);
}
- externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, "Link(s)", StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
+ externalLinks = formFactory.createExternalLinksSection(formElement, "Link(s)", StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 3));
externalLinks.setEntity(HibernateProxyHelper.deproxy(entity));
externalLinks.setFont(AbstractUtility.getFont(Resources.COLOR_FONT_DEFAULT));
addControl(externalLinks);
addElement(externalLinks);
- advancedSection = formFactory.createOriginalSourceAdvancedSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(OriginalSourceAdvancedSection.class, INomenclaturalReference.class.getCanonicalName()));
+ advancedSection = formFactory.createOriginalSourceAdvancedSection(formElement, null, StoreUtil.getSectionStyle(OriginalSourceAdvancedSection.class, INomenclaturalReference.class.getCanonicalName()));
TableWrapData layoutData = LayoutConstants.FILL_HORIZONTALLY(2, 1);
advancedSection.setLayoutData(layoutData);
advancedSection.setFont(AbstractUtility.getFont(Resources.COLOR_FONT_DEFAULT));
@Override
public void handleEvent(Object eventSource) {
if (eventSource.equals(selection_Ref)){
+
getEntity().setCitation(selection_Ref.getEntity());
+
+ ReferenceType newRefType = getEntity().getCitation() != null? getEntity().getCitation().getType(): null;
+ if (refType != null && refType.isDynamic()^(newRefType!= null && newRefType.isDynamic()) ){
+ this.refresh();
+ }
+ refType = newRefType;
}else if (eventSource.equals(microReference)){
getEntity().setCitationMicroReference(microReference.getText());
}else if(eventSource == accessed){
externalLinks.setIndent(indent+10);
advancedSection.setIndent(indent+10);
}
+
+ @Override
+ public void refresh() {
+ updateContent();
+ this.getParentElement().refresh();
+ }
+
+ @Override
+ public void fillFields() {
+ if (getEntity() != null) {
+ selection_Ref.setEntity(getEntity().getCitation()!= null? getEntity().getCitation(): null);
+ microReference.setText(getEntity().getCitationMicroReference());
+ if (accessed != null) {
+ accessed.setEntity(getEntity().getAccessed()!= null? getEntity().getAccessed(): null);
+ }
+ if (advancedSection != null) {
+ advancedSection.setEntity(getEntity());
+ }
+
+ externalLinks.setEntity(getEntity());
+
+ }
+
+ }
+
+
+
+
}
\ No newline at end of file
private TextWithLabelElement text_organisation;
private TextWithLabelElement text_pages;
private TextWithLabelElement text_placePublished;
+ private TextWithLabelElement text_placePublished2;
private TextWithLabelElement text_publisher;
+ private TextWithLabelElement text_publisher2;
private TextWithLabelElement text_referenceAbstract;
private TextWithLabelElement text_series;
// private TextWithLabelElement text_seriesPart;
if(referenceType != null && !referenceType.equals(ReferenceType.Journal) && !referenceType.equals(ReferenceType.PrintSeries) ) {
if (isNomenclaturalReference){
selection_authorTeam = formFactory
- .createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,getConversationHolder(),
+ .createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
formElement, "Author",
entity.getAuthorship(),
EntitySelectionElement.ALL, style);
}
- private void createWebPageControls(ReferenceDetailElement referenceDetailElement, Reference reference, int style) {
+ private void createWebPageControls(ICdmFormElement element, Reference reference, int style) {
DateTime accessed = reference.getAccessed();
- text_accessed = formFactory.createDateElement(referenceDetailElement, "Accessed", accessed, style, false);
+ text_accessed = formFactory.createDateElement(element, "Accessed", accessed, style, false);
}
@Override
private void createPublicationControls(ICdmFormElement element,
ReferenceType referenceType, Reference reference, int style) {
- // placePublished
- text_placePublished = formFactory.createTextWithLabelElement(element,
- "Place Published", reference.getPlacePublished(), style);
+ if (!referenceType.equals(ReferenceType.Journal)) {
+ // placePublished
+ text_placePublished = formFactory.createTextWithLabelElement(element,
+ "Place Published", reference.getPlacePublished(), style);
- // publisher
- text_publisher = formFactory.createTextWithLabelElement(element,
- "Publisher", reference.getPublisher(), style);
+ // publisher
+ text_publisher = formFactory.createTextWithLabelElement(element,
+ "Publisher", reference.getPublisher(), style);
+ // placePublished2
+ text_placePublished2 = formFactory.createTextWithLabelElement(element,
+ "2nd Place Published", reference.getPlacePublished2(), style);
+
+ text_placePublished2.setEditable(!(reference.getPlacePublished() == null && reference.getPublisher() == null));
+
+
+ // publisher2
+ text_publisher2 = formFactory.createTextWithLabelElement(element,
+ "2nd Publisher", reference.getPublisher2(), style);
+ text_publisher2.setEditable(!(getEntity().getPlacePublished() == null && getEntity().getPublisher() == null));
+ }
if (referenceType.equals(ReferenceType.Journal)) {
// issn
text_issn = formFactory.createTextWithLabelElement(element, "ISSN",
if (referenceType.equals(ReferenceType.Report)) {
// institution
selection_institution = formFactory
- .createSelectionElement(Institution.class,//getConversationHolder(),
+ .createSelectionElement(Institution.class,
element, "Institution",
reference.getInstitution(),
EntitySelectionElement.ALL, style);
text_uri = formFactory.createUriWithLabelElement(element, "URI",
reference.getUri(), style);
if (reference.isDynamic()){
- createWebPageControls(this, reference, style);
+ createWebPageControls(element, reference, style);
}
}
getEntity().setPages(text_pages.getText());
} else if (eventSource == text_placePublished) {
getEntity().setPlacePublished(text_placePublished.getText());
- } else if (eventSource == text_publisher) {
+ text_publisher2.setEditable(!(getEntity().getPlacePublished() == null && getEntity().getPublisher() == null));
+ text_placePublished2.setEditable(!(getEntity().getPlacePublished() == null && getEntity().getPublisher() == null));
+ } else if (eventSource == text_placePublished2) {
+ getEntity().setPlacePublished2(text_placePublished2.getText());
+ }else if (eventSource == text_publisher) {
getEntity().setPublisher(text_publisher.getText());
- } else if (eventSource == text_referenceAbstract) {
+ text_publisher2.setEditable(!(getEntity().getPlacePublished() == null && getEntity().getPublisher() == null));
+ text_placePublished2.setEditable(!(getEntity().getPlacePublished() == null && getEntity().getPublisher() == null));
+ } else if (eventSource == text_publisher2) {
+ getEntity().setPublisher2(text_publisher2.getText());
+ }else if (eventSource == text_referenceAbstract) {
getEntity().setReferenceAbstract(text_referenceAbstract.getText());
} else if (eventSource == text_series) {
getEntity().setSeriesPart(text_series.getText());
List<Object> except = new ArrayList<>();
- except.addAll( Arrays.asList(new Object[] { toggleable_cache, toggleableAbbrevCache, text_editor, text_isbn, text_issn, text_organisation, text_pages, text_placePublished, text_publisher, text_referenceAbstract, text_uri, selection_institution}));
+ except.addAll( Arrays.asList(new Object[] { toggleable_cache, toggleableAbbrevCache, text_editor, text_isbn, text_issn, text_organisation, text_pages, text_placePublished,text_placePublished2, text_publisher, text_publisher2, text_referenceAbstract, text_uri, selection_institution}));
if (abbrev){
except.add(text_title);
updateCacheRelevance();
}
+
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+
+ }
}
\ No newline at end of file
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
/**
- * <p>ReferenceBaseDetailSection class.</p>
- *
* @author n.hoffmann
* @created 05.06.2009
*/
private TaxonBase<?> taxonBase;
- /**
- * <p>Constructor for ReferenceBaseDetailSection.</p>
- *
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
- */
- public ReferenceDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
+ public ReferenceDetailSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
+ super(cdmFormFactory, parentElement, selectionProvider, style);
}
@Override
setEntity(reference);
}
+ @Override
+ public void setTaxonBaseWithoutUpdate(TaxonBase<?> entity) {
+ this.taxonBase = entity;
+ TaxonName name = entity.getName();
+ Reference reference = HibernateProxyHelper.deproxy(name.getNomenclaturalReference());
+
+ setEntityWithoutUpdate(reference);
+ }
@Override
public String getHeading() {
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
- * <p>ReferenceBaseWizardPage class.</p>
- *
* @author n.hoffmann
* @created Jun 1, 2010
*/
public class ReferenceWizardPage extends AbstractCdmEntityWizardPage<Reference> implements IExceptionHandler{
- private boolean isNomenclaturalReference = false;
- /**
- * <p>Constructor for ReferenceBaseWizardPage.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param entity a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
- */
- public ReferenceWizardPage(CdmFormFactory formFactory, ConversationHolder conversation, Reference entity, boolean isNomenclaturalReference) {
- super(formFactory, conversation, entity);
+ private boolean isNomenclaturalReference = false;
+
+ public ReferenceWizardPage(CdmFormFactory formFactory, Reference entity, boolean isNomenclaturalReference) {
+ super(formFactory, entity);
setTitle("Reference");
this.isNomenclaturalReference = isNomenclaturalReference;
}
}
+ @Override
+ public void fillFields() {
+ sourceElement.fillFields();
+
+ }
+
}
public class SecundumSourceElement extends OriginalSourceElement<SecundumSource> {
protected EntitySelectionElement<TaxonName> select_nameUsedInSource;
-
+
public SecundumSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement, CdmBase cdmEntity,
String label) {
super(formFactory, formElement, cdmEntity, label);
@Override
protected void createControls(ICdmFormElement formElement, SecundumSource entity, int style) {
- setEntityWithoutUpdate(HibernateProxyHelper.deproxy(entity));
+ HibernateProxyHelper.deproxy(entity);
this.selection_Ref = formFactory.createSelectionElement(Reference.class, formElement, "Secundum", getEntity()!= null? getEntity().getCitation(): null, EntitySelectionElement.ALL, style);
-
+ if (entity.getCitation() != null) {
+ refType = entity.getCitation().getType();
+ }
selection_Ref.setBackground(this.getPersistentBackground());
for (ICdmFormElement element: selection_Ref.getElements()){
element.setBackground(getPersistentBackground());
select_nameUsedInSource = formFactory.createSelectionElement(TaxonName.class, formElement, "Name in Source", entity != null? ((NamedSourceBase)entity).getNameUsedInSource(): null, EntitySelectionElement.DELETABLE, style);
}
- externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, "Links", false, StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
+ externalLinks = formFactory.createExternalLinksSection(formElement, "Links", false, StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
externalLinks.setEmptySectionString("No links yet.");
externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 3));
externalLinks.setEntity(getEntity());
super.handleEvent(eventSource);
}
}
+
+ @Override
+ public void fillFields() {
+ if (getEntity() != null) {
+ super.fillFields();
+ if (select_nameUsedInSource != null) {
+ select_nameUsedInSource.setEntity(getEntity().getNameUsedInSource());
+ }
+ }
+
+ }
}
\ No newline at end of file
+/**
+ * Copyright (C) 2011 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.reference;
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.model.name.NomenclaturalSource;
-import eu.etaxonomy.cdm.model.taxon.SecundumSource;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
public abstract class SecundumSourceSection extends AbstractCdmDetailSection<TaxonBase> {
-
- public SecundumSourceSection(CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider,
- int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
-
+ public SecundumSourceSection(CdmFormFactory formFactory, ICdmFormElement parentElement,
+ ISelectionProvider selectionProvider, int style) {
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
public String getHeading() {
-
+
return "Secundum Source";
}
-
+
@Override
protected void setSectionTitle() {
String title = "";
if(getEntity() != null ){
-
+
if (getEntity().getSecSource() != null && getEntity().getSecSource().getCitation() != null){
String secundumCitation = getEntity().getSecSource().getCitation().getNomenclaturalCitation(getEntity().getSecSource().getCitationMicroReference());
title = ": " + secundumCitation;
// @Override
// protected AbstractCdmDetailElement<TaxonBase> createCdmDetailElement(
// AbstractCdmDetailSection<TaxonBase> parentElement, int style) {
-//
+//
// return formFactory.createSecundumSourceDetailElement(parentElement);
// }
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
import eu.etaxonomy.cdm.model.reference.Reference;
private CdmBase cdmEntity;
private String label;
- public SingleSourceSection(CdmFormFactory formFactory, ConversationHolder conversation,
+ public SingleSourceSection(CdmFormFactory formFactory,
ICdmFormElement parentElement, CdmBase cdmEntity, ISelectionProvider selectionProvider, int style, String label) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
this.cdmEntity = cdmEntity;
this.label = label;
- ((OriginalSourceElement)this.detailElement).setCdmEntity(cdmEntity);
+ ((OriginalSourceElement<?>)this.detailElement).setCdmEntity(cdmEntity);
}
@Override
protected AbstractCdmDetailElement<OriginalSourceBase> createCdmDetailElement(
AbstractCdmDetailSection<OriginalSourceBase> parentElement, int style) {
- return new OriginalSourceElement(getFormFactory(), parentElement, cdmEntity, label);
+ return new OriginalSourceElement<>(getFormFactory(), parentElement, cdmEntity, label);
}
@Override
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.TimePeriod;
+import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.reference.ICdmTarget;
import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
protected boolean isCommonNameReference = false;
protected EntitySelectionElement<Reference> selection_reference;
+ protected EntitySelectionElement<SpecimenOrObservationBase> selection_specimen;
protected TextWithLabelElement text_referenceDetail;
protected TimePeriodElement accessed;
protected EnumComboElement<OriginalSourceType> combo_origsourcetype;
selection_reference = formFactory
.createCommonNameReferenceSelectionElement(formElement, "Reference",
null, EntitySelectionElement.ALL, style);
- }else{
+ }else if (entity instanceof DescriptionElementSource && PreferencesUtil.getBooleanValue(PreferencePredicate.ShowSpecimenInFactSource.getKey())) {
+ selection_reference = formFactory
+ .createSelectionElement(Reference.class,
+ formElement, "Reference",
+ null, EntitySelectionElement.ALL, style);
+ selection_specimen = formFactory
+ .createSelectionElement(SpecimenOrObservationBase.class,
+ formElement, "or Specimen",
+ null, EntitySelectionElement.ALL, SWT.NULL);
+ }else{
selection_reference = formFactory
.createSelectionElement(Reference.class,
formElement, "Reference",
if (entity != null){
selection_reference.setEntity(entity.getCitation());
+ if (selection_specimen != null && entity instanceof DescriptionElementSource) {
+ selection_specimen.setEntity(((DescriptionElementSource)entity).getSpecimen());
+ }
text_referenceDetail.setText(entity.getCitationMicroReference());
text_originalInfo.setText(entity.getOriginalInfo());
private SelectionArbitrator selectionArbitrator;
private OriginalSourceElement sourceElement;
- private String label = "Source";
-// protected EntitySelectionElement<Reference> selection_reference;
-// protected TextWithLabelElement text_referenceDetail;
+ protected String label = "Source";
+
protected boolean isCommonNameReference = false;
public AbstractSourcedEntityElement(CdmFormFactory formFactory,
- AbstractFormSection section, T entity,
+ AbstractFormSection<?> section, T entity,
SelectionListener removeListener, String label, int style, boolean isCommonNameReference) {
super(formFactory, section, entity, removeListener, null, style);
// make this element selectable
selectionArbitrator = formFactory.createSelectionArbitrator(this);
}
this.isCommonNameReference = isCommonNameReference;
-
-
-
+ this.label = label;
}
public AbstractSourcedEntityElement(CdmFormFactory formFactory,
this(formFactory, section, entity, removeListener, label, style, false);
}
-
@Override
public void createControls(ICdmFormElement formElement, int style) {
-
sourceElement = formFactory.createOriginalSourceElement(formElement, entity, label);
if (entity.getSource() == null){
sourceElement.setEntity(source);
}else{
sourceElement.setEntity(entity.getSource());
-
}
-
}
@Override
this.sourceElement.refresh();
}
}
-
-}
+}
\ No newline at end of file
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.ui.section.supplemental;
+
+import org.eclipse.swt.events.SelectionListener;
+
+import eu.etaxonomy.cdm.model.common.AnnotationType;
+import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.persistence.dto.AnnotationDto;
+import eu.etaxonomy.taxeditor.event.EventUtility;
+import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
+import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
+import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
+
+/**
+ * <p>AnnotationElement class.</p>
+ *
+ * @author Katja Luther
+ */
+public class AnnotationDtoElement extends AbstractEntityCollectionElement<AnnotationDto>{
+
+ private TextWithLabelElement text;
+ private TermComboElement<AnnotationType> combo_annotationType;
+
+ /**
+ * <p>Constructor for AnnotationElement.</p>
+ *
+ * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
+ * @param annotation a {@link eu.etaxonomy.cdm.model.common.Annotation} object.
+ * @param style a int.
+ * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
+ * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
+ */
+ public AnnotationDtoElement(CdmFormFactory cdmFormFactory, AbstractFormSection formElement, AnnotationDto annotation, SelectionListener removeListener, int style) {
+ super(cdmFormFactory, formElement, annotation, removeListener, null, style);
+ }
+
+ @Override
+ public void createControls(ICdmFormElement element, int style) {
+ combo_annotationType = formFactory.createDefinedTermComboElement(TermType.AnnotationType, this, "Annotation Type", null, style);
+
+ text = formFactory.createMultiLineTextWithLabel(this, "Annotation", 100, style);
+ if (entity != null){
+ setEntity(entity);
+ }
+ }
+
+ @Override
+ public void setEntity(AnnotationDto entity) {
+ this.entity = entity;
+ if (entity == null || combo_annotationType == null) {
+ return;
+ }
+ if (combo_annotationType != null && entity.getTypeUuid() != null){
+ AnnotationType selectedType = null;
+ for (AnnotationType anType: combo_annotationType.getTerms()) {
+ if (anType != null && anType.getUuid() != null && anType.getUuid().equals(entity.getTypeUuid())) {
+ selectedType = anType;
+ break;
+ }
+ }
+ combo_annotationType.setSelection(selectedType);
+
+ }
+ text.setText(entity.getText());
+ }
+
+ @Override
+ public void handleEvent(Object eventSource) {
+ if(eventSource == combo_annotationType){
+ getEntity().setTypeLabel(combo_annotationType.getSelection() == null ? null :combo_annotationType.getSelection().getLabel());
+ getEntity().setTypeUuid(combo_annotationType.getSelection() == null ? null :combo_annotationType.getSelection().getUuid());
+ }else if(eventSource == text){
+ getEntity().setText(text.getText());
+ }
+
+ EventUtility.postEvent(WorkbenchEventConstants.ADD_SAVE_CANDIDATE, getEntity());
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2013 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.supplemental;
+
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.UUID;
+
+import eu.etaxonomy.cdm.model.common.AnnotationType;
+import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.persistence.dto.AnnotationDto;
+import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
+import eu.etaxonomy.taxeditor.event.EventUtility;
+import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
+
+/**
+ * @author n.hoffmann
+ * @created Nov 5, 2009
+ */
+public class AnnotationDtoSection extends AbstractEntityCollectionSection<TermNodeDto, AnnotationDto>{
+
+ public AnnotationDtoSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, int style) {
+ super(cdmFormFactory, parentElement, "Annotations", style);
+ }
+
+ @Override
+ public AnnotationDto createNewElement() {
+ String text = "";
+ AnnotationType type = AnnotationType.EDITORIAL();
+ Language language = CdmStore.getDefaultLanguage();
+
+ AnnotationDto anDto = new AnnotationDto(UUID.randomUUID(), 0);
+ anDto.setTypeUuid(type.getUuid());
+ return anDto;
+ }
+
+ @Override
+ public Collection<AnnotationDto> getCollection(TermNodeDto entity) {
+ return entity.getAnnotations();
+ }
+
+ @Override
+ public Comparator<AnnotationDto> getComparator() {
+ return null;
+ // return new DefaultCdmBaseComparator<>();
+ }
+
+ @Override
+ public String getEmptyString() {
+ return "No annotations yet.";
+ }
+
+ @Override
+ protected String getTooltipString() {
+ return "Create a new annotation";
+ }
+
+ @Override
+ public void addElement(AnnotationDto element) {
+ getEntity().addAnnotation(element);
+ }
+
+ @Override
+ public void removeElement(AnnotationDto element) {
+ getEntity().removeAnnotation(element);
+ EventUtility.postEvent(WorkbenchEventConstants.REMOVE_ELEMENT, element);
+ }
+
+ @Override
+ public AnnotationDto addExisting() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean allowAddExisting() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+}
\ No newline at end of file
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
import eu.etaxonomy.cdm.model.common.Annotation;
import eu.etaxonomy.cdm.model.common.AnnotationType;
*/
public class AnnotationSection extends AbstractEntityCollectionSection<AnnotatableEntity, Annotation>{
- /**
- * <p>Constructor for AnnotationSection.</p>
- *
- */
- public AnnotationSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(cdmFormFactory, conversation, parentElement, "Annotations", style);
+ public AnnotationSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, int style) {
+ super(cdmFormFactory, parentElement, "Annotations", style);
}
@Override
--- /dev/null
+/**
+* Copyright (C) 2009 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.supplemental;
+
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+
+import eu.etaxonomy.cdm.persistence.dto.ICdmBaseDto;
+import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
+
+/**
+ * @author l.morris
+ * @date 24 Jan 2012
+ */
+public class CdmBaseDtoElement extends AbstractCdmFormElement implements IEntityElement<ICdmBaseDto>{
+ private Label label_created;
+ private Label label_updated;
+ private TextWithLabelElement text_uuid;
+ private TextWithLabelElement text_objectId;
+
+ private ICdmBaseDto entity;
+
+ public CdmBaseDtoElement(CdmFormFactory formFactory,
+ ICdmFormElement formElement, ICdmBaseDto entity, int style) {
+
+ super(formFactory, formElement);
+
+ label_created = formFactory.createLabel(getLayoutComposite(), null, style);
+ TableWrapData layout = LayoutConstants.FILL_HORIZONTALLY();
+ layout.maxHeight = 1;
+ label_created.setLayoutData(layout);
+
+ label_updated = formFactory.createLabel(getLayoutComposite(), null, style);
+ TableWrapData layoutUpdated = LayoutConstants.FILL_HORIZONTALLY();
+ layoutUpdated.maxHeight = 1;
+ label_updated.setLayoutData(layoutUpdated);
+ text_uuid = formFactory.createTextWithLabelElement(formElement, "UUID", null, style);
+ text_uuid.setEditable(false);
+ text_objectId = formFactory.createTextWithLabelElement(formElement, "Object ID", null, style);
+ text_objectId.setEditable(false);
+ if (entity != null) {
+ setEntity(entity);
+ }
+ }
+
+ @Override
+ public void setSelected(boolean selected) {
+ // this entity element is not likely to get selected
+ }
+
+ @Override
+ public ICdmBaseDto getEntity() {
+ return entity;
+ }
+
+ public void setEntity(ICdmBaseDto entity) {
+
+ this.entity = entity;
+ String createdBy = entity.getCreatedBy()!= null? entity.getCreatedBy():"";
+ String createdString = "Created "
+ + dateFormat(entity.getCreated())
+ + " by " + createdBy;
+ label_created.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
+ label_created.setText(createdString);
+
+ String updatedBy = entity.getUpdatedBy()!= null? entity.getUpdatedBy():"";
+ String updatedString = "Updated "
+ + dateFormat(entity.getUpdated())
+ + " by " + updatedBy;
+ label_updated.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
+ label_updated.setText(updatedString);
+
+ text_uuid.setText(entity != null ? entity.getUuid().toString() : "");
+ text_objectId.setText(entity != null ? entity.getId()+"" : "");
+
+ refresh();
+ }
+}
\ No newline at end of file
--- /dev/null
+/**
+* Copyright (C) 2009 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.supplemental;
+
+import eu.etaxonomy.cdm.persistence.dto.ICdmBaseDto;
+import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+
+/**
+ * @author l.morris
+ * @date 24 Jan 2012
+ *
+ */
+public class CdmBaseDtoSection extends AbstractFormSection<ICdmBaseDto> {
+
+ private CdmBaseDtoElement cdmBaseElement;
+
+ /**
+ * @param formFactory
+ * @param parentElement
+ * @param selectionProvider
+ * @param style
+ */
+ public CdmBaseDtoSection(CdmFormFactory formFactory,
+ ICdmFormElement parentElement,
+ int style) {
+
+ super(formFactory, parentElement, style);
+ cdmBaseElement = formFactory.createCdmBaseDtoElement(this, null, style);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setEntity(ICdmBaseDto entity) {
+ super.setEntity(entity);
+ cdmBaseElement.setEntity(entity);
+ }
+
+}
@Override
public void createControls(ICdmFormElement element, int style) {
agentSelection = formFactory
- .createSelectionElement(AgentBase.class,//getConversationHolder(),
+ .createSelectionElement(AgentBase.class,
this, "Agent", null,
EntitySelectionElement.ALL, style);
text = formFactory.createMultiLineTextWithLabel(this, "Text", 100,
/**
- *
- */
+* 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.supplemental;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.Credit;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
*/
public class CreditSection extends AbstractEntityCollectionSection<IdentifiableEntity, Credit> {
- /**
- * <p>Constructor for CreditSection.</p>
- *
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- public CreditSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(cdmFormFactory, conversation, parentElement, "Credits", style);
+ public CreditSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, int style) {
+ super(cdmFormFactory, parentElement, "Credits", style);
}
- /** {@inheritDoc} */
@Override
public Credit createNewElement() {
return Credit.NewInstance(null, null, null);
}
- /** {@inheritDoc} */
@Override
public Collection<Credit> getCollection(IdentifiableEntity entity) {
return entity.getCredits();
return new DefaultCdmBaseComparator<>();
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No credits yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Create a new credit entry";
}
- /** {@inheritDoc} */
@Override
public void addElement(Credit element) {
getEntity().addCredit(element);
}
- /** {@inheritDoc} */
@Override
public void removeElement(Credit element) {
getEntity().removeCredit(element);
}
- /**
- * {@inheritDoc}
- */
@Override
public Credit addExisting() {
// TODO Auto-generated method stub
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
// TODO Auto-generated method stub
return false;
}
-
-}
+}
\ No newline at end of file
/**
- *
- */
+* 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.supplemental;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.Extension;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- * <p>ExtensionSection class.</p>
- *
* @author nho
*/
public class ExtensionSection extends AbstractEntityCollectionSection<IdentifiableEntity, Extension> {
- /**
- * <p>Constructor for ExtensionSection.</p>
- *
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- public ExtensionSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(cdmFormFactory, conversation,parentElement, "Extensions", style);
+ public ExtensionSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, int style) {
+ super(cdmFormFactory, parentElement, "Extensions", style);
}
@Override
// TODO Auto-generated method stub
return false;
}
-
-}
+}
\ No newline at end of file
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.ui.section.supplemental;
+
+
+import eu.etaxonomy.cdm.persistence.dto.IAnnotatableDto;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+
+/**
+ * <p>HeadlineDtoSection class.</p>
+ *
+ * @author k.luther
+ */
+public class HeadlineDtoSection extends AbstractFormSection<IAnnotatableDto> {
+
+ /**
+ * <p>Constructor for HeadlineSection.</p>
+ *
+ * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
+ * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
+ * @param style a int.
+ */
+ public HeadlineDtoSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement,
+ int style) {
+ super(cdmFormFactory, parentElement, style);
+ }
+
+ @Override
+ public void setEntity(IAnnotatableDto dto) {
+
+ super.setEntity(dto);
+
+ //String simpleName = entity.getClass().getSimpleName();
+ String titleString = dto.getLabel();
+ titleString = StoreUtil.cleanTitleString(titleString);
+ setText(titleString);
+ layout();
+ }
+
+}
@Override
public void createControls(ICdmFormElement formElement, int style) {
super.createControls(formElement, style);
- externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(ExternalLinksSection.class, IdentifiableSource.class.getCanonicalName()));
+ externalLinks = formFactory.createExternalLinksSection(formElement, StoreUtil.getSectionStyle(ExternalLinksSection.class, IdentifiableSource.class.getCanonicalName()));
externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
if (entity != null){
setEntity(this.entity);
--- /dev/null
+package eu.etaxonomy.taxeditor.ui.section.supplemental;
+
+import org.eclipse.swt.events.SelectionListener;
+
+import eu.etaxonomy.cdm.model.common.MarkerType;
+import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.persistence.dto.IAnnotatableDto;
+import eu.etaxonomy.cdm.persistence.dto.MarkerDto;
+import eu.etaxonomy.taxeditor.event.EventUtility;
+import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
+import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
+import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
+
+/**
+ * @author n.hoffmann
+ * @created Nov 16, 2009
+ * @version 1.0
+ */
+public class MarkerDtoElement extends AbstractEntityCollectionElement<MarkerDto>{
+
+
+ private TermComboElement<MarkerType> combo_markerType;
+ private CheckboxElement checkbox_markerState;
+
+ public MarkerDtoElement(CdmFormFactory cdmFormFactory, AbstractFormSection formElement, MarkerDto element,
+ SelectionListener removeListener, int style) {
+ super(cdmFormFactory, formElement, element, removeListener, null, style);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void createControls(ICdmFormElement element, int style) {
+ checkbox_markerState = formFactory.createCheckbox(this, null, false, style);
+ combo_markerType = formFactory.createDefinedTermComboElement(TermType.MarkerType, this, null, null, style);
+ if (entity != null){
+ setEntity(entity);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void setEntity(MarkerDto element) {
+ this.entity = element;
+
+ if (checkbox_markerState != null){
+ checkbox_markerState.setSelection(element.getValue());
+ MarkerType selectedType = null;
+ for (MarkerType markerType: combo_markerType.getTerms()) {
+ if (markerType != null && markerType.getUuid() != null && markerType.getUuid().equals(entity.getTypeUuid())) {
+ selectedType = markerType;
+ break;
+ }
+ }
+ combo_markerType.setSelection(selectedType);
+
+
+ combo_markerType.removeEmptyElement();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void handleEvent(Object eventSource) {
+ if(eventSource == combo_markerType && getParentElement() instanceof MarkerDtoSection){
+ MarkerDtoSection markerSection = (MarkerDtoSection)getParentElement();
+ IAnnotatableDto annotatableEntity = markerSection.getEntity();
+ annotatableEntity.removeMarker(entity);
+ MarkerType markerType = combo_markerType.getSelection();
+ entity.setTypeUuid(markerType.getUuid());
+ annotatableEntity.addMarker(entity);
+ }
+ else if(eventSource == checkbox_markerState){
+ getEntity().setValue(checkbox_markerState.getSelection());
+ }
+ EventUtility.postEvent(WorkbenchEventConstants.ADD_SAVE_CANDIDATE, getEntity());
+ }
+}
--- /dev/null
+/**
+ * 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.supplemental;
+
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.UUID;
+
+import eu.etaxonomy.cdm.persistence.dto.IAnnotatableDto;
+import eu.etaxonomy.cdm.persistence.dto.MarkerDto;
+import eu.etaxonomy.taxeditor.event.EventUtility;
+import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
+
+/**
+ * @author nho
+ */
+public class MarkerDtoSection extends AbstractUnboundEntityCollectionSection<IAnnotatableDto, MarkerDto> {
+
+ public MarkerDtoSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, int style) {
+ super(cdmFormFactory, parentElement, "Marker", style);
+ }
+
+ @Override
+ public MarkerDto createNewElement() {
+ MarkerDto marker = new MarkerDto(UUID.randomUUID(), 0);
+ marker.setValue(true);
+ return marker;
+ }
+
+ @Override
+ public String getEmptyString() {
+ return "No markers yet.";
+ }
+
+ @Override
+ protected String getTooltipString() {
+ return "Create a new marker";
+ }
+
+ @Override
+ public void addElement(MarkerDto element) {
+ getEntity().addMarker(element);
+ }
+
+
+ @Override
+ public Comparator<MarkerDto> getComparator() {
+ return null;//new DefaultCdmBaseComparator<>();
+ }
+
+ @Override
+ public MarkerDto addExisting() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean allowAddExisting() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ protected Collection<MarkerDto> getEntityCollection(IAnnotatableDto entity) {
+ return entity.getMarkers();
+ }
+
+ @Override
+ public void removeElement(MarkerDto element) {
+ getEntity().removeMarker(element);
+ EventUtility.postEvent(WorkbenchEventConstants.REMOVE_ELEMENT, element);
+ }
+}
\ No newline at end of file
+/**
+ * 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.supplemental;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
import eu.etaxonomy.cdm.model.common.Marker;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
/**
- * <p>MarkerSection class.</p>
- *
* @author nho
*/
public class MarkerSection extends AbstractUnboundEntityCollectionSection<AnnotatableEntity, Marker> {
- /**
- * <p>Constructor for MarkerSection.</p>
- *
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- public MarkerSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(cdmFormFactory, conversation, parentElement, "Marker", style);
+ public MarkerSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, int style) {
+ super(cdmFormFactory, parentElement, "Marker", style);
}
@Override
// TODO Auto-generated method stub
return false;
}
-
-}
+}
\ No newline at end of file
public void createControls(ICdmFormElement element, int style) {
combo_rightsType = formFactory.createDefinedTermComboElement(TermType.RightsType, this, "Rights Type", null, style);
selection_agent = formFactory.createSelectionElement(
- AgentBase.class, //getConversationHolder(),
+ AgentBase.class,
this, "Agent",
null, EntitySelectionElement.ALL, style);
text = formFactory.createMultiLineTextWithLabel(this, "Text", 100,
/**
- *
- */
+* 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.supplemental;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.media.Rights;
import eu.etaxonomy.taxeditor.ui.dialog.selection.RightsSelectionDialog;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- * <p>RightsSection class.</p>
- *
* @author nho
*/
public class RightsSection extends AbstractEntityCollectionSection<IdentifiableEntity, Rights> {
- /**
- * <p>Constructor for RightsSection.</p>
- *
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- public RightsSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(cdmFormFactory, conversation, parentElement, "Rights", style);
+ public RightsSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, int style) {
+ super(cdmFormFactory, parentElement, "Rights", style);
}
@Override
public boolean allowAddExisting() {
return true;
}
-
-
-}
+}
\ No newline at end of file
/**
- *
- */
+* 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.supplemental;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.reference.ISourceable;
import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
import eu.etaxonomy.taxeditor.ui.section.description.SourceComparator;
/**
- * <p>SourceSection class.</p>
- *
* @author n.hoffmann
* @created Nov 17, 2009
*/
public class SourceSection extends AbstractEntityCollectionSection<ISourceable, IdentifiableSource> {
- /**
- * <p>Constructor for SourceSection.</p>
- *
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- public SourceSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(cdmFormFactory, conversation, parentElement, "Sources", style);
+ public SourceSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, int style) {
+ super(cdmFormFactory, parentElement, "Sources", style);
}
@Override
+/**
+* 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.supplemental.identifier;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.Identifier;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
public abstract class AbstractIdentifierSection<T> extends AbstractEntityCollectionSection<T, Identifier> {
public AbstractIdentifierSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Identifiers", style);
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Identifiers", style);
}
- /** {@inheritDoc} */
@Override
public Identifier createNewElement() {
return Identifier.NewInstance(null, null);
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No identifiers yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add an identifier";
}
-
-}
+}
\ No newline at end of file
* 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.supplemental.identifier;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.common.Identifier;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- *
* @author pplitzner
- *
*/
public class DerivedUnitFacadeIdentifierSection extends AbstractIdentifierSection<DerivedUnitFacade> {
-
public DerivedUnitFacadeIdentifierSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
int style) {
- super(formFactory, conversation, parentElement, style);
+ super(formFactory, parentElement, style);
}
@Override
getEntity().removeIdentifier(element);
}
- /**
- * {@inheritDoc}
- */
@Override
public Identifier addExisting() {
// TODO Auto-generated method stub
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
// TODO Auto-generated method stub
return false;
}
-
-}
+}
\ No newline at end of file
* 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.supplemental.identifier;
import org.eclipse.swt.events.SelectionListener;
-import eu.etaxonomy.cdm.model.term.DefinedTerm;
import eu.etaxonomy.cdm.model.common.Identifier;
+import eu.etaxonomy.cdm.model.term.IdentifierType;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
/**
- *
* @author pplitzner
- *
*/
public class IdentifierElement extends AbstractEntityCollectionElement<Identifier> {
private TextWithLabelElement textIdentifier;
- private TermComboElement<DefinedTerm> comboIdentifierType;
+ private TermComboElement<IdentifierType> comboIdentifierType;
public IdentifierElement(CdmFormFactory formFactory,
AbstractFormSection section, Identifier entity,
super(formFactory, section, entity, removeListener, null, style);
}
- /** {@inheritDoc} */
@Override
public void setEntity(Identifier entity) {
this.entity = entity;
comboIdentifierType.setSelection(entity.getType());
}
}
-
- /** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement formElement, int style) {
comboIdentifierType = formFactory.createDefinedTermComboElement(TermType.IdentifierType, formElement, "Type", null, style);
getEntity().setType(comboIdentifierType.getSelection());
}
}
-
}
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.Identifier;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
public class IdentifierSection extends AbstractIdentifierSection<IdentifiableEntity> {
public IdentifierSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
int style) {
- super(formFactory, conversation, parentElement, style);
+ super(formFactory, parentElement, style);
}
@Override
* 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.taxon;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.widgets.TableWrapData;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.name.INonViralName;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
/**
- * <p>ParsingMessagesSection class.</p>
- *
* @author n.hoffmann
* @created Mar 3, 2010
*/
-public class ParsingMessagesSection
- extends AbstractCdmDetailSection<INonViralName>
+public class ParsingMessagesSection
+ extends AbstractCdmDetailSection<INonViralName>
implements ITaxonBaseDetailSection {
/** Constant <code>HEADING_SUCCESS=""</code> */
public static final String HEADING_PROBLEM = "The name has problems.";
private TaxonBase taxonBase;
- /**
- * <p>Constructor for ParsingMessagesSection.</p>
- *
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
- * @param style a int.
- */
- public ParsingMessagesSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement,
+ public ParsingMessagesSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
+ super(cdmFormFactory, parentElement, selectionProvider, style);
}
- /** {@inheritDoc} */
@Override
protected void createControls(AbstractCdmDetailSection formElement, int style) {
// we do it differently here
}
- /** {@inheritDoc} */
@Override
public void setTaxonBase(TaxonBase entity) {
this.taxonBase = entity;
displayParsingProblems();
}
}
+ @Override
+ public void setTaxonBaseWithoutUpdate(TaxonBase entity) {
+ //
+ this.taxonBase = entity;
+ this.setEntityWithoutUpdate(entity.getName());
+ }
private void destroyParsingProblemComposites() {
setText(HEADING_SUCCESS);
this.layout();
}
- /** {@inheritDoc} */
@Override
public String getHeading() {
return HEADING_SUCCESS;
//no detail element
return null;
}
-}
+}
\ No newline at end of file
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
+import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
private CheckboxElement checkbox_published;
- private TermComboElement<SynonymType> combo_relationshipType;
+ private EnumComboElement<SynonymType> combo_relationshipType;
public TaxonBaseDetailElement(CdmFormFactory cdmFormFactory,
ICdmFormElement formElement, int style) {
checkbox_doubtful = formFactory.createCheckbox(formElement,
entity.getClass().getSimpleName() + " is doubtful", entity.isDoubtful(), style);
-
checkbox_published = formFactory.createCheckbox(formElement,
entity.getClass().getSimpleName()+" is published", entity.isPublish(), style);
-
//cache relevance
registerCacheRelevance(checkbox_doubtful);
registerCacheRelevance(checkbox_useNameCache);
checkbox_published.setEnabled(
CdmStore.currentAuthentiationHasOneOfRoles(Role.ROLE_PUBLISH, Role.ROLE_ADMIN)
);
-
}
@Override
updateCacheRelevance();
updateToggleableCacheField();
}
+
+ @Override
+ public void refresh() {
+ updateContent();
+
+ }
+
+ @Override
+ public void fillFields() {
+ super.fillFields();
+ if (!(checkbox_doubtful.getSelection() == getEntity().isDoubtful())) {
+ checkbox_doubtful.setSelection(getEntity().isDoubtful());
+ }
+ if (!(checkbox_useNameCache.getSelection() == getEntity().isUseNameCache())) {
+ checkbox_useNameCache.setSelection(getEntity().isUseNameCache());
+ }
+ if (!secElement.getEntity().equals(getEntity().getSecSource())) {
+ secElement.fillFields();
+ }
+ if (getEntity().getAppendedPhrase()!= null && !getEntity().getAppendedPhrase().equals(text_appendedPhrase.getText())) {
+ text_appendedPhrase.setText(getEntity().getAppendedPhrase());
+ }
+ if (!(checkbox_published.getSelection() == getEntity().isPublish())) {
+ checkbox_published.setSelection(getEntity().isPublish());
+ }
+ if (combo_relationshipType != null && !((Synonym) getEntity()).getType().equals(combo_relationshipType.getSelection())) {
+ combo_relationshipType.setSelection(((Synonym) getEntity()).getType());
+ }
+ }
}
\ No newline at end of file
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
/**
* @author n.hoffmann
* @created Nov 4, 2009
*/
-public class TaxonBaseDetailSection extends AbstractCdmDetailSection<TaxonBase<?>> {
+public class TaxonBaseDetailSection extends AbstractCdmDetailSection<TaxonBase<?>> implements ITaxonBaseDetailSection{
- public TaxonBaseDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
- super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
+ public TaxonBaseDetailSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+ super(cdmFormFactory, parentElement, selectionProvider, style);
}
@Override
protected AbstractCdmDetailElement<TaxonBase<?>> createCdmDetailElement(AbstractCdmDetailSection<TaxonBase<?>> parentElement, int style) {
return formFactory.createTaxonBaseDetailElement(parentElement, style);
}
+
+ @Override
+ public void setTaxonBase(TaxonBase<?> taxon) {
+ this.setEntity(taxon);
+
+ }
+
+ @Override
+ public void setTaxonBaseWithoutUpdate(TaxonBase<?> taxon) {
+ setEntityWithoutUpdate(taxon);
+
+ }
+
+ @Override
+ public TaxonBase<?> getTaxonBase() {
+
+ return getEntity();
+ }
}
+/**
+* Copyright (C) 2009 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.taxon;
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.ICdmDetailElement;
public class TaxonDetailSection extends AbstractCdmDetailSection<Taxon> {
-
- public TaxonDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
- super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
- }
+ public TaxonDetailSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+ super(cdmFormFactory, parentElement, selectionProvider, style);
+ }
- /** {@inheritDoc} */
@Override
public String getHeading() {
return getEntity() != null ? getEntity().getClass().getSimpleName() : "Taxon";
public void setTaxon(Taxon fromTaxon) {
// TODO Auto-generated method stub
-
}
-
-
-
-
-}
+}
\ No newline at end of file
}
}
}
+
+ @Override
+ public void fillFields() {
+ super.fillFields();
+ checkbox_doubtful.setSelection(getEntity().isDoubtful());
+ }
}
\ No newline at end of file
*/
package eu.etaxonomy.taxeditor.ui.section.taxon;
-import java.util.Comparator;
-
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.cdm.model.term.TermRelationshipType;
-import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer;
import eu.etaxonomy.taxeditor.ui.combo.InverseTermWrapper;
import eu.etaxonomy.taxeditor.ui.combo.MisappliedRelationshipComboElement;
import eu.etaxonomy.taxeditor.ui.combo.RelationshipTypeCombo;
-import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
taxon = entity.getFromTaxon();
- taxonElement = formFactory.createTaxonDetailSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(TaxonDetailSection.class, Taxon.class.getCanonicalName()));
+ taxonElement = formFactory.createTaxonDetailSection(formElement, null, StoreUtil.getSectionStyle(TaxonDetailSection.class, Taxon.class.getCanonicalName()));
taxonElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
addControl(taxonElement);
addElement(taxonElement);
checkbox_published = formFactory.createCheckbox(this,
"Published", taxon.isPublish(), style);
- sensuReference = formFactory.createSelectionElement(Reference.class,//getConversationHolder(),
+ sensuReference = formFactory.createSelectionElement(Reference.class,
formElement, label,
taxon.getSec(), EntitySelectionElement.ALL,
style);
}
/*TODO: use super.createControls(); to create single source element
- secReference = formFactory.createSelectionElement(Reference.class,//getConversationHolder(),
+ secReference = formFactory.createSelectionElement(Reference.class,
formElement, label,
entity.getCitation(), EntitySelectionElement.ALL,
style);
}else if (entity.getType().isAnySynonym() ){
taxon = entity.getFromTaxon();
- taxonElement = formFactory.createTaxonDetailSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(TaxonDetailSection.class, Taxon.class.getCanonicalName()));
+ taxonElement = formFactory.createTaxonDetailSection(formElement, null, StoreUtil.getSectionStyle(TaxonDetailSection.class, Taxon.class.getCanonicalName()));
taxonElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
addControl(taxonElement);
addElement(taxonElement);
checkbox_published = formFactory.createCheckbox(this,
"Published", taxon.isPublish(), style);
/*
- * secReference = formFactory.createSelectionElement(Reference.class,//getConversationHolder(),
+ * secReference = formFactory.createSelectionElement(Reference.class,
formElement, "Syn. Sec.",
entity.getCitation(), EntitySelectionElement.ALL,
super.createControls(formElement, entity, style);
setSourceLabel("Syn. Sec.");
- sensuReference = formFactory.createSelectionElement(Reference.class,//getConversationHolder(),
+ sensuReference = formFactory.createSelectionElement(Reference.class,
formElement, "Sec",
taxon.getSec(), EntitySelectionElement.ALL,
style);
style,
false,
null);
-
+
combo_taxonRelationshipType.setEnabled(false);
selection_relatedTaxon = formFactory.createSelectionElement(
- Taxon.class, //getConversationHolder(),
+ Taxon.class,
formElement, "Related Taxon", getRelatedTaxon(),
EntitySelectionElement.SELECTABLE, style);
checkBoxDoubtful = formFactory.createCheckbox(formElement, "Relation Doubtful", entity.isDoubtful(), style);
// TODO Auto-generated method stub
return null;
}
+
+ @Override
+ public void fillFields() {
+ taxon = getEntity().getFromTaxon();
+ if (combo_misappliedRelationshipType!= null) {
+ combo_misappliedRelationshipType.setSelection(getEntity().getType());
+ }
+
+ super.singleSourceSection.fillFields();
+ selection_relatedTaxon.setEntity(getEntity().getToTaxon());;
+ checkBoxDoubtful.setSelection(getEntity().isDoubtful());
+
+ sensuReference.setEntity(taxon.getSec());;
+ text_sensu_microreference.setText(taxon.getSecMicroReference());
+ text_appendedPhrase.setText(taxon.getAppendedPhrase());
+
+ checkbox_published.setSelection(taxon.isPublish());;
+ //taxonElement.fillFields();???
+
+ }
}
\ No newline at end of file
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Control;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.taxon.Taxon;
*
*/
public class TaxonRelationshipDetailSection extends AbstractCdmDetailSection<TaxonRelationship> implements ITaxonBaseDetailSection {
- Taxon taxon;
- TaxonName name;
- boolean taxonChoosable = false;
+
+ private Taxon taxon;
+ private TaxonName name;
+ private boolean taxonChoosable = false;
public TaxonRelationshipDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style, boolean taxonChoosable) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
this.taxonChoosable = taxonChoosable;
}
return formFactory.createTaxonRelationshipDetailElement(parentElement);
}
- /** {@inheritDoc} */
@Override
public void setTaxonBase(TaxonBase taxon) {
this.taxon = (Taxon)taxon;
TaxonName name = HibernateProxyHelper.deproxy(taxon.getName());
setName(name);
}
+
+ @Override
+ public void setTaxonBaseWithoutUpdate(TaxonBase taxon) {
+ this.setTaxonBase(taxon);
+ }
@Override
public TaxonBase getTaxonBase() {
Action chooseTaxonAction = new Action("Choose Taxon", IAction.AS_PUSH_BUTTON){
@Override
public void run() {
- Taxon taxon = TaxonBaseSelectionDialog.selectTaxon(getShell(), //getConversationHolder(),
+ Taxon taxon = TaxonBaseSelectionDialog.selectTaxon(getShell(),
getEntity().getFromTaxon());
if(taxon!=null){
taxon = HibernateProxyHelper.deproxy(taxon);
import org.eclipse.swt.SWT;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
*/
public class TaxonWizardPage extends AbstractCdmEntityWizardPage<TaxonBase<?>> {
- public TaxonWizardPage(CdmFormFactory formFactory, ConversationHolder conversation,
- TaxonBase<?> entity) {
- super(formFactory, conversation, entity);
+ public TaxonWizardPage(CdmFormFactory formFactory, TaxonBase<?> entity) {
+ super(formFactory, entity);
setTitle("Taxon");
}
@Override
public void createControls(ICdmFormElement element, int style) {
selection_group = formFactory
- .createSelectionElement(Group.class,//getConversationHolder(),
+ .createSelectionElement(Group.class,
element, "", getEntity(),
EntitySelectionElement.NOTHING, style);
}
/**
- *
- */
+* 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.user;
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.permission.Group;
import eu.etaxonomy.cdm.model.permission.User;
import eu.etaxonomy.taxeditor.ui.dialog.selection.GroupSelectionDialog;
/**
* @author n.hoffmann
- *
*/
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,
+ ICdmFormElement parentElement,
int style) {
- super(formFactory, conversation, parentElement, "Groups", style);
+ super(formFactory, parentElement, "Groups", style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
- */
@Override
public Collection<Group> getCollection(User entity) {
return entity.getGroups();
return new DefaultCdmBaseComparator<>();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
- */
@Override
public Group createNewElement() {
- Group selectedGroup = GroupSelectionDialog.select(getShell(), //getConversationHolder(),
+ Group selectedGroup = GroupSelectionDialog.select(getShell(),
null, getEntity());
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";
}
- /**
- * {@inheritDoc}
- */
@Override
public Group addExisting() {
// TODO Auto-generated method stub
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
// TODO Auto-generated method stub
return false;
}
-
-}
+}
\ No newline at end of file
if (userIsAuthenticated() || CdmStore.getLoginManager().isUserManager() || CdmStore.getLoginManager().isAdmin() ) {
formFactory.createEditPasswordElement(
- formElement, "Change Password", getConversationHolder(),
- entity, style);
+ formElement, "Change Password", entity, style);
}
text_emailAdress = formFactory.createTextWithLabelElement(formElement,
selection_person = formFactory
.createSelectionElement(Person.class,
- //getConversationHolder(),
formElement,
"Person",
entity.getPerson(),
checkbox_credentialsNonExpired.getSelection());
}
}
-}
+
+ @Override
+ public void fillFields() {
+ // TODO implement
+ //text_username;
+ //text_emailAdress;
+ //selection_person;
+ //checkbox_credentialsNonExpired;
+ //checkbox_enabled;
+ //checkbox_accountNonLocked;
+ //checkbox_accountNonExpired;
+
+ }
+}
\ No newline at end of file
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.viewers.ISelectionProvider;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.permission.User;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
public class UserDetailSection extends AbstractCdmDetailSection<User> {
public UserDetailSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement,
+ ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
- super(formFactory, conversation, parentElement, selectionProvider, style);
+ super(formFactory, parentElement, selectionProvider, style);
}
@Override
protected AbstractCdmDetailElement<User> createCdmDetailElement(AbstractCdmDetailSection<User> parentElement, int style) {
return formFactory.createUserDetailElement(parentElement);
}
-}
+}
\ No newline at end of file
*/
package eu.etaxonomy.taxeditor.ui.section.user;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.permission.User;
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
*/
public class UserDetailWizardPage extends AbstractCdmEntityWizardPage<User> {
- public UserDetailWizardPage(CdmFormFactory formFactory,
- ConversationHolder conversation, User entity) {
- super(formFactory, conversation, entity);
+ public UserDetailWizardPage(CdmFormFactory formFactory, User entity) {
+ super(formFactory, entity);
setTitle("User");
}
import java.util.Map;\r
import java.util.Set;\r
\r
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
import org.eclipse.swt.events.SelectionEvent;\r
import org.eclipse.swt.events.SelectionListener;\r
\r
-import eu.etaxonomy.cdm.model.term.DefinedTerm;\r
+import eu.etaxonomy.cdm.model.common.CdmBase;\r
import eu.etaxonomy.cdm.model.common.Language;\r
import eu.etaxonomy.cdm.model.common.LanguageString;\r
import eu.etaxonomy.cdm.model.common.Marker;\r
-import eu.etaxonomy.cdm.model.term.TermType;\r
import eu.etaxonomy.cdm.model.description.CategoricalData;\r
import eu.etaxonomy.cdm.model.description.State;\r
import eu.etaxonomy.cdm.model.description.StateData;\r
+import eu.etaxonomy.cdm.model.term.DefinedTerm;\r
+import eu.etaxonomy.cdm.model.term.TermType;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
import eu.etaxonomy.taxeditor.store.TermStore;\r
import eu.etaxonomy.taxeditor.store.UsageTermCollection;\r
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;\r
\r
-\r
/**\r
* The context manager mediates context start/stop and workbench shutdowns to all registered listeners.\r
*\r
* @author a.theys\r
* @created mar 13, 2012\r
- * @version 1.0\r
*/\r
public class UseRecordDetailElement extends\r
AbstractCdmDetailElement<CategoricalData> implements SelectionListener {\r
\r
@SuppressWarnings("unused")\r
- private static final Logger logger = LogManager.getLogger(UseRecordDetailElement.class);\r
+ private static final Logger logger = LogManager.getLogger();\r
\r
private TermComboElement<State> combo_UseCategory;\r
private TermComboElement<State> combo_UseSubCategory;\r
super(formFactory, formElement);\r
}\r
\r
- /** {@inheritDoc} */\r
@Override\r
protected void createControls(ICdmFormElement formElement,\r
CategoricalData entity, int style) {\r
} else {\r
combo_EthnicGroup.setEnabled(false);\r
}\r
-\r
}\r
\r
/**\r
* Returns the select modifier\r
- * @param comboCategory\r
- * @return\r
*/\r
private DefinedTerm modifierSelection(String comboCategory) {\r
if(!getEntity().getModifiers().isEmpty()) {\r
return null;\r
}\r
return null;\r
-\r
}\r
\r
/**\r
* Returns the selected state\r
- * @param comboCategory\r
- * @return\r
*/\r
private State stateSelection(String comboCategory) {\r
if (!getEntity().getStateData().isEmpty()) {\r
String testString = statedata.getModifyingText().get(CdmStore.getDefaultLanguage()).getText();\r
if(testString.equals(comboCategory)) {\r
if(statedata.getState() !=null) {\r
- return statedata.getState();\r
+ return CdmBase.deproxy(statedata.getState(), State.class);\r
}\r
}\r
}\r
return null;\r
}\r
return null;\r
-\r
}\r
\r
/**\r
* This function sets the combo terms (Besides EthnicGroup\r
- * @param listOfTerms\r
- * @param modType\r
- * @return\r
*/\r
private List<DefinedTerm> setModifierComboTerms(List<DefinedTerm> listOfTerms, String modType) {\r
List<DefinedTerm> termsToAdd = new ArrayList<DefinedTerm>();\r
return termsToAdd;\r
}\r
\r
-\r
/**\r
* This function sets the Use Category combo term\r
- * @param listOfTerms\r
- * @return\r
*/\r
private List<State> setUseCategoryComboTerms(List<State> listOfTerms) {\r
- List<State> termsToAdd = new ArrayList<State>();\r
+ List<State> termsToAdd = new ArrayList<>();\r
for (State term : listOfTerms) {\r
-\r
- if ((term.getPartOf() != null) && (term.getPartOf().getUuid().equals( UsageTermCollection.uuidUseCategoryVocabulary))) {\r
+ if ((term.getPartOf() != null) && (term.getPartOf().getUuid().equals( UsageTermCollection.uuidUseCategoryVocabulary))) {\r
termsToAdd.add(term);\r
}\r
else if ((term.getVocabulary() !=null) && (term.getPartOf() == null) && (term.getVocabulary().getUuid().equals(UsageTermCollection.uuidUseCategoryVocabulary))) {\r
}\r
}\r
return termsToAdd;\r
-\r
}\r
\r
/**\r
* This function sets the Use SubCategory combo term\r
- * @param listOfTerms\r
- * @param selectedUseCategory\r
- * @return\r
*/\r
private List<State> setUseCategoryComboTerms(List<State> listOfTerms,\r
State selectedUseCategory) {\r
- List<State> termsToAdd = new ArrayList<State>();\r
+\r
+ List<State> termsToAdd = new ArrayList<>();\r
if (combo_UseCategory.getSelection() != null) {\r
\r
for (State term : listOfTerms) {\r
}\r
}\r
}\r
-\r
}\r
-\r
else {\r
return null;\r
}\r
\r
/**\r
* This function sets the EthnicGroup combo term\r
- * @param listOfTerms\r
- * @param selectedHumangroup\r
- * @return\r
*/\r
private List<DefinedTerm> setEthnicGroupComboTerms(List<DefinedTerm> listOfTerms,\r
DefinedTerm selectedHumangroup) {\r
return termsToAdd;\r
}\r
\r
-\r
- /** {@inheritDoc} */\r
@Override\r
public void handleEvent(Object eventSource) {\r
if (eventSource == combo_UseCategory) {\r
}\r
}\r
\r
-\r
if (isChanged == false) {\r
StateData stateData = StateData\r
.NewInstance(combo_UseCategory.getSelection());\r
}\r
\r
combo_UseSubCategory.setEnabled(true);\r
-\r
}\r
else {\r
if (!getEntity().getStateData().isEmpty()) {\r
Iterator<StateData> itr = getEntity().getStateData().iterator();\r
while(itr.hasNext()) {\r
- StateData stateToRemove = itr.next();\r
+ itr.next();\r
itr.remove();\r
}\r
- List<State> termsSubCategory = new ArrayList<State>();\r
+ List<State> termsSubCategory = new ArrayList<>();\r
State emptyState = State.NewInstance();\r
termsSubCategory.add(emptyState);\r
combo_UseSubCategory.setTerms(termsSubCategory);\r
stateData.putModifyingText(CdmStore.getDefaultLanguage(), UsageTermCollection.useSubCategoryVocabularyLabel);\r
getEntity().addStateData(stateData);\r
}\r
-\r
} else {\r
if (!getEntity().getStateData().isEmpty()) {\r
Iterator<StateData> itrStateData = getEntity().getStateData().iterator();\r
if(GetVocabularyType(modifier, UsageTermCollection.plantPartLabel)) {\r
itrExistingModifiers.remove();\r
}\r
-\r
}\r
DefinedTerm plantPart = combo_PlantPart.getSelection();\r
getEntity().addModifier(plantPart);\r
}\r
}\r
}\r
-\r
}\r
}\r
if (eventSource == combo_Country) {\r
if(GetVocabularyType(modifier, UsageTermCollection.countryLabel)) {\r
itrExistingModifiers.remove();\r
}\r
-\r
}\r
DefinedTerm country = combo_Country.getSelection();\r
getEntity().addModifier(country);\r
for (DefinedTerm modToCheck: getEntity().getModifiers()) {\r
if(modToCheck.equals(combo_HumanGroup.getSelection()) && (GetVocabularyType(modToCheck, UsageTermCollection.humanGroupLabel))) {\r
isHumanGroupChanged = false;\r
- }\r
-\r
-\r
+ }\r
}\r
Iterator<DefinedTerm> itrExistingModifiers = getEntity().getModifiers().iterator();\r
while (itrExistingModifiers.hasNext()) {\r
if((GetVocabularyType(modifier, UsageTermCollection.humanGroupLabel) || GetVocabularyType(modifier, UsageTermCollection.ethnicGroupLabel)) && isHumanGroupChanged) {\r
itrExistingModifiers.remove();\r
}\r
-\r
}\r
if(isHumanGroupChanged){\r
DefinedTerm humanGroup = combo_HumanGroup.getSelection();\r
// DefinedTerm emptyMod = DefinedTerm.NewInstance();\r
DefinedTerm emptyMod = null;\r
\r
-\r
emptyListToResetComboBox.add(emptyMod);\r
combo_EthnicGroup.setTerms(emptyListToResetComboBox);\r
combo_EthnicGroup.setEnabled(false);\r
-\r
}\r
}\r
if (eventSource == combo_EthnicGroup) {\r
if(GetVocabularyType(modifier, combo_HumanGroup.getSelection().getTitleCache())) {\r
itrExistingModifiers.remove();\r
}\r
-\r
}\r
DefinedTerm ethnicGroup = combo_EthnicGroup.getSelection();\r
getEntity().addModifier(ethnicGroup);\r
itr.remove();\r
}\r
}\r
-\r
}\r
}\r
}\r
}\r
\r
-\r
-\r
/**\r
* This function Checks the vocabulary type\r
- * @param term\r
- * @param vocabularyExpected\r
- * @return\r
*/\r
private boolean GetVocabularyType(DefinedTerm term, String vocabularyExpected) {\r
if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals(vocabularyExpected))) {\r
return false;\r
}\r
\r
-\r
-\r
- /** {@inheritDoc} */\r
@Override\r
public void setEntity(CategoricalData entity) {\r
super.setEntity(entity);\r
}\r
\r
- /** {@inheritDoc} */\r
@Override\r
public void widgetSelected(SelectionEvent e) {\r
Object eventSource = e.getSource();\r
}\r
}\r
}\r
-\r
}\r
}\r
}\r
}\r
\r
- /** {@inheritDoc} */\r
@Override\r
public void widgetDefaultSelected(SelectionEvent e) {\r
// TODO Auto-generated method stub\r
+ }\r
+
\r
+ @Override\r
+ public void fillFields() {\r
+ // TODO \r
+ //combo_UseCategory;\r
+ //combo_UseSubCategory;\r
+ //combo_PlantPart;\r
+ //combo_Country;\r
+ //combo_HumanGroup;\r
+ //combo_EthnicGroup;\r
}\r
\r
-}\r
+}
\r
import org.eclipse.jface.viewers.ISelectionProvider;\r
\r
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
*/\r
public class UseRecordDetailSection extends AbstractCdmDetailSection<DescriptionElementBase> {\r
\r
- /**Constructor for class UseRecordDetailSection\r
- *\r
- * @param cdmFormFactory\r
- * @param conversation\r
- * @param parentElement\r
- * @param selectionProvider\r
- * @param style\r
- */\r
- public UseRecordDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,\r
+ public UseRecordDetailSection(CdmFormFactory cdmFormFactory,\r
ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {\r
- super(cdmFormFactory, conversation, parentElement, selectionProvider, style);\r
+ super(cdmFormFactory, parentElement, selectionProvider, style);\r
}\r
\r
- /** {@inheritDoc} */\r
@Override\r
public String getHeading() {\r
return "Use Record";\r
}\r
\r
- /** {@inheritDoc} */\r
@Override\r
protected void setSectionTitle() {\r
this.setText(getHeading() + ": " + getEntity().getFeature().getLabel(CdmStore.getDefaultLanguage()));\r
setTextClient(createToolbar());\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)\r
- */\r
@Override\r
protected AbstractCdmDetailElement createCdmDetailElement(AbstractCdmDetailSection<DescriptionElementBase> parentElement, int style) {\r
return formFactory.createUseRecordDetailElement(parentElement);\r
}\r
-\r
-}\r
+}
\ No newline at end of file
*/\r
package eu.etaxonomy.taxeditor.ui.section.vocabulary;\r
\r
-import org.eclipse.swt.widgets.Button;\r
-\r
import eu.etaxonomy.cdm.model.common.Language;\r
import eu.etaxonomy.cdm.model.term.Representation;\r
import eu.etaxonomy.cdm.model.term.TermBase;\r
-import eu.etaxonomy.cdm.model.term.TermVocabulary;\r
import eu.etaxonomy.taxeditor.editor.definedterm.TermBasePropertyTester;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
/**\r
* @author l.morris\r
* @date 20 Dec 2011\r
- *\r
*/\r
public abstract class AbstractTermBaseDetailElement<T extends TermBase> extends AbstractCdmDetailElement<T> {\r
\r
- protected UriWithLabelElement uri_uri;\r
- protected RepresentationElement element_Representation;\r
- private Button button;\r
-\r
+ private UriWithLabelElement uri_uri;\r
+ private RepresentationElement element_Representation;\r
\r
public AbstractTermBaseDetailElement(CdmFormFactory formFactory,\r
ICdmFormElement formElement) {\r
getEntity().setTitleCache(null);\r
}\r
}\r
-\r
- public abstract TermVocabulary getVocabulary();\r
-\r
-}\r
+}
\ No newline at end of file
package eu.etaxonomy.taxeditor.ui.section.vocabulary;\r
\r
import org.apache.commons.lang3.StringUtils;\r
-import org.eclipse.swt.widgets.Composite;\r
\r
import eu.etaxonomy.cdm.model.term.DefinedTermBase;\r
-import eu.etaxonomy.cdm.model.term.TermVocabulary;\r
-import eu.etaxonomy.cdm.persistence.permission.TargetEntityStates;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelAndSetNullElement;\r
* @author l.morris\r
* @date 20 Dec 2011\r
*/\r
-public class DefinedTermDetailElement<T extends DefinedTermBase> \r
+public class DefinedTermDetailElement<T extends DefinedTermBase>\r
extends AbstractTermBaseDetailElement<T> {\r
\r
protected TextWithLabelElement textIdInVocabulary;\r
\r
protected TextWithLabelAndSetNullElement textSymbol2;\r
\r
- /**\r
- * @param formFactory\r
- * @param formElement\r
- */\r
public DefinedTermDetailElement(CdmFormFactory formFactory,\r
ICdmFormElement formElement) {\r
super(formFactory, formElement);\r
}\r
textSymbol = formFactory.createTextWithLabelAndSetNullElement(formElement, "Symbol", symbolString, style);\r
textSymbol2 = formFactory.createTextWithLabelAndSetNullElement(formElement, "Symbol 2", symbolString2, style);\r
- };\r
+ }\r
\r
@Override\r
public void handleEvent(Object eventSource) {\r
}else{\r
getEntity().setIdInVocabulary(textIdInVocabulary.getText());\r
}\r
-\r
}\r
+\r
if(eventSource==textSymbol){\r
if (textSymbol.getText().equals("[NULL]")){\r
getEntity().setSymbol(null);\r
getEntity().setSymbol2(null);\r
}else {\r
getEntity().setSymbol2(textSymbol2.getText());\r
- } \r
-\r
+ }\r
}\r
}\r
\r
@Override\r
- public TermVocabulary getVocabulary() {\r
- return getEntity() != null ? getEntity().getVocabulary() : null;\r
+ public void fillFields() {\r
+ // TODO Auto-generated method stub\r
}\r
-\r
-}\r
+}
\ No newline at end of file
\r
import org.eclipse.jface.viewers.ISelectionProvider;\r
\r
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
import eu.etaxonomy.cdm.model.term.DefinedTermBase;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
/**\r
* @author l.morris\r
* @date 4 Jan 2012\r
- *\r
*/\r
public class DefinedTermDetailSection<T extends DefinedTermBase> extends AbstractCdmDetailSection<T> {\r
\r
- /**\r
- * @param formFactory\r
- * @param definedTermClass\r
- * @param conversation\r
- * @param parentElement\r
- * @param selectionProvider\r
- * @param style\r
- */\r
public DefinedTermDetailSection(CdmFormFactory formFactory,\r
- Class<T> definedTermClass, ConversationHolder conversation, ICdmFormElement parentElement,\r
+ Class<T> definedTermClass, ICdmFormElement parentElement,\r
ISelectionProvider selectionProvider, int style) {\r
- super(formFactory, definedTermClass, conversation, parentElement, selectionProvider, style);\r
+ super(formFactory, definedTermClass, parentElement, selectionProvider, style);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading()\r
- */\r
@Override\r
public String getHeading() {\r
/*String result = null;\r
if (result == null){\r
result = getEntity().getTitleCache();\r
} */\r
- \r
+\r
return "Defined Term ";//+ result;\r
}\r
\r
//FIXME clean up create element methods\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElementByType(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, java.lang.Class, int)\r
- */\r
@Override\r
protected AbstractCdmDetailElement createCdmDetailElementByType(AbstractCdmDetailSection<T> parentElement, Class<T> entityClass, int style) {\r
return formFactory.createDefinedTermDetailElement(entityClass, parentElement, style);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)\r
- */\r
@Override\r
protected AbstractCdmDetailElement<T> createCdmDetailElement(AbstractCdmDetailSection<T> parentElement, int style) {\r
return null;\r
}\r
-\r
-}\r
+}
\ No newline at end of file
import eu.etaxonomy.taxeditor.store.StoreUtil;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;\r
+import eu.etaxonomy.taxeditor.ui.element.FloatWithLabelElement;\r
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
import eu.etaxonomy.taxeditor.ui.element.LabelElement;\r
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;\r
/**\r
* @author l.morris\r
* @date 20 Dec 2011\r
- *\r
*/\r
public class FeatureDetailElement extends DefinedTermDetailElement<Feature> {\r
\r
\r
private CheckboxElement supportsTemporalData;\r
\r
- private StateVocabularyCollectionSection sectionStateVocabularies;\r
+ private RecommendedStateCollectionSection sectionStateVocabularies;\r
\r
private MeasurementUnitCollectionSection sectionMeasurementUnits;\r
\r
private StatisticalMeasureCollectionSection sectionStatisticalMeasures;\r
\r
- private RecommendedModifierVocabulariesCollectionSection sectionModifierVocabularies;\r
+ private RecommendedModifierCollectionsCollectionSection sectionModifierVocabularies;\r
private CheckboxElement availableForTaxon;\r
private CheckboxElement availableForTaxonName;\r
private CheckboxElement availableForSpecimenOrObservation;\r
\r
- /**\r
- * @param formFactory\r
- * @param formElement\r
- */\r
+ private FloatWithLabelElement maxPerDataset;\r
+ private FloatWithLabelElement maxStates;\r
+\r
public FeatureDetailElement(CdmFormFactory formFactory,\r
ICdmFormElement formElement) {\r
super(formFactory, formElement);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.ui.section.vocabulary.AbstractTermBaseDetailElement#createControls(eu.etaxonomy.taxeditor.ui.element.ICdmFormElement, eu.etaxonomy.cdm.model.term.TermBase, int)\r
- */\r
@Override\r
protected void createControls(ICdmFormElement formElement, Feature entity, int style) {\r
super.createControls(formElement, entity, style);\r
this.parentFormElement = formElement;\r
+ //Layout\r
+\r
LabelElement supportsLabel = formFactory.createLabel(formElement, "Supports");\r
supportsLabel.setBold();\r
supportsTextData = formFactory.createCheckbox(formElement, "Text Data", entity.isSupportsTextData(), style);\r
supportsCommonTaxonName = formFactory.createCheckbox(formElement, "Common Taxon Name", entity.isSupportsCommonTaxonName(), style);\r
supportsTemporalData = formFactory.createCheckbox(formElement, "Temporal Data", entity.isSupportsTemporalData(), style);\r
\r
+ //categorical data\r
if (supportsCategoricalData.getSelection()) {\r
- sectionStateVocabularies = formFactory.createStateVocabulariesSection(getConversationHolder(),\r
- parentFormElement, StoreUtil.getSectionStyle(StateVocabularyCollectionSection.class, getEntity().getClass().getCanonicalName()));\r
+ maxStates = formFactory.createFloatTextWithLabelElement(formElement, "Max n states", entity.getMaxStates(), style);\r
+ sectionStateVocabularies = formFactory.createStateVocabulariesSection(\r
+ parentFormElement, StoreUtil.getSectionStyle(RecommendedStateCollectionSection.class, getEntity().getClass().getCanonicalName()));\r
sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
sectionStateVocabularies.setEntity(getEntity());\r
-\r
}\r
+\r
+ //quantitative data\r
if (supportsQuantitativeData.getSelection()) {\r
- sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(getConversationHolder(),\r
+ sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(\r
parentFormElement, StoreUtil.getSectionStyle(MeasurementUnitCollectionSection.class, getEntity().getClass().getCanonicalName()));\r
sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
sectionMeasurementUnits.setEntity(getEntity());\r
\r
- sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection(getConversationHolder(),\r
+ sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection(\r
parentFormElement, StoreUtil.getSectionStyle(StatisticalMeasureCollectionSection.class, getEntity().getClass().getCanonicalName()));\r
sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
sectionStatisticalMeasures.setEntity(getEntity());\r
}\r
+\r
+ //both\r
if (supportsCategoricalData.getSelection() || supportsQuantitativeData.getSelection()) {\r
sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(\r
- getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierVocabulariesCollectionSection.class, getEntity().getClass().getCanonicalName()));\r
+ parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierCollectionsCollectionSection.class, getEntity().getClass().getCanonicalName()));\r
sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
sectionModifierVocabularies.setEntity(getEntity());\r
}\r
TableWrapData data = LayoutConstants.FILL_HORIZONTALLY(2, 1);\r
data.maxHeight = 3;\r
noLabel.setLayout(data);\r
+\r
LabelElement availableLabel = formFactory.createLabel(formElement, "Available for");\r
availableLabel.setBold();\r
\r
availableForTaxon = formFactory.createCheckbox(formElement, "Taxon", entity.isAvailableForTaxon(), style);\r
availableForTaxonName = formFactory.createCheckbox(formElement, "Taxon Name", entity.isAvailableForTaxonName(), style);\r
availableForSpecimenOrObservation = formFactory.createCheckbox(formElement, "Occurrence", entity.isAvailableForOccurrence(), style);\r
+ LabelElement noLabel2 = formFactory.createLabel(formElement, "");\r
+ data = LayoutConstants.FILL_HORIZONTALLY(2, 1);\r
+ data.maxHeight = 3;\r
+ noLabel2.setLayout(data);\r
+ maxPerDataset = formFactory.createFloatTextWithLabelElement(formElement, "Max n per dataset", entity.getMaxPerDataset(), style);\r
+ //maxPerDataset.setTextLimit(1);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailElement#handleEvent(java.lang.Object)\r
- */\r
@Override\r
public void handleEvent(Object eventSource) {\r
super.handleEvent(eventSource);\r
}\r
else if(eventSource == availableForSpecimenOrObservation){\r
getEntity().setAvailableForOccurrence(availableForSpecimenOrObservation.getSelection());\r
- \r
}\r
else if(eventSource == availableForTaxon){\r
getEntity().setAvailableForTaxon(availableForTaxon.getSelection());\r
- \r
}\r
else if(eventSource == availableForTaxonName){\r
getEntity().setAvailableForTaxonName(availableForTaxonName.getSelection());\r
- \r
}\r
-\r
+ else if(eventSource == maxPerDataset){\r
+ getEntity().setMaxPerDataset(maxPerDataset.getInteger());\r
+ }\r
+ else if(eventSource == maxStates){\r
+ getEntity().setMaxStates(maxStates.getInteger());\r
+ }\r
StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);\r
}\r
\r
removeCategoricalWidgets();\r
\r
//measurement units\r
- sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(getConversationHolder(),\r
- parentFormElement, StoreUtil.getSectionStyle(MeasurementUnitCollectionSection.class, getEntity().getClass().getCanonicalName()));\r
+ sectionMeasurementUnits = formFactory.createMeasurementUnitCollectionSection(parentFormElement,\r
+ StoreUtil.getSectionStyle(MeasurementUnitCollectionSection.class, getEntity().getClass().getCanonicalName()));\r
sectionMeasurementUnits.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
sectionMeasurementUnits.setEntity(getEntity());\r
\r
//statistical measures\r
sectionStatisticalMeasures = formFactory.createStatisticalMeasureCollectionSection(\r
- getConversationHolder(), parentFormElement,StoreUtil.getSectionStyle(StatisticalMeasureCollectionSection.class, getEntity().getClass().getCanonicalName()));\r
+ parentFormElement,StoreUtil.getSectionStyle(StatisticalMeasureCollectionSection.class, getEntity().getClass().getCanonicalName()));\r
sectionStatisticalMeasures.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
sectionStatisticalMeasures.setEntity(getEntity());\r
\r
//modifiers\r
sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(\r
- getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierVocabulariesCollectionSection.class, getEntity().getClass().getCanonicalName()));\r
+ parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierCollectionsCollectionSection.class, getEntity().getClass().getCanonicalName()));\r
sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
sectionModifierVocabularies.setEntity(getEntity());\r
}\r
getEntity().setSupportsQuantitativeData(false);\r
removeQuantitativeWidgets();\r
\r
+ maxStates = formFactory.createFloatTextWithLabelElement(parentFormElement, "Max n states", getEntity().getMaxStates(), StoreUtil.getSectionStyle(RecommendedStateCollectionSection.class, getEntity().getClass().getCanonicalName()));\r
//states\r
- sectionStateVocabularies = formFactory.createStateVocabulariesSection(getConversationHolder(),\r
- parentFormElement, StoreUtil.getSectionStyle(StateVocabularyCollectionSection.class, getEntity().getClass().getCanonicalName()));\r
+ sectionStateVocabularies = formFactory.createStateVocabulariesSection(\r
+ parentFormElement, StoreUtil.getSectionStyle(RecommendedStateCollectionSection.class, getEntity().getClass().getCanonicalName()), getEntity().getMaxStates());\r
sectionStateVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
sectionStateVocabularies.setEntity(getEntity());\r
\r
+\r
//modifiers\r
sectionModifierVocabularies = formFactory.createRecommendedModifierVocabulariesCollectionSection(\r
- getConversationHolder(), parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierVocabulariesCollectionSection.class, getEntity().getClass().getCanonicalName()));\r
+ parentFormElement, StoreUtil.getSectionStyle(RecommendedModifierCollectionsCollectionSection.class, getEntity().getClass().getCanonicalName()));\r
sectionModifierVocabularies.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));\r
sectionModifierVocabularies.setEntity(getEntity());\r
}\r
\r
private void removeCategoricalWidgets(){\r
if(sectionStateVocabularies!=null){\r
+ removeElementsAndControls(maxStates);\r
removeElementsAndControls(sectionStateVocabularies);\r
removeElementsAndControls(sectionModifierVocabularies);\r
}\r
}\r
-\r
-}\r
+}
\ No newline at end of file
import org.apache.commons.lang3.StringUtils;
import eu.etaxonomy.cdm.model.common.Language;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
*/
public class LanguageDetailElement extends AbstractTermBaseDetailElement<Language> {
- protected TextWithLabelElement textIdInVocabulary;
+ private TextWithLabelElement textIdInVocabulary;
- protected TextWithLabelElement textISO_639_1;
+ private TextWithLabelElement textISO_639_1;
- protected TextWithLabelElement textSymbol;
+ private TextWithLabelElement textSymbol;
- protected TextWithLabelElement textSymbol2;
+ private TextWithLabelElement textSymbol2;
-
- /**
- * @param formFactory
- * @param formElement
- */
public LanguageDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
super(formFactory, formElement);
-
}
@Override
textISO_639_1 = formFactory.createTextWithLabelElement(formElement, "ID in ISO 639-1", entity.getIdInVocabulary(), style);
textSymbol = formFactory.createTextWithLabelElement(formElement, "Symbol", entity.getSymbol(), style);
textSymbol2 = formFactory.createTextWithLabelElement(formElement, "Symbol 2", entity.getSymbol2(), style);
- };
+ }
@Override
public void handleEvent(Object eventSource) {
}else{
getEntity().setIdInVocabulary(textIdInVocabulary.getText());
}
-
}
+
if(eventSource==textSymbol){
if (StringUtils.isBlank(textSymbol.getText())){
getEntity().setSymbol(null);
}else{
getEntity().setSymbol(textSymbol.getText());
}
-
}
if(eventSource==textSymbol2){
}else{
getEntity().setSymbol2(textSymbol2.getText());
}
-
}
+
if (eventSource == textISO_639_1){
if (StringUtils.isBlank(textISO_639_1.getText())){
getEntity().setIso639_1(null);
}
}
- @Override
- public TermVocabulary getVocabulary() {
- return getEntity() != null ? getEntity().getVocabulary() : null;
- }
-
-
-}
+ @Override
+ public void fillFields() {
+ // TODO Auto-generated method stub
+ }
+}
\ No newline at end of file
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.MeasurementUnit;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
/**
* @author pplitzner
* @date Apr 27, 2015
- *
*/
public class MeasurementUnitCollectionSection extends AbstractUnboundEntityCollectionSection<Feature, MeasurementUnit> {
public MeasurementUnitCollectionSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Recommended measurement units", style);
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Recommended measurement units", style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
- */
- /** {@inheritDoc} */
@Override
protected Collection<MeasurementUnit> getEntityCollection(Feature entity) {
return entity.getRecommendedMeasurementUnits();
return new DefaultCdmBaseComparator<>();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
- */
- /** {@inheritDoc} */
@Override
public MeasurementUnit createNewElement() {
return MeasurementUnit.NewInstance();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void addElement(MeasurementUnit element) {
//never gets called
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void removeElement(MeasurementUnit element) {
getEntity().removeRecommendedMeasurementUnit(element);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No recommended measurement units yet.";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a measurement unit";
}
- /**
- * {@inheritDoc}
- */
@Override
public MeasurementUnit addExisting() {
// TODO Auto-generated method stub
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
// TODO Auto-generated method stub
return false;
}
-
-}
+}
\ No newline at end of file
import java.util.Comparator;
import java.util.HashSet;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.MeasurementUnit;
import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
/**
* @author pplitzner
* @date Apr 27, 2015
- *
*/
public class MeasurementUnitDtoCollectionSection extends AbstractUnboundEntityCollectionSection<FeatureDto, TermDto> {
public MeasurementUnitDtoCollectionSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Recommended measurement units", style);
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Recommended measurement units", style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
- */
- /** {@inheritDoc} */
@Override
protected Collection<TermDto> getEntityCollection(FeatureDto entity) {
if (entity.getRecommendedMeasurementUnits() == null){
};
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
- */
- /** {@inheritDoc} */
@Override
public TermDto createNewElement() {
return TermDto.fromTerm(MeasurementUnit.NewInstance());
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void addElement(TermDto element) {
//never gets called
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void removeElement(TermDto element) {
if (element == null){
getEntity().getRecommendedMeasurementUnits().remove(remove);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No recommended measurement units yet.";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a measurement unit";
}
- /**
- * {@inheritDoc}
- */
@Override
public TermDto addExisting() {
// TODO Auto-generated method stub
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
// TODO Auto-generated method stub
return false;
}
-
-}
+}
\ No newline at end of file
*/\r
package eu.etaxonomy.taxeditor.ui.section.vocabulary;\r
\r
-import eu.etaxonomy.cdm.model.term.TermType;\r
import eu.etaxonomy.cdm.model.location.NamedArea;\r
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;\r
import eu.etaxonomy.cdm.model.location.NamedAreaType;\r
+import eu.etaxonomy.cdm.model.term.TermType;\r
import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
/**\r
* @author l.morris\r
* @date 20 Dec 2011\r
- *\r
*/\r
public class NamedAreaDetailElement extends DefinedTermDetailElement<NamedArea> {\r
\r
// validPeriod\r
private TimePeriodElement timePeriod_validPeriod;\r
\r
- /**\r
- * @param formFactory\r
- * @param formElement\r
- */\r
public NamedAreaDetailElement(CdmFormFactory formFactory,\r
ICdmFormElement formElement) {\r
super(formFactory, formElement);\r
timePeriod_validPeriod = formFactory.createTimePeriodElement(formElement, "Valid Period", getEntity().getValidPeriod(), style);\r
combo_namedAreaType = formFactory.createDefinedTermComboElement(TermType.NamedAreaType, formElement, "Named Area Type", getEntity().getType(), style);\r
combo_namedAreaLevel = formFactory.createDefinedTermComboElement(TermType.NamedAreaLevel, formElement, "Named Area Level", getEntity().getLevel(), style);\r
-\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)\r
- */\r
@Override\r
public void handleEvent(Object eventSource) {\r
super.handleEvent(eventSource);\r
} else if (eventSource == combo_namedAreaLevel) {\r
getEntity().setLevel(combo_namedAreaLevel.getSelection());\r
}\r
-\r
-\r
}\r
-\r
-\r
-}\r
+}
\ No newline at end of file
\r
import org.eclipse.jface.viewers.ISelectionProvider;\r
\r
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
import eu.etaxonomy.cdm.model.location.NamedArea;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
/**\r
* @author l.morris\r
* @date 20 Dec 2011\r
- *\r
*/\r
public class NamedAreaDetailSection extends AbstractCdmDetailSection<NamedArea> {\r
\r
- /**\r
- * @param formFactory\r
- * @param conversation\r
- * @param parentElement\r
- * @param selectionProvider\r
- * @param style\r
- */\r
public NamedAreaDetailSection(CdmFormFactory formFactory,\r
- ConversationHolder conversation, ICdmFormElement parentElement,\r
+ ICdmFormElement parentElement,\r
ISelectionProvider selectionProvider, int style) {\r
- super(formFactory, conversation, parentElement, selectionProvider, style);\r
-\r
+ super(formFactory, parentElement, selectionProvider, style);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading()\r
- */\r
@Override\r
public String getHeading() {\r
-\r
return "Defined Term: "+ (getEntity() != null ? getEntity().getLabel() : "");\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)\r
- */\r
@Override\r
protected AbstractCdmDetailElement<NamedArea> createCdmDetailElement(AbstractCdmDetailSection<NamedArea> parentElement, int style) {\r
return formFactory.createNamedAreaDetailElement(parentElement);\r
}\r
-\r
-}\r
+}
\ No newline at end of file
\r
import org.eclipse.jface.viewers.ISelectionProvider;\r
\r
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
/**\r
* @author l.morris\r
* @date 4 Jan 2012\r
- *\r
*/\r
public class NamedAreaLevelDetailSection extends AbstractCdmDetailSection<NamedAreaLevel> {\r
\r
- /**\r
- * @param formFactory\r
- * @param parentElement\r
- * @param style\r
- */\r
public NamedAreaLevelDetailSection(CdmFormFactory formFactory,\r
- ConversationHolder conversation, ICdmFormElement parentElement,\r
+ ICdmFormElement parentElement,\r
ISelectionProvider selectionProvider, int style) {\r
- super(formFactory, conversation, parentElement, selectionProvider, style);\r
+ super(formFactory, parentElement, selectionProvider, style);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading()\r
- */\r
@Override\r
public String getHeading() {\r
return "Defined Term: "+ (getEntity() != null ? getEntity().getLabel() : "");\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)\r
- */\r
@Override\r
protected AbstractCdmDetailElement<NamedAreaLevel> createCdmDetailElement(AbstractCdmDetailSection<NamedAreaLevel> parentElement, int style) {\r
return formFactory.createNamedAreaLevelElement(parentElement);\r
import org.eclipse.ui.forms.widgets.TableWrapData;
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.ImageResources;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
/**
- *
* @author pplitzner
* @date Nov 24, 2016
- *
*/
public class PresenceAbsenceTermDetailElement extends DefinedTermDetailElement<PresenceAbsenceTerm> implements SelectionListener{
private Button btnColorChooser;
- private Label isAbsentLabel;
-
private Button btnIsAbsent;
public PresenceAbsenceTermDetailElement(CdmFormFactory formFactory,
super.handleEvent(eventSource);
}
- @Override
- public TermVocabulary getVocabulary() {
- return getEntity() != null ? getEntity().getVocabulary() : null;
- }
-
- /**
- * {@inheritDoc}
- */
@Override
public void widgetSelected(SelectionEvent e) {
if (e.getSource().equals(btnColorChooser)){
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
}
- /**
- * {@inheritDoc}
- */
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
-
-}
+}
\ No newline at end of file
--- /dev/null
+/**
+* Copyright (C) 2015 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.vocabulary;
+
+import java.util.Collection;
+import java.util.Comparator;
+
+import eu.etaxonomy.cdm.model.description.Feature;
+import eu.etaxonomy.cdm.model.term.DefinedTerm;
+import eu.etaxonomy.cdm.model.term.TermCollection;
+import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.model.term.TermVocabulary;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
+
+/**
+ * @author pplitzner
+ * @date Apr 27, 2015
+ */
+public class RecommendedModifierCollectionsCollectionSection
+ extends AbstractUnboundEntityCollectionSection<Feature, TermCollection<DefinedTerm,?>> {
+
+ public RecommendedModifierCollectionsCollectionSection(CdmFormFactory formFactory,
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Recommended modifier collections", style);
+ }
+
+ @Override
+ protected Collection<TermCollection<DefinedTerm,?>> getEntityCollection(Feature entity) {
+ return entity.getRecommendedModifierEnumeration();
+ }
+
+ @Override
+ public Comparator<TermCollection<DefinedTerm,?>> getComparator() {
+ return new DefaultCdmBaseComparator<>();
+ }
+
+ @Override
+ public TermVocabulary<DefinedTerm> createNewElement() {
+ return TermVocabulary.NewInstance(TermType.Modifier);
+ }
+
+ @Override
+ public void addElement(TermCollection<DefinedTerm,?> element) {
+ //never gets called
+ }
+
+ @Override
+ public void removeElement(TermCollection<DefinedTerm,?> element) {
+ getEntity().removeRecommendedModifierEnumeration(element);
+ }
+
+ @Override
+ public String getEmptyString() {
+ return "No modifier collection yet.";
+ }
+
+ @Override
+ protected String getTooltipString() {
+ return "Add a modifier collection";
+ }
+
+ @Override
+ public TermCollection<DefinedTerm,?> addExisting() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean allowAddExisting() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+}
\ No newline at end of file
--- /dev/null
+/**
+* Copyright (C) 2015 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.vocabulary;
+
+import java.util.Collection;
+import java.util.Comparator;
+
+import eu.etaxonomy.cdm.model.term.DefinedTerm;
+import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.model.term.TermVocabulary;
+import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
+import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
+
+/**
+ * @author pplitzner
+ * @date Apr 27, 2015
+ */
+public class RecommendedModifierCollectionsDtoCollectionSection extends AbstractUnboundEntityCollectionSection<FeatureDto, TermCollectionDto> {
+
+ public RecommendedModifierCollectionsDtoCollectionSection(CdmFormFactory formFactory,
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Recommended modifier collections", style);
+ }
+
+ @Override
+ protected Collection<TermCollectionDto> getEntityCollection(FeatureDto entity) {
+ return entity.getRecommendedModifierEnumeration();
+ }
+
+ @Override
+ public Comparator<TermCollectionDto> getComparator() {
+ return new Comparator<TermCollectionDto>() {
+ @Override
+ public int compare(TermCollectionDto o1, TermCollectionDto o2) {
+ if(o1==null){
+ return -1;
+ }
+ if(o2==null){
+ return 1;
+ }
+ int diff = o1.getTitleCache().compareTo(o2.getTitleCache());
+ if(diff==0){
+ diff = o1.getUuid().compareTo(o2.getUuid());
+ }
+ return diff;
+ }
+ };
+ }
+
+ //TODO should not be implemented here as we do not want to create vocabularies/term collections here
+ @Override
+ public TermCollectionDto createNewElement() {
+ TermVocabulary<DefinedTerm> voc = TermVocabulary.NewInstance(TermType.Modifier);
+ return new TermVocabularyDto(voc.getUuid(), voc.getRepresentations(), voc.getTermType(), voc.getTitleCache(), voc.isAllowDuplicates(), voc.isOrderRelevant(), voc.isFlat());
+ }
+
+ @Override
+ public void addElement(TermCollectionDto element) {
+ //never gets called
+ }
+
+ @Override
+ public void removeElement(TermCollectionDto element) {
+ if (element == null){
+ return;
+ }
+ TermCollectionDto remove = null;
+ for (TermCollectionDto voc: getEntity().getRecommendedModifierEnumeration()) {
+ if (voc.getUuid().equals(element.getUuid())){
+ remove = voc;
+ break;
+ }
+ }
+
+ getEntity().getRecommendedModifierEnumeration().remove(remove);
+ }
+
+ @Override
+ public String getEmptyString() {
+ return "No modifiers collections yet.";
+ }
+
+ @Override
+ protected String getTooltipString() {
+ return "Add a modifier collection";
+ }
+
+ @Override
+ public TermCollectionDto addExisting() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean allowAddExisting() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+}
\ No newline at end of file
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
+import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.term.DefinedTerm;
+import eu.etaxonomy.cdm.model.term.TermCollection;
import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
-import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.taxeditor.ui.combo.VocabularyComboElement;
+import eu.etaxonomy.taxeditor.ui.combo.TermCollectionComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author pplitzner
* @date Apr 27, 2015
- *
*/
-public class RecommendedModifierVocabulariesElement extends AbstractEntityCollectionElement<TermVocabulary<DefinedTerm>> {
-
+public class RecommendedModifierCollectionsElement extends AbstractEntityCollectionElement<TermCollection<DefinedTerm,?>> {
- private VocabularyComboElement<DefinedTerm, TermVocabulary<DefinedTerm>> comboStateVocabulary;
+ private TermCollectionComboElement<DefinedTerm, TermCollection<DefinedTerm,?>> comboStateTermCollection;
- /**
- * @param formFactory
- * @param section
- * @param entity
- * @param removeListener
- * @param isChoosableEntity
- * @param backgroundColor
- * @param style
- */
- public RecommendedModifierVocabulariesElement(CdmFormFactory formFactory, AbstractFormSection section, TermVocabulary<DefinedTerm> entity,
+ public RecommendedModifierCollectionsElement(CdmFormFactory formFactory, AbstractFormSection section, TermCollection<DefinedTerm,?> entity,
SelectionListener removeListener, Color backgroundColor, int style) {
super(formFactory, section, entity, removeListener, backgroundColor, style);
-
}
@Override
public void createControls(ICdmFormElement element, int style) {
- comboStateVocabulary = formFactory.createVocabularyComboElement(TermType.Modifier, "Modifier Vocabulary", null, element, style);
+ comboStateTermCollection = formFactory.createTermCollectionComboElement(TermType.Modifier, "Modifier Term Collections", null, element, style);
if (entity != null){
setEntity(entity);
}
}
@Override
- public void setEntity(TermVocabulary<DefinedTerm> entity) {
+ public void setEntity(TermCollection<DefinedTerm,?> entity) {
this.entity = entity;
- if(entity.getId()!=0 && comboStateVocabulary != null){
- comboStateVocabulary.setSelection(entity);
- comboStateVocabulary.removeEmptyElement();
+ if(entity.getId()!=0 && comboStateTermCollection != null){
+ comboStateTermCollection.setSelection(entity);
+ comboStateTermCollection.removeEmptyElement();
}
}
@Override
public void handleEvent(Object eventSource) {
- if(eventSource==comboStateVocabulary && comboStateVocabulary.getSelection()!=null){
- if(getParentElement() instanceof RecommendedModifierVocabulariesCollectionSection){
- RecommendedModifierVocabulariesCollectionSection parentElement = (RecommendedModifierVocabulariesCollectionSection) getParentElement();
+ if(eventSource==comboStateTermCollection && comboStateTermCollection.getSelection()!=null){
+ if(getParentElement() instanceof RecommendedModifierCollectionsCollectionSection){
+ RecommendedModifierCollectionsCollectionSection parentElement = (RecommendedModifierCollectionsCollectionSection) getParentElement();
Feature feature = parentElement.getEntity();
feature.removeRecommendedModifierEnumeration(entity);
- TermVocabulary<DefinedTerm> vocabulary = comboStateVocabulary.getSelection();
- feature.addRecommendedModifierEnumeration(vocabulary);
- entity = vocabulary;
+ TermCollection<DefinedTerm,?> termCollection = comboStateTermCollection.getSelection();
+ feature.addRecommendedModifierEnumeration(termCollection);
+ entity = termCollection;
//update the parent section to re-set the listeners to the persisted measurement unit
parentElement.removeElementAndUpdate(null);
}
}
}
-
-}
+}
\ No newline at end of file
import org.eclipse.swt.graphics.Color;
import eu.etaxonomy.cdm.model.term.DefinedTerm;
+import eu.etaxonomy.cdm.model.term.TermCollection;
import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
-import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
-import eu.etaxonomy.taxeditor.ui.combo.VocabularyComboElement;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
+import eu.etaxonomy.taxeditor.ui.combo.TermCollectionComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author pplitzner
* @date Apr 27, 2015
- *
*/
-public class RecommendedModifierDtoVocabulariesElement extends AbstractEntityCollectionElement<TermVocabularyDto> {
+public class RecommendedModifierDtoCollectionsElement extends AbstractEntityCollectionElement<TermCollectionDto> {
+ private TermCollectionComboElement<DefinedTerm, TermCollection<DefinedTerm,?>> comboStateTermCollection;
- private VocabularyComboElement<DefinedTerm, TermVocabulary<DefinedTerm>> comboStateVocabulary;
-
- /**
- * @param formFactory
- * @param section
- * @param entity
- * @param removeListener
- * @param isChoosableEntity
- * @param backgroundColor
- * @param style
- */
- public RecommendedModifierDtoVocabulariesElement(CdmFormFactory formFactory, AbstractFormSection section, TermVocabularyDto entity,
+ public RecommendedModifierDtoCollectionsElement(CdmFormFactory formFactory, AbstractFormSection section, TermCollectionDto entity,
SelectionListener removeListener, Color backgroundColor, int style) {
super(formFactory, section, entity, removeListener, backgroundColor, style);
-
}
@Override
public void createControls(ICdmFormElement element, int style) {
- comboStateVocabulary = formFactory.createVocabularyComboElement(TermType.Modifier, "Modifier Vocabulary", null, element, style);
+ comboStateTermCollection = formFactory.createTermCollectionComboElement(TermType.Modifier, "Modifier collection", null, element, style);
if (entity != null){
setEntity(entity);
}
}
@Override
- public void setEntity(TermVocabularyDto entity) {
+ public void setEntity(TermCollectionDto entity) {
this.entity = entity;
- if(comboStateVocabulary != null){
- comboStateVocabulary.setSelectionDto(entity);
- comboStateVocabulary.removeEmptyElement();
+ if(comboStateTermCollection != null){
+ comboStateTermCollection.setSelectionDto(entity);
+ comboStateTermCollection.removeEmptyElement();
}
}
@Override
public void handleEvent(Object eventSource) {
- if(eventSource==comboStateVocabulary && comboStateVocabulary.getSelection()!=null){
- if(getParentElement() instanceof RecommendedModifierVocabulariesDtoCollectionSection){
- RecommendedModifierVocabulariesDtoCollectionSection parentElement = (RecommendedModifierVocabulariesDtoCollectionSection) getParentElement();
+ if(eventSource==comboStateTermCollection && comboStateTermCollection.getSelection()!=null){
+ if(getParentElement() instanceof RecommendedModifierCollectionsDtoCollectionSection){
+ RecommendedModifierCollectionsDtoCollectionSection parentElement = (RecommendedModifierCollectionsDtoCollectionSection) getParentElement();
FeatureDto feature = parentElement.getEntity();
- TermVocabularyDto remove = null;
- for (TermVocabularyDto voc: feature.getRecommendedModifierEnumeration()){
+ TermCollectionDto remove = null;
+ for (TermCollectionDto voc: feature.getRecommendedModifierEnumeration()){
if (voc.getUuid().equals(getEntity().getUuid())){
remove = voc;
break;
}
}
feature.getRecommendedModifierEnumeration().remove(remove);
- TermVocabulary<DefinedTerm> vocabulary = comboStateVocabulary.getSelection();
- entity = TermVocabularyDto.fromVocabulary(vocabulary);
+ TermCollection<DefinedTerm,?> termCollection = comboStateTermCollection.getSelection();
+ entity = TermCollectionDto.fromCdmBase(termCollection);
feature.getRecommendedModifierEnumeration().add(entity);
//update the parent section to re-set the listeners to the persisted measurement unit
// parentElement.removeElementAndUpdate(null);
+++ /dev/null
-/**
-* Copyright (C) 2015 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.vocabulary;
-
-import java.util.Collection;
-import java.util.Comparator;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.model.term.DefinedTerm;
-import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
-import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
-
-/**
- * @author pplitzner
- * @date Apr 27, 2015
- *
- */
-public class RecommendedModifierVocabulariesCollectionSection extends AbstractUnboundEntityCollectionSection<Feature, TermVocabulary<DefinedTerm>> {
-
- public RecommendedModifierVocabulariesCollectionSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Recommended modifier vocabularies", style);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
- */
- /** {@inheritDoc} */
- @Override
- protected Collection<TermVocabulary<DefinedTerm>> getEntityCollection(Feature entity) {
- return entity.getRecommendedModifierEnumeration();
- }
-
- @Override
- public Comparator<TermVocabulary<DefinedTerm>> getComparator() {
- return new DefaultCdmBaseComparator<>();
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
- */
- /** {@inheritDoc} */
- @Override
- public TermVocabulary<DefinedTerm> createNewElement() {
- return TermVocabulary.NewInstance(TermType.Modifier);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
- @Override
- public void addElement(TermVocabulary<DefinedTerm> element) {
- //never gets called
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
- @Override
- public void removeElement(TermVocabulary<DefinedTerm> element) {
- getEntity().removeRecommendedModifierEnumeration(element);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
- /** {@inheritDoc} */
- @Override
- public String getEmptyString() {
- return "No modifiers vocabularies yet.";
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
- /** {@inheritDoc} */
- @Override
- protected String getTooltipString() {
- return "Add a modifier vocabulary";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public TermVocabulary<DefinedTerm> addExisting() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean allowAddExisting() {
- // TODO Auto-generated method stub
- return false;
- }
-
-
-}
+++ /dev/null
-/**
-* Copyright (C) 2015 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.vocabulary;
-
-import java.util.Collection;
-import java.util.Comparator;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.model.description.State;
-import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
-import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
-import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
-
-/**
- * @author pplitzner
- * @date Apr 27, 2015
- *
- */
-public class RecommendedModifierVocabulariesDtoCollectionSection extends AbstractUnboundEntityCollectionSection<FeatureDto, TermVocabularyDto> {
-
- public RecommendedModifierVocabulariesDtoCollectionSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Recommended modifier vocabularies", style);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
- */
- /** {@inheritDoc} */
- @Override
- protected Collection<TermVocabularyDto> getEntityCollection(FeatureDto entity) {
- return entity.getRecommendedModifierEnumeration();
- }
-
- @Override
- public Comparator<TermVocabularyDto> getComparator() {
- return new Comparator<TermVocabularyDto>() {
- @Override
- public int compare(TermVocabularyDto o1, TermVocabularyDto o2) {
- if(o1==null){
- return -1;
- }
- if(o2==null){
- return 1;
- }
- int diff = o1.getTitleCache().compareTo(o2.getTitleCache());
- if(diff==0){
- diff = o1.getUuid().compareTo(o2.getUuid());
- }
- return diff;
- }
- };
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
- */
- /** {@inheritDoc} */
- @Override
- public TermVocabularyDto createNewElement() {
- TermVocabulary<State> voc = TermVocabulary.NewInstance(TermType.Modifier);
- return new TermVocabularyDto(voc.getUuid(), voc.getRepresentations(), voc.getTermType(), voc.getTitleCache(), voc.isAllowDuplicates(), voc.isOrderRelevant(), voc.isFlat());
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
- @Override
- public void addElement(TermVocabularyDto element) {
- //never gets called
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
- @Override
- public void removeElement(TermVocabularyDto element) {
- if (element == null){
- return;
- }
- TermVocabularyDto remove = null;
- for (TermVocabularyDto voc: getEntity().getSupportedCategoricalEnumerations()){
- if (voc.getUuid().equals(element.getUuid())){
- remove = voc;
- break;
- }
- }
- getEntity().getSupportedCategoricalEnumerations().remove(remove);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
- /** {@inheritDoc} */
- @Override
- public String getEmptyString() {
- return "No modifiers vocabularies yet.";
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
- /** {@inheritDoc} */
- @Override
- protected String getTooltipString() {
- return "Add a modifier vocabulary";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public TermVocabularyDto addExisting() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean allowAddExisting() {
- // TODO Auto-generated method stub
- return false;
- }
-
-
-
-}
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
-import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.cdm.model.description.State;
-import eu.etaxonomy.taxeditor.ui.combo.VocabularyComboElement;
+import eu.etaxonomy.cdm.model.term.DefinedTermBase;
+import eu.etaxonomy.cdm.model.term.TermCollection;
+import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.taxeditor.ui.combo.TermCollectionComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author pplitzner
* @date Apr 27, 2015
- *
*/
-public class StateVocabularyCollectionElement extends AbstractEntityCollectionElement<TermVocabulary<State>> {
-
+public class RecommendedStateCollectionElement<T extends DefinedTermBase<T>>
+ extends AbstractEntityCollectionElement<TermCollection<T,?>> {
- private VocabularyComboElement<State, TermVocabulary<State>> comboStateVocabulary;
+ private TermCollectionComboElement<T, TermCollection<T,?>> comboStateCollection;
- /**
- * @param formFactory
- * @param section
- * @param entity
- * @param removeListener
- * @param isChoosableEntity
- * @param backgroundColor
- * @param style
- */
- public StateVocabularyCollectionElement(CdmFormFactory formFactory, AbstractFormSection section, TermVocabulary<State> entity,
+ public RecommendedStateCollectionElement(CdmFormFactory formFactory, AbstractFormSection<T> section, TermCollection<T,?> entity,
SelectionListener removeListener, Color backgroundColor, int style) {
super(formFactory, section, entity, removeListener, backgroundColor, style);
-
}
@Override
public void createControls(ICdmFormElement element, int style) {
- comboStateVocabulary = formFactory.createVocabularyComboElement(TermType.State, "State vocabulary", null, element, style);
+ comboStateCollection = formFactory.createTermCollectionComboElement(TermType.State, "State collection", null, element, style);
if (entity != null){
setEntity(entity);
}
}
@Override
- public void setEntity(TermVocabulary<State> entity) {
+ public void setEntity(TermCollection<T,?> entity) {
this.entity = entity;
- if(entity.getId()!=0 && comboStateVocabulary != null){
- comboStateVocabulary.setSelection(entity);
- comboStateVocabulary.removeEmptyElement();
+ if(entity.getId()!=0 && comboStateCollection != null){
+ comboStateCollection.setSelection(entity);
+ comboStateCollection.removeEmptyElement();
}
}
@Override
public void handleEvent(Object eventSource) {
- if(eventSource==comboStateVocabulary && comboStateVocabulary.getSelection()!=null){
- if(getParentElement() instanceof StateVocabularyCollectionSection){
- StateVocabularyCollectionSection parentElement = (StateVocabularyCollectionSection) getParentElement();
+ if(eventSource==comboStateCollection && comboStateCollection.getSelection()!=null){
+ if(getParentElement() instanceof RecommendedStateCollectionSection){
+ RecommendedStateCollectionSection parentElement = (RecommendedStateCollectionSection) getParentElement();
Feature feature = parentElement.getEntity();
feature.removeSupportedCategoricalEnumeration(entity);
- TermVocabulary<State> vocabulary = comboStateVocabulary.getSelection();
- feature.addSupportedCategoricalEnumeration(vocabulary);
- entity = vocabulary;
+ TermCollection<T,?> termCollection = comboStateCollection.getSelection();
+ feature.addSupportedCategoricalEnumeration(termCollection);
+ entity = termCollection;
//update the parent section to re-set the listeners to the persisted measurement unit
parentElement.removeElementAndUpdate(null);
}
}
}
-
-}
+}
\ No newline at end of file
--- /dev/null
+/**
+* Copyright (C) 2015 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.vocabulary;
+
+import java.util.Collection;
+import java.util.Comparator;
+
+import eu.etaxonomy.cdm.model.description.Feature;
+import eu.etaxonomy.cdm.model.description.State;
+import eu.etaxonomy.cdm.model.term.DefinedTermBase;
+import eu.etaxonomy.cdm.model.term.TermCollection;
+import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.model.term.TermVocabulary;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
+
+/**
+ * @author pplitzner
+ * @date Apr 27, 2015
+ */
+public class RecommendedStateCollectionSection
+ extends AbstractUnboundEntityCollectionSection<Feature, TermCollection<? extends DefinedTermBase,?>> {
+
+ public RecommendedStateCollectionSection(CdmFormFactory formFactory,
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Recommended state collections", style);
+ }
+
+ public RecommendedStateCollectionSection(CdmFormFactory formFactory,
+ ICdmFormElement parentElement, int style, Integer maxStates) {
+ super(formFactory, parentElement, "Recommended state collections", style);
+ }
+
+ @Override
+ protected Collection<TermCollection<? extends DefinedTermBase,?>> getEntityCollection(Feature entity) {
+ return entity.getSupportedCategoricalEnumerations();
+ }
+
+ @Override
+ public Comparator<TermCollection<? extends DefinedTermBase,?>> getComparator() {
+ return new DefaultCdmBaseComparator<>();
+ }
+
+ //TODO should not be implemented as we do not want to create vocabularies/term collections here
+ @Override
+ public TermCollection<State,?> createNewElement() {
+ //FIXME 10196
+
+ return TermVocabulary.NewInstance(TermType.State);
+ }
+
+ @Override
+ public void addElement(TermCollection<? extends DefinedTermBase,?> element) {
+ //never gets called
+ }
+
+ @Override
+ public void removeElement(TermCollection<? extends DefinedTermBase,?> element) {
+ getEntity().removeSupportedCategoricalEnumeration(element);
+ }
+
+ @Override
+ public String getEmptyString() {
+ return "No state collections yet.";
+ }
+
+ @Override
+ protected String getTooltipString() {
+ return "Add a state collection";
+ }
+
+ @Override
+ public TermCollection<State,?> addExisting() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean allowAddExisting() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+
+}
\ No newline at end of file
*/
package eu.etaxonomy.taxeditor.ui.section.vocabulary;
+import java.util.EnumSet;
+
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
-import eu.etaxonomy.cdm.model.description.State;
+import eu.etaxonomy.cdm.model.term.DefinedTermBase;
+import eu.etaxonomy.cdm.model.term.TermCollection;
import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
-import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
-import eu.etaxonomy.taxeditor.ui.combo.VocabularyComboElement;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
+import eu.etaxonomy.taxeditor.ui.combo.TermCollectionComboElement;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author pplitzner
* @date Apr 27, 2015
- *
*/
-public class StateVocabularyDtoCollectionElement extends AbstractEntityCollectionElement<TermVocabularyDto> {
-
+public class RecommendedStateCollectionsDtoElement<T extends DefinedTermBase<T>>
+ extends AbstractEntityCollectionElement<TermCollectionDto> {
- private VocabularyComboElement<State, TermVocabulary<State>> comboStateVocabulary;
+ private TermCollectionComboElement<T, TermCollection<T,?>> comboStateCollection;
- /**
- * @param formFactory
- * @param section
- * @param entity
- * @param removeListener
- * @param isChoosableEntity
- * @param backgroundColor
- * @param style
- */
- public StateVocabularyDtoCollectionElement(CdmFormFactory formFactory, AbstractFormSection section, TermVocabularyDto entity,
+ public RecommendedStateCollectionsDtoElement(CdmFormFactory formFactory, AbstractFormSection section, TermCollectionDto entity,
SelectionListener removeListener, Color backgroundColor, int style) {
super(formFactory, section, entity, removeListener, backgroundColor, style);
-
}
@Override
public void createControls(ICdmFormElement element, int style) {
- comboStateVocabulary = formFactory.createVocabularyDtoComboElement(TermType.State, "State vocabulary", null, element, style);
+ //for now we allow State and Structure here
+ comboStateCollection = formFactory.createTermCollectionDtoComboElement(EnumSet.of(TermType.State, TermType.Structure), "State term collection", null, element, style);
if (entity != null){
setEntity(entity);
}
}
@Override
- public void setEntity(TermVocabularyDto entity) {
+ public void setEntity(TermCollectionDto entity) {
this.entity = entity;
- if(comboStateVocabulary != null){
- comboStateVocabulary.setSelectionDto(entity);
- comboStateVocabulary.removeEmptyElement();
+ if(comboStateCollection != null){
+ comboStateCollection.setSelectionDto(entity);
+ comboStateCollection.removeEmptyElement();
}
}
@Override
public void handleEvent(Object eventSource) {
- if(eventSource==comboStateVocabulary && comboStateVocabulary.getSelection()!=null){
- if(getParentElement() instanceof StateVocabularyDtoCollectionSection){
- StateVocabularyDtoCollectionSection parentElement = (StateVocabularyDtoCollectionSection) getParentElement();
+ if(eventSource==comboStateCollection && comboStateCollection.getSelection()!=null){
+ if(getParentElement() instanceof RecommendedStateDtoCollectionSection){
+ RecommendedStateDtoCollectionSection parentElement = (RecommendedStateDtoCollectionSection) getParentElement();
FeatureDto feature = parentElement.getEntity();
- TermVocabularyDto remove = null;
- for (TermVocabularyDto voc: feature.getSupportedCategoricalEnumerations()){
+ TermCollectionDto remove = null;
+ for (TermCollectionDto voc: feature.getSupportedCategoricalEnumerations()){
if (voc.getUuid().equals(getEntity().getUuid())){
remove = voc;
break;
}
}
feature.getSupportedCategoricalEnumerations().remove(remove);
- TermVocabulary<State> vocabulary = comboStateVocabulary.getSelection();
- TermVocabularyDto dto = new TermVocabularyDto(vocabulary.getUuid(), vocabulary.getRepresentations(), vocabulary.getTermType(), vocabulary.getTitleCache(), vocabulary.isAllowDuplicates(), vocabulary.isOrderRelevant(), vocabulary.isFlat());
+ TermCollection<T,?> termCollection = comboStateCollection.getSelection();
+ TermCollectionDto dto = TermCollectionDto.fromCdmBase(termCollection);
feature.getSupportedCategoricalEnumerations().add(dto);
entity = dto;
//update the parent section to re-set the listeners to the persisted measurement unit
}
}
}
-
-}
+}
\ No newline at end of file
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.State;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
+import eu.etaxonomy.cdm.persistence.dto.TermCollectionDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
/**
* @author pplitzner
* @date Apr 27, 2015
- *
*/
-public class StateVocabularyDtoCollectionSection extends AbstractUnboundEntityCollectionSection<FeatureDto, TermVocabularyDto> {
+public class RecommendedStateDtoCollectionSection extends AbstractUnboundEntityCollectionSection<FeatureDto, TermCollectionDto> {
- public StateVocabularyDtoCollectionSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Supported state vocabularies", style);
+ public RecommendedStateDtoCollectionSection(CdmFormFactory formFactory,
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Supported state collections", style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
- */
- /** {@inheritDoc} */
@Override
- protected Collection<TermVocabularyDto> getEntityCollection(FeatureDto entity) {
+ protected Collection<TermCollectionDto> getEntityCollection(FeatureDto entity) {
return entity.getSupportedCategoricalEnumerations();
}
@Override
- public Comparator<TermVocabularyDto> getComparator() {
- return new Comparator<TermVocabularyDto>() {
+ public Comparator<TermCollectionDto> getComparator() {
+ return new Comparator<TermCollectionDto>() {
@Override
- public int compare(TermVocabularyDto o1, TermVocabularyDto o2) {
+ public int compare(TermCollectionDto o1, TermCollectionDto o2) {
if(o1==null){
return -1;
}
};
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
- */
- /** {@inheritDoc} */
+ //TODO should not be implemented as we do not want to create new vocabularies/term collections here
@Override
- public TermVocabularyDto createNewElement() {
+ public TermCollectionDto createNewElement() {
+ //FIXME 10196
TermVocabulary<State> voc = TermVocabulary.NewInstance(TermType.State);
return new TermVocabularyDto(voc.getUuid(), voc.getRepresentations(), voc.getTermType(), voc.getTitleCache(), voc.isAllowDuplicates(), voc.isOrderRelevant(), voc.isFlat());
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
- public void addElement(TermVocabularyDto element) {
+ public void addElement(TermCollectionDto element) {
//never gets called
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
- public void removeElement(TermVocabularyDto element) {
+ public void removeElement(TermCollectionDto element) {
if (element == null){
return;
}
- TermVocabularyDto remove = null;
- for (TermVocabularyDto voc: getEntity().getSupportedCategoricalEnumerations()){
+ TermCollectionDto remove = null;
+ for (TermCollectionDto voc: getEntity().getSupportedCategoricalEnumerations()){
if (voc.getUuid().equals(element.getUuid())){
remove = voc;
break;
getEntity().getSupportedCategoricalEnumerations().remove(remove);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
- return "No state vocabularies yet.";
+ return "No state collections yet.";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
- return "Add a state vocabulary";
+ return "Add a state collection";
}
- /**
- * {@inheritDoc}
- */
@Override
- public TermVocabularyDto addExisting() {
+ public TermCollectionDto addExisting() {
// TODO Auto-generated method stub
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
// TODO Auto-generated method stub
return false;
}
-
-
-}
+}
\ No newline at end of file
+++ /dev/null
-/**
-* Copyright (C) 2015 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.vocabulary;
-
-import java.util.Collection;
-import java.util.Comparator;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
-import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.cdm.model.description.State;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
-
-/**
- * @author pplitzner
- * @date Apr 27, 2015
- *
- */
-public class StateVocabularyCollectionSection extends AbstractUnboundEntityCollectionSection<Feature, TermVocabulary<State>> {
-
- public StateVocabularyCollectionSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Supported state vocabularies", style);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
- */
- /** {@inheritDoc} */
- @Override
- protected Collection<TermVocabulary<State>> getEntityCollection(Feature entity) {
- return entity.getSupportedCategoricalEnumerations();
- }
-
- @Override
- public Comparator<TermVocabulary<State>> getComparator() {
- return new DefaultCdmBaseComparator<>();
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
- */
- /** {@inheritDoc} */
- @Override
- public TermVocabulary<State> createNewElement() {
- return TermVocabulary.NewInstance(TermType.State);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
- @Override
- public void addElement(TermVocabulary<State> element) {
- //never gets called
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
- @Override
- public void removeElement(TermVocabulary<State> element) {
- getEntity().removeSupportedCategoricalEnumeration(element);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
- /** {@inheritDoc} */
- @Override
- public String getEmptyString() {
- return "No state vocabularies yet.";
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
- /** {@inheritDoc} */
- @Override
- protected String getTooltipString() {
- return "Add a state vocabulary";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public TermVocabulary<State> addExisting() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean allowAddExisting() {
- // TODO Auto-generated method stub
- return false;
- }
-
-
-}
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
/**
* @author pplitzner
* @date Apr 27, 2015
- *
*/
public class StatisticalMeasureCollectionSection extends AbstractUnboundEntityCollectionSection<Feature, StatisticalMeasure> {
public StatisticalMeasureCollectionSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Statistical measures", style);
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Statistical measures", style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
- */
- /** {@inheritDoc} */
@Override
protected Collection<StatisticalMeasure> getEntityCollection(Feature entity) {
return entity.getRecommendedStatisticalMeasures();
return new DefaultCdmBaseComparator<>();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
- */
- /** {@inheritDoc} */
@Override
public StatisticalMeasure createNewElement() {
return StatisticalMeasure.NewInstance();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void addElement(StatisticalMeasure element) {
//never gets called
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void removeElement(StatisticalMeasure element) {
getEntity().removeRecommendedStatisticalMeasure(element);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No statistical measures yet.";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a statistical measure";
}
- /**
- * {@inheritDoc}
- */
@Override
public StatisticalMeasure addExisting() {
// TODO Auto-generated method stub
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
// TODO Auto-generated method stub
return false;
}
-
-}
+}
\ No newline at end of file
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
/**
* @author pplitzner
* @date Apr 27, 2015
- *
*/
public class StatisticalMeasureDtoCollectionSection extends AbstractUnboundEntityCollectionSection<FeatureDto, TermDto> {
public StatisticalMeasureDtoCollectionSection(CdmFormFactory formFactory,
- ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(formFactory, conversation, parentElement, "Statistical measures", style);
+ ICdmFormElement parentElement, int style) {
+ super(formFactory, parentElement, "Statistical measures", style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractNullEntityCollectionSection#getEntityCollection(java.lang.Object)
- */
- /** {@inheritDoc} */
@Override
protected Collection<TermDto> getEntityCollection(FeatureDto entity) {
return entity.getRecommendedStatisticalMeasures();
};
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#createNewElement()
- */
- /** {@inheritDoc} */
@Override
public TermDto createNewElement() {
return TermDto.fromTerm(StatisticalMeasure.NewInstance());
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void addElement(TermDto element) {
//never gets called
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
- */
- /** {@inheritDoc} */
@Override
public void removeElement(TermDto element) {
if (element == null){
getEntity().getRecommendedStatisticalMeasures().remove(remove);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getEmptyString()
- */
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No statistical measures yet.";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getTooltipString()
- */
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Add a statistical measure";
}
- /**
- * {@inheritDoc}
- */
@Override
public TermDto addExisting() {
// TODO Auto-generated method stub
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
// TODO Auto-generated method stub
return false;
}
-
-}
+}
\ No newline at end of file
import java.util.Collection;
import java.util.Comparator;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermBasePropertyTester;
import eu.etaxonomy.taxeditor.ui.dialog.selection.MediaSelectionDialog;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- *
* @author pplitzner
* @since May 17, 2019
- *
*/
public class TermMediaSection extends AbstractEntityCollectionSection<DefinedTermBase, Media>{
- public TermMediaSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
- super(cdmFormFactory, conversation, parentElement, "Media", style);
+ public TermMediaSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement, int style) {
+ super(cdmFormFactory, parentElement, "Media", style);
+
}
@Override
public boolean allowAddExisting() {
return true;
}
-
-}
+
+ @Override
+ public void setEntity(DefinedTermBase entity) {
+ super.setEntity(entity);
+ setEnabled(TermBasePropertyTester.isModifiable(entity));
+ }
+}
\ No newline at end of file
}\r
\r
@Override\r
- public TermVocabulary getVocabulary() {\r
- return getEntity();\r
+ public void fillFields() {\r
+ // TODO\r
+ //uri_uriTermSource\r
}\r
-\r
-}\r
+}
\ No newline at end of file
\r
import org.eclipse.jface.viewers.ISelectionProvider;\r
\r
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
import eu.etaxonomy.cdm.model.term.TermVocabulary;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
/**\r
* @author l.morris\r
* @date 20 Dec 2011\r
- *\r
*/\r
public class TermVocabularyDetailSection extends\r
AbstractCdmDetailSection<TermVocabulary> {\r
\r
- /**\r
- * @param formFactory\r
- * @param conversation\r
- * @param parentElement\r
- * @param selectionProvider\r
- * @param style\r
- */\r
public TermVocabularyDetailSection(CdmFormFactory formFactory,\r
- ConversationHolder conversation, ICdmFormElement parentElement,\r
+ ICdmFormElement parentElement,\r
ISelectionProvider selectionProvider, int style) {\r
- super(formFactory, conversation, parentElement, selectionProvider, style);\r
- // TODO Auto-generated constructor stub\r
+ super(formFactory, parentElement, selectionProvider, style);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading()\r
- */\r
@Override\r
public String getHeading() {\r
-\r
return "Vocabulary: "+ (getEntity() != null ? getEntity().getLabel() : "");\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#setSectionTitle()\r
- */\r
@Override\r
protected void setSectionTitle() {\r
setText(getHeading());\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)\r
- */\r
@Override\r
protected AbstractCdmDetailElement<TermVocabulary> createCdmDetailElement(AbstractCdmDetailSection<TermVocabulary> parentElement, int style) {\r
return formFactory.createTermVocabularyDetailElement(parentElement);\r
+/**
+* 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 eu.etaxonomy.cdm.model.taxon.Classification;
public class ClassificationSelectionElement extends EntitySelectionElement<Classification> {
- public ClassificationSelectionElement(CdmFormFactory formFactory,//ConversationHolder conversation, #
+ public ClassificationSelectionElement(CdmFormFactory formFactory,
ICdmFormElement parentElement,
Class<Classification> clazz, String labelString,
Classification entity, int mode, int style) {
- super(formFactory, //conversation,
+ super(formFactory,
parentElement, clazz, labelString, entity,
mode, style);
-
}
-
-}
+}
\ No newline at end of file
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.CdmBase;
-import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
public class CollectorSelectionElement extends EntitySelectionElement<AgentBase> {
-
- Team collectorTeam;
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param clazz
- * @param labelString
- * @param entity
- * @param mode
- * @param style
- */
- public CollectorSelectionElement(CdmFormFactory formFactory,// ConversationHolder conversation,
+
+ private Team collectorTeam;
+
+ public CollectorSelectionElement(CdmFormFactory formFactory,
ICdmFormElement parentElement, String labelString, AgentBase entity, int mode, int style) {
- super(formFactory, //conversation,
- parentElement, AgentBase.class,
- labelString, entity, mode, style);
+ super(formFactory,parentElement, AgentBase.class,
+ labelString, entity, mode, style);
}
- public CollectorSelectionElement(CdmFormFactory formFactory,// ConversationHolder conversation,
+
+ public CollectorSelectionElement(CdmFormFactory formFactory,
ICdmFormElement parentElement, String labelString, AgentBase entity, Person primaryCollector, int mode, int style) {
- super(formFactory, //conversation,
+ super(formFactory,
parentElement, AgentBase.class,
labelString, primaryCollector, mode, style);
if (entity instanceof Team){
protected String getTitle() {
if (entity != null){
if (entity instanceof TeamOrPersonBase){
- return ((TeamOrPersonBase)entity).getCollectorTitleCache();
+ return ((TeamOrPersonBase)entity).getCollectorTitleCache();
}else{
return entity.getTitleCache();
}
public void setCollectorTeam(Team collectorTeam) {
this.collectorTeam = collectorTeam;
}
-
- public void widgetSelected(SelectionEvent e) {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
if (e.getSource().equals(button_selection) ){
AgentBase selection = null;
if (this.collectorTeam != null){
selection = SelectionDialogFactory.getSelectionFromDialog(AgentBase.class, getShell(),
collectorTeam, this);
- }else{
+ }else{
selection = SelectionDialogFactory.getSelectionFromDialog(AgentBase.class, getShell(),
getEntity(), getParentElement());
}
}
}
}
-}
+}
\ No newline at end of file
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
import eu.etaxonomy.cdm.api.service.IService;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacadeNotSupportedException;
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.agent.Team;
import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.permission.User;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.cdm.model.molecular.Amplification;
import eu.etaxonomy.cdm.model.molecular.Primer;
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.cdm.model.permission.User;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
* @author n.hoffmann
* @created Jun 1, 2010
*/
-public class EditFromSelectionWizard extends Wizard implements
- SelectionListener, ICdmEntitySessionEnabled<CdmBase> {
+public class EditFromSelectionWizard
+ extends Wizard
+ implements SelectionListener, ICdmEntitySessionEnabled<CdmBase> {
private ICdmEntitySession cdmEntitySession;
private ICdmEntitySession previousCdmEntitySession;
}
if (rootElement.isInstanceOf(Reference.class)&& selectionElement instanceof EntitySelectionElementWithAbbreviatedTitle<?>) {
addPage(new ReferenceWizardPage(formFactory,
- selectionElement.getConversationHolder(),
HibernateProxyHelper.deproxy(rootElement, Reference.class), true));
} else if (rootElement.isInstanceOf(Reference.class) ) {
addPage(new ReferenceWizardPage(formFactory,
- selectionElement.getConversationHolder(), HibernateProxyHelper.deproxy(rootElement, Reference.class), false));
+ HibernateProxyHelper.deproxy(rootElement, Reference.class), false));
} else if (rootElement.isInstanceOf(Team.class) && (selectionElement instanceof EntitySelectionElementWithAbbreviatedTitle<?> )) {
addPage(new TeamWizardPage(formFactory,
- selectionElement.getConversationHolder(), HibernateProxyHelper.deproxy(rootElement, Team.class), true, false));
+ HibernateProxyHelper.deproxy(rootElement, Team.class), true, false));
} else if (rootElement.isInstanceOf(Team.class) && (selectionElement.getClass().equals(CollectorSelectionElement.class)) ){
addPage(new TeamWizardPage(formFactory,
- selectionElement.getConversationHolder(), HibernateProxyHelper.deproxy(rootElement, Team.class), false, true));
+ HibernateProxyHelper.deproxy(rootElement, Team.class), false, true));
} else if (rootElement.isInstanceOf(Team.class) && (selectionElement instanceof EntitySelectionElement<?>)) {
addPage(new TeamWizardPage(formFactory,
- selectionElement.getConversationHolder(), HibernateProxyHelper.deproxy(rootElement, Team.class), false, false));
+ HibernateProxyHelper.deproxy(rootElement, Team.class), false, false));
} else if (rootElement.isInstanceOf(Person.class)) {
addPage(new PersonWizardPage(formFactory,
- selectionElement.getConversationHolder(), HibernateProxyHelper.deproxy(rootElement, Person.class)));
+ HibernateProxyHelper.deproxy(rootElement, Person.class)));
} else if (rootElement.isInstanceOf(TaxonName.class)) {
addPage(new NonViralNameWizardPage(formFactory,
- selectionElement.getConversationHolder(),
HibernateProxyHelper.deproxy(rootElement, TaxonName.class)));
} else if (rootElement.isInstanceOf(TaxonBase.class)) {
addPage(new TaxonWizardPage(formFactory,
- selectionElement.getConversationHolder(),
HibernateProxyHelper.deproxy(rootElement, TaxonBase.class)));
} else if (rootElement.isInstanceOf(SpecimenOrObservationBase.class)) {
throw new IllegalStateException();
}
- addPage(new DerivedUnitGeneralWizardPage(formFactory,
- selectionElement.getConversationHolder(), facade));
- addPage(new GatheringEventWizardPage(formFactory,
- selectionElement.getConversationHolder(), facade));
- addPage(new FieldUnitWizardPage(formFactory,
- selectionElement.getConversationHolder(), facade));
+ addPage(new DerivedUnitGeneralWizardPage(formFactory,facade));
+ addPage(new GatheringEventWizardPage(formFactory, facade));
+ addPage(new FieldUnitWizardPage(formFactory, facade));
if(facade.innerDerivedUnit()!=null){
- addPage(new DerivedUnitBaseWizardPage(formFactory,
- selectionElement.getConversationHolder(), facade));
+ addPage(new DerivedUnitBaseWizardPage(formFactory, facade));
}
} else if (rootElement.isInstanceOf(Collection.class)) {
addPage(new CollectionWizardPage(formFactory,
- selectionElement.getConversationHolder(),
HibernateProxyHelper.deproxy(rootElement, Collection.class)));
} else if (rootElement instanceof Institution) {
addPage(new InstitutionWizardPage(formFactory,
- selectionElement.getConversationHolder(),
HibernateProxyHelper.deproxy(rootElement, Institution.class)));
} else if (rootElement instanceof User) {
addPage(new UserDetailWizardPage(formFactory,
- selectionElement.getConversationHolder(),
HibernateProxyHelper.deproxy(rootElement, User.class)));
} else if (rootElement instanceof Primer) {
addPage(new PrimerWizardPage(formFactory,
- selectionElement.getConversationHolder(),
HibernateProxyHelper.deproxy(rootElement, Primer.class)));
} else if (rootElement instanceof Amplification) {
addPage(new AmplificationGeneralWizardPage(formFactory,
- selectionElement.getConversationHolder(),
HibernateProxyHelper.deproxy(rootElement, Amplification.class)));
} else if (rootElement instanceof PolytomousKey) {
addPage(new PolytomousKeyWizardPage(formFactory,
- selectionElement.getConversationHolder(),
HibernateProxyHelper.deproxy(rootElement, PolytomousKey.class)));
} else {
MessagingUtils.warningDialog("Missing interface", this,
import org.eclipse.ui.forms.widgets.TableWrapData;\r
import org.springframework.security.core.GrantedAuthority;\r
\r
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;\r
import eu.etaxonomy.cdm.api.service.IService;\r
import eu.etaxonomy.cdm.common.CdmUtils;\r
import eu.etaxonomy.cdm.model.common.CdmBase;\r
//if the edited entity has already been persisted\r
//but the transient entity is still set in this\r
//EntitySelectionElement, re-load it and set it\r
- if(!entity.isPersited()){\r
+ if(!entity.isPersisted()){\r
IService<T> service = CdmStore.getService(entity);\r
T loadedEntity = service.load(entity.getUuid());\r
if(loadedEntity != null){\r
public void widgetDefaultSelected(SelectionEvent e) {\r
}\r
\r
-// @Override\r
- public ConversationHolder getConversationHolder() {\r
- if(getParentElement() instanceof IConversationEnabled) {\r
- return ((IConversationEnabled)getParentElement()).getConversationHolder();\r
- }\r
- return null;\r
- }\r
+\r
\r
@Override\r
public void setBackground(Color color) {\r
/**
- *
- */
+* 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 eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
public class EntitySelectionElementWithAbbreviatedTitle<T extends CdmBase> extends EntitySelectionElement<T> {
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param clazz
- * @param labelString
- * @param entity
- * @param mode
- * @param style
- */
- public EntitySelectionElementWithAbbreviatedTitle(CdmFormFactory formFactory,// ConversationHolder conversation,
+ public EntitySelectionElementWithAbbreviatedTitle(CdmFormFactory formFactory,
ICdmFormElement parentElement, Class<T> clazz, String labelString, T entity, int mode, int style) {
- super(formFactory, //conversation,
+ super(formFactory,
parentElement, clazz, labelString, entity, mode, style);
}
}
return "";
}
-}
+}
\ No newline at end of file
- public TaxonNodeSelectionElement(CdmFormFactory formFactory,//ConversationHolder conversation,
+ public TaxonNodeSelectionElement(CdmFormFactory formFactory,
ICdmFormElement parentElement,
String labelString, TaxonNode entity, int mode, int style, Integer limit) {
super(formFactory, //conversation,
/** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
- TaxonNode newSelection = TaxonNodeSelectionDialog.select(getShell(),//getConversationHolder(),
+ TaxonNode newSelection = TaxonNodeSelectionDialog.select(getShell(),
"Select parent taxon", null, null, getClassification().getUuid());
setSelectionInternal(newSelection);
}
if(preferredRepresentation != null){
text_source.setSelectedRepresentation(preferredRepresentation);
}
+ text_source.setEnabled(false);
+ text_source.setLanguageComboEnabled(false);
}
private void createLeftControls(ICdmFormElement element){
preferredRepresentation = term.getPreferredRepresentation(PreferencesUtil.getGlobalLanguage());
text_source = formFactory.createRepresentationElement(element, preferredRepresentation,term, TEXT_HEIGHT, SWT.NULL, true);
text_source.setTerm(term, true);
+
}else {
preferredRepresentation = termDto.getPreferredRepresentation(PreferencesUtil.getGlobalLanguage());
text_source = formFactory.createRepresentationElement(element, preferredRepresentation,termDto, TEXT_HEIGHT, SWT.NULL, true);
text_source.setTermDto(termDto, true);
}
-
-
-
+ text_source.setEnabled(false);
+ text_source.setEnabled(false);
}
private void createRightControls(ICdmFormElement element){
}else {
text_target = formFactory.createRepresentationElement(element, null, termDto, TEXT_HEIGHT, SWT.NULL, false);
}
+ text_target.setEnabled(false);
}
@Override
if (taxonNode.getStatus() != null){
text = taxonNode.getStatus().getSymbol() + " ";
}
+ if (taxonNode.getTaxon() != null && !taxonNode.getTaxon().isPublish()) {
+ text = text + "\\u20ac";
+ }
text += taxon.getName() != null ? taxon.getName().getTitleCache() : "";
return text;
}catch(Exception e){
else if (element instanceof TaxonNodeDto){
TaxonNodeDto taxonNode = (TaxonNodeDto) element;
String text= "";
+ if (!taxonNode.isPublish() ) {
+ text = text + "\u26D4 ";
+ }
if (taxonNode.getStatus() != null){
text = taxonNode.getStatus().getSymbol() + " ";
}
+
//TODO if symbols contain non-ASCII this may create problems
// if so we may use ASCII like text +=Character.toString((char)248) + " ";
}
return notGrantedStyler;
}
+
}
\ No newline at end of file
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
-import eu.etaxonomy.cdm.api.service.dto.DescriptionBaseDto;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.name.NomenclaturalSource;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
+import eu.etaxonomy.cdm.persistence.dto.DescriptionBaseDto;
import eu.etaxonomy.cdm.persistence.dto.ReferencingObjectDto;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import java.util.Collection;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
-import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* Input for {@link DataImportEditor}. This class queries a data source for
*
* @author pplitzner
* @date 25.02.2014
- *
*/
public abstract class DataImportEditorInput<T> {
- protected static Logger logger = LogManager.getLogger(DataImportEditorInput.class);
+ protected static Logger logger = LogManager.getLogger();
private Collection<T> results;
- private final ConversationHolder conversationHolder;
protected OccurenceQuery query;
- public DataImportEditorInput() {
- this.conversationHolder = CdmStore.createConversation();
- }
-
public Collection<T> getResults() {
return results;
}
this.results = results;
}
- public ConversationHolder getConversationHolder() {
- return conversationHolder;
- }
-
@Override
public abstract int hashCode();
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.e4.ui.di.Focus;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.forms.widgets.FormToolkit;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
-import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.databaseAdmin.wizard.ImportPreferencesWizard;
import eu.etaxonomy.taxeditor.model.IContextListener;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
/**
* View which shows a list of "data" that can be imported into the CDM
+ *
* @author pplitzner
* @date 22.08.2017
*
* @param <T> the CDM type that will be handled by this view
*/
-public abstract class DataImportView<T> implements IPartContentHasFactualData,
-IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, IContextListener, Listener, IEditorAreaPart{
+public abstract class DataImportView<T> implements IPartContentHasFactualData, IPartContentHasDetails, IPartContentHasSupplementalData, IContextListener, Listener, IEditorAreaPart{
- protected final Logger logger = LogManager.getLogger(DataImportView.class);
+ protected final Logger logger = LogManager.getLogger();
protected Collection<T> results = new ArrayList<>();
protected OccurenceQuery query;
- private static ConversationHolder conversationHolder;
-
private SaveImportedSpecimenAction saveImportedSpecimenAction;
-// private Text textClassification;
-
-// private Classification classification;
-
protected Text textReferenceString;
private Button selectAllButton;
- //private Button selectNoneButton;
private Button importButton;
private boolean state;
- private Button openConfigurator;
-
- private Abcd206ImportConfigurator config;
-
-// public Classification getClassification() {
-// return classification;
-// }
-//
-// public void setClassification(Classification classification) {
-// this.classification = classification;
-// }
-
- private Button btnBrowseClassification;
-
- private Button btnClear;
-
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
private Table table;
*/
@PostConstruct
public void createPartControl(Composite parent) {
- if(CdmStore.isActive()){
- initConversation();
- }
- else{
- return;
- }
+
parent.setLayout(new GridLayout(1, false));
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
CheckboxTableViewer checkboxTableViewer = CheckboxTableViewer.newCheckList(composite_2, SWT.BORDER | SWT.FULL_SELECTION);
-
table = checkboxTableViewer.getTable();
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
table.addListener(SWT.Selection, this);
public abstract void query();
- @Override
- public void update(CdmDataChangeMap changeEvents) {
- //nothing
- }
-
/**
* Returns the text label of the given item.
* @param item the item for which the label should be returns
if(getTable()!=null){
getTable().setFocus();
}
- //make sure to bind again if maybe in another view the conversation was unbound
- if(getConversationHolder()!=null && !getConversationHolder().isBound()){
- getConversationHolder().bind();
- }
}
@Override
@Override
public void contextStart(IMemento memento, IProgressMonitor monitor) {
- initConversation();
- }
- private void initConversation(){
- if(conversationHolder==null){
- conversationHolder = CdmStore.createConversation();
- }
}
@Override
public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
- if(getConversationHolder()!=null && getConversationHolder().isBound() && !getConversationHolder().isClosed()) {
- getConversationHolder().close();
- }
- }
-
- /**
- * @return the conversationHolder
- */
- @Override
- public ConversationHolder getConversationHolder() {
- if(CdmStore.isActive() && conversationHolder==null){
- initConversation();
- }
- return conversationHolder;
}
@Override
public static final String ID = "eu.etaxonomy.taxeditor.view.dataimport.e4.GbifResponseImportView";
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.view.dataimport.DataImportView#getTextForTableItem(java.lang.Object)
- */
@Override
protected String getTextForTableItem(GbifResponse item) {
- String text = "";
- if(item.getDataSetProtocol()!=null){
- text += "["+item.getDataSetProtocol()+"] ";
+
+ String text = "";
+ String unitId = "";
+ if(item.getDataSetProtocol()!=null){
+ text += "["+item.getDataSetProtocol()+"] ";
+ }
+ if (item.getDerivedUnitFacade().getAccessionNumber() != null) {
+ unitId = item.getDerivedUnitFacade().getAccessionNumber();
+ }else if (item.getDerivedUnitFacade().getBarcode() != null) {
+ unitId = item.getDerivedUnitFacade().getBarcode();
+ }else {
+ unitId = item.getDerivedUnitFacade().getCatalogNumber();
+ }
+ if(item.getScientificName() != null){
+
+ text = item.getScientificName().getTitleCache();
}
- text += item.getDerivedUnitFacade().innerDerivedUnit().generateTitle();
- return text;
+ //if (text != null){
+ String collectionCode = item.getDerivedUnitFacade().getCollection() != null ? " - " + item.getDerivedUnitFacade().getCollection().getCode(): "";
+ String kindOfUnit = item.getDerivedUnitFacade().getDerivedUnitKindOfUnit() != null ? " - " + item.getDerivedUnitFacade().getDerivedUnitKindOfUnit().toString():"";
+
+ return text + collectionCode + unitId + kindOfUnit;
+ //}
+
+// String text = "";
+// if(item.getDataSetProtocol()!=null){
+// text += "["+item.getDataSetProtocol()+"] ";
+// }
+// text += item.getDerivedUnitFacade().innerDerivedUnit().generateTitle();
+// return text;
}
/* (non-Javadoc)
public void query() {
String errorMessage = "Could not execute query " + query;
try{
- //Collection<GbifResponse> results = new GbifQueryServiceWrapper().query(query);
- //setResults(results);
-
- // String errorMessage = "Could not execute query " + query;
-
- // Collection<SpecimenOrObservationBase<?>> results = new ArrayList<SpecimenOrObservationBase<?>>();
- Collection<GbifResponse> results = new GbifQueryServiceWrapper().query(query);
-
- setResults(results);
-
-
-//
- // results = repo.getUnits();
-
- } catch (ClientProtocolException e) {
- logger.error(errorMessage, e);
- } catch (IOException e) {
- logger.error(errorMessage, e);
- } catch (URISyntaxException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ Collection<GbifResponse> results = new GbifQueryServiceWrapper().query(query);
+ setResults(results);
+ } catch (ClientProtocolException e) {
+ logger.error(errorMessage, e);
+ } catch (IOException e) {
+ logger.error(errorMessage, e);
+ } catch (URISyntaxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
-
-// setResults(results);
-//
-// }
-// } catch (ClientProtocolException e) {
-// logger.error(errorMessage, e);
-// } catch (IOException e) {
-// logger.error(errorMessage, e);
-// } catch (URISyntaxException e) {
-// logger.error(errorMessage, e);
-// }
-
- // }
-
-
-
-
-
-
+ }
}
import org.eclipse.swt.widgets.TableItem;
import eu.etaxonomy.cdm.common.URI;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
import eu.etaxonomy.cdm.ext.occurrence.bioCase.BioCaseResponse;
-import eu.etaxonomy.cdm.ext.occurrence.gbif.DataSetResponse;
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifDataSetProtocol;
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
import eu.etaxonomy.cdm.io.specimen.gbif.in.GbifImportConfigurator;
-import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.view.dataimport.GbifResponseComparator;
Abcd206ImportConfigurator configuratorAbcd;
List<Abcd206ImportConfigurator> abcdConfigurators = new ArrayList<>();
- DataSetResponse dataSetResponse;
OccurenceQuery bioCaseOccurrenceQuery = null;
URI dataSetUri = null;
for (BioCaseResponse response:checkedAbcdResults){
}
}
- private void persistTerm(DefinedTermBase<?> term, ITermService termService, ConversationHolder conversation){
- if(term!=null){
- //if the term does not exist in the DB save it
- if(termService.find(term.getUuid())==null){
- termService.saveOrUpdate(term);
- }
- }
- }
-
@Override
public String getText() {
return "Import";
@Override
protected IStatus run(IProgressMonitor monitor) {
- view.getConversationHolder().bind();
view.query();
Display.getDefault().asyncExec(new Runnable() {
import java.util.EventObject;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.SectionPart;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacadeNotSupportedException;
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
*/
public class CdmSectionPart<T> extends SectionPart
implements IPropertyChangeListener {
+ private static final Logger logger = LogManager.getLogger();
public static String EXPANDED = "expanded";
public static String COLLAPSED = "collapsed";
return true;
}
+ public boolean setFormInputWithoutUpdate(Object input) {
+ if (formSection.isDisposed()){
+ return false;
+ }
+
+ this.rootInput = input;
+ //FIXME (CM): Need to fix this part of the design.
+ //The design seems to be locked to the idea that only one
+ // entity (either from the navigator or the editor) drives
+ // the detail view. In the case of multiple inputs the only workaround
+ // is checking the type and extracting relevant objects.
+ if (input instanceof IElementHasDetails) {
+ input = ((IElementHasDetails) input).getData();
+ }
+
+ if ((input instanceof TaxonBase)
+ && (formSection instanceof ITaxonBaseDetailSection )) {
+
+ //if (!((TaxonBase<?>) input).getTitleCache().equals(((ITaxonBaseDetailSection) formSection).getTaxonBase().getTitleCache())) {
+ ((ITaxonBaseDetailSection) formSection)
+ .setTaxonBaseWithoutUpdate((TaxonBase<?>) input);
+
+ //}
+
+ return true;
+ }
+ //actually only for Taxon Details...
+ return this.setFormInput( input);
+ }
+
@Override
public void propertyChange(PropertyChangeEvent event) {
if (event != null) {
@Override
protected void expansionStateChanged(boolean expanded) {
super.expansionStateChanged(expanded);
- PreferencesUtil.setStringValue(StoreUtil.getPrefKey(formSection.getClass(), rootInput.getClass().getCanonicalName()), expanded?EXPANDED:COLLAPSED);
+ try {
+ PreferencesUtil.setStringValue(StoreUtil.getPrefKey(formSection.getClass(), rootInput.getClass().getCanonicalName()), expanded?EXPANDED:COLLAPSED);
+ }catch (NullPointerException e) {
+ logger.error(e.getMessage());
+ }
}
}
\ No newline at end of file
* 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.e4;
import javax.inject.Inject;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
-import org.eclipse.e4.core.services.log.Logger;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.ui.forms.ManagedForm;
import org.eclipse.ui.forms.widgets.ScrolledForm;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.view.detail.CdmSectionPart;
/**
- *
* @author pplitzner
* @date 18.07.2017
- *
*/
-public abstract class AbstractCdmDataViewer extends Viewer implements IConversationEnabled{
- @Inject
- private Logger logger;
+public abstract class AbstractCdmDataViewer extends Viewer {
+
+ private static final Logger logger = LogManager.getLogger();
protected ManagedForm managedForm;
@Inject
public AbstractCdmDataViewer() {
-
}
public void init(Composite parent, IDirtyMarkable part) {
rootElement = new RootElement(formFactory, body);
}
-
protected void createEmptySection(String message, RootElement parent) {
destroySections();
formFactory.dispose();
formFactory = null;
}
- formFactory = new CdmFormFactory(Display.getCurrent(), this);
+ formFactory = new CdmFormFactory(Display.getCurrent(), this);
ContextInjectionFactory.inject(formFactory, context);
}
// managedForm.reflow(true);
}
+
+
+ public void refresh_withoutnew_build() {
+ if(input!=null){
+ IFormPart[] parts = managedForm.getParts();
+ for (IFormPart part: parts) {
+ if(part instanceof CdmSectionPart) {
+ ((CdmSectionPart<?>)part).setFormInputWithoutUpdate(input);
+ }
+ }
+ }
+
+ }
public void layout(){
body.layout();
null,
e,
true);
-
}
}
managedForm.addPart(sectionPart);
formFactory.addPropertyChangeListener(sectionPart);
}
-
- @Override
- public ConversationHolder getConversationHolder() {
- return null;
- }
-
-}
+}
\ No newline at end of file
import javax.inject.Inject;
import javax.inject.Named;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.di.PersistState;
import org.eclipse.swt.SWTException;
import org.springframework.security.core.GrantedAuthority;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.api.service.ITermNodeService;
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.api.service.IVocabularyService;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.IBulkEditor;
import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
* @author pplitzner
* @since Aug 10, 2017
*/
-public abstract class AbstractCdmEditorPartE4
- implements IConversationEnabled, IDirtyMarkable, ISelectionElementEditingPart, IPostOperationEnabled{
+public abstract class AbstractCdmEditorPart<V extends Viewer>
+ implements IDirtyMarkable, ISelectionElementEditingPart, IPostOperationEnabled{
- private static final Logger logger = LogManager.getLogger(AbstractCdmEditorPartE4.class);
+ private static final Logger logger = LogManager.getLogger();
private DelaySelection delaySelection = null;
+
/**
* This is the monitor for the DelaySelection runnable.
* If it is <code>true</code> then it is currently delaying a selection.
private Object selection;
private MPart activePart;
private MPart thisPart;
+ private EPartService partService;
- public DelaySelection(Object selection, MPart activePart, MPart thisPart) {
- super();
+ public DelaySelection(Object selection, MPart activePart, MPart thisPart, EPartService partService) {
this.selection = selection;
this.activePart= activePart;
this.thisPart = thisPart;
+ this.partService = partService;
}
@Override
public void run() {
+
+ isInDelay = false;
+
+ //multiple selections are not supported
+ if(activePart != null
+ && thisPart != null
+ && !activePart.equals(thisPart)
+ && selection instanceof IStructuredSelection
+ && ((IStructuredSelection) selection).size()>1){
+ showEmptyPage();
+ return;
+ }
+
+ // no active editor found
+ if(activePart == thisPart && WorkbenchUtility.getActiveEditorPart(partService) == null && showEmptyIfNoActiveEditor()){
+ showEmptyPage();
+ return;
+ }
+
+ if (viewer != null && viewer.getControl()!= null && viewer.getInput() != null && !viewer.getControl().isDisposed()){
+ try{
+ viewer.getControl().setEnabled(isEnabled);
+ }catch(SWTException e){
+ System.out.println("...exception3 ("+ (thisPart == null? "":thisPart.getLabel()) + ")");
+ logger.debug("Something went wrong for viewer.getControl().setEnabled(true) in " + this.getClass().getSimpleName(), e);
+ }
+ }
+
+ //same as previous selection? => return
+ if((previousSelection != null && selection != null)
+ && (activePart != null && selectionProvidingPart != null
+ && activePart.equals(selectionProvidingPart))
+ && (previousSelection == selection
+ || previousSelection.equals(selection)
+ || new StructuredSelection(selection).equals(previousSelection))
+ ) {
+ return;
+ }
+
try{
selectionChanged_internal(selection, activePart, thisPart);
+ }catch (Exception ex){
+ logger.error("Error during selectionChanged_internal", ex);
+ ex.printStackTrace();
}
finally{
- isInDelay = false;
- }
+ previousSelection = selection;
+ }
}
public synchronized void setSelection(Object selection) {
public synchronized void setThisPart(MPart thisPart) {
this.thisPart = thisPart;
}
+
+ public synchronized void setThisPartService(EPartService partService) {
+ this.partService = partService;
+ }
}
- protected Viewer viewer;
+ protected V viewer;
protected MPart thisPart;
@Optional@Named(IServiceConstants.ACTIVE_SELECTION)Object selection,
@Optional@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
MPart thisPart, UISynchronize sync, EPartService partService){
- //multiple selections are not supported
- if(activePart!=null
- && thisPart!=null
- && !activePart.equals(thisPart)
- && selection instanceof IStructuredSelection
- && ((IStructuredSelection) selection).size()>1){
- showEmptyPage();
- return;
- }
- // no active editor found
- if(activePart==thisPart && WorkbenchUtility.getActiveEditorPart(partService)==null && showEmptyIfNoActiveEditor()){
- showEmptyPage();
- return;
- }
- if (viewer != null && viewer.getControl()!= null && viewer.getInput() != null && !viewer.getControl().isDisposed()){
- try{
- viewer.getControl().setEnabled(isEnabled);
- }catch(SWTException e){
- logger.debug("Something went wrong for viewer.getControl().setEnabled(true) in " + this.getClass().getSimpleName(), e);
- }
- }
- if((previousSelection!=null && selection!=null)
- && (activePart != null && selectionProvidingPart != null && activePart.equals(selectionProvidingPart))
- && (previousSelection==selection
- || previousSelection.equals(selection)
- || new StructuredSelection(selection).equals(previousSelection))
- ) {
- return;
- }
- if(delaySelection==null){
- delaySelection = new DelaySelection(selection, activePart, thisPart);
+ //set the delay selection which puts the change handling to the end
+ if(delaySelection == null){
+ delaySelection = new DelaySelection(selection, activePart, thisPart, partService);
}else{
delaySelection.setSelection(selection);
delaySelection.setActivePart(activePart);
delaySelection.setThisPart(thisPart);
+ delaySelection.setThisPartService(partService);
}
+
+ //as long as the delay thread is running,
if(!isInDelay){
- isInDelay = true;
+ isInDelay = true;
sync.asyncExec(delaySelection);
- previousSelection = selection;
}
}
@Override
public void changed(Object object) {
- if(selectionProvidingPart!=null){
+ if(selectionProvidingPart != null){
Object part = selectionProvidingPart.getObject();
if(part instanceof IDirtyMarkable){
((IDirtyMarkable) part).changed(object);
if (part instanceof IBulkEditor){
((IBulkEditor)part).setSelection(createSelection(object));
}
+
}
}
- public Viewer getViewer() {
+ public V getViewer() {
return viewer;
}
}
protected void showViewer(IStructuredSelection selection, MPart activePart, Viewer viewer){
- if(CdmStore.getCurrentSessionManager().getActiveSession()==null){
+ if(CdmStore.getCurrentSessionManager().getActiveSession() == null){
return;
}
- if(viewer!=null && viewer.getControl()!=null && !viewer.getControl().isDisposed()){
+ if(viewer != null && viewer.getControl() != null && !viewer.getControl().isDisposed()){
Object element = selection.getFirstElement();
- Object part = createPartObject(activePart);
+ Object part = getPartObject(activePart);
if (viewer.getControl().isDisposed()){
return;
}
this.isEnabled = doEnable;
}
}
+
if (taxon.isMisapplication() || taxon.isProparteSynonym() ){
if(part instanceof ITaxonEditor){
element = CdmStore.getService(IVocabularyService.class).load(((TermVocabularyDto) element).getUuid());
}
-
selectionProvidingPart = activePart;
if (viewer instanceof DetailsViewerE4){
((DetailsViewerE4)viewer).setDetailsEnabled(isEnabled);
}
((DetailsViewerE4)viewer).setInput(element, part);
-
}
-
else{
if(element instanceof TermNodeDto){
- element = CdmStore.getService(ITermNodeService.class).load(((TermNodeDto) element).getUuid());
+ //element = CdmStore.getService(ITermNodeService.class).load(((TermNodeDto) element).getUuid());
}
if (activePart.getObject() instanceof DetailsPartE4 && element instanceof TaxonName){
selectionProvidingPart = ((DetailsPartE4)activePart.getObject()).getSelectionProvidingPart();
}
}
}
-
}
- protected Object createPartObject(MPart activePart) {
+ protected Object getPartObject(MPart activePart) {
Object partObject = activePart;
Object wrappedPart = WorkbenchUtility.getE4WrappedPart(activePart);
- if(wrappedPart!=null){
+ if(wrappedPart != null){
partObject = wrappedPart;
}
return partObject;
return structuredSelection;
}
- @Override
- public ConversationHolder getConversationHolder() {
- if(selectionProvidingPart != null && selectionProvidingPart instanceof IConversationEnabled) {
- return ((IConversationEnabled) selectionProvidingPart).getConversationHolder();
- }
- return null;
- }
@Override
public boolean postOperation(Object objectAffectedByOperation) {
changed(objectAffectedByOperation);
-// Object part = selectionProvidingPart.getObject();
-// if (part instanceof IBulkEditor){
-// ((IBulkEditor)part).setSelection(createSelection(objectAffectedByOperation));
-// }
return true;
}
@Override
public boolean onComplete() {
- viewer.refresh();
+ try {
+ viewer.refresh();
+ }catch(SWTException e) {
+ if (PreferencesUtil.isShowUpWidgetIsDisposedMessages() && e.getMessage().equals("Widget is disposed")){
+ MessagingUtils.errorDialog("Widget is disposed",
+ null,
+ MessagingUtils.WIDGET_IS_DISPOSED_MESSAGE,
+ null,
+ e,
+ true);
+ }
+
+ }
return true;
}
}
- @Override
- public void update(CdmDataChangeMap arg0) {
- }
-
@Override
public void forceDirty() {
}
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.widgets.Composite;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPartE4;
+import eu.etaxonomy.taxeditor.view.detail.CdmSectionPart;
+import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPart;
import eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4;
-import eu.etaxonomy.taxeditor.workbench.part.ISelectionElementEditingPart;
/**
* @author pplitzner
* @date 18.07.2017
*/
-public class DetailsPartE4 extends AbstractCdmEditorPartE4 implements IPartContentHasSupplementalData, IPartContentHasFactualData {
+public class DetailsPartE4 extends AbstractCdmEditorPart<DetailsViewerE4> implements IPartContentHasSupplementalData, IPartContentHasFactualData {
@Inject
public DetailsPartE4() {
this.thisPart = thisPart;
viewer = ContextInjectionFactory.make(DetailsViewerE4.class, context);
- ((DetailsViewerE4)viewer).init(parent, this);
+ viewer.init(parent, this);
// Propagate selection from viewer
selectionChangedListener = (event -> selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event)));
@Override
public void selectionChanged_internal(Object selection, MPart activePart, MPart thisPart) {
- if (activePart==thisPart){
- return;
+ if (activePart == null) {
+ return;
+ }
+
+ if (activePart == thisPart ){
+ if (this.getViewer().isNeedsRefresh()) {
+ viewer.refresh();
+ viewer.setNeedsRefresh(false);
+ return;
+ }else {
+ return;
+ }
}
+
+
- Object partObject = createPartObject(activePart);
+ Object partObject = getPartObject(activePart);
if (partObject instanceof SupplementalDataPartE4 ) {
// do not show empty page
return;
}
+
+ if (partObject instanceof AbstractCdmEditorPart && ((AbstractCdmEditorPart)partObject).getViewer() instanceof TreeViewer ) {
+ //active part is factual data view or media view
+ IStructuredSelection structuredSelection = createSelection(selection);
+ if (structuredSelection != null && !structuredSelection.isEmpty()) {
+ //if the active part is empty the selection is still the previous selection
+ if (!(structuredSelection instanceof TreeSelection)) {
+ return;
+ }
+ }
+
+ }
if(partObject instanceof IPartContentHasDetails){
IStructuredSelection structuredSelection = createSelection(selection);
- if(structuredSelection==null || structuredSelection.isEmpty()){
- showEmptyPage();
- return;
- }
- if(!(partObject instanceof ISelectionElementEditingPart) &&
- partObject instanceof IConversationEnabled && ((IConversationEnabled) partObject).getConversationHolder()==null) {
- //TODO show specific message (refactor EmptyElement to allow specific messages)
+ if(structuredSelection == null || structuredSelection.isEmpty()){
showEmptyPage();
return;
}
+
// do not show details for feature nodes TODO strange check to avoid having shown the distribution map for every FeatureNodeContainer
if(structuredSelection.getFirstElement() instanceof FeatureNodeContainer){
// do show the map for distributions
viewer.setSelection(structuredSelection, false);
showViewer(structuredSelection, activePart, viewer);
-
-
-
+ viewer.setNeedsRefresh(false);
return;
}
else{
}
public void refreshSelection(){
- selectionChanged_internal(new StructuredSelection(this.viewer.getInput()), selectionProvidingPart, thisPart);
+ this.viewer.refresh_withoutnew_build();
}
@Override
protected void showEmptyPage() {
super.showEmptyPage();
- if(viewer!=null && viewer.getControl()!=null && !viewer.getControl().isDisposed() ){
+ if(viewer != null && viewer.getControl() != null && !viewer.getControl().isDisposed() ){
try{
- ((DetailsViewerE4)viewer).destroySections();
+ viewer.destroySections();
}catch(SWTException e){
if (PreferencesUtil.isShowUpWidgetIsDisposedMessages() && e.getMessage().equals("Widget is disposed")){
MessagingUtils.errorDialog("Widget is disposed",
null,
e,
true);
-
}
}
}
return Messages.DetailsViewPart_VIEWER_NAME;
}
-}
+}
\ No newline at end of file
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeNode;
import org.eclipse.swt.SWT;
+import org.eclipse.ui.forms.IFormPart;
import org.springframework.security.core.GrantedAuthority;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacadeNotSupportedException;
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.term.TermVocabulary;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.IBulkEditor;
import eu.etaxonomy.taxeditor.editor.IDistributionEditorPart;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
private boolean detailsEnabled = true;
private Object activePart;
+ private boolean needsRefresh = false;
+
public boolean isDetailsEnabled() {
return detailsEnabled;
}
setInput(input);
}
+
+ public boolean isNeedsRefresh() {
+ return needsRefresh;
+ }
+
+ public void setNeedsRefresh(boolean needsRefresh) {
+ this.needsRefresh = needsRefresh;
+ }
// START HACK TO MAKE THE DERIVED UNIT FACADE WORK
// since we are getting implementations of DerivedUnitBase from the bulk
- // editor
- // and not derived unit facade objects,
-
+ // editor and not derived unit facade objects,
@Override
public void setInput(Object input) {
input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input);
}
super.setInput(input);
-
-
}
@Override
}
else if(type.equals(TermType.Feature) || type.equals(TermType.Character)){
createFeatureNodeSection(rootElement);
+ }else {
+ createTermNodeSection(rootElement);
}
} else if (input instanceof TermTreeDto) {
if (sel.getFirstElement()instanceof Distribution){
createDescriptionElementSection(rootElement);
}
-
-// createDescriptionElementSection(rootElement);
+ }else if (activePart instanceof IDistributionEditorPart && input instanceof HashSet) {
+ createEmptySection(Messages.More_than_one_distribution, rootElement);
}else {
createEmptySection(null, rootElement);
}
private void createGroupSection(RootElement parent) {
- GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(GroupDetailSection.class, getInput().getClass().getCanonicalName()));
- MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(MemberDetailSection.class, getInput().getClass().getCanonicalName()));
- GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,StoreUtil.getSectionStyle(GrantedAuthorityDetailSection.class, getInput().getClass().getCanonicalName()));
+ GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(parent, this, StoreUtil.getSectionStyle(GroupDetailSection.class, getInput().getClass().getCanonicalName()));
+ MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(parent, StoreUtil.getSectionStyle(MemberDetailSection.class, getInput().getClass().getCanonicalName()));
+ GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(parent,StoreUtil.getSectionStyle(GrantedAuthorityDetailSection.class, getInput().getClass().getCanonicalName()));
addPart(groupDetailSection);
addPart(memberDetailSection);
}
}
detailsEnabled = hasPermission;
- ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
+ ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(parent, this,
StoreUtil.getSectionStyle(ParsingMessagesSection.class, getInput().getClass().getCanonicalName(), true));
if (config == null){
- TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
+ TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(parent, this,
StoreUtil.getSectionStyle(TaxonBaseDetailSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
// boolean hasPermission = CdmStore.currentAuthentiationHasPermission(getInput(), Operation.UPDATE);
addPart(taxonBaseDetailSection);
}else{
if (config.isTaxonSectionActivated()){
- TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
+ TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(parent, this,
StoreUtil.getSectionStyle(TaxonBaseDetailSection.class, getInput().getClass().getCanonicalName(), true));
taxonBaseDetailSection.setEnabled(detailsEnabled);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
}
}
//TODO: test code for secundum source section
-// SecundumSourceSection sourceSection = formFactory.createSecundumDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SecundumSourceSection.class, getInput().getClass().getCanonicalName(), true));
// formFactory.createHorizontalSeparator(parent, SWT.BORDER);
// addPart(sourceSection);
// if (taxonBase.getSecSource() == null){
// sourceSection.setEnabled(false);
// }
NonViralNameDetailSection nonViralNameSection = formFactory
- .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
+ .createNonViralNameDetailSection(parent, this, true,
StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
nonViralNameSection.setEnabled(detailsEnabled);
if (config == null || config.isNomenclaturalReferenceSectionActivated()){
- NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
+ NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(parent, this,
StoreUtil.getSectionStyle(NomenclaturalSourceDetailSection.class, getInput().getClass().getCanonicalName(), true));
referenceDetailSection.setEnabled(detailsEnabled);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
}
if ( config == null || config.isNomenclaturalStatusSectionActivated()){
- NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
+ NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(parent,
StoreUtil.getSectionStyle(NomenclaturalStatusSection.class, getInput().getClass().getCanonicalName(), true));
nomenclaturalStatusSection.setEnabled(detailsEnabled);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(nomenclaturalStatusSection);
}
-// if ( config == null || config.isProtologueActivated()){
-// ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ProtologueSection.class, getInput().getClass().getCanonicalName()));
-// protologSection.setEnabled(detailsEnabled);
-// formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-// addPart(protologSection);
-// }
-
if (config == null || config.isTypeDesignationSectionActivated()){
- TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(TypeDesignationSection.class, getInput().getClass().getCanonicalName()));
+ TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(parent, StoreUtil.getSectionStyle(TypeDesignationSection.class, getInput().getClass().getCanonicalName()));
typeDesignationSection.setEnabled(detailsEnabled);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(typeDesignationSection);
}
if (config == null || config.isNameRelationsSectionActivated()){
- NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(NameRelationshipDetailSection.class, getInput().getClass().getCanonicalName()));
+ NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(parent, StoreUtil.getSectionStyle(NameRelationshipDetailSection.class, getInput().getClass().getCanonicalName()));
nameRelationshipSection.setEnabled(detailsEnabled);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(nameRelationshipSection);
private void createNameSections(RootElement parent) {
NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(
- getConversationHolder(), parent, this, false, StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ parent, this, false, StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
+ NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(parent, this,
StoreUtil.getSectionStyle(NomenclaturalSourceDetailSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
+ NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(parent,
StoreUtil.getSectionStyle(NomenclaturalStatusSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(nomenclaturalStatusSection);
addPart(referenceDetailSection);
-// ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ProtologueSection.class, getInput().getClass().getCanonicalName()));
-// formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
- TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(TypeDesignationSection.class, getInput().getClass().getCanonicalName()));
+ TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(parent, StoreUtil.getSectionStyle(TypeDesignationSection.class, getInput().getClass().getCanonicalName()));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(NameRelationshipDetailSection.class, getInput().getClass().getCanonicalName()));
+ NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(parent, StoreUtil.getSectionStyle(NameRelationshipDetailSection.class, getInput().getClass().getCanonicalName()));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
// addPart(protologSection);
addPart(typeDesignationSection);
}
private void createReferenceSections(RootElement parent) {
- ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this,
+ ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(parent, this,
StoreUtil.getSectionStyle(ReferenceDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(referenceDetailSection);
}
private void createTeamOrPersonBaseDetailSection(RootElement parent) {
- TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TeamOrPersonBaseDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(parent, this, StoreUtil.getSectionStyle(TeamOrPersonBaseDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(teamOrPersonBaseDetailSection);
}
private void createTeamDetailSection(RootElement parent) {
- TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(TeamDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(parent, StoreUtil.getSectionStyle(TeamDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(teamDetailSection);
}
private void createPersonDetailSection(RootElement parent) {
- PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(PersonDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(parent, StoreUtil.getSectionStyle(PersonDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(personDetailSection);
}
}
private void createDescriptionElementSection(RootElement parent, Object activePart) {
- DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DescriptionElementDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(parent, this, StoreUtil.getSectionStyle(DescriptionElementDetailSection.class, getInput().getClass().getCanonicalName(), true));
- // IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(getConversationHolder(), parent, getSectionStyle(.class, getInput().getClass().getCanonicalName()));
+ // IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(parent, getSectionStyle(.class, getInput().getClass().getCanonicalName()));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
DescriptionElementSourceSection descriptionElementSourceSection;
if (activePart != null && activePart instanceof IDistributionEditorPart){
Reference defaultSource =((IDistributionEditorPart)activePart).getEditor().getDefaultSource();
- descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, defaultSource, StoreUtil.getSectionStyle(DescriptionElementSourceSection.class, getInput().getClass().getCanonicalName()));
+ descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(parent, defaultSource, StoreUtil.getSectionStyle(DescriptionElementSourceSection.class, getInput().getClass().getCanonicalName()));
}else{
- descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionElementSourceSection.class, getInput().getClass().getCanonicalName()) );
+ descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(parent, StoreUtil.getSectionStyle(DescriptionElementSourceSection.class, getInput().getClass().getCanonicalName()) );
descriptionElementSourceSection.setEnabled(this.detailsEnabled);
}
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionElementMediaSection.class, getInput().getClass().getCanonicalName()));
+ DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(
+ parent, StoreUtil.getSectionStyle(DescriptionElementMediaSection.class, getInput().getClass().getCanonicalName()));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
}
private void createDescriptionSection(RootElement parent, boolean isTaxonDescription, boolean isEnabled) {
- DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName(), true));
descriptionDetailSection.setEnabled(isEnabled);
addPart(descriptionDetailSection);
if(isTaxonDescription) {
NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(
- getConversationHolder(), parent, this, StoreUtil.getSectionStyle(NaturalLanguageSection.class, getInput().getClass().getCanonicalName(), true));
+ parent, this, StoreUtil.getSectionStyle(NaturalLanguageSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
naturalLanguageSection.setEnabled(isEnabled);
addPart(naturalLanguageSection);
}
DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(
- getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionSourceSection.class, getInput().getClass().getCanonicalName(), true));
+ parent, StoreUtil.getSectionStyle(DescriptionSourceSection.class, getInput().getClass().getCanonicalName(), true));
descriptionSourceSection.setEnabled(isEnabled);
addPart(descriptionSourceSection);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
if(isTaxonDescription) {
- ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ScopeSection.class, getInput().getClass().getCanonicalName()));
+ ScopeSection scopeSection = formFactory.createScopeSection(parent, StoreUtil.getSectionStyle(ScopeSection.class, getInput().getClass().getCanonicalName()));
scopeSection.setEnabled(isEnabled);
addPart(scopeSection);
}
}
private void createUseDescriptionSection(RootElement parent) {
- DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName()));
+ DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName()));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionSourceSection.class, getInput().getClass().getCanonicalName()));
+ DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(parent, StoreUtil.getSectionStyle(DescriptionSourceSection.class, getInput().getClass().getCanonicalName()));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
}
private void createImageGallerySection(RootElement parent) {
- DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName()));
+ DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName()));
addPart(descriptionDetailSection);
}
private void createMediaElementSection(RootElement parent) {
- MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(MediaDetailsSection.class, getInput().getClass().getCanonicalName(), true));
+ MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(parent, this, StoreUtil.getSectionStyle(MediaDetailsSection.class, getInput().getClass().getCanonicalName(), true));
addPart(mediaDetailSection);
}
private void createDerivedUnitBaseElementSection(RootElement parent) {
- DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DerivedUnitGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(parent, this, StoreUtil.getSectionStyle(DerivedUnitGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
//TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
if(!(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){
derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DerivedUnitBaseDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(parent, this, StoreUtil.getSectionStyle(DerivedUnitBaseDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(derivedUnitBaseDetailSection);
//for editors working with facades
if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(GatheringEventDetailSection.class, getInput().getClass().getCanonicalName()));
+ GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(parent, this, StoreUtil.getSectionStyle(GatheringEventDetailSection.class, getInput().getClass().getCanonicalName()));
addPart(gatheringEventDetailSection);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- FieldUnitFacadeDetailSection fieldUnitDetailSection = formFactory.createFieldUnitFacadeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(FieldUnitFacadeDetailSection.class, getInput().getClass().getCanonicalName()));
+ FieldUnitFacadeDetailSection fieldUnitDetailSection = formFactory.createFieldUnitFacadeDetailSection(parent, this, StoreUtil.getSectionStyle(FieldUnitFacadeDetailSection.class, getInput().getClass().getCanonicalName()));
addPart(fieldUnitDetailSection);
}
else{
if(PreferencesUtil.isShowTaxonAssociations()){
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TaxonAssociationDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(parent, this, StoreUtil.getSectionStyle(TaxonAssociationDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(taxonAssociationDetailSection);
}
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- DerivedUnitFacadeIdentifierSection identifierDetailSection = formFactory.createDerivedUnitFacadeIdentifierSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DerivedUnitFacadeIdentifierSection.class, getInput().getClass().getCanonicalName()));
+ DerivedUnitFacadeIdentifierSection identifierDetailSection = formFactory.createDerivedUnitFacadeIdentifierSection(parent, StoreUtil.getSectionStyle(DerivedUnitFacadeIdentifierSection.class, getInput().getClass().getCanonicalName()));
addPart(identifierDetailSection);
}
if(!PreferencesUtil.isDeterminationOnlyForFieldUnits()){
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DeterminationDetailSection.class, getInput().getClass().getCanonicalName()));
+ DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(parent, this, StoreUtil.getSectionStyle(DeterminationDetailSection.class, getInput().getClass().getCanonicalName()));
addPart(determinationDetailSection);
}
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- DerivedUnitTypeDesignationSection derivedUnitTypeDesignationSection = formFactory.createDerivedUnitTypeDesignationSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DerivedUnitTypeDesignationSection.class, getInput().getClass().getCanonicalName()));
+ DerivedUnitTypeDesignationSection derivedUnitTypeDesignationSection = formFactory.createDerivedUnitTypeDesignationSection(parent, this, StoreUtil.getSectionStyle(DerivedUnitTypeDesignationSection.class, getInput().getClass().getCanonicalName()));
addPart(derivedUnitTypeDesignationSection);
}
private void createFieldUnitFacadeSection(RootElement parent) {
- FieldUnitFacadeGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitFacadeGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(FieldUnitFacadeGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ FieldUnitFacadeGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitFacadeGeneralDetailSection(parent, this, StoreUtil.getSectionStyle(FieldUnitFacadeGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(GatheringEventDetailSection.class, getInput().getClass().getCanonicalName()));
+ GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(parent, this, StoreUtil.getSectionStyle(GatheringEventDetailSection.class, getInput().getClass().getCanonicalName()));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- FieldUnitFacadeDetailSection fieldUnitDetailSection = formFactory.createFieldUnitFacadeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(FieldUnitFacadeDetailSection.class, getInput().getClass().getCanonicalName()));
+ FieldUnitFacadeDetailSection fieldUnitDetailSection = formFactory.createFieldUnitFacadeDetailSection(parent, this, StoreUtil.getSectionStyle(FieldUnitFacadeDetailSection.class, getInput().getClass().getCanonicalName()));
addPart(fielUnitGeneralDetailSection);
addPart(gatheringEventDetailSection);
addPart(fieldUnitDetailSection);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DeterminationDetailSection.class, getInput().getClass().getCanonicalName()));
+ DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(parent, this, StoreUtil.getSectionStyle(DeterminationDetailSection.class, getInput().getClass().getCanonicalName()));
addPart(determinationDetailSection);
}
private void createTissueSampleSection(RootElement parent) {
- TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TissueSampleGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(parent, this, StoreUtil.getSectionStyle(TissueSampleGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SampleDesignationDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(parent, this, StoreUtil.getSectionStyle(SampleDesignationDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(section);
addPart(sampleDesignationDetailSection);
}
private void createDnaSampleSection(RootElement parent) {
- DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DnaSampleGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(parent, this, StoreUtil.getSectionStyle(DnaSampleGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- DnaSamplePreparationPreservationSection preparationPreservationSection = formFactory.createDnaSamplePreparationPreservationSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DnaSamplePreparationPreservationSection.class, getInput().getClass().getCanonicalName(), true));
+ DnaSamplePreparationPreservationSection preparationPreservationSection = formFactory.createDnaSamplePreparationPreservationSection(parent, this, StoreUtil.getSectionStyle(DnaSamplePreparationPreservationSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- DnaQualityDetailSection qualitySection = formFactory.createDnaQualityDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DnaQualityDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ DnaQualityDetailSection qualitySection = formFactory.createDnaQualityDetailSection(parent, this, StoreUtil.getSectionStyle(DnaQualityDetailSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SampleDesignationDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(parent, this, StoreUtil.getSectionStyle(SampleDesignationDetailSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
DeterminationDetailSection determinationDetailSection = null;
if(!PreferencesUtil.isDeterminationOnlyForFieldUnits()){
- determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DeterminationDetailSection.class, getInput().getClass().getCanonicalName()));
+ determinationDetailSection = formFactory.createDeterminationDetailSection(parent, this, StoreUtil.getSectionStyle(DeterminationDetailSection.class, getInput().getClass().getCanonicalName()));
}
addPart(section);
addPart(preparationPreservationSection);
}
private void createSequenceSection(RootElement parent) {
- SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SequenceGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(parent, this, StoreUtil.getSectionStyle(SequenceGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- SequenceReferenceCollectionDetailSection referenceSection = formFactory.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(SequenceReferenceCollectionDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ SequenceReferenceCollectionDetailSection referenceSection = formFactory.createSequenceReferenceCollectionDetailSection(parent, StoreUtil.getSectionStyle(SequenceReferenceCollectionDetailSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- SequenceContigFileCollectionDetailSection contigFileSection = formFactory.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(SequenceContigFileCollectionDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ SequenceContigFileCollectionDetailSection contigFileSection = formFactory.createSequenceContigFileCollectionDetailSection(parent, StoreUtil.getSectionStyle(SequenceContigFileCollectionDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(section);
addPart(referenceSection);
}
private void createSingleReadSection(RootElement parent) {
- SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SingleReadGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(parent, this, StoreUtil.getSectionStyle(SingleReadGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(section);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(SingleReadPherogramCollectionDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(parent, StoreUtil.getSectionStyle(SingleReadPherogramCollectionDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(pherogramSection);
}
private void createMediaSpecimenSection(RootElement parent) {
- MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(MediaSpecimenGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(parent, this, StoreUtil.getSectionStyle(MediaSpecimenGeneralDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(generalSection);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(RightsSection.class, getInput().getClass().getCanonicalName()));
+ RightsSection rightsSection = formFactory.createRightsSection(parent, StoreUtil.getSectionStyle(RightsSection.class, getInput().getClass().getCanonicalName()));
// rightsSection.setEntity(generalSection.getEntity().innerDerivedUnit());
addPart(rightsSection);
}
private void createFeatureTreeSectionForDto(RootElement parent) {
- TermTreeDetailSection section = formFactory.createFeatureTreeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TermTreeDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ TermTreeDetailSection section = formFactory.createFeatureTreeDetailSection(parent, this, StoreUtil.getSectionStyle(TermTreeDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(section);
}
private void createFeatureTreeSection(RootElement parent) {
- TermTreeDetailSectionForNode section = formFactory.createFeatureTreeDetailSectionForTree(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TermTreeDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ TermTreeDetailSectionForNode section = formFactory.createFeatureTreeDetailSectionForTree(parent, this, StoreUtil.getSectionStyle(TermTreeDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(section);
}
private void createFeatureNodeSection(RootElement parent) {
- TermNodeDetailSection featureDistributionSection = formFactory.createFeatureNodeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TermNodeDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ TermNodeDetailSection featureDistributionSection = formFactory.createFeatureNodeDetailSection(parent, this, StoreUtil.getSectionStyle(TermNodeDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ addPart(featureDistributionSection);
+ }
+ private void createTermNodeSection(RootElement parent) {
+ TermNodeDetailSection featureDistributionSection = formFactory.createTermNodeDetailSection(parent, this, StoreUtil.getSectionStyle(TermNodeDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(featureDistributionSection);
}
private void createFeatureDistributionSection(RootElement parent) {
- FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(FeatureDistributionDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(parent, this, StoreUtil.getSectionStyle(FeatureDistributionDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(featureDistributionSection);
}
private void createCharacterNodeSection(RootElement parent) {
- CharacterNodeDetailSection featureDistributionSection = formFactory.createCharacterNodeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(CharacterDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ CharacterNodeDetailSection featureDistributionSection = formFactory.createCharacterNodeDetailSection(parent, this, StoreUtil.getSectionStyle(CharacterDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(featureDistributionSection);
}
private void createCharacterNodeDtoSection(RootElement parent) {
- CharacterNodeDtoDetailSection featureDistributionSection = formFactory.createCharacterNodeDtoDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(CharacterDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ CharacterNodeDtoDetailSection featureDistributionSection = formFactory.createCharacterNodeDtoDetailSection(parent, this, StoreUtil.getSectionStyle(CharacterDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(featureDistributionSection);
}
private void createCharacterSection(RootElement parent) {
- CharacterDetailSection featureDistributionSection = formFactory.createCharacterDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(CharacterDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ CharacterDetailSection featureDistributionSection = formFactory.createCharacterDetailSection(parent, this, StoreUtil.getSectionStyle(CharacterDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(featureDistributionSection);
}
private void createPolytomousKeyNodeSection(RootElement parent) {
- PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(PolytomousKeyDetailSection.class, getInput().getClass().getCanonicalName()));
+ PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(parent, this, StoreUtil.getSectionStyle(PolytomousKeyDetailSection.class, getInput().getClass().getCanonicalName()));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(PolytomousKeyNodeDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(parent, this, StoreUtil.getSectionStyle(PolytomousKeyNodeDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(polytomousKeyDetailSection);
addPart(polytomousKeyNodeDetailSection);
}
private void createUseRecordSection(RootElement parent) {
- UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,StoreUtil.getSectionStyle(UseRecordDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(parent, this,StoreUtil.getSectionStyle(UseRecordDetailSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(descriptionUseRecordSection);
}
private void createUserSection(RootElement parent) {
- UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(UserDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ UserDetailSection userDetailSection = formFactory.createUserDetailSection(parent, this, StoreUtil.getSectionStyle(UserDetailSection.class, getInput().getClass().getCanonicalName(), true));
- GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(GroupsByUserDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(parent, StoreUtil.getSectionStyle(GroupsByUserDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(userDetailSection);
addPart(groupByUserDetailSection);
}
private void createMisappliedNameSection(RootElement parent) {
- TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this,
+ TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(parent, this,
StoreUtil.getSectionStyle(TaxonRelationshipDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(taxonRelationshipDetailSection);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
NonViralNameDetailSection nonViralNameSection = formFactory
- .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
+ .createNonViralNameDetailSection(parent, this, true,
StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(nonViralNameSection);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
+ NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(parent, this,
StoreUtil.getSectionStyle(NomenclaturalSourceDetailSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(referenceDetailSection);
- NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
+ NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(parent,
StoreUtil.getSectionStyle(NomenclaturalStatusSection.class, getInput().getClass().getCanonicalName(), true));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(nomenclaturalStatusSection);
-// ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ProtologueSection.class, getInput().getClass().getCanonicalName()));
-// formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-// addPart(protologSection);
-
- TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(TypeDesignationSection.class, getInput().getClass().getCanonicalName()));
+ TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(parent, StoreUtil.getSectionStyle(TypeDesignationSection.class, getInput().getClass().getCanonicalName()));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(typeDesignationSection);
- NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(NameRelationshipDetailSection.class, getInput().getClass().getCanonicalName()));
+ NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(parent, StoreUtil.getSectionStyle(NameRelationshipDetailSection.class, getInput().getClass().getCanonicalName()));
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(nameRelationshipSection);
}
private void createTaxonRelationshipSection(RootElement parent) {
- TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TaxonRelationshipDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(parent, this, StoreUtil.getSectionStyle(TaxonRelationshipDetailSection.class, getInput().getClass().getCanonicalName(), true));
- ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(ReferencedEntityDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(parent, this, StoreUtil.getSectionStyle(ReferencedEntityDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(taxonRelationshipDetailSection);
addPart(referencedEntityBaseDetailSection);
}
private void createTermVocabularySection(RootElement parent) {
- TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(TermVocabularyDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(parent, this, StoreUtil.getSectionStyle(TermVocabularyDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(termVocabularyDetailSection);
}
private void createDefinedTermSection(RootElement parent) {
- DefinedTermDetailSection<?> definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DefinedTermDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ DefinedTermDetailSection<?> definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), parent, this, StoreUtil.getSectionStyle(DefinedTermDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(definedTermDetailSection);
- TermMediaSection termMediaSection = formFactory.createTermMediaSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DefinedTermDetailSection.class, getInput().getClass().getCanonicalName(), true));
+ TermMediaSection termMediaSection = formFactory.createTermMediaSection(parent, StoreUtil.getSectionStyle(DefinedTermDetailSection.class, getInput().getClass().getCanonicalName(), true));
addPart(termMediaSection);
}
- @Override
- public void update(CdmDataChangeMap arg0) {
- }
@Inject
@Optional
private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_DETAILS)boolean refresh){
if(refresh){
- refresh();
+ //refresh_withoutnew_build(); this would use the update without creation of all fields
+ if (needsRefresh) {
+ refresh();
+ }
+ this.needsRefresh = false;
}
}
+ @Inject
+ @Optional
+ private void needsRefresh(@UIEventTopic(WorkbenchEventConstants.NEED_REFRESH_DETAILS)boolean enable){
+ for (IFormPart part :this.managedForm.getParts()) {
+ if (part instanceof CdmSectionPart) {
+ ((CdmSectionPart)part).getSection().setEnabled(enable);
+ this.setNeedsRefresh(!enable);
+
+ }
+ }
+
+
+ }
+
@Inject
@Optional
private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_DETAILS_DISTRIBUTION)String nameCache){
}
}
}
+
+
}
\ No newline at end of file
import org.eclipse.swt.SWTException;
import org.eclipse.swt.widgets.Composite;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
+import eu.etaxonomy.cdm.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
+import eu.etaxonomy.cdm.model.term.TermBase;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermBasePropertyTester;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPartE4;
+import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPart;
/**
* @author pplitzner
* @since Aug 10, 2017
*/
-public class SupplementalDataPartE4 extends AbstractCdmEditorPartE4 {
+public class SupplementalDataPartE4 extends AbstractCdmEditorPart<SupplementalDataViewerE4> {
- @Inject
- public SupplementalDataPartE4() {}
+ @Inject
+ public SupplementalDataPartE4() {
+ }
- @PostConstruct
- public void create(Composite parent, MPart thisPart, IEclipseContext context) {
+ @PostConstruct
+ public void create(Composite parent, MPart thisPart, IEclipseContext context) {
- this.thisPart = thisPart;
+ this.thisPart = thisPart;
- viewer = ContextInjectionFactory.make(SupplementalDataViewerE4.class, context);
- ((SupplementalDataViewerE4)viewer).init(parent, this);
- }
+ viewer = ContextInjectionFactory.make(SupplementalDataViewerE4.class, context);
+ viewer.init(parent, this);
+ }
@Override
public void selectionChanged_internal(Object selection, MPart activePart, MPart thisPart) {
- if(activePart==thisPart){
- return;
- }
-// setEnabled(true);
- Object partObject = createPartObject(activePart);
-
- if(partObject instanceof IPartContentHasSupplementalData) {
- setEnabled(true);
-
- IStructuredSelection structuredSelection = createSelection(selection);
- if(structuredSelection==null || structuredSelection.isEmpty()){
- showEmptyPage();
- return;
- }
- if(structuredSelection.size() != 1){
- showEmptyPage();
- return;
- }
- if (partObject instanceof ITaxonEditor && structuredSelection.getFirstElement() instanceof Taxon ){
- if (((ITaxonEditor)partObject).getTaxon() != structuredSelection.getFirstElement() && ((Taxon)structuredSelection.getFirstElement()).isMisapplication()){
- Set<TaxonRelationship> rels =((Taxon)structuredSelection.getFirstElement()).getTaxonRelations(((ITaxonEditor)partObject).getTaxon());
- if (rels != null && rels.size() == 1){
- structuredSelection = new StructuredSelection(rels.iterator().next());
- }else{
- showEmptyPage();
- return;
- }
- }
- }
- // do not show supplemental data for feature nodes
- if(structuredSelection.getFirstElement() instanceof FeatureNodeContainer){
- showEmptyPage();
- return;
- }
-
- else if(structuredSelection.getFirstElement() instanceof DerivedUnitFacade){
- return;
- }
- else if(structuredSelection.getFirstElement() instanceof PolytomousKeyNode){
- structuredSelection = new StructuredSelection(((PolytomousKeyNode)structuredSelection.getFirstElement()).getKey());
- }
- else if(structuredSelection.getFirstElement() instanceof TreeNode){
- structuredSelection = new StructuredSelection(((TreeNode)structuredSelection.getFirstElement()).getValue());
- }
- else if(structuredSelection.getFirstElement() instanceof GbifResponse){
- structuredSelection = new StructuredSelection(((GbifResponse)structuredSelection.getFirstElement()).getDerivedUnitFacade().innerDerivedUnit());
- }
- else if(structuredSelection.getFirstElement() instanceof DescriptionElementBase ){
- structuredSelection = new StructuredSelection((structuredSelection.getFirstElement()));
-
- if (((DescriptionElementBase)structuredSelection.getFirstElement()).getInDescription() != null && (((DescriptionElementBase)structuredSelection.getFirstElement()).getInDescription().isComputed() || ((DescriptionElementBase)structuredSelection.getFirstElement()).getInDescription().isCloneForSource())){
- if (PreferencesUtil.isComputedDesciptionHandlingDisabled()){
+ if (activePart == thisPart) {
+ return;
+ }
+ // setEnabled(true);
+ Object partObject = getPartObject(activePart);
+
+ if (partObject instanceof IPartContentHasSupplementalData) {
+ setEnabled(true);
+
+ IStructuredSelection structuredSelection = createSelection(selection);
+ if (structuredSelection == null || structuredSelection.isEmpty()) {
+ showEmptyPage();
+ return;
+ }
+ if (structuredSelection.size() != 1) {
+ showEmptyPage();
+ return;
+ }
+ if (partObject instanceof ITaxonEditor && structuredSelection.getFirstElement() instanceof Taxon) {
+ if (((ITaxonEditor) partObject).getTaxon() != structuredSelection.getFirstElement()
+ && ((Taxon) structuredSelection.getFirstElement()).isMisapplication()) {
+ Set<TaxonRelationship> rels = ((Taxon) structuredSelection.getFirstElement())
+ .getTaxonRelations(((ITaxonEditor) partObject).getTaxon());
+ if (rels != null && rels.size() == 1) {
+ structuredSelection = new StructuredSelection(rels.iterator().next());
+ } else {
+ showEmptyPage();
+ return;
+ }
+ }
+ }
+ // do not show supplemental data for feature nodes
+ if (structuredSelection.getFirstElement() instanceof FeatureNodeContainer) {
+ showEmptyPage();
+ return;
+ }
+
+ else if (structuredSelection.getFirstElement() instanceof DerivedUnitFacade) {
+ return;
+ } else if (structuredSelection.getFirstElement() instanceof PolytomousKeyNode) {
+ structuredSelection = new StructuredSelection(
+ ((PolytomousKeyNode) structuredSelection.getFirstElement()).getKey());
+ } else if (structuredSelection.getFirstElement() instanceof TreeNode) {
+ structuredSelection = new StructuredSelection(
+ ((TreeNode) structuredSelection.getFirstElement()).getValue());
+ } else if (structuredSelection.getFirstElement() instanceof GbifResponse) {
+ structuredSelection = new StructuredSelection(((GbifResponse) structuredSelection.getFirstElement())
+ .getDerivedUnitFacade().innerDerivedUnit());
+ } else if (structuredSelection.getFirstElement() instanceof DescriptionElementBase) {
+ structuredSelection = new StructuredSelection((structuredSelection.getFirstElement()));
+
+ if (((DescriptionElementBase) structuredSelection.getFirstElement()).getInDescription() != null
+ && (((DescriptionElementBase) structuredSelection.getFirstElement()).getInDescription()
+ .isComputed()
+ || ((DescriptionElementBase) structuredSelection.getFirstElement()).getInDescription()
+ .isCloneForSource())) {
+ if (PreferencesUtil.isComputedDesciptionHandlingDisabled()) {
setEnabled(false);
- }else{
+ } else {
setEnabled(true);
}
}
- }
- else if(structuredSelection.getFirstElement() instanceof DescriptionBase ){
+ } else if (structuredSelection.getFirstElement() instanceof DescriptionBase) {
- if (((DescriptionBase<?>)structuredSelection.getFirstElement()).isComputed() || ((DescriptionBase<?>)structuredSelection.getFirstElement()).isCloneForSource()){
- if (PreferencesUtil.isComputedDesciptionHandlingDisabled()){
+ if (((DescriptionBase<?>) structuredSelection.getFirstElement()).isComputed()
+ || ((DescriptionBase<?>) structuredSelection.getFirstElement()).isCloneForSource()) {
+ if (PreferencesUtil.isComputedDesciptionHandlingDisabled()) {
setEnabled(false);
- }else{
+ } else {
setEnabled(true);
}
}
+ } else if (structuredSelection.getFirstElement() instanceof TermDto
+ || structuredSelection.getFirstElement() instanceof TermVocabularyDto
+ || structuredSelection.getFirstElement() instanceof TermNodeDto) {
+ showViewer(structuredSelection, activePart, viewer);
+ setEnabled(TermBasePropertyTester.isModifiable(structuredSelection.getFirstElement()));
+ viewer.setEnabled(isEnabled());
+ return;
+ }
+
+ if (!(structuredSelection.getFirstElement() instanceof ICdmBase)) {
+ showEmptyPage();
+ return;
+ }
+ if (structuredSelection.getFirstElement() instanceof TermBase) {
+ setEnabled(TermBasePropertyTester.isModifiable(structuredSelection.getFirstElement()));
}
- else if(structuredSelection.getFirstElement() instanceof TermDto
- || structuredSelection.getFirstElement() instanceof TermVocabularyDto
- || structuredSelection.getFirstElement() instanceof TermNodeDto){
- showViewer(structuredSelection, activePart, viewer);
- return;
- }
-
-
- if(!(structuredSelection.getFirstElement() instanceof ICdmBase)){
- showEmptyPage();
- return;
- }
- showViewer(structuredSelection, activePart, viewer);
- ((SupplementalDataViewerE4)viewer).setEnabled(isEnabled());
-
- return;
- }
- else{
- showEmptyPage();
- return;
- }
- }
+ showViewer(structuredSelection, activePart, viewer);
+ viewer.setEnabled(isEnabled());
+
+ return;
+ } else {
+ showEmptyPage();
+ return;
+ }
+ }
@Override
protected void showEmptyPage() {
super.showEmptyPage();
- if(viewer!=null && viewer.getControl()!=null && !viewer.getControl().isDisposed()){
- try{
- ((SupplementalDataViewerE4)viewer).destroySections();
- }catch (SWTException e){
- if (PreferencesUtil.isShowUpWidgetIsDisposedMessages() && e.getMessage().equals("Widget is disposed")){
- MessagingUtils.errorDialog("Widget is disposed",
- null,
- MessagingUtils.WIDGET_IS_DISPOSED_MESSAGE,
- null,
- e,
- true);
+ if (viewer != null && viewer.getControl() != null && !viewer.getControl().isDisposed()) {
+ try {
+ viewer.destroySections();
+ } catch (SWTException e) {
+ if (PreferencesUtil.isShowUpWidgetIsDisposedMessages() && e.getMessage().equals("Widget is disposed")) {
+ MessagingUtils.errorDialog("Widget is disposed", null, MessagingUtils.WIDGET_IS_DISPOSED_MESSAGE,
+ null, e, true);
}
- }
+ }
}
}
- @Override
+ @Override
protected String getViewName() {
- return Messages.SupplementalDataViewPart_VIEWER_NAME;
- }
+ return Messages.SupplementalDataViewPart_VIEWER_NAME;
+ }
- @Inject
+ @Inject
@Optional
- private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_SUPPLEMENTAL)boolean refresh){
- if(refresh){
+ private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_SUPPLEMENTAL) boolean refresh) {
+ if (refresh) {
viewer.refresh();
}
}
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
import eu.etaxonomy.cdm.model.reference.ISourceable;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.cdm.persistence.dto.IAnnotatableDto;
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
import eu.etaxonomy.taxeditor.model.IElementHasDetails;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.element.RootElement;
import eu.etaxonomy.taxeditor.ui.section.media.MediaSection;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationDtoSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseDtoSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.CdmBaseSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.CreditSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.ExtensionSection;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineDtoSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.HeadlineSection;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.MarkerDtoSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.MarkerSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.SourceSection;
destroySections();
//1. Headline
- createHeadlineSection(rootElement);
+ if (input instanceof IAnnotatableDto) {
+ createHeadlineDtoSection(rootElement);
+ }else {
+ createHeadlineSection(rootElement);
+ }
//2. Annotatable entitiy
- if(input instanceof AnnotatableEntity){
+ if(input instanceof AnnotatableEntity ){
createAnnotationSections(rootElement);
}
+ if(input instanceof IAnnotatableDto ){
+ createAnnotationDtoSections(rootElement);
+ }
//3. Identifiable entity
if(input instanceof IdentifiableEntity){
createIdentifiableSections(rootElement);
createVersionSection(rootElement);
}
//6. CdmBase
- if(showDebug){
- createCdmBaseSection(rootElement);
+ if(showDebug ){
+ if (input instanceof IAnnotatableDto) {
+ createCdmBaseDtoSection(rootElement);
+ }else {
+ createCdmBaseSection(rootElement);
+ }
}
layout();
addPart(headlineSection);
}
+ private void createHeadlineDtoSection(RootElement parent){
+ HeadlineDtoSection headlineSection = formFactory.createHeadlineDtoSection(parent);
+ addPart(headlineSection);
+ }
+
private void createSourceSection(RootElement parent){
int expandStyle = StoreUtil.getSectionStyle(SourceSection.class, getInput().getClass().getCanonicalName(), false);
- SourceSection sourceSection = formFactory.createSourceSection(getConversationHolder(), parent, expandStyle);
+ SourceSection sourceSection = formFactory.createSourceSection(parent, expandStyle);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(sourceSection);
}
private void createAnnotationSections(RootElement parent) {
int expandStyle = StoreUtil.getSectionStyle(AnnotationSection.class, getInput().getClass().getCanonicalName(), false);
- AnnotationSection annotationSection = formFactory.createAnnotationSection(getConversationHolder(), parent, expandStyle);
+ AnnotationSection annotationSection = formFactory.createAnnotationSection(parent, expandStyle);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
expandStyle = StoreUtil.getSectionStyle(MarkerSection.class, getInput().getClass().getCanonicalName(), false);
- MarkerSection markerSection = formFactory.createMarkerSection(getConversationHolder(), parent, expandStyle);
+ MarkerSection markerSection = formFactory.createMarkerSection(parent, expandStyle);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
}
+ private void createAnnotationDtoSections(RootElement parent) {
+ int expandStyle = StoreUtil.getSectionStyle(AnnotationSection.class, getInput().getClass().getCanonicalName(), false);
+ AnnotationDtoSection annotationSection = formFactory.createAnnotationDtoSection(parent, expandStyle);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ expandStyle = StoreUtil.getSectionStyle(MarkerSection.class, getInput().getClass().getCanonicalName(), false);
+ MarkerDtoSection markerSection = formFactory.createMarkerDtoSection(parent, expandStyle);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ addPart(annotationSection);
+ addPart(markerSection);
+
+ }
private void createIdentifiableSections(RootElement parent) {
int expandStyle = StoreUtil.getSectionStyle(SourceSection.class, getInput().getClass().getCanonicalName(), false);
- SourceSection sourceSection = formFactory.createSourceSection(getConversationHolder(), parent, expandStyle);
+ SourceSection sourceSection = formFactory.createSourceSection(parent, expandStyle);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
expandStyle = StoreUtil.getSectionStyle(IdentifierSection.class, getInput().getClass().getCanonicalName(), false);
- IdentifierSection identifierSection = formFactory.createIdentifierDetailSection(getConversationHolder(), parent, expandStyle);
+ IdentifierSection identifierSection = formFactory.createIdentifierDetailSection(parent, expandStyle);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
expandStyle = StoreUtil.getSectionStyle(ExtensionSection.class, getInput().getClass().getCanonicalName(), false);
- ExtensionSection extensionSection = formFactory.createExtensionSection(getConversationHolder(), parent, expandStyle);
+ ExtensionSection extensionSection = formFactory.createExtensionSection(parent, expandStyle);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
expandStyle = StoreUtil.getSectionStyle(CreditSection.class, getInput().getClass().getCanonicalName(), false);
- CreditSection creditSection = formFactory.createCreditSection(getConversationHolder(), parent, expandStyle);
+ CreditSection creditSection = formFactory.createCreditSection(parent, expandStyle);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
expandStyle = StoreUtil.getSectionStyle(RightsSection.class, getInput().getClass().getCanonicalName(), false);
- RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, expandStyle);
+ RightsSection rightsSection = formFactory.createRightsSection(parent, expandStyle);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
private void createIdentifiableMediaSections(RootElement parent) {
int expandStyle = StoreUtil.getSectionStyle(MediaSection.class, getInput().getClass().getCanonicalName(), false);
- MediaSection mediaSection = formFactory.createMediaSection(getConversationHolder(), parent, expandStyle);
+ MediaSection mediaSection = formFactory.createMediaSection(parent, expandStyle);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(mediaSection);
}
-
+
private void createVersionSection(RootElement parent){
VersionSection versionSection = formFactory.createVersionSection(parent, ExpandableComposite.NO_TITLE);
addPart(versionSection);
addPart(cdmBaseSection);
}
- @Override
- public void update(CdmDataChangeMap arg0) {
- }
+ private void createCdmBaseDtoSection(RootElement parent) {
+ CdmBaseDtoSection cdmBaseSection = formFactory.createCdmBaseDtoSection(parent, ExpandableComposite.NO_TITLE);
+ addPart(cdmBaseSection);
+ }
@Inject
@Optional
* 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.editor.view.checklist;
+package eu.etaxonomy.taxeditor.view.remoteserver;
import java.util.List;
import org.eclipse.jface.viewers.Viewer;
/**
- * @author a.oppermann
- * @created 30.04.2014
+ * <p>CdmDataSourceContentProvider class.</p>
+ *
+ * @author n.hoffmann
+ * @created 14.04.2009
*/
-public class ChecklistContentProvider implements IStructuredContentProvider {
+public class CdmRemoteServerContentProvider implements IStructuredContentProvider {
- /**
- * <p>dispose</p>
- */
@Override
public void dispose() {
-
}
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
}
@Override
}
return new Object[]{};
}
-}
+}
\ No newline at end of file
--- /dev/null
+/**
+* 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.remoteserver;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+import eu.etaxonomy.cdm.config.ICdmSource;
+import eu.etaxonomy.cdm.database.DatabaseTypeEnum;
+import eu.etaxonomy.cdm.database.ICdmDataSource;
+import eu.etaxonomy.cdm.model.metadata.CdmMetaDataPropertyName;
+import eu.etaxonomy.taxeditor.model.ImageResources;
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfo;
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfoConfig;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * <p>CdmDataSourceLabelProvider class.</p>
+ *
+ * @author n.hoffmann
+ * @created 14.04.2009
+ */
+public class CdmRemoteServerLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ /** {@inheritDoc} */
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ CdmServerInfoConfig serverInfo = (CdmServerInfoConfig) element;
+
+
+ switch (columnIndex){
+ case 0:
+ return serverInfo.getName();
+ case 1:
+ return serverInfo.getServer();
+ case 2:
+ return serverInfo.getPort() != null?String.valueOf(serverInfo.getPort()): "";
+ case 3:
+ return serverInfo.getPrefix();
+ case 4:
+ return String.valueOf(!serverInfo.isIgnoreCdmLibVersion());
+ }
+ return null;
+ }
+
+
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+}
--- /dev/null
+/**
+* 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.remoteserver;
+
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.Focus;
+import org.eclipse.e4.ui.di.UIEventTopic;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.services.EMenuService;
+import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfoConfig;
+import eu.etaxonomy.taxeditor.view.remoteserver.common.CdmRemoteServerRepository;
+import eu.etaxonomy.taxeditor.view.remoteserver.common.CdmRemoteServerViewerComparator;
+import eu.etaxonomy.taxeditor.view.remoteserver.wizard.CdmRemoteServerWizard;
+
+/**
+ * @author kluther
+ * @date 20.01.2023
+ */
+public class CdmRemoteServerViewPart {
+
+ // private static final Logger logger = LogManager.getLogger(CdmRemoteServerViewPart.class);
+
+ @Inject
+ private UISynchronize sync;
+
+
+
+ private class RemoteServerJob extends Job{
+
+ private final List<CdmServerInfoConfig> cdmSources;
+
+ public RemoteServerJob(String title, List<CdmServerInfoConfig> cdmSources) {
+ super(title);
+ this.cdmSources = cdmSources;
+ }
+
+ @Override
+ public IStatus run(final IProgressMonitor monitor) {
+ try{
+ //logger.debug("Begin of eclipse core runtime Job to Retrieve datasources"); //$NON-NLS-1$
+ monitor.beginTask("Retrieving datasources", cdmSources.size() + 1); //$NON-NLS-1$
+
+
+
+ sync.asyncExec(()->viewer.setInput(this.cdmSources));
+
+ monitor.worked(1);
+
+ for(final CdmServerInfoConfig container : cdmSources){
+ sync.asyncExec(()-> {
+ viewer.update(container, null);
+ }
+ );
+ monitor.worked(1);
+ }
+
+ }finally{
+ monitor.done();
+ }
+ return Status.OK_STATUS;
+ }
+ }
+
+ private TableViewer viewer;
+
+// private CdmRemoteServerViewerComparator comparator;
+
+ public CdmRemoteServerViewPart(){
+ }
+
+ private ISelectionChangedListener selectionChangedListener;
+
+ @Inject
+ private ESelectionService selService;
+
+ @PostConstruct
+ public void create(Composite parent, EMenuService menuService) {
+ // Create top composite
+ FillLayout fillLayout = new FillLayout();
+ fillLayout.marginWidth = 0;
+ fillLayout.marginHeight = 0;
+ fillLayout.type = SWT.VERTICAL;
+ parent.setLayout(fillLayout);
+
+ viewer = new TableViewer(parent, SWT.H_SCROLL
+ | SWT.V_SCROLL | SWT.FULL_SELECTION);
+
+ createColumns(viewer);
+
+ viewer.setContentProvider(new CdmRemoteServerContentProvider());
+ viewer.setLabelProvider(new CdmRemoteServerLabelProvider());
+// comparator = new CdmRemoteServerViewerComparator();
+// viewer.setComparator(comparator);
+
+ // Propagate selection from viewer
+ selectionChangedListener = (event -> selService.setSelection(event.getSelection()));
+ viewer.addSelectionChangedListener(selectionChangedListener);
+ viewer.getControl().addMouseListener(new MouseListener() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ StructuredSelection sel = (StructuredSelection) viewer.getSelection();
+ if (sel.getFirstElement() instanceof CdmServerInfoConfig) {
+ CdmServerInfoConfig container = (CdmServerInfoConfig) sel.getFirstElement();
+ Wizard wizard = new CdmRemoteServerWizard(container, CdmRemoteServerWizard.Mode.EDIT);
+ WizardDialog dialog = new WizardDialog(null, wizard);
+ int result = dialog.open();
+ if(result == IStatus.OK){
+ if(viewer != null){
+ viewer.update(container, null);
+ }
+ }
+ }
+ }
+ });
+
+ //create context menu
+ menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.local.popupmenu.remoteServerViewPart");
+
+ refresh();
+ }
+
+
+ // This will create the columns for the table
+ private void createColumns(TableViewer viewer) {
+ Table table = viewer.getTable();
+
+ String[] titles = {"Name", "Server", "Port", "Prefix", "Check version"};
+ int[] bounds = { 200, 200, 100, 50, 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);
+ column.getColumn().addSelectionListener(getSelectionAdapter(column.getColumn(), i));
+
+ if(i == 1){
+ table.setSortColumn(column.getColumn());
+ }
+ }
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ table.setSortDirection(SWT.UP);
+ }
+
+ @Inject
+ @Optional
+ private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_DATASOURCE)boolean refresh){
+ if(refresh){
+ refresh();
+ }
+ }
+
+ public void refresh(){
+ RemoteServerJob dataSourceJob = new RemoteServerJob(Messages.CdmDataSourceViewPart_1, CdmRemoteServerRepository.getAll());
+ dataSourceJob.schedule();
+ }
+
+ @Focus
+ public void setFocus() {
+ if (viewer.getControl() != null && !viewer.getControl().isDisposed()) {
+ viewer.getControl().setFocus();
+ }
+ }
+
+ public StructuredViewer getViewer() {
+ return viewer;
+ }
+
+// public IWorkbenchSiteProgressService getService() {
+// return service;
+// }
+
+ private SelectionAdapter getSelectionAdapter(final TableColumn column,
+ final int index) {
+ SelectionAdapter selectionAdapter = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+// comparator.setColumn(index);
+ int dir = viewer.getTable().getSortDirection();
+ if (viewer.getTable().getSortColumn() == column) {
+ dir = dir == SWT.UP ? SWT.DOWN : SWT.UP;
+ } else {
+ dir = SWT.DOWN;
+ }
+ viewer.getTable().setSortDirection(dir);
+ viewer.getTable().setSortColumn(column);
+ viewer.refresh();
+ }
+ };
+ return selectionAdapter;
+ }
+
+
+
+}
--- /dev/null
+/**
+ * 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.
+ *
+ * @author n.hoffmann
+ */
+package eu.etaxonomy.taxeditor.view.remoteserver.common;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import eu.etaxonomy.cdm.config.ConfigFileUtil;
+import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSourceException;
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfo;
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfoConfig;
+
+public class CdmRemoteServerRepository{
+
+ private static final String DEFAULT_REMOTE_SERVER_FILENAME = "cdm_remote_servers.json";
+
+ static List<CdmServerInfoConfig> cdmServerList = new ArrayList<>();
+
+
+
+ public static boolean delete(CdmServerInfoConfig remoteServerConfig) {
+ cdmServerList.remove(remoteServerConfig);
+ save();
+ return true;
+ }
+
+ public static Integer check(CdmServerInfoConfig remoteServerConfig) {
+
+ int index = 0;
+ for (CdmServerInfoConfig server: cdmServerList) {
+ if (server.getName().equals(remoteServerConfig.getName())) {
+ return index;
+ }
+ index++;
+ }
+ return null;
+
+ }
+
+ public static boolean add(CdmServerInfoConfig newRemoteServer) {
+// if (cdmServerList.containsKey(newRemoteServer)) {
+// return false;
+// }
+
+ cdmServerList.add(newRemoteServer);
+ return true;
+ }
+
+ public static boolean update(CdmServerInfoConfig updatedRemoteServer, String oldName) {
+ int i = 0;
+ boolean contains = false;
+ for (CdmServerInfoConfig server: cdmServerList) {
+ if (server.getName().equals(oldName)) {
+ contains = true;
+ break;
+ }
+ }
+ if (contains) {
+ cdmServerList.remove(i);
+ }
+ cdmServerList.add(i, updatedRemoteServer);
+ return true;
+ }
+
+ public static boolean moveUp(CdmServerInfoConfig updatedRemoteServer) {
+ int i = 0;
+ boolean contains = false;
+ for (CdmServerInfoConfig server: cdmServerList) {
+ if (server.getName().equals(updatedRemoteServer.getName())) {
+ contains = true;
+ break;
+ }
+ i++;
+ }
+ if (contains) {
+ cdmServerList.remove(i);
+ }
+
+ cdmServerList.add(--i, updatedRemoteServer);
+ return true;
+ }
+
+ public static boolean moveDown(CdmServerInfoConfig updatedRemoteServer) {
+ int i = 0;
+ boolean contains = false;
+ for (CdmServerInfoConfig server: cdmServerList) {
+ if (server.getName().equals(updatedRemoteServer.getName())) {
+ contains = true;
+ break;
+ }
+ i++;
+ }
+ if (contains) {
+ cdmServerList.remove(i);
+ }
+
+ cdmServerList.add(++i, updatedRemoteServer);
+ return true;
+ }
+
+ public static List<CdmServerInfoConfig> getAll() {
+ List<CdmServerInfoConfig> cdmServers = null;
+ try {
+ cdmServerList.clear();
+ File file = new File(ConfigFileUtil.perUserCdmFolderFallback(), DEFAULT_REMOTE_SERVER_FILENAME);
+ cdmServers = CdmServerInfo.loadFromConfigFile(file);
+ for (CdmServerInfoConfig server: cdmServers) {
+ cdmServerList.add(server);
+ }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return cdmServers;
+ }
+
+
+
+
+
+ /**
+ * <p>save</p>
+ *
+ * @param dataSource a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object.
+ * @param strDataSourceName a {@link java.lang.String} object.
+ * @return a {@link eu.etaxonomy.cdm.database.CdmPersistentDataSource} object.
+ * @throws CdmRemoteSourceException
+ */
+ public static boolean save() {
+ File file = new File(ConfigFileUtil.perUserCdmFolderFallback(), DEFAULT_REMOTE_SERVER_FILENAME);
+ return CdmServerInfo.saveToConfigFile(cdmServerList, file);
+ }
+
+
+
+
+
+
+
+}
--- /dev/null
+/**
+* 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.remoteserver.common;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+
+import eu.etaxonomy.cdm.config.ICdmSource;
+import eu.etaxonomy.cdm.database.ICdmDataSource;
+import eu.etaxonomy.cdm.model.metadata.CdmMetaDataPropertyName;
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfoConfig;
+
+/**
+ * @author n.hoffmann
+ * @created Dec 8, 2010
+ */
+public class CdmRemoteServerViewerComparator extends ViewerComparator {
+
+ private int propertyIndex;
+ private static final int DESCENDING = 1;
+ private int direction = DESCENDING;
+
+ public CdmRemoteServerViewerComparator() {
+ this.propertyIndex = 1;
+ direction = DESCENDING;
+ }
+
+ public void setColumn(int column) {
+ if (column == this.propertyIndex) {
+ // Same column as last sort; toggle the direction
+ direction = 1 - direction;
+ } else {
+ // New column; do an ascending sort
+ this.propertyIndex = column;
+ direction = DESCENDING;
+ }
+ }
+
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ CdmServerInfoConfig d1 = (CdmServerInfoConfig) e1;
+ CdmServerInfoConfig d2 = (CdmServerInfoConfig) e2;
+
+
+
+ int result = 0;
+
+ switch (propertyIndex) {
+
+ case 4:
+ //port
+ if (d1.getPort() == d2.getPort()) {
+ result = 0;
+ }else if (d1.getPort() > d2.getPort()) {
+ result = 1;
+ }else {
+ result = -1;
+ }
+ break;
+ case 3:
+ // prefix
+ result = d1.getPrefix().compareTo(d2.getPrefix());
+ break;
+ case 2:
+ //server
+ String server1 = d1.getServer();
+ String server2 = d2.getServer();
+
+ result = server1.compareTo(server2);
+ break;
+ default:
+ result = d1.getName().compareTo(d2.getName());
+ }
+
+ // If descending order, flip the direction
+ if (direction == DESCENDING) {
+ result = -result;
+ }
+ return result;
+ }
+}
--- /dev/null
+/**
+* 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.remoteserver.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfoConfig;
+import eu.etaxonomy.taxeditor.view.remoteserver.CdmRemoteServerViewPart;
+
+/**
+ * @author kluther
+ * @date 23.01.2023
+ */
+public abstract class AbstractRemoteServerHandler {
+
+ protected UISynchronize sync;
+
+ @Execute
+ public void execute(
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ @Named(IServiceConstants.ACTIVE_PART)MPart thisPart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ UISynchronize sync) {
+
+ this.sync = sync;
+
+ CdmRemoteServerViewPart view = (CdmRemoteServerViewPart) thisPart.getObject();
+
+ boolean refresh = specificExecute(view,
+ (CdmServerInfoConfig) selection.getFirstElement(), shell);
+
+ if(refresh) {
+ view.refresh();
+ }
+ }
+
+ @CanExecute
+ public boolean canExecute(
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart thisPart,
+ MHandledMenuItem menuItem) {
+ boolean canExecute = false;
+ canExecute = thisPart.getObject() instanceof CdmRemoteServerViewPart
+ && selection!=null
+ && selection.size()==1
+ && selection.getFirstElement() instanceof CdmServerInfoConfig;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+ public abstract boolean specificExecute(CdmRemoteServerViewPart dataSourceViewPart, CdmServerInfoConfig container, Shell shell);
+}
--- /dev/null
+/**
+* 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.remoteserver.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.view.remoteserver.CdmRemoteServerViewPart;
+import eu.etaxonomy.taxeditor.view.remoteserver.wizard.CdmRemoteServerWizard;
+
+/**
+ * @author pplitzner
+ * @date 22.08.2017
+ */
+public class CreateRemoteServerHandler {
+
+ @Execute
+ public void execute(
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ @Named(IServiceConstants.ACTIVE_PART)MPart thisPart) {
+
+ CdmRemoteServerViewPart view = (CdmRemoteServerViewPart) thisPart.getObject();
+
+ CdmRemoteServerWizard wizard = new CdmRemoteServerWizard();
+
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+
+ boolean refresh = dialog.open() == IStatus.OK;
+
+ if(refresh) {
+ view.refresh();
+ }
+ }
+
+ @CanExecute
+ public boolean canExecute(
+ @Named(IServiceConstants.ACTIVE_PART)MPart thisPart,
+ MHandledMenuItem menuItem) {
+ boolean canExecute = false;
+ canExecute = thisPart.getObject() instanceof CdmRemoteServerViewPart;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
--- /dev/null
+/**
+* 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.remoteserver.handler;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfoConfig;
+import eu.etaxonomy.taxeditor.view.remoteserver.CdmRemoteServerViewPart;
+import eu.etaxonomy.taxeditor.view.remoteserver.common.CdmRemoteServerRepository;
+
+/**
+ *
+ * @author pplitzner
+ * @date 22.08.2017
+ *
+ */
+public class DeleteRemoteServerHandler extends AbstractRemoteServerHandler {
+
+
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean specificExecute(CdmRemoteServerViewPart dataSourceViewPart, CdmServerInfoConfig container, Shell shell) {
+ if(! MessageDialog.openConfirm(shell, "Confirm Deletion", "Do you want to delete the selected datasources?")){
+ return false;
+ }
+ CdmRemoteServerRepository.delete(container);
+
+ return true;
+ }
+
+}
--- /dev/null
+/**
+* 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.remoteserver.handler;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfoConfig;
+import eu.etaxonomy.taxeditor.view.remoteserver.CdmRemoteServerViewPart;
+import eu.etaxonomy.taxeditor.view.remoteserver.wizard.CdmRemoteServerWizard;
+
+/**
+ * @author k.luther
+ * @date 23.01.2023
+ *
+ */
+public class EditRemoteServerHandler extends AbstractRemoteServerHandler {
+
+ @Override
+ public boolean specificExecute(CdmRemoteServerViewPart remoteServerViewPart, CdmServerInfoConfig container, Shell shell) {
+
+ Wizard wizard = new CdmRemoteServerWizard(container, CdmRemoteServerWizard.Mode.EDIT);
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+
+ int result = dialog.open();
+
+ if(result == IStatus.OK){
+ if(remoteServerViewPart != null){
+
+ remoteServerViewPart.getViewer().update(container, null);
+ }
+ }
+
+ return false;
+ }
+}
\ No newline at end of file
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2023 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.remoteserver.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfoConfig;
+import eu.etaxonomy.taxeditor.view.remoteserver.CdmRemoteServerViewPart;
+import eu.etaxonomy.taxeditor.view.remoteserver.common.CdmRemoteServerRepository;
+
+/**
+ * @author k.luther
+ * @date 12.04.2023
+ *
+ */
+public class MoveDownRemoteServerHandler extends AbstractRemoteServerHandler{
+ @Override
+ @CanExecute
+ public boolean canExecute(
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart thisPart,
+ MHandledMenuItem menuItem) {
+ boolean canExecute = false;
+ canExecute = thisPart.getObject() instanceof CdmRemoteServerViewPart
+ && selection!=null
+ && selection.size()==1
+ && selection.getFirstElement() instanceof CdmServerInfoConfig
+ && CdmRemoteServerRepository.check((CdmServerInfoConfig)selection.getFirstElement()) < CdmRemoteServerRepository.getAll().size()-1;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+ @Override
+ public boolean specificExecute(CdmRemoteServerViewPart dataSourceViewPart, CdmServerInfoConfig container,
+ Shell shell) {
+ CdmRemoteServerRepository.moveDown(container);
+ CdmRemoteServerRepository.save();
+ return true;
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2023 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.remoteserver.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfoConfig;
+import eu.etaxonomy.taxeditor.view.remoteserver.CdmRemoteServerViewPart;
+import eu.etaxonomy.taxeditor.view.remoteserver.common.CdmRemoteServerRepository;
+
+/**
+ * @author k.luther
+ * @date 12.04.2023
+ *
+ */
+public class MoveUpRemoteServerHandler extends AbstractRemoteServerHandler{
+
+
+ @Override
+ @CanExecute
+ public boolean canExecute(
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart thisPart,
+ MHandledMenuItem menuItem) {
+ boolean canExecute = false;
+ canExecute = thisPart.getObject() instanceof CdmRemoteServerViewPart
+ && selection!=null
+ && selection.size()==1
+ && selection.getFirstElement() instanceof CdmServerInfoConfig
+ && CdmRemoteServerRepository.check((CdmServerInfoConfig)selection.getFirstElement()) > 0;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+
+
+ @Override
+ public boolean specificExecute(CdmRemoteServerViewPart dataSourceViewPart, CdmServerInfoConfig container,
+ Shell shell) {
+ CdmRemoteServerRepository.moveUp(container);
+ CdmRemoteServerRepository.save();
+ return true;
+ }
+
+}
--- /dev/null
+/**
+* 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.remoteserver.wizard;
+
+import org.eclipse.jface.wizard.Wizard;
+
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfoConfig;
+import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
+import eu.etaxonomy.taxeditor.view.remoteserver.common.CdmRemoteServerRepository;
+
+/**
+ *
+ * @author n.hoffmann
+ * @author k.luther
+ * @created 23.03.2023
+ */
+public class CdmRemoteServerWizard extends Wizard {
+
+ private CdmRemoteServerWizardPage remoteServerPage;
+
+ private CdmServerInfoConfig remoteServer;
+ private String oldName;
+
+ public enum Mode {
+ CREATE,
+ EDIT,
+ CLONE
+ }
+
+ // default mode is to create a new remote server
+ Mode mode = Mode.EDIT;
+
+ public CdmRemoteServerWizard() {
+ super();
+ this.mode = Mode.CREATE;
+ setForcePreviousAndNextButtons(false);
+ setWindowTitle("Remote Server Dialog");
+ }
+
+ public CdmRemoteServerWizard(CdmServerInfoConfig remoteServer, Mode mode) {
+ super();
+ if(remoteServer != null){
+ this.mode = mode;
+ this.remoteServer = remoteServer;
+ this.oldName = remoteServer.getName();
+ } else {
+ this.remoteServer = new CdmServerInfoConfig();
+ this.remoteServer.setName("");
+ }
+ setWindowTitle("Remote Server Dialog");
+ }
+
+ @Override
+ public void addPages() {
+ if (remoteServer != null) {
+
+ remoteServerPage = new CdmRemoteServerWizardPage(remoteServer.getName(), remoteServer, mode);
+ }else {
+ remoteServerPage = new CdmRemoteServerWizardPage("New remote server", remoteServer, mode);
+ }
+ this.addPage(remoteServerPage);
+ return;
+
+ }
+
+ @Override
+ public boolean performFinish() {
+ try {
+ CdmServerInfoConfig cdmServerConf = this.remoteServerPage.getRemoteServer();
+ if (mode.equals(Mode.CREATE) && CdmRemoteServerRepository.check(cdmServerConf)!= null) {
+ while(CdmRemoteServerRepository.check(cdmServerConf) != null){
+ cdmServerConf.setName(cdmServerConf.getName()+ 1);
+ }
+
+ boolean confirm = MessagingUtils.confirmDialog("Servername already in use", "This servername is already in use, the new remote server will be called: "+ cdmServerConf.getName()+"\n Do you want to continue?");
+ if (!confirm) {
+ return false;
+ }
+ }
+ if (mode.equals(Mode.CREATE)) {
+ CdmRemoteServerRepository.add(cdmServerConf);
+// }else {
+// CdmRemoteServerRepository.update(cdmServerConf, this.oldName);
+ }
+ CdmRemoteServerRepository.save();
+ return true;
+ } catch (Throwable e) {
+ MessagingUtils.errorDialog("Error when persisting change",
+ this,
+ e.getMessage(),
+ TaxeditorStorePlugin.PLUGIN_ID,
+ e,
+ true);
+ return false;
+ }
+ }
+
+ @Override
+ public boolean canFinish() {
+ return remoteServerPage.isPageComplete();
+
+ }
+}
\ No newline at end of file
--- /dev/null
+/**
+* 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.remoteserver.wizard;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+
+import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfoConfig;
+
+/**
+ * <p>Abstract CdmDataSourceCredentialsWizardPage class.</p>
+ *
+ * @author k.luther
+ * @created 23.01.2023
+ */
+public class CdmRemoteServerWizardPage extends WizardPage implements ModifyListener, SelectionListener {
+ private CdmServerInfoConfig remoteServer;
+
+ protected Text text_name;
+ protected Text text_server;
+ protected Text text_port;
+ protected Text text_prefix;
+
+ protected Button checkIgnoreCdmLibVersion;
+
+ protected Composite composite;
+
+ protected Composite parent;
+
+ protected String name;
+ protected String server;
+ protected String port;
+ protected String prefix;
+ protected Boolean checkCdmLibVersion;
+ CdmRemoteServerWizard.Mode mode;
+
+ /**
+ * <p>Constructor for CdmDataSourceCredentialsWizardPage.</p>
+ *
+ * @param pageName a {@link java.lang.String} object.
+ */
+ protected CdmRemoteServerWizardPage(String pageName, CdmServerInfoConfig remoteServer) {
+ super(pageName);
+ this.setPageComplete(false);
+ this.remoteServer = remoteServer;
+ mode = CdmRemoteServerWizard.Mode.CREATE;
+ }
+
+ /**
+ * <p>Constructor for CdmDataSourceCredentialsWizardPage.</p>
+ *
+ * @param pageName a {@link java.lang.String} object.
+ */
+ public CdmRemoteServerWizardPage(String pageName, CdmServerInfoConfig remoteServer, CdmRemoteServerWizard.Mode mode) {
+ super(pageName);
+ this.setPageComplete(false);
+
+ this.mode = mode;
+ if(mode == CdmRemoteServerWizard.Mode.CLONE ) {
+ this.remoteServer = new CdmServerInfoConfig(remoteServer.getName(), remoteServer.getServer(), remoteServer.getPort(), remoteServer.getPrefix(),remoteServer.isIgnoreCdmLibVersion());
+ } else if (mode == CdmRemoteServerWizard.Mode.CREATE){
+ this.remoteServer = new CdmServerInfoConfig("");
+ //CdmRemoteServerRepository.add(this.remoteServer);
+ } else {
+ this.remoteServer = remoteServer;
+ }
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ this.parent = parent;
+
+ // Create top-level composite
+ parent.setLayout(new GridLayout());
+ composite = new Composite(parent, SWT.NONE);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false,2,5));
+ GridLayout formLayout = new GridLayout();
+ formLayout.numColumns = 2;
+ composite.setLayout(formLayout);
+
+ // Create composite for data source name
+ Composite editRemoteServerComposite = new Composite(composite, SWT.NONE);
+ GridData remoteServerGridData = new GridData(SWT.FILL, SWT.TOP, true, true,2,1);
+ editRemoteServerComposite.setLayoutData(remoteServerGridData);
+ GridLayout remoteServerLayout = new GridLayout();
+ remoteServerLayout.numColumns = 2;
+ editRemoteServerComposite.setLayout(remoteServerLayout);
+
+ // Create label and input for dataSource name
+ Label remoteServerNameLabel = new Label(editRemoteServerComposite, SWT.NONE);
+ remoteServerNameLabel.setText("Name:");
+ text_name = new Text(editRemoteServerComposite, SWT.BORDER);
+ text_name.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ Label remoteServerLabel = new Label(editRemoteServerComposite, SWT.NONE);
+ remoteServerLabel.setText("Server:");
+ text_server = new Text(editRemoteServerComposite, SWT.BORDER);
+ text_server.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ Label remotePortLabel = new Label(editRemoteServerComposite, SWT.NONE);
+ remotePortLabel.setText("Port:");
+ text_port = new Text(editRemoteServerComposite, SWT.BORDER);
+ text_port.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ Label remotePrefixLabel = new Label(editRemoteServerComposite, SWT.NONE);
+ remotePrefixLabel.setText("Prefix:");
+ text_prefix = new Text(editRemoteServerComposite, SWT.BORDER);
+ text_prefix.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+
+ Composite checkCdmlibVersionComposite = new Composite(editRemoteServerComposite, SWT.NONE);
+ GridData checkCdmlibVersionGridData = new GridData(SWT.FILL, SWT.TOP, true, true,2,1);
+ checkCdmlibVersionComposite.setLayoutData(checkCdmlibVersionGridData);
+ GridLayout checkCdmlibVersionLayout = new GridLayout();
+ checkCdmlibVersionLayout.numColumns = 3;
+ checkCdmlibVersionComposite.setLayout(checkCdmlibVersionLayout);
+ Label remoteCheckCdmLibVersionLabel = new Label(checkCdmlibVersionComposite, SWT.NONE);
+ remoteCheckCdmLibVersionLabel.setText("Check cdmlib Version:");
+ checkIgnoreCdmLibVersion = new Button(checkCdmlibVersionComposite, SWT.CHECK);
+ checkIgnoreCdmLibVersion.addSelectionListener(this);
+ Label remoteCheckCdmLibVersionWarning = new Label(checkCdmlibVersionComposite, SWT.NONE);
+ remoteCheckCdmLibVersionWarning.setText("(Recommended)");
+
+ // Create composite for buttons
+ Composite buttonComposite = new Composite(composite, SWT.NONE);
+ buttonComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
+ GridLayout buttonLayout = new GridLayout();
+ buttonLayout.numColumns = 1;
+ buttonComposite.setLayout(buttonLayout);
+
+ // Create test connection button
+ Button testButton = new Button(buttonComposite, SWT.NONE);
+ testButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
+ testButton.setText("Test connection");
+
+ // Test connection when button is pressed
+ testButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean testConnection = testServerConfiguration();
+ if (testConnection) {
+ MessagingUtils.informationDialog("Connection successfull", "The connection to the server could be established successfully.");
+ }else {
+ MessagingUtils.informationDialog("Connection not successfull", "The connection to the server could not be established.");
+ }
+ }
+ });
+
+ setControl(composite);
+ init();
+ }
+
+
+
+ /**
+ * Initialize text fields
+ */
+ public void init() {
+ removeListeners();
+ if(getRemoteServer() != null && getRemoteServer().getName() != null){
+ text_name.setText(getRemoteServer().getName());
+ text_server.setText(getRemoteServer().getServer());
+ text_port.setText(getRemoteServer().getPort() != null?String.valueOf(getRemoteServer().getPort()): "");
+ text_prefix.setText(getRemoteServer().getPrefix());
+ checkIgnoreCdmLibVersion.setSelection(!getRemoteServer().isIgnoreCdmLibVersion());
+ }
+ // add listeners after setting text to avoid the modify event being called
+ // for the initial value
+ addListeners();
+
+ // in the case of cloning we use the same datasource info
+ // except for the name
+ if(mode == CdmRemoteServerWizard.Mode.CLONE) {
+ getRemoteServer().setName("");
+ text_name.setText("");
+ } else {
+ name = text_name.getText();
+ }
+ }
+
+ private void addListeners() {
+ text_name.addModifyListener(this);
+ text_server.addModifyListener(this);
+ text_port.addModifyListener(this);
+ text_prefix.addModifyListener(this);
+
+ }
+
+ private void removeListeners() {
+ text_name.removeModifyListener(this);
+ text_server.removeModifyListener(this);
+ text_port.removeModifyListener(this);
+ text_prefix.removeModifyListener(this);
+
+ }
+
+ private boolean testServerConfiguration() {
+ Socket s = new Socket();
+ try {
+ s.connect(new InetSocketAddress(remoteServer.getServer(), remoteServer.getPort()), CdmApplicationRemoteConfiguration.HTTP_READ_TIMEOUT_MIN);
+ s.close();
+ } catch (IOException e) {
+ return false;
+ }
+ return true;
+ }
+
+
+ /**
+ * <p>checkPageComplete</p>
+ */
+ public void checkPageComplete(){
+ boolean complete = true;
+
+ complete &=StringUtils.isNotBlank(text_name.getText());
+ complete &=StringUtils.isNotBlank(text_server.getText());
+ complete &=this.remoteServer.getPort() != null;
+
+ this.setPageComplete(complete);
+ }
+
+
+
+ @Override
+ public IWizardPage getNextPage() {
+ return null;
+ }
+
+ public void setRemoteServer(CdmServerInfoConfig remoteServer) {
+ this.remoteServer = remoteServer;
+ }
+
+ protected CdmServerInfoConfig getRemoteServer() {
+ return remoteServer;
+ }
+
+ public String getRemoteServerName() {
+ return name;
+ }
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ name = text_name.getText();
+ server = text_server.getText();
+ port = text_port.getText();
+ prefix = text_prefix.getText();
+ this.remoteServer.setName(name != null? name:null);
+ this.remoteServer.setIgnoreCdmLibVersion(!this.checkIgnoreCdmLibVersion.getSelection());
+ this.remoteServer.setServer(server!= null? server:null);
+ this.remoteServer.setPrefix(prefix != null?prefix:null);
+
+ text_port.setBackground(text_prefix.getBackground());
+ Integer intPort = checkAndConvertPort();
+ if (intPort == null){
+ text_port.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
+ }
+ this.remoteServer.setPort(intPort);
+ checkPageComplete();
+ }
+
+ private Integer checkAndConvertPort() {
+ Integer portInt = null;
+
+ try {
+ portInt = StringUtils.isNotBlank(port)?Integer.parseInt(port):0;
+ }catch(NumberFormatException e) {
+ return null;
+ }
+ if (portInt > 65535) {
+ return null;
+ }
+
+ return portInt;
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ this.remoteServer.setIgnoreCdmLibVersion(!checkIgnoreCdmLibVersion.getSelection());
+ checkPageComplete();
+
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+
+}
\ No newline at end of file
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.TreeNode;
import org.eclipse.swt.graphics.Image;
-import org.hibernate.LazyInitializationException;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
import eu.etaxonomy.cdm.model.term.DefinedTerm;
+import eu.etaxonomy.cdm.model.term.IdentifierType;
import eu.etaxonomy.cdm.strategy.cache.common.IdentifiableEntityDefaultCacheStrategy;
import eu.etaxonomy.cdm.strategy.cache.occurrence.DnaSampleDefaultCacheStrategy;
import eu.etaxonomy.taxeditor.model.ImageResources;
/**
* Label provider for the views to show {@link SpecimenOrObservationBase}s.<br>
- * <br>
- * <b>Note:</b> If you use this label provider you need to assure that you
- * created a {@link ConversationHolder} resp. have an open session because
- * the labels are generated from various fields of the derivate hierarchy which
- * are lazy loaded and could therefore throw a {@link LazyInitializationException}.<br>
- * Use <b>{@link #setConversation(ConversationHolder)}</b> to assign the session to this provider.
*/
public class DerivateLabelProvider extends ColumnLabelProvider {
private static Map<DerivedUnit, Collection<SpecimenTypeDesignation>> typeDesignations;
- private ConversationHolder conversation;
-
private static DefinedTerm photoTerm = null;
private static DefinedTerm drawingTerm = null;
private static DefinedTerm specimenScanTerm = null;
private static DefinedTerm detailImageTerm = null;
- private static DefinedTerm sampleDesignationTerm = null;
+ private static IdentifierType sampleDesignationTerm = null;
//FIXME: move static term getters to new singleton utility class
private static void initializeTerms() {
else if(definedTerm.getUuid().equals(UUID.fromString("31eb8d02-bf5d-437c-bcc6-87a626445f34"))){
detailImageTerm = definedTerm;
}
- else if(definedTerm.getUuid().equals(UUID.fromString("fadeba12-1be3-4bc7-9ff5-361b088d86fc"))){
- sampleDesignationTerm = definedTerm;
+ }
+ List<IdentifierType> identifierTypes = CdmStore.getTermManager().getPreferredTerms(IdentifierType.class);
+ for (IdentifierType identifierType : identifierTypes) {
+ if(identifierType.getUuid().equals(UUID.fromString("fadeba12-1be3-4bc7-9ff5-361b088d86fc"))){
+ sampleDesignationTerm = identifierType;
}
}
}
return detailImageTerm;
}
- public static DefinedTerm getSampleDesignationTerm(){
+ public static IdentifierType getSampleDesignationTerm(){
if(sampleDesignationTerm==null){
initializeTerms();
}
return getDerivateText(element);
}
- public void setConversation(ConversationHolder conversation) {
- this.conversation = conversation;
- }
-
- public String getDerivateText(Object element){
- return getDerivateText(element, conversation);
- }
-
//Note AM: not sure what this method is really used for, why do we need an explicit
// formatting for those few use-cases where this is used?
- public static String getDerivateText(Object element, ConversationHolder conversation){
+ public static String getDerivateText(Object element){
//TODO: use list of strings to assemble labels to avoid adding the separator every time and to allow null values
TreeNode parentNode = null;
TreeNode node = null;
derivate = node.getValue();
}
- if(conversation!=null){
- conversation.bind();
- }
-
final String emptyString = StringUtils.EMPTY;
final String separator = " ";
public static Identifier getCurrentSampleDesignation(CdmBase entity) {
if(entity.isInstanceOf(DnaSample.class)){
DnaSample dnaSample = HibernateProxyHelper.deproxy(entity, DnaSample.class);
- return dnaSample.getIdentifier(DefinedTerm.uuidSampleDesignation);
+ return dnaSample.getIdentifier(IdentifierType.uuidSampleDesignation);
}
else if(entity.isInstanceOf(Sequence.class)){
Sequence sequence = HibernateProxyHelper.deproxy(entity, Sequence.class);
*/
package eu.etaxonomy.taxeditor.view.search.facet;
+import org.apache.commons.lang3.StringUtils;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
content.setLayout(gl_content);
Label label = new Label(content, SWT.NONE);
- label.setText(facet.getFacet());
+ label.setText(StringUtils.replace(facet.getFacet(), "&", "&&"));
GridDataFactory.fillDefaults().applyTo(label);
}
import java.util.Set;
import java.util.TreeMap;
+import org.apache.commons.lang3.StringUtils;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;
categoryToFacetsMap.put(category, categoryFacets);
}
for (Entry<String, List<Facet>> entry: categoryToFacetsMap.entrySet()) {
- String category = entry.getKey();
+ String category = StringUtils.replace(entry.getKey(), "&", "&&");
// create group
Group group = new Group(composite.getFilterListComposite(), SWT.NONE);
group.setLayout(new GridLayout());
+
+
+
GridDataFactory.fillDefaults().applyTo(group);
group.setText(category!=null?category:"None");
// fill group with facet filters
private Set<Facet> createResults(List<S> results) {
Set<Facet> facets = new HashSet<>();
searchResultComposites.clear();
+
+
+
for (S result : results) {
CheckBoxSearchResultComposite checkComp = createResultComposite(result, composite.getSearchResultComposite());
/**
* @author pplitzner
* @since Jan 22, 2019
- *
*/
public class OccurrenceSearchController extends SearchController<OccurrenceSearchResult, DerivedUnitDTO> {
String label2 = o2.getContent().getLabel();
return StoreUtil.compareBySearchString(searchString, label1, label2);
}
-
};
}
protected List<OccurrenceSearchResult> getSelectedResults() {
return null;
}
-
-}
+}
\ No newline at end of file
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
+import java.util.stream.Collectors;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import eu.etaxonomy.cdm.api.service.IVocabularyService;
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.model.term.VocabularyEnum;
import eu.etaxonomy.cdm.persistence.dto.AbstractTermDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
}
@Override
- protected List<TermSearchResult> searchResults(String searchString){
+ protected List<TermSearchResult> searchResults(String searchString) {
List<TermSearchResult> searchResults = new ArrayList<>();
- if(CdmUtils.isNotBlank(searchString)){
- TermType type = term!= null ? term.getTermType():null;
- Collection<TermDto> dtos = CdmStore.getService(ITermService.class).findByTitleAsDtoWithVocDto(searchString, type);
+ if (CdmUtils.isNotBlank(searchString)) {
+ TermType type = term != null ? term.getTermType() : null;
+ Collection<TermDto> dtos = CdmStore.getService(ITermService.class).findByTitleAsDtoWithVocDto(searchString,
+ type);
dtos.remove(term);
- dtos.stream().forEach(dto->searchResults.add(new TermSearchResult(dto)));
- if (page != null){
- Collection<TermVocabularyDto> vocDtos = CdmStore.getService(IVocabularyService.class).findVocabularyDtoByTermTypeAndPattern(searchString, type);
- vocDtos.stream().forEach(vocDto->searchResults.add(new TermSearchResult(vocDto)));
+
+ if (this.page != null && this.page.isSkipStandartVocs()) {
+ Collection<TermDto> filteredDtos = dtos.stream()
+ .filter(c -> VocabularyEnum.getVocabularyEnumByUuid(c.getVocabularyUuid()) == null)
+ .collect(Collectors.toSet());
+
+ dtos = filteredDtos;
+ }
+ if (this.page != null && this.page.isSkipManagedColls()) {
+ Collection<TermDto> filteredDtos = dtos.stream()
+ .filter(c -> !c.isManaged())
+ .collect(Collectors.toSet());
+
+ dtos = filteredDtos;
+ }
+
+
+ dtos.stream().forEach(dto -> searchResults.add(new TermSearchResult(dto)));
+ if (page != null) {
+ Collection<TermVocabularyDto> vocDtos = CdmStore.getService(IVocabularyService.class)
+ .findVocabularyDtoByTermTypeAndPattern(searchString, type);
+ if (this.page.isSkipStandartVocs()) {
+ Collection<TermVocabularyDto> filteredDtos = vocDtos.stream()
+ .filter(c -> VocabularyEnum.getVocabularyEnumByUuid(c.getUuid()) == null)
+ .collect(Collectors.toSet());
+
+ vocDtos = filteredDtos;
+ }
+ if (this.page != null && this.page.isSkipStandartVocs()) {
+ Collection<TermVocabularyDto> filteredDtos = vocDtos.stream()
+ .filter(c -> VocabularyEnum.getVocabularyEnumByUuid(c.getUuid()) == null)
+ .collect(Collectors.toSet());
+
+ vocDtos = filteredDtos;
+ }
+ if (this.page != null && this.page.isSkipManagedColls()) {
+ Collection<TermVocabularyDto> filteredDtos = vocDtos.stream()
+ .filter(c -> !c.isManaged())
+ .collect(Collectors.toSet());
+
+ vocDtos = filteredDtos;
+ }
+
+ vocDtos.stream().forEach(vocDto -> searchResults.add(new TermSearchResult(vocDto)));
}
}
return searchResults;
public void widgetSelected(SelectionEvent e) {
Button selectedComp = (Button) e.widget;
boolean selected = selectedComp.getSelection();
- for (CheckBoxSearchResultComposite<?,?> comp: getSearchResultComposites()){
+ for (CheckBoxSearchResultComposite<?, ?> comp : getSearchResultComposites()) {
comp.getBtnCheck().setSelection(false);
}
selectedComp.setSelection(selected);
- if (page != null){
+ if (page != null) {
page.setPageComplete(selected);
}
}
}
@Override
- protected void search(){
+ protected void search() {
super.search();
}
*/
package eu.etaxonomy.taxeditor.view.search.facet.term;
+import java.util.ArrayList;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import eu.etaxonomy.cdm.api.service.l10n.TermRepresentation_L10n;
+import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.term.TermType;
import eu.etaxonomy.cdm.persistence.dto.AbstractTermDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.view.search.facet.Facet;
import eu.etaxonomy.taxeditor.view.search.facet.SearchResult;
/**
* @author pplitzner
* @since Jan 24, 2019
- *
*/
public class TermSearchResult extends SearchResult<AbstractTermDto> {
@Override
protected Set<Facet> initFacets(AbstractTermDto content) {
Set<Facet> facets = new HashSet<>();
- content.localize(new TermRepresentation_L10n());
+ //this does not work!
+ List<Language> languages = new ArrayList<>();
+ languages.add(PreferencesUtil.getGlobalLanguage());
+ content.localize(new TermRepresentation_L10n(), languages);
TermType termType = content.getTermType();
+
if (content instanceof TermDto){
- facets.add(new Facet(((TermDto)content).getVocRepresentation_L10n(), termType!=null?termType.getLabel():null));
+ String vocString =((TermDto)content).getVocabularyDto() != null?((TermDto)content).getVocabularyDto().getTitleCache():null;
+ vocString = vocString != null? vocString: (termType!= null? termType.getLabel():null);
+ facets.add(new Facet(((TermDto)content).getVocabularyDto() != null?((TermDto)content).getVocabularyDto().getTitleCache():"", termType!= null?termType.getLabel():"" ));
}else{
facets.add(new Facet(content.getRepresentation_L10n(), termType!=null?termType.getLabel():null));
}
return facets;
}
-
-}
+}
\ No newline at end of file
import java.util.UUID;
import java.util.stream.Collectors;
+import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
private Collection<Image> imageBuffer;
-
-
public TermSearchResultComposite(TermSearchResult result, Composite parent, int style) {
super(result, parent, style);
-
}
@Override
image.dispose();
imageBuffer = null;
}
-
super.dispose();
}
content.setLayout(layout);
Label label = new Label(content, SWT.WRAP);
label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
- label.setText(result.getContent().getRepresentation_L10n());
+ String termLabel = CdmUtils.Nz(StringUtils.replace(result.getContent().getRepresentation_L10n(), "&", "&&"));
+ label.setText(termLabel);
label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
GridDataFactory.fillDefaults().applyTo(label);
.collect(Collectors.joining(","));
if (CdmUtils.isNotBlank(facetText)) {
Label labelFacets = new Label(content, SWT.WRAP);
- labelFacets.setText(facetText);
+ labelFacets.setText(StringUtils.replace(facetText, "&", "&&"));
labelFacets.setFont(JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT));
}
// description
}
});
lblDescription.setText(representation_L10n_text);
+ lblDescription.setText(StringUtils.replace(representation_L10n_text, "&", "&&"));
}
+
// media
if (result.getContent() instanceof TermDto){
Collection<UUID> mediaUuids = ((TermDto)result.getContent()).getMedia();
}
return content;
}
-
-
-
-
-}
+}
\ No newline at end of file
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.TableWrapData;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.taxeditor.preference.BiocaseProvideConfig;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
/**
toolkit.adapt(lblAccessPointUrl, true, true);
lblAccessPointUrl.setText("Access Point URL");
txtAccessPoint = new Combo(this, SWT.BORDER);
- txtAccessPoint.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+ TableWrapData layoutData = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
+ layoutData.maxWidth = 300;
+ txtAccessPoint.setLayoutData(layoutData);
toolkit.adapt(txtAccessPoint, true, true);
// new Label(this, SWT.NONE);
btnGbif = new Button(this, SWT.RADIO);
try {
url = new URL("https://www.biocase.org/whats_biocase/gbif_biocase.cgi");
- HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ HttpURLConnection conn;
+
+ conn = (HttpURLConnection) url.openConnection();
+
conn.setRequestProperty("Accept", "application/json");
// conn.setConnectTimeout(TIMEOUT*9);
// conn.setReadTimeout(TIMEOUT*9);
e.printStackTrace();
}
- JSONArray jsonResponseArray;
+ java.util.List<BiocaseProvideConfig> listProvider = null;
+ ObjectMapper mapper = new ObjectMapper();
try {
- jsonResponseArray =new JSONArray(response);
-
- int i = 0;
- String service_url = null;
- JSONArray dataSets = null;
-// items = new String[jsonResponseArray.length()];
- while (i<jsonResponseArray.length()){
- JSONObject object = jsonResponseArray.getJSONObject(i);
- service_url = (String) object.get("service_url");
- if (service_url != null){
- if (itemList.add(service_url)){
- dataSets = (JSONArray) object.get("datasets");
- if (service_url != null){
- int j = 0;
- while ( j < dataSets.length()){
- String title = ((JSONObject)dataSets.get(j)).getString("title");
- itemList.add(title+" - "+ service_url);
- txtAccessPoint.add(title+" - "+ service_url);
- //create object with title and service url to add as data
- txtAccessPoint.setData(title+" - "+ service_url, title);
- j++;
- }
-
- }
-
-
+ listProvider = mapper.readValue(response, new TypeReference<java.util.List<BiocaseProvideConfig>>(){});
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
-// txtAccessPoint.add(service_url);
+ int i = 0;
+ String service_url = null;
+ String[] datasets = null;
+ for (BiocaseProvideConfig conf: listProvider) {
+
+ service_url = conf.getService_url();
+ if (service_url != null){
+ if (itemList.add(service_url)){
+ int j = 0;
+ while ( j < conf.getDatasets().length){
+ String title = conf.getDatasets()[j];
+ itemList.add(title+" - "+ service_url);
+ txtAccessPoint.add(title+" - "+ service_url);
+ //create object with title and service url to add as data
+ txtAccessPoint.setData(title+" - "+ service_url, title);
+ j++;
}
-// items[i] = service_url;
+ // txtAccessPoint.add(service_url);
}
- i++;
+// items[i] = service_url;
}
-
- } catch (JSONException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ i++;
}
+
+
String biocaseProvider = PreferencesUtil.getStringValue(PreferencePredicate.BioCaseProvider.getKey());
if (biocaseProvider != null){
String items[] = biocaseProvider.split(";");
public InspectSessionsDialog(Shell parent, int style) {
super(parent, style);
setText("Inspect Active Session");
- cdmlibModelCache = CdmRemoteCacheManager.getInstance().getCdmModelGetMethodsCache();
+ cdmlibModelCache = CdmRemoteCacheManager.INSTANCE().getCdmModelGetMethodsCache();
activeSession = CdmStore.getCurrentSessionManager().getActiveSession();
if (activeSession != null){
//TODO
import org.eclipse.swt.widgets.Text;
import org.eclipse.wb.swt.SWTResourceManager;
-import eu.etaxonomy.cdm.api.cache.CdmCacherBase;
+import eu.etaxonomy.cdm.api.cache.CdmPermanentCacheBase;
import eu.etaxonomy.cdm.cache.CdmRemoteCacheManager;
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
private final ICdmEntitySessionManager cdmEntitySessionManager;
private Text txtNoOfSessions;
private Text txtNoOfCaches;
- private Text txtDefaultInMemory;
+ private Text txtPermanentInMemory;
private Text txtCdmModelInMemory;
private Text txtCdmModelOnDisk;
- private Text txtDefaultOnDisk;
+ private Text txtPermanentOnDisk;
@Inject
private ECommandService commandService;
* Create contents of the view part.
* @param parent
*/
+ @SuppressWarnings("unused")
@PostConstruct
public void createPartControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
new Label(container, SWT.NONE);
{
- Label lblDefaultCache = new Label(container, SWT.CENTER);
- lblDefaultCache.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
- lblDefaultCache.setText("Default Cache, ");
- lblDefaultCache.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
- lblDefaultCache.setAlignment(SWT.RIGHT);
+ Label lblPermanentCache = new Label(container, SWT.CENTER);
+ lblPermanentCache.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblPermanentCache.setText("Permanent Cache, ");
+ lblPermanentCache.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+ lblPermanentCache.setAlignment(SWT.RIGHT);
}
{
- Label lblDefaultInMemory = new Label(container, SWT.CENTER);
- lblDefaultInMemory.setText("in Memory : ");
- lblDefaultInMemory.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
- lblDefaultInMemory.setAlignment(SWT.RIGHT);
- lblDefaultInMemory.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ Label lblPermanentInMemory = new Label(container, SWT.CENTER);
+ lblPermanentInMemory.setText("in Memory : ");
+ lblPermanentInMemory.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+ lblPermanentInMemory.setAlignment(SWT.RIGHT);
+ lblPermanentInMemory.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
}
{
- txtDefaultInMemory = new Text(container, SWT.BORDER);
- txtDefaultInMemory.setEditable(false);
- GridData gd_txtDefaultInMemory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
- gd_txtDefaultInMemory.widthHint = 130;
- txtDefaultInMemory.setLayoutData(gd_txtDefaultInMemory);
+ txtPermanentInMemory = new Text(container, SWT.BORDER);
+ txtPermanentInMemory.setEditable(false);
+ GridData gd_txtPermanentInMemory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+ gd_txtPermanentInMemory.widthHint = 130;
+ txtPermanentInMemory.setLayoutData(gd_txtPermanentInMemory);
}
{
- Label lblDefaultOnDisk = new Label(container, SWT.CENTER);
- lblDefaultOnDisk.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
- lblDefaultOnDisk.setText("on Disk : ");
- lblDefaultOnDisk.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
- lblDefaultOnDisk.setAlignment(SWT.RIGHT);
+ Label lblPermanentOnDisk = new Label(container, SWT.CENTER);
+ lblPermanentOnDisk.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblPermanentOnDisk.setText("on Disk : ");
+ lblPermanentOnDisk.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+ lblPermanentOnDisk.setAlignment(SWT.RIGHT);
}
{
- txtDefaultOnDisk = new Text(container, SWT.BORDER);
- txtDefaultOnDisk.setEditable(false);
- txtDefaultOnDisk.setText("");
- GridData gd_txtDefaultOnDisk = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
- gd_txtDefaultOnDisk.widthHint = 130;
- txtDefaultOnDisk.setLayoutData(gd_txtDefaultOnDisk);
+ txtPermanentOnDisk = new Text(container, SWT.BORDER);
+ txtPermanentOnDisk.setEditable(false);
+ txtPermanentOnDisk.setText("");
+ GridData gd_txtPermanentOnDisk = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+ gd_txtPermanentOnDisk.widthHint = 130;
+ txtPermanentOnDisk.setLayoutData(gd_txtPermanentOnDisk);
}
{
Label lblCdmModelCache = new Label(container, SWT.CENTER);
}
}
- CdmRemoteCacheManager instance = CdmRemoteCacheManager.getInstance();
+ CdmRemoteCacheManager instance = CdmRemoteCacheManager.INSTANCE();
int cdmEnityCacheSize = CacheManager.create().getCacheNames().length;
txtNoOfCaches.setText(String.valueOf(cdmEnityCacheSize));
- Cache defaultCache = CacheManager.create().getCache(CdmCacherBase.DEFAULT_CACHE_NAME);
- txtDefaultInMemory.setText("");
- txtDefaultOnDisk.setText("");
- if(defaultCache != null) {
- FlatStatistics liveCacheStatistics = defaultCache.getStatistics();
- txtDefaultInMemory.setText(getInMemoryStats(liveCacheStatistics));
- txtDefaultOnDisk.setText(getOnDiskStats(liveCacheStatistics));
+ Cache permanentCache = CacheManager.create().getCache(CdmPermanentCacheBase.PERMANENT_CACHE_NAME);
+ txtPermanentInMemory.setText("");
+ txtPermanentOnDisk.setText("");
+ if(permanentCache != null) {
+ FlatStatistics liveCacheStatistics = permanentCache.getStatistics();
+ txtPermanentInMemory.setText(getInMemoryStats(liveCacheStatistics));
+ txtPermanentOnDisk.setText(getOnDiskStats(liveCacheStatistics));
}
Cache cdmModelGetMethodsCache = instance.getCdmModelGetMethodsCache();
txtCdmModelInMemory.setText(getInMemoryStats(liveCacheStatistics));
txtCdmModelOnDisk.setText(getOnDiskStats(liveCacheStatistics));
}
-
}
private void addSession(ICdmEntitySession session) {
import org.eclipse.swt.widgets.Tree;
import org.eclipse.wb.swt.SWTResourceManager;
-import eu.etaxonomy.cdm.api.service.IVocabularyService;
-import eu.etaxonomy.cdm.model.term.TermVocabulary;
import eu.etaxonomy.taxeditor.model.ImageResources;
-import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.combo.termvocabulary.TermVocabularyComboViewer;
/**
btnChooseOntology = new Button(composite_3, SWT.NONE);
btnChooseOntology.setImage(ImageResources.getImage(ImageResources.BROWSE_ICON));
- lblNewLabel_4 = new Label(composite_3, SWT.NONE);
- lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
- lblNewLabel_4.setText("Import Vocabulary");
-
- termVocabularyComboViewer = new TermVocabularyComboViewer(composite_3, SWT.NONE);
- termVocabularyComboViewer.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false, 1, 1));
- termVocabularyComboViewer.setInput(CdmStore.getService(IVocabularyService.class).list(TermVocabulary.class, null, null, null, null));
+// lblNewLabel_4 = new Label(composite_3, SWT.NONE);
+// lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+// lblNewLabel_4.setText("Import Vocabulary");
+//
+// termVocabularyComboViewer = new TermVocabularyComboViewer(composite_3, SWT.NONE);
+// termVocabularyComboViewer.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false, 1, 1));
+// termVocabularyComboViewer.setInput(CdmStore.getService(IVocabularyService.class).list(TermVocabulary.class, null, null, null, null));
btnRemoveVocabulary = new Button(composite_3, SWT.NONE);
btnRemoveVocabulary.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.json.JSONException;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.taxeditor.l10n.Messages;
String response = new RequestTerminologies().request();
try {
availableOntologies = TerminologyParser.parse(response);
- } catch (JSONException e) {
+ } catch (JsonProcessingException e) {
MessagingUtils.errorDialog("Loading ontologies failed", this, "Ontologies could not be found", TaxeditorStorePlugin.PLUGIN_ID, e, false);
e.printStackTrace();
}
return Status.CANCEL_STATUS;
}
final List<OntologyTermWrapper> wrapperList = new ArrayList<>();
- wrapperList.addAll(TermParser.parse(response));
+ try {
+ wrapperList.addAll(TermParser.parse(response));
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ }
if(wrapperList.isEmpty()){
MessagingUtils.informationDialog(Messages.GfBioTerminologyImportPresenter_NO_RESULTS_TITLE, Messages.GfBioTerminologyImportPresenter_NO_RESULTS_MESSAGE);
}
import org.eclipse.jface.viewers.ITreeContentProvider;
+import com.fasterxml.jackson.core.JsonProcessingException;
+
import eu.etaxonomy.taxeditor.view.webimport.termimport.parser.OntologyTermParser;
import eu.etaxonomy.taxeditor.view.webimport.termimport.requests.RequestBroader;
import eu.etaxonomy.taxeditor.view.webimport.termimport.wrapper.OntologyTermWrapper;
if(parentElement instanceof OntologyTermWrapper){
OntologyTermWrapper wrapper = (OntologyTermWrapper) parentElement;
String response = new RequestBroader(wrapper.getUri(), wrapper.getSourceTerminology()).request();
- Collection<OntologyTermWrapper> broader = OntologyTermParser.parse(response, ((OntologyTermWrapper) parentElement).getSourceTerminology());
- return broader.toArray();
+ Collection<OntologyTermWrapper> broader;
+ try {
+ broader = OntologyTermParser.parse(response, ((OntologyTermWrapper) parentElement).getSourceTerminology());
+ return broader.toArray();
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ }
+
}
return null;
}
import java.util.Collection;
import java.util.LinkedList;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import eu.etaxonomy.taxeditor.view.webimport.termimport.wrapper.HierarchyTermWrapper;
*
*/
public class HierarchyParser {
- public static Collection<HierarchyTermWrapper> parse(String response){
+ public static Collection<HierarchyTermWrapper> parse(String response) throws JsonProcessingException{
LinkedList<HierarchyTermWrapper> wrapperList = new LinkedList<>();
+ JsonNode tree = null;
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode resultNode = null;
+ HierarchyTermWrapper childTerm = null;
try {
- JSONObject jsonResponse = new JSONObject(response);
- JSONArray responseArray = ParserUtil.parseResults(jsonResponse);
- HierarchyTermWrapper childTerm = null;
- for(int i=0;i<responseArray.length();i++){
- JSONObject jsonObject = responseArray.getJSONObject(i);
- String label = ParserUtil.parseLabel(jsonObject);
- String uri= ParserUtil.parseUri(jsonObject);
- HierarchyTermWrapper hierarchyTermWrapper = new HierarchyTermWrapper(uri, label);
- wrapperList.add(hierarchyTermWrapper);
- if(childTerm!=null){
- childTerm.setParentTerm(hierarchyTermWrapper);
+ tree = mapper.readTree(response);
+ if (tree != null) {
+ resultNode =ParserUtil.parseResults(tree);
+
+ for (int i = 0; i < resultNode.size(); i++) {
+ JsonNode node = resultNode.get(i);
+ String uri = ParserUtil.parseUri(node);
+ String label = ParserUtil.parseLabel(node);
+ HierarchyTermWrapper hierarchyTermWrapper = new HierarchyTermWrapper(uri, label, null);
+ if (childTerm != null) {
+ childTerm.setParentTerm(hierarchyTermWrapper);
+ }
+ childTerm = hierarchyTermWrapper;
+ wrapperList.add(hierarchyTermWrapper);
}
- childTerm = hierarchyTermWrapper;
+
}
- } catch (JSONException jsonException) {
- jsonException.printStackTrace();
- }
+ } catch (JsonProcessingException e1) {
+
+ throw e1;
+ }
+
+
+
+
return wrapperList;
}
import java.util.Collection;
import java.util.List;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import eu.etaxonomy.taxeditor.view.webimport.termimport.wrapper.OntologyTermWrapper;
*
*/
public class OntologyTermParser {
- public static Collection<OntologyTermWrapper> parse(String response, String terminology){
+ public static Collection<OntologyTermWrapper> parse(String response, String terminology) throws JsonMappingException, JsonProcessingException{
List<OntologyTermWrapper> wrapperList = new ArrayList<>();
- try {
- JSONObject jsonResponse = new JSONObject(response);
- JSONArray responseArray = ParserUtil.parseResults(jsonResponse);
- for(int i=0;i<responseArray.length();i++){
- JSONObject jsonObject = responseArray.getJSONObject(i);
- String label = ParserUtil.parseLabel(jsonObject);
- String uriString = ParserUtil.parseUri(jsonObject);
+
+ JsonNode tree = null;
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode resultNode = null;
+
+ tree = mapper.readTree(response);
+ if (tree != null) {
+ resultNode =tree.get("results");
+ for (int i = 0; i < resultNode.size(); i++) {
+ String label = ParserUtil.parseLabel(resultNode.get(i));
+ String uriString = ParserUtil.parseUri(resultNode.get(i));
wrapperList.add(new OntologyTermWrapper(uriString, label, terminology));
}
- } catch (JSONException e) {
- e.printStackTrace();
}
return wrapperList;
}
import java.util.ArrayList;
import java.util.List;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
import eu.etaxonomy.taxeditor.view.webimport.termimport.requests.RequestTerm;
import eu.etaxonomy.taxeditor.view.webimport.termimport.wrapper.OntologyTermWrapper;
*/
public class ParserUtil {
- public static JSONArray parseResults(JSONObject jsonObject) throws JSONException{
- return jsonObject.getJSONArray("results");
+ public static JsonNode parseResults(JsonNode jsonObject) {
+ return jsonObject.get("results");
}
- public static String parseUri(JSONObject jsonObject) throws JSONException{
- return jsonObject.getString("uri");
+ public static String parseUri(JsonNode jsonObject){
+ return jsonObject.get("uri").textValue();
}
- public static String parseLabel(JSONObject jsonObject) throws JSONException{
- return jsonObject.getString("label");
+ public static String parseLabel(JsonNode jsonObject) {
+ return jsonObject.get("label").textValue();
}
- public static String parseDescription(JSONObject jsonObject) throws JSONException{
+ public static String parseDescription(JsonNode jsonObject) {
String descriptionKey = "description";
if(jsonObject.has(descriptionKey)){
- return jsonObject.getString(descriptionKey);
+ return jsonObject.get(descriptionKey).textValue();
}
return null;
}
- public static List<String> parseSynonyms(JSONObject jsonObject) throws JSONException{
+ public static List<String> parseSynonyms(JsonNode jsonObject) {
List<String> synonyms = new ArrayList<>();
String synomymKey = "synonyms";
if(jsonObject.has(synomymKey)){
- JSONArray jsonArray = jsonObject.getJSONArray(synomymKey);
- for(int i=0;i<jsonArray.length();i++){
- synonyms.add(jsonArray.getString(i));
+ JsonNode jsonArray = jsonObject.get(synomymKey);
+ for(int i=0;i<jsonArray.size();i++){
+ //TODO: check whether this is correct!!!
+ synonyms.add(jsonArray.get(i).textValue());
}
}
return synonyms;
}
- public static String parseTerminology(JSONObject jsonObject) throws JSONException {
- return jsonObject.getString("sourceTerminology");
+ public static String parseTerminology(JsonNode jsonObject){
+ return jsonObject.get("sourceTerminology").textValue();
}
/**
* Loads and sets detail information for the given wrapper
* @param wrapper the wrapper for which the detailed information will be loaded and set
+ * @throws JsonProcessingException
+ * @throws JsonMappingException
*/
- public static void loadDetails(OntologyTermWrapper wrapper) {
+ public static void loadDetails(OntologyTermWrapper wrapper) throws JsonMappingException, JsonProcessingException {
String request = new RequestTerm(wrapper.getUri(), wrapper.getSourceTerminology()).request();
OntologyTermWrapper detailTerm = TermParser.parseSingleTerm(request);
wrapper.setDescription(detailTerm.getDescription());
import java.util.Collection;
import java.util.List;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
-import eu.etaxonomy.taxeditor.view.webimport.termimport.requests.RequestTerm;
import eu.etaxonomy.taxeditor.view.webimport.termimport.wrapper.OntologyTermWrapper;
/**
*
*/
public class SuggestParser {
- public static Collection<OntologyTermWrapper> parse(String response){
+ public static Collection<OntologyTermWrapper> parse(String response) throws JsonMappingException, JsonProcessingException{
List<OntologyTermWrapper> wrapperList = new ArrayList<>();
- try {
- JSONObject jsonResponse = new JSONObject(response);
- JSONArray responseArray = ParserUtil.parseResults(jsonResponse);
- for(int i=0;i<responseArray.length();i++){
- JSONObject jsonObject = responseArray.getJSONObject(i);
- String label = ParserUtil.parseLabel(jsonObject);
- String uri= ParserUtil.parseUri(jsonObject);
- String sourceTerminology = ParserUtil.parseTerminology(jsonObject);
- String request = new RequestTerm(uri, sourceTerminology).request();
- OntologyTermWrapper wrapper = new OntologyTermWrapper(uri, label, sourceTerminology);
- wrapperList.add(wrapper);
- }
- } catch (JSONException jsonException) {
- jsonException.printStackTrace();
+ ObjectMapper mapper = new ObjectMapper();
+
+ JsonNode tree = mapper.readTree(response);
+ JsonNode resultNode = ParserUtil.parseResults(tree);
+ for(int i=0;i<resultNode.size();i++){
+ JsonNode jsonObject = resultNode.get(i);
+ String label = ParserUtil.parseLabel(jsonObject);
+ String uri= ParserUtil.parseUri(jsonObject);
+ String sourceTerminology = ParserUtil.parseTerminology(jsonObject);
+ //String request = new RequestTerm(uri, sourceTerminology).request();
+ OntologyTermWrapper wrapper = new OntologyTermWrapper(uri, label, sourceTerminology);
+ wrapperList.add(wrapper);
}
+
return wrapperList;
}
import java.util.ArrayList;
import java.util.List;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import eu.etaxonomy.taxeditor.view.webimport.termimport.wrapper.OntologyTermWrapper;
*
*/
public class TermParser {
- public static OntologyTermWrapper parseSingleTerm(String response){
- try {
- JSONObject jsonResponse = new JSONObject(response);
- JSONArray responseArray = ParserUtil.parseResults(jsonResponse);
- for(int i=0;i<responseArray.length();i++){
- JSONObject jsonObject = responseArray.getJSONObject(i);
- return createWrapper(jsonObject);
- }
- } catch (JSONException e) {
- e.printStackTrace();
+ public static OntologyTermWrapper parseSingleTerm(String response) throws JsonMappingException, JsonProcessingException{
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode resultNode = null;
+
+ JsonNode tree = mapper.readTree(response);
+ JsonNode responseNode = ParserUtil.parseResults(tree);
+ for(int i=0;i<responseNode.size();i++){
+ JsonNode jsonObject = responseNode.get(i);
+ return createWrapper(jsonObject);
}
+
return null;
}
- public static List<OntologyTermWrapper> parse(String response){
+ public static List<OntologyTermWrapper> parse(String response) throws JsonMappingException, JsonProcessingException{
List<OntologyTermWrapper> wrapperList = new ArrayList<>();
- try {
- JSONObject jsonResponse = new JSONObject(response);
- JSONArray responseArray = ParserUtil.parseResults(jsonResponse);
- for(int i=0;i<responseArray.length();i++){
- JSONObject jsonObject = responseArray.getJSONObject(i);
- wrapperList.add(createWrapper(jsonObject));
- }
- } catch (JSONException e) {
- e.printStackTrace();
+ ObjectMapper mapper = new ObjectMapper();
+
+ JsonNode tree = mapper.readTree(response);
+
+ JsonNode resultNode = ParserUtil.parseResults(tree);
+ for(int i=0;i<resultNode.size();i++){
+ JsonNode jsonObject = resultNode.get(i);
+ wrapperList.add(createWrapper(jsonObject));
}
+
return wrapperList;
}
- private static OntologyTermWrapper createWrapper(JSONObject jsonObject) throws JSONException{
+ private static OntologyTermWrapper createWrapper(JsonNode jsonObject) {
String description = ParserUtil.parseDescription(jsonObject);
String label = ParserUtil.parseLabel(jsonObject);
String uri= ParserUtil.parseUri(jsonObject);
import java.util.Collection;
import java.util.List;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import eu.etaxonomy.taxeditor.view.webimport.termimport.wrapper.TerminologyWrapper;
*
*/
public class TerminologyParser {
- public static Collection<TerminologyWrapper> parse(String response) throws JSONException{
+ public static Collection<TerminologyWrapper> parse(String response) throws JsonProcessingException {
List<TerminologyWrapper> wrapperList = new ArrayList<>();
- JSONObject jsonResponse = new JSONObject(response);
- JSONArray responseArray = jsonResponse.getJSONArray("results");
- for(int i=0;i<responseArray.length();i++){
- JSONObject jsonObject = responseArray.getJSONObject(i);
- String name = jsonObject.getString("name");
- String acronym = jsonObject.getString("acronym");
- String description = ParserUtil.parseDescription(jsonObject);
- String uri = ParserUtil.parseUri(jsonObject);
- wrapperList.add(new TerminologyWrapper(name, acronym, description, uri));
+ JsonNode tree = null;
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode resultNode = null;
+ try {
+ tree = mapper.readTree(response);
+ if (tree != null) {
+ resultNode =tree.get("results");
+
+ for (int i = 0; i < resultNode.size(); i++) {
+ JsonNode node = resultNode.get(i);
+ String name = node.get("name").textValue();
+ String acronym = node.get("acronym").textValue();
+ String description = ParserUtil.parseDescription(node);
+ String uri = ParserUtil.parseUri(node);
+ wrapperList.add(new TerminologyWrapper(name, acronym, description, uri));
+ }
+
+ }
+ } catch (JsonProcessingException e1) {
+ // TODO Auto-generated catch block
+ throw e1;
}
+
+
return wrapperList;
}
public class HierarchyTermWrapper extends TermWrapper{
private HierarchyTermWrapper parentTerm;
- public HierarchyTermWrapper(String uri, String label) {
+ public HierarchyTermWrapper(String uri, String label, HierarchyTermWrapper parentTerm) {
super(uri, label);
+ this.parentTerm = parentTerm;
}
public HierarchyTermWrapper getParentTerm() {
return parentTerm;
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* 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.
*/
import org.junit.Before;
import org.junit.Test;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.name.INonViralName;
import eu.etaxonomy.cdm.model.name.Rank;
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
// @SpringBeanByType
@SuppressWarnings("unused")
- private CdmStore cdmStore;// = CdmStore.getDefault();
-
- @SuppressWarnings("unused")
- private ConversationHolder conversation;
+ private CdmStore cdmStore;// = CdmStore.getDefault();
private INonViralName name;
@Before
public void setUp() throws Exception {
-
+
(new DefaultTermInitializer()).initialize();
-
+
name = TaxonNameFactory.NewNonViralInstance(Rank.SPECIES());
-
+
name.setGenusOrUninomial("Joe");
name.setSpecificEpithet("mama");
}
-
+
@Test
public void testProtectTitleCache(){
Assert.assertTrue(name.isProtectedTitleCache() == false);
Bundle-ManifestVersion: 2
Bundle-Name: eu.etaxonomy.taxeditor.test
Bundle-SymbolicName: eu.etaxonomy.taxeditor.test;singleton:=true
-Bundle-Version: 5.34.0
+Bundle-Version: 5.42.0
Bundle-ActivationPolicy: lazy
Bundle-Vendor: EDIT
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.34.0</version>
+ <version>5.42.0</version>
</parent>
<artifactId>eu.etaxonomy.taxeditor.test</artifactId>
<!-- for packaging=eclipse-test-plugin
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.application.CdmDataChangeService;
-import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
import eu.etaxonomy.cdm.cache.CdmRemoteCacheManager;
import eu.etaxonomy.cdm.model.permission.User;
import eu.etaxonomy.taxeditor.remoting.cache.ConversationalTransientEntityCacher;
null,
null);
CdmApplicationState.setCurrentAppConfig(remoteApplicationController);
- CdmApplicationState.setCdmServiceCacher(new CdmServiceCacher());
+ CdmApplicationState.setTermProxy(new CdmServiceCachingProxy());
cdmEntitySessionManager = getRemoteApplicationController().getCdmEntitySessionManager();
import org.junit.Test;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
-import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.taxeditor.httpinvoker.RemotingSessionAwareTest;
@SuppressWarnings("unused")
private static final Logger logger = LogManager.getLogger(CdmServiceCacherTest.class);
- private static CdmServiceCacher cdmServiceCacher = CdmApplicationState.getCdmServiceCacher();
+ private static CdmServiceCachingProxy cdmServiceCacher = CdmApplicationState.getTermProxy();
@Test
public void testLanguageCache() {
import java.util.Set;
import java.util.UUID;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Ignore;
@Ignore
public class RemoteLazyLoadingTest extends BaseRemotingTest {
- private static final Logger logger = LogManager.getLogger(RemoteLazyLoadingTest.class);
+ private static final Logger logger = LogManager.getLogger();
private static IClassificationService classificationService;
private static ITaxonService taxonService;
// Assert.assertNotNull(classification);
taxonNodes = classificationService.getAllNodes();
Assert.assertFalse(taxonNodes.isEmpty());
-
}
-
-
@Test
public void testCDMEntityGet() {
Iterator<TaxonNode> taxonNodeItr = taxonNodes.iterator();
count++;
}
-
-
}
@Test
Assert.assertEquals("Title caches should be equal",oldTitleCache,nvnOld.getTitleCache());
}
+
@Ignore
@Test
public void testCDMEntitySaveCollection() {
* @date 3 Feb 2015
*/
@DataSet
-public class TaxonNameEditorTest extends BaseOperationTest {
+public class TaxonEditorTest extends BaseOperationTest {
@SuppressWarnings("unused")
- private static final Logger logger = LogManager.getLogger(TaxonNameEditorTest.class);
+ private static final Logger logger = LogManager.getLogger();
private ITaxonNodeService taxonNodeService = getRemoteApplicationController().getTaxonNodeService();
private ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
import java.util.Set;
import java.util.UUID;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.core.commands.ExecutionException;
import org.junit.Assert;
import org.junit.Ignore;
public class TaxonNavigatorTest extends BaseOperationTest {
@SuppressWarnings("unused")
- private static final Logger logger = LogManager.getLogger(TaxonNameEditorTest.class);
+ private static final Logger logger = LogManager.getLogger();
- ITaxonNodeService taxonNodeService = getRemoteApplicationController().getTaxonNodeService();
- ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
- IClassificationService classificationService = getRemoteApplicationController().getClassificationService();
-
- Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
+ private ITaxonNodeService taxonNodeService = getRemoteApplicationController().getTaxonNodeService();
+ private ITaxonService taxonService = getRemoteApplicationController().getTaxonService();
+ private IClassificationService classificationService = getRemoteApplicationController().getClassificationService();
+ private Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
@Test
public void testChangeAcceptedTaxonToSynonym() throws ExecutionException {
Assert.assertNull(oldTaxonNode);
Assert.assertEquals(countTargetSynonyms + 1,newAcceptedTaxonNode.getTaxon().getSynonyms().size());
Assert.assertEquals(name, newAcceptedTaxonNode.getTaxon().getSynonyms().iterator().next().getName());
-
-
}
@Test
import eu.etaxonomy.cdm.io.sdd.in.SDDImportConfigurator;
import eu.etaxonomy.cdm.io.service.IIOService;
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
-import eu.etaxonomy.cdm.io.specimen.excel.in.SpecimenCdmExcelImportConfigurator;
import eu.etaxonomy.cdm.io.tcsxml.in.TcsXmlImportConfigurator;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
import eu.etaxonomy.cdm.model.name.TaxonName;
Assert.assertEquals(9,list.size());
}
- @Test
- public void importSpecimenExcel() throws IOException {
- String importFilePath = "src/test/resources/imports/SpecimenExcelImport.xls";
- SpecimenCdmExcelImportConfigurator config = SpecimenCdmExcelImportConfigurator.NewInstance(null, null);
- config.setNomenclaturalCode(NomenclaturalCode.ICNP);
- config.setDbSchemaValidation(DbSchemaValidation.CREATE);
- ImportResult result = ioService.importData(config, fileToByteArray(importFilePath), SOURCE_TYPE.URI);
- Assert.assertTrue(result.isSuccess());
-// List<SpecimenOrObservationBase> occurrences = occurrenceService.list(SpecimenOrObservationBase.class, null, null, null, null);
-// Assert.assertEquals(3,occurrences.size());
- }
+
@Test
public void importTCS() throws IOException {
+/**
+* Copyright (C) 2018 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.service;
import java.util.List;
import org.junit.Test;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
-import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.Language;
public class ServiceInterceptorTest extends RemotingSessionAwareTest {
- @SuppressWarnings("unused")
- private static final Logger logger = LogManager.getLogger(ServiceInterceptorTest.class);
- private final ITermService termService = getRemoteApplicationController().getTermService();
- private static CdmServiceCacher cdmServiceCacher = CdmApplicationState.getCdmServiceCacher();
-
-
- @Test
- public void termServiceInterceptorTest() {
- List<DefinedTermBase<?>> terms = termService.listByTermType(TermType.Language, null, null, null, null);
- int cacheLanguageSize = 0;
- List<UUID> keys = cdmServiceCacher.getDefaultCache().getKeys();
- for(UUID key : keys) {
- CdmBase cdmBase = cdmServiceCacher.getFromCache(key);
- if(cdmBase != null && cdmBase.getClass().equals(Language.class)) {
- cacheLanguageSize++;
- }else{
- System.err.println("There is no element for key" + key.toString());
- }
- }
- Assert.assertEquals(terms.size(), cacheLanguageSize);
- // TO DO : get the static termTypeMap from TermServiceRequestExecutor and check the size
- }
-}
+ @SuppressWarnings("unused")
+ private static final Logger logger = LogManager.getLogger(ServiceInterceptorTest.class);
+
+ private final ITermService termService = getRemoteApplicationController().getTermService();
+ private static CdmServiceCachingProxy cdmTermCache = CdmApplicationState.getTermProxy();
+
+
+ @Test
+ public void termServiceInterceptorTest() {
+ List<DefinedTermBase<?>> terms = termService.listByTermType(TermType.Language, null, null, null, null);
+ int cacheLanguageSize = 0;
+ List<UUID> keys = cdmTermCache.getPermanentCache().getKeys();
+ for(UUID key : keys) {
+ CdmBase cdmBase = cdmTermCache.getFromCache(key);
+ if(cdmBase != null && cdmBase.getClass().equals(Language.class)) {
+ cacheLanguageSize++;
+ }else{
+ System.err.println("There is no element for key" + key.toString());
+ }
+ }
+ Assert.assertEquals(terms.size(), cacheLanguageSize);
+ // TO DO : get the static termTypeMap from TermServiceRequestExecutor and check the size
+ }
+}
\ No newline at end of file
public void testSaveNewTermVocabulary() {
TermVocabulary<Feature> termVocabulary =
TermVocabulary.NewInstance(TermType.Feature,
+ Feature.class,
null,
"Untitled",
null,
import java.util.List;
import java.util.UUID;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
import org.junit.Assert;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.unitils.dbunit.annotation.DataSet;
@DataSet
public class CdmEntitySessionManagerTest extends RemotingSessionAwareTest {
- @SuppressWarnings("unused")
- private static final Logger logger = LogManager.getLogger(CdmEntitySessionManagerTest.class);
-
IPolytomousKeyService polytomousKeyService = getRemoteApplicationController().getPolytomousKeyService();
IPolytomousKeyNodeService polytomousKeyNodeService = getRemoteApplicationController().getPolytomousKeyNodeService();
private final UUID polytomousKeyUuid = UUID.fromString("0d53ba20-7de4-4baa-bd8a-401048447d66");
private final Language english = Language.getLanguageFromUuid(Language.uuidEnglish);
- @BeforeClass
- public static void initializeCdmEntitySessionManagerTest() {
- }
-
@Test
public void manageNullSessionTest() {
PolytomousKeyNode node = root.getChildAt(0);
List<PolytomousKeyNode> nodes = root.getChildren();
node.getStatement().getLabel(english).setText(upStatement);
-
+
MergeResult<PolytomousKey> result = polytomousKeyService.merge(key, true);
key = result.getMergedEntity();
pKeys = polytomousKeyService.list(PolytomousKey.class, null, null, null, null);
/**
* @author cmathew
* @date 15 Jun 2015
- *
*/
public class MockConversationEnabled implements IConversationEnabled {
- /* (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 new ConversationHolderMock();
}
-
-}
+}
\ No newline at end of file
<TaxonBase DTYPE="Taxon" id="2737" uuid="6b46ac55-3e39-4c37-a1b6-b680b21599b2" protectedtitlecache="false" titleCache="Pteris vittata L. sec. Cyprus" doubtful="false" usenamecache="false" taxonstatusunknown="false" name_id="2737" publish="true"/>
<TaxonBase DTYPE="Taxon" id="2738" uuid="8ac3dca2-6bbf-4cd4-84b7-53ddc2973ed8" protectedtitlecache="false" titleCache="Pteris sec. Cyprus" doubtful="false" usenamecache="false" taxonstatusunknown="false" name_id="2738" publish="true"/>
- <DescriptionBase DTYPE="TaxonDescription" id="28" uuid="f04f8f66-ad92-42d0-89bc-04ac5b36163c" protectedtitlecache="false" titleCache="Taxon description for Adiantum capillus-veneris L." imagegallery="false" taxon_id="48" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="149" uuid="24df0fca-bfc4-4f0f-a269-336985ed6e5e" protectedtitlecache="false" titleCache="Taxon description for Anogramma leptophylla (L.) Link" imagegallery="false" taxon_id="264" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="447" uuid="01863b86-c6ae-48b8-a8da-f693be9087da" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes acrostica (Balbis) Tod." imagegallery="false" taxon_id="812" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="448" uuid="aac7b184-e622-409b-8eda-e14998b9021d" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes maderensis Lowe" imagegallery="false" taxon_id="815" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="521" uuid="2d672585-0f35-42f8-9923-dfd5545e6369" protectedtitlecache="false" titleCache="Taxon description for Cosentinia vellea (Aiton) Tod." imagegallery="false" taxon_id="946" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="1234" uuid="a8a734c2-122b-4d5b-9c89-a852f4ab4661" protectedtitlecache="false" titleCache="Taxon description for Notholaena marantae (L.) Desv." imagegallery="false" taxon_id="2203" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="1524" uuid="c4e66d46-e4fb-4da2-a432-3f1cf5353b81" protectedtitlecache="false" titleCache="Taxon description for Pteris vittata L." imagegallery="false" taxon_id="2737" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="4567" uuid="dd0f7395-6162-4ce4-8ece-774011b09325" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Adiantum capillus-veneris L. sec. Cyprus" imagegallery="false" taxon_id="48" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="4627" uuid="34266202-eb5d-41ec-a0b2-da56deb11cc7" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Anogramma leptophylla (L.) Link sec. Cyprus" imagegallery="false" taxon_id="264" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="4798" uuid="504b0178-39e6-4c79-8e33-ca00b0662f27" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cheilanthes acrostica (Balbis) Tod. sec. Cyprus" imagegallery="false" taxon_id="812" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="4840" uuid="73396d11-5d35-43fb-8b15-4d472bdcdd43" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cosentinia vellea (Aiton) Tod. sec. Cyprus" imagegallery="false" taxon_id="946" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="5409" uuid="64a797b2-7f92-4012-a4f5-d76f8aaeb6b4" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Pteris vittata L. sec. Cyprus" imagegallery="false" taxon_id="2737" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="5974" uuid="71872861-8229-4cab-8042-b75dfa0e3f63" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Notholaena marantae (L.) Desv. sec. Cyprus" imagegallery="false" taxon_id="2203" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="11766" uuid="6b4be8a2-ea86-4815-bd31-b022055a90f2" protectedtitlecache="false" titleCache="Image gallery for Pteris vittata L." imagegallery="true" taxon_id="2737" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="12353" uuid="b8d3a151-032e-48d9-9191-d7b8fb1fe1a0" protectedtitlecache="false" titleCache="Image gallery for Cheilanthes acrostica (Balbis) Tod." imagegallery="true" taxon_id="812" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="12713" uuid="61fbdc1b-80bf-4aea-b6cb-8f4d466bd923" protectedtitlecache="false" titleCache="Image gallery for Adiantum capillus-veneris L." imagegallery="true" taxon_id="48" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="13728" uuid="53b3125e-2a43-4433-a4dd-50dd9a4cf92c" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="48" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="13817" uuid="7b108193-e689-417a-bcab-adaf6c49d532" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="264" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="14043" uuid="de29cc97-a160-4783-b996-b929157335d5" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="812" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="14101" uuid="815336d3-19d6-493d-9ea4-bcb320d1b922" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="946" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="14658" uuid="ce4068f8-17b0-46e2-9fbb-e8c16efb7255" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2203" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="14864" uuid="2d55f445-8e72-43d3-976a-133828e89599" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2737" isDefault="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="28" uuid="f04f8f66-ad92-42d0-89bc-04ac5b36163c" protectedtitlecache="false" titleCache="Taxon description for Adiantum capillus-veneris L." imagegallery="false" taxon_id="48" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="149" uuid="24df0fca-bfc4-4f0f-a269-336985ed6e5e" protectedtitlecache="false" titleCache="Taxon description for Anogramma leptophylla (L.) Link" imagegallery="false" taxon_id="264" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="447" uuid="01863b86-c6ae-48b8-a8da-f693be9087da" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes acrostica (Balbis) Tod." imagegallery="false" taxon_id="812" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="448" uuid="aac7b184-e622-409b-8eda-e14998b9021d" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes maderensis Lowe" imagegallery="false" taxon_id="815" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="521" uuid="2d672585-0f35-42f8-9923-dfd5545e6369" protectedtitlecache="false" titleCache="Taxon description for Cosentinia vellea (Aiton) Tod." imagegallery="false" taxon_id="946" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="1234" uuid="a8a734c2-122b-4d5b-9c89-a852f4ab4661" protectedtitlecache="false" titleCache="Taxon description for Notholaena marantae (L.) Desv." imagegallery="false" taxon_id="2203" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="1524" uuid="c4e66d46-e4fb-4da2-a432-3f1cf5353b81" protectedtitlecache="false" titleCache="Taxon description for Pteris vittata L." imagegallery="false" taxon_id="2737" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4567" uuid="dd0f7395-6162-4ce4-8ece-774011b09325" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Adiantum capillus-veneris L. sec. Cyprus" imagegallery="false" taxon_id="48" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4627" uuid="34266202-eb5d-41ec-a0b2-da56deb11cc7" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Anogramma leptophylla (L.) Link sec. Cyprus" imagegallery="false" taxon_id="264" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4798" uuid="504b0178-39e6-4c79-8e33-ca00b0662f27" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cheilanthes acrostica (Balbis) Tod. sec. Cyprus" imagegallery="false" taxon_id="812" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4840" uuid="73396d11-5d35-43fb-8b15-4d472bdcdd43" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cosentinia vellea (Aiton) Tod. sec. Cyprus" imagegallery="false" taxon_id="946" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="5409" uuid="64a797b2-7f92-4012-a4f5-d76f8aaeb6b4" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Pteris vittata L. sec. Cyprus" imagegallery="false" taxon_id="2737" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="5974" uuid="71872861-8229-4cab-8042-b75dfa0e3f63" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Notholaena marantae (L.) Desv. sec. Cyprus" imagegallery="false" taxon_id="2203" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="11766" uuid="6b4be8a2-ea86-4815-bd31-b022055a90f2" protectedtitlecache="false" titleCache="Image gallery for Pteris vittata L." imagegallery="true" taxon_id="2737" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="12353" uuid="b8d3a151-032e-48d9-9191-d7b8fb1fe1a0" protectedtitlecache="false" titleCache="Image gallery for Cheilanthes acrostica (Balbis) Tod." imagegallery="true" taxon_id="812" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="12713" uuid="61fbdc1b-80bf-4aea-b6cb-8f4d466bd923" protectedtitlecache="false" titleCache="Image gallery for Adiantum capillus-veneris L." imagegallery="true" taxon_id="48" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="13728" uuid="53b3125e-2a43-4433-a4dd-50dd9a4cf92c" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="48" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="13817" uuid="7b108193-e689-417a-bcab-adaf6c49d532" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="264" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14043" uuid="de29cc97-a160-4783-b996-b929157335d5" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="812" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14101" uuid="815336d3-19d6-493d-9ea4-bcb320d1b922" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="946" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14658" uuid="ce4068f8-17b0-46e2-9fbb-e8c16efb7255" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2203" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14864" uuid="2d55f445-8e72-43d3-976a-133828e89599" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2737" PUBLISH="true" ISDEFAULT="false"/>
<LanguageString id="10"/>
</dataset>
<TaxonBase DTYPE="Taxon" id="2738" uuid="8ac3dca2-6bbf-4cd4-84b7-53ddc2973ed8" protectedtitlecache="false" titleCache="Pteris sec. Cyprus" doubtful="false" usenamecache="false" taxonstatusunknown="false" name_id="2738" publish="true"/>
<TaxonBase DTYPE="Taxon" id="2739" uuid="79b45ff5-c17c-44ec-9114-fb6b3cd1aef4" protectedtitlecache="false" titleCache="Pteris cretica sec. Cyprus" doubtful="false" usenamecache="false" name_id="2739" publish="true" taxonstatusunknown="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="28" uuid="f04f8f66-ad92-42d0-89bc-04ac5b36163c" protectedtitlecache="false" titleCache="Taxon description for Adiantum capillus-veneris L." imagegallery="false" taxon_id="48" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="149" uuid="24df0fca-bfc4-4f0f-a269-336985ed6e5e" protectedtitlecache="false" titleCache="Taxon description for Anogramma leptophylla (L.) Link" imagegallery="false" taxon_id="264" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="447" uuid="01863b86-c6ae-48b8-a8da-f693be9087da" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes acrostica (Balbis) Tod." imagegallery="false" taxon_id="812" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="448" uuid="aac7b184-e622-409b-8eda-e14998b9021d" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes maderensis Lowe" imagegallery="false" taxon_id="815" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="521" uuid="2d672585-0f35-42f8-9923-dfd5545e6369" protectedtitlecache="false" titleCache="Taxon description for Cosentinia vellea (Aiton) Tod." imagegallery="false" taxon_id="946" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="1234" uuid="a8a734c2-122b-4d5b-9c89-a852f4ab4661" protectedtitlecache="false" titleCache="Taxon description for Notholaena marantae (L.) Desv." imagegallery="false" taxon_id="2203" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="1524" uuid="c4e66d46-e4fb-4da2-a432-3f1cf5353b81" protectedtitlecache="false" titleCache="Taxon description for Pteris vittata L." imagegallery="false" taxon_id="2737" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="4567" uuid="dd0f7395-6162-4ce4-8ece-774011b09325" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Adiantum capillus-veneris L. sec. Cyprus" imagegallery="false" taxon_id="48" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="4627" uuid="34266202-eb5d-41ec-a0b2-da56deb11cc7" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Anogramma leptophylla (L.) Link sec. Cyprus" imagegallery="false" taxon_id="264" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="4798" uuid="504b0178-39e6-4c79-8e33-ca00b0662f27" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cheilanthes acrostica (Balbis) Tod. sec. Cyprus" imagegallery="false" taxon_id="812" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="4840" uuid="73396d11-5d35-43fb-8b15-4d472bdcdd43" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cosentinia vellea (Aiton) Tod. sec. Cyprus" imagegallery="false" taxon_id="946" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="5409" uuid="64a797b2-7f92-4012-a4f5-d76f8aaeb6b4" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Pteris vittata L. sec. Cyprus" imagegallery="false" taxon_id="2737" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="5974" uuid="71872861-8229-4cab-8042-b75dfa0e3f63" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Notholaena marantae (L.) Desv. sec. Cyprus" imagegallery="false" taxon_id="2203" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="11766" uuid="6b4be8a2-ea86-4815-bd31-b022055a90f2" protectedtitlecache="false" titleCache="Image gallery for Pteris vittata L." imagegallery="true" taxon_id="2737" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="12353" uuid="b8d3a151-032e-48d9-9191-d7b8fb1fe1a0" protectedtitlecache="false" titleCache="Image gallery for Cheilanthes acrostica (Balbis) Tod." imagegallery="true" taxon_id="812" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="12713" uuid="61fbdc1b-80bf-4aea-b6cb-8f4d466bd923" protectedtitlecache="false" titleCache="Image gallery for Adiantum capillus-veneris L." imagegallery="true" taxon_id="48" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="13728" uuid="53b3125e-2a43-4433-a4dd-50dd9a4cf92c" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="48" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="13817" uuid="7b108193-e689-417a-bcab-adaf6c49d532" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="264" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="14043" uuid="de29cc97-a160-4783-b996-b929157335d5" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="812" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="14101" uuid="815336d3-19d6-493d-9ea4-bcb320d1b922" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="946" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="14658" uuid="ce4068f8-17b0-46e2-9fbb-e8c16efb7255" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2203" isDefault="false" types="#"/>
- <DescriptionBase DTYPE="TaxonDescription" id="14864" uuid="2d55f445-8e72-43d3-976a-133828e89599" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2737" isDefault="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="28" uuid="f04f8f66-ad92-42d0-89bc-04ac5b36163c" protectedtitlecache="false" titleCache="Taxon description for Adiantum capillus-veneris L." imagegallery="false" taxon_id="48" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="149" uuid="24df0fca-bfc4-4f0f-a269-336985ed6e5e" protectedtitlecache="false" titleCache="Taxon description for Anogramma leptophylla (L.) Link" imagegallery="false" taxon_id="264" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="447" uuid="01863b86-c6ae-48b8-a8da-f693be9087da" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes acrostica (Balbis) Tod." imagegallery="false" taxon_id="812" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="448" uuid="aac7b184-e622-409b-8eda-e14998b9021d" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes maderensis Lowe" imagegallery="false" taxon_id="815" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="521" uuid="2d672585-0f35-42f8-9923-dfd5545e6369" protectedtitlecache="false" titleCache="Taxon description for Cosentinia vellea (Aiton) Tod." imagegallery="false" taxon_id="946" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="1234" uuid="a8a734c2-122b-4d5b-9c89-a852f4ab4661" protectedtitlecache="false" titleCache="Taxon description for Notholaena marantae (L.) Desv." imagegallery="false" taxon_id="2203" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="1524" uuid="c4e66d46-e4fb-4da2-a432-3f1cf5353b81" protectedtitlecache="false" titleCache="Taxon description for Pteris vittata L." imagegallery="false" taxon_id="2737" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4567" uuid="dd0f7395-6162-4ce4-8ece-774011b09325" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Adiantum capillus-veneris L. sec. Cyprus" imagegallery="false" taxon_id="48" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4627" uuid="34266202-eb5d-41ec-a0b2-da56deb11cc7" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Anogramma leptophylla (L.) Link sec. Cyprus" imagegallery="false" taxon_id="264" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4798" uuid="504b0178-39e6-4c79-8e33-ca00b0662f27" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cheilanthes acrostica (Balbis) Tod. sec. Cyprus" imagegallery="false" taxon_id="812" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4840" uuid="73396d11-5d35-43fb-8b15-4d472bdcdd43" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cosentinia vellea (Aiton) Tod. sec. Cyprus" imagegallery="false" taxon_id="946" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="5409" uuid="64a797b2-7f92-4012-a4f5-d76f8aaeb6b4" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Pteris vittata L. sec. Cyprus" imagegallery="false" taxon_id="2737" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="5974" uuid="71872861-8229-4cab-8042-b75dfa0e3f63" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Notholaena marantae (L.) Desv. sec. Cyprus" imagegallery="false" taxon_id="2203" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="11766" uuid="6b4be8a2-ea86-4815-bd31-b022055a90f2" protectedtitlecache="false" titleCache="Image gallery for Pteris vittata L." imagegallery="true" taxon_id="2737" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="12353" uuid="b8d3a151-032e-48d9-9191-d7b8fb1fe1a0" protectedtitlecache="false" titleCache="Image gallery for Cheilanthes acrostica (Balbis) Tod." imagegallery="true" taxon_id="812" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="12713" uuid="61fbdc1b-80bf-4aea-b6cb-8f4d466bd923" protectedtitlecache="false" titleCache="Image gallery for Adiantum capillus-veneris L." imagegallery="true" taxon_id="48" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="13728" uuid="53b3125e-2a43-4433-a4dd-50dd9a4cf92c" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="48" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="13817" uuid="7b108193-e689-417a-bcab-adaf6c49d532" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="264" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14043" uuid="de29cc97-a160-4783-b996-b929157335d5" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="812" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14101" uuid="815336d3-19d6-493d-9ea4-bcb320d1b922" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="946" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14658" uuid="ce4068f8-17b0-46e2-9fbb-e8c16efb7255" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2203" PUBLISH="true" ISDEFAULT="false" types="#"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14864" uuid="2d55f445-8e72-43d3-976a-133828e89599" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2737" PUBLISH="true" ISDEFAULT="false" types="#"/>
<LanguageString id="10"/>
</dataset>
<TaxonBase DTYPE="Taxon" id="2737" uuid="6b46ac55-3e39-4c37-a1b6-b680b21599b2" protectedtitlecache="false" titleCache="Pteris vittata L. sec. Cyprus" doubtful="false" usenamecache="false" taxonstatusunknown="false" name_id="2737" publish="true"/>
<TaxonBase DTYPE="Taxon" id="2738" uuid="8ac3dca2-6bbf-4cd4-84b7-53ddc2973ed8" protectedtitlecache="false" titleCache="Pteris sec. Cyprus" doubtful="false" usenamecache="false" taxonstatusunknown="false" name_id="2738" publish="true"/>
- <DescriptionBase DTYPE="TaxonDescription" id="28" uuid="f04f8f66-ad92-42d0-89bc-04ac5b36163c" protectedtitlecache="false" titleCache="Taxon description for Adiantum capillus-veneris L." imagegallery="false" taxon_id="48" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="149" uuid="24df0fca-bfc4-4f0f-a269-336985ed6e5e" protectedtitlecache="false" titleCache="Taxon description for Anogramma leptophylla (L.) Link" imagegallery="false" taxon_id="264" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="447" uuid="01863b86-c6ae-48b8-a8da-f693be9087da" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes acrostica (Balbis) Tod." imagegallery="false" taxon_id="812" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="448" uuid="aac7b184-e622-409b-8eda-e14998b9021d" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes maderensis Lowe" imagegallery="false" taxon_id="815" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="521" uuid="2d672585-0f35-42f8-9923-dfd5545e6369" protectedtitlecache="false" titleCache="Taxon description for Cosentinia vellea (Aiton) Tod." imagegallery="false" taxon_id="946" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="1234" uuid="a8a734c2-122b-4d5b-9c89-a852f4ab4661" protectedtitlecache="false" titleCache="Taxon description for Notholaena marantae (L.) Desv." imagegallery="false" taxon_id="2203" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="1524" uuid="c4e66d46-e4fb-4da2-a432-3f1cf5353b81" protectedtitlecache="false" titleCache="Taxon description for Pteris vittata L." imagegallery="false" taxon_id="2737" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="4567" uuid="dd0f7395-6162-4ce4-8ece-774011b09325" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Adiantum capillus-veneris L. sec. Cyprus" imagegallery="false" taxon_id="48" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="4627" uuid="34266202-eb5d-41ec-a0b2-da56deb11cc7" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Anogramma leptophylla (L.) Link sec. Cyprus" imagegallery="false" taxon_id="264" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="4798" uuid="504b0178-39e6-4c79-8e33-ca00b0662f27" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cheilanthes acrostica (Balbis) Tod. sec. Cyprus" imagegallery="false" taxon_id="812" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="4840" uuid="73396d11-5d35-43fb-8b15-4d472bdcdd43" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cosentinia vellea (Aiton) Tod. sec. Cyprus" imagegallery="false" taxon_id="946" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="5409" uuid="64a797b2-7f92-4012-a4f5-d76f8aaeb6b4" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Pteris vittata L. sec. Cyprus" imagegallery="false" taxon_id="2737" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="5974" uuid="71872861-8229-4cab-8042-b75dfa0e3f63" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Notholaena marantae (L.) Desv. sec. Cyprus" imagegallery="false" taxon_id="2203" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="11766" uuid="6b4be8a2-ea86-4815-bd31-b022055a90f2" protectedtitlecache="false" titleCache="Image gallery for Pteris vittata L." imagegallery="true" taxon_id="2737" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="12353" uuid="b8d3a151-032e-48d9-9191-d7b8fb1fe1a0" protectedtitlecache="false" titleCache="Image gallery for Cheilanthes acrostica (Balbis) Tod." imagegallery="true" taxon_id="812" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="12713" uuid="61fbdc1b-80bf-4aea-b6cb-8f4d466bd923" protectedtitlecache="false" titleCache="Image gallery for Adiantum capillus-veneris L." imagegallery="true" taxon_id="48" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="13728" uuid="53b3125e-2a43-4433-a4dd-50dd9a4cf92c" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="48" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="13817" uuid="7b108193-e689-417a-bcab-adaf6c49d532" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="264" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="14043" uuid="de29cc97-a160-4783-b996-b929157335d5" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="812" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="14101" uuid="815336d3-19d6-493d-9ea4-bcb320d1b922" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="946" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="14658" uuid="ce4068f8-17b0-46e2-9fbb-e8c16efb7255" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2203" isDefault="false"/>
- <DescriptionBase DTYPE="TaxonDescription" id="14864" uuid="2d55f445-8e72-43d3-976a-133828e89599" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2737" isDefault="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="28" uuid="f04f8f66-ad92-42d0-89bc-04ac5b36163c" protectedtitlecache="false" titleCache="Taxon description for Adiantum capillus-veneris L." imagegallery="false" taxon_id="48" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="149" uuid="24df0fca-bfc4-4f0f-a269-336985ed6e5e" protectedtitlecache="false" titleCache="Taxon description for Anogramma leptophylla (L.) Link" imagegallery="false" taxon_id="264" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="447" uuid="01863b86-c6ae-48b8-a8da-f693be9087da" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes acrostica (Balbis) Tod." imagegallery="false" taxon_id="812" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="448" uuid="aac7b184-e622-409b-8eda-e14998b9021d" protectedtitlecache="false" titleCache="Taxon description for Cheilanthes maderensis Lowe" imagegallery="false" taxon_id="815" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="521" uuid="2d672585-0f35-42f8-9923-dfd5545e6369" protectedtitlecache="false" titleCache="Taxon description for Cosentinia vellea (Aiton) Tod." imagegallery="false" taxon_id="946" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="1234" uuid="a8a734c2-122b-4d5b-9c89-a852f4ab4661" protectedtitlecache="false" titleCache="Taxon description for Notholaena marantae (L.) Desv." imagegallery="false" taxon_id="2203" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="1524" uuid="c4e66d46-e4fb-4da2-a432-3f1cf5353b81" protectedtitlecache="false" titleCache="Taxon description for Pteris vittata L." imagegallery="false" taxon_id="2737" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4567" uuid="dd0f7395-6162-4ce4-8ece-774011b09325" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Adiantum capillus-veneris L. sec. Cyprus" imagegallery="false" taxon_id="48" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4627" uuid="34266202-eb5d-41ec-a0b2-da56deb11cc7" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Anogramma leptophylla (L.) Link sec. Cyprus" imagegallery="false" taxon_id="264" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4798" uuid="504b0178-39e6-4c79-8e33-ca00b0662f27" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cheilanthes acrostica (Balbis) Tod. sec. Cyprus" imagegallery="false" taxon_id="812" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="4840" uuid="73396d11-5d35-43fb-8b15-4d472bdcdd43" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Cosentinia vellea (Aiton) Tod. sec. Cyprus" imagegallery="false" taxon_id="946" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="5409" uuid="64a797b2-7f92-4012-a4f5-d76f8aaeb6b4" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Pteris vittata L. sec. Cyprus" imagegallery="false" taxon_id="2737" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="5974" uuid="71872861-8229-4cab-8042-b75dfa0e3f63" protectedtitlecache="true" titleCache="Cyprus Distributions Excel Import for Notholaena marantae (L.) Desv. sec. Cyprus" imagegallery="false" taxon_id="2203" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="11766" uuid="6b4be8a2-ea86-4815-bd31-b022055a90f2" protectedtitlecache="false" titleCache="Image gallery for Pteris vittata L." imagegallery="true" taxon_id="2737" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="12353" uuid="b8d3a151-032e-48d9-9191-d7b8fb1fe1a0" protectedtitlecache="false" titleCache="Image gallery for Cheilanthes acrostica (Balbis) Tod." imagegallery="true" taxon_id="812" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="12713" uuid="61fbdc1b-80bf-4aea-b6cb-8f4d466bd923" protectedtitlecache="false" titleCache="Image gallery for Adiantum capillus-veneris L." imagegallery="true" taxon_id="48" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="13728" uuid="53b3125e-2a43-4433-a4dd-50dd9a4cf92c" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="48" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="13817" uuid="7b108193-e689-417a-bcab-adaf6c49d532" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="264" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14043" uuid="de29cc97-a160-4783-b996-b929157335d5" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="812" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14101" uuid="815336d3-19d6-493d-9ea4-bcb320d1b922" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="946" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14658" uuid="ce4068f8-17b0-46e2-9fbb-e8c16efb7255" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2203" PUBLISH="true" ISDEFAULT="false"/>
+ <DescriptionBase DTYPE="TaxonDescription" id="14864" uuid="2d55f445-8e72-43d3-976a-133828e89599" protectedtitlecache="true" titleCache="Import from Cyprus Excel Altitude Import" imagegallery="false" taxon_id="2737" PUBLISH="true" ISDEFAULT="false"/>
<LanguageString id="10"/>
</dataset>
eu.etaxonomy.taxeditor.workbench.datasource,
eu.etaxonomy.taxeditor.workbench.part
Bundle-Name: Workbench Bundle
-Bundle-Version: 5.34.0
+Bundle-Version: 5.42.0
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.e4.ui.workbench,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.34.0</version>
+ <version>5.42.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
}
//sort root nodes
- Collections.sort(rootPages, new PreferenceNodeComparator());
+ // Collections.sort(rootPages, new PreferenceNodeComparator());
//add root nodes
rootPages.forEach(pageWrapper->{
PreferenceNode node = new PreferenceNode(pageWrapper.id, pageWrapper.page);
}
PreferenceDialog dialog = new PreferenceDialog(shell, manager);
dialog.create();
+ dialog.getTreeViewer().expandToLevel(2);
dialog.open();
}
import javax.inject.Named;
-import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
}
//sort root nodes
- Collections.sort(rootPages, new PreferenceNodeComparator());
+ //Collections.sort(rootPages, new PreferenceNodeComparator());
//add root nodes
rootPages.forEach(pageWrapper->{
PreferenceNode node = new PreferenceNode(pageWrapper.id, pageWrapper.page);
<?xml version="1.0" encoding="UTF-8"?>
-<?pde version="3.5"?><product application="eu.etaxonomy.taxeditor.application.application" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" includeLaunchers="true" name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product" useFeatures="true" version="5.34.0">
+<?pde version="3.5"?><product application="eu.etaxonomy.taxeditor.application.application" autoIncludeRequirements="true" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" includeLaunchers="true" name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product" useFeatures="true" version="5.42.0">
<aboutInfo>
<image path="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
<text>
<windowImages i16="/eu.etaxonomy.taxeditor.application/icons/256color_16x16.gif" i32="/eu.etaxonomy.taxeditor.application/icons/256color_32x32.gif" i48="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
<splash location="eu.etaxonomy.taxeditor.application" startupForegroundColor="000000" startupMessageRect="7,432,360,20" startupProgressRect="5,447,366,15"/>
<launcher name="TaxonomicEditor">
- <solaris/>
<win useIco="false">
<bmp/>
</win>
<plugin autoStart="true" id="org.eclipse.equinox.ds" startLevel="2"/>
<plugin autoStart="true" id="org.eclipse.equinox.p2.transport.ecf" startLevel="4"/>
<plugin autoStart="true" id="org.eclipse.equinox.simpleconfigurator" startLevel="1"/>
+ <property name="osgi.nl" value="en"/>
</configurations>
</product>
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
-<product name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product.jre" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" application="eu.etaxonomy.taxeditor.application.application" version="5.34.0" useFeatures="true" includeLaunchers="true">
+<product name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product.jre" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" application="eu.etaxonomy.taxeditor.application.application" version="5.42.0" useFeatures="true" includeLaunchers="true">
<aboutInfo>
<image path="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
<plugin id="org.eclipse.equinox.ds" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.equinox.p2.transport.ecf" autoStart="true" startLevel="4" />
<plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
+ <property name="osgi.nl" value="en"/>
</configurations>
</product>
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.34.0</version>
+ <version>5.42.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<unit id="org.eclipse.oomph.setup.sdk.feature.group" version="1.7.0.v20170305-1123"/>\r
<repository location="http://download.eclipse.org/releases/neon"/>\r
</location>\r
-<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">\r
-<unit id="org.eclipse.nebula.widgets.compositetable.feature.feature.group" version="1.0.0.202011020719"/>\r
-<repository location="http://download.eclipse.org/nebula/releases/latest/"/>\r
-</location>\r
+ <location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">\r
+ <repository location="https://archive.eclipse.org/nebula/Q22016/release/"/>\r
+ <unit id="org.eclipse.nebula.widgets.compositetable.feature.feature.group" version="1.0.0.201605182147"/>\r
+ </location>\r
</locations>\r
<includeBundles>\r
<feature id="org.eclipse.core.runtime.feature"/>\r
</prerequisites>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.34.0</version>
+ <version>5.42.0</version>
<name>EDIT Taxonomic Editor</name>
<description>The Taxonomic Editor for EDIT's platform for
cybertaxonomy
<properties>
<java.codelevel>1.8</java.codelevel>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <cdmlib.version>5.34.0</cdmlib.version>
+ <cdmlib.version>5.42.0</cdmlib.version>
<!-- TODO can we use project.version ????? -->
<!-- Increasing tycho above 0.22.0 will fail for the macosx build because
for higher version numbers tycho needs to be build against Eclipse Mars or
higher -->
<tycho.version>1.7.0</tycho.version>
- <taxeditor.version>5.34.0</taxeditor.version>
+ <taxeditor.version>5.42.0</taxeditor.version>
<update.dir>snapshot</update.dir>
<log4j.version>2.19.0</log4j.version>
<httpcomponents.version>4.5.13</httpcomponents.version>
<doclint>none</doclint>
+
+
+
+
+
+
+
+
<!-- see according comment in cdmlib for possible finetuning -->
</properties>
<modules>
<repository>
<id>eclipse-indigo</id>
<layout>p2</layout>
- <url>http://download.eclipse.org/technology/swtbot/snapshots/</url>
+ <!--<url>http://download.eclipse.org/technology/swtbot/snapshots</url>-->
+ <url>http://download.eclipse.org/technology/swtbot/releases/latest</url>
</repository>
<repository>
<id>eclipse-nebula</id>
<layout>p2</layout>
- <url>http://download.eclipse.org/nebula/releases/latest</url>
+ <url> https://archive.eclipse.org/nebula/Q22016/release/</url>
+
+
+
+
+
+
+
+ <!--<url>http://download.eclipse.org/nebula/releases/latest</url>-->
</repository>
<repository>
<id>nattable</id>