Bundle-ManifestVersion: 2
Bundle-Name: Application
Bundle-SymbolicName: eu.etaxonomy.taxeditor.application;singleton:=true
-Bundle-Version: 5.27.0
+Bundle-Version: 5.28.0
Bundle-Activator: eu.etaxonomy.taxeditor.TaxonomicEditorPlugin
Bundle-Vendor: EDIT
Bundle-Localization: OSGI-INF/l10n/plugin
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.27.0</version>
+ <version>5.28.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
/**
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
*/
package eu.etaxonomy.taxeditor.perspective;
/**
* @author n.hoffmann
- *
*/
public abstract class Default implements IPerspectiveFactory {
protected static final String CONCEPT_VIEW = eu.etaxonomy.taxeditor.editor.AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_CONCEPT_E4_CONCEPTVIEWPARTE4;
protected static final String REFERENCING_VIEW = eu.etaxonomy.taxeditor.bulkeditor.AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_REFERENCINGOBJECTS_E4_REFERENCINGOBJECTSVIEWE4;
-
public static final String ADDITIONAL = "additional";
- /**
- *
- * @param layout
- * @param refId
- */
public void createAdditionalFolder(IPageLayout layout, String refId) {
}
-
-}
+}
\ No newline at end of file
Bundle-ManifestVersion: 2
Bundle-Name: Bulkeditor Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.bulkeditor;singleton:=true
-Bundle-Version: 5.27.0
+Bundle-Version: 5.28.0
Bundle-Activator: eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin
Bundle-Vendor: EDIT
Export-Package: eu.etaxonomy.taxeditor.annotatedlineeditor,
#Properties file for eu.etaxonomy.taxeditor.bulkeditor
editor.name = Bulk Editor
-editor.name.0 = Name Editor
+editor.name.0 = Taxon Editor
editor.name.1 = Data Import Editor
menu.label = Bulk Editor
menu.label.0 = Search Specimen
#Properties file for eu.etaxonomy.taxeditor.bulkeditor
editor.name = Bulk Editor
-editor.name.0 = Namens Editor
+editor.name.0 = Taxon Editor
editor.name.1 = Daten-Import Editor
menu.label = Bulk Editor
menu.label.0 = Suche Specimen
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.27.0</version>
+ <version>5.28.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Bundle-ManifestVersion: 2
Bundle-Name: CDM Library Dependencies Plugin
Bundle-SymbolicName: eu.etaxonomy.taxeditor.cdmlib;singleton:=true
-Bundle-Version: 5.27.0
+Bundle-Version: 5.28.0
Eclipse-BundleShape: dir
Export-Package: com.sun.istack.internal.tools,
com.sun.istack.internal.ws,
Bundle-ClassPath: .,
lib/apache-log4j-extras-1.2.17.jar,
lib/aspectjrt-1.9.6.jar,
- lib/cdmlib-commons-5.27.0.jar,
- lib/cdmlib-ext-5.27.0.jar,
- lib/cdmlib-io-5.27.0.jar,
- lib/cdmlib-model-5.27.0.jar,
- lib/cdmlib-persistence-5.27.0.jar,
- lib/cdmlib-cache-5.27.0.jar,
- lib/cdmlib-services-5.27.0.jar,
+ lib/cdmlib-commons-5.28.0.jar,
+ lib/cdmlib-ext-5.28.0.jar,
+ lib/cdmlib-io-5.28.0.jar,
+ lib/cdmlib-model-5.28.0.jar,
+ lib/cdmlib-persistence-5.28.0.jar,
+ lib/cdmlib-cache-5.28.0.jar,
+ lib/cdmlib-services-5.28.0.jar,
lib/commons-beanutils-1.9.4.jar,
lib/commons-codec-1.15.jar,
lib/commons-collections-3.2.2.jar,
lib/apache-log4j-extras-1.2.17.jar,\
lib/aspectjrt-1.9.6.jar,\
lib/aspectjweaver-1.9.6.jar,\
- lib/cdmlib-commons-5.27.0.jar,\
- lib/cdmlib-ext-5.27.0.jar,\
- lib/cdmlib-io-5.27.0.jar,\
- lib/cdmlib-model-5.27.0.jar,\
- lib/cdmlib-persistence-5.27.0.jar,\
- lib/cdmlib-services-5.27.0.jar,\
+ lib/cdmlib-commons-5.28.0.jar,\
+ lib/cdmlib-ext-5.28.0.jar,\
+ lib/cdmlib-io-5.28.0.jar,\
+ lib/cdmlib-model-5.28.0.jar,\
+ lib/cdmlib-persistence-5.28.0.jar,\
+ lib/cdmlib-services-5.28.0.jar,\
lib/commons-beanutils-1.9.4.jar,\
lib/commons-codec-1.15.jar,\
lib/commons-collections-3.2.2.jar,\
lib/lucene-analyzers-common-5.4.1.jar,\
lib/lucene-sandbox-5.4.1.jar,\
lib/lucene-suggest-5.4.1.jar,\
- lib/cdmlib-cache-5.27.0.jar,\
+ lib/cdmlib-cache-5.28.0.jar,\
lib/org.swtchart_0.10.0.v20160212.jar,\
lib/commons-collections4-4.4.jar,\
lib/commons-math3-3.6.1.jar,\
<parent>\r
<groupId>eu.etaxonomy</groupId>\r
<artifactId>taxeditor-parent</artifactId>\r
- <version>5.27.0</version>\r
+ <version>5.28.0</version>\r
</parent>\r
<modelVersion>4.0.0</modelVersion>\r
<artifactId>eu.etaxonomy.taxeditor.cdmlib</artifactId>\r
private static final Logger logger = Logger.getLogger(CdmApplicationRemoteConfiguration.class);\r
\r
/**\r
- * Timeout for service lookup etc. This timeout (milliseconds) should me more\r
+ * Timeout for service lookup etc. This timeout (milliseconds) should be more\r
* strict than {@link #HTTP_READ_TIMEOUT} to avoid connecting to\r
* cdm servers when the network quality is too bad.\r
- *\r
+ * Note AM: IMO we should not be to strict, sometimes services do not respond too fast\r
+ * during the first call (e.g. test server), therefore I put this up from 1 to 3 sec.\r
+ * Better we should inform the user that the connection might be of low quality\r
+ * instead of making the connection completely unavailable.\r
*/\r
- public static final int HTTP_READ_TIMEOUT_MIN = 1000; // one second\r
+ public static final int HTTP_READ_TIMEOUT_MIN = 3000; // 3 seconds\r
\r
/**\r
* Timeout for normal operation (milliseconds)\r
Bundle-ManifestVersion: 2
Bundle-Name: Editor Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.editor;singleton:=true
-Bundle-Version: 5.27.0
+Bundle-Version: 5.28.0
Bundle-Activator: eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: OSGI-INF/l10n/plugin
command.name.17 = Set Basionym\r
command.name.18 = Remove Basionym\r
editor.name = Multipage Taxon Editor\r
-editor.name.0 = Taxon Name Editor\r
+editor.name.0 = Taxon Editor\r
editor.name.1 = Key\r
editor.name.2 = Polytomous Key Graph Editor\r
editor.name.3 = Polytomous Key List Editor\r
command.label.44 = Delete\r
command.label.45 = Edit Authorities\r
extension.name = Name Commands\r
-category.name.0 = -- Name Editor\r
+category.name.0 = -- Taxon Editor\r
command.name = Open Parent\r
command.name.0 = Create Homotypic Synonym\r
command.name.1 = Create Heterotypic Synonym\r
command.name.REUSE_SINGLE_READ = Reuse SingleRead\r
command.name.REMOVE_SINGLE_READ = Remove SingleRead from sequence\r
\r
-viewCommandMapping.viewerName.NAME_EDITOR = Name Editor\r
+viewCommandMapping.viewerName.NAME_EDITOR = Taxon Editor\r
viewCommandMapping.viewerName.SPECIMEN_EDITOR = Specimen Editor (tree)\r
viewCommandMapping.viewerName.CHECKLIST_EDITOR = Distribution Editor\r
command.name.OPEN_EDITOR_FOR_TYPE_SPECIMEN = Open specimen tree editor for type specimen
handledmenuitem.label.10 = Remove Character
handledtoolitem.label.1 = Collapse
handledtoolitem.label.2 = Expand
-partdescriptor.label.2 = Taxon Name Editor
+partdescriptor.label.2 = Taxon Editor
handledtoolitem.label.3 = Collapse
handledtoolitem.label.4 = Expand
handledmenuitem.label.11 = Open Graph
command.name.17 = Setze Basionym
command.name.18 = Entferne Basionym
editor.name = Multipage Taxon Editor
-editor.name.0 = Editor Taxonname
+editor.name.0 = Taxon Editor
editor.name.1 = Bestimmungsschl\u00fcssel
editor.name.2 = Polytomer Bestimmungsschl\u00fcssel Graph Editor
editor.name.3 = Polytomer Bestimmungsschl\u00fcssel List Editor
command.label.44 = L\u00f6schen
command.label.45 = Bearbeite Rechte
extension.name = Namensbefehle
-category.name.0 = -- Namenseditor
+category.name.0 = -- Taxon Editor
command.name = \u00d6ffne Elter
command.name.0 = Erstelle homotypisches Synonym
command.name.1 = Erstelle heterotypisches Synonym
command.label.REUSE_SINGLE_READ_HERE = Single-Read hier wiederverwenden
command.label.REUSE_SINGLE_READ_FOR_OTHER_SEQUENCE = Für andere Sequenz wiederverwenden
command.label.REMOVE_SINGLE_READ_FROM_THIS_SEQUENCE = Von dieser Sequenz entfernen
-command.name.OPEN_NAME_EDITOR_FOR_TAXON_NODE = Öffne Namenseditor für Taxonknoten
+command.name.OPEN_NAME_EDITOR_FOR_TAXON_NODE = Öffne Taxon Editor für Taxonknoten
command.name.OPEN_DERIVATIVE_EDITOR = Öffne Specimen-Editor (Baum)
command.name.LINK_WITH_TAXON_SELECTION = Verknüpfe mit Taxonauswahl
command.name.COPY_SINGLE_READ_TO_CLIPBOARD = Kopiere Single-Read in die Zwischenablage
command.name.REUSE_SINGLE_READ = Single-Read wiederverwenden
command.name.REMOVE_SINGLE_READ = Entferne Single-Read von Sequenz
-viewCommandMapping.viewerName.NAME_EDITOR = Namenseditor
+viewCommandMapping.viewerName.NAME_EDITOR = Taxon Editor
viewCommandMapping.viewerName.SPECIMEN_EDITOR = Specimen-Editor (Baum)
viewCommandMapping.viewerName.CHECKLIST_EDITOR = Verbreitungs-Editor
command.name.OPEN_EDITOR_FOR_TYPE_SPECIMEN = Öffne Specimen-Baum-Editor für Typusbelege
handledmenuitem.label.10 = Character entfernen
handledtoolitem.label.1 = Einklappen
handledtoolitem.label.2 = Ausklappen
-partdescriptor.label.2 = Editor Taxonname
+partdescriptor.label.2 = Taxon Editor
handledtoolitem.label.3 = Einklappen
handledtoolitem.label.4 = Ausklappen
handledmenuitem.label.11 = Graph öffnen
<viewCommandMapping
commandId="eu.etaxonomy.taxeditor.editor.view.concept.command.open"
selection="eu.etaxonomy.cdm.model.taxon.TaxonRelationship"
- viewerName="Name Editor">
+ viewerName="Taxon Editor">
</viewCommandMapping>
<viewCommandMapping
commandId="eu.etaxonomy.taxeditor.editor.openBulkEditorForTaxonRelationship"
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.27.0</version>
+ <version>5.28.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration;
import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
+import org.eclipse.nebula.widgets.nattable.config.EditableRule;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
import org.eclipse.nebula.widgets.nattable.config.IEditableRule;
+import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
import org.eclipse.nebula.widgets.nattable.edit.gui.ICellEditDialog;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
//make cell editable
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITABLE_RULE,
+// getEditRule(matrix.getBodyDataProvider()),
IEditableRule.ALWAYS_EDITABLE,
DisplayMode.EDIT,
CharacterMatrixConfigLabelAccumulator.CATEGORICAL_EDITABLE
//make cell editable
configRegistry.registerConfigAttribute(
EditConfigAttributes.CELL_EDITABLE_RULE,
+// getEditRule(matrix.getBodyDataProvider()),
IEditableRule.ALWAYS_EDITABLE,
DisplayMode.EDIT,
CharacterMatrixConfigLabelAccumulator.QUANTITATIVE_EDITABLE
DisplayMode.NORMAL,
CharacterMatrixConfigLabelAccumulator.QUANTITATIVE);
+
+
//Open cell editor in dialog
configRegistry.registerConfigAttribute(
EditConfigAttributes.OPEN_IN_DIALOG,
DisplayMode.EDIT,
CharacterMatrixConfigLabelAccumulator.QUANTITATIVE_EDITABLE);
}
+
+
+// private static IEditableRule getEditRule(final IDataProvider dataProvider) {
+// return new EditableRule(){
+// public boolean isEditable(int columnIndex, int rowIndex) {
+// Object dataValue = dataProvider.getDataValue(columnIndex, rowIndex);
+// if (dataValue instanceof Set && ((Set)dataValue).size()>1){
+// return false;
+// }else return true;
+// }
+// };
+// }
}
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeExpansionEvent;
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.config.AbstractUiBindingConfiguration;
import org.eclipse.nebula.widgets.nattable.config.ConfigRegistry;
import org.eclipse.nebula.widgets.nattable.freeze.CompositeFreezeLayer;
import org.eclipse.nebula.widgets.nattable.freeze.FreezeHelper;
import org.eclipse.nebula.widgets.nattable.freeze.FreezeLayer;
+import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
import org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider;
import org.eclipse.nebula.widgets.nattable.layer.AbstractLayer;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.layer.ILayer;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
import org.eclipse.nebula.widgets.nattable.persistence.gui.PersistenceDialog;
import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand;
import org.eclipse.nebula.widgets.nattable.sort.SortHeaderLayer;
import org.eclipse.nebula.widgets.nattable.sort.config.SingleClickSortConfiguration;
import org.eclipse.nebula.widgets.nattable.style.theme.ModernNatTableThemeConfiguration;
+import org.eclipse.nebula.widgets.nattable.tooltip.NatTableContentTooltip;
import org.eclipse.nebula.widgets.nattable.tree.ITreeRowModel;
import org.eclipse.nebula.widgets.nattable.tree.TreeLayer;
import org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandToLevelCommand;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
import ca.odell.glazedlists.BasicEventList;
import ca.odell.glazedlists.EventList;
import eu.etaxonomy.cdm.api.service.dto.FieldUnitDTO;
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
import eu.etaxonomy.cdm.api.service.dto.SpecimenRowWrapperDTO;
+import eu.etaxonomy.cdm.api.service.dto.TaxonRowWrapperDTO;
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.persistence.dto.DescriptiveDataSetBaseDto;
import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
import eu.etaxonomy.cdm.persistence.dto.SpecimenNodeWrapper;
+import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
import eu.etaxonomy.cdm.persistence.dto.TermTreeDto;
* Character matrix editor for editing specimen/taxon descriptions in a table
* @author pplitzner
* @since Nov 26, 2017
- *
*/
public class CharacterMatrix extends Composite {
static final String LABEL_TAXON_LITERATURE_DESCRIPTION_ICON = "TAXON_LITERATURE_DESCRIPTION_ICON"; //$NON-NLS-1$
static final String LABEL_TAXON_DESCRIPTION = "LABEL_TAXON_DESCRIPTION"; //$NON-NLS-1$
static final String LABEL_DESCRIPTION_HAS_SUPPLEMENTAL_DATA = "LABEL_DESCRIPTION_HAS_SUPPLEMENTAL_DATA"; //$NON-NLS-1$
-
+
boolean isFirstCall = true;
@Inject
private UISynchronize sync;
private NatTable natTable;
-// private Collection<RowWrapperDTO<?>> rowsToSave = new HashSet<>();
private HashMap<UUID, RowWrapperDTO<?>> rowsToMerge = new HashMap<>();
private Map<Integer, FeatureDto> indexToFeatureMap = new HashMap<>();
private ConfigRegistry configRegistry;
private MatrixBodyLayerStack bodyLayer;
-
+
private SelectionLayer selectionLayer;
private boolean isTreeView = true;
private CharacterMatrixToolbar toolbar;
private DescriptionTreeFormat treeFormat;
-// private List<UUID> descriptionUuidsToDelete;
- Map<RemoveDescriptionsFromDescriptiveDataSetConfigurator, List<UUID>> descriptionUuidsToDelete;
+
+ private Map<RemoveDescriptionsFromDescriptiveDataSetConfigurator, List<UUID>> descriptionUuidsToDelete;
private List<SpecimenRowWrapperDTO> specimenToAdd;
private MouseEventMatcher mouseEventMatcher = null;
- private Set<DescriptionBase> descriptionsToSave = new HashSet<>();
+ private Set<DescriptionBase<?>> descriptionsToSave = new HashSet<>();
public CharacterMatrix(Composite parent, CharacterMatrixPart part) {
super(parent, SWT.NONE);
createToolBar();
natTable = new NatTable(this, false);
-
-// createBottomToolbar();
-
}
private void createToolBar(){
toolbar = new CharacterMatrixToolbar(this, SWT.NONE);
}
-// @SuppressWarnings("unused")
-// private void createBottomToolbar() {
-// new CharacterMatrixBottomToolbar(this, SWT.NONE);
-// }
-
-
private void applyStyles(){
ModernNatTableThemeConfiguration configuration = new ModernNatTableThemeConfiguration();
// NOTE: Getting the colors and fonts from the GUIHelper ensures that
configuration.cHeaderBgColor = GUIHelper.getColor(211, 211, 211);
configuration.rHeaderBgColor = GUIHelper.getColor(211, 211, 211);
natTable.addConfiguration(configuration);
-
}
void toggleTreeFlat(boolean isTree, Button btnToggleFlat, Button btnToggleTree, Button btnCollapseAll, Button btnExpandAll, Button btnFreezeSuppInfo) {
btnToggleTree.setEnabled(!isTree);
btnCollapseAll.setEnabled(isTree);
btnExpandAll.setEnabled(isTree);
-
}
public boolean isTreeView() {
natTable.doCommand(new TreeExpandToLevelCommand(deepestTaxonLevel-2));
}
}
-
+ new NatTableContentTooltip(natTable, GridRegion.BODY) {
+ protected String getText(Event event) {
+ int col = this.natTable.getColumnPositionByX(event.x);
+ int row = this.natTable.getRowPositionByY(event.y);
+
+ ILayerCell cell = this.natTable.getCellByPosition(col, row);
+ if (cell.getConfigLabels().getLabels().contains(CharacterMatrixConfigLabelAccumulator.NOT_EDITABLE)){
+ Object o = bodyDataProvider.getRowObject(row);
+ String object = "";
+ if (o instanceof TaxonNodeDto || o instanceof TaxonRowWrapperDTO){
+ object = "taxon";
+ }else {
+ object = "specimen";
+ }
+
+ return "Multiple data exist. Editing only possible in factual data view of " + object;
+ }
+ return null;
+ }
+ };
+
// clean up table state
getNatTableState().remove(NatTable.INITIAL_PAINT_COMPLETE_FLAG);
SortedList<Object> sortedList = new SortedList<>(descriptions, new MatrixRowComparator());
// wrap the SortedList with the TreeList
treeFormat = new DescriptionTreeFormat(getDescriptiveDataSet());
- TreeList<Object> treeList = new TreeList(sortedList, treeFormat, TreeList.NODES_START_COLLAPSED);
+ @SuppressWarnings("unchecked")
+ TreeList<Object> treeList = new TreeList<Object>(sortedList, treeFormat, TreeList.NODES_START_COLLAPSED);
// wrap the SortedList with the TreeList
// treeFormat = new DescriptionTreeFormat(getDescriptiveDataSet());
}
// layer for event handling of GlazedLists and PropertyChanges
- GlazedListsEventLayer eventLayer = new GlazedListsEventLayer<>(bodyDataLayer, (EventList)bodyDataProvider.getList());
+ GlazedListsEventLayer<Object> eventLayer = new GlazedListsEventLayer<>(bodyDataLayer, (EventList<Object>)bodyDataProvider.getList());
- GlazedListTreeData treeData = new GlazedListTreeData<>(treeList);
- ITreeRowModel treeRowModel = new GlazedListTreeRowModel<>(treeData);
+ GlazedListTreeData<?> treeData = new GlazedListTreeData<>(treeList);
+ ITreeRowModel<?> treeRowModel = new GlazedListTreeRowModel<>(treeData);
// assemble the column groups
LinkedList<ColumnGroupWrapper> columnGroups = new LinkedList<>();
// add the SortHeaderLayer to the column header layer stack
// as we use GlazedLists, we use the GlazedListsSortModel which
// delegates the sorting to the SortedList
- final SortHeaderLayer<DescriptionBase> sortHeaderLayer = new SortHeaderLayer<>(
+ final SortHeaderLayer<DescriptionBase<?>> sortHeaderLayer = new SortHeaderLayer<>(
topHeaderLayer,
new GlazedListsSortModel<>(
sortedList,
configRegistry,
columnHeaderDataLayer));
-
-
/**
* row header layer
*/
RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer,
topMostLayer, selectionLayer);
-
/**
* corner layer
*/
new DataLayer(new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider)),
rowHeaderLayer, sortHeaderLayer);
-
/**
* GRID layer (composition of all other layers)
*/
GridLayer gridLayer = new GridLayer(topMostLayer, sortHeaderLayer, rowHeaderLayer, cornerLayer);
-
natTable.setLayer(gridLayer);
-
}
private TreeSet<Integer> recurseChildIndexes(TermNodeDto node){
natTable.registerCommandHandler(new ExportCommandHandler(natTable));
//selection listener
- E4SelectionListener selectionListener = new CellSelectionListener(part.getSelectionService(),
+ E4SelectionListener<Object> selectionListener = new CellSelectionListener(part.getSelectionService(),
bodyLayer.getSelectionLayer(), bodyDataProvider, part);
bodyLayer.getSelectionLayer().addLayerListener(selectionListener);
selectionListener.setFullySelectedRowsOnly(false);
}
public void loadDescriptions(boolean isInitialExpandToDeepestTaxonLevel, boolean initialLoading) {
+
UUID monitorUuid = CdmApplicationState.getLongRunningTasksService().monitGetRowWrapper(this.getDescriptiveDataSet().getUuid());
- final Collection<RowWrapperDTO> wrappers = new ArrayList<>();
+ final Collection<RowWrapperDTO<?>> wrappers = new ArrayList<>();
String jobLabel = Messages.CharacterMatrix_LOAD_CHARACTER_DATA;
Job job = Job.create(jobLabel, (ICoreRunnable) monitor -> {
SubMonitor subMonitor = SubMonitor.convert(monitor);
}
Object result = remotingMonitor.getResult();
if(result instanceof Collection){
- wrappers.addAll((Collection<RowWrapperDTO>) result);
+ wrappers.addAll((Collection<RowWrapperDTO<?>>) result);
}
if(result instanceof Exception){
MessagingUtils.errorDialog("Exception during description loading", this.getClass(), "An exception occured during loading", TaxeditorEditorPlugin.PLUGIN_ID, (Throwable) result, true);
);
}
descriptions.clear();
+// part.setDescriptiveDataSet(CdmStore.getService(IDescriptiveDataSetService.class).getDescriptiveDataSetDtoByUuid(part.getDescriptiveDataSet().getUuid()));
wrappers.stream().filter(row->row.getTaxonNode()!=null).forEach(wrapper->CharacterMatrix.this.descriptions.add(wrapper));
if(initialLoading){
loadingDone(isInitialExpandToDeepestTaxonLevel);
return categoricalFeatureToStateMap.get(featureUuid);
}
- public Set<DescriptionBase> getDescriptionsToSave() {
+ public Set<DescriptionBase<?>> getDescriptionsToSave() {
return descriptionsToSave;
}
- public void addDescriptionToSave(DescriptionBase descriptionToSave) {
+ public void addDescriptionToSave(DescriptionBase<?> descriptionToSave) {
this.descriptionsToSave.add(descriptionToSave);
}
public void addSpecimenToAdd(Collection<SpecimenRowWrapperDTO> specimenToAdd) {
if (this.specimenToAdd == null){
- this.specimenToAdd = new ArrayList();
+ this.specimenToAdd = new ArrayList<>();
}
this.specimenToAdd.addAll(specimenToAdd);
}
public void addSpecimenToAdd(SpecimenRowWrapperDTO specimenToAdd) {
if (this.specimenToAdd == null){
- this.specimenToAdd = new ArrayList();
+ this.specimenToAdd = new ArrayList<>();
}
this.specimenToAdd.add(specimenToAdd);
return rowsToMerge;
}
- public void putRowToMerge(RowWrapperDTO rowToMerge) {
+ public void putRowToMerge(RowWrapperDTO<?> rowToMerge) {
if (this.rowsToMerge == null){
this.rowsToMerge = new HashMap<>();
}
public void addRowsToMatrix(Collection<SpecimenNodeWrapper> wrappers){
- List<UUID> specimenUuids = new ArrayList();
+ List<UUID> specimenUuids = new ArrayList<>();
wrappers.forEach(wrapper -> specimenUuids.add(wrapper.getUuidAndTitleCache().getUuid()));
// List<SpecimenOrObservationBase> specimens = CdmStore.getService(IOccurrenceService.class).load(specimenUuids, null);
- Map<UUID, UuidAndTitleCache<FieldUnit>> specimenMap = new HashMap();
+ Map<UUID, UuidAndTitleCache<FieldUnit>> specimenMap = new HashMap<>();
for (UUID specimenUuid: specimenUuids ){
try{
FieldUnitDTO fieldUnitDto = CdmStore.getService(IOccurrenceService.class).loadFieldUnitDTO(specimenUuid);
if (fieldUnitDto != null){
- UuidAndTitleCache<FieldUnit> fieldUnit = new UuidAndTitleCache(FieldUnit.class, fieldUnitDto.getUuid(), null, fieldUnitDto.getLabel());
+ UuidAndTitleCache<FieldUnit> fieldUnit = new UuidAndTitleCache<>(FieldUnit.class, fieldUnitDto.getUuid(), null, fieldUnitDto.getLabel());
specimenMap.put(specimenUuid, fieldUnit);
}
}catch(Exception e){
setDirty();
}
- public HashMap<UUID, DescriptionBase> addSpecimensToDescriptiveDataSet(){
+ public HashMap<UUID, DescriptionBase<?>> addSpecimensToDescriptiveDataSet(){
if (specimenToAdd == null || specimenToAdd.isEmpty()){
return new HashMap<>();
}
.collect(Collectors.joining("\n"))));
}
DescriptiveDataSet dataSet = (DescriptiveDataSet) result.getCdmEntity();
- HashMap<UUID, DescriptionBase> resultMap = new HashMap<>();
+ HashMap<UUID, DescriptionBase<?>> resultMap = new HashMap<>();
for (CdmBase updated: result.getUpdatedObjects()){
if (updated instanceof SpecimenDescription){
- resultMap.put(updated.getUuid(), (DescriptionBase)updated);
+ resultMap.put(updated.getUuid(), (DescriptionBase<?>)updated);
}
}
public void setSelectedObject(Object selectedObject){
-
- int rowIndex = ((IRowDataProvider)bodyDataProvider).indexOfRowObject(selectedObject);
- int rowPosition = selectionLayer.getRowPositionByIndex(rowIndex);
- natTable.doCommand( new SelectRowsCommand(natTable, 1, rowPosition, false, false));
-
+
+ int rowIndex = ((IRowDataProvider<Object>)bodyDataProvider).indexOfRowObject(selectedObject);
+ int rowPosition = selectionLayer.getRowPositionByIndex(rowIndex);
+ natTable.doCommand( new SelectRowsCommand(natTable, 1, rowPosition, false, false));
}
-
+
public TreeList<Object> updateDescriptions(boolean treeView){
SortedList<Object> sortedList = new SortedList<>(descriptions, new MatrixRowComparator());
// wrap the SortedList with the TreeList
treeFormat = new DescriptionTreeFormat(getDescriptiveDataSet());
- TreeList<Object> treeList = new TreeList(sortedList, treeFormat, TreeList.NODES_START_COLLAPSED);
+ TreeList<Object> treeList = new TreeList<Object>(sortedList, treeFormat, TreeList.NODES_START_COLLAPSED);
// wrap the SortedList with the TreeList
// treeFormat = new DescriptionTreeFormat(getDescriptiveDataSet());
@Override
public void dispose () {
super.dispose();
- descriptions.dispose();
+ if (descriptions != null){
+ descriptions.dispose();
+ }
descriptions = null;
this.natTable.dispose();
this.natTable = null;
public static final String CATEGORICAL = "CATEGORICAL";
public static final String CATEGORICAL_EDITABLE = CATEGORICAL+"_EDITABLE";
public static final String QUANTITATIVE_EDITABLE = QUANTITATIVE+"_EDITABLE";
+ public static final String NOT_EDITABLE = "NOT_EDITABLE";
private CharacterMatrix matrix;
configLabels.addLabel(DEFAULT_OVERRIDDEN);
}
}
+
+ }
+ if (rowObject instanceof RowWrapperDTO){
+ if (hasMoreThanOneValue(feature, (RowWrapperDTO)rowObject)){
+ isEditable = false;
+ }
}
if(feature.isSupportsCategoricalData()){
configLabels.addLabel(CATEGORICAL);
if(isEditable){
configLabels.addLabel(CATEGORICAL_EDITABLE);
+ }else{
+ configLabels.addLabel(NOT_EDITABLE);
}
}
else if(feature.isSupportsQuantitativeData()){
configLabels.addLabel(QUANTITATIVE);
if(isEditable){
configLabels.addLabel(QUANTITATIVE_EDITABLE);
+ }else{
+ configLabels.addLabel(NOT_EDITABLE);
}
}
}
}
private boolean hasDefaultOverriddenValue(FeatureDto feature, RowWrapperDTO<?> rowWrapper) {
- DescriptionElementDto dataValueForFeature = rowWrapper.getDataValueForFeature(feature.getUuid());
+ Set<DescriptionElementDto> dataValueForFeature = rowWrapper.getDataValueForFeature(feature.getUuid());
if(dataValueForFeature!=null){
- if(dataValueForFeature instanceof CategoricalDataDto){
- return !((CategoricalDataDto) dataValueForFeature).getStates().isEmpty();
- }
- else if(dataValueForFeature instanceof QuantitativeDataDto){
- return !((QuantitativeDataDto) dataValueForFeature).getValues().isEmpty();
- }
+ for (DescriptionElementDto dto:dataValueForFeature){
+ if(dto instanceof CategoricalDataDto && !((CategoricalDataDto) dto).getStates().isEmpty()){
+ return true;
+ }
+ else if(dto instanceof QuantitativeDataDto && !((QuantitativeDataDto) dto).getValues().isEmpty()){
+ return true;
+ }
+ }
}
return false;
}
}
return false;
}
+ private boolean hasMoreThanOneValue(FeatureDto feature, RowWrapperDTO<?> rowWrapperDTO) {
+
+ Set<DescriptionElementDto> elements = rowWrapperDTO.getDataValueForFeature(feature.getUuid());
+ return elements != null && elements.size()>1;
+
+
+ }
+
private boolean hasDefaultValue(FeatureDto feature, DescriptionBaseDto defaultDescription) {
if(defaultDescription!=null){
Style hasDefaultValueStyle = new Style();
hasDefaultValueStyle.setAttributeValue(
CellStyleAttributes.BACKGROUND_COLOR,
- GUIHelper.COLOR_GRAY);
+ GUIHelper.COLOR_WIDGET_LIGHT_SHADOW);
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_STYLE,
hasDefaultValueStyle,
DisplayMode.NORMAL,
CharacterMatrixConfigLabelAccumulator.HAS_DEFAULT);
+
+ Style notEditableValueStyle = new Style();
+ notEditableValueStyle.setAttributeValue(
+ CellStyleAttributes.BACKGROUND_COLOR,
+ GUIHelper.COLOR_GRAY);
+ configRegistry.registerConfigAttribute(
+ CellConfigAttributes.CELL_STYLE,
+ notEditableValueStyle,
+ DisplayMode.NORMAL,
+ CharacterMatrixConfigLabelAccumulator.NOT_EDITABLE);
Style defaultOverriddenStyle = new Style();
defaultOverriddenStyle.setAttributeValue(
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
label.setText(Messages.CharacterMatrixPart_LOADING_MATRIX);
stackLayout.topControl = label;
ContextInjectionFactory.inject(matrix, context);
-
}
public void init(UUID descriptiveDataSetUuid, boolean treeView) {
matrix.createTable(treeView, true, true);
thisPart.setLabel(descriptiveDataSet.getTitleCache());
matrix.loadDescriptions( true, true);
+
}
}
@Override
public void save(IProgressMonitor monitor) {
-
- HashMap<UUID, DescriptionBase> descriptionResults = matrix.addSpecimensToDescriptiveDataSet();
+ HashMap<UUID, DescriptionBase<?>> descriptionResults = matrix.addSpecimensToDescriptiveDataSet();
//newly added descriptions should not be saved again.
// descriptions.removeAll(matrix.getRowsToSave().values());
// save edited descriptions
List<MergeResult<DescriptionBase>> resultsFromSave = CdmStore.getService(IDescriptionService.class).merge(new ArrayList<>(matrix.getDescriptionsToSave()), true);
for (MergeResult<DescriptionBase> result: resultsFromSave){
Set<DescriptionBase> newEntities = result.getNewEntities();
- for(DescriptionBase newEntity: newEntities){
+ for(DescriptionBase<?> newEntity: newEntities){
descriptionResults.put(newEntity.getUuid(), newEntity);
}
- if (result.getMergedEntity() instanceof DescriptionBase){
- descriptionResults.put(result.getMergedEntity().getUuid(), result.getMergedEntity());
- }
-
+ descriptionResults.put(result.getMergedEntity().getUuid(), result.getMergedEntity());
}
matrix.getDescriptionsToSave().clear();
UpdateResult results = CdmStore.getService(IDescriptionService.class).mergeDescriptions(descriptionsToMerge, matrix.getDescriptiveDataSet().getUuid());
for (CdmBase result: results.getUpdatedObjects()){
if (result instanceof DescriptionBase){
- descriptionResults.put(result.getUuid(), (DescriptionBase)result);
+ descriptionResults.put(result.getUuid(), (DescriptionBase<?>)result);
}
}
- List<Object> updateRows = matrix.getDescriptions().stream().filter(row->descriptionResults.keySet().contains(((RowWrapperDTO)row).getDescription().getDescriptionUuid())).collect(Collectors.toList());
+ List<Object> updateRows = matrix.getDescriptions().stream().filter(row->descriptionResults.keySet().contains(((RowWrapperDTO<?>)row).getDescription().getDescriptionUuid())).collect(Collectors.toList());
for (Object updateRow: updateRows){
if (updateRow instanceof SpecimenRowWrapperDTO){
SpecimenRowWrapperDTO dto = (SpecimenRowWrapperDTO)updateRow;
setDirty();
matrix.getNatTable().refresh();
if (element instanceof DescriptionBase){
- if (!matrix.getRowsToMerge().containsKey(((DescriptionBase)element).getUuid())){
- matrix.addDescriptionToSave((DescriptionBase)element);
+ if (!matrix.getRowsToMerge().containsKey(((DescriptionBase<?>)element).getUuid())){
+ matrix.addDescriptionToSave((DescriptionBase<?>)element);
}
}
}
stackLayout.topControl = matrix;
matrix.getParent().layout();
}
-
}
*/
package eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.categorical;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
import org.eclipse.nebula.widgets.nattable.widget.NatCombo;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import eu.etaxonomy.cdm.api.service.dto.DescriptionElementDto;
import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
import eu.etaxonomy.cdm.persistence.dto.FeatureDto;
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.CharacterMatrix;
// FIXME avoid creating empty CategoricalData
// ((RowWrapperDTO) rowWrapper).addCategoricalData(feature);
}
+
+ }
+ List canonicalValueList = new ArrayList<>();
+
+ if (canonicalValue instanceof String[]){
+ String[] stringArray = (String[])canonicalValue;
+ for (int i = 0; i<stringArray.length; i++){
+ canonicalValueList.add(stringArray[i]);
+ }
+ }else if (canonicalValue instanceof List){
+ canonicalValueList = (List<String>)canonicalValue;
+ }else if (canonicalValue instanceof String){
+ canonicalValueList.add((String)canonicalValue);
+ }else if (canonicalValue instanceof HashSet){
+ canonicalValueList = new ArrayList(((HashSet)canonicalValue));
}
- super.setCanonicalValue(canonicalValue);
+ super.setCanonicalValue(canonicalValueList);
}
@Override
// update local dataset
- matrix.loadDescriptions(false, true);
+ matrix.loadDescriptions(true, true);
// matrix.setSelectedObject(sel);
}
*/
package eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.quantitative;
+import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
import org.eclipse.jface.window.Window;
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
QuantitativeDataDto quantitativeData = null;
if(rowObject instanceof RowWrapperDTO){
rowWrapperDTO = (RowWrapperDTO<?>) rowObject;
- DescriptionElementDto dataValueForFeature = rowWrapperDTO.getDataValueForFeature(feature.getUuid());
- if(dataValueForFeature instanceof QuantitativeDataDto){
- quantitativeData = (QuantitativeDataDto) dataValueForFeature;
+ Set<DescriptionElementDto> dataValueForFeature = rowWrapperDTO.getDataValueForFeature(feature.getUuid());
+ if (dataValueForFeature != null && dataValueForFeature.size() > 1){
+ return null;
}
+
+ DescriptionElementDto dto = null;
+ if (dataValueForFeature != null){
+ Iterator<DescriptionElementDto> it = dataValueForFeature.iterator();
+ if(it.hasNext() ){
+ dto = it.next();
+ }
+ }
+ if(dto instanceof QuantitativeDataDto){
+ quantitativeData = (QuantitativeDataDto) dto;
+ }
//create new Quantitative Data
if (quantitativeData == null) {
quantitativeData = ((RowWrapperDTO) rowObject).addQuantitativeData(feature);
EditorUtil_COMFIRM_SAVE=Confirm save
EditorUtil_CONFIRM_SAVE_MESSAGE=Warning - this operation will save the editor. This will also save all other unsaved changes in your working editor to the database. Please 'Cancel' if you are not ready to do this.
EditorUtil_ORPHAN_ACCEPTED_TAXON=Orphaned accepted taxon
-EditorUtil_ORPHAN_ACCEPTED_TAXON_MESSAGE=The accepted taxon of this synonym is not part of any classification. Editing with the name editor is currently not implemented. Try to edit the taxon with the bulk editor.
+EditorUtil_ORPHAN_ACCEPTED_TAXON_MESSAGE=The accepted taxon of this synonym is not part of any classification. Editing with the taxon editor is currently not implemented. Try to edit the taxon with the bulk editor.
EditorUtil_ORPHAN_TAXON=Orphaned Taxon
-EditorUtil_ORPHAN_TAXON_MESSAGE=This is an orphaned taxon i.e. a taxon that is not connected to a classification and not having any taxonomic relationships. Editing of orphaned taxa in the name editor is currently not supported. Try editing with the bulk editor
+EditorUtil_ORPHAN_TAXON_MESSAGE=This is an orphaned taxon i.e. a taxon that is not connected to a classification and not having any taxonomic relationships. Editing of orphaned taxa in the taxon editor is currently not supported. Try editing with the bulk editor
EditorUtil_MISSING_PERMISSION=Missing permission
EditorUtil_MISSING_PERMISSION_MESSAGE=You do not have the permission to edit this taxon
MultiPageTaxonEditor_INVALID_INPUT=Invalid Input: Must be TaxonEditorInput
SpecimenSelectionDialog_REMOVE_FILTER=Remove filter
TaxonEditorInput_INCORRECT_STATE=Incorrect state
TaxonEditorInput_NEW_TAXON=New taxon
-TaxonEditorInput_NO_ACCEPTED_TAXON_PRESENT=Trying to open accepted taxon for a synonym or misapplication but misapplication but the accepted taxon is not present in any classification and can\u2019t be opened in name editor.
+TaxonEditorInput_NO_ACCEPTED_TAXON_PRESENT=Trying to open accepted taxon for a synonym or misapplication but misapplication but the accepted taxon is not present in any classification and can\u2019t be opened in taxon editor.
TaxonEditorInput_NOT_IMPLEMENTED=Not yet implemented
TaxonEditorInput_NOT_IMPLEMENTED_MESSAGE=Selected Taxonnode does not exist, probably it is deleted or moved.
TaxonEditorInput_OPEN_MISSAPPLIED_NAME=trying to open Mispplied Name
-TaxonEditorInput_TAXON_NOT_IN_CLASSIFICATION=The accepted taxon is not part of any classification. Editing with the name editor is currently not implemented. Try to edit the taxon with the bulk editor.
+TaxonEditorInput_TAXON_NOT_IN_CLASSIFICATION=The accepted taxon is not part of any classification. Editing with the taxon editor is currently not implemented. Try to edit the taxon with the bulk editor.
TaxonEditorInputFactory_COULD_NOT_CREATE=Could not create element
TaxonEditorInputFactory_NOT_FOUND_TAXON=Couldn't find taxon node with UUID
UseObjectManager_RESET_DATA=Reset usage data
SetSecundumHandler_configureSettings=Konfigurieren Sie das Ersetzen der Secundum Referenz für den ausgewählten Teilbaum.
SetSecundumHandler_confirm=Ersetzen der Secundum Referenz bestätigen
DefaultOpenSpecimenEditorForTypeSpecimenHandler_COULD_NOT_OPEN=Specimen-Baum-Editor konnte nicht geöffnet werden
-DefaultOpenTaxonEditorForTaxonBaseHandler_COULD_NOT_OPEN=Taxon-Editor für Taxon/Synonym konnte nicht geöffnet werden
-DefaultOpenTaxonEditorForTaxonNodeHandler_COULD_NOT_OPEN=Taxon-Editor für Taxonknoten konnte nicht geöffnet werden
+DefaultOpenTaxonEditorForTaxonBaseHandler_COULD_NOT_OPEN=Taxon Editor für Taxon/Synonym konnte nicht geöffnet werden
+DefaultOpenTaxonEditorForTaxonNodeHandler_COULD_NOT_OPEN=Taxon Editor für Taxonknoten konnte nicht geöffnet werden
OpenChecklistEditorHandler_CHOOSE_AREA=Bitte wählen Sie das Gebiet aus, das dargestellt werden soll
OpenChecklistEditorHandler_GOTO_PREFERENCES=Hierfür gehen Sie zu den Preferences, wählen Sie Checklist Editor und dann die Gebiete in dem Verbreitungs-Wizard.
OpenChecklistEditorHandler_NO_AREAS=Keine Gebiete, die angezeigt werden können
EditorUtil_COMFIRM_SAVE=Speichern bestätigen
EditorUtil_CONFIRM_SAVE_MESSAGE=Warnung - Diese Operation wird den Editor speichern. Ebenso werden alle weiteren ungespeicherten Änderungen gespeichert. Um das zu verhindern, drücken Sie 'Abbrechen'.
EditorUtil_ORPHAN_ACCEPTED_TAXON=Verwaistes akzeptiertes Taxon
-EditorUtil_ORPHAN_ACCEPTED_TAXON_MESSAGE=Das akzeptierte Taxon dieses Synonyms ist in keiner Klassifikation vorhanden. Editieren mit dem Namens-Editor ist noch nicht implementiert. Benutzen Sie den Bulk-Editor.
+EditorUtil_ORPHAN_ACCEPTED_TAXON_MESSAGE=Das akzeptierte Taxon dieses Synonyms ist in keiner Klassifikation vorhanden. Editieren mit dem Taxon Editor ist noch nicht implementiert. Benutzen Sie den Bulk-Editor.
EditorUtil_ORPHAN_TAXON=Verwaistes Taxon
-EditorUtil_ORPHAN_TAXON_MESSAGE=Dies ist ein verwaistes Taxon d.h. ein Taxon, welches in keiner Klassifikation vorhanden ist und keine Taxonverknüpfungen hat. Editieren von verwaisten Taxa im Namens-Editor ist noch nicht implementiert. Benutzen Sie den Bulk-Editor.
+EditorUtil_ORPHAN_TAXON_MESSAGE=Dies ist ein verwaistes Taxon d.h. ein Taxon, welches in keiner Klassifikation vorhanden ist und keine Taxonverknüpfungen hat. Editieren von verwaisten Taxa im Taxon Editor ist noch nicht implementiert. Benutzen Sie den Bulk-Editor.
EditorUtil_MISSING_PERMISSION=Fehlende Berechtigung
EditorUtil_MISSING_PERMISSION_MESSAGE=Sie haben nicht die Berechtigung dieses Taxon zu bearbeiten
MultiPageTaxonEditor_INVALID_INPUT=Ungültiger Input: Muss TaxonEditorInput sein
SpecimenSelectionDialog_REMOVE_FILTER=Filter entfernen
TaxonEditorInput_INCORRECT_STATE=Ungültiger Zustand
TaxonEditorInput_NEW_TAXON=Neues Taxon
-TaxonEditorInput_NO_ACCEPTED_TAXON_PRESENT=Öffnen eines akzeptierten Taxons für ein Synonym oder eine Misapplikation, das akzeptierte Taxon ist aber in keiner Klassifikation enthalten, daher kann es nicht im Namens-Editor geöffnet werden. Benutzen Sie den Bulk-Editor.
+TaxonEditorInput_NO_ACCEPTED_TAXON_PRESENT=Öffnen eines akzeptierten Taxons für ein Synonym oder eine Misapplikation, das akzeptierte Taxon ist aber in keiner Klassifikation enthalten, daher kann es nicht im Taxon Editor geöffnet werden. Benutzen Sie den Bulk-Editor.
TaxonEditorInput_NOT_IMPLEMENTED=Noch nicht implementiert
TaxonEditorInput_NOT_IMPLEMENTED_MESSAGE=Ausgewählter Taxonknoten existiert nicht, eventuell wurde er gelöscht oder verschoben.
TaxonEditorInput_OPEN_MISSAPPLIED_NAME=Öffnen einer Misapplikation
-TaxonEditorInput_TAXON_NOT_IN_CLASSIFICATION=Das akzeptierte Taxon ist in keiner Klassifikation vorhanden. Editieren mit dem Namens-Editor ist noch nicht implementiert. Benutzen Sie den Bulk-Editor.
+TaxonEditorInput_TAXON_NOT_IN_CLASSIFICATION=Das akzeptierte Taxon ist in keiner Klassifikation vorhanden. Editieren mit dem Taxon Editor ist noch nicht implementiert. Benutzen Sie den Bulk-Editor.
TaxonEditorInputFactory_COULD_NOT_CREATE=Element konnte nicht erstellt werden
TaxonEditorInputFactory_NOT_FOUND_TAXON=Konnte Taxonknoten nicht finden. UUID
UseObjectManager_RESET_DATA=Wiederherstellen der Nutzugsdaten
}
}
- if (synonym.isPublish() != newParentNode.getTaxon().isPublish()){
+ if (newParentNode.getTaxon() != null &&
+ synonym.isPublish() != newParentNode.getTaxon().isPublish()){
MessagingUtils.warningDialog("Publish flag",this, Messages.ChangeSynonymToAcceptedHandler_Different_Publish_Flag);
}
// Get synonym name
TaxonName synonymName = synonym.getName();
monitor.worked(20);
+ Taxon acc = synonym.getAcceptedTaxon();
+ if(acc != null){
+ acc.removeSynonym(synonym);
+ }
// TODO pass in homotypical group's taxon in case we are dragging from one editor to another
// Switch groups
- oldHomotypicalGroup.removeTypifiedName(synonymName, false);
+// oldHomotypicalGroup.removeTypifiedName(synonymName, false);
monitor.worked(40);
newHomotypicalGroup = HibernateProxyHelper.deproxy(newHomotypicalGroup, HomotypicalGroup.class);
newHomotypicalGroup.addTypifiedName(synonymName);
- Taxon acc = synonym.getAcceptedTaxon();
-
- if(acc != null){
- acc.removeSynonym(synonym);
- }
+
SynonymType type = SynonymType.HETEROTYPIC_SYNONYM_OF();
if(newHomotypicalGroup.getTypifiedNames().contains(element.getName())){
description.removeElement(descriptionElement);
target.addElement(descriptionElement);
- if (description.getElements().isEmpty() ){
- if (description instanceof TaxonDescription){
- ((TaxonDescription)description).getTaxon().removeDescription((TaxonDescription)description, false);
- }else if (description instanceof TaxonNameDescription){
- ((TaxonNameDescription)description).getTaxonName().removeDescription((TaxonNameDescription)description);
- } else if (description instanceof SpecimenDescription){
- ((SpecimenDescription)description).getDescribedSpecimenOrObservation().removeDescription(description);
- }
- }
descriptionElements.add(descriptionElement);
}
}
TransferData transferData) {
boolean transferDataIsSupported = true;
if (target instanceof DescriptionBase){
- if(((DescriptionBase)target).isComputed() && PreferencesUtil.isComputedDesciptionHandlingDisabled()){
+ if((((DescriptionBase)target).isComputed() || ((DescriptionBase)target).isCloneForSource())&& PreferencesUtil.isComputedDesciptionHandlingDisabled()){
transferDataIsSupported = false;
}
}
description = HibernateProxyHelper.deproxy(object, DescriptionBase.class);
}
- if (description.isComputed() && PreferencesUtil.isComputedDesciptionHandlingDisabled()){
+ if ((description.isComputed() || description.isCloneForSource())&& PreferencesUtil.isComputedDesciptionHandlingDisabled()){
canExecute = false;
menuItem.getParent().setVisible(false);
}else{
Object selectedElement = selection.getFirstElement();
if (selectedElement instanceof DescriptionBase<?>) {
- if (((DescriptionBase<?>) selectedElement).isComputed() && PreferencesUtil.isComputedDesciptionHandlingDisabled()){
+ if ((((DescriptionBase<?>) selectedElement).isComputed() || ((DescriptionBase<?>) selectedElement).isCloneForSource())&& PreferencesUtil.isComputedDesciptionHandlingDisabled()){
items.remove(menu);
return;
}
canExecute = ((firstElement instanceof FeatureNodeContainer && !(((FeatureNodeContainer)firstElement).getContainerTree().getDescription() instanceof TaxonNameDescription))
|| (firstElement instanceof DescriptionElementBase && !(((DescriptionElementBase)firstElement).getInDescription() instanceof TaxonNameDescription)))
- && ((firstElement instanceof FeatureNodeContainer && !(((FeatureNodeContainer)firstElement).getDescription().isComputed() && isComputedDisabled))
- || (firstElement instanceof DescriptionElementBase && !(((DescriptionElementBase)firstElement).getInDescription().isComputed() && isComputedDisabled))) ;
+ && ((firstElement instanceof FeatureNodeContainer && !((((FeatureNodeContainer)firstElement).getDescription().isComputed() || ((FeatureNodeContainer)firstElement).getDescription().isCloneForSource())&& isComputedDisabled))
+ || (firstElement instanceof DescriptionElementBase && !((((DescriptionElementBase)firstElement).getInDescription().isComputed() || ((DescriptionElementBase)firstElement).getInDescription().isCloneForSource())&& isComputedDisabled))) ;
menuItem.setVisible(canExecute);
}
}
<feature\r
id="eu.etaxonomy.taxeditor.feature.platform"\r
label="Taxeditor Dependencies"\r
- version="5.27.0"\r
+ version="5.28.0"\r
os="linux,macosx,win32"\r
ws="cocoa,gtk,win32"\r
arch="x86,x86_64">\r
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.27.0</version>
+ <version>5.28.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eu.etaxonomy.taxeditor.feature.platform</artifactId>
<feature\r
id="eu.etaxonomy.taxeditor.feature"\r
label="Taxonomic Editor"\r
- version="5.27.0"\r
+ version="5.28.0"\r
provider-name="EDIT"\r
plugin="eu.etaxonomy.taxeditor.application"\r
os="linux,macosx,win32"\r
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.27.0</version>
+ <version>5.28.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eu.etaxonomy.taxeditor.feature</artifactId>
Bundle-ManifestVersion: 2
Bundle-Name: Help
Bundle-SymbolicName: eu.etaxonomy.taxeditor.help; singleton:=true
-Bundle-Version: 5.27.0
+Bundle-Version: 5.28.0
Bundle-Activator: eu.etaxonomy.taxeditor.help.Activator
Bundle-Vendor: EDIT
Require-Bundle: org.eclipse.ui,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.27.0</version>
+ <version>5.28.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Bundle-ManifestVersion: 2
Bundle-Name: Local
Bundle-SymbolicName: eu.etaxonomy.taxeditor.local;singleton:=true
-Bundle-Version: 5.27.0
+Bundle-Version: 5.28.0
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.jface,
org.eclipse.ui.ide,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.27.0</version>
+ <version>5.28.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eu.etaxonomy.taxeditor.local</artifactId>
Bundle-ManifestVersion: 2
Bundle-Name: eu.etaxonomy.taxeditor.molecular.lib
Bundle-SymbolicName: eu.etaxonomy.taxeditor.molecular.lib;singleton:=true
-Bundle-Version: 5.27.0
+Bundle-Version: 5.28.0
Bundle-ClassPath: .,
lib/owlapi-xmlutils-4.1.4.jar,
lib/commons-collections4-4.1.jar,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.27.0</version>
+ <version>5.28.0</version>
</parent>
<name>Molecular Library Dependencies Bundle</name>
Bundle-ManifestVersion: 2
Bundle-Name: Molecular Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.molecular;singleton:=true
-Bundle-Version: 5.27.0
+Bundle-Version: 5.28.0
Bundle-Activator: eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.27.0</version>
+ <version>5.28.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: 5.27.0
+Bundle-Version: 5.28.0
Bundle-Activator: eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin
Bundle-Vendor: EDIT
Export-Package: eu.etaxonomy.taxeditor.navigation,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.27.0</version>
+ <version>5.28.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
TaxonNavigatorDataChangeBehavior_REFRESH_VIEWER=Refreshing viewer
TaxonNavigatorDataChangeBehavior_UPDATE_NAVIGATOR=Updating Taxon Navigator
TaxonNavigatorLabels_CHANGE_ACC_TAXON=Change Accepted Taxon to Synonym
-TaxonNavigatorLabels_CLOSE_IMPOSSIBLE=Could not close related taxon name editor. Please close it manually and try again.
+TaxonNavigatorLabels_CLOSE_IMPOSSIBLE=Could not close related taxon editor. Please close it manually and try again.
TaxonNavigatorLabels_DELETE_TAXON=Delete Taxon Node
TaxonNavigatorLabels_MOVE_FACTUAL_DATA=Move Factual Data
TaxonNavigatorLabels_MOVE_TAXON=Move Taxon
TaxonNavigatorDataChangeBehavior_REFRESH_VIEWER=Taxonnavigator aktualisieren
TaxonNavigatorDataChangeBehavior_UPDATE_NAVIGATOR=Taxonnavigator updaten
TaxonNavigatorLabels_CHANGE_ACC_TAXON=Akzeptiertes Taxon in Synonym umwandeln
-TaxonNavigatorLabels_CLOSE_IMPOSSIBLE=Konnte den Namenseditor nicht schließen. Bitte schließen Sie ihn manuell und versuchen es erneut.
+TaxonNavigatorLabels_CLOSE_IMPOSSIBLE=Konnte den Taxon Editor nicht schließen. Bitte schließen Sie ihn manuell und versuchen es erneut.
TaxonNavigatorLabels_DELETE_TAXON=Taxonknoten löschen
TaxonNavigatorLabels_MOVE_FACTUAL_DATA=Faktendaten verschieben
TaxonNavigatorLabels_MOVE_TAXON=Taxon verschieben
Bundle-ManifestVersion: 2
Bundle-Name: Printpublisher Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.printpublisher;singleton:=true
-Bundle-Version: 5.27.0
+Bundle-Version: 5.28.0
Export-Package: eu.etaxonomy.cdm.print,
eu.etaxonomy.cdm.print.out,
eu.etaxonomy.cdm.print.out.odf,
eu.etaxonomy.taxeditor.editor,
eu.etaxonomy.taxeditor.store
Bundle-ClassPath: .,
- lib/cdmlib-print-5.27.0.jar,
- lib/cdmlib-remote-5.27.0.jar
+ lib/cdmlib-print-5.28.0.jar,
+ lib/cdmlib-remote-5.28.0.jar
Import-Package: org.apache.log4j,
org.eclipse.core.runtime,
org.eclipse.core.runtime.jobs,
bin.includes = META-INF/,\
.,\
plugin.xml,\
- lib/cdmlib-print-5.27.0.jar,\
- lib/cdmlib-remote-5.27.0.jar,\
+ lib/cdmlib-print-5.28.0.jar,\
+ lib/cdmlib-remote-5.28.0.jar,\
OSGI-INF/l10n/bundle.properties,\
OSGI-INF/l10n/bundle_de.properties,\
<parent>
<artifactId>taxeditor-parent</artifactId>
<groupId>eu.etaxonomy</groupId>
- <version>5.27.0</version>
+ <version>5.28.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: 5.27.0
+Bundle-Version: 5.28.0
Bundle-Activator: eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin
Bundle-Vendor: EDIT
Bundle-Localization: OSGI-INF/l10n/bundle
themeElementCategory.description.0 = Colors and fonts for the details view\r
colorDefinition.label.5 = Entity Element List Background Odd\r
colorDefinition.label.6 = Entity Element List Background Even\r
-themeElementCategory.label.1 = Name Editor\r
-themeElementCategory.description.1 = Colors and fonts for the name editor\r
+themeElementCategory.label.1 = Taxon Editor\r
+themeElementCategory.description.1 = Colors and fonts for the taxon editor\r
colorDefinition.label.7 = Container Background\r
colorDefinition.label.8 = Container Selected Focus\r
colorDefinition.label.9 = Container Selected\r
fontDefinition.description.0 = The font that is used for synonyms in the search result list.\r
fontDefinition.label.6 = Other font\r
fontDefinition.description.1 = The font used by default in the search result list.\r
-colorDefinition.label.13 = Parse Error\r
-colorDefinition.label.14 = Disabled Name Editor Field\r
-colorDefinition.label.15 = Editor On Error\r
page.name.26 = Specimens\r
page.name.27 = Media\r
page.name.28 = Distribution Editor\r
themeElementCategory.description.0 = Farben und Schriften f\u00fcr die Detailansicht
colorDefinition.label.5 = Entity Element List Background Odd
colorDefinition.label.6 = Entity Element List Background Even
-themeElementCategory.label.1 = Namenseditor
-themeElementCategory.description.1 = Farben und Schriften f\u00fcr den Namenseditor
+themeElementCategory.label.1 = Taxon Editor
+themeElementCategory.description.1 = Farben und Schriften f\u00fcr den Taxon Editor
colorDefinition.label.7 = Container Hintergrund
colorDefinition.label.8 = Container ausgew\u00e4hlter Fokus
colorDefinition.label.9 = Container ausgew\u00e4hlt
fontDefinition.description.0 = Die Schrift f\u00fcr Synonyme in den Suchergebnissen.
fontDefinition.label.6 = Andere Schrift
fontDefinition.description.1 = Die Schrift, die normalerweise in den Suchergebnissen benutzt wird.
-colorDefinition.label.13 = Fehler beim Parsing
-colorDefinition.label.14 = Gesperrtes Namenseditierfeld
-colorDefinition.label.15 = Editor fehlerhaft
page.name.26 = Specimens
page.name.27 = Media
page.name.28 = Verbreitungs-Editor
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.27.0</version>
+ <version>5.28.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
TransferData transferType) {
boolean valid = LocalSelectionTransfer.getTransfer().isSupportedType(transferType)
&& target instanceof AbstractTermDto;
- if(target instanceof TermVocabularyDto && getCurrentLocation()!=ViewerDropAdapter.LOCATION_ON){
+ if(target instanceof TermVocabularyDto && getCurrentLocation()!=ViewerDropAdapter.LOCATION_ON ){
valid = false;
}
+ if (target instanceof TermDto && ((TermDto)target).getOrderIndex() == null && getCurrentLocation() == ViewerDropAdapter.LOCATION_AFTER){
+ valid = false;
+ }
return valid;
}
public static String StructuredDescriptionAggregationWizardPage_SELECT_ALL_SUBTREES;
// public static String StructuredDescriptionAggregationWizardPage_TOOLTIP_SELECT_ALL_SUBTREES;
public static String StructuredDescriptionAggregationWizardPage_SELECT_SELECTED_TAXA_ONLY;
+ public static String StructuredDescriptionAggregationWizardPage_SOURCEMODE_CHILD_PARENT;
+ public static String StructuredDescriptionAggregationWizardPage_SOURCEMODE_WITHIN_TAXON;
public static String CommonNameLanguages_Title;
StructuredDescriptionAggregationWizardPage_SELECT_DEFAULT_DESCRIPTION=Default descriptions
StructuredDescriptionAggregationWizardPage_SELECT_LITERATURE_DESCRIPTION=Literature descriptions
StructuredDescriptionAggregationWizardPage_SELECT_UNPUBLISHED_TAXA=Unpublished taxa
+StructuredDescriptionAggregationWizardPage_SOURCEMODE_WITHIN_TAXON=Specimen and literature to taxon
+StructuredDescriptionAggregationWizardPage_SOURCEMODE_CHILD_PARENT=From child to parent taxon
CommonNameLanguages_Title=Common Name Languages
CommonNameVocabularyPreferencePage_description=Select the vocabularies for common name area selection.
CommonNameLanguagePreferencePage_description=Choose the languages available for common names.
StructuredDescriptionAggregationWizardPage_SELECT_DEFINE_SCOPE=Bei Aggregation einschließen:
StructuredDescriptionAggregationWizardPage_SELECT_DEFAULT_DESCRIPTION=Default Beschreibungen
StructuredDescriptionAggregationWizardPage_SELECT_LITERATURE_DESCRIPTION=Literatur Beschreibungen
+StructuredDescriptionAggregationWizardPage_SOURCEMODE_WITHIN_TAXON=Specimen and Literatur zum Taxon
+StructuredDescriptionAggregationWizardPage_SOURCEMODE_CHILD_PARENT=Vom Kind- zum Eltern-Taxon
CommonNameLanguages_Title=Sprachen für Trivialnamen
CommonNameVocabularyPreferencePage_description=Wählen Sie die Vokabulare, für die Area-Auswahl bei Trivialnamen.
CommonNameLanguagePreferencePage_description=Wählen Sie die für Trivialnamen verfügbaren Sprachen.
}
if (listValue == null || listValue.isEmpty() ){
- termlist = termService.findByTitleAsDto("", type);
+ termlist = termService.findByTitleAsDtoWithVocDto("", type);
}
}
if (listValue == null || listValue.isEmpty() ){
- termlist = termService.findByTitleAsDto("", type);
+ termlist = termService.findByTitleAsDtoWithVocDto("", type);
}
return new ArrayList(termlist);
}
public TermManager(){
}
-
+
public void reset(){
cachedTermMap = new HashMap<>();
}
public <T extends DefinedTermBase> List<T> getPreferredTerms(TermType termType){
- List<?> terms = cachedTermMap.get(termType);
+ List<?> terms = cachedTermMap.get(termType.getUuid());
List<T> termBaseList = new ArrayList<>();
if(terms==null || terms.isEmpty()){
termBaseList = getFilteredTerms(TermStore.<T>getTerms(termType, null));
}else {
termBaseList.add((T)term);
}
-
}
+
if (!uuids.isEmpty()){
termBaseList.addAll(this.getTerms(uuids, DefinedTermBase.class));
}
if(terms==null){
terms = getFilteredTerms(TermStore.getTerms(clazz));
cachedTermMap.put(clazz, terms);
-
}
return terms;
}
relTypes.add(TaxonRelationshipType.PRO_PARTE_SYNONYM_FOR());
relTypes.add(TaxonRelationshipType.PARTIAL_SYNONYM_FOR());
}
- populateTerms(relTypes);
+ addTerms(relTypes);
+ populateTerms();
setSelection(selection);
}
/** {@inheritDoc} */
@Override
public void widgetSelected(SelectionEvent e) {
- wrapperSelection = (T) wrapperList.get(combo.getSelectionIndex());
+ if (combo.getSelectionIndex() > -1){
+ wrapperSelection = (T) wrapperList.get(combo.getSelectionIndex());
+ }
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
}
public void setTermComparator(Comparator<T> termComparator) {
this.termComparator = termComparator;
- List<T> termsWithoutNull = terms.subList(1, terms.size());
+// List<T> termsWithoutNull = terms.subList(1, terms.size());
- populateTerms(termsWithoutNull);
+ populateTerms();
}
if(termType!=null){
//TODO try to remove generic T and avoid classes to be used
- populateTerms((List<T>) getTermManager().getPreferredTerms(termType));
+ addTerms((List<T>) getTermManager().getPreferredTerms(termType));
+
}
else if(termVocabulary!=null){
- populateTerms((List<T>) getTermManager().getPreferredTerms(termVocabulary));
+ addTerms((List<T>) getTermManager().getPreferredTerms(termVocabulary));
}
else if(this.termClass!=null){
- populateTerms(getPreferredTerms());
+ addTerms(getPreferredTerms());
}else if (terms != null){
- populateTerms(terms);
+ addTerms(terms);
}
combo.addDisposeListener(this);
if (comparator == null){
setTermComparator(new DefaultTermComparator<T>());
+ }else{
+ populateTerms();
}
+
PreferencesUtil.getPreferenceStore().addPropertyChangeListener(this);
if (selection != null) {
}
}
+ protected void addTerms(List<T> preferredTerms) {
+ terms = new ArrayList<T>();
+ if(addEmptyElement){
+ // Add an empty element for when nothing was selected yet
+ combo.add(EMPTY_ELEMENT_LABEL);
+ terms.add(emptyElement);
+ }
+ for (T term: preferredTerms){
+ terms.add(term);
+ }
+
+
+ }
+
private TermComboElement(CdmFormFactory formFactory,
ICdmFormElement parentElement, Class<T> termClass, TermType termType, TermVocabulary<?> termVocabulary, List<T> terms,String labelString, TermDto selection, boolean addEmptyElement,
int style, boolean useAbbrevLabel, Comparator<T> comparator) {
if(termType!=null){
//TODO try to remove generic T and avoid classes to be used
- populateTerms((List<T>) getTermManager().getPreferredTerms(termType));
+ addTerms((List<T>) getTermManager().getPreferredTerms(termType));
}
else if(termVocabulary!=null){
- populateTerms((List<T>) getTermManager().getPreferredTerms(termVocabulary));
+ addTerms((List<T>) getTermManager().getPreferredTerms(termVocabulary));
}
else if(this.termClass!=null){
- populateTerms(getPreferredTerms());
+ addTerms(getPreferredTerms());
}else if (terms != null){
- populateTerms(terms);
+ addTerms(terms);
}
combo.addDisposeListener(this);
if (comparator == null){
setTermComparator(new DefaultTermComparator<T>());
+ }else{
+ populateTerms();
}
PreferencesUtil.getPreferenceStore().addPropertyChangeListener(this);
if (this.terms != null && selection != null){
*
* @param preferredTerms
*/
- protected void populateTerms(List<T> preferredTerms) {
+ protected void populateTerms() {
combo.removeAll();
- terms = new ArrayList<T>();
+// terms = new ArrayList<T>();
int i = 1;
int index = 0;
if(addEmptyElement){
// Add an empty element for when nothing was selected yet
combo.add(EMPTY_ELEMENT_LABEL);
- terms.add(emptyElement);
+// terms.add(emptyElement);
}
-
+ List<T> withoutNull = new ArrayList<>(terms);
if (termComparator != null) {
- Collections.sort(preferredTerms, termComparator);
+ if (addEmptyElement){
+ withoutNull = terms.subList(1, terms.size());
+ }
+ Collections.sort(withoutNull, termComparator);
}
- for (T term : preferredTerms) {
+ for (T term : withoutNull) {
String label = getLabel(term);
if (label == null) {
if (term.getTitleCache() != null) {
combo.add(label);
combo.setData(label, term);
- terms.add(term);
+// terms.add(term);
i++;
if (selection != null) {
}
if (selection != null && index == 0) {
- createTermNotInPreferredTerms(selection, preferredTerms);
+ createTermNotInPreferredTerms(selection, terms);
}
combo.select(index);
private void createTermNotInPreferredTerms(T term, List<T> preferredTerms) {
//List<T> preferredTerms = getPreferredTerms();
- preferredTerms.add(term);
+ terms.add(term);
- populateTerms(preferredTerms);
+ populateTerms();
}
/** {@inheritDoc} */
if (event != null
&& PreferencesUtil.PREFERRED_TERMS_CHANGE.equals(event
.getProperty())) {
- populateTerms(getPreferredTerms());
+ addTerms(getPreferredTerms());
+ populateTerms();
}
this.setSelection(selection);
}
public void setTerms(List<T> terms) {
// setSelection(null);
customPreferredTerms = terms;
- populateTerms(customPreferredTerms);
+ addTerms(customPreferredTerms);
+ populateTerms();
}
public void removeEmptyElement(){
}
protected void updateHigherRankCombo() {
+ int index = comboHigherRank.getSelectionIndex();
+ String item = null;
+ if (index > 0){
+ item = comboHigherRank.getItem(index);
+ }
comboHigherRank.removeAll();
List<Rank> rankList = new ArrayList<>();
TaxonName name = null;
comboHigherRank.add(rank.getLabel());
comboHigherRank.setData(rank.getLabel(), rank);
}
+ int i = 1;
+ if (item != null){
+ for (String itemString: comboHigherRank.getItems()){
+ if (itemString.equals(item)){
+ comboHigherRank.select(i);
+ break;
+ }
+ i++;
+ }
+ }
}
protected void updateLowerRankCombo() {
+ int index = comboLowerRank.getSelectionIndex();
+ String item = null;
+ if (index > 0){
+ item = comboLowerRank.getItem(index);
+ }
comboLowerRank.removeAll();
TaxonName name = null;
List<Rank> rankList = new ArrayList<>();
comboLowerRank.add(rank.getLabel());
comboLowerRank.setData(rank.getLabel(), rank);
}
+ int i = 0;
+ if (item != null){
+ for (String itemString: comboLowerRank.getItems()){
+ if (itemString.equals(item)){
+ comboLowerRank.select(i);
+ break;
+ }
+ i++;
+ }
+ }
}
public Rank getHigherRank(){
}
configurator.setTaxonNodeFilter(filter);
}else{
- //FIXME this does not work as dataset.subtreefilter is not loaded here
if (dataSet.getSubTreeFilter() != null){
for (TaxonNodeDto taxonNode : dataSet.getSubTreeFilter()) {
filter = filter.orSubtree(taxonNode.getUuid());
package eu.etaxonomy.taxeditor.ui.dialog.configurator;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import eu.etaxonomy.cdm.api.service.description.StructuredDescriptionAggregation;
import eu.etaxonomy.cdm.api.service.description.StructuredDescriptionAggregationConfiguration;
import eu.etaxonomy.cdm.model.name.Rank;
-import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.persistence.dto.DescriptiveDataSetBaseDto;
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
import eu.etaxonomy.taxeditor.l10n.Messages;
-import eu.etaxonomy.taxeditor.ui.combo.OriginalSourceTypeComparator;
/**
* @author k.luther
protected Button checkIncludeDefaultDescriptions;
protected Button checkIncludeLiteratureDescriptions;
protected DescriptiveDataSetBaseDto ddsDTO;
-
+
private Label selectSubtreeLabel;
this.setDescription(Messages.DistributionAggregationWizardPage_DESCRIPTION);
selectedNodes = nodes;
ddsDTO = CdmApplicationState.getCurrentAppConfig().getDescriptiveDataSetService().getDescriptiveDataSetDtoByUuid(configurator.getDatasetUuid());
-
+
}
@Override
}
}
});
-
+
// ... from selected subtree
checkUseSelectedSubtree= new Button(radioComposite, SWT.RADIO);
checkIncludeDefaultDescriptions.setText(Messages.StructuredDescriptionAggregationWizardPage_SELECT_DEFAULT_DESCRIPTION);
checkIncludeDefaultDescriptions.setEnabled(false);
-
checkIncludeLiteratureDescriptions = new Button(scopeComposite, SWT.CHECK);
checkIncludeLiteratureDescriptions.setText(Messages.StructuredDescriptionAggregationWizardPage_SELECT_LITERATURE_DESCRIPTION);
checkIncludeLiteratureDescriptions.setSelection(configurator.isIncludeLiterature());
GridLayoutFactory.fillDefaults();
+
//ranks
Label higherRankLabel = new Label(control, SWT.NULL);
higherRankLabel.setText(Messages.DistributionAggregationWizardPage_HIGHEST_RANK);
-
comboHigherRank = new Combo(control, SWT.BORDER | SWT.READ_ONLY);
updateHigherRankCombo();
- setConfigValueToRankCombo(comboHigherRank, ddsDTO.getMaxRank() != null?ddsDTO.getMaxRank().getUuid(): null);
+ setConfigValueToRankCombo(comboHigherRank, ddsDTO.getMaxRank() != null? ddsDTO.getMaxRank().getUuid(): null);
comboHigherRank.addListener(SWT.Selection, this);
Label lowerRankLabel = new Label(control, SWT.NULL);
@Override
public String getText(Object element){
if (element instanceof AggregationMode){
+ if (((AggregationMode)element).getKey().equals("INTAX")){
+ return Messages.StructuredDescriptionAggregationWizardPage_SOURCEMODE_WITHIN_TAXON;
+ }else if (((AggregationMode)element).getKey().equals("TOPAR")){
+ return Messages.StructuredDescriptionAggregationWizardPage_SOURCEMODE_CHILD_PARENT;
+ }
return ((AggregationMode)element).getLabel();
}
return null;
//source mode within taxon
Label sourceModeLabelWithin = new Label(control, SWT.NULL);
- sourceModeLabelWithin.setText(Messages.DistributionAggregationWizardPage_SOURCEMODE_WITHIN_TAXON);
+ sourceModeLabelWithin.setText(Messages.StructuredDescriptionAggregationWizardPage_SOURCEMODE_WITHIN_TAXON);
sourceModeLabelWithin.setToolTipText(Messages.DistributionAggregationWizardPage_TOOLTIP_SOURCEMODE_WITHIN_TAXON);
comboSourceModeWithinTaxon = new Combo(control, SWT.BORDER| SWT.READ_ONLY);
comboSourceModeWithinTaxon.setText(Messages.DistributionAggregationWizardPage_AGGREGATION_MODE);
//source mode child parent
Label sourceModeChildParentLabel = new Label(control, SWT.NULL);
- sourceModeChildParentLabel.setText(Messages.DistributionAggregationWizardPage_SOURCEMODE_CHILD_PARENT);
+ sourceModeChildParentLabel.setText(Messages.StructuredDescriptionAggregationWizardPage_SOURCEMODE_CHILD_PARENT);
sourceModeChildParentLabel.setToolTipText(Messages.DistributionAggregationWizardPage_TOOLTIP_SOURCEMODE_CHILD_PARENT);
comboSourceModeChildParent = new Combo(control, SWT.BORDER| SWT.READ_ONLY);
comboSourceModeChildParent.setText(Messages.DistributionAggregationWizardPage_AGGREGATION_MODE);
GridLayoutFactory.fillDefaults();
/*source type
- //TODO: distinguish within taxon and parent child source types
+ //TODO: distinguish within taxon and parent child source types (#9805)
Label sourceTypeLabel = new Label(control, SWT.NULL);
sourceTypeLabel.setText(Messages.DistributionAggregationWizardPage_SOURCE_TYPE);
sourceTypeLabel.setToolTipText(Messages.DistributionAggregationWizardPage_TOOLTIP_SOURCE_TYPE);
}
return result;
}
-
+
protected void setConfigValueToRankCombo(Combo rankCombo, UUID rankUuid) {
int index = 0;
-
+
if (rankUuid == null){
rankCombo.select(index);
- }else{
+ }else{
Rank rank = null;
for (String item: rankCombo.getItems()){
if (rankCombo.getData(item) instanceof Rank){
import eu.etaxonomy.taxeditor.ui.section.reference.OriginalSourceElement;
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement;
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.reference.SecundumSourceDetailElement;
import eu.etaxonomy.taxeditor.ui.section.reference.SecundumSourceElement;
+import eu.etaxonomy.taxeditor.ui.section.reference.SecundumSourceSection;
import eu.etaxonomy.taxeditor.ui.section.reference.SingleSourceSection;
import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationElement;
import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
addAndAdaptSection(parentElement, section);
return section;
}
+
+ public SecundumSourceSection createSecundumDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+ SecundumSourceSection section = new SecundumSourceSection(this, conversation, parentElement, selectionProvider, style);
+ addAndAdaptSection(parentElement, section);
+ return section;
+ }
public AuthorshipDetailSection createAuthorshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
AuthorshipDetailSection section = new AuthorshipDetailSection(this, conversation, parentElement, selectionProvider, style);
return element;
}
+ public SecundumSourceDetailElement createSecundumSourceDetailElement(ICdmFormElement parentElement){
+ SecundumSourceDetailElement element = new SecundumSourceDetailElement(this, parentElement);
+ addAndAdaptElement(parentElement, element);
+ return element;
+ }
+
public SecundumSourceElement createSecundumSourceElement(ICdmFormElement parentElement, CdmBase cdmEntity, String label){
SecundumSourceElement element = new SecundumSourceElement(this, parentElement, cdmEntity, label);
addAndAdaptElement(parentElement, element);
if (entity instanceof CategoricalData) {
detailedDescriptionElement = new CategoricalDataDetailElement(this, parentElement,
- (CategoricalData) entity, style);
+ (CategoricalData) entity, enabled, style);
} else if (entity instanceof CommonTaxonName) {
- detailedDescriptionElement = new CommonNameDetailElement(this, parentElement, (CommonTaxonName) entity,
- style);
+ detailedDescriptionElement = new CommonNameDetailElement(this, parentElement, (CommonTaxonName) entity, enabled, style);
} else if (entity instanceof Distribution && !enabled) {
detailedDescriptionElement = new DistributionDetailElement(this, parentElement, (Distribution) entity,
enabled, style);
true, style);
}else if (entity instanceof IndividualsAssociation) {
detailedDescriptionElement = new IndividualsAssociationDetailElement(this, parentElement,
- (IndividualsAssociation) entity, style);
+ (IndividualsAssociation) entity, enabled, style);
} else if (entity instanceof QuantitativeData) {
detailedDescriptionElement = new QuantitativeDataDetailElement(this, parentElement,
- (QuantitativeData) entity, style);
+ (QuantitativeData) entity, enabled, style);
} else if (entity instanceof TaxonInteraction) {
detailedDescriptionElement = new TaxonInteractionDetailElement(this, parentElement,
- (TaxonInteraction) entity, style);
+ (TaxonInteraction) entity, enabled, style);
} else if (entity instanceof TemporalData) {
- detailedDescriptionElement = new TemporalDataDetailElement(this, parentElement, (TemporalData) entity, style);
+ detailedDescriptionElement = new TemporalDataDetailElement(this, parentElement, (TemporalData) entity, enabled, style);
} else if (entity instanceof TextData) {
- detailedDescriptionElement = new TextDataDetailElement(this, parentElement, (TextData) entity, style);
+ detailedDescriptionElement = new TextDataDetailElement(this, parentElement, (TextData) entity, enabled, style);
}
else {
throw new IllegalStateException("There is no interface for the given description element");
}
- detailedDescriptionElement.setEnabled(enabled);
+// detailedDescriptionElement.setEnabled(enabled);
adapt(detailedDescriptionElement);
parentElement.addElement(detailedDescriptionElement);
return detailedDescriptionElement;
@Override
public void setEnabled(boolean enabled) {
- checkbox.setEnabled(enabled);
- label.setEnabled(enabled);
+ if (!checkbox.isDisposed()){
+ checkbox.setEnabled(enabled);
+ if (label != null){
+ label.setEnabled(enabled);
+ }
+ }
}
@Override
@Override
public void setEnabled(boolean enabled) {
this.isEnabled = enabled;
+ if (text.isDisposed()){
+ return;
+ }
text.setEditable(enabled);
String symbolicName = enabled ? Resources.COLOR_FONT_DEFAULT : Resources.COLOR_TEXT_DISABLED;
text.setForeground(getColor(symbolicName));
}
public void setEditable(boolean editable) {
+ if (text.isDisposed()){
+ return;
+ }
text.setEditable(editable);
String symbolicName = editable ? Resources.COLOR_FONT_DEFAULT : Resources.COLOR_TEXT_DISABLED;
text.setForeground(getColor(symbolicName));
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.IEnableableFormElement;
import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
import eu.etaxonomy.taxeditor.ui.element.ISelectable;
import eu.etaxonomy.taxeditor.ui.element.LabelElement;
public abstract class AbstractEntityCollectionElement<ENTITY>
extends AbstractCdmFormElement
implements IEntityElement<ENTITY>, SelectionListener,
- IConversationEnabled {
+ IConversationEnabled, IEnableableFormElement {
protected ENTITY entity;
* Composite "around" the actual content. Is used for control action like e.g. remove button
*/
private final Composite box;
+
+ private boolean isEnabled;
+
+
private Button btnRemove;
protected Button btnChooseEntity;
btnRemove.setToolTipText("Remove");
btnRemove.addSelectionListener(removeListener);
+ btnRemove.setEnabled(isEnabled);
}
- createControls(this, style);
+
setEntity(entity);
+ createControls(this, style);
}
/**
warnForReferencedObjects.setVisible(isVisible);
}
}
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ this.isEnabled = enabled;
+ if (btnRemove != null){
+ btnRemove.setEnabled(enabled);
+ }
+ if (btnChooseEntity != null){
+ btnChooseEntity.setEnabled(enabled);
+ }
+
+ for (ICdmFormElement element:this.getElements()){
+ if (element instanceof IEnableableFormElement){
+ ((IEnableableFormElement)element).setEnabled(enabled);
+ }
+ }
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return isEnabled;
+ }
}
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.IEnableableFormElement;
/**
* This class visualizes an CDM entity of type ENTITY and additionally provides
*/
public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT>
extends AbstractFormSection<ENTITY>
- implements IExpansionListener, Observer {
+ implements IExpansionListener, Observer, IEnableableFormElement {
private static final EnumSet<CRUD> UPDATE = EnumSet.of(CRUD.UPDATE);
private String title;
private AbstractEntityCollectionElement<ENTITY> entityCollectionElement;
+
+ private boolean isEnabled = true;
public AbstractEntityCollectionSection(CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, String title, int style) {
super(formFactory, parentElement, ExpandableComposite.CLIENT_INDENT | style);
this.title = title;
this.setText(getTitleString());
updateToolbar();
-
+ layout();
addExpansionListener(this);
CdmStore.getLoginManager().addObserver(this);
/**
* Removes all content from the container
*/
- private void destroyDynamicContent(){
+ protected void destroyDynamicContent(){
if(label_empty != null){
label_empty.dispose();
label_empty = null;
/**
* Create the elements to be shown in this section client area
*/
- private void renderContent(boolean forceExpansion){
+ protected void renderContent(boolean forceExpansion){
Collection<ELEMENT> collection = getCollection(getEntity());
if(collection == null || collection.isEmpty()){
}
protected void createEmptyContent(){
- label_empty = formFactory.createLabel(getLayoutComposite(), getEmptyString());
+ if (label_empty == null){
+ label_empty = formFactory.createLabel(getLayoutComposite(), getEmptyString());
+ }
}
/**
*/
protected void createElementComposite(ELEMENT element, SelectionListener removeListener, Color backgroundColor){
entityCollectionElement = formFactory.createEntityCollectionElement(this, element, removeListener, backgroundColor, SWT.NULL);
+ entityCollectionElement.setEnabled(isEnabled);
}
@Override
}
}
- private boolean expandSectionWhenContentAvailable(){
+ protected boolean expandSectionWhenContentAvailable(){
return PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOULD_EXPAND_SECTION_WHEN_DATA_AVAILABLE, true);
}
}
protected void updateToolbar() {
- if( !(getEntity() instanceof CdmBase) || (getEntity() != null && CdmStore.currentAuthentiationHasPermission(StoreUtil.getCdmEntity(getEntity()), UPDATE)) ){
+ if( !(getEntity() instanceof CdmBase) || (getEntity() != null && CdmStore.currentAuthentiationHasPermission(StoreUtil.getCdmEntity(getEntity()), UPDATE)) && isEnabled){
showToolbar();
} else {
removeToolbar();
* @return String to display when hovering the add button
*/
protected abstract String getTooltipString();
+
+ public boolean isEnabled(){
+ return isEnabled;
+ }
+
+ public void setEnabled(boolean enabled){
+ isEnabled=enabled;
+ if (!isEnabled){
+ removeToolbar();
+ }
+
+ for (ICdmFormElement element: getElements()){
+ if (element instanceof IEnableableFormElement){
+ ((IEnableableFormElement)element).setEnabled(isEnabled);
+ }
+ }
+
+ }
}
this, "Person", null,
EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE,
style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(Person entity) {
this.entity = entity;
- selection_person.setEntity(entity);
+ if (selection_person != null){
+ selection_person.setEntity(entity);
+ }
}
@Override
@Override
public void setEntity(TaxonNodeAgentRelation entity) {
-
- if(entity.getId()!=0){
+ this.entity = entity;
+ if(entity.getId()!=0 && combo_relationshipType != null){
combo_relationshipType.setSelection(entity.getType());
selection_toPerson.setEntity(entity.getAgent());
}
- this.entity = entity;
+
}
@Override
EntitySelectionElement.ALL, style);
}
label = formFactory.createLabel(element, null);
-
+ if (entity != null){
+ setEntity(entity);
+ }
}
public boolean isComplete(){
@Override
public void setEntity(ExternalLink entity) {
- if (entity.getUri() != null){
- externalLinkUriText.setText(entity.getUri().toString());
- }
-
- if (entity.getDescription() != null && isShowDescription) {
- if (description == null){
- description = formFactory.createMultiLanguageTextElement(this, "Description", null, 50, SWT.NULL);
- }
- description.setMultilanguageText(entity.getDescription());
-// description.setText(entity.getDescription().get(
-// CdmStore.getDefaultLanguage()).getText());
- }
+ this.entity = entity;
+ if (externalLinkUriText != null){
+ if (entity.getUri() != null){
+ externalLinkUriText.setText(entity.getUri().toString());
+ }
+
+ if (entity.getDescription() != null && isShowDescription) {
+ if (description == null){
+ description = formFactory.createMultiLanguageTextElement(this, "Description", null, 50, SWT.NULL);
+ }
+ description.setMultilanguageText(entity.getDescription());
+ }
+ }
}
@Override
public void setEntity(DescriptionBase<?> entity) {
super.setEntity(entity);
- if (entity.isComputed() && PreferencesUtil.isComputedDesciptionHandlingDisabled()){
+ if ((entity.isComputed() || entity.isCloneForSource())&& PreferencesUtil.isComputedDesciptionHandlingDisabled()){
setEnabled(false);
this.getDetailElement().setEnabled(false);
}
/** {@inheritDoc} */
@Override
protected void createControls(ICdmFormElement formElement, DescriptionElementBase entity, int style) {
+
+ setEnabled(!((getEntity().getInDescription() != null && (getEntity().getInDescription().isComputed() || getEntity().getInDescription().isCloneForSource())&& PreferencesUtil.isComputedDesciptionHandlingDisabled()) || (getEntity() instanceof Distribution && AbstractUtility.getActivePart() instanceof IDistributionEditorPart)));
formFactory.createDetailedDescriptionDetailElement(formElement, entity, style, isEnabled());
}
import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
import eu.etaxonomy.taxeditor.ui.section.description.operation.ChangeDescriptionElementType;
import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
public void setEntity(DescriptionElementBase entity) {
super.setEntity(entity);
boolean isEnabled = true;
- if (entity.getInDescription().isComputed() && PreferencesUtil.isComputedDesciptionHandlingDisabled() ){
+ if ((entity.getInDescription().isComputed() || entity.getInDescription().isCloneForSource())&& PreferencesUtil.isComputedDesciptionHandlingDisabled() ){
isEnabled = false;
}
setEnabled(isEnabled);
-// this.getDetailElement().setEnabled(isEnabled);
}
this.setVisible(false);
}
super.setEntity(entity);
- if (entity.getInDescription().isComputed() && PreferencesUtil.isComputedDesciptionHandlingDisabled()){
+ if ((entity.getInDescription().isComputed() || entity.getInDescription().isCloneForSource())&& PreferencesUtil.isComputedDesciptionHandlingDisabled()){
this.setEnabled(false);
}
}
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.IEnableableFormElement;
import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.section.common.ExternalLinksSection;
* @version 1.0
*/
public class DescriptionElementSourceElement extends
-// AbstractEntityCollectionElement<Reference> {
-
AbstractOriginalSourceElement<DescriptionElementSource> implements
IEntityElement<DescriptionElementSource>{//, IEnableableFormElement {
private EntitySelectionElement<Reference> selection_descriptionElementSource;
externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ if (getEntity() != null){
+ setEntity(entity);
+ }
+
}
@Override
public void setEntity(DescriptionElementSource entity) {
super.setEntity(entity);
- if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSource.getKey())){
- text_idInSource.setText(entity.getIdInSource());
- }
- if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowNamespaceInSource.getKey())){
- text_idNamespace.setText(entity.getIdNamespace());
+ if (text_idInSource != null){
+ if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSource.getKey())){
+ text_idInSource.setText(entity.getIdInSource());
+ }
+ if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowNamespaceInSource.getKey())){
+ text_idNamespace.setText(entity.getIdNamespace());
+ }
+
+ selection_reference.setEntity(entity.getCitation());
+ text_referenceDetail.setText(entity.getCitationMicroReference());
+ text_originaleNameString.setText(entity.getOriginalNameString());
+ selection_name.setEntity(entity.getNameUsedInSource());
+ combo_origsourcetype.setSelection(entity.getType());
+ externalLinks.setEntity(entity);
}
-
- selection_reference.setEntity(entity.getCitation());
- text_referenceDetail.setText(entity.getCitationMicroReference());
- text_originaleNameString.setText(entity.getOriginalNameString());
- selection_name.setEntity(entity.getNameUsedInSource());
- combo_origsourcetype.setSelection(entity.getType());
+
}
/** {@inheritDoc} */
}
}
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ externalLinks.setEnabled(isEnabled);
+
+ }
+
+
}
*/
package eu.etaxonomy.taxeditor.ui.section.description;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+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.section.AbstractEntityCollectionSection;
}
return source;
}
-
@Override
- public Collection<OriginalSourceBase> getCollection(DescriptionElementBase entity) {
+ protected void internalUpdateSection(boolean changed){
+ setSectionTitle();
+ destroyDynamicContent();
+ if(isExpanded() || expandSectionWhenContentAvailable()) {
+ renderContent(isExpanded());
+ }
+ if(changed) {
+ firePropertyChangeEvent(this);
+ }
+ if (getEntity() != null && getEntity().getInDescription() != null &&(getEntity().getInDescription().isComputed() || getEntity().getInDescription().isCloneForSource())){
+ this.setEnabled(false);;
+ }
+ }
+ @Override
+ protected void renderContent(boolean forceExpansion){
+
+ Collection<OriginalSourceBase> collectionElement = getCollectionElement(getEntity());
+ Collection<OriginalSourceBase> collectionDescription = getCollectionDescription(getEntity());
+
+ if((collectionElement == null || collectionElement.isEmpty()) && (collectionDescription == null || collectionDescription.isEmpty())){
+ createEmptyContent();
+ }
+ if (collectionElement != null && !collectionElement.isEmpty()){
+ List<OriginalSourceBase> elements = new ArrayList<>(collectionElement);
+ Collections.sort(elements, getComparator());
+ createDynamicContents(elements);
+ forceExpansion = true;
+ }
+
+ this.setExpanded(forceExpansion);
+
+
+
+
+ if(collectionDescription != null && !collectionDescription.isEmpty()){
+ List<OriginalSourceBase> elements = new ArrayList<>(collectionDescription);
+ Collections.sort(elements, getComparator());
+ createDynamicContentsDisabled(elements);
+ forceExpansion = true;
+ }
+
+ this.setExpanded(forceExpansion);
+
+ reflow();
+ }
+
+
+
+ public Collection<OriginalSourceBase> getCollectionDescription(DescriptionElementBase entity) {
Collection<OriginalSourceBase> sources = new HashSet<>();
- sources.addAll(entity.getSources());
+// sources.addAll(entity.getSources());
sources.addAll(entity.getInDescription().getSources());
return sources;
}
+ public Collection<OriginalSourceBase> getCollectionElement(DescriptionElementBase entity) {
+ Collection<OriginalSourceBase> sources = new HashSet<>();
+ sources.addAll(entity.getSources());
+// sources.addAll(entity.getInDescription().getSources());
+
+ return sources;
+ }
@Override
public Comparator<OriginalSourceBase> getComparator() {
public boolean allowAddExisting() {
return false;
}
+
+ @Override
+ public Collection<OriginalSourceBase> getCollection(DescriptionElementBase entity) {
+ Collection<OriginalSourceBase> sources = new HashSet<>();
+ sources.addAll(entity.getSources());
+ sources.addAll(entity.getInDescription().getSources());
+ return sources;
+
+ }
+
+
+ private void createDynamicContentsDisabled(Collection<OriginalSourceBase> elements)
+ {
+ int i = 0;
+ for(final OriginalSourceBase element : elements){
+ SelectionAdapter removeListener = new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ removeElement(element);
+ internalUpdateSection(true);
+ }
+ };
+ boolean modulo = i++%2 == 0;
+ String colorResource = modulo ? Resources.COLOR_LIST_EVEN : Resources.COLOR_LIST_ODD;
+ createElementComposite(element, removeListener, AbstractUtility.getColor(colorResource));
+ getEntityCollectionElement().setEnabled(false);
+ }
+ }
}
\ No newline at end of file
.createSelectionElement(Reference.class,
element, "Source",
null, EntitySelectionElement.ALL, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
/** {@inheritDoc} */
@Override
public void setEntity(Reference element) {
- selection_descriptionSource.setEntity(element);
+ this.entity = element;
+ if (selection_descriptionSource != null){
+ selection_descriptionSource.setEntity(element);
+ }
}
/** {@inheritDoc} */
/** {@inheritDoc} */
@Override
public void setEntity(NamedArea entity) {
+ this.entity = entity;
}
@Override
public void setEntity(DefinedTerm entity) {
this.entity = entity;
- if(getParentElement() instanceof ModifierSection){
- ModifierSection parentSection = (ModifierSection) getParentElement();
- List<DefinedTerm> modifierTerms = new ArrayList<DefinedTerm>();
- Set<TermVocabulary<DefinedTerm>> recommendedModifierEnumeration = new HashSet<TermVocabulary<DefinedTerm>>();
- if(parentSection.getEntity() instanceof StateData){
- StateData stateData = (StateData) parentSection.getEntity();
- recommendedModifierEnumeration = stateData.getCategoricalData().getFeature().getRecommendedModifierEnumeration();
- }else if(parentSection.getEntity() instanceof StatisticalMeasurementValue){
- StatisticalMeasurementValue statisticalMeasurementValue = (StatisticalMeasurementValue)parentSection.getEntity();
- recommendedModifierEnumeration = statisticalMeasurementValue.getQuantitativeData().getFeature().getRecommendedModifierEnumeration();
- }
- if (!(parentSection.getParentElement() instanceof DescriptionElementBase) && parentSection.getEntity() instanceof DescriptionElementBase){
- DescriptionElementBase element = (DescriptionElementBase) parentSection.getEntity();
- recommendedModifierEnumeration = element.getFeature().getRecommendedModifierEnumeration();
-
- }
-
- for (TermVocabulary<DefinedTerm> termVocabulary : recommendedModifierEnumeration) {
- modifierTerms.addAll(termVocabulary.getTerms());
- }
- combo_modifier.setTerms(modifierTerms);
+ if (combo_modifier != null){
+ if(getParentElement() instanceof ModifierSection){
+ ModifierSection parentSection = (ModifierSection) getParentElement();
+ List<DefinedTerm> modifierTerms = new ArrayList<DefinedTerm>();
+ Set<TermVocabulary<DefinedTerm>> recommendedModifierEnumeration = new HashSet<TermVocabulary<DefinedTerm>>();
+ if(parentSection.getEntity() instanceof StateData){
+ StateData stateData = (StateData) parentSection.getEntity();
+ recommendedModifierEnumeration = stateData.getCategoricalData().getFeature().getRecommendedModifierEnumeration();
+ }else if(parentSection.getEntity() instanceof StatisticalMeasurementValue){
+ StatisticalMeasurementValue statisticalMeasurementValue = (StatisticalMeasurementValue)parentSection.getEntity();
+ recommendedModifierEnumeration = statisticalMeasurementValue.getQuantitativeData().getFeature().getRecommendedModifierEnumeration();
+ }
+ if (!(parentSection.getParentElement() instanceof DescriptionElementBase) && parentSection.getEntity() instanceof DescriptionElementBase){
+ DescriptionElementBase element = (DescriptionElementBase) parentSection.getEntity();
+ recommendedModifierEnumeration = element.getFeature().getRecommendedModifierEnumeration();
+
+ }
+
+ for (TermVocabulary<DefinedTerm> termVocabulary : recommendedModifierEnumeration) {
+ modifierTerms.addAll(termVocabulary.getTerms());
+ }
+ combo_modifier.setTerms(modifierTerms);
+ }
+ if(entity!=null && entity.getId()>0){
+ combo_modifier.setSelection(entity);
+ combo_modifier.removeEmptyElement();
+ }
}
- if(entity!=null && entity.getId()>0){
- combo_modifier.setSelection(entity);
- combo_modifier.removeEmptyElement();
- }
}
@Override
@Override
public void setEntity(DefinedTerm entity) {
this.entity = entity;
- if(entity!=null && entity.getId()!=0){
+ if(entity!=null && entity.getId()!=0 && combo_scope != null){
combo_scope.setSelection(entity);
combo_scope.removeEmptyElement();
}
@Override
public void createControls(ICdmFormElement element, int style) {
combo_scope = formFactory.createDefinedTermComboElement(TermType.Scope, element, "Scope", null, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
/** {@inheritDoc} */
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-
package eu.etaxonomy.taxeditor.ui.section.description;
import java.util.ArrayList;
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
/**
- * <p>StateDataElement class.</p>
- *
* @author n.hoffmann
* @created Sep 15, 2010
- * @version 1.0
*/
public class StateDataElement extends AbstractEntityCollectionElement<StateData> {
private ModifierSection section_modifiers;
private TextWithLabelElement text_modifyingText;
- /**
- * <p>Constructor for StateDataElement.</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 {@link eu.etaxonomy.cdm.model.description.StateData} object.
- * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
- * @param style a int.
- */
public StateDataElement(CdmFormFactory formFactory,
AbstractFormSection section, StateData entity,
SelectionListener removeListener, int style) {
super(formFactory, section, entity, removeListener, null, style);
}
- /** {@inheritDoc} */
@Override
public void setEntity(StateData entity) {
this.entity = entity;
- List<State> stateTerms = new ArrayList<State>();
- Set<TermVocabulary<State>> stateVocabularies = getEntity().getCategoricalData().getFeature().getSupportedCategoricalEnumerations();
- for (TermVocabulary<State> termVocabulary : stateVocabularies) {
- stateTerms.addAll(termVocabulary.getTerms());
- }
- combo_state.setTerms(stateTerms);
- combo_state.setSelection(entity.getState());
- if (section_modifiers != null){
- section_modifiers.setEntity(entity);
- section_modifiers.setExpanded(!entity.getModifiers().isEmpty());
- }
- if(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()) != null && text_modifyingText != null) {
- text_modifyingText.setText(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()).getText());
- }
- if(getEntity().getId()>0){
- combo_state.removeEmptyElement();
+ if (combo_state != null){
+
+ combo_state.setSelection(entity.getState());
+ if (section_modifiers != null){
+ section_modifiers.setEntity(entity);
+ section_modifiers.setExpanded(!entity.getModifiers().isEmpty());
+ }
+ if(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()) != null && text_modifyingText != null) {
+ text_modifyingText.setText(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()).getText());
+ }
+ if(getEntity().getId()>0){
+ combo_state.removeEmptyElement();
+ }
}
}
- /** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement element, int style) {
- combo_state = formFactory.createDefinedTermComboElement(TermType.State, element, "State", null, style);
+ if (getEntity() != null){
+ List<State> stateTerms = new ArrayList<>();
+ Set<TermVocabulary<State>> stateVocabularies = getEntity().getCategoricalData().getFeature().getSupportedCategoricalEnumerations();
+ for (TermVocabulary<State> termVocabulary : stateVocabularies) {
+ stateTerms.addAll(termVocabulary.getTerms());
+ }
+ combo_state = formFactory.createDefinedTermComboElement(stateTerms, element, "State", null, style);
+ }else{
+ combo_state = formFactory.createDefinedTermComboElement(TermType.State, element, "State", null, style);
+ }
// combo_state.setTermComparator(new DefaultTermComparator<State>());
if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowModifier.getKey())){
section_modifiers = formFactory.createModifierSection(getConversationHolder(), element, StoreUtil.getSectionStyle(ModifierSection.class, StateData.class.getCanonicalName(), true));
if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowModifierFreeText.getKey())){
text_modifyingText = formFactory.createTextWithLabelElement(element, "Modifying Text", null, style);
}
+ if (entity != null){
+ setEntity(entity);
+ }
}
- /** {@inheritDoc} */
@Override
public void handleEvent(Object eventSource) {
if(eventSource == combo_state){
}
}
- public void setEnabled(boolean enable){
- combo_state.setEnabled(enable);
- section_modifiers.setEnabled(enable);
- text_modifyingText.setEnabled(enable);
+ @Override
+ public void setEnabled(boolean enable){
+ if (combo_state != null){
+ combo_state.setEnabled(enable);
+ }
+ if (section_modifiers != null){
+ section_modifiers.setEnabled(enable);
+ }
+ if (text_modifyingText != null){
+ text_modifyingText.setEnabled(enable);
+ }
+ super.setEnabled(enable);
}
}
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-
package eu.etaxonomy.taxeditor.ui.section.description;
import java.util.Collection;
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
/**
- * <p>StateDataSection class.</p>
- *
* @author n.hoffmann
* @created Sep 15, 2010
- * @version 1.0
*/
public class StateDataSection extends AbstractEntityCollectionSection<CategoricalData, StateData> implements IEnableableFormElement {
- /**
- * <p>Constructor for StateDataSection.</p>
- *
- * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
- * @param style a int.
- */
public StateDataSection(CdmFormFactory formFactory,
ConversationHolder conversation, ICdmFormElement parentElement,
int style) {
super(formFactory, conversation, parentElement, "State Data", style);
}
- /** {@inheritDoc} */
@Override
public Collection<StateData> getCollection(CategoricalData entity) {
return entity.getStateData();
return new DefaultCdmBaseComparator<>();
}
- /** {@inheritDoc} */
@Override
public StateData createNewElement() {
return StateData.NewInstance();
}
- /** {@inheritDoc} */
@Override
public void addElement(StateData element) {
getEntity().addStateData(element);
}
- /** {@inheritDoc} */
@Override
public void removeElement(StateData element) {
getEntity().removeStateData(element);
}
- /** {@inheritDoc} */
@Override
public String getEmptyString() {
return "No state data yet.";
}
- /** {@inheritDoc} */
@Override
protected String getTooltipString() {
return "Create new state data";
}
- /**
- * {@inheritDoc}
- */
@Override
public StateData addExisting() {
return null;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean allowAddExisting() {
return false;
}
-
-
-}
+}
\ No newline at end of file
* @created Sep 15, 2010
*/
public class StatisticalMeasurementValueElement extends
- AbstractEntityCollectionElement<StatisticalMeasurementValue> implements IEnableableFormElement{
+ AbstractEntityCollectionElement<StatisticalMeasurementValue> {
private BigDecimalWithLabelElement number_value;
private TermComboElement<StatisticalMeasure> combo_type;
@Override
public void setEntity(StatisticalMeasurementValue entity) {
this.entity = entity;
- Set<StatisticalMeasure> statisiticalMeasures = getEntity().getQuantitativeData().getFeature().getRecommendedStatisticalMeasures();
- combo_type.setTerms(new ArrayList<StatisticalMeasure>(statisiticalMeasures));
- combo_type.setSelection(entity.getType());
- number_value.setNumber(entity.getValue());
- section_modifiers.setEntity(entity);
+ if (combo_type != null){
+ Set<StatisticalMeasure> statisiticalMeasures = getEntity().getQuantitativeData().getFeature().getRecommendedStatisticalMeasures();
+ combo_type.setTerms(new ArrayList<StatisticalMeasure>(statisiticalMeasures));
+ combo_type.setSelection(entity.getType());
+ number_value.setNumber(entity.getValue());
+ section_modifiers.setEntity(entity);
+ }
}
@Override
combo_type = formFactory.createDefinedTermComboElement(TermType.StatisticalMeasure, element, "Statistical Measure", null, style);
section_modifiers = formFactory.createModifierSection(getConversationHolder(), element, StoreUtil.getSectionStyle(ModifierSection.class, StatisticalMeasurementValue.class.getCanonicalName()));
section_modifiers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
}
}
- @Override
- public void setEnabled(boolean enabled) {
- combo_type.setEnabled(enabled);
- number_value.setEnabled(enabled);
- section_modifiers.setEnabled(enabled);
- }
-
- @Override
- public boolean isEnabled() {
- return combo_type.isEnabled();
- }
+// @Override
+// public void setEnabled(boolean enabled) {
+// combo_type.setEnabled(enabled);
+// number_value.setEnabled(enabled);
+// section_modifiers.setEnabled(enabled);
+// }
+//
+// @Override
+// public boolean isEnabled() {
+// return combo_type.isEnabled();
+// }
}
* @param style a int.
* @param <T> a T object.
*/
+ public AbstractDetailedDescriptionDetailElement(CdmFormFactory formFactory,
+ ICdmFormElement formElement, T entity, boolean enabled, int style) {
+ super(formFactory, formElement);
+ setEntity(entity);
+ setEnabled(enabled);
+ }
public AbstractDetailedDescriptionDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement, T entity, int style) {
super(formFactory, formElement);
setEntity(entity);
+
}
protected void createTimePeriod(ICdmFormElement formElement, DescriptionElementBase entity,
int style) {
timePeriod = formFactory.createTimePeriodElement(this, "Time scope", entity.getTimeperiod(), SWT.WRAP);
-
+ timePeriod.setEnabled(enabled);
}
protected void createModifier(ICdmFormElement formElement, DescriptionElementBase entity,
section_modifiers = formFactory.createModifierSection(getConversationHolder(), this, StoreUtil.getSectionStyle(ModifierSection.class, entity.getClass().getCanonicalName(), true));
section_modifiers.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_modifiers.setEntity(entity);
+ section_modifiers.setEnabled(enabled);
}
if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowModifierFreeText.getKey())){
text_modifyingText = formFactory.createTextWithLabelElement(this, "Modifying Text", null, style);
if(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()) != null) {
text_modifyingText.setText(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()).getText());
}
+ text_modifyingText.setEnabled(enabled);
}
}
if(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()) != null) {
text_modifyingText.setText(getEntity().getModifyingText().get(CdmStore.getDefaultLanguage()).getText());
}
+ text_modifyingText.setEnabled(enabled);
}
}
* @param style a int.
*/
public CategoricalDataDetailElement(CdmFormFactory formFactory,
- ICdmFormElement formElement, CategoricalData entity, int style) {
- super(formFactory, formElement, entity, style);
+ ICdmFormElement formElement, CategoricalData entity, boolean enabled, int style) {
+ super(formFactory, formElement, entity, enabled, style);
+
}
@Override
section_stateData = formFactory.createStateDataSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(StateDataSection.class, entity.getClass().getCanonicalName(), true));
section_stateData.setEntity(entity);
section_stateData.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ section_stateData.setEnabled(enabled);
createTimePeriod(formElement, entity, style);
if (entity.getFeature().getRecommendedModifierEnumeration() != null && !entity.getFeature().getRecommendedModifierEnumeration().isEmpty()){
createModifier(formElement, entity, style);
* @param style a int.
*/
public CommonNameDetailElement(CdmFormFactory formFactory,
- ICdmFormElement formElement, CommonTaxonName entity, int style) {
- super(formFactory, formElement, entity, style);
+ ICdmFormElement formElement, CommonTaxonName entity, boolean enabled, int style) {
+ super(formFactory, formElement, entity, enabled, style);
}
/** {@inheritDoc} */
public DistributionDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement, Distribution entity, boolean enabled, int style) {
- super(formFactory, formElement, entity, style);
- setEnabled(enabled);
+ super(formFactory, formElement, entity, enabled, style);
+
}
@Override
private EntitySelectionElement<SpecimenOrObservationBase> selection_derivedUnit;
public IndividualsAssociationDetailElement(CdmFormFactory formFactory,
- ICdmFormElement formElement, IndividualsAssociation entity,
+ ICdmFormElement formElement, IndividualsAssociation entity, boolean enabled,
int style) {
- super(formFactory, formElement, entity, style);
+ super(formFactory, formElement, entity, enabled, style);
}
/** {@inheritDoc} */
* @param style a int.
*/
public QuantitativeDataDetailElement(CdmFormFactory formFactory,
- ICdmFormElement formElement, QuantitativeData entity, int style) {
- super(formFactory, formElement, entity, style);
+ ICdmFormElement formElement, QuantitativeData entity, boolean enabled, int style) {
+ super(formFactory, formElement, entity, enabled, style);
}
@Override
* a int.
*/
public TaxonInteractionDetailElement(CdmFormFactory formFactory,
- ICdmFormElement formElement, TaxonInteraction entity, int style) {
- super(formFactory, formElement, entity, style);
+ ICdmFormElement formElement, TaxonInteraction entity, boolean enabled, int style) {
+ super(formFactory, formElement, entity, enabled, style);
}
/** {@inheritDoc} */
* @param entity
* @param style
*/
- public TemporalDataDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement, TemporalData entity,
+ public TemporalDataDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement, TemporalData entity, boolean enabled,
int style) {
- super(formFactory, formElement, entity, style);
+ super(formFactory, formElement, entity, enabled, style);
}
* @param style a int.
*/
public TextDataDetailElement(CdmFormFactory formFactory,
- ICdmFormElement formElement, TextData entity, int style) {
- super(formFactory, formElement, entity, style);
+ ICdmFormElement formElement, TextData entity, boolean enabled, int style) {
+ super(formFactory, formElement, entity, enabled, style);
}
/** {@inheritDoc} */
comboState = formFactory.createDefinedTermComboElement(Collections.EMPTY_LIST, element, getComboLabel(), null, style);
comboState.setEnabled(false);
selectFeature.setEnabled(false);
+
+ selectFeature.setEntity(entity.getFeature());
+ comboState.setSelection(entity.getState());
}
protected abstract String getComboLabel();
@Override
public void setEntity(FeatureState entity) {
this.entity = entity;
- selectFeature.setEntity(entity.getFeature());
- comboState.setSelection(entity.getState());
+ if (selectFeature != null){
+ selectFeature.setEntity(entity.getFeature());
+ comboState.setSelection(entity.getState());
+ }
}
@Override
*/
@Override
public void setEntity(User entity) {
- selection_user.setEntity(entity);
+ this.entity = entity;
+ if (selection_user!= null){
+ selection_user.setEntity(entity);
+ }
}
/*
.createSelectionElement(User.class,//getConversationHolder(),
element, "", entity,
EntitySelectionElement.EDITABLE, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
/*
text_width = formFactory.createFloatTextWithLabelElement(formElement, "Width", null, style);
text_width.setEnabled(false);
element_keyValue = formFactory.createKeyValueViewerElement(formElement, "Key", "Value", null);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(ImageFile entity) {
super.setEntity(entity);
- text_height.setNumber(entity.getHeight());
- text_width.setNumber(entity.getWidth());
- try {
- new LoadImageJob(getEntity().getUri(), true).schedule();
- } catch (Exception e) {
- e.printStackTrace();
- handleException();
+ if (text_height != null){
+ text_height.setNumber(entity.getHeight());
+ text_width.setNumber(entity.getWidth());
+ try {
+ new LoadImageJob(getEntity().getUri(), true).schedule();
+ } catch (Exception e) {
+ e.printStackTrace();
+ handleException();
+ }
}
}
mediaDetailElement.setShowImage(false);
}
addElement(mediaDetailElement);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(Media element) {
this.entity = element;
- mediaDetailElement.setEntity(element);
-
- selection_artist.setEntity(HibernateProxyHelper
- .deproxy(element.getArtist()));
-
- text_description.setMultilanguageText(element.getAllDescriptions());
-
-// if (CdmUtils.isBlank(text_description.getText())){
-// Map<Language, LanguageString> allDescriptions = element.getAllDescriptions();
-// if (!allDescriptions.isEmpty()){
-// text_description.setLanguageString(allDescriptions.get(Language.ENGLISH()));
-// }
-// }
-
- createTitle();
+ if (mediaDetailElement != null){
+ mediaDetailElement.setEntity(element);
+
+ selection_artist.setEntity(HibernateProxyHelper
+ .deproxy(element.getArtist()));
+
+ text_description.setMultilanguageText(element.getAllDescriptions());
+ createTitle();
+ }
}
public void createTitle() {
text_suffix = formFactory.createTextWithLabelElement(element, "Suffix", null, style);
section_mediaRepresentationPart = formFactory.createMediaRepresentationPartSection(getConversationHolder(), element, StoreUtil.getSectionStyle(MediaRepresentationPartSection.class, MediaRepresentation.class.getCanonicalName()));
section_mediaRepresentationPart.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(MediaRepresentation element) {
this.entity = element;
- section_mediaRepresentationPart.setEntity(element);
- text_mimeType.setText(element.getMimeType());
- text_suffix.setText(element.getSuffix());
+ if (section_mediaRepresentationPart != null){
+ section_mediaRepresentationPart.setEntity(element);
+ text_mimeType.setText(element.getMimeType());
+ text_suffix.setText(element.getSuffix());
+ }
}
@Override
text_uri = formFactory.createUriWithLabelElement(element, "URI", null, style);
text_size = formFactory.createFloatTextWithLabelElement(element, "Size", null, style);
text_size.setEnabled(false);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(T entity) {
this.entity = entity;
- if(entity.getSize() != null){
- text_size.setText(FileUtils.byteCountToDisplaySize(entity.getSize()));
+ if (text_size != null){
+ if(entity.getSize() != null){
+ text_size.setText(FileUtils.byteCountToDisplaySize(entity.getSize()));
+ }
+ if(entity.getUri() != null){
+ text_uri.setParsedText(entity.getUri());
+ } else {
+ String uriBuffer = getParentMediaDetailElement().getUriBuffer();
+ if(uriBuffer!=null){
+ text_uri.setText(uriBuffer);
+ text_uri.parseText();//just to update the error label
+ }
+ }
}
- if(entity.getUri() != null){
- text_uri.setParsedText(entity.getUri());
- } else {
- String uriBuffer = getParentMediaDetailElement().getUriBuffer();
- if(uriBuffer!=null){
- text_uri.setText(uriBuffer);
- text_uri.parseText();//just to update the error label
- }
- }
}
@Override
sourceSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
this.formElement = formElement;
this.style = style;
+ if (this.entity != null){
+ this.setEntity(entity);
+ }
}
@Override
public void setEntity(T entity){
super.setEntity(entity);
+ if (this.getElements() == null || this.getElements().isEmpty()){
+ return;
+ }
removeSourcesControls();
if (this.entity != null && this.entity.hasDesignationSource()){
addElement(spacer);
super.createControls(element, style);
setSourceLabel("Source");
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(NameRelationship entity) {
- String text = (entity.getFromName() == null? "-":entity.getFromName().getTitleCache())
- + " " +(entity.getType()==null?"(no type)":entity.getType().getLabel())
- + " " + (entity.getToName()==null?"-":entity.getToName().getTitleCache());
- labelElement.setText(text);
- if (ruleConsidered != null){
- ruleConsidered.setElement(entity);
+ if (labelElement != null){
+ String text = (entity.getFromName() == null? "-":entity.getFromName().getTitleCache())
+ + " " +(entity.getType()==null?"(no type)":entity.getType().getLabel())
+ + " " + (entity.getToName()==null?"-":entity.getToName().getTitleCache());
+ labelElement.setText(text);
+ if (ruleConsidered != null){
+ ruleConsidered.setElement(entity);
+ }
}
super.setEntity(entity);
"Designation Status", null, style); //$NON-NLS-1$
super.createControls(formElement, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
/** {@inheritDoc} */
@Override
public void setEntity(NameTypeDesignation entity) {
super.setEntity(entity);
- checkbox_conservedType.setSelection(entity.isConservedType());
- checkbox_rejectedType.setSelection(entity.isRejectedType());
-
- selection_typeName.setEntity(HibernateProxyHelper.deproxy(entity.getTypeName()));
-
- combo_typeStatus.setSelection(HibernateProxyHelper.deproxy(entity.getTypeStatus(), NameTypeDesignationStatus.class));
-
- checkbox_notDesignated.setSelection(entity.isNotDesignated());
+ if (checkbox_conservedType != null){
+ checkbox_conservedType.setSelection(entity.isConservedType());
+ checkbox_rejectedType.setSelection(entity.isRejectedType());
+ selection_typeName.setEntity(HibernateProxyHelper.deproxy(entity.getTypeName()));
+ combo_typeStatus.setSelection(HibernateProxyHelper.deproxy(entity.getTypeStatus(), NameTypeDesignationStatus.class));
+ checkbox_notDesignated.setSelection(entity.isNotDesignated());
+ }
}
spacer.getLayoutComposite().setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
addElement(spacer);
super.createControls(element, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(NomenclaturalStatus entity) {
super.setEntity(entity);
- if (entity.getType() != null){
- nomenclaturalStatusTypeCombo.setSelection(entity.getType());
- nomenclaturalStatusTypeCombo.removeEmptyElement();
- }
- if (ruleConsidered != null){
- ruleConsidered.setElement(entity);
+ if (nomenclaturalStatusTypeCombo != null){
+ if (entity.getType() != null){
+ nomenclaturalStatusTypeCombo.setSelection(entity.getType());
+ nomenclaturalStatusTypeCombo.removeEmptyElement();
+ }
+ if (ruleConsidered != null){
+ ruleConsidered.setElement(entity);
+ }
}
}
this.updateContent();
//this is needed for the "new" wizards in order to redraw correctly
StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
- section_hybrid.setEntity(getEntity());
- section_author.setEntity(getEntity());
- section_name.setEntity(getEntity());
+ if (section_hybrid != null){
+ section_hybrid.setEntity(getEntity());
+ }
+ if (section_author != null){
+ section_author.setEntity(getEntity());
+ }
+ if (section_name != null){
+ section_name.setEntity(getEntity());
+ }
}else{
combo_nomenclaturalCode.setSelection(getEntity().getNameType());
}
formElement, "Designation Status", null, style, new TypeDesignationStatusComparator<SpecimenTypeDesignationStatus>());
super.createControls(formElement, style);
+ setEntity(entity);
}
@Override
public void setEntity(SpecimenTypeDesignation entity) {
super.setEntity(entity);
- if (entity.getTypeSpecimen() != null){
- selection_typeSpecimen.setEntity(entity.getTypeSpecimen());
- }else{
- selection_typeSpecimen.setEntity(entity.getTypeSpecimen());
- }
-
- SpecimenTypeDesignationStatus typeStatus = HibernateProxyHelper
- .deproxy(entity.getTypeStatus(), SpecimenTypeDesignationStatus.class);
- combo_typeStatus.setSelection(typeStatus);
-
- checkbox_notDesignated.setSelection(entity.isNotDesignated());
+ if (selection_typeSpecimen != null){
+ if (entity.getTypeSpecimen() != null){
+ selection_typeSpecimen.setEntity(entity.getTypeSpecimen());
+ }else{
+ selection_typeSpecimen.setEntity(entity.getTypeSpecimen());
+ }
+
+ SpecimenTypeDesignationStatus typeStatus = HibernateProxyHelper
+ .deproxy(entity.getTypeStatus(), SpecimenTypeDesignationStatus.class);
+ combo_typeStatus.setSelection(typeStatus);
+
+ checkbox_notDesignated.setSelection(entity.isNotDesignated());
+ }
}
@Override
multilanguageTextElement = formFactory.createMultiLanguageTextElement(this, null, entity.getText(), 100, SWT.WRAP);
checkIsVerbatim = formFactory.createCheckbox(formElement, "Is Verbatim", getEntity().isVerbatim(), style);
super.createControls(formElement, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
@Override
public void setEntity(TextualTypeDesignation entity) {
super.setEntity(entity);
- removeNotDesignatedControls();
+ if (checkbox_notDesignated != null){
+ removeNotDesignatedControls();
+ }
}
@Override
/** {@inheritDoc} */
@Override
public void setEntity(T entity) {
- selection_agent.setEntity(entity.getActor());
- text_description.setText(entity.getDescription());
- element_timePeriod.setEntity(entity.getTimeperiod());
+ if (selection_agent != null){
+ selection_agent.setEntity(entity.getActor());
+ text_description.setText(entity.getDescription());
+ element_timePeriod.setEntity(entity.getTimeperiod());
+ }
}
"Time Period", null, style);
text_description = formFactory.createTextWithLabelElement(element,
"Description", null, style);
+ if (entity != null){
+ selection_agent.setEntity(entity.getActor());
+ text_description.setText(entity.getDescription());
+ element_timePeriod.setEntity(entity.getTimeperiod());
+ }
}
}
@Override
public void setEntity(NamedArea entity) {
- selection_namedArea.setEntity(entity);
+ this.entity = entity;
+ if (selection_namedArea != null){
+ selection_namedArea.setEntity(entity);
+ }
}
@Override
selection_namedArea = formFactory.createSelectionElement(NamedArea.class, //getConversationHolder(),
formElement, "Area",
null, EntitySelectionElement.NOTHING, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
@Override
public void setEntity(DeterminationEvent entity) {
this.entity = entity;
- combo_determinationModifier.setSelection(entity.getModifier());
- selection_taxonBase.setEntity(entity.getTaxon());
- selectionTaxonNameBase.setEntity(entity.getTaxonName());
+ if (combo_determinationModifier != null){
+ combo_determinationModifier.setSelection(entity.getModifier());
+ selection_taxonBase.setEntity(entity.getTaxon());
+ selectionTaxonNameBase.setEntity(entity.getTaxonName());
+ }
super.setEntity(entity);
}
combo_determinationModifier = formFactory.createDefinedTermComboElement(TermType.DeterminationModifier,
element, "Modifier", null, style);
+ if (entity != null){
+ combo_determinationModifier.setSelection(entity.getModifier());
+ selection_taxonBase.setEntity(entity.getTaxon());
+ selectionTaxonNameBase.setEntity(entity.getTaxonName());
+ }
}
@Override
@Override
public void setEntity(DerivedUnit entity) {
this.entity = entity;
- selection_derivedUnit.setEntity(entity);
+ if (selection_derivedUnit != null){
+ selection_derivedUnit.setEntity(entity);
+ }
}
/*
.createSelectionElement(DerivedUnit.class,//getConversationHolder(),
element, "Derived Unit", null,
EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
/*
@Override
public void setEntity(SpecimenTypeDesignation entity) {
super.setEntity(entity);
- Set<TaxonName> typifiedNames = entity.getTypifiedNames();
- if(typifiedNames.size()==1){
- selectionTaxonName.setEntity(typifiedNames.iterator().next());
+ if (combo_typeStatus != null){
+ Set<TaxonName> typifiedNames = entity.getTypifiedNames();
+ if(typifiedNames.size()==1){
+ selectionTaxonName.setEntity(typifiedNames.iterator().next());
+ }
+ else if(typifiedNames.size()>1){
+ formFactory.createLabel(getLayoutComposite(), "!!!!!!!!");
+ }
+
+ SpecimenTypeDesignationStatus typeStatus = HibernateProxyHelper
+ .deproxy(entity.getTypeStatus());
+ combo_typeStatus.setSelection(typeStatus);
+ checkbox_notDesignated.setSelection(entity.isNotDesignated());
}
- else if(typifiedNames.size()>1){
- formFactory.createLabel(getLayoutComposite(), "!!!!!!!!");
- }
-
- SpecimenTypeDesignationStatus typeStatus = HibernateProxyHelper
- .deproxy(entity.getTypeStatus());
- combo_typeStatus.setSelection(typeStatus);
- checkbox_notDesignated.setSelection(entity.isNotDesignated());
// for (TaxonNameBase taxonNameBase : typifiedNames) {
// EntitySelectionElement<TaxonNameBase> selectionElement = formFactory.createSelectionElement(
parentFormElement, "Designation Status", null, style);
super.createControls(element, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
/** {@inheritDoc} */
public void createControls(ICdmFormElement element, int style) {
text_description = formFactory.createTextWithLabelElement(element,
"Sample Designation", null, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
@Override
public void setEntity(Identifier entity) {
this.entity = entity;
- text_description.setText(entity.getIdentifier());
+ if (text_description != null){
+ text_description.setText(entity.getIdentifier());
+ }
}
}
\ No newline at end of file
null, EntitySelectionElement.SELECTABLE|EntitySelectionElement.EDITABLE, style);
text_referenceDetail = formFactory.createTextWithLabelElement(
formElement, "Reference Detail", null, SWT.NULL);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(Reference entity) {
this.entity = entity;
- selection_reference.setEntity(entity);
- text_referenceDetail.setText(entity.getReferenceAbstract());
+ if(selection_reference != null){
+ selection_reference.setEntity(entity);
+ text_referenceDetail.setText(entity.getReferenceAbstract());
+ }
+
}
@Override
--- /dev/null
+package eu.etaxonomy.taxeditor.ui.section.reference;
+
+import eu.etaxonomy.cdm.model.name.NomenclaturalSource;
+import eu.etaxonomy.cdm.model.taxon.SecundumSource;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+public class SecundumSourceDetailElement extends AbstractCdmDetailElement<TaxonBase> {
+
+ private SecundumSourceElement sourceElement;
+
+ public SecundumSourceDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
+ super(formFactory, formElement);
+
+ }
+
+ @Override
+ protected void createControls(ICdmFormElement formElement, TaxonBase entity, int style) {
+ sourceElement = formFactory.createSecundumSourceElement(formElement, entity, "Secundum");
+ if (entity.getSecSource() == null){
+ SecundumSource source = SecundumSource.NewSecundumInstance(entity);
+ entity.setSecSource(source);
+ sourceElement.setEntity(source);
+ }else{
+ sourceElement.setEntity(entity.getSecSource());
+ }
+ sourceElement.setPersistentBackground(formElement.getPersistentBackground());
+
+ }
+
+ @Override
+ public void handleEvent(Object eventSource) {
+
+
+ }
+
+}
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.reference.NamedSourceBase;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.SecundumSource;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.preference.Resources;
import eu.etaxonomy.taxeditor.store.StoreUtil;
*/
public class SecundumSourceElement extends OriginalSourceElement<SecundumSource> {
+ protected EntitySelectionElement<TaxonName> select_nameUsedInSource;
/**
* @param formFactory
* @param formElement
setEntityWithoutUpdate(HibernateProxyHelper.deproxy(entity));
- this.selection_Ref = formFactory.createSelectionElement(Reference.class, formElement, "Secundum", null, EntitySelectionElement.ALL, style);
+ this.selection_Ref = formFactory.createSelectionElement(Reference.class, formElement, "Secundum", getEntity()!= null? getEntity().getCitation(): null, EntitySelectionElement.ALL, style);
- if (getEntity() != null){
- selection_Ref.setEntity(getEntity().getCitation());
- }
selection_Ref.setBackground(this.getPersistentBackground());
for (ICdmFormElement element: selection_Ref.getElements()){
element.setBackground(getPersistentBackground());
Label sep = formFactory.createLabel(formElement.getLayoutComposite(), "");
sep.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-
-
+ if (this.cdmEntity instanceof Taxon){
+ select_nameUsedInSource = formFactory.createSelectionElement(TaxonName.class, formElement, "Name in Source", entity != null? ((NamedSourceBase)entity).getNameUsedInSource(): null, EntitySelectionElement.DELETABLE, style);
+ }
+
externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, "Links", false, StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
externalLinks.setEmptySectionString("No links yet.");
externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 3));
externalLinks.setEntity(getEntity());
externalLinks.setFont(AbstractUtility.getFont(Resources.COLOR_FONT_DEFAULT));
-
-
+
addControl(externalLinks);
addElement(externalLinks);
-
-// advancedSection = formFactory.createOriginalSourceAdvancedSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(OriginalSourceAdvancedSection.class, INomenclaturalReference.class.getCanonicalName()));
-// TableWrapData layoutData = LayoutConstants.FILL_HORIZONTALLY(2, 1);
-//
-// advancedSection.setLayoutData(layoutData);
-// advancedSection.setBackground(this.getPersistentBackground());
-// advancedSection.setEntity(entity);
-// advancedSection.setFont(AbstractUtility.getFont(Resources.COLOR_FONT_DEFAULT));
-// addControl(advancedSection);
-// addElement(advancedSection);
this.getLayoutComposite().layout();
+
}
+ @Override
+ public void handleEvent(Object eventSource) {
+ if (eventSource.equals(select_nameUsedInSource)){
+ getEntity().setNameUsedInSource(select_nameUsedInSource.getEntity());
+ }else{
+ super.handleEvent(eventSource);
+ }
+ }
+
}
--- /dev/null
+package eu.etaxonomy.taxeditor.ui.section.reference;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.name.NomenclaturalSource;
+import eu.etaxonomy.cdm.model.taxon.SecundumSource;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
+
+public class SecundumSourceSection extends AbstractCdmDetailSection<TaxonBase> {
+
+
+ public SecundumSourceSection(CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider,
+ int style) {
+ super(formFactory, conversation, parentElement, selectionProvider, style);
+
+ }
+
+ @Override
+ public String getHeading() {
+
+ return "Secundum Source";
+ }
+
+ @Override
+ protected void setSectionTitle() {
+ String title = "";
+ if(getEntity() != null ){
+
+ if (getEntity().getSecSource() != null && getEntity().getSecSource().getCitation() != null){
+ String secundumCitation = getEntity().getSecSource().getCitation().getNomenclaturalCitation(getEntity().getSecSource().getCitationMicroReference());
+ title = ": " + secundumCitation;
+ }
+
+ }
+ this.setText(getHeading() + title);
+ }
+
+ @Override
+ protected AbstractCdmDetailElement<TaxonBase> createCdmDetailElement(
+ AbstractCdmDetailSection<TaxonBase> parentElement, int style) {
+
+ return formFactory.createSecundumSourceDetailElement(parentElement);
+ }
+
+}
@Override
public void setEntity(T entity) {
- selection_reference.setEntity(entity.getCitation());
- text_referenceDetail.setText(entity.getCitationMicroReference());
- text_originaleNameString.setText(entity.getOriginalNameString());
- ICdmTarget cdmSource = entity.getCdmSource();
- String source = "";
- if(cdmSource instanceof IdentifiableEntity) {
- source = ((IdentifiableEntity) cdmSource).getTitleCache();
- } else if(cdmSource instanceof CdmBase) {
- source += CdmUtils.isNotBlank(source)?"\nUUID: ":"";
- source += ((CdmBase) cdmSource).getUuid().toString();
- } else if(cdmSource!=null){
- source = cdmSource.toString();
- }
- text_cdmsource.setText(source);
- externalLinks.setEntity(entity);
+ this.entity = entity;
+ if (selection_reference != null){
+ selection_reference.setEntity(entity.getCitation());
+ text_referenceDetail.setText(entity.getCitationMicroReference());
+ text_originaleNameString.setText(entity.getOriginalNameString());
+ ICdmTarget cdmSource = entity.getCdmSource();
+ String source = "";
+ if(cdmSource instanceof IdentifiableEntity) {
+ source = ((IdentifiableEntity) cdmSource).getTitleCache();
+ } else if(cdmSource instanceof CdmBase) {
+ source += CdmUtils.isNotBlank(source)?"\nUUID: ":"";
+ source += ((CdmBase) cdmSource).getUuid().toString();
+ } else if(cdmSource!=null){
+ source = cdmSource.toString();
+ }
+ text_cdmsource.setText(source);
+ externalLinks.setEntity(entity);
+ }
}
/**
text_cdmsource = formFactory.createTextWithLabelElement(
formElement, "CDM Source", null, SWT.NULL);
((Text) text_cdmsource.getMainControl()).setEditable(false);
+
+ if (entity != null){
+ selection_reference.setEntity(entity.getCitation());
+ text_referenceDetail.setText(entity.getCitationMicroReference());
+ text_originaleNameString.setText(entity.getOriginalNameString());
+ ICdmTarget cdmSource = entity.getCdmSource();
+ String source = "";
+ if(cdmSource instanceof IdentifiableEntity) {
+ source = ((IdentifiableEntity) cdmSource).getTitleCache();
+ } else if(cdmSource instanceof CdmBase) {
+ source += CdmUtils.isNotBlank(source)?"\nUUID: ":"";
+ source += ((CdmBase) cdmSource).getUuid().toString();
+ } else if(cdmSource!=null){
+ source = cdmSource.toString();
+ }
+ text_cdmsource.setText(source);
+ if (externalLinks != null){
+ externalLinks.setEntity(entity);
+ }
+ }
}
}
combo_annotationType = formFactory.createDefinedTermComboElement(TermType.AnnotationType, this, "Annotation Type", null, style);
text = formFactory.createMultiLineTextWithLabel(this, "Annotation", 100, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(Annotation entity) {
this.entity = entity;
- combo_annotationType.setSelection(getEntity().getAnnotationType());
- text.setText(entity.getText());
+ if (combo_annotationType != null){
+ combo_annotationType.setSelection(getEntity().getAnnotationType());
+ text.setText(entity.getText());
+ }
}
@Override
EntitySelectionElement.ALL, style);
text = formFactory.createMultiLineTextWithLabel(this, "Text", 100,
style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
/*
@Override
public void setEntity(Credit element) {
this.entity = element;
-
- agentSelection.setEntity(element.getAgent());
- text.setText(element.getText());
+ if (agentSelection != null){
+ agentSelection.setEntity(element.getAgent());
+ text.setText(element.getText());
+ }
}
/** {@inheritDoc} */
public void createControls(ICdmFormElement element, int style) {
combo_extensionType = formFactory.createDefinedTermComboElement(TermType.ExtensionType, element, "Type", null, style);
text_extensionValue = formFactory.createTextWithLabelElement(element, "Extension", null, style);
-
+ if (entity != null){
+ setEntity(entity);
+ }
}
/* (non-Javadoc)
@Override
public void setEntity(Extension element) {
this.entity = element;
- ExtensionType extensionType = HibernateProxyHelper.deproxy(element.getType());
- combo_extensionType.setSelection(extensionType);
- text_extensionValue.setText(element.getValue());
+ if (combo_extensionType != null){
+ ExtensionType extensionType = HibernateProxyHelper.deproxy(element.getType());
+ combo_extensionType.setSelection(extensionType);
+ text_extensionValue.setText(element.getValue());
+ }
}
/*
super.createControls(formElement, style);
externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(ExternalLinksSection.class, IdentifiableSource.class.getCanonicalName()));
externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+ if (entity != null){
+ setEntity(this.entity);
+ }
}
/** {@inheritDoc} */
@Override
public void setEntity(IdentifiableSource entity) {
super.setEntity(entity);
- if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSource.getKey())){
- text_idInSource.setText(entity.getIdInSource());
- }
- if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowNamespaceInSource.getKey())){
- text_idNamespace.setText(entity.getIdNamespace());
+ if (selection_reference != null){
+ if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSource.getKey())){
+ text_idInSource.setText(entity.getIdInSource());
+ }
+ if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowNamespaceInSource.getKey())){
+ text_idNamespace.setText(entity.getIdNamespace());
+ }
+
+ selection_reference.setEntity(entity.getCitation());
+ text_referenceDetail.setText(entity.getCitationMicroReference());
+ combo_origsourcetype.setSelection(entity.getType());
+ text_originaleNameString.setText(entity.getOriginalNameString());
}
- selection_reference.setEntity(entity.getCitation());
- text_referenceDetail.setText(entity.getCitationMicroReference());
- combo_origsourcetype.setSelection(entity.getType());
- text_originaleNameString.setText(entity.getOriginalNameString());
-
-
-
}
/** {@inheritDoc} */
public void createControls(ICdmFormElement element, int style) {
checkbox_markerState = formFactory.createCheckbox(this, null, false, style);
combo_markerType = formFactory.createDefinedTermComboElement(TermType.MarkerType, this, null, null, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
/** {@inheritDoc} */
@Override
public void setEntity(Marker element) {
this.entity = element;
- checkbox_markerState.setSelection(element.getFlag());
- combo_markerType.setSelection(element.getMarkerType());
- combo_markerType.removeEmptyElement();
+ if (checkbox_markerState != null){
+ checkbox_markerState.setSelection(element.getFlag());
+ combo_markerType.setSelection(element.getMarkerType());
+ combo_markerType.removeEmptyElement();
+ }
}
/** {@inheritDoc} */
abbrev = formFactory.createTextWithLabelElement(element, "Abbrev. Text", null, style);
uri = formFactory.createUriWithLabelElement(element, "Uri", null, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(Rights element) {
this.entity = element;
- combo_rightsType.setSelection(element.getType());
- selection_agent.setEntity(element.getAgent());
- text.setText(element.getText());
- abbrev.setText(element.getAbbreviatedText());
- uri.setParsedText(element.getUri());
+ if(combo_rightsType != null){
+ combo_rightsType.setSelection(element.getType());
+ selection_agent.setEntity(element.getAgent());
+ text.setText(element.getText());
+ abbrev.setText(element.getAbbreviatedText());
+ uri.setParsedText(element.getUri());
+ }
}
@Override
@Override
public void setEntity(Identifier entity) {
this.entity = entity;
- textIdentifier.setText(entity.getIdentifier());
- comboIdentifierType.setSelection(entity.getType());
+ if (textIdentifier != null){
+ textIdentifier.setText(entity.getIdentifier());
+ comboIdentifierType.setSelection(entity.getType());
+ }
}
+
/** {@inheritDoc} */
@Override
public void createControls(ICdmFormElement formElement, int style) {
comboIdentifierType = formFactory.createDefinedTermComboElement(TermType.IdentifierType, formElement, "Type", null, style);
textIdentifier = formFactory.createTextWithLabelElement(formElement, "Identifier", null, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
@Override
public void setEntity(Taxon entity) {
- selection_taxon.setEntity(entity);
+ this.entity = entity;
+ if (selection_taxon != null){
+ selection_taxon.setEntity(entity);
+ }
}
@Override
.createSelectionElement(Taxon.class,
element, "Taxon", null,
EntitySelectionElement.SELECTABLE, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
@Override
public void createControls(ICdmFormElement element, int style) {
comboMeasurementUnit = formFactory.createDefinedTermComboElementDto(TermType.MeasurementUnit, element, "Measurement unit", null, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(MeasurementUnit entity) {
this.entity = entity;
- if(entity.getId()!=0){
+ if(entity.getId()!=0 && comboMeasurementUnit != null){
comboMeasurementUnit.setSelection(entity);
comboMeasurementUnit.removeEmptyElement();
}
@Override
public void createControls(ICdmFormElement element, int style) {
comboMeasurementUnit = formFactory.createDefinedTermComboElementDto(TermType.MeasurementUnit, element, "Measurement unit", null, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(TermDto entity) {
this.entity = entity;
-// if(entity.getId()!=0){
+ if(comboMeasurementUnit != null){
comboMeasurementUnit.setSelectionDto(entity);
comboMeasurementUnit.removeEmptyElement();
-// }
+ }
}
@Override
@Override
public void createControls(ICdmFormElement element, int style) {
comboStateVocabulary = formFactory.createVocabularyComboElement(TermType.Modifier, "Modifier Vocabulary", null, element, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(TermVocabularyDto entity) {
this.entity = entity;
-// if(entity.getId()!=0){
+ if(comboStateVocabulary != null){
comboStateVocabulary.setSelectionDto(entity);
comboStateVocabulary.removeEmptyElement();
-// }
+ }
}
@Override
public void createControls(ICdmFormElement element, int style) {
comboStateVocabulary = formFactory.createVocabularyComboElement(TermType.Modifier, "Modifier Vocabulary", null, element, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(TermVocabulary<DefinedTerm> entity) {
this.entity = entity;
- if(entity.getId()!=0){
+ if(entity.getId()!=0 && comboStateVocabulary != null){
comboStateVocabulary.setSelection(entity);
comboStateVocabulary.removeEmptyElement();
}
@Override
public void createControls(ICdmFormElement element, int style) {
comboStateVocabulary = formFactory.createVocabularyComboElement(TermType.State, "State vocabulary", null, element, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(TermVocabulary<State> entity) {
this.entity = entity;
- if(entity.getId()!=0){
+ if(entity.getId()!=0 && comboStateVocabulary != null){
comboStateVocabulary.setSelection(entity);
comboStateVocabulary.removeEmptyElement();
}
@Override
public void createControls(ICdmFormElement element, int style) {
comboStateVocabulary = formFactory.createVocabularyDtoComboElement(TermType.State, "State vocabulary", null, element, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(TermVocabularyDto entity) {
this.entity = entity;
-// if(entity.getId()!=0){
+ if(comboStateVocabulary != null){
comboStateVocabulary.setSelectionDto(entity);
comboStateVocabulary.removeEmptyElement();
-// }
+ }
}
@Override
@Override
public void createControls(ICdmFormElement element, int style) {
comboStatisticalMeasure = formFactory.createDefinedTermComboElementDto(TermType.StatisticalMeasure, element, "Statistical measure", null, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(StatisticalMeasure entity) {
this.entity = entity;
- if(entity.getId()!=0){
+ if(entity.getId()!=0 && comboStatisticalMeasure != null){
comboStatisticalMeasure.setSelection(entity);
comboStatisticalMeasure.removeEmptyElement();
}
@Override
public void createControls(ICdmFormElement element, int style) {
comboStatisticalMeasure = formFactory.createDefinedTermComboElementDto(TermType.StatisticalMeasure, element, "Statistical measure", null, style);
+ if (entity != null){
+ setEntity(entity);
+ }
}
@Override
public void setEntity(TermDto entity) {
this.entity = entity;
-// if(entity.getId()!=0){
+ if(comboStatisticalMeasure != null){
comboStatisticalMeasure.setSelectionDto(entity);
comboStatisticalMeasure.removeEmptyElement();
-// }
+ }
}
@Override
import eu.etaxonomy.taxeditor.store.UsageTermCollection;
import eu.etaxonomy.taxeditor.termtree.e4.ICharacterEditor;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
import eu.etaxonomy.taxeditor.ui.element.RootElement;
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
createTeamOrPersonBaseDetailSection(rootElement);
} else if (input instanceof DescriptionBase) {
- if (((DescriptionBase)input).isComputed() && PreferencesUtil.isComputedDesciptionHandlingDisabled()){
+ if ((((DescriptionBase)input).isComputed() || ((DescriptionBase)input).isCloneForSource())&& PreferencesUtil.isComputedDesciptionHandlingDisabled()){
this.setDetailsEnabled(false);
}
if(input instanceof SpecimenDescription){
}else{
descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionElementSourceSection.class, getInput().getClass().getCanonicalName()) );
descriptionElementSourceSection.setEnabled(this.detailsEnabled);
- descriptionElementDetailSection.setEnabled(this.detailsEnabled);
+
}
if(activePart==thisPart){
return;
}
- setEnabled(true);
+// setEnabled(true);
Object partObject = createPartObject(activePart);
if(partObject instanceof IPartContentHasSupplementalData) {
+ setEnabled(true);
IStructuredSelection structuredSelection = createSelection(selection);
if(structuredSelection==null || structuredSelection.isEmpty()){
else if(structuredSelection.getFirstElement() instanceof DescriptionElementBase ){
structuredSelection = new StructuredSelection((structuredSelection.getFirstElement()));
- if (((DescriptionElementBase)structuredSelection.getFirstElement()).getInDescription() != null && ((DescriptionElementBase)structuredSelection.getFirstElement()).getInDescription().isComputed()){
+ if (((DescriptionElementBase)structuredSelection.getFirstElement()).getInDescription() != null && (((DescriptionElementBase)structuredSelection.getFirstElement()).getInDescription().isComputed() || ((DescriptionElementBase)structuredSelection.getFirstElement()).getInDescription().isCloneForSource())){
if (PreferencesUtil.isComputedDesciptionHandlingDisabled()){
setEnabled(false);
}else{
}
else if(structuredSelection.getFirstElement() instanceof DescriptionBase ){
- if (((DescriptionBase)structuredSelection.getFirstElement()).isComputed()){
+ if (((DescriptionBase)structuredSelection.getFirstElement()).isComputed() || ((DescriptionBase)structuredSelection.getFirstElement()).isCloneForSource()){
if (PreferencesUtil.isComputedDesciptionHandlingDisabled()){
setEnabled(false);
}else{
addPart(annotationSection);
addPart(markerSection);
+
}
private void createIdentifiableSections(RootElement parent) {
public static Identifier getCurrentSampleDesignation(CdmBase entity) {
if(entity.isInstanceOf(DnaSample.class)){
DnaSample dnaSample = HibernateProxyHelper.deproxy(entity, DnaSample.class);
- dnaSample.getIdentifier(DefinedTerm.uuidSampleDesignation);
+ return dnaSample.getIdentifier(DefinedTerm.uuidSampleDesignation);
}
else if(entity.isInstanceOf(Sequence.class)){
Sequence sequence = HibernateProxyHelper.deproxy(entity, Sequence.class);
List<TermSearchResult> searchResults = new ArrayList<>();
if(CdmUtils.isNotBlank(searchString)){
TermType type = term!= null ? term.getTermType():null;
- Collection<TermDto> dtos = CdmStore.getService(ITermService.class).findByTitleAsDto(searchString, type);
+ Collection<TermDto> dtos = CdmStore.getService(ITermService.class).findByTitleAsDtoWithVocDto(searchString, type);
dtos.remove(term);
dtos.stream().forEach(dto->searchResults.add(new TermSearchResult(dto)));
if (page != null){
Bundle-ManifestVersion: 2
Bundle-Name: eu.etaxonomy.taxeditor.test
Bundle-SymbolicName: eu.etaxonomy.taxeditor.test;singleton:=true
-Bundle-Version: 5.27.0
+Bundle-Version: 5.28.0
Bundle-ActivationPolicy: lazy
Bundle-Vendor: EDIT
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.27.0</version>
+ <version>5.28.0</version>
</parent>
<artifactId>eu.etaxonomy.taxeditor.test</artifactId>
<!-- for packaging=eclipse-test-plugin
}
}
- @Ignore // this should be targetting integration or production
+ @Ignore // this should be targeting integration or production
@Test
public void pingInstancesTest() {
CdmServerInfo csii = new CdmServerInfo(new CdmServerInfoConfig("edit-test", "test.e-taxonomy.eu", 8080, "cdmserver/", false));
}
}
- @Ignore // this should be targetting integration or production
+ @Ignore // this should be targeting integration or production
@Test
public void refreshInstancesTest() throws CdmServerException {
CdmServerInfo cdmServerInfo = new CdmServerInfo(new CdmServerInfoConfig("edit-test", "test.e-taxonomy.eu", 8080, "cdmserver/", false));
eu.etaxonomy.taxeditor.workbench.datasource,
eu.etaxonomy.taxeditor.workbench.part
Bundle-Name: Workbench Bundle
-Bundle-Version: 5.27.0
+Bundle-Version: 5.28.0
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.e4.ui.workbench,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.27.0</version>
+ <version>5.28.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<?xml version="1.0" encoding="UTF-8"?>
-<?pde version="3.5"?><product application="eu.etaxonomy.taxeditor.application.application" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" includeLaunchers="true" name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product" useFeatures="true" version="5.27.0">
+<?pde version="3.5"?><product application="eu.etaxonomy.taxeditor.application.application" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" includeLaunchers="true" name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product" useFeatures="true" version="5.28.0">
<aboutInfo>
<image path="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
<text>
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.27.0</version>
+ <version>5.28.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
</prerequisites>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>5.27.0</version>
+ <version>5.28.0</version>
<name>EDIT Taxonomic Editor</name>
<description>The Taxonomic Editor for EDIT's platform for
cybertaxonomy
<properties>
<java.codelevel>1.8</java.codelevel>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <cdmlib.version>5.27.0</cdmlib.version>
+ <cdmlib.version>5.28.0</cdmlib.version>
<!-- TODO can we use project.version ????? -->
<!-- Increasing tycho above 0.22.0 will fail for the macosx build because
for higher version numbers tycho needs to be build against Eclipse Mars or
higher -->
<tycho.version>1.0.0</tycho.version>
- <taxeditor.version>5.27.0</taxeditor.version>
+ <taxeditor.version>5.28.0</taxeditor.version>
<update.dir>snapshot</update.dir>
<log4j.version>1.2.17</log4j.version>
<httpcomponents.version>4.5.12</httpcomponents.version>