<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="src" path="src/test/java/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Bundle-ManifestVersion: 2
Bundle-Name: Application
Bundle-SymbolicName: eu.etaxonomy.taxeditor.application;singleton:=true
-Bundle-Version: 3.6.1
+Bundle-Version: 3.7.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>3.6.1</version>
+ <version>3.7.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
--- /dev/null
+This is only a placeholder to allow empty folder be committed to git. Can be removed if any other file exists in this folder.
\ No newline at end of file
--- /dev/null
+This is only a placeholder file to allow an empty folder. Can be deleted once another file is present in this folder.
\ No newline at end of file
Bundle-ManifestVersion: 2
Bundle-Name: Bulkeditor Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.bulkeditor;singleton:=true
-Bundle-Version: 3.6.1
+Bundle-Version: 3.7.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>3.6.1</version>
+ <version>3.7.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
try {\r
team = CdmStore.getService(IAgentService.class).convertPerson2Team(person);\r
} catch (IllegalArgumentException e) {\r
- MessagingUtils.informationDialog("Can not convert Team to Person", e.getMessage());\r
+ MessagingUtils.errorDialog("Can not convert Team to Person", null, e.getMessage(), null,e, true);\r
} catch (MergeException e) {\r
- MessagingUtils.informationDialog("Can not convert Team to Person", e.getMessage());\r
+ MessagingUtils.errorDialog("Can not convert Team to Person", null, e.getMessage(), null,e, true);\r
}\r
}else{\r
MessagingUtils.informationDialog("Can not convert Team to Person", "convertTeam2Person can only be called on a team.");\r
if (name != null){
NameDeletionConfigurator config = new NameDeletionConfigurator();
- result = service.delete(name, config);
+ result = service.delete(name.getUuid(), config);
}
} else if (object instanceof TaxonBase){
ITaxonService service = controller.getTaxonService();
TaxonBase taxonBase = service.load(((TaxonBase) object).getUuid());
if (taxonBase != null){
if (object instanceof Taxon){
- result = service.deleteTaxon((Taxon)object, null, null);
+ result = service.deleteTaxon(((TaxonBase) object).getUuid(), null, null);
}else{
result = service.deleteSynonym((Synonym)object, null);
}
private List<T> model;
private IEntityCreator<T> entityCreator;
-
+
private static Class serviceClass;
/**
* @return a {@link eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput} object.
*/
static public AbstractBulkEditorInput NewInstance(BulkEditorInputType inputType) {
-
+
return BulkEditorInputType.getInput(inputType);
}
* @return a T object.
*/
protected T loadEntity(UUID entityUuid) {
- List<String> propertyPaths = Arrays.asList(new String[]{});
+ List<String> propertyPaths = Arrays.asList(new String[]{});
return (T) CdmStore.getService(serviceClass).load(entityUuid, propertyPaths);
}
if(getEntityUuid() != null){
- T entity = (T) loadEntity(getEntityUuid());
+ T entity = loadEntity(getEntityUuid());
entityList.add(entity);
model = entityList;
}
entityList = listEntities(configurator);
Collections.sort(entityList, queryComparator);
-
+
}
public boolean merge(T entity, T mergeTarget) {
if (entity instanceof IMergable) {
try {
- CdmStore.getCommonService().merge((IMergable)mergeTarget, (IMergable)entity, null);
+ CdmStore.getCommonService().merge((IMergable)mergeTarget, (IMergable)entity);
} catch (MergeException e) {
MessagingUtils.errorDialog("Bulk Editor Merge Error",
this,
* Returns a textual representation given object. The default implementation
* in the abstract base class returns the simple name of the class, this may
* be overwritten to something more specific in subclasses.
- *
+ *
* @param entity
* @return a textual representation given object.
*/
// $Id$
/**
* 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.
*/
*/
public class ReferencingObjectsContentProvider implements
IStructuredContentProvider {
- private static final Logger logger = Logger
+ @SuppressWarnings("unused")
+ private static final Logger logger = Logger
.getLogger(ReferencingObjectsContentProvider.class);
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
/** {@inheritDoc} */
- public Object[] getElements(Object inputElement) {
+ @Override
+ public Object[] getElements(Object inputElement) {
if (inputElement instanceof Collection) {
- return ((Collection) inputElement).toArray();
+ return ((Collection<?>) inputElement).toArray();
}
return new Object[0];
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
/**
* <p>dispose</p>
*/
- public void dispose() {}
+ @Override
+ public void dispose() {}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
/** {@inheritDoc} */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
}
// $Id$
/**
* 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.
*/
public ReferencingObjectsLabelProvider() {
}
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
+
/** {@inheritDoc} */
- public Image getColumnImage(Object element, int columnIndex) {
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
/** {@inheritDoc} */
- public String getColumnText(Object element, int columnIndex) {
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
String text = null;
-
+
Object deproxiedElement = HibernateProxyHelper.deproxy(element);
-
+
if (columnIndex == 0) {
text = DescriptionHelper.getObjectClassname(deproxiedElement);
}else if (columnIndex == 1) {
text = ((CdmBase) element).getId() + "";
}
}
-
+
return text == null ? element.toString() : text;
-
+
}
}
// $Id$
/**
* 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.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
-
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Table;
-import org.eclipse.ui.INullSelectionListener;
-import org.eclipse.ui.ISelectionListener;
-
import org.eclipse.ui.IWorkbenchPart;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.IAgentService;
-import eu.etaxonomy.cdm.api.service.ICommonService;
import eu.etaxonomy.cdm.api.service.IGroupService;
-
import eu.etaxonomy.cdm.api.service.INameService;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.api.service.IReferenceService;
import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.api.service.IUserService;
-
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.Group;
-
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.model.name.NonViralName;
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
import eu.etaxonomy.taxeditor.model.DescriptionHelper;
import eu.etaxonomy.taxeditor.model.LineSelection;
/** Constant <code>ID="eu.etaxonomy.taxeditor.bulkeditor.refer"{trunked}</code> */
public static final String ID = "eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects";
-
+
private TableViewer viewer;
private String referencedObjectTitleCache;
- private ConversationHolder conversation;
-
+ private ConversationHolder conversation;
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#createViewer(org.eclipse.swt.widgets.Composite)
*/
createColumns(viewer);
viewer.setContentProvider(new ReferencingObjectsContentProvider());
viewer.setLabelProvider(new ReferencingObjectsLabelProvider());
+ viewer.setCellModifier(new ICellModifier() {
+
+ @Override
+ public void modify(Object element, String property, Object value) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Object getValue(Object element, String property) {
+ ITableLabelProvider tableLabelProvider = null;
+ if(viewer.getLabelProvider() instanceof ITableLabelProvider){
+ tableLabelProvider = (ITableLabelProvider) viewer.getLabelProvider();
+ }
+ Object[] columnProperties = viewer.getColumnProperties();
+ for (int i=0;i<columnProperties.length;i++) {
+ if(columnProperties[i].equals(property) && tableLabelProvider!=null){
+ return tableLabelProvider.getColumnText(element, i);
+ }
+ }
+ return "";
+ }
+
+ @Override
+ public boolean canModify(Object element, String property) {
+ return true;
+ }
+ });
// viewer.setInput(new ArrayList<CdmBase>());
}
-
+
/**
* Create the columns for the table
* @param viewer
String[] titles = {"Class", "Description", "UUID", "Object ID" };
int[] bounds = { 100, 200, 100, 70};
+ CellEditor[] editors = new CellEditor[titles.length];
+
for (int i = 0; i < titles.length; i++) {
TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
+ editors[i] = new TextCellEditor(table);
column.getColumn().setText(titles[i]);
column.getColumn().setWidth(bounds[i]);
column.getColumn().setResizable(true);
}
table.setHeaderVisible(true);
table.setLinesVisible(true);
+
+ viewer.setCellEditors(editors);
+ viewer.setColumnProperties(titles);
}
/**
* @param entity a {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity} object.
*/
public void updateReferencingObjects(final UUID entityUUID, final Class objectClass) {
-
+
final Display display = Display.getCurrent();
-
+
Job job = new Job("Update Referencing Objects") {
-
+
@Override
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask("Calculating referencing objects", 10);
-
+
monitor.worked(3);
-
+
display.asyncExec(new Runnable() {
-
+
@Override
public void run() {
if (entityUUID != null){
-
+
List<CdmBase> referencingObjects = getReferencingObjects(entityUUID, objectClass);
-
+
updateView(referencingObjects);
-
-
+
}
}
});
-
+
monitor.done();
-
-
+
+
return Status.OK_STATUS;
}
};
-
+
job.setPriority(Job.DECORATE);
job.schedule();
}
}
//referencedObject =(CdmBase) CdmStore.getService(IIdentifiableEntityService.class).load(referencedObject.getUuid());
Set<CdmBase> setOfReferencingObjects = null;
-
+
if (referencedObject != null){
referencedObjectTitleCache = ((IdentifiableEntity)referencedObject).getTitleCache();
setOfReferencingObjects = CdmStore.getCommonService().getReferencingObjects(referencedObject);
}
if (setOfReferencingObjects != null){
- List<CdmBase> referencingObjects = new ArrayList<CdmBase>(setOfReferencingObjects);
-
+ List<CdmBase> referencingObjects = new ArrayList<CdmBase>(setOfReferencingObjects);
+
Collections.sort(referencingObjects, new ReferencingClassComparator());
-
+
return referencingObjects;
-
+
}
} catch (Exception e) {
logger.error("Error retrieving referencing objects", e);
}
return null;
}
-
+
class ReferencingClassComparator implements Comparator<CdmBase> {
/* (non-Javadoc)
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
- public int compare(CdmBase o1, CdmBase o2) {
+ @Override
+ public int compare(CdmBase o1, CdmBase o2) {
String string1 = o1.getClass().getSimpleName();
String string2 = o2.getClass().getSimpleName();
int classCompare = string1.compareToIgnoreCase(string2);
}
}
}
-
+
/**
- *
+ *
*/
private void updateView(List<CdmBase> referencingObjects) {
if (viewer != null && !viewer.getControl().isDisposed()){
- viewer.setInput(referencingObjects);
- if (referencedObjectTitleCache != null){
- setContentDescription("'" + referencedObjectTitleCache + "' is referenced by:");
- } else {
- setContentDescription("");
+ try{
+ viewer.setInput(referencingObjects);
+ if (referencedObjectTitleCache != null){
+ setContentDescription("'" + referencedObjectTitleCache + "' is referenced by:");
+ } else {
+ setContentDescription("");
+ }
+ showViewer();
+ }catch(Exception e){
+ setContentDescription("Some Problems occured.");
}
- showViewer();
+
}
}
/** {@inheritDoc} */
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ @Override
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if(! (part instanceof BulkEditor)){
setContentDescription("");
showEmptyPage();
return;
}
-
+
if(! (selection instanceof LineSelection)){
return;
}
LineSelection lineSelection = (LineSelection) selection;
-
+
if(lineSelection.size() != 1){
return;
}
-
+
if(! (lineSelection.getFirstElement() instanceof IdentifiableEntity)){
return;
}
-
+
showViewer(part, lineSelection);
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#showViewer(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
@Override
public void showViewer(IWorkbenchPart part, IStructuredSelection selection) {
// this.part = part;
-
+
updateReferencingObjects(((IdentifiableEntity) selection.getFirstElement()).getUuid(),selection.getFirstElement().getClass() );
}
-
+
/** {@inheritDoc} */
@Override
public void dispose() {
selectionService.removePostSelectionListener(this);
selectionService.removeSelectionListener(this);
super.dispose();
-
+
}
/* (non-Javadoc)
public void changed(Object object) {
// no editing in this view
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#onComplete()
*/
public boolean onComplete() {
return false;
}
-
+
public void refresh(){
-
+
selectionService.removePostSelectionListener(this);
selectionService.removeSelectionListener(this);
selectionService.addPostSelectionListener(this);
selectionService.addSelectionListener(this);
-
+
}
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.7.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.7.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.7.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.7.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.7.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.7.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.7.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.7.0.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry exported="true" kind="lib" path="lib/spring-security-remoting-3.1.3.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jena-core-2.11.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jena-iri-1.0.2.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.6.1-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.6.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.6.1-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.6.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.6.1-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.6.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.6.1-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.6.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.6.1-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.6.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.6.1-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.6.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.6.1-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.6.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.6.1-sources.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.6.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/poi-3.10-FINAL.jar"/>
<classpathentry exported="true" kind="lib" path="lib/poi-ooxml-3.10-FINAL.jar"/>
<classpathentry exported="true" kind="lib" path="lib/xmlbeans-2.3.0.jar"/>
--- /dev/null
+bin
\ No newline at end of file
Bundle-ManifestVersion: 2
Bundle-Name: CDM Library Dependencies Plugin
Bundle-SymbolicName: eu.etaxonomy.taxeditor.cdmlib;singleton:=true
-Bundle-Version: 3.6.1
+Bundle-Version: 3.7.0
Eclipse-BundleShape: dir
Export-Package: com.google.api,
com.google.api.detect,
lib/spring-security-remoting-3.1.3.RELEASE.jar,
lib/jena-core-2.11.2.jar,
lib/jena-iri-1.0.2.jar,
- lib/cdmlib-commons-3.6.1-sources.jar,
- lib/cdmlib-commons-3.6.1.jar,
- lib/cdmlib-ext-3.6.1-sources.jar,
- lib/cdmlib-ext-3.6.1.jar,
- lib/cdmlib-io-3.6.1-sources.jar,
- lib/cdmlib-io-3.6.1.jar,
- lib/cdmlib-model-3.6.1-sources.jar,
- lib/cdmlib-model-3.6.1.jar,
- lib/cdmlib-persistence-3.6.1-sources.jar,
- lib/cdmlib-persistence-3.6.1.jar,
- lib/cdmlib-print-3.6.1-sources.jar,
- lib/cdmlib-print-3.6.1.jar,
- lib/cdmlib-remote-3.6.1-sources.jar,
- lib/cdmlib-remote-3.6.1.jar,
- lib/cdmlib-services-3.6.1-sources.jar,
- lib/cdmlib-services-3.6.1.jar,
lib/poi-3.10-FINAL.jar,
lib/poi-ooxml-3.10-FINAL.jar,
lib/xmlbeans-2.3.0.jar,
lib/poi-ooxml-schemas-3.10-FINAL.jar,
- lib/swagger-annotations-1.3.5.jar
+ lib/swagger-annotations-1.3.5.jar,
+ lib/cdmlib-commons-3.7.0.jar,
+ lib/cdmlib-ext-3.7.0.jar,
+ lib/cdmlib-io-3.7.0.jar,
+ lib/cdmlib-model-3.7.0.jar,
+ lib/cdmlib-persistence-3.7.0.jar,
+ lib/cdmlib-print-3.7.0.jar,
+ lib/cdmlib-remote-3.7.0.jar,
+ lib/cdmlib-services-3.7.0.jar
Import-Package: eu.etaxonomy.cdm.api.application
lib/poi-ooxml-3.10-FINAL.jar,\\r
lib/poi-ooxml-schemas-3.10-FINAL.jar,\\r
lib/xmlbeans-2.3.0.jar,\\r
- lib/cdmlib-commons-3.6.1-sources.jar,\\r
- lib/cdmlib-commons-3.6.1.jar,\\r
- lib/cdmlib-ext-3.6.1-sources.jar,\\r
- lib/cdmlib-ext-3.6.1.jar,\\r
- lib/cdmlib-io-3.6.1-sources.jar,\\r
- lib/cdmlib-io-3.6.1.jar,\\r
- lib/cdmlib-model-3.6.1-sources.jar,\\r
- lib/cdmlib-model-3.6.1.jar,\\r
- lib/cdmlib-persistence-3.6.1-sources.jar,\\r
- lib/cdmlib-persistence-3.6.1.jar,\\r
- lib/cdmlib-print-3.6.1-sources.jar,\\r
- lib/cdmlib-print-3.6.1.jar,\\r
- lib/cdmlib-remote-3.6.1-sources.jar,\\r
- lib/cdmlib-remote-3.6.1.jar,\\r
- lib/cdmlib-services-3.6.1-sources.jar,\\r
- lib/cdmlib-services-3.6.1.jar,\\r
- lib/swagger-annotations-1.3.5.jar\r
+ lib/swagger-annotations-1.3.5.jar,\\r
+ lib/cdmlib-commons-3.7.0.jar,\\r
+ lib/cdmlib-ext-3.7.0.jar,\\r
+ lib/cdmlib-io-3.7.0.jar,\\r
+ lib/cdmlib-model-3.7.0.jar,\\r
+ lib/cdmlib-persistence-3.7.0.jar,\\r
+ lib/cdmlib-print-3.7.0.jar,\\r
+ lib/cdmlib-remote-3.7.0.jar,\\r
+ lib/cdmlib-services-3.7.0.jar\r
\r
jars.compile.order = .\r
output.. = bin/\r
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.6.1</version>
+ <version>3.7.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eu.etaxonomy.taxeditor.cdmlib</artifactId>
* @param <T>
*/
@Component
-public class CdmServiceCacher<T extends CdmBase> extends CdmCacher<T> {
+public class CdmServiceCacher<T extends CdmBase> extends CdmCacher {
@Autowired
ITermService termService;
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.model.ICdmCacher#isCachable(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public boolean isCachable(CdmBase arg0) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.cache.CdmCacher#load(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ @Override
+ public CdmBase load(CdmBase arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
package eu.etaxonomy.cdm.api.lazyloading;
-import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
public class CdmLazyLoader {
- private Set classes = new HashSet();
-
+ private final Set classes = new HashSet();
+
public static boolean enableWeaving = true;
private static Set<String> classesToIgnore = new HashSet<String>();
-
-
+
+
@Autowired
private ICommonService commonService;
public CdmLazyLoader() {
//classesToIgnore.add("eu.etaxonomy.cdm.model.common.TermVocabulary");
//classesToIgnore.add("eu.etaxonomy.cdm.model.common.OrderedTermVocabulary");
-
+
}
-
+
/**
* Point cut for the 'initialize' method of the AbstractLazyInitializer.
- *
+ *
*/
@Pointcut("execution(* org.hibernate.proxy.AbstractLazyInitializer.initialize())")
public void possibleEntityLazyInitializationException() {
/**
* 'Around' advice for the initialization of CDM Entity Objects
- *
+ *
*/
@Around(value = "possibleEntityLazyInitializationException()")
- public Object preloadEntityOnDemand(ProceedingJoinPoint pjp) throws Throwable {
+ public Object preloadEntityOnDemand(ProceedingJoinPoint pjp) throws Throwable {
if(enableWeaving) {
- LazyInitializer ll = (LazyInitializer)pjp.getTarget();
- if(ll.isUninitialized()) {
+ LazyInitializer ll = (LazyInitializer)pjp.getTarget();
+ if(ll.isUninitialized()) {
int classid = ((Integer)ll.getIdentifier()).intValue();
System.out.print("--> AspectJ Compile-Time Weaving " + ll.getEntityName() + " with id " + classid);
- Class clazz = (Class<? extends CdmBase>) Class.forName(ll.getEntityName());
+ Class clazz = Class.forName(ll.getEntityName());
CdmBase cdmBase = CdmBase.deproxy(commonService.find(clazz,classid),clazz);
ll.setImplementation(cdmBase);
System.out.println("....Done");
}
}
- return pjp.proceed();
+ return pjp.proceed();
}
-
+
/**
* Point cut for the 'initialize' method of the AbstractPersistentCollection.
- *
+ *
*/
@Pointcut("execution(protected final void org.hibernate.collection.internal.AbstractPersistentCollection.initialize(..))")
public void possibleCollectionLazyInitializationException() {
}
-
+
/**
* 'Around' advice for the initialization of Collection objects
- *
+ *
*/
- @Around(value = "possibleCollectionLazyInitializationException()")
- public Object preloadCollectionOnDemand(ProceedingJoinPoint pjp) throws Throwable {
+ @Around(value = "possibleCollectionLazyInitializationException()")
+ public Object preloadCollectionOnDemand(ProceedingJoinPoint pjp) throws Throwable {
if(enableWeaving) {
PersistentCollection ps = (PersistentCollection) pjp.getTarget();
if (ps.getOwner() != null && !classesToIgnore.contains(ps.getOwner().getClass().getName()) && !ps.wasInitialized() && !classes.contains(ps.getKey())) {
- System.out.print("--> AspectJCompile-Time Weaving " + ps.getRole());
+ System.out.print("--> AspectJCompile-Time Weaving " + ps.getRole());
classes.add(ps.getKey());
try {
String role = ps.getRole();
System.out.print(", field : " + fieldName);
Object owner = ps.getOwner();
- PersistentCollection col = commonService.initializeCollection(ps);
+ Object col = commonService.initializeCollection(((CdmBase)owner).getUuid(), fieldName);
ps.afterInitialize();
- Class<?> clazz = ps.getClass();
- if (clazz != null) {
- CollectionField cf = getCollectionField(col);
- Field field = clazz.getDeclaredField(cf.getFieldName());
- field.setAccessible(true);
- field.set(ps, cf.getCollection());
- }
+// Class<?> clazz = ps.getClass();
+// if (clazz != null) {
+// CollectionField cf = getCollectionField(col);
+// Field field = clazz.getDeclaredField(cf.getFieldName());
+// field.setAccessible(true);
+// field.set(ps, cf.getCollection());
+// }
+
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("Error in ReattachSessionAspect : " + ex.getMessage());
} finally {
classes.remove(ps.getKey());
System.out.println("....Done");
- }
+ throw new Exception("This code is invalid");
+ }
}
- }
+ }
return pjp.proceed();
}
-
+
private CollectionField getCollectionField(PersistentCollection pc) {
if(pc != null) {
if(pc instanceof PersistentSet) {
}
return null;
}
-
+
private String getCollectionFieldName(PersistentCollection pc) {
if(pc != null) {
if(pc instanceof PersistentSet || pc instanceof PersistentSortedSet) {
return "set";
- }
+ }
if(pc instanceof PersistentList) {
return "list";
}
}
return null;
}
-
+
private class CollectionField {
- private Object col;
- private String fieldName;
+ private final Object col;
+ private final String fieldName;
public CollectionField(Object col, String fieldName) {
this.col = col;
this.fieldName = fieldName;
}
-
+
public Object getCollection() {
return this.col;
}
-
+
public String getFieldName() {
return this.fieldName;
}
package org.hibernate.collection.internal;
import java.io.Serializable;
-import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
private static final Logger log = Logger.getLogger( AbstractPersistentCollection.class );
private static final long serialVersionUID = -7238232378593030571L;
-
+
private transient SessionImplementor session;
private boolean initialized;
private transient List<DelayedOperation> operationQueue;
private String sessionFactoryUuid;
private boolean specjLazyLoad = false;
- public final String getRole() {
+ @Override
+ public final String getRole() {
return role;
}
- public final Serializable getKey() {
+ @Override
+ public final Serializable getKey() {
return key;
}
- public final boolean isUnreferenced() {
+ @Override
+ public final boolean isUnreferenced() {
return role == null;
}
- public final boolean isDirty() {
+ @Override
+ public final boolean isDirty() {
return dirty;
}
- public final void clearDirty() {
+ @Override
+ public final void clearDirty() {
dirty = false;
}
- public final void dirty() {
+ @Override
+ public final void dirty() {
dirty = true;
}
- public final Serializable getStoredSnapshot() {
+ @Override
+ public final Serializable getStoredSnapshot() {
return storedSnapshot;
}
/**
* Is the initialized collection empty?
*/
- public abstract boolean empty();
+ @Override
+ public abstract boolean empty();
/**
* Called by any read-only method of the collection interface
else {
// In remoting we are sure that session is null
// both when using property paths and switching off conversations
- if(session == null && remoting) {
+ if(session == null && remoting) {
log.info("--> readSize, of " + getRole() + " with key " + getKey());
- read();
+ read();
} else {
boolean isExtraLazy = withTemporarySessionIfNeeded(
new LazyInitializationWork<Boolean>() {
.getTransactionContext().getTransactionEnvironment()
.getTransactionFactory()
.compatibleWithJtaSynchronization();
-
+
if ( !isJTA ) {
// Explicitly handle the transactions only if we're not in
// a JTA environment. A lazy loading temporary session can
// multiple transactions.
( ( Session) session ).beginTransaction();
}
-
+
session.getPersistenceContext().addUninitializedDetachedCollection(
session.getFactory().getCollectionPersister( getRole() ),
this
if ( !initialized ) {
// In remoting we are sure that session is null
// both when using property paths and switching off conversations
- if(session == null && remoting) {
+ if(session == null && remoting) {
log.info("--> readIndexExistence, of " + getRole() + " with key " + getKey());
- read();
+ read();
} else {
Boolean extraLazyExistenceCheck = withTemporarySessionIfNeeded(
new LazyInitializationWork<Boolean>() {
// both when using property paths and switching off conversations
if(session == null && remoting) {
log.info("--> readElementExistence, of " + getRole() + " with key " + getKey());
- read();
-
+ read();
+
} else {
Boolean extraLazyExistenceCheck = withTemporarySessionIfNeeded(
new LazyInitializationWork<Boolean>() {
if ( !initialized ) {
// In remoting we are sure that session is null
// both when using property paths and switching off conversations
- if(session == null && remoting) {
+ if(session == null && remoting) {
log.info("--> readElementByIndex, of " + getRole() + " with key " + getKey());
- read();
-
+ read();
+
} else {
class ExtraLazyElementByIndexReader implements LazyInitializationWork {
private boolean isExtraLazy;
/**
* After flushing, re-init snapshot state.
*/
- public void setSnapshot(Serializable key, String role, Serializable snapshot) {
+ @Override
+ public void setSnapshot(Serializable key, String role, Serializable snapshot) {
this.key = key;
this.role = role;
this.storedSnapshot = snapshot;
* After flushing, clear any "queued" additions, since the
* database state is now synchronized with the memory state.
*/
- public void postAction() {
+ @Override
+ public void postAction() {
operationQueue = null;
cachedSize = -1;
clearDirty();
/**
* return the user-visible collection (or array) instance
*/
- public Object getValue() {
+ @Override
+ public Object getValue() {
return this;
}
/**
* Called just before reading any rows from the JDBC result set
*/
- public void beginRead() {
+ @Override
+ public void beginRead() {
// override on some subclasses
initializing = true;
}
/**
* Called after reading all rows from the JDBC result set
*/
- public boolean endRead() {
+ @Override
+ public boolean endRead() {
//override on some subclasses
return afterInitialize();
}
- public boolean afterInitialize() {
+ @Override
+ public boolean afterInitialize() {
setInitialized();
//do this bit after setting initialized to true or it will recurse
if ( operationQueue != null ) {
// In remoting we are sure that session is null
// both when using property paths and switching off conversations
if(session == null && remoting) {
- remoteInitialize();
+ remoteInitialize();
}
-
+
if ( initialized ) {
return;
}
-
+
withTemporarySessionIfNeeded(
new LazyInitializationWork<Object>() {
@Override
* Could the application possibly have a direct reference to
* the underlying collection implementation?
*/
- public boolean isDirectlyAccessible() {
+ @Override
+ public boolean isDirectlyAccessible() {
return directlyAccessible;
}
*
* @return true if this was currently associated with the given session
*/
- public final boolean unsetSession(SessionImplementor currentSession) {
+ @Override
+ public final boolean unsetSession(SessionImplementor currentSession) {
prepareForPossibleSpecialSpecjInitialization();
if ( currentSession == this.session ) {
this.session = null;
* @throws HibernateException if the collection was already associated
* with another open session
*/
- public final boolean setCurrentSession(SessionImplementor session) throws HibernateException {
+ @Override
+ public final boolean setCurrentSession(SessionImplementor session) throws HibernateException {
if ( session == this.session ) {
return false;
}
/**
* Do we need to completely recreate this collection when it changes?
*/
- public boolean needsRecreate(CollectionPersister persister) {
+ @Override
+ public boolean needsRecreate(CollectionPersister persister) {
return false;
}
* To be called internally by the session, forcing
* immediate initialization.
*/
- public final void forceInitialization() throws HibernateException {
+ @Override
+ public final void forceInitialization() throws HibernateException {
if ( !initialized ) {
if ( initializing ) {
throw new AssertionFailure( "force initialize loading collection" );
/**
* Is this instance initialized?
*/
- public final boolean wasInitialized() {
+ @Override
+ public final boolean wasInitialized() {
return initialized;
}
- public boolean isRowUpdatePossible() {
+ @Override
+ public boolean isRowUpdatePossible() {
return true;
}
/**
* Does this instance have any "queued" additions?
*/
- public final boolean hasQueuedOperations() {
+ @Override
+ public final boolean hasQueuedOperations() {
return operationQueue != null;
}
/**
* Iterate the "queued" additions
*/
- public final Iterator queuedAdditionIterator() {
+ @Override
+ public final Iterator queuedAdditionIterator() {
if ( hasQueuedOperations() ) {
return new Iterator() {
int i = 0;
- public Object next() {
+ @Override
+ public Object next() {
return operationQueue.get( i++ ).getAddedInstance();
}
- public boolean hasNext() {
+ @Override
+ public boolean hasNext() {
return i < operationQueue.size();
}
- public void remove() {
+ @Override
+ public void remove() {
throw new UnsupportedOperationException();
}
};
/**
* Iterate the "queued" additions
*/
- @SuppressWarnings({"unchecked"})
+ @Override
+ @SuppressWarnings({"unchecked"})
public final Collection getQueuedOrphans(String entityName) {
if ( hasQueuedOperations() ) {
Collection additions = new ArrayList( operationQueue.size() );
* Called before inserting rows, to ensure that any surrogate keys
* are fully generated
*/
- public void preInsert(CollectionPersister persister) throws HibernateException {
+ @Override
+ public void preInsert(CollectionPersister persister) throws HibernateException {
}
/**
* Called after inserting a row, to fetch the natively generated id
*/
- public void afterRowInsert(CollectionPersister persister, Object entry, int i) throws HibernateException {
+ @Override
+ public void afterRowInsert(CollectionPersister persister, Object entry, int i) throws HibernateException {
}
/**
* get all "orphaned" elements
*/
- public abstract Collection getOrphans(Serializable snapshot, String entityName) throws HibernateException;
+ @Override
+ public abstract Collection getOrphans(Serializable snapshot, String entityName) throws HibernateException;
/**
* Get the current session
this.itr = itr;
}
- public boolean hasNext() {
+ @Override
+ public boolean hasNext() {
return itr.hasNext();
}
- public Object next() {
+ @Override
+ public Object next() {
return itr.next();
}
- public void remove() {
+ @Override
+ public void remove() {
write();
itr.remove();
}
this.itr = itr;
}
- @SuppressWarnings({"unchecked"})
+ @Override
+ @SuppressWarnings({"unchecked"})
public void add(Object o) {
write();
itr.add( o );
}
- public boolean hasNext() {
+ @Override
+ public boolean hasNext() {
return itr.hasNext();
}
- public boolean hasPrevious() {
+ @Override
+ public boolean hasPrevious() {
return itr.hasPrevious();
}
- public Object next() {
+ @Override
+ public Object next() {
return itr.next();
}
- public int nextIndex() {
+ @Override
+ public int nextIndex() {
return itr.nextIndex();
}
- public Object previous() {
+ @Override
+ public Object previous() {
return itr.previous();
}
- public int previousIndex() {
+ @Override
+ public int previousIndex() {
return itr.previousIndex();
}
- public void remove() {
+ @Override
+ public void remove() {
write();
itr.remove();
}
- @SuppressWarnings({"unchecked"})
+ @Override
+ @SuppressWarnings({"unchecked"})
public void set(Object o) {
write();
itr.set( o );
this.set = set;
}
- @SuppressWarnings({"unchecked"})
+ @Override
+ @SuppressWarnings({"unchecked"})
public boolean add(Object o) {
write();
return set.add( o );
}
- @SuppressWarnings({"unchecked"})
+ @Override
+ @SuppressWarnings({"unchecked"})
public boolean addAll(Collection c) {
write();
return set.addAll( c );
}
- public void clear() {
+ @Override
+ public void clear() {
write();
set.clear();
}
- public boolean contains(Object o) {
+ @Override
+ public boolean contains(Object o) {
return set.contains( o );
}
- public boolean containsAll(Collection c) {
+ @Override
+ public boolean containsAll(Collection c) {
return set.containsAll( c );
}
- public boolean isEmpty() {
+ @Override
+ public boolean isEmpty() {
return set.isEmpty();
}
- public Iterator iterator() {
+ @Override
+ public Iterator iterator() {
return new IteratorProxy( set.iterator() );
}
- public boolean remove(Object o) {
+ @Override
+ public boolean remove(Object o) {
write();
return set.remove( o );
}
- public boolean removeAll(Collection c) {
+ @Override
+ public boolean removeAll(Collection c) {
write();
return set.removeAll( c );
}
- public boolean retainAll(Collection c) {
+ @Override
+ public boolean retainAll(Collection c) {
write();
return set.retainAll( c );
}
- public int size() {
+ @Override
+ public int size() {
return set.size();
}
- public Object[] toArray() {
+ @Override
+ public Object[] toArray() {
return set.toArray();
}
- @SuppressWarnings({"unchecked"})
+ @Override
+ @SuppressWarnings({"unchecked"})
public Object[] toArray(Object[] array) {
return set.toArray( array );
}
}
}
- public Object getIdentifier(Object entry, int i) {
+ @Override
+ public Object getIdentifier(Object entry, int i) {
throw new UnsupportedOperationException();
}
- public Object getOwner() {
+ @Override
+ public Object getOwner() {
return owner;
}
- public void setOwner(Object owner) {
+ @Override
+ public void setOwner(Object owner) {
this.owner = owner;
}
/** ------ Below is section of code which makes remote service calls ----- */
- // The affected methods are :
+ // The affected methods are :
// initialize(final boolean writing)
// readSize()
// readIndexExistence(final Object index)
// readElementExistence(final Object element)
- // readElementByIndex(final Object index)
-
+ // readElementByIndex(final Object index)
+
private static ICdmApplicationConfiguration configuration;
private static boolean remoting = false;
-
+
public static void setConfiguration(ICdmApplicationConfiguration conf) {
configuration = conf;
-
+
if(conf instanceof CdmApplicationRemoteController) {
remoting = true;
} else {
remoting = false;
}
}
-
-
+
+
private void remoteInitialize() {
-
- if (getOwner() != null && !initialized) {
-
+
+ if (getOwner() != null && !initialized) {
+
try {
String role = getRole();
String fieldName = role.substring(role.lastIndexOf(".") + 1);
log.info("--> Remote Lazy Initializing " + getRole() + " , key : " + getKey() + " , field : " + fieldName);
Object owner = getOwner();
-
+
if(configuration == null) {
throw new HibernateException("CdmApplicationRemoteConfiguration not initialized (null)");
}
if(commonService == null) {
throw new HibernateException("commonService not initialized (null)");
}
-
- PersistentCollection col = commonService.initializeCollection(this);
- afterInitialize();
-
- Class<?> clazz = getClass();
- if (clazz != null) {
- CollectionField cf = getCollectionField(col);
- Field field = clazz.getDeclaredField(cf.getFieldName());
- field.setAccessible(true);
- field.set(this, cf.getCollection());
- }
+
+// PersistentCollection col = commonService.initializeCollection(this);
+// afterInitialize();
+//
+// Class<?> clazz = getClass();
+// if (clazz != null) {
+// CollectionField cf = getCollectionField(col);
+// Field field = clazz.getDeclaredField(cf.getFieldName());
+// field.setAccessible(true);
+// field.set(this, cf.getCollection());
+// }
} catch (Exception ex) {
log.warn(ex.getMessage());
- }
+ }
+ log.warn("This code is invalid");
}
}
-
-
+
+
private CollectionField getCollectionField(PersistentCollection pc) {
if(pc != null) {
if(pc instanceof PersistentSet) {
}
return null;
}
-
+
private String getCollectionFieldName(PersistentCollection pc) {
if(pc != null) {
if(pc instanceof PersistentSet || pc instanceof PersistentSortedSet) {
return "set";
- }
+ }
if(pc instanceof PersistentList) {
return "list";
}
}
return null;
}
-
+
private class CollectionField {
- private Object col;
- private String fieldName;
+ private final Object col;
+ private final String fieldName;
public CollectionField(Object col, String fieldName) {
this.col = col;
this.fieldName = fieldName;
}
-
+
public Object getCollection() {
return this.col;
}
-
+
public String getFieldName() {
return this.fieldName;
}
}
-
+
public static boolean isInitialized(List list) {
return ((AbstractPersistentCollection)list).initialized;
}
-
+
public static boolean isInitialized(Map map) {
return ((AbstractPersistentCollection)map).initialized;
}
-
+
public static boolean isInitialized(Set set) {
return ((AbstractPersistentCollection)set).initialized;
}
-
- //FIXME:Remoting These methods may no longer be required since we are
- // initialising collections as default behaviour
- private int remoteSize() {
- int size = configuration.getCommonService().size(this);
- log.debug("--> Remote Lazy Initializing size of " + getRole() + " to " + size);
- if(size == -1) {
- throw new HibernateException("size of " + getClass() + " could not be retrieved from remote service");
- }
- return size;
- }
-
- private Object remoteReadElementByIndex(int index) {
- Object element = configuration.getCommonService().get(this,index);
- log.debug("--> Remote Lazy Initializing element from " + getRole() + " at index " + index);
- return element;
- }
-
- private boolean remoteReadElementExistence(Object element) {
- return configuration.getCommonService().contains(this,element);
- }
-
- private boolean remoteReadIndexExistence(Object index) {
- return false;
- }
+
+
}
Bundle-ManifestVersion: 2
Bundle-Name: Editor Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.editor;singleton:=true
-Bundle-Version: 3.6.1
+Bundle-Version: 3.7.0
Bundle-Activator: eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: OSGI-INF/l10n/plugin
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.6.1</version>
+ <version>3.7.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
import java.util.Map;
import org.apache.log4j.Logger;
-import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.ui.PartInitException;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
private final Logger logger = Logger.getLogger(EditorCdmViewer.class);
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.view.ICdmViewer#show(java.lang.Object)
- */
@Override
- public void show(Object input, Class<?> viewerClass, ExecutionEvent event) {
+ public void show(Object input, Class<?> viewerClass) {
try {
if(viewerClass.equals(MultiPageTaxonEditor.class)){
if(input instanceof TaxonBase){
}
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.view.ICdmViewer#getViewerClasses(java.lang.Object)
- */
@Override
public Map<Class<?>, String> getViewerClasses(Object input) {
Map<Class<?>, String> viewerNameMap = new HashMap<Class<?>, String>();
TaxonNode newTaxonNode = parentNode.addChildTaxon(newTaxon, parentNode.getReference(), parentNode.getMicroReference());
// add the new taxon to the editors persistence context
- UUID newTaxonNodeUuid = CdmStore.getService(ITaxonNodeService.class).save(newTaxonNode);
+ UUID newTaxonNodeUuid = CdmStore.getService(ITaxonNodeService.class).save(newTaxonNode).getUuid();
return new TaxonEditorInput(newTaxonNode, conversation);
}
NameDeletionConfigurator nameConfig = new NameDeletionConfigurator();
nameConfig.setRemoveAllNameRelationships(true);
config.setNameDeletionConfig(nameConfig);
- service.deleteTaxon(misapplication, config, null);
+ service.deleteTaxon(misapplication.getUuid(), config, null);
monitor.worked(40);
return postExecute(null);
ITaxonService service = controller.getTaxonService();\r
\r
\r
- DeleteResult result = service.deleteTaxon(element, configurator, classification);\r
+ DeleteResult result = service.deleteTaxon(element.getUuid(), configurator, classification.getUuid());\r
if (result.isError()){\r
MessageDialog.openError(null, "Delete failed", result.toString());\r
} else if (!result.getUpdatedObjects().isEmpty()){\r
*/
public class TransientAgentService implements IAgentService {
- private IAgentService defaultService;
+ private final IAgentService defaultService;
/**
* @param defaultAgentService
* @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
*/
@Override
- public UUID save(AgentBase newInstance) {
+ public AgentBase save(AgentBase newInstance) {
return null;
}
return defaultService.convertTeam2Person(arg0);
}
+
+ @Override
+ public DeleteResult delete(UUID arg0) {
+ return defaultService.delete(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+ */
+ @Override
+ public List<AgentBase> merge(List<AgentBase> arg0) {
+ return defaultService.merge(arg0);
+ }
+
}
* @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
*/
@Override
- public UUID save(Classification newInstance) {
+ public Classification save(Classification newInstance) {
return null;
}
return defaultService.createHierarchyInClassification(arg1, arg2);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.UUID)
+ */
+ @Override
+ public DeleteResult delete(UUID arg0) {
+ return defaultService.delete(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+ */
+ @Override
+ public List<Classification> merge(List<Classification> arg0) {
+ return defaultService.merge(arg0);
+ }
}
* @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
*/
@Override
- public UUID save(Collection newInstance) {
+ public Collection save(Collection newInstance) {
return null;
}
public <S extends Collection> Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier, DefinedTerm identifierType, MatchMode matchmode, boolean includeEntity, Integer pageSize, Integer pageNumber, List<String> propertyPaths){
return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
}
+
+
+ @Override
+ public DeleteResult delete(UUID arg0) {
+ return defaultService.delete(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(java.util.Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+ */
+ @Override
+ public List<Collection> merge(List<Collection> arg0) {
+ return defaultService.merge(arg0);
+ }
+
}
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.DistributionTree;
import eu.etaxonomy.cdm.api.service.IDescriptionService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
import eu.etaxonomy.cdm.api.service.dto.FindByIdentifierDTO;
* @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
*/
@Override
- public UUID save(DescriptionBase newInstance) {
+ public DescriptionBase save(DescriptionBase newInstance) {
return null;
}
}
@Override
- public UUID deleteDescription(DescriptionBase description) {
+ public DeleteResult deleteDescription(DescriptionBase description) {
return defaultService.deleteDescription(description);
}
public Pager<TermDto> pageNamedAreasInUse(boolean includeAllParents, Integer pageSize, Integer pageNumber) {
return defaultService.pageNamedAreasInUse(includeAllParents, pageSize, pageNumber);
}
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.UUID)
+ */
+ @Override
+ public DeleteResult delete(UUID uuid) {
+ return defaultService.deleteDescription(uuid);
+ }
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IDescriptionService#deleteDescription(java.util.UUID)
+ */
+ @Override
+ public DeleteResult deleteDescription(UUID uuid) {
+ return defaultService.delete(uuid);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IDescriptionService#deleteDescriptionElement(java.util.UUID)
+ */
+ @Override
+ public UUID deleteDescriptionElement(UUID uuid) {
+ return defaultService.deleteDescriptionElement(uuid);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IDescriptionService#moveTaxonDescriptions(eu.etaxonomy.cdm.model.taxon.Taxon, eu.etaxonomy.cdm.model.taxon.Taxon)
+ */
+ @Override
+ public UpdateResult moveTaxonDescriptions(Taxon sourceTaxon, Taxon targetTaxon) {
+ return defaultService.moveTaxonDescriptions(sourceTaxon, targetTaxon);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IDescriptionService#moveTaxonDescriptions(java.util.UUID, java.util.UUID)
+ */
+ @Override
+ public UpdateResult moveTaxonDescriptions(UUID sourceTaxonUuid, UUID targetTaxonUuid) {
+ return defaultService.moveTaxonDescriptions(sourceTaxonUuid, targetTaxonUuid);
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+ */
+ @Override
+ public List<DescriptionBase> merge(List<DescriptionBase> arg0) {
+ return defaultService.merge(arg0);
+ }
+
}
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.INameService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
*/
public class TransientNameService implements INameService {
- private INameService defaultService;
+ private final INameService defaultService;
/**
*
* @see eu.etaxonomy.cdm.api.service.INameService#delete(eu.etaxonomy.cdm.model.name.TaxonNameBase, eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator)
*/
@Override
- public DeleteResult delete(TaxonNameBase name, NameDeletionConfigurator config) {
- return defaultService.delete(name, config);
+ public DeleteResult delete(UUID nameUuid, NameDeletionConfigurator config) {
+ return defaultService.delete(nameUuid, config);
}
/**
* @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
*/
@Override
- public UUID save(TaxonNameBase newInstance) {
+ public TaxonNameBase save(TaxonNameBase newInstance) {
return null;
}
public TaxonNameBase findWithoutFlush(UUID uuid) {
return defaultService.findWithoutFlush(uuid);
}
-
-
+
@Override
public <S extends TaxonNameBase> Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier, DefinedTerm identifierType, MatchMode matchmode, boolean includeEntity, Integer pageSize, Integer pageNumber, List<String> propertyPaths){
return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
}
-
+
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.INameService#setAsGroupsBasionym(java.util.UUID)
+ */
+ @Override
+ public UpdateResult setAsGroupsBasionym(UUID nameUuid) {
+ return defaultService.delete(nameUuid);
+ }
+
@Override
public List<HashMap<String, String>> getNameRecords() {
-
+
return defaultService.getNameRecords();
}
-
-
-
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public DeleteResult delete(UUID arg0) {
+ return defaultService.delete(arg0);
+ }
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+ */
+ @Override
+ public List<TaxonNameBase> merge(List<TaxonNameBase> arg0) {
+ return defaultService.merge(arg0);
+ }
}
import eu.etaxonomy.cdm.model.media.Rights;
import eu.etaxonomy.cdm.model.molecular.DnaSample;
import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
* @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
*/
@Override
- public UUID save(SpecimenOrObservationBase newInstance) {
+ public SpecimenOrObservationBase save(SpecimenOrObservationBase newInstance) {
units.add(newInstance);
return null;
}
return defaultService.list(example, includeProperties, limit, start, orderHints, propertyPaths);
}
- /**
- * @param clazz
- * @param matchStrategy
- * @param mergeStrategy
- * @return
- * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#deduplicate(java.lang.Class, eu.etaxonomy.cdm.strategy.match.IMatchStrategy, eu.etaxonomy.cdm.strategy.merge.IMergeStrategy)
- */
@Override
public int deduplicate(Class<? extends SpecimenOrObservationBase> clazz, IMatchStrategy matchStrategy, IMergeStrategy mergeStrategy) {
return defaultService.deduplicate(clazz, matchStrategy, mergeStrategy);
}
- /**
- * @param clazz
- * @param queryString
- * @param pageSize
- * @param pageNumber
- * @param orderHints
- * @param matchMode
- * @return
- * @see eu.etaxonomy.cdm.api.service.IIdentifiableEntityService#findTitleCache(java.lang.Class, java.lang.String, java.lang.Integer, java.lang.Integer, java.util.List, eu.etaxonomy.cdm.persistence.query.MatchMode)
- */
@Override
public Pager<SpecimenOrObservationBase> findTitleCache(Class<? extends SpecimenOrObservationBase> clazz, String queryString, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, MatchMode matchMode) {
return defaultService.findTitleCache(clazz, queryString, pageSize, pageNumber, orderHints, matchMode);
}
- /**
- * @return
- */
public Collection<SpecimenOrObservationBase<?>> getUnits() {
return units;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#getFieldUnits(java.util.UUID)
- */
@Override
public Collection<FieldUnit> getFieldUnits(UUID derivedUnitUuid) {
return defaultService.getFieldUnits(derivedUnitUuid);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#pageByAssociatedTaxon(java.lang.Class, java.util.Set, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
- */
@Override
public <T extends SpecimenOrObservationBase> Pager<T> pageByAssociatedTaxon(Class<T> type,
Set<TaxonRelationshipEdge> includeRelationships, String taxonUUID, Integer maxDepth, Integer pageSize,
maxDepth, pageSize, pageNumber, orderHints, propertyPaths);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#moveDerivate(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, eu.etaxonomy.cdm.model.occurrence.DerivedUnit)
- */
@Override
public boolean moveDerivate(SpecimenOrObservationBase<?> from, SpecimenOrObservationBase<?> to, DerivedUnit derivate) {
return defaultService.moveDerivate(from, to, derivate);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#moveSequence(eu.etaxonomy.cdm.model.molecular.DnaSample, eu.etaxonomy.cdm.model.molecular.DnaSample, eu.etaxonomy.cdm.model.molecular.Sequence)
- */
@Override
public boolean moveSequence(DnaSample from, DnaSample to, Sequence sequence) {
return defaultService.moveSequence(from, to, sequence);
return defaultService.isDeletable(object, config);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#countDeterminations(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, eu.etaxonomy.cdm.model.taxon.TaxonBase)
- */
@Override
public int countDeterminations(SpecimenOrObservationBase occurence, TaxonBase taxonbase) {
return defaultService.countDeterminations(occurence, taxonbase);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#assembleFieldUnitDTO(eu.etaxonomy.cdm.model.occurrence.FieldUnit, java.util.UUID)
- */
@Override
public FieldUnitDTO assembleFieldUnitDTO(FieldUnit fieldUnit, UUID associatedTaxonUuid) {
return defaultService.assembleFieldUnitDTO(fieldUnit, associatedTaxonUuid);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#assemblePreservedSpecimenDTO(eu.etaxonomy.cdm.model.occurrence.DerivedUnit)
- */
@Override
public PreservedSpecimenDTO assemblePreservedSpecimenDTO(DerivedUnit derivedUnit) {
return defaultService.assemblePreservedSpecimenDTO(derivedUnit);
return defaultService.getNonCascadedAssociatedElements(specimen);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#deleteDerivateHierarchy(eu.etaxonomy.cdm.model.common.ICdmBase)
- */
@Override
public DeleteResult deleteDerivateHierarchy(CdmBase from, SpecimenDeleteConfigurator config) {
return defaultService.deleteDerivateHierarchy(from, config);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#delete(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator)
- */
@Override
public DeleteResult delete(SpecimenOrObservationBase<?> specimen, SpecimenDeleteConfigurator config) {
return defaultService.delete(specimen, config);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#listIndividualsAssociations(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
- */
@Override
public Collection<IndividualsAssociation> listIndividualsAssociations(SpecimenOrObservationBase<?> specimen,
Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths) {
return defaultService.listIndividualsAssociations(specimen, limit, start, orderHints, propertyPaths);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#listTypeDesignations(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
- */
@Override
public Collection<SpecimenTypeDesignation> listTypeDesignations(SpecimenOrObservationBase<?> specimen,
Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths) {
return defaultService.listTypeDesignations(specimen, limit, start, orderHints, propertyPaths);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#listDescriptionsWithDescriptionSpecimen(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
- */
@Override
public Collection<DescriptionBase<?>> listDescriptionsWithDescriptionSpecimen(
SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints,
return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#getCharacterDataForSpecimen(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase)
- */
@Override
public Collection<DescriptionElementBase> getCharacterDataForSpecimen(SpecimenOrObservationBase<?> arg0) {
return defaultService.getCharacterDataForSpecimen(arg0);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#getCharacterDataForSpecimen(java.util.UUID)
- */
@Override
public Collection<DescriptionElementBase> getCharacterDataForSpecimen(UUID arg0) {
return getCharacterDataForSpecimen(arg0);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#getMostSignificantIdentifier(eu.etaxonomy.cdm.model.occurrence.DerivedUnit)
- */
@Override
public String getMostSignificantIdentifier(DerivedUnit derivedUnit) {
return defaultService.getMostSignificantIdentifier(derivedUnit);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#countOccurrences(eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator)
- */
@Override
public int countOccurrences(IIdentifiableEntityServiceConfigurator<SpecimenOrObservationBase> config) {
return defaultService.countOccurrences(config);
return defaultService.getAllHierarchyDerivatives(specimen);
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.UUID)
+ */
+ @Override
+ public DeleteResult delete(UUID uuid) {
+ return defaultService.delete(uuid);
+ }
+
+ @Override
+ public DeleteResult delete(Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
+
+ @Override
+ public DeleteResult deleteSingleRead(SingleRead singleRead, Sequence sequence){
+ return defaultService.deleteSingleRead(singleRead, sequence);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+ */
+ @Override
+ public List<SpecimenOrObservationBase> merge(List<SpecimenOrObservationBase> arg0) {
+ return defaultService.merge(arg0);
+ }
+
+
}
*/
public class TransientReferenceService implements IReferenceService {
- private IReferenceService defaultService;
+ private final IReferenceService defaultService;
/**
* @param defaultReferenceService
* @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
*/
@Override
- public UUID save(Reference newInstance) {
+ public Reference save(Reference newInstance) {
return null;
}
public Reference findWithoutFlush(UUID uuid) {
return defaultService.findWithoutFlush(uuid);
}
-
+
@Override
public <S extends Reference> Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier, DefinedTerm identifierType, MatchMode matchmode, boolean includeEntity, Integer pageSize, Integer pageNumber, List<String> propertyPaths){
return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.UUID)
+ */
+ @Override
+ public DeleteResult delete(UUID uuid) {
+ return defaultService.delete(uuid);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+ */
+ @Override
+ public List<Reference> merge(List<Reference> arg0) {
+ return defaultService.merge(arg0);
+ }
}
// $Id$
/**
-* 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.
-*/
+ * 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.dataimport.transientServices;
import java.io.IOException;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.api.service.TaxaAndNamesSearchMode;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator;
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
return defaultService.searchTaxaByName(name, sec);
}
+
/**
- * @param synonym
- * @param acceptedTaxon
- * @see eu.etaxonomy.cdm.api.service.ITaxonService#swapSynonymAndAcceptedTaxon(eu.etaxonomy.cdm.model.taxon.Synonym, eu.etaxonomy.cdm.model.taxon.Taxon)
+ * {@inheritDoc}
*/
@Override
- public void swapSynonymAndAcceptedTaxon(Synonym synonym, Taxon acceptedTaxon) {
- defaultService.swapSynonymAndAcceptedTaxon(synonym, acceptedTaxon);
+ public UpdateResult swapSynonymAndAcceptedTaxon(Synonym arg0, Taxon arg1) {
+ return defaultService.swapSynonymAndAcceptedTaxon(arg0, arg1);
+
}
/**
* @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
*/
@Override
- public UUID save(TaxonBase newInstance) {
+ public TaxonBase save(TaxonBase newInstance) {
return null;
}
String queryString, Classification classification, Set<NamedArea> namedAreas,
Set<PresenceAbsenceTerm> distributionStatus, List<Language> languages, boolean highlightFragments,
Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
- throws CorruptIndexException, IOException, ParseException, LuceneMultiSearchException {
+ throws CorruptIndexException, IOException, ParseException, LuceneMultiSearchException {
return defaultService.findTaxaAndNamesByFullText(searchModes, queryString, classification, namedAreas, distributionStatus, languages, highlightFragments, pageSize, pageNumber, orderHints, propertyPaths);
}
return defaultService.deleteSynonym(arg0, arg1, arg2);
}
- @Override
- public DeleteResult deleteTaxon(Taxon arg0, TaxonDeletionConfigurator arg1, Classification arg2) {
- return defaultService.deleteTaxon(arg0, arg1, arg2);
- }
-
@Override
public List<List<Synonym>> getSynonymsByHomotypicGroup(Taxon taxon, List<String> propertyPaths) {
return defaultService.getSynonymsByHomotypicGroup(taxon, propertyPaths);
}
- @Override
- public Synonym changeRelatedTaxonToSynonym(Taxon fromTaxon, Taxon toTaxon,
- TaxonRelationshipType oldRelationshipType,
- SynonymRelationshipType synonymRelationshipType)
- throws DataChangeNoRollbackException {
+ @Override
+ public Synonym changeRelatedTaxonToSynonym(Taxon fromTaxon, Taxon toTaxon,
+ TaxonRelationshipType oldRelationshipType,
+ SynonymRelationshipType synonymRelationshipType)
+ throws DataChangeNoRollbackException {
- return defaultService.changeRelatedTaxonToSynonym(fromTaxon, toTaxon, oldRelationshipType, synonymRelationshipType);
- }
+ return defaultService.changeRelatedTaxonToSynonym(fromTaxon, toTaxon, oldRelationshipType, synonymRelationshipType);
+ }
/* (non-Javadoc)
* @see eu.etaxonomy.cdm.api.service.ITaxonService#pageAcceptedTaxaFor(java.util.UUID, java.util.UUID, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
return defaultService.listAcceptedTaxaFor(synonymUuid, classificationUuid, pageSize, pageNumber, orderHints, propertyPaths);
}
- @Override
- public DeleteResult isDeletable(TaxonBase object,
- DeleteConfiguratorBase config) {
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public DeleteResult isDeletable(TaxonBase object,
+ DeleteConfiguratorBase config) {
+ // TODO Auto-generated method stub
+ return null;
+ }
- @Override
- public IncludedTaxaDTO listIncludedTaxa(UUID taxonUuid,
- IncludedTaxonConfiguration configuration) {
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public IncludedTaxaDTO listIncludedTaxa(UUID taxonUuid,
+ IncludedTaxonConfiguration configuration) {
+ // TODO Auto-generated method stub
+ return null;
+ }
- @Override
- public TaxonBase findWithoutFlush(UUID uuid) {
- return defaultService.findWithoutFlush(uuid);
- }
+ @Override
+ public TaxonBase findWithoutFlush(UUID uuid) {
+ return defaultService.findWithoutFlush(uuid);
+ }
/* (non-Javadoc)
* @see eu.etaxonomy.cdm.api.service.ITaxonService#findTaxaByName(eu.etaxonomy.cdm.api.service.config.MatchingTaxonConfigurator)
return defaultService.findTaxaByName(config);
}
- @Override
- public <S extends TaxonBase> Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier, DefinedTerm identifierType, MatchMode matchmode, boolean includeEntity, Integer pageSize, Integer pageNumber, List<String> propertyPaths){
- return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
- }
+ @Override
+ public <S extends TaxonBase> Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier, DefinedTerm identifierType, MatchMode matchmode, boolean includeEntity, Integer pageSize, Integer pageNumber, List<String> propertyPaths){
+ return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
+ }
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.service.ITaxonService#findByIdentifier(java.lang.Class, java.lang.String, eu.etaxonomy.cdm.model.common.DefinedTerm, eu.etaxonomy.cdm.model.taxon.TaxonNode, eu.etaxonomy.cdm.persistence.query.MatchMode, boolean, java.lang.Integer, java.lang.Integer, java.util.List)
- */
- @Override
- public <S extends TaxonBase> Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier,
- DefinedTerm identifierType, TaxonNode subtreeFilter, MatchMode matchmode, boolean includeEntity,
- Integer pageSize, Integer pageNumber, List<String> propertyPaths) {
- return defaultService.findByIdentifier(clazz, identifier, identifierType, subtreeFilter, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
- }
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.ITaxonService#findByIdentifier(java.lang.Class, java.lang.String, eu.etaxonomy.cdm.model.common.DefinedTerm, eu.etaxonomy.cdm.model.taxon.TaxonNode, eu.etaxonomy.cdm.persistence.query.MatchMode, boolean, java.lang.Integer, java.lang.Integer, java.util.List)
+ */
+ @Override
+ public <S extends TaxonBase> Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier,
+ DefinedTerm identifierType, TaxonNode subtreeFilter, MatchMode matchmode, boolean includeEntity,
+ Integer pageSize, Integer pageNumber, List<String> propertyPaths) {
+ return defaultService.findByIdentifier(clazz, identifier, identifierType, subtreeFilter, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
+ }
-
-
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.ITaxonService#deleteSynonym(java.util.UUID, java.util.UUID, eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator)
+ */
+ @Override
+ public DeleteResult deleteSynonym(UUID synonymUuid, UUID taxonUuid, SynonymDeletionConfigurator config) {
+ return defaultService.deleteSynonym(synonymUuid, taxonUuid, config);
+ }
+
+
+ /**
+ * {@inheritDoc}
+
+ */
+ @Override
+ public UpdateResult swapSynonymAndAcceptedTaxon(UUID synonymUUid, UUID acceptedTaxonUuid) {
+ return defaultService.swapSynonymAndAcceptedTaxon(synonymUUid, acceptedTaxonUuid);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.ITaxonService#deleteTaxon(java.util.UUID, eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator, java.util.UUID)
+ */
+ @Override
+ public DeleteResult deleteTaxon(UUID taxonUuid, TaxonDeletionConfigurator config, UUID classificationUuid) {
+ return defaultService.deleteTaxon(taxonUuid, config, classificationUuid);
+ }
@Override
- public SynonymRelationship moveSynonymToAnotherTaxon(
- SynonymRelationship oldSynonymRelation, UUID newTaxonUUID,
- boolean moveHomotypicGroup,
- SynonymRelationshipType newSynonymRelationshipType,
- Reference reference, String referenceDetail, boolean keepReference)
- throws HomotypicalGroupChangeException {
-
- return defaultService.moveSynonymToAnotherTaxon(oldSynonymRelation, newTaxonUUID, moveHomotypicGroup, newSynonymRelationshipType, reference, referenceDetail, keepReference);
+ public UpdateResult moveFactualDateToAnotherTaxon(UUID arg0, UUID arg1) {
+ return defaultService.moveFactualDateToAnotherTaxon(arg0, arg1);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public SynonymRelationship moveSynonymToAnotherTaxon(
+ SynonymRelationship oldSynonymRelation, UUID newTaxonUUID,
+ boolean moveHomotypicGroup,
+ SynonymRelationshipType newSynonymRelationshipType,
+ Reference reference, String referenceDetail, boolean keepReference)
+ throws HomotypicalGroupChangeException {
+
+ return defaultService.moveSynonymToAnotherTaxon(oldSynonymRelation, newTaxonUUID, moveHomotypicGroup, newSynonymRelationshipType, reference, referenceDetail, keepReference);
+ }
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.UUID)
+ */
+ @Override
+ public DeleteResult delete(UUID uuid) {
+ return defaultService.delete(uuid);
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+ */
+ @Override
+ public List<TaxonBase> merge(List<TaxonBase> arg0) {
+ return defaultService.merge(arg0);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.ITaxonService#deleteSynonym(java.util.UUID, eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator)
+ */
+ @Override
+ public DeleteResult deleteSynonym(UUID arg0, SynonymDeletionConfigurator arg1) {
+ return defaultService.deleteSynonym(arg0, arg1);
+ }
}
// $Id$
/**
-* 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.
-*/
+ * 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.dataimport.transientServices;
import java.net.URI;
* @see eu.etaxonomy.cdm.api.service.IService#save(eu.etaxonomy.cdm.model.common.ICdmBase)
*/
@Override
- public UUID save(DefinedTermBase newInstance) {
+ public DefinedTermBase save(DefinedTermBase newInstance) {
return null;
}
return defaultService.findByIdInVocabulary(id, vocabularyUuid, clazz);
}
- @Override
- public DeleteResult isDeletable(DefinedTermBase object,
- DeleteConfiguratorBase config) {
- return defaultService.isDeletable(object, config);
- }
+ @Override
+ public DeleteResult isDeletable(DefinedTermBase object,
+ DeleteConfiguratorBase config) {
+ return defaultService.isDeletable(object, config);
+ }
/* (non-Javadoc)
* @see eu.etaxonomy.cdm.api.service.ITermService#listByTermType(eu.etaxonomy.cdm.model.common.TermType, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
return defaultService.listByTermType(termType, limit, start, orderHints, propertyPaths);
}
- @Override
- public DefinedTermBase findWithoutFlush(UUID uuid) {
- return defaultService.findWithoutFlush(uuid);
- }
-
+ @Override
+ public DefinedTermBase findWithoutFlush(UUID uuid) {
+ return defaultService.findWithoutFlush(uuid);
+ }
+
+
+ @Override
+ public <S extends DefinedTermBase> Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier, DefinedTerm identifierType, MatchMode matchmode, boolean includeEntity, Integer pageSize, Integer pageNumber, List<String> propertyPaths){
+ return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.UUID)
+ */
+ @Override
+ public DeleteResult delete(UUID uuid) {
+ return defaultService.delete(uuid);
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
- @Override
- public <S extends DefinedTermBase> Pager<FindByIdentifierDTO<S>> findByIdentifier(Class<S> clazz, String identifier, DefinedTerm identifierType, MatchMode matchmode, boolean includeEntity, Integer pageSize, Integer pageNumber, List<String> propertyPaths){
- return defaultService.findByIdentifier(clazz, identifier, identifierType, matchmode, includeEntity, pageSize, pageNumber, propertyPaths);
- }
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#merge(java.util.List)
+ */
+ @Override
+ public List<DefinedTermBase> merge(List<DefinedTermBase> arg0) {
+ return defaultService.merge(arg0);
+ }
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.ITermService#delete(java.util.UUID, eu.etaxonomy.cdm.api.service.config.TermDeletionConfigurator)
+ */
+ @Override
+ public DeleteResult delete(UUID arg0, TermDeletionConfigurator arg1) {
+ return defaultService.delete(arg0, arg1);
+ }
}
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.TreeNode;
import org.eclipse.jface.viewers.ViewerDropAdapter;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.TransferData;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
return LocalSelectionTransfer.getTransfer().isSupportedType(transferType) && target instanceof TreeNode;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void dragOver(DropTargetEvent event) {
+ super.dragOver(event);
+ event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL;
+ }
+
}
boolean deepDelete = event.getCommand().getId().equals("eu.etaxonomy.taxeditor.editor.derivate.deepDelete");
config.setDeleteChildren(deepDelete);
config.setDeleteMolecularData(deepDelete);
- DeleteDerivateOperation deleteDerivateOperation = new DeleteDerivateOperation(label, undoContext, (CdmBase) value, postOperationEnabled, config);
+ DeleteDerivateOperation deleteDerivateOperation = new DeleteDerivateOperation(label, undoContext, (CdmBase) value, (TreeNode) object, postOperationEnabled, config);
AbstractUtility.executeOperation(deleteDerivateOperation);
}
}
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.TreeNode;
import org.eclipse.ui.ISaveablePart;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
public class DeleteDerivateOperation extends AbstractPostOperation<CdmBase> {
private final SpecimenDeleteConfigurator deleteConfigurator;
+ private final TreeNode treeNode;
- public DeleteDerivateOperation(String label, IUndoContext undoContext, CdmBase element,
+ public DeleteDerivateOperation(String label, IUndoContext undoContext, CdmBase element, TreeNode treeNode,
IPostOperationEnabled postOperationEnabled) {
- this(label, undoContext, element, postOperationEnabled, new SpecimenDeleteConfigurator());
+ this(label, undoContext, element, treeNode, postOperationEnabled, new SpecimenDeleteConfigurator());
}
- public DeleteDerivateOperation(String label, IUndoContext undoContext, CdmBase element,
+ public DeleteDerivateOperation(String label, IUndoContext undoContext, CdmBase element, TreeNode treeNode,
IPostOperationEnabled postOperationEnabled, SpecimenDeleteConfigurator config) {
super(label, undoContext, element, postOperationEnabled);
this.deleteConfigurator = config;
+ this.treeNode = treeNode;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse
- * .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
/** {@inheritDoc} */
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
return Status.CANCEL_STATUS;
}
}
- DeleteResult deleteResult = CdmStore.getService(IOccurrenceService.class).deleteDerivateHierarchy(element, deleteConfigurator);
+ DeleteResult deleteResult;
+ if(element instanceof SingleRead && treeNode!=null
+ && treeNode.getValue().equals(element)
+ && treeNode.getParent()!=null
+ && treeNode.getParent().getValue() instanceof Sequence){
+ deleteResult = CdmStore.getService(IOccurrenceService.class).deleteSingleRead((SingleRead)element, (Sequence) treeNode.getParent().getValue());
+ }
+ else{
+ deleteResult = CdmStore.getService(IOccurrenceService.class).deleteDerivateHierarchy(element, deleteConfigurator);
+ }
if(deleteResult.isOk()){
if(getPostOperationEnabled() instanceof DerivateView){
DerivateView derivateView = (DerivateView) getPostOperationEnabled();
return Status.OK_STATUS;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse
- * .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
/** {@inheritDoc} */
@Override
public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
return Status.CANCEL_STATUS ;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse
- * .core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- */
/** {@inheritDoc} */
@Override
public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
<feature
id="eu.etaxonomy.taxeditor.feature.platform"
label="Taxeditor Dependencies"
- version="3.6.1"
+ version="3.7.0"
os="linux,macosx,win32"
ws="cocoa,gtk,win32"
arch="x86,x86_64">
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.6.1</version>
+ <version>3.7.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eu.etaxonomy.taxeditor.feature.platform</artifactId>
<feature
id="eu.etaxonomy.taxeditor.feature"
label="Taxonomic Editor"
+<<<<<<< HEAD
version="3.6.1"
+=======
+ version="3.7.0"
+>>>>>>> refs/heads/release/3.7.0
provider-name="EDIT"
plugin="eu.etaxonomy.taxeditor.application"
os="linux,macosx,win32"
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.6.1</version>
+ <version>3.7.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: 3.6.1
+Bundle-Version: 3.7.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>3.6.1</version>
+ <version>3.7.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Bundle-ManifestVersion: 2
Bundle-Name: Navigation Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.navigation;singleton:=true
-Bundle-Version: 3.6.1
+Bundle-Version: 3.7.0
Bundle-Vendor: EDIT
Export-Package: eu.etaxonomy.cdm,
eu.etaxonomy.taxeditor.navigation,
command.name.8 = Refresh Polytomous Key list\r
command.name.9 = Refresh Polytomous Key nodes\r
command.name.10 = Fix Classification Hierarchy\r
-\r
+command.name.11 = Delete \r
view.name.2 = Taxonomic Tree\r
navigatorContent.name = Classification\r
navigatorContent.name.0 = TaxonNode\r
\r
menu.label.0 = Aktualisieren\r
command.label.17 = Liste\r
-command.label.18 = Schl�sselknoten\r
+command.label.18 = Schl\u00fcsselknoten\r
command.label.19 = L\u00F6schen\r
command.name = Neuer Taxonknoten\r
command.name.0 = Neue Klassifikation\r
command.name.3 = Aktualisieren\r
command.name.4 = Kopieren\r
command.name.5 = Verschiebe akzeptiertes Taxon in Synonymie\r
-command.name.6 = Neuer Polytomer Schl�ssel\r
-command.name.7 = Bearbeite Schl�ssel-Knoten\r
-command.name.8 = Aktualisiere Schl�ssel-Liste\r
-command.name.9 = Aktualisiere Schl�ssel-Knoten\r
+command.name.6 = Neuer Polytomer Schl\u00fcssel\r
+command.name.7 = Bearbeite Schl\u00fcssel-Knoten\r
+command.name.8 = Aktualisiere Schl\u00fcssel-Liste\r
+command.name.9 = Aktualisiere Schl\u00fcssel-Knoten\r
command.name.10 = Erzeuge Taxon-Hierarchie\r
+command.name.11 = L\u00F6schen\r
view.name.2 = Taxonomiebaum\r
navigatorContent.name = Klassifikation\r
navigatorContent.name.0 = Taxonknoten\r
<command
defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.DeleteHandler"
id="eu.etaxonomy.taxeditor.navigation.command.delete"
- name="delete">
+ name="%command.name.11">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.DeleteHandler"
+ id="eu.etaxonomy.taxeditor.navigation.key.polytomous.command.delete"
+ name="%command.name.11">
</command>
</extension>
<extension
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.6.1</version>
+ <version>3.7.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
import java.util.Map;
import org.apache.log4j.Logger;
-import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.PlatformUI;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
@SuppressWarnings("unused")
private final Logger logger = Logger.getLogger(NavigationCdmViewer.class);
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.view.ICdmViewer#show(java.lang.Object)
- */
@Override
- public void show(Object input, Class<?> viewerClass, ExecutionEvent event) {
+ public void show(Object input, Class<?> viewerClass) {
if(viewerClass.equals(NewClassificationWizard.class)){
if(input instanceof Classification){
Classification classification = (Classification)input;
NewClassificationWizard classificationWizard = new NewClassificationWizard();
classificationWizard.init(null, null);
classificationWizard.setEntity(classification);
- WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), classificationWizard);
+ WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), classificationWizard);
dialog.open();
}
}
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.view.ICdmViewer#getViewerClasses(java.lang.Object)
- */
@Override
public Map<Class<?>, String> getViewerClasses(Object input) {
Map<Class<?>, String> viewerNameMap = new HashMap<Class<?>, String>();
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.taxon.TaxonComparatorSearch;
+
import eu.etaxonomy.cdm.model.taxon.TaxonNaturalComparator;
+import eu.etaxonomy.cdm.model.taxon.TaxonNodeComparator;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.model.DataChangeBridge;
import eu.etaxonomy.taxeditor.model.IDataChangeBehavior;
if (PreferencesUtil.getSortNodesNaturally()){
comparator = new TaxonNaturalComparator();
} else{
- comparator = new TaxonComparatorSearch();
+ comparator = new TaxonNodeComparator();
}
- TaxonNodeComparator viewerComparator = new TaxonNodeComparator(comparator);
+ TaxonNodeNavigatorComparator viewerComparator = new TaxonNodeNavigatorComparator(comparator);
this.getCommonViewer().setComparator(viewerComparator);
setLinkingEnabled(true);
// this.getCommonViewer().addSelectionChangedListener(new ISelectionChangedListener() {
-package eu.etaxonomy.taxeditor.navigation.navigator;\r
-\r
-import java.util.Arrays;\r
-import java.util.Comparator;\r
-\r
-\r
-import org.eclipse.jface.viewers.Viewer;\r
-import org.eclipse.jface.viewers.ViewerComparator;\r
-\r
-\r
-import eu.etaxonomy.cdm.model.common.IdentifiableEntity;\r
-import eu.etaxonomy.cdm.model.taxon.Classification;\r
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
-import eu.etaxonomy.cdm.model.taxon.TaxonComparatorSearch;\r
-import eu.etaxonomy.cdm.model.taxon.TaxonNaturalComparator;\r
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;\r
-import eu.etaxonomy.taxeditor.ui.section.supplemental.IdentifiableSourceElement;\r
-\r
-public class TaxonNodeComparator extends ViewerComparator{\r
-\r
- \r
- public TaxonNodeComparator(Comparator<TaxonBase> comparator){\r
- super(comparator);\r
- }\r
-\r
- \r
- \r
- @Override\r
- public int compare(Viewer viewer, Object e1, Object e2){\r
- if (e1 instanceof Classification && e2 instanceof Classification){\r
- return ((Classification)e1).getTitleCache().compareTo(((Classification)e2).getTitleCache());\r
- } else{\r
- if (this.getComparator() instanceof TaxonNaturalComparator){\r
- return this.getComparator().compare((TaxonNode)e1, (TaxonNode)e2);\r
- }else{\r
- return this.getComparator().compare(((TaxonNode)e1).getTaxon(),((TaxonNode)e2).getTaxon());\r
- }\r
- }\r
- }\r
-}\r
+package eu.etaxonomy.taxeditor.navigation.navigator;
+
+import java.util.Arrays;
+import java.util.Comparator;
+
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+
+
+import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+
+import eu.etaxonomy.cdm.model.taxon.TaxonNaturalComparator;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.IdentifiableSourceElement;
+
+public class TaxonNodeNavigatorComparator extends ViewerComparator{
+
+
+ public TaxonNodeNavigatorComparator(Comparator<TaxonBase> comparator){
+ super(comparator);
+ }
+
+
+
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2){
+ if (e1 instanceof Classification && e2 instanceof Classification){
+ return ((Classification)e1).getTitleCache().compareTo(((Classification)e2).getTitleCache());
+ } else{
+ if (this.getComparator() instanceof TaxonNaturalComparator){
+ return this.getComparator().compare((TaxonNode)e1, (TaxonNode)e2);
+ }else{
+ return this.getComparator().compare(e1,e2);
+ }
+ }
+ }
+}
Bundle-ManifestVersion: 2
Bundle-Name: Printpublisher Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.printpublisher;singleton:=true
-Bundle-Version: 3.6.1
+Bundle-Version: 3.7.0
Require-Bundle: org.eclipse.osgi,
org.eclipse.ui,
eu.etaxonomy.taxeditor.cdmlib,
<parent>
<artifactId>taxeditor-parent</artifactId>
<groupId>eu.etaxonomy</groupId>
- <version>3.6.1</version>
+ <version>3.7.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Bundle-ManifestVersion: 2
Bundle-Name: DataStore Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.store;singleton:=true
-Bundle-Version: 3.6.1
+Bundle-Version: 3.7.0
Bundle-Activator: eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin
Bundle-Vendor: EDIT
Export-Package: eu.etaxonomy.cdm,
page.name.12 = Erweiterungen
page.name.13 = Typusarten (Namen)
page.name.14 = Gebiete
-page.name.15 = Matching (experimentel)
+page.name.15 = Matching (experimentell)
page.name.16 = Taxonnamen Matching-Strategie
page.name.17 = Referenz Matching-Strategie
page.name.18 = Team oder Personen Matching-Strategie
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>3.6.1</version>
+ <version>3.7.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
import eu.etaxonomy.taxeditor.view.CdmViewerChooser;
+/**
+ * Opens the (first) currently selected element in a viewer. Opens a list of
+ * possible viewers if more than one are registered for this element.
+ *
+ * @author pplitzner
+ * @date Jul 6, 2015
+ *
+ */
public class OpenHandler extends AbstractHandler {
@Override
if(currentSelection instanceof IStructuredSelection){
Object firstElement = ((IStructuredSelection) currentSelection).getFirstElement();
CdmViewerChooser viewerChooser = new CdmViewerChooser(HandlerUtil.getActiveShell(event));
- viewerChooser.chooseViewer(firstElement, event);
+ viewerChooser.chooseViewer(firstElement);
}
return null;
}
/** Constant <code>COLLAPSE_ALL="collapse_all"</code> */
public static final String COLLAPSE_ALL = "collapse_all";
+ public static final String SWITCH_VIEW_TYPE = "switch_view_type";
+
+ //derivative icons
public static final String TISSUE_SAMPLE_DERIVATE = "tissue_sample_derivate";
public static final String TISSUE_SAMPLE_DERIVATE_CHARACTER_DATA = "tissue_sample_derivate_character_data";
public static final String DNA_SAMPLE_DERIVATE = "dna_sample_derivate";
"lock.png");
registerImage(registry, LOCK_OPEN_ICON,
"lock_open.png");
+ registerImage(registry, SWITCH_VIEW_TYPE,
+ "switch_view_type-16x16-32.png");
registerImage(registry, DNA_SAMPLE_DERIVATE,
"dna_derivate-16x16-32.png");
registerImage(registry, DNA_SAMPLE_DERIVATE_CHARACTER_DATA,
IMatchStrategy strategy = PreferencesUtil.getDefaultMatchStrategy(NonViralName.class);
strategy.setMatchMode("nomenclaturalReference", MatchMode.IGNORE);
- strategy.setMatchMode("combinationAuthorTeam", MatchMode.IGNORE);
- strategy.setMatchMode("exCombinationAuthorTeam", MatchMode.IGNORE);
- strategy.setMatchMode("basionymAuthorTeam", MatchMode.IGNORE);
- strategy.setMatchMode("exBasionymAuthorTeam", MatchMode.IGNORE);
+ strategy.setMatchMode("combinationAuthorship", MatchMode.IGNORE);
+ strategy.setMatchMode("exCombinationAuthorship", MatchMode.IGNORE);
+ strategy.setMatchMode("basionymAuthorship", MatchMode.IGNORE);
+ strategy.setMatchMode("exBasionymAuthorship", MatchMode.IGNORE);
return strategy;
}
List<INomenclaturalReference> duplicateReferences = new ArrayList<INomenclaturalReference>();
List<INomenclaturalReference> duplicateInReferences = new ArrayList<INomenclaturalReference>();
- List<TeamOrPersonBase> duplicateCombinationAuthorTeams = new ArrayList<TeamOrPersonBase>();
- List<TeamOrPersonBase> duplicateExCombinationAuthorTeams = new ArrayList<TeamOrPersonBase>();
- List<TeamOrPersonBase> duplicateBasionymAuthorTeams = new ArrayList<TeamOrPersonBase>();
- List<TeamOrPersonBase> duplicateExBasionymAuthorTeams = new ArrayList<TeamOrPersonBase>();
+ List<TeamOrPersonBase> duplicateCombinationAuthorships = new ArrayList<TeamOrPersonBase>();
+ List<TeamOrPersonBase> duplicateExCombinationAuthorships = new ArrayList<TeamOrPersonBase>();
+ List<TeamOrPersonBase> duplicateBasionymAuthorships = new ArrayList<TeamOrPersonBase>();
+ List<TeamOrPersonBase> duplicateExBasionymAuthorships = new ArrayList<TeamOrPersonBase>();
}
private static NonViralNameParserImpl nonViralNameParser = NonViralNameParserImpl.NewInstance();
*/
private void resolveAllDuplicateAuthors(NonViralName name, MatchMatrix matchMatrix) {
- if(matchMatrix.duplicateCombinationAuthorTeams.size() > 0){
- name.setCombinationAuthorTeam(matchMatrix.duplicateCombinationAuthorTeams.iterator().next());
+ if(matchMatrix.duplicateCombinationAuthorships.size() > 0){
+ name.setCombinationAuthorship(matchMatrix.duplicateCombinationAuthorships.iterator().next());
Reference reference = (Reference) name.getNomenclaturalReference();
if(reference != null){
- reference.setAuthorship(matchMatrix.duplicateCombinationAuthorTeams.iterator().next());
+ reference.setAuthorship(matchMatrix.duplicateCombinationAuthorships.iterator().next());
}
// FIXME TODO resolve multiple duplications. We use first match for a start.
}
- if(matchMatrix.duplicateExCombinationAuthorTeams.size() > 0){
- name.setExCombinationAuthorTeam(matchMatrix.duplicateExCombinationAuthorTeams.iterator().next());
+ if(matchMatrix.duplicateExCombinationAuthorships.size() > 0){
+ name.setExCombinationAuthorship(matchMatrix.duplicateExCombinationAuthorships.iterator().next());
// FIXME TODO resolve multiple duplications. We use first match for a start.
}
- if(matchMatrix.duplicateBasionymAuthorTeams.size() > 0){
- name.setBasionymAuthorTeam(matchMatrix.duplicateBasionymAuthorTeams.iterator().next());
+ if(matchMatrix.duplicateBasionymAuthorships.size() > 0){
+ name.setBasionymAuthorship(matchMatrix.duplicateBasionymAuthorships.iterator().next());
// FIXME TODO resolve multiple duplications. We use first match for a start.
}
- if(matchMatrix.duplicateExBasionymAuthorTeams.size() > 0){
- name.setExBasionymAuthorTeam(matchMatrix.duplicateExBasionymAuthorTeams.iterator().next());
+ if(matchMatrix.duplicateExBasionymAuthorships.size() > 0){
+ name.setExBasionymAuthorship(matchMatrix.duplicateExBasionymAuthorships.iterator().next());
// FIXME TODO resolve multiple duplications. We use first match for a start.
}
}
matchMatrix.duplicateNames = findMatchingLatinNames(name);
- matchMatrix.duplicateCombinationAuthorTeams = findMatchingAuthors(name.getCombinationAuthorTeam());
- matchMatrix.duplicateExCombinationAuthorTeams = findMatchingAuthors(name.getExCombinationAuthorTeam());
- matchMatrix.duplicateBasionymAuthorTeams = findMatchingAuthors(name.getBasionymAuthorTeam());
- matchMatrix.duplicateExBasionymAuthorTeams = findMatchingAuthors(name.getExBasionymAuthorTeam());
+ matchMatrix.duplicateCombinationAuthorships = findMatchingAuthors(name.getCombinationAuthorship());
+ matchMatrix.duplicateExCombinationAuthorships = findMatchingAuthors(name.getExCombinationAuthorship());
+ matchMatrix.duplicateBasionymAuthorships = findMatchingAuthors(name.getBasionymAuthorship());
+ matchMatrix.duplicateExBasionymAuthorships = findMatchingAuthors(name.getExBasionymAuthorship());
INomenclaturalReference nomenclaturalReference = name.getNomenclaturalReference();
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
/**
- * <p>Abstract AbstractCdmFormElement class.</p>
- *
* @author n.hoffmann
* @version $Id: $
*/
private Color persistentBackgroundColor;
- /**
- * <p>Constructor for AbstractCdmFormElement.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param layoutComposite a {@link org.eclipse.swt.widgets.Composite} object.
- */
protected AbstractCdmFormElement(CdmFormFactory formFactory, Composite layoutComposite){
this.layoutComposite = layoutComposite;
this.formFactory = formFactory;
}
- /**
- * <p>Constructor for AbstractCdmFormElement.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- */
public AbstractCdmFormElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
this(formFactory, formElement.getLayoutComposite());
this.parentElement = formElement;
controls.add(child);
}
- /**
- * <p>removeControl</p>
- *
- * @param child a {@link org.eclipse.swt.widgets.Control} object.
- */
protected void removeControl(Control child){
controls.remove(child);
}
elements.add(element);
}
- /**
- * <p>removeElement</p>
- *
- * @param element a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- */
protected void removeElement(ICdmFormElement element){
elements.remove(element);
}
this.layoutComposite = layoutComposite;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.ICdmFormComposite#getPropertyChangeListeners()
- */
/**
* <p>Getter for the field <code>propertyChangeListeners</code>.</p>
*
return propertyChangeListeners;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.ICdmFormComposite#setPropertyChangeListeners(org.eclipse.core.runtime.ListenerList)
- */
/** {@inheritDoc} */
@Override
public void setPropertyChangeListeners(List<IPropertyChangeListener> propertyChangeListeners){
this.propertyChangeListeners = propertyChangeListeners;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.IPropertyChangeEmitter#firePropertyChangeEvent()
- */
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.ICdmFormComposite#firePropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent)
- */
/** {@inheritDoc} */
@Override
public void firePropertyChangeEvent(CdmPropertyChangeEvent event) {
}
}
- /*
- * (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.ICdmFormElement#refresh()
- */
- /**
- * <p>refresh</p>
- */
+ protected void reflowParentScrolledForm(boolean flushCashes){
+ ScrolledForm scrolledForm = null;
+ Composite parent = getLayoutComposite().getParent();
+ while(parent!=null && !(parent instanceof ScrolledForm)){
+ parent = parent.getParent();
+ }
+ scrolledForm = (ScrolledForm)parent;
+ if(scrolledForm!=null){
+ scrolledForm.reflow(flushCashes);
+ }
+ }
+
@Override
public void refresh() {
// empty default implementation
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSamplePreparationPreservationDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSamplePreparationPreservationSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.PrimerGeneralDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailElement;
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailSection;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailElement;
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElementWithAbbreviatedTitle;
import eu.etaxonomy.taxeditor.ui.selection.NomenclaturalAuthorTeamSelectionElement;
import eu.etaxonomy.taxeditor.ui.selection.TaxonNodeSelectionElement;
return section;
}
+ public DnaSamplePreparationPreservationSection createDnaSamplePreparationPreservationSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ DnaSamplePreparationPreservationSection section = new DnaSamplePreparationPreservationSection(this, conversation, 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);
addAndAdaptSection(parentElement, section);
return element;
}
+ public DnaSamplePreparationPreservationDetailElement createDnaSamplePreparationPreservationDetailElement(ICdmFormElement parentElement){
+ DnaSamplePreparationPreservationDetailElement element = new DnaSamplePreparationPreservationDetailElement(this, parentElement);
+ addAndAdaptElement(parentElement, element);
+ return element;
+ }
+
public DnaQualityDetailElement createDnaQualityDetailElement(ICdmFormElement parentElement){
DnaQualityDetailElement element = new DnaQualityDetailElement(this, parentElement);
addAndAdaptElement(parentElement, element);
return element;
}
+ /**
+ * <p>
+ * Creates a selection element for the given type T which shows only the <b>abbreviated</b> title as the label.
+ * </p>
+ * <p>
+ * <strong>Selection elements not handled by this method:</strong>
+ * <ul>
+ * <li>{@link TaxonNodeSelectionElement} see
+ * {@link #createTaxonNodeSelectionElement(ConversationHolder, ICdmFormElement, String, TaxonNode, int, int)}
+ * </li>
+ * <li>{@link NomenclaturalAuthorTeamSelectionElement} see
+ * {@link #createNomenclaturalAuthorTeamSelectionElement(ConversationHolder, 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 ICdmBase> EntitySelectionElementWithAbbreviatedTitle<T> createSelectionElementWithAbbreviatedTitle(
+ Class<T> clazz, ConversationHolder conversation, ICdmFormElement parentElement, String labelString,
+ T selection, int mode, int style) {
+ EntitySelectionElementWithAbbreviatedTitle<T> element = new EntitySelectionElementWithAbbreviatedTitle<T>(this, conversation, parentElement, clazz,
+ labelString, selection, mode, style);
+ adapt(element);
+ parentElement.addElement(element);
+ return element;
+ }
+
public TaxonNodeSelectionElement createTaxonNodeSelectionElement(ConversationHolder conversation,
ICdmFormElement parentElement, String labelString, TaxonNode selection, int mode, int style) {
TaxonNodeSelectionElement element = new TaxonNodeSelectionElement(this, conversation, parentElement,
*/
package eu.etaxonomy.taxeditor.ui.element;
-import org.apache.commons.lang.StringUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
* @return a {@link java.lang.String} object.
*/
public String getText() {
- if (StringUtils.isBlank(text.getText())){
- return null;
- }else{
- return text.getText();
- }
+ return text.getText();
}
/**
// $Id$
/**
* 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.ui.element;
import java.net.URI;
-import java.net.URISyntaxException;
-
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Label;
/**
* @author n.hoffmann
*/
public class UriWithLabelElement extends TextWithLabelElement {
- /**
- * @param formFactory
- * @param parentElement
- * @param labelString
- * @param initialText
- * @param textHeight
- * @param style
- */
+ private final Label labelException;
+
protected UriWithLabelElement(CdmFormFactory formFactory,
ICdmFormElement parentElement, String labelString,
URI initialUri, Integer textHeight, int style) {
super(formFactory, parentElement, labelString, null, textHeight, style);
+
+ labelException = formFactory.createLabel(getLayoutComposite(), "", SWT.WRAP);
+ labelException.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ addControl(labelException);
setUri(initialUri);
}
-
- /**
- *
- */
+
public void setUri(URI uri) {
if(uri != null){
super.setText(uri.toString());
}
}
-
- public URI getUri() throws URISyntaxException{
- return new URI(super.getText());
+
+ public URI getUri(){
+ try {
+ labelException.setText("");
+ return new URI(super.getText());
+ } catch (Exception e) {
+ labelException.setText(e.getMessage());
+ return null;
+ }
}
-
+
}
import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
/**
- * <p>
- * Abstract AbstractCdmDetailElement class.
- * </p>
*
* @author n.hoffmann
* @created Feb 26, 2010
private EnumSet<CRUD> requiredCrud = null;
- /**
- * <p>
- * Constructor for AbstractCdmDetailElement.
- * </p>
- *
- * @param formFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param formElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param <T>
- * a T object.
- */
public AbstractCdmDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement) {
super(formFactory, formElement);
updateContent();
}
- /*
- * (non-Javadoc)
- *
- * @see eu.etaxonomy.taxeditor.forms.IEntityElement#getEntity()
- */
- /**
- * <p>
- * Getter for the field <code>entity</code>.
- * </p>
- *
- * @return a T object.
- */
@Override
public T getEntity() {
return entity;
protected void updateContent() {
removeElements();
createControls(this, entity, SWT.WRAP);
- getLayoutComposite().layout();
+ reflowParentScrolledForm(true);
updateControlStates();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.forms.ISelectableComposite#setSelected(boolean)
- */
- /** {@inheritDoc} */
- @Override
+ @Override
public void setSelected(boolean selected) {
Composite section = getLayoutComposite().getParent();
section.setBackground(selected ? SELECTED : getPersistentBackground());
}
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement#isEnabled()
- */
@Override
public boolean isEnabled() {
return enabled;
if (getParentElement() instanceof AbstractCdmDetailSection) {
((AbstractCdmDetailSection) getParentElement()).updateTitle();
}
+ reflowParentScrolledForm(true);
}
/**
*/
public abstract void handleEvent(Object eventSource);
- /**
- * <p>
- * handleException
- * </p>
- *
- * @param event
- * a
- * {@link eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent}
- * object.
- */
public void handleException(CdmPropertyChangeEvent event) {
// override this in subclasses if you want to deal with the error
MessagingUtils.error(event.getSource().getClass(), event.getException());
}
- /**
- * <p>
- * isIrrelevant
- * </p>
- *
- * @return a boolean.
- */
public boolean isIrrelevant() {
return irrelevant;
}
- /**
- * <p>
- * getConversationHolder
- * </p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
- * object.
- */
@Override
public ConversationHolder getConversationHolder() {
if (getParentElement() instanceof IConversationEnabled) {
private final Composite container;
+ /**
+ * Composite "around" the actual content. Is used for control action like e.g. remove button
+ */
private final Composite box;
private Button btnRemove;
private Color backgroundColor;
- /**
- * <p>
- * Constructor for AbstractEntityCollectionElement.
- * </p>
- *
- * @param style
- * a int.
- * @param formFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param section
- * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
- * object.
- * @param entity
- * a ENTITY object.
- * @param removeListener
- * a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param <ENTITY>
- * a ENTITY object.
- */
public AbstractEntityCollectionElement(CdmFormFactory formFactory,
AbstractFormSection section, ENTITY entity,
SelectionListener removeListener, Color backgroundColor, int style) {
box.setBackgroundMode(SWT.INHERIT_DEFAULT);
addControl(box);
- TableWrapLayout boxLayout = LayoutConstants.LAYOUT(3, false);
+ TableWrapLayout boxLayout = LayoutConstants.LAYOUT(4, false);
boxLayout.topMargin = 4;
boxLayout.bottomMargin = 4;
box.setLayout(boxLayout);
// default implementation is empty
}
- /**
- * <p>
- * Setter for the field <code>entity</code>.
- * </p>
- *
- * @param entity
- * a ENTITY object.
- */
public abstract void setEntity(ENTITY entity);
- /**
- * <p>
- * Getter for the field <code>entity</code>.
- * </p>
- *
- * @return a ENTITY object.
- */
@Override
public ENTITY getEntity() {
return entity;
return null;
}
- /**
- * <p>
- * createControls
- * </p>
- *
- * @param element
- * a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
- * object.
- * @param style
- * a int.
- */
public abstract void createControls(ICdmFormElement element, int style);
/**
setBackground(selected ? SELECTED : getPersistentBackground());
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#propertyChange(org
- * .eclipse.jface.util.PropertyChangeEvent)
- */
/** {@inheritDoc} */
@Override
public void propertyChange(PropertyChangeEvent event) {
}
}
- /**
- * <p>
- * handleEvent
- * </p>
- *
- * @param eventSource
- * a {@link java.lang.Object} object.
- */
public abstract void handleEvent(Object eventSource);
/** {@inheritDoc} */
return container;
}
- /**
- * <p>
- * Getter for the field <code>backgroundColor</code>.
- * </p>
- *
- * @return the backgroundColor
- */
public Color getBackgroundColor() {
return backgroundColor;
}
- /**
- * <p>
- * getConversationHolder
- * </p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
- * object.
- */
+ public Composite getBox() {
+ return box;
+ }
+
@Override
public ConversationHolder getConversationHolder() {
if (getParentElement() instanceof IConversationEnabled) {
public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends AbstractFormSection<ENTITY> implements IExpansionListener, Observer {
- /**
- *
- */
private static final EnumSet<CRUD> UPDATE = EnumSet.of(CRUD.UPDATE);
protected Composite container;
private String title;
- /**
- * <p>Constructor for AbstractEntityCollectionSection.</p>
- *
- * @param conversation
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param title a {@link java.lang.String} object.
- * @param <ENTITY> a ENTITY object.
- * @param <ELEMENT> a ELEMENT object.
- */
+ private AbstractEntityCollectionElement entityCollectionElement;
+
public AbstractEntityCollectionSection(CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, String title, int style) {
super(formFactory, parentElement, ExpandableComposite.CLIENT_INDENT | style);
this.title = title;
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
Action addAction = new Action("add", IAction.AS_PUSH_BUTTON){
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
@Override
public void run() {
ELEMENT element = createNewElement();
setTextClient(null);
}
- /**
- * <p>setEntity</p>
- *
- * @param entity a ENTITY object.
- */
@Override
public void setEntity(ENTITY entity) {
if(entity != null){
reflow();
}
- /**
- * <p>createEmptyContent</p>
- */
protected void createEmptyContent(){
label_empty = formFactory.createLabel(getLayoutComposite(), getEmptyString());
}
* @param backgroundColor a {@link org.eclipse.swt.graphics.Color} object.
*/
protected void createElementComposite(ELEMENT element, SelectionListener removeListener, Color backgroundColor){
- formFactory.createEntityCollectionElement(this, element, removeListener, backgroundColor, SWT.NULL);
+ entityCollectionElement = formFactory.createEntityCollectionElement(this, element, removeListener, backgroundColor, SWT.NULL);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.section.AbstractEditorFormSection#setBackground(org.eclipse.swt.graphics.Color)
- */
/** {@inheritDoc} */
@Override
public void setBackground(Color color) {
internalUpdateSection(true);
}
- /* (non-Javadoc)
- * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
- */
@Override
public void update(Observable o, Object arg){
if(o instanceof LoginManager){
}
}
+ public AbstractEntityCollectionElement getEntityCollectionElement() {
+ return entityCollectionElement;
+ }
+
/**
* Get the specific collection of this entity
*
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.model.agent.Person;
+import eu.etaxonomy.cdm.model.agent.Team;
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.selection.EntitySelectionElement;
/**
- * <p>
- * TeamMemberElement class.
- * </p>
- *
* @author n.hoffmann
* @created Apr 30, 2010
* @version 1.0
private EntitySelectionElement<Person> selection_person;
- /**
- * <p>
- * Constructor for TeamMemberElement.
- * </p>
- *
- * @param cdmFormFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param section
- * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
- * object.
- * @param entity
- * a {@link eu.etaxonomy.cdm.model.agent.Person} object.
- * @param removeListener
- * a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style
- * a int.
- */
public TeamMemberElement(CdmFormFactory cdmFormFactory,
AbstractFormSection section, Person entity,
SelectionListener removeListener, int style) {
super(cdmFormFactory, section, entity, removeListener, null, style);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#createControls
- * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
- */
/** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement element, int style) {
style);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#setEntity
- * (eu.etaxonomy.cdm.model.common.VersionableEntity)
- */
/** {@inheritDoc} */
@Override
public void setEntity(Person entity) {
if (eventSource == selection_person) {
if (getParentElement() instanceof TeamMemberSection) {
TeamMemberSection teamMemberSection = (TeamMemberSection) getParentElement();
- teamMemberSection.getEntity().addTeamMember(selection_person.getEntity());
+ Team team = teamMemberSection.getEntity();
+
+ int index = team.getTeamMembers().indexOf(getEntity());
+
+ if(index==-1){
+ team.addTeamMember(selection_person.getEntity());
+ }
+ else{
+ //first remove the edited team member and then add it again
+ //because the model allows the same person multiple time in on team
+ team.removeTeamMember(getEntity());
+ team.addTeamMember(selection_person.getEntity(), index);
+ }
firePropertyChangeEvent(new CdmPropertyChangeEvent(teamMemberSection, eventSource));
}
entity = selection_person.getEntity();
}
};
// TODO enable this once a proper icon has been found
+ // ticket #5043
// addAction.setImageDescriptor(new ImageDescriptor() {
//
// @Override
// $Id$
/**
* 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.
*/
*/
public class DescriptionElementMediaSection extends
AbstractEntityCollectionSection<DescriptionElementBase, Media> {
-
- /**
- * <p>Constructor for DescriptionElementMediaSection.</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 DescriptionElementMediaSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
ICdmFormElement parentElement, int style) {
super(cdmFormFactory, conversation, parentElement, "Media", style);
}
-
+
/** {@inheritDoc} */
@Override
public void setEntity(DescriptionElementBase entity) {
public void removeElement(Media element) {
getEntity().removeMedia(element);
}
-
+
+
}
package eu.etaxonomy.taxeditor.ui.section.description;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.media.Media;
*/
public class MediaDetailsSection extends AbstractCdmDetailSection<Media> {
- private MediaMetaElement element_media;
+ private MediaMetaElement mediaMetaElement;
- /**
- * <p>Constructor for MediaDetailsSection.</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 MediaDetailsSection(CdmFormFactory formFactory, ConversationHolder conversation,
ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int style) {
super(formFactory, conversation, parentElement, selectionProvider, style);
}
- /** {@inheritDoc} */
- @Override
- protected void createControls(AbstractCdmDetailSection formElement,
- int style) {
- TableWrapLayout layout = (TableWrapLayout) getLayoutComposite().getLayout();
- layout.topMargin = 10;
- layout.numColumns = 2;
-
- getLayoutComposite().setLayout(layout);
-
-
- }
-
- @Override
- protected Control createToolbar() {
- ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
-
- //FIXME: duplicate code (see #4598)
- final String label = "Change View Type";
-
- Action addAction = new Action(label, IAction.AS_PUSH_BUTTON) {
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- element_media.toggleAdvancedMediaView();
- }
- };
- addAction.setToolTipText(label);
-
- toolBarManager.add(addAction);
-
- return toolBarManager.createControl(this);
- }
-
- /**
- * <p>setEntity</p>
- *
- * @param entity a {@link eu.etaxonomy.cdm.model.media.Media} object.
- */
@Override
public void setEntity(Media entity) {
- if(element_media != null){
+ if(mediaMetaElement != null){
this.removeElements();
}
- element_media = (MediaMetaElement) formFactory.createEntityCollectionElement(this, entity, null, null, ExpandableComposite.EXPANDED);
+ mediaMetaElement = (MediaMetaElement) formFactory.createEntityCollectionElement(this, entity, null, null, ExpandableComposite.EXPANDED);
super.setEntity(entity);
setSectionTitle();
setTextClient(createToolbar());
layout();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
- */
/** {@inheritDoc} */
@Override
public String getHeading() {
return "Image";
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
- */
@Override
protected AbstractCdmDetailElement<Media> createCdmDetailElement(AbstractCdmDetailSection<Media> parentElement, int style) {
return null;
List<Language> languages = Arrays.asList(new Language[]{CdmStore.getDefaultLanguage()});
- String parameter = CdmStore.getGeoService().getDistributionServiceRequestParameterString(getTaxonDescriptions(),
- false, false, null, presenceAbsenceTermColors, languages);
+ String parameter = CdmStore.getGeoService().getDistributionServiceRequestParameterString(
+ getTaxonDescriptions(),
+ false,
+ false,
+ null,
+ null,
+ presenceAbsenceTermColors,
+ languages);
String mapUriString = String.format("%s?%s&ms=1000&bbox=-180,-90,180,90&l=earth", accessPoint, parameter);
return mapUriString;
--- /dev/null
+// $Id$
+/**
+* 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.media;
+
+/**
+ * @author pplitzner
+ * @date Jun 27, 2015
+ *
+ */
+public interface ITogglableMediaElement {
+
+ public void toggleAdvancedMediaView();
+
+}
// $Id$
/**
* 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 java.net.URI;
import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpException;
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.common.media.ImageInfo;
import eu.etaxonomy.cdm.model.media.ImageFile;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
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.NumberWithLabelElement;
/**
- * <p>ImageFileElement class.</p>
- *
* @author n.hoffmann
* @created Mar 26, 2010
* @version 1.0
private NumberWithLabelElement text_width;
private KeyValueViewerElement element_keyValue;
private ImageElement element_image;
-
-
- private Runnable postRunnable = new Runnable(){
- public void run() {
- StoreUtil.reflowDetailsViewer();
- StoreUtil.reflowSupplementalViewer();
+
+
+ private final Runnable postRunnable = new Runnable(){
+ @Override
+ public void run() {
+ AbstractUtility.reflowDetailsViewer();
+ AbstractUtility.reflowSupplementalViewer();
}
};
-
-
- /**
- * <p>Constructor for ImageFileElement.</p>
- *
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param section a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
- * @param element a {@link eu.etaxonomy.cdm.model.media.ImageFile} object.
- * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style a int.
- */
+
+
public ImageFileElement(CdmFormFactory cdmFormFactory,
AbstractFormSection section, ImageFile element,
SelectionListener removeListener, int style) {
super(cdmFormFactory, section, element, removeListener, style);
}
-
+
/** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement formElement, int style) {
super.createControls(formElement, style);
-
+
text_height = formFactory.createNumberTextWithLabelElement(formElement, "Height", null, style);
text_height.setEnabled(false);
text_width = formFactory.createNumberTextWithLabelElement(formElement, "Width", null, style);
element_image = formFactory.createImageElement(formElement, null, style);
element_keyValue = formFactory.createKeyValueViewerElement(formElement, "Key", "Value", null);
}
-
+
/** {@inheritDoc} */
@Override
public void setEntity(ImageFile entity) {
text_height.setNumber(entity.getHeight());
text_width.setNumber(entity.getWidth());
try {
- loadImage(entity.getUri(), false);
+ loadImage(entity.getUri(), false);
} catch (Exception e) {
handleException(e);
}
}
-
+
private void loadImage(URI uri, boolean updateDimensions) throws IOException, HttpException{
element_image.initImageUri(uri);
-
+
element_image.loadImage(postRunnable );
-
-
+
+
if(uri == null){
return;
}
-
+
ImageInfo imageInfo = ImageInfo.NewInstanceWithMetaData(uri, 10000);
-
+
element_keyValue.setInput(imageInfo.getMetaData());
-
+
if(updateDimensions){
text_size.setText(FileUtils.byteCountToDisplaySize(imageInfo.getLength()));
- // KLUDGE this is not save for very large files, because of the int cast.
+ // KLUDGE this is not save for very large files, because of the int cast.
// But then, I don't think we will handle such large files in the near future
getEntity().setSize((int) imageInfo.getLength());
-
+
text_height.setNumber(imageInfo.getHeight());
getEntity().setHeight(imageInfo.getHeight());
-
+
text_width.setNumber(imageInfo.getWidth());
getEntity().setWidth(imageInfo.getWidth());
}
-
-
- element_messages.setText("");
+
+
}
- /*
- * (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
- */
/** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
if(eventSource == text_uri){
try {
- String uriString = text_uri.getText();
- URI uri = StringUtils.isNotEmpty(uriString) ? new URI(uriString) : null;
+ URI uri = text_uri.getUri();
getEntity().setUri(uri);
-
-
+
+
loadImage(getEntity().getUri(), true);
-
+
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
} catch (Exception e) {
handleException(e);
- } finally {
+ } finally {
firePropertyChangeEvent(this);
}
}
}
protected void handleException(Exception e) {
- super.handleException(e);
element_image.unloadImage(postRunnable);
text_height.setNumber(0);
text_width.setNumber(0);
-
+
element_image.loadImage(new Runnable(){
- public void run() {
- StoreUtil.reflowDetailsViewer();
- StoreUtil.reflowSupplementalViewer();
+ @Override
+ public void run() {
+ AbstractUtility.reflowDetailsViewer();
+ AbstractUtility.reflowSupplementalViewer();
}
});
}
*/
package eu.etaxonomy.taxeditor.ui.section.media;
-import java.net.URISyntaxException;
import java.util.List;
import java.util.Set;
import eu.etaxonomy.cdm.model.media.MediaUtils;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-import eu.etaxonomy.taxeditor.preference.Resources;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
private ICdmFormElement parentFormElement;
private int style;
- /**
- * @param formFactory
- * @param formElement
- */
public MediaDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
super(formFactory, formElement);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.ui.element.ICdmFormElement, java.lang.Object, int)
- */
@Override
protected void createControls(ICdmFormElement formElement, Media entity, int style) {
this.parentFormElement = formElement;
this.style = style;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#setEntity(java.lang.Object)
- */
@Override
public void setEntity(Media entity) {
super.setEntity(entity);
showAdvancedView();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
- */
@Override
- public void handleEvent(Object eventSource) {
+ public void handleEvent(Object eventSource){
if(eventSource==textUri){
textUri.setBackground(getPersistentBackground());
- try {
- singleMediaRepresentationPart.setUri(textUri.getUri());
- } catch (URISyntaxException e) {
- textUri.setBackground(getColor(Resources.COLOR_PARSE_ERROR));
- }
+ singleMediaRepresentationPart.setUri(textUri.getUri());
}
}
public void toggleAdvancedMediaView(){
isAdvancedMediaView = !isAdvancedMediaView;
showAdvancedView();
+ reflowParentScrolledForm(true);
}
- /**
- * @param showAdvancedView
- */
private void showAdvancedView() {
if(isAdvancedMediaView){
if(textUri!=null){
isAdvancedMediaView = false;
}
- /**
- * @return
- */
public boolean isAdvancedMediaView() {
return isAdvancedMediaView;
}
*/
package eu.etaxonomy.taxeditor.ui.section.media;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.common.LanguageString;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.ImageResources;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.dialog.selection.MediaSelectionDialog;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
- * <p>
- * MediaElement class.
- * </p>
- *
* @author n.hoffmann
* @created Nov 17, 2009
* @version 1.0
*/
-public class MediaMetaElement extends AbstractEntityCollectionElement<Media> {
+public class MediaMetaElement extends AbstractEntityCollectionElement<Media> implements ITogglableMediaElement{
private EntitySelectionElement<AgentBase> selection_artist;
private LanguageStringWithLabelElement text_description;
private LanguageStringWithLabelElement text_title;
private MediaDetailElement mediaDetailElement;
- /**
- * <p>
- * Constructor for MediaElement.
- * </p>
- *
- * @param formElement
- * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
- * object.
- * @param element
- * a {@link eu.etaxonomy.cdm.model.media.Media} object.
- * @param removeListener
- * a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style
- * a int.
- * @param cdmFormFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- */
public MediaMetaElement(CdmFormFactory cdmFormFactory,
AbstractFormSection<?> formElement, Media element,
SelectionListener removeListener, boolean isChoosableEntity, int style) {
super(cdmFormFactory, formElement, element, removeListener, isChoosableEntity, null, style);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite
- * #createControls(org.eclipse.swt.widgets.Composite, int)
- */
/** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement element, int style) {
-
+ final IAction switchAction = MediaViewSwitch.createSwitch(MediaMetaElement.this);
+ Button btnToggleAdvancedMediaView = new Button(getBox(), style);
+ btnToggleAdvancedMediaView.setToolTipText(switchAction.getText());
+ btnToggleAdvancedMediaView.setImage(ImageResources.getImage(ImageResources.SWITCH_VIEW_TYPE));
+ btnToggleAdvancedMediaView.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ switchAction.run();
+ }
+ });
text_title = formFactory.createLanguageStringWithLabelElement(element, "Title", null, style);
selection_artist = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), element, "Artist", null, EntitySelectionElement.ALL, style);
text_description = formFactory.createLanguageStringWithLabelElement(element, "Description", null, 100, true, style);
text_title.setLanguageString(title);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#selectFromDialog()
- */
@Override
protected Media selectFromDialog() {
return MediaSelectionDialog.select(AbstractUtility.getShell(), null, null);
}
+ @Override
public void toggleAdvancedMediaView(){
mediaDetailElement.toggleAdvancedMediaView();
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent
- * (java.lang.Object)
- */
/** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
}
}
- /**
- * @return
- */
- public boolean isAdvancedMediaView() {
- return mediaDetailElement.isAdvancedMediaView();
- }
}
private TextWithLabelElement text_mimeType;
private TextWithLabelElement text_suffix;
- /**
- * <p>Constructor for MediaRepresentationElement.</p>
- *
- * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param section a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
- * @param element a {@link eu.etaxonomy.cdm.model.media.MediaRepresentation} object.
- * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style a int.
- */
public MediaRepresentationElement(CdmFormFactory cdmFormFactory,
AbstractFormSection section,
MediaRepresentation element, SelectionListener removeListener,
super(cdmFormFactory, section, element, removeListener, null, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.section.AbstractEntityCollectionElement#createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
- */
/** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement element, int style) {
text_suffix.setText(element.getSuffix());
}
- /*
- * (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
- */
/** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
// $Id$
/**
* 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 java.net.URI;
import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
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.LabelElement;
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
/**
public class MediaRepresentationPartElement<T extends MediaRepresentationPart> extends
AbstractEntityCollectionElement<T> {
- protected TextWithLabelElement text_uri;
+ protected UriWithLabelElement text_uri;
protected NumberWithLabelElement text_size;
- protected LabelElement element_messages;
-
- /**
- * <p>Constructor for AbstractMediaRepresentationPartElement.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param section a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
- * @param element a T object.
- * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style a int.
- * @param <T> a T object.
- */
public MediaRepresentationPartElement(CdmFormFactory formFactory,
AbstractFormSection section,
T element, SelectionListener removeListener,
int style) {
super(formFactory, section, element, removeListener, null, style);
}
-
+
/** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement element, int style) {
- text_uri = formFactory.createTextWithLabelElement(element, "URI", null, style);
+ text_uri = formFactory.createUriWithLabelElement(element, "URI", null, style);
text_size = formFactory.createNumberTextWithLabelElement(element, "Size", null, style);
text_size.setEnabled(false);
-
- element_messages = formFactory.createLabel(element, "");
}
@Override
if(entity.getUri() != null){
text_uri.setText(entity.getUri().toString());
}
- element_messages.setText("We currrently do not know how to display this generic MediaRepresentationPart to you.");
}
@Override
public void handleEvent(Object eventSource) {
if(eventSource == text_uri){
- try {
- String uriString = text_uri.getText();
- URI uri = StringUtils.isNotEmpty(uriString) ? new URI(uriString) : null;
- getEntity().setUri(uri);
- } catch (Exception e) {
- handleException(e);
- } finally {
- firePropertyChangeEvent(this);
- }
- }
- }
-
- protected void handleException(Exception e) {
- element_messages.setText(e.getMessage());
- text_size.setText("");
+ URI uri = text_uri.getUri();
+ getEntity().setUri(uri);
+ firePropertyChangeEvent(this);
+ }
}
}
--- /dev/null
+// $Id$
+/**
+* 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.media;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+
+import eu.etaxonomy.taxeditor.model.ImageResources;
+
+/**
+ * Adds a switch to a section with an {@link ITogglableMediaElement}
+ * to allow switching between simple and advanced media view
+ * @author pplitzner
+ * @date Jun 29, 2015
+ *
+ */
+public class MediaViewSwitch {
+
+ /**
+ * Creates an {@link IAction} for the given {@link ITogglableMediaElement}
+ * that switches between the two states of the element.
+ */
+ public static IAction createSwitch(final ITogglableMediaElement togglableMediaElement) {
+ final String label = "Change View Type";
+
+ Action switchAction = new Action(label, ImageResources.getImageDescriptor(ImageResources.SWITCH_VIEW_TYPE)) {
+ @Override
+ public void run() {
+ if(togglableMediaElement!=null){
+ togglableMediaElement.toggleAdvancedMediaView();
+ }
+ }
+ };
+ switchAction.setToolTipText(label);
+
+ return switchAction;
+ }
+}
if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
toggleable_cache.setVisible(false);
}
- selectionCombinationAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class,
+ selectionCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
getConversationHolder(),
formElement, "Author",
- entity.getCombinationAuthorTeam(),
+ entity.getCombinationAuthorship(),
EntitySelectionElement.ALL, style);
addElement(selectionCombinationAuthor);
- selectionExCombinationAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class,
+ selectionExCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
getConversationHolder(),
formElement, "Ex Author",
- entity.getExCombinationAuthorTeam(),
+ entity.getExCombinationAuthorship(),
EntitySelectionElement.ALL, style);
addElement(selectionExCombinationAuthor);
- selectionBasionymAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class, getConversationHolder(),
- formElement, "Basionym Author", entity.getBasionymAuthorTeam(),
+ selectionBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class, getConversationHolder(),
+ formElement, "Basionym Author", entity.getBasionymAuthorship(),
EntitySelectionElement.ALL, style);
addElement(selectionBasionymAuthor);
- selectionExBasionymAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class, getConversationHolder(),
- formElement, "Ex Basionym Author", entity.getExBasionymAuthorTeam(),
+ selectionExBasionymAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class, getConversationHolder(),
+ formElement, "Ex Basionym Author", entity.getExBasionymAuthorship(),
EntitySelectionElement.ALL, style);
addElement(selectionExBasionymAuthor);
Arrays.asList(new Object[] { toggleable_cache }));
}
} else if (eventSource == selectionCombinationAuthor) {
- getEntity().setCombinationAuthorTeam(
+ getEntity().setCombinationAuthorship(
selectionCombinationAuthor.getSelection());
} else if (eventSource == selectionExCombinationAuthor) {
- getEntity().setExCombinationAuthorTeam(
+ getEntity().setExCombinationAuthorship(
selectionExCombinationAuthor.getSelection());
} else if (eventSource == selectionBasionymAuthor) {
- getEntity().setBasionymAuthorTeam(
+ getEntity().setBasionymAuthorship(
selectionBasionymAuthor.getSelection());
} else if (eventSource == selectionExBasionymAuthor) {
- getEntity().setExBasionymAuthorTeam(
+ getEntity().setExBasionymAuthorship(
selectionExBasionymAuthor.getSelection());
}
// $Id$
/**
* 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.ui.section.name;
import java.net.URI;
-import java.net.URISyntaxException;
import org.eclipse.swt.events.SelectionListener;
import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.reference.Reference;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
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.ISelectableElement;
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
-import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;
import eu.etaxonomy.taxeditor.ui.openurl.IOpenUrlEnabled;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
*/
public class ProtologueElement extends AbstractEntityCollectionElement<DescriptionElementBase> implements ISelectableElement, IOpenUrlEnabled{
- private SelectionArbitrator selectionArbitrator;
+ private final SelectionArbitrator selectionArbitrator;
- private TextWithLabelElement protologueUriText;
+ private UriWithLabelElement protologueUriText;
private MediaRepresentationPart mediaRepresentationPart;
private Media media;
private MediaRepresentation mediaRepresentation;
selectionArbitrator = cdmFormFactory.createSelectionArbitrator(this);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#createControls(org.eclipse.swt.widgets.Composite, int)
- */
/** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement element, int style) {
- protologueUriText = formFactory.createTextWithLabelElement(this, "Protologue URI", "", style);
+ protologueUriText = formFactory.createUriWithLabelElement(element, "Protologue URI", null, style);
formFactory.createOpenUrlSelectorElement(element, "Query BHL for Reference Image", this, style);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#setElement(eu.etaxonomy.cdm.model.common.VersionableEntity)
- */
/** {@inheritDoc} */
@Override
public void setEntity(DescriptionElementBase element) {
this.entity = element;
-
+
if(element.getMedia().size() == 0){
element.addMedia(Media.NewInstance());
}
media = element.getMedia().iterator().next();
-
+
if(media.getRepresentations().size() == 0){
media.addRepresentation(MediaRepresentation.NewInstance());
- }
+ }
mediaRepresentation = media.getRepresentations().iterator().next();
-
+
if(mediaRepresentation.getParts().size() == 0){
mediaRepresentation.addRepresentationPart(MediaRepresentationPart.NewInstance(null, null));
}
-
+
mediaRepresentationPart = mediaRepresentation.getParts().iterator().next();
-
+
if(mediaRepresentationPart.getUri() != null){
protologueUriText.setText(mediaRepresentationPart.getUri().toString());
}
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.section.cdmdetail.ISelectableElement#getSelectionArbitrator()
- */
+
/**
* <p>Getter for the field <code>selectionArbitrator</code>.</p>
*
* @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator} object.
*/
- public SelectionArbitrator getSelectionArbitrator() {
+ @Override
+ public SelectionArbitrator getSelectionArbitrator() {
return selectionArbitrator;
}
-
- /*
- * (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
- */
+
/** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
- if(eventSource == protologueUriText){
- try {
- mediaRepresentationPart.setUri(new URI(protologueUriText.getText()));
- } catch (URISyntaxException e) {
- MessagingUtils.warningDialog("Could not parse URI", getClass(), e.getMessage());
- }
- }
+ if(eventSource == protologueUriText && protologueUriText.getText()!=null){
+ mediaRepresentationPart.setUri(protologueUriText.getUri());
+ }
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.openurl.IOpenUrlEnabled#setOpenUrl(java.net.URI)
- */
@Override
public void setOpenUrl(URI uri) {
protologueUriText.setText(uri.toString());
firePropertyChangeEvent(new CdmPropertyChangeEvent(protologueUriText, null));
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.openurl.IOpenUrlEnabled#getReference()
- */
@Override
public Reference getReference() {
return (Reference) getName().getNomenclaturalReference();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.forms.openurl.IOpenUrlEnabled#getDetail()
- */
@Override
public String getDetail() {
return getName().getNomenclaturalMicroReference();
}
-
+
private TaxonNameBase getName(){
TaxonNameDescription description = (TaxonNameDescription) entity.getInDescription();
-
+
TaxonNameBase taxonName = description.getTaxonName();
-
+
return taxonName;
}
}
*/
package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
Collection<ELEMENT> elements = getEntityCollection(entity);
if(addUnboundElement){
//cloning to avoid saving the dummy element
- Collection<ELEMENT> clonedElements = new HashSet<ELEMENT>();
+ Collection<ELEMENT> clonedElements = new ArrayList<ELEMENT>();
clonedElements.addAll(elements);
clonedElements.add(createNewElement()); //add dummy element which is not bound to entity
return clonedElements;
*/
package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
-import eu.etaxonomy.cdm.model.agent.AgentBase;
-import eu.etaxonomy.cdm.model.agent.Institution;
-import eu.etaxonomy.cdm.model.common.DefinedTerm;
-import eu.etaxonomy.cdm.model.common.TermType;
-import eu.etaxonomy.cdm.model.common.TimePeriod;
import eu.etaxonomy.cdm.model.molecular.DnaSample;
-import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
-import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
+import eu.etaxonomy.cdm.model.occurrence.Collection;
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.NumberWithLabelElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
*/
public class DnaSampleGeneralDetailElement extends AbstractCdmDetailElement<DnaSample> {
- private EntitySelectionElement<Institution> selectionInstitution;
- private EntitySelectionElement<AgentBase> selectionStaff;
- private TimePeriodElement datePreparationDate;
- private NumberWithLabelElement numberPreservationTemperature;
- private TermComboElement<DefinedTerm> comboMaterialOrMethods;
+
+ private EntitySelectionElement<Collection> selection_collection;
private TextWithLabelElement textBarcode;
private CheckboxElement checkIsPublish;
- /**
- * @param formFactory
- * @param formElement
- */
public DnaSampleGeneralDetailElement(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, DnaSample entity, int style) {
- Institution institution = null;
- AgentBase<?> staff = null;
- TimePeriod preparationDate = null;
- if(entity.getDerivedFrom()!=null){
- institution = entity.getDerivedFrom().getInstitution();
- staff = entity.getDerivedFrom().getActor();
- preparationDate = entity.getDerivedFrom().getTimeperiod();
- }
-
- Double temperature = null;
- DefinedTerm definedMaterialOrMethod = null;
- if(entity.getPreservation()!=null){
- temperature = entity.getPreservation().getTemperature();
- definedMaterialOrMethod = entity.getPreservation().getDefinedMaterialOrMethod();
- }
- selectionInstitution = formFactory.createSelectionElement(Institution.class, getConversationHolder(), formElement, "Institution", institution, EntitySelectionElement.ALL, style);
- selectionStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Staff", staff, EntitySelectionElement.ALL, style);
- datePreparationDate = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
- numberPreservationTemperature = formFactory.createNumberTextWithLabelElement(formElement, "Preservation Temp. [C°]", temperature, style);
- comboMaterialOrMethods = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Materials & Methods", definedMaterialOrMethod, style);
+ selection_collection = formFactory
+ .createSelectionElement(Collection.class,
+ getConversationHolder(), formElement, "Collection",
+ entity.getCollection(),
+ EntitySelectionElement.ALL, style);
textBarcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
checkIsPublish = formFactory.createCheckbox(formElement, "Publish", entity.isPublish(), style);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
- * .lang.Object)
- */
@Override
public void handleEvent(Object eventSource) {
- if(eventSource==datePreparationDate){
- if(getEntity().getDerivedFrom()!=null){
- getEntity().getDerivedFrom().setTimeperiod(datePreparationDate.getTimePeriod());
- }
- }
- else if(eventSource==selectionInstitution){
- if(getEntity().getDerivedFrom()!=null){
- getEntity().getDerivedFrom().setInstitution(selectionInstitution.getSelection());
- }
- }
- else if(eventSource==selectionStaff){
- if(getEntity().getDerivedFrom()!=null){
- getEntity().getDerivedFrom().setActor(selectionStaff.getSelection());
- }
- }
- else if(eventSource==numberPreservationTemperature){
- addPreservationMethod().setTemperature(numberPreservationTemperature.getDouble());
- }
- else if(eventSource==comboMaterialOrMethods){
- addPreservationMethod().setDefinedMaterialOrMethod(comboMaterialOrMethods.getSelection());
- }
- else if(eventSource==textBarcode){
+ if(eventSource==textBarcode){
getEntity().setBarcode(textBarcode.getText());
}
else if(eventSource==checkIsPublish){
getEntity().setPublish(checkIsPublish.getSelection());
+ } else if (eventSource == selection_collection) {
+ getEntity().setCollection(selection_collection.getSelection());
}
}
- private PreservationMethod addPreservationMethod(){
- PreservationMethod preservationMethod = getEntity().getPreservation();
- if(preservationMethod==null){
- preservationMethod = PreservationMethod.NewInstance();
- getEntity().setPreservation(preservationMethod);
- }
- return preservationMethod;
- }
}
*/
public class DnaSampleGeneralDetailSection extends AbstractCdmDetailSection<DnaSample> {
- /**
- * @param formFactory
- * @param conversation
- * @param parentElement
- * @param selectionProvider
- * @param style
- */
public DnaSampleGeneralDetailSection(CdmFormFactory formFactory,
ConversationHolder conversation, ICdmFormElement parentElement,
ISelectionProvider selectionProvider, int 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<DnaSample> createCdmDetailElement(AbstractCdmDetailSection<DnaSample> parentElement, int style) {
return formFactory.createDnaSampleGeneralDetailElement(parentElement);
--- /dev/null
+
+// $Id$
+/**
+ * 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.occurrence.dna;
+
+import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.agent.Institution;
+import eu.etaxonomy.cdm.model.common.TimePeriod;
+import eu.etaxonomy.cdm.model.molecular.DnaSample;
+import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
+
+/**
+ * @author pplitzner
+ * @date 16.12.2013
+ *
+ */
+public class DnaSamplePreparationPreservationDetailElement extends AbstractCdmDetailElement<DnaSample> {
+
+ private EntitySelectionElement<Institution> selectionInstitution;
+ private EntitySelectionElement<AgentBase> selectionStaff;
+ private TimePeriodElement datePreparationDate;
+ private NumberWithLabelElement numberPreservationTemperature;
+ private TextWithLabelElement txtMaterialOrMethods;
+
+ /**
+ * @param formFactory
+ * @param formElement
+ */
+ public DnaSamplePreparationPreservationDetailElement(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, DnaSample entity, int style) {
+ Institution institution = null;
+ AgentBase<?> staff = null;
+ TimePeriod preparationDate = null;
+ if(entity.getDerivedFrom()!=null){
+ institution = entity.getDerivedFrom().getInstitution();
+ staff = entity.getDerivedFrom().getActor();
+ preparationDate = entity.getDerivedFrom().getTimeperiod();
+ }
+
+ Double temperature = null;
+ String materialOrMethodText = null;
+ if(entity.getPreservation()!=null){
+ temperature = entity.getPreservation().getTemperature();
+ }
+ if(entity.getDerivedFrom()!=null){
+ materialOrMethodText = entity.getDerivedFrom().getDescription();
+ }
+ selectionInstitution = formFactory.createSelectionElement(Institution.class, getConversationHolder(), formElement, "Institution", institution, EntitySelectionElement.ALL, style);
+ selectionStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Staff", staff, EntitySelectionElement.ALL, style);
+ datePreparationDate = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
+ numberPreservationTemperature = formFactory.createNumberTextWithLabelElement(formElement, "Preservation Temp. [C°]", temperature, style);
+ txtMaterialOrMethods = formFactory.createTextWithLabelElement(formElement, "Materials && Methods", materialOrMethodText, style);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
+ * .lang.Object)
+ */
+ @Override
+ public void handleEvent(Object eventSource) {
+ if(eventSource==datePreparationDate){
+ if(getEntity().getDerivedFrom()!=null){
+ getEntity().getDerivedFrom().setTimeperiod(datePreparationDate.getTimePeriod());
+ }
+ }
+ else if(eventSource==selectionInstitution){
+ if(getEntity().getDerivedFrom()!=null){
+ getEntity().getDerivedFrom().setInstitution(selectionInstitution.getSelection());
+ }
+ }
+ else if(eventSource==selectionStaff){
+ if(getEntity().getDerivedFrom()!=null){
+ getEntity().getDerivedFrom().setActor(selectionStaff.getSelection());
+ }
+ }
+ else if(eventSource==numberPreservationTemperature && numberPreservationTemperature.getText()!=null){
+ addPreservationMethod().setTemperature(numberPreservationTemperature.getDouble());
+ }
+ else if(eventSource==txtMaterialOrMethods && getEntity().getDerivedFrom()!=null){
+ getEntity().getDerivedFrom().setDescription(txtMaterialOrMethods.getText());
+ }
+ }
+
+ private PreservationMethod addPreservationMethod(){
+ PreservationMethod preservationMethod = getEntity().getPreservation();
+ if(preservationMethod==null){
+ preservationMethod = PreservationMethod.NewInstance();
+ getEntity().setPreservation(preservationMethod);
+ }
+ return preservationMethod;
+ }
+}
--- /dev/null
+// $Id$
+/**
+* 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.occurrence.dna;
+
+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;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+
+/**
+ * @author pplitzner
+ * @date 12.12.2013
+ *
+ */
+public class DnaSamplePreparationPreservationSection extends AbstractCdmDetailSection<DnaSample> {
+
+ public DnaSamplePreparationPreservationSection(CdmFormFactory formFactory,
+ ConversationHolder conversation, ICdmFormElement parentElement,
+ ISelectionProvider selectionProvider, int style) {
+ super(formFactory, conversation, parentElement, selectionProvider, style);
+ }
+
+
+ @Override
+ public String getHeading() {
+ return "Preparation/Preservation";
+ }
+
+ @Override
+ protected AbstractCdmDetailElement<DnaSample> createCdmDetailElement(AbstractCdmDetailSection<DnaSample> parentElement, int style) {
+ return formFactory.createDnaSamplePreparationPreservationDetailElement(parentElement);
+ }
+}
protected EntitySelectionElement<Reference> selection_reference;
protected TextWithLabelElement text_referenceDetail;
- /**
- * <p>
- * Constructor for AbstractReferencedEntityElement.
- * </p>
- *
- * @param formFactory
- * a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
- * object.
- * @param section
- * a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
- * object.
- * @param entity
- * a T object.
- * @param removeListener
- * a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style
- * a int.
- * @param <T>
- * a T object.
- */
public SequenceReferenceCollectionDetailElement(CdmFormFactory formFactory,
AbstractFormSection<?> section, Reference<?> entity,
SelectionListener removeListener, int style) {
super(formFactory, section, entity, removeListener, null, style);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.forms.section.AbstractEntityCollectionElement#
- * createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
- */
/** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement formElement, int style) {
formElement, "Reference Detail", null, SWT.NULL);
}
- /**
- * <p>
- * setEntity
- * </p>
- *
- * @param entity
- * a T object.
- */
@Override
public void setEntity(Reference<?> entity) {
this.entity = entity;
text_referenceDetail.setText(entity.getReferenceAbstract());
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
- */
@Override
public void handleEvent(Object eventSource) {
if(eventSource==selection_reference){
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.media.ITogglableMediaElement;
import eu.etaxonomy.taxeditor.ui.section.media.MediaDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
* @date 16.12.2013
*
*/
-public class MediaSpecimenGeneralDetailElement extends AbstractCdmDetailElement<MediaSpecimen> {
+public class MediaSpecimenGeneralDetailElement extends AbstractCdmDetailElement<MediaSpecimen> implements ITogglableMediaElement{
private final TermVocabulary mediaSpecimenVocabulary = CdmStore.getService(IVocabularyService.class).find(VocabularyEnum.MediaSpecimenKindOfUnit.getUuid());
super(formFactory, formElement);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
- * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
- */