diff --git a/chemclipse/plugins/org.eclipse.chemclipse.pcr.model/META-INF/MANIFEST.MF b/chemclipse/plugins/org.eclipse.chemclipse.pcr.model/META-INF/MANIFEST.MF index 708e10d11e..df190a8d9e 100644 --- a/chemclipse/plugins/org.eclipse.chemclipse.pcr.model/META-INF/MANIFEST.MF +++ b/chemclipse/plugins/org.eclipse.chemclipse.pcr.model/META-INF/MANIFEST.MF @@ -14,4 +14,5 @@ Require-Bundle: org.eclipse.core.runtime, Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Export-Package: org.eclipse.chemclipse.pcr.model.comparators, - org.eclipse.chemclipse.pcr.model.core + org.eclipse.chemclipse.pcr.model.core, + org.eclipse.chemclipse.pcr.model.core.support diff --git a/chemclipse/plugins/org.eclipse.chemclipse.pcr.model/src/org/eclipse/chemclipse/pcr/model/core/Position.java b/chemclipse/plugins/org.eclipse.chemclipse.pcr.model/src/org/eclipse/chemclipse/pcr/model/core/Position.java index 672275d3ec..3b1361b82d 100644 --- a/chemclipse/plugins/org.eclipse.chemclipse.pcr.model/src/org/eclipse/chemclipse/pcr/model/core/Position.java +++ b/chemclipse/plugins/org.eclipse.chemclipse.pcr.model/src/org/eclipse/chemclipse/pcr/model/core/Position.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018 Lablicate GmbH. + * Copyright (c) 2018, 2021 Lablicate GmbH. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -22,10 +22,12 @@ public class Position implements Comparable { private Pattern pattern = Pattern.compile("([a-zA-Z]*)(\\d*)"); public Position() { + this("", 0); } public Position(String row, int column) { + this.row = row; this.column = column; } @@ -107,7 +109,7 @@ public boolean equals(Object obj) { @Override public String toString() { - return "Position [row=" + row + ", column=" + column + "]"; + return row + column; } @Override diff --git a/chemclipse/plugins/org.eclipse.chemclipse.pcr.model/src/org/eclipse/chemclipse/pcr/model/core/support/LabelSetting.java b/chemclipse/plugins/org.eclipse.chemclipse.pcr.model/src/org/eclipse/chemclipse/pcr/model/core/support/LabelSetting.java new file mode 100644 index 0000000000..80f0f3b55d --- /dev/null +++ b/chemclipse/plugins/org.eclipse.chemclipse.pcr.model/src/org/eclipse/chemclipse/pcr/model/core/support/LabelSetting.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2021 Lablicate GmbH. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Matthias Mailänder - initial API and implementation + *******************************************************************************/ +package org.eclipse.chemclipse.pcr.model.core.support; + +public enum LabelSetting { + SAMPLENAME("Sample ID"), // + COORDINATE("Coordinate"), // + COORDINATE_SAMPLENAME("Coordinate + Sample ID"); // + + private String label = ""; + + private LabelSetting(String label) { + + this.label = label; + } + + public String getLabel() { + + return label; + } + + public static String[][] getOptions() { + + LabelSetting[] labelSettings = values(); + String[][] elements = new String[labelSettings.length][2]; + // + int counter = 0; + for(LabelSetting labelSetting : labelSettings) { + elements[counter][0] = labelSetting.getLabel(); + elements[counter][1] = labelSetting.name(); + counter++; + } + // + return elements; + } +} diff --git a/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/preferences/PreferenceConstants.java b/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/preferences/PreferenceConstants.java index 9c4e42b6a8..92583ee722 100644 --- a/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/preferences/PreferenceConstants.java +++ b/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/preferences/PreferenceConstants.java @@ -15,6 +15,7 @@ import org.eclipse.chemclipse.model.core.support.HeaderField; import org.eclipse.chemclipse.model.traces.NamedTraceUtil; import org.eclipse.chemclipse.msd.model.support.CalculationType; +import org.eclipse.chemclipse.pcr.model.core.support.LabelSetting; import org.eclipse.chemclipse.swt.ui.support.Colors; import org.eclipse.chemclipse.ux.extension.ui.support.PartSupport; import org.eclipse.swt.SWT; @@ -780,6 +781,8 @@ public class PreferenceConstants extends ChartOptions { public static final String DEF_PCR_COLOR_CODES = ""; public static final String P_PCR_SAVE_AS_FOLDER = "pcrSaveAsFolder"; public static final String DEF_PCR_SAVE_AS_FOLDER = ""; + public static final String P_PCR_REFERENCE_LABEL = "pcrReferenceLabel"; + public static final String DEF_PCR_REFERENCE_LABEL = LabelSetting.COORDINATE_SAMPLENAME.name(); /* * Processor */ diff --git a/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/preferences/PreferenceInitializer.java b/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/preferences/PreferenceInitializer.java index dbe16c4673..b11c3c5d02 100644 --- a/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/preferences/PreferenceInitializer.java +++ b/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/preferences/PreferenceInitializer.java @@ -252,6 +252,7 @@ public void initializeDefaultPreferences() { store.setDefault(PreferenceConstants.P_PCR_DEFAULT_COLOR, PreferenceConstants.DEF_PCR_DEFAULT_COLOR); store.setDefault(PreferenceConstants.P_PCR_COLOR_CODES, PreferenceConstants.DEF_PCR_COLOR_CODES); store.setDefault(PreferenceConstants.P_PCR_SAVE_AS_FOLDER, PreferenceConstants.DEF_PCR_SAVE_AS_FOLDER); + store.setDefault(PreferenceConstants.P_PCR_REFERENCE_LABEL, PreferenceConstants.DEF_PCR_REFERENCE_LABEL); /* * Molecule(s) */ diff --git a/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/preferences/PreferencePagePCR.java b/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/preferences/PreferencePagePCR.java index cb7ef659e4..11cfb1cab7 100644 --- a/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/preferences/PreferencePagePCR.java +++ b/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/preferences/PreferencePagePCR.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2019 Lablicate GmbH. + * Copyright (c) 2018, 2021 Lablicate GmbH. * * All rights reserved. * This program and the accompanying materials are made available under the @@ -8,12 +8,16 @@ * * Contributors: * Dr. Philip Wenig - initial API and implementation + * Matthias Mailänder - add a reference label setting *******************************************************************************/ package org.eclipse.chemclipse.ux.extension.xxd.ui.preferences; +import org.eclipse.chemclipse.pcr.model.core.support.LabelSetting; +import org.eclipse.chemclipse.support.ui.preferences.fieldeditors.SpacerFieldEditor; import org.eclipse.chemclipse.ux.extension.xxd.ui.Activator; import org.eclipse.chemclipse.ux.extension.xxd.ui.fieldeditors.ColorCodesFieldEditor; import org.eclipse.jface.preference.ColorFieldEditor; +import org.eclipse.jface.preference.ComboFieldEditor; import org.eclipse.jface.preference.FieldEditorPreferencePage; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; @@ -30,6 +34,8 @@ public PreferencePagePCR() { public void createFieldEditors() { + addField(new ComboFieldEditor(PreferenceConstants.P_PCR_REFERENCE_LABEL, "Reference Label:", LabelSetting.getOptions(), getFieldEditorParent())); + addField(new SpacerFieldEditor(getFieldEditorParent())); addField(new ColorFieldEditor(PreferenceConstants.P_PCR_DEFAULT_COLOR, "Default Line Color:", getFieldEditorParent())); addField(new ColorCodesFieldEditor(PreferenceConstants.P_PCR_COLOR_CODES, "Color Codes", getFieldEditorParent())); } diff --git a/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/swt/ExtendedPlateChartsUI.java b/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/swt/ExtendedPlateChartsUI.java index 0b3c256af9..1966264a19 100644 --- a/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/swt/ExtendedPlateChartsUI.java +++ b/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/swt/ExtendedPlateChartsUI.java @@ -23,6 +23,7 @@ import org.eclipse.chemclipse.pcr.model.core.IChannel; import org.eclipse.chemclipse.pcr.model.core.IPlate; import org.eclipse.chemclipse.pcr.model.core.IWell; +import org.eclipse.chemclipse.pcr.model.core.support.LabelSetting; import org.eclipse.chemclipse.rcp.ui.icons.core.ApplicationImageFactory; import org.eclipse.chemclipse.rcp.ui.icons.core.IApplicationImage; import org.eclipse.chemclipse.swt.ui.components.InformationUI; @@ -158,8 +159,8 @@ private void createToolbarMain(Composite parent) { buttonToolbarInfo = createButtonToggleToolbar(composite, toolbarInfo, IMAGE_INFO, TOOLTIP_INFO); createButtonToggleChartLegend(composite, chartControl, IMAGE_LEGEND); createResetButton(composite); - createSettingsButton(composite); createColorCompensationButton(composite); + createSettingsButton(composite); } private void createSettingsButton(Composite parent) { @@ -257,8 +258,9 @@ private void updateChart() { try { int channelNumber = comboChannels.getSelectionIndex(); IChannel channel = well.getChannels().get(channelNumber); + String label = getLabel(well); Color color = getWellColor(well, colorCodes); - ILineSeriesData lineSeriesData = extractChannel(channel, Integer.toString(well.getPosition().getId() + 1), color); + ILineSeriesData lineSeriesData = getLineSeriesData(well, channel, label, color); if(lineSeriesData != null) { lineSeriesDataList.add(lineSeriesData); } @@ -271,6 +273,29 @@ private void updateChart() { } } + private String getLabel(IWell well) { + + LabelSetting labelSetting = getLabelSetting(); + switch(labelSetting) { + case SAMPLENAME: + return well.getSampleId(); + case COORDINATE: + return well.getPosition().toString(); + case COORDINATE_SAMPLENAME: + default: + return well.getPosition().toString() + ": " + well.getSampleId(); + } + } + + private LabelSetting getLabelSetting() { + + try { + return LabelSetting.valueOf(preferenceStore.getString(PreferenceConstants.P_PCR_REFERENCE_LABEL)); + } catch(Exception e) { + return LabelSetting.COORDINATE_SAMPLENAME; + } + } + private Color getWellColor(IWell well, ColorCodes colorCodes) { String sampleSubset = well.getSampleSubset(); @@ -284,7 +309,7 @@ private Color getWellColor(IWell well, ColorCodes colorCodes) { } } - private ILineSeriesData extractChannel(IChannel channel, String position, Color color) { + private ILineSeriesData getLineSeriesData(IWell well, IChannel channel, String description, Color color) { ILineSeriesData lineSeriesData = null; if(channel != null) { @@ -294,11 +319,13 @@ private ILineSeriesData extractChannel(IChannel channel, String position, Color points[index] = pointList.get(index); } // - ISeriesData seriesData = new SeriesData(points, "Position: " + position + " | Channel: " + channel.getId()); + String position = Integer.toString(well.getPosition().getId() + 1); + ISeriesData seriesData = new SeriesData(points, position); lineSeriesData = new LineSeriesData(seriesData); ILineSeriesSettings lineSeriesSettings = lineSeriesData.getSettings(); lineSeriesSettings.setLineColor(color); lineSeriesSettings.setEnableArea(false); + lineSeriesSettings.setDescription(description); } return lineSeriesData; } diff --git a/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/swt/ExtendedWellChartUI.java b/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/swt/ExtendedWellChartUI.java index fccdec88c8..670c5a2cde 100644 --- a/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/swt/ExtendedWellChartUI.java +++ b/chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/swt/ExtendedWellChartUI.java @@ -148,8 +148,8 @@ private void createToolbarMain(Composite parent) { buttonToolbarInfo = createButtonToggleToolbar(composite, toolbarInfo, IMAGE_INFO, TOOLTIP_INFO); createButtonToggleChartLegend(composite, chartControl, IMAGE_LEGEND); createResetButton(composite); - createSettingsButton(composite); createColorCompensationButton(composite); + createSettingsButton(composite); } private void createColorCompensationButton(Composite parent) { @@ -300,7 +300,7 @@ private ILineSeriesData getChannelCurve(IChannel channel, Color color) { for(int index = 0; index < pointList.size(); index++) { points[index] = pointList.get(index); } - ISeriesData seriesData = new SeriesData(points, "Channel " + channel.getId()); + ISeriesData seriesData = new SeriesData(points, channel.getDetectionName()); lineSeriesData = new LineSeriesData(seriesData); ILineSeriesSettings lineSeriesSettings = lineSeriesData.getSettings(); lineSeriesSettings.setLineColor(color);