*/
package eu.etaxonomy.taxeditor.ui.section.name.type;
+
import java.util.Collection;
import java.util.stream.Collectors;
import org.eclipse.jface.wizard.Wizard;
+import eu.etaxonomy.cdm.common.URI;
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
import eu.etaxonomy.cdm.model.name.TaxonName;
private SpecimenTypeDesignationStatus typeStatus;
+ private URI stableIdentifier;
+
public CloneTypeWizard(TaxonName taxonName) {
this.taxonName = taxonName;
this.typeDesignations = taxonName.getTypeDesignations().stream()
this.catalogNumber = page.getCatalogNumber();
this.collection = page.getCollection();
this.typeStatus = page.getTypeStatus();
+ this.stableIdentifier = page.getStableIdentifier();
return true;
}
return typeStatus;
}
+ public URI getStableIdentifier() {
+ return stableIdentifier;
+ }
+
+ public void setStableIdentifier(URI stableIdentifier) {
+ this.stableIdentifier = stableIdentifier;
+ }
+
}
*/
package eu.etaxonomy.taxeditor.ui.section.name.type;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
+import eu.etaxonomy.cdm.common.URI;
import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.ImageResources;
import eu.etaxonomy.taxeditor.ui.combo.term.TermUuidComboViewer;
* @since Mar 13, 2019
*
*/
-public class CloneTypeWizardComposite extends Composite {
+public class CloneTypeWizardComposite extends Composite implements ModifyListener{
private Text txtAccNumber;
private Text txtCollection;
private Button btnBrowseCollection;
private ComboViewer comboViewerBaseType;
private Text textBarcode;
private Text textCatalogNumber;
+ private Text textStableIdentifier;
+ private Label labelException;
+ private URI stableIdentifier;
/**
* Create the composite.
comboTypeStatus.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
comboTypeStatus.setInput(TermType.SpecimenTypeDesignationStatus);
+ Label lblNewLabel_stableIdentifier = new Label(this, SWT.NONE);
+ lblNewLabel_stableIdentifier.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblNewLabel_stableIdentifier.setText("Stable Identifier");
+
+ textStableIdentifier = new Text(this, SWT.BORDER);
+ textStableIdentifier.setEnabled(true);
+ textStableIdentifier.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
+ textStableIdentifier.addModifyListener(this);
+
+
}
@Override
public Text getTextCatalogNumber() {
return textCatalogNumber;
}
+
+ public URI getStableIdentifier() {
+ return stableIdentifier;
+ }
+
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ if (e.getSource().equals(textStableIdentifier)){
+ try{
+ stableIdentifier = URI.create(textStableIdentifier.getText());
+ if (labelException != null){
+ labelException.setText("");
+ }
+ }catch(IllegalArgumentException ex){
+ if (labelException == null){
+ labelException = new Label(this, SWT.WRAP); //$NON-NLS-1$
+ labelException.setBackground(this.getBackground());
+ labelException.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
+ labelException.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
+ labelException.requestLayout();
+ labelException.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
+ }
+ labelException.setText(Messages.UriWithLabelElement_URL_NOT_SAVED + ex.getLocalizedMessage());
+
+ stableIdentifier = null;
+ }
+ }
+
+ }
}