command.name.setSecForSubtree = set secundum for subtree\r
command.label.setPublishForSubtree = Set publish flag for subtree\r
command.name.setPublishForSubtree = Set publish flag for subtree\r
+command.name.setUnplaced = Set Unplaced Flag\r
+command.label.setUnplaced = Set Unplaced Flag\r
+command.label.removeUnplaced = Remove Unplaced Flag\r
+command.name.removeUnplaced = Remove Unplaced Flag\r
wizard.name = TCS\r
wizard.name.2 = Excel Normal Explicit Taxa\r
wizard.name.3 = ABCD\r
command.name.setSecForSubtree = Setze Secundum für Teilbaum\r
command.label.setPublishForSubtree = Publish Flag\r
command.name.setPublishForSubtree = Setze Publish Flag für Teilbaum\r
+command.name.setUnplaced = Setze Unplaced Flag\r
+command.label.setUnplaced = Setze Unplaced Flag\r
+command.label.removeUnplaced = Entferne Unplaced Flag\r
+command.name.removeUnplaced = Entferne Unplaced Flag\r
+\r
wizard.name = TCS\r
wizard.name.2 = Excel Normal Explicit Taxa\r
wizard.name.3 = ABCD\r
</handlers>
<handlers xmi:id="_-GirMLVbEeeZf_R8QJbACw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.LinkWithTaxonHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.LinkWithTaxonHandlerE4" command="_6iiY8LVbEeeZf_R8QJbACw"/>
<handlers xmi:id="_gWjsEJO5EeiqbJlqxN0v2w" elementId="eu.etaxonomy.taxeditor.navigation.handler.0" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.AggregateTaxonDescriptionsHandler" command="_jd_XEJO5EeiqbJlqxN0v2w"/>
+ <handlers xmi:id="_Jr9BQM0xEeiHbMP3rrIRKQ" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.SetUnplacedHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.SetUnplacedHandler" command="_oghMkM0vEeiHbMP3rrIRKQ"/>
+ <handlers xmi:id="_lct0oM1AEeiHbMP3rrIRKQ" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemoveUnplacedHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemoveUnplacedHandler" command="_gMQnoM1AEeiHbMP3rrIRKQ"/>
<menus xsi:type="menu:PopupMenu" xmi:id="_XNXnkJIvEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigator.popupmenu.taxonnavigator">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_5ydggKkeEeejedk4mZQIGw" coreExpressionId="isCdmStoreConnected"/>
<children xsi:type="menu:Menu" xmi:id="_yzFmYJIvEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menu.new" label="%menu.label">
<children xsi:type="menu:HandledMenuItem" xmi:id="_SNIFsK5bEeeDTZvTg-vKRg" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.setpublishforsubtree" label="%command.label.setPublishForSubtree" command="_Jb45kK5bEeeDTZvTg-vKRg"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_mLjosJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.setsecforsubtree" label="%command.label.setSecForSubtree" command="_uFj1YJIxEeeJAdt8ZUxyaw"/>
</children>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_Yb8F8M1AEeiHbMP3rrIRKQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.removeUnplaced" label="%command.label.removeUnplaced" command="_gMQnoM1AEeiHbMP3rrIRKQ">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_39MtQM1AEeiHbMP3rrIRKQ" coreExpressionId="isUnplaced"/>
+ </children>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_YeWwgM0vEeiHbMP3rrIRKQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.setUnplaced" label="%command.label.setUnplaced" command="_oghMkM0vEeiHbMP3rrIRKQ">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_fXWooM0vEeiHbMP3rrIRKQ" coreExpressionId="isNotUnplaced"/>
+ </children>
<children xsi:type="menu:MenuSeparator" xmi:id="_z0Q6EJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.4"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_0FX4MJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.refresh" label="%command.label.11" command="_ukhM0JIyEeeJAdt8ZUxyaw"/>
</menus>
<elements xsi:type="commands:Command" xmi:id="_8C8AEKQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.command.delete" commandName="%command.name.11"/>
<elements xsi:type="commands:Command" xmi:id="_6iiY8LVbEeeZf_R8QJbACw" elementId="eu.etaxonomy.taxeditor.navigation.command.linkWithTaxon" commandName="Link with taxon"/>
<elements xsi:type="commands:Command" xmi:id="_jd_XEJO5EeiqbJlqxN0v2w" elementId="eu.etaxonomy.taxeditor.navigation.command.aggregateTaxonDescriptions" commandName="Aggregate taxon descriptions"/>
+ <elements xsi:type="commands:Command" xmi:id="_oghMkM0vEeiHbMP3rrIRKQ" elementId="eu.etaxonomy.taxeditor.navigator.command.update.setUnplaced" commandName="%command.name.setUnplaced"/>
+ <elements xsi:type="commands:Command" xmi:id="_gMQnoM1AEeiHbMP3rrIRKQ" elementId="eu.etaxonomy.taxeditor.navigator.command.update.removeUnplaced" commandName="%command.name.removeUnplaced"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_3CbhIK25EeeykrJkROy5EA" featurename="children" parentElementId="eu.etaxonomy.navigation.menu.new" positionInList="after:eu.etaxonomy.taxeditor.editor.menuseparator.22">
<elements xsi:type="menu:HandledMenuItem" xmi:id="_M9FakK26EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.commandlabel13" label="%command.label.13" tooltip="%command.label.13" command="_Nx06MJIvEeeJAdt8ZUxyaw">
class="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester"
id="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester"
namespace="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester"
- properties="hasSynonyms,isClassification"
+ properties="hasSynonyms,isClassification,isUnplaced,isExcluded"
type="java.lang.Object">
</propertyTester>
- <propertyTester
+ <!--<propertyTester
class="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester"
id="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester"
namespace="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester"
namespace="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester"
properties="hasTaxa"
type="eu.etaxonomy.cdm.model.taxon.TaxonNode">
- </propertyTester>
+ </propertyTester>-->
<propertyTester
class="eu.etaxonomy.taxeditor.preference.CdmStorePropertyTester"
id="eu.etaxonomy.taxeditor.preference.CdmStorePropertyTester"
property="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester.isClassification">
</test>
</definition>
+ <definition
+ id="isUnplaced">
+ <test
+ property="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester.isUnplaced">
+ </test>
+ </definition>
+ <definition
+ id="isNotUnplaced">
+ <not>
+ <reference
+ definitionId="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester.isUnplaced">
+ </reference>
+ </not>
+ </definition>
+ <definition
+ id="isExcluded">
+ <test
+ property="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodePropertyTester.isExcluded">
+ </test>
+ </definition>
</extension>
<extension
id="eu.etaxonomy.taxeditor.navigation.workbench.model"
public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_REFRESH = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.refresh";
public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_SETPUBLISHFORSUBTREE = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.setpublishforsubtree";
public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_SETSECFORSUBTREE = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.setsecforsubtree";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_SETUNPLACED = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.setunplaced";
public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_SYNCWITHTAXON = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.syncwithtaxon";
public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENU_NEW_CLASSIFICATION = "eu.etaxonomy.taxeditor.navigation.menu.new.classification";
public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENU_NEW_TAXON = "eu.etaxonomy.taxeditor.navigation.menu.new.taxon";
public static String SetPublishForSubtreeOperation_CHANGE_PUBLISH_OP;
public static String TaxonNavigatorLabels_SET_PUBLISH_FOR_CHILDREN;
public static String TaxonNavigatorLabels_ACCEPTED_TAXA_NEED_TO_BE_FROM_SAME_CLASSIFICATION;
+ public static String TaxonNavigatorLabels_SET_UNPLACED;
static {
// initialize resource bundle
TreeNodeDropAdapter_UNSAVED_PARENT_MESSAGE=There are unsaved changes in the parent taxon. Please save first.
SetPublishForSubtreeOperation_CHANGE_PUBLISH_OP=Change publish flag for all children
TaxonNavigatorLabels_SET_PUBLISH_FOR_CHILDREN=Change publish flag for all children
+TaxonNavigatorLabels_SET_UNPLACED=Set unplaced flag for taxonnode(s)
SetPublishForSubtreeOperation_CHANGE_PUBLISH_OP=Publish Flag für alle Kinder ändern
TaxonNavigatorLabels_SET_PUBLISH_FOR_CHILDREN=Ändere Publish Flag für alle Kinder
-
+TaxonNavigatorLabels_SET_UNPLACED=Setze unplaced Flag für den/die Taxonknoten
public static final String UNSAVED_CHANGES_MESSAGE = Messages.TaxonNavigatorLabels_UNSAVED_CHANGES;
public static final String CHANGE_SECUNDUM_FOR_SUBTREE = Messages.TaxonNavigatorLabels_SET_SEC_FOR_CHILDREN;
public static final String ACCEPTED_TAXA_NEED_TO_BE_FROM_SAME_CLASSIFICATION = Messages.TaxonNavigatorLabels_ACCEPTED_TAXA_NEED_TO_BE_FROM_SAME_CLASSIFICATION;
+ public static final String SET_UNPLACED = Messages.TaxonNavigatorLabels_SET_UNPLACED;
private static final Object HAS_SYNONYMS = "hasSynonyms"; //$NON-NLS-1$
private static final Object HAS_TAXA = "hasTaxa"; //$NON-NLS-1$
private static final Object IS_CLASSIFICATION = "isClassification"; //$NON-NLS-1$
-
+ private static final Object IS_UNPLACED = "isUnplaced";
+ private static final Object IS_EXCLUDED = "isExcluded";
/** {@inheritDoc} */
@Override
public boolean test(Object receiver, String property, Object[] args,
TaxonNodeDto node = (TaxonNodeDto) receiver;
return node.getTaxonUuid() == null;
}
+ if (receiver instanceof TaxonNodeDto && IS_UNPLACED.equals(property)) {
+ TaxonNodeDto node = (TaxonNodeDto) receiver;
+ return node.isUnplaced();
+ }
+ if (receiver instanceof TaxonNodeDto && IS_EXCLUDED.equals(property)) {
+ TaxonNodeDto node = (TaxonNodeDto) receiver;
+ return node.isExcluded();
+ }
return false;
}
@CanExecute
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
- boolean canExecute = false;
- canExecute = selection.size()==1
- && selection.getFirstElement() instanceof TaxonNodeDto
- && ((TaxonNodeDto)selection.getFirstElement()).getTaxonUuid() != null ;
+ boolean canExecute = !selection.isEmpty();
+ Object[] array = selection.toArray();
+ for (Object object : array) {
+ canExecute &= (object instanceof TaxonNodeDto) && ((TaxonNodeDto)selection.getFirstElement()).getTaxonUuid() != null;
+ }
menuItem.setVisible(canExecute);
return canExecute;
}
--- /dev/null
+/**
+* Copyright (C) 2018 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.SetUnplacedOperation;
+
+/**
+ * @author k.luther
+ * @since 11.10.2018
+ *
+ */
+public class RemoveUnplacedHandler extends UnplacedHandler {
+ @Override
+ public AbstractOperation prepareOperation(IStructuredSelection selection,
+ Shell shell,
+ MPart activePart,
+ MHandledMenuItem menuItem) {
+ SetUnplacedOperation operation =
+ new SetUnplacedOperation(getTrigger(),
+ true,
+ taxonNodes,
+ false);
+
+ return operation;
+ }
+
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = !selection.isEmpty();
+ Object[] array = selection.toArray();
+ for (Object object : array) {
+ canExecute &= (object instanceof TaxonNodeDto) && (((TaxonNodeDto)object).getUuid() != null) && ((TaxonNodeDto)object).isUnplaced();
+ }
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2018 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.SetUnplacedOperation;
+
+/**
+ * @author k.luther
+ * @since 11.10.2018
+ *
+ */
+public class SetUnplacedHandler extends UnplacedHandler {
+ @Override
+ public AbstractOperation prepareOperation(IStructuredSelection selection,
+ Shell shell,
+ MPart activePart,
+ MHandledMenuItem menuItem) {
+ SetUnplacedOperation operation =
+ new SetUnplacedOperation(getTrigger(),
+ true,
+ taxonNodes,
+ true);
+
+ return operation;
+ }
+
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = !selection.isEmpty();
+ Object[] array = selection.toArray();
+ for (Object object : array) {
+ canExecute &= (object instanceof TaxonNodeDto) && (((TaxonNodeDto)object).getUuid() != null) && !((TaxonNodeDto)object).isUnplaced();
+ }
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+
+}
--- /dev/null
+/**
+* Copyright (C) 2018 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
+import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels;
+import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
+
+/**
+ * @author k.luther
+ * @since 11.10.2018
+ *
+ */
+public abstract class UnplacedHandler extends RemotingCdmHandlerE4{
+ protected List<UUID> taxonNodes ;
+
+ public UnplacedHandler() {
+ super(TaxonNavigatorLabels.SET_UNPLACED);
+ }
+
+ @Override
+ public IStatus allowOperations(IStructuredSelection selection,
+ Shell shell,
+ MPart activePart,
+ MHandledMenuItem menuItem) {
+
+
+ // check for no taxon tree node selected
+ if(selection.size() == 0) {
+ return new Status(IStatus.ERROR,
+ "unknown", //$NON-NLS-1$
+ TaxonNavigatorLabels.NO_TAXON_SELECTION_MESSAGE);
+ }
+ taxonNodes = new ArrayList<>();
+ // check that selected object is a taxon node
+ Iterator<TaxonNodeDto> iterator = selection.iterator();
+ while(iterator.hasNext()){
+ Object obj = iterator.next();
+ if(obj instanceof TaxonNodeDto) {
+ if(obj instanceof Classification){
+ taxonNodes.add(((Classification)obj).getRootNode().getUuid());
+ }else{
+ taxonNodes.add(((TaxonNodeDto)obj).getUuid());
+ }
+ } else{
+ return new Status(IStatus.ERROR,
+ "unknown", //$NON-NLS-1$
+ TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE);
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+
+
+ @Override
+ public void onComplete() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Object getTrigger() {
+ return this;
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2018 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.navigation.navigator.operation;
+
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
+
+/**
+ * @author k.luther
+ * @since 11.10.2018
+ *
+ */
+public class SetUnplacedOperation extends RemotingCdmUpdateOperation {
+ private final static String LABEL = Messages.TaxonNavigatorLabels_SET_UNPLACED;
+ private List<UUID> sourceTaxonNodeUuids;
+ private boolean unplaced;
+ /**
+ * @param source
+ * @param async
+ */
+ public SetUnplacedOperation(Object source,
+ boolean async,
+ List<UUID> sourceTaxonNodeUuids,
+ boolean unplaced) {
+ super(LABEL, Action.Update, source, async);
+ this.sourceTaxonNodeUuids = sourceTaxonNodeUuids;
+ this.unplaced = unplaced;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
+
+ List<TaxonNode> nodes = CdmApplicationState.getService(ITaxonNodeService.class).load(sourceTaxonNodeUuids, null);
+
+ for (TaxonNode node: nodes){
+ node.setUnplaced(unplaced);
+ }
+ List<MergeResult<TaxonNode>> results = CdmApplicationState.getService(ITaxonNodeService.class).merge(nodes, true);
+ UpdateResult updateResult = new UpdateResult();
+ for (MergeResult<TaxonNode>result: results){
+ updateResult.addUpdatedObject(result.getMergedEntity());
+ }
+ return updateResult;
+ }
+
+}
super.setEntity(entity);
}
+
+
}
@Override
protected void createControls(ICdmFormElement formElement,
ITaxonTreeNode entity, int style) {
- selection_classification = formFactory
- .createSelectionElement(Classification.class,//getConversationHolder(),
- formElement, "Classification",
- null, EntitySelectionElement.DELETABLE, style);
- selection_parentTaxonNode = formFactory
- .createTaxonNodeSelectionElement(getConversationHolder(), formElement, "Parent", null,
- EntitySelectionElement.DELETABLE, style);
-
- selection_reuseExistingTaxon = formFactory
- .createSelectionElement(Taxon.class,//getConversationHolder(),
- formElement,
- "Reuse existing taxon", null,
- EntitySelectionElement.DELETABLE, style);
-
- selection_reuseExistingName = formFactory
- .createSelectionElement(TaxonName.class,//getConversationHolder(),
- formElement,
- "Reuse existing name", null,
- EntitySelectionElement.DELETABLE, style);
- selection_SecRef = formFactory
- .createSelectionElement(Reference.class,//getConversationHolder(),
- formElement, "Secundum Reference", null,
- EntitySelectionElement.DELETABLE, style);
- selection_Ref = formFactory
+ if (createNew){
+ selection_classification = formFactory
+ .createSelectionElement(Classification.class,//getConversationHolder(),
+ formElement, "Classification",
+ null, EntitySelectionElement.DELETABLE, style);
+ selection_parentTaxonNode = formFactory
+ .createTaxonNodeSelectionElement(getConversationHolder(), formElement, "Parent", null,
+ EntitySelectionElement.DELETABLE, style);
+
+ selection_reuseExistingTaxon = formFactory
+ .createSelectionElement(Taxon.class,//getConversationHolder(),
+ formElement,
+ "Reuse existing taxon", null,
+ EntitySelectionElement.DELETABLE, style);
+
+ selection_reuseExistingName = formFactory
+ .createSelectionElement(TaxonName.class,//getConversationHolder(),
+ formElement,
+ "Reuse existing name", null,
+ EntitySelectionElement.DELETABLE, style);
+ selection_SecRef = formFactory
+ .createSelectionElement(Reference.class,//getConversationHolder(),
+ formElement, "Secundum Reference", null,
+ EntitySelectionElement.DELETABLE, style);
+
+ if (isCreateNew()){
+ textNewTaxonName = formFactory.createTextWithLabelElement(formElement,"New Taxon", "", style);
+ textNewTaxonName.setFocus();
+ } else{
+ textNewTaxonName = formFactory.createTextWithLabelElement(formElement,"Taxon", "", style);
+
+ }
+ }else{
+ TextWithLabelElement textClassification = formFactory.createTextWithLabelElement(formElement,"Classification", ((TaxonNode)entity).getClassification().getTitleCache(), style);
+ textClassification.setEnabled(false);
+
+ TextWithLabelElement textTaxon = formFactory.createTextWithLabelElement(formElement,"Taxon", ((TaxonNode)entity).getTaxon().getTitleCache(), style);
+ textTaxon.setEnabled(false);
+
+ TextWithLabelElement textTaxonSec = formFactory.createTextWithLabelElement(formElement,"Secundum Reference", "", style);
+ if (((TaxonNode)entity).getTaxon().getSec() != null){
+ textTaxonSec.setText(((TaxonNode)entity).getTaxon().getSec().getTitleCache());
+ }
+ textTaxonSec.setEnabled(false);
+
+
+
+ }
+
+ selection_Ref = formFactory
.createSelectionElement(Reference.class,//getConversationHolder(),
formElement, "Parent Child Relationship Reference", null,
EntitySelectionElement.DELETABLE, style);
- microReference = formFactory.createTextWithLabelElement(formElement,"Detail", "", style);
- if (!isCreateNew()){
- selection_Ref.setEntity(entity.getReference());
- }
- if (isCreateNew()){
- textNewTaxonName = formFactory.createTextWithLabelElement(formElement,"New Taxon", "", style);
- textNewTaxonName.setFocus();
- } else{
- textNewTaxonName = formFactory.createTextWithLabelElement(formElement,"Taxon", "", style);
+ microReference = formFactory.createTextWithLabelElement(formElement,"Detail", "", style);
- }
+ if (!isCreateNew()){
+ selection_Ref.setEntity(entity.getReference());
+ }
if (entity instanceof TaxonNode) {
checkbox_publish = formFactory.createCheckbox(formElement,
"Taxon is public", ((TaxonNode)entity).getTaxon().isPublish(), style);
checkbox_unplaced = formFactory.createCheckbox(formElement,
"Taxon is unplaced", false, style);
}
-
- preFillTaxonName();
+ if (isCreateNew()){
+ preFillTaxonName();
+ }
if (entity instanceof TaxonNode) {
checkbox_excluded = formFactory.createCheckbox(formElement,
private void setTreeNode(ITaxonTreeNode treeNode) {
classification = HibernateProxyHelper
.deproxy(((TaxonNode) treeNode).getClassification());
- selection_classification.setEntity(classification);
- selection_parentTaxonNode.setEntity(((TaxonNode) treeNode).getParent());
- selection_parentTaxonNode.setClassification(((TaxonNode) treeNode).getParent().getClassification());
- selection_SecRef.setEntity(((TaxonNode)treeNode).getTaxon().getSec());
+ if (isCreateNew()){
+ selection_classification.setEntity(classification);
+ selection_parentTaxonNode.setEntity(((TaxonNode) treeNode).getParent());
+ selection_parentTaxonNode.setClassification(((TaxonNode) treeNode).getParent().getClassification());
+ selection_SecRef.setEntity(((TaxonNode)treeNode).getTaxon().getSec());
+ }
}
private void setTaxon(Taxon taxon) {
this.checkbox_publish.setSelection(publish);
}
+
}