Skip to content

Commit ac91f1e

Browse files
Ensure that the orcid is overwritten if manual input is provided
1 parent a949972 commit ac91f1e

File tree

1 file changed

+19
-4
lines changed
  • user-interface/src/main/java/life/qbic/datamanager/views/general/contact

1 file changed

+19
-4
lines changed

user-interface/src/main/java/life/qbic/datamanager/views/general/contact/ContactField.java

+19-4
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ public class ContactField extends CustomField<Contact> implements HasClientValid
2525

2626
public static final String GAP_M_CSS = "gap-m";
2727
private static final String FULL_WIDTH_CSS = "full-width";
28+
private static final Logger log = logger(ContactField.class);
2829
private final TextField fullName;
2930
private final TextField email;
3031
private final Checkbox setMyselfCheckBox;
3132
protected transient ComboBox<Contact> orcidSelection;
3233
private Contact myself;
3334
private boolean isOptional = true;
34-
private static final Logger log = logger(ContactField.class);
3535

3636
private ContactField(String label, PersonLookupService personLookupService) {
3737
this.fullName = withErrorMessage(withPlaceHolder(new TextField(), "Please provide a name"),
@@ -45,12 +45,27 @@ private ContactField(String label, PersonLookupService personLookupService) {
4545
add(layoutFields(setMyselfCheckBox, layoutFields(fullName, email)), orcidSelection);
4646
hideCheckbox(); // default is to hide the set myself checkbox
4747
setMyselfCheckBox.addValueChangeListener(listener -> {
48+
orcidSelection.setValue(null);
4849
if (isChecked(listener.getSource())) {
4950
loadContact(this, myself);
5051
}
5152
});
52-
fullName.addValueChangeListener(listener -> updateValue());
53-
email.addValueChangeListener(listener -> updateValue());
53+
fullName.addValueChangeListener(listener ->
54+
{
55+
//We need to make sure that the orcid information within the orcid selection is reset as soon as manual entry has begun
56+
if (listener.isFromClient()) {
57+
orcidSelection.setValue(null);
58+
}
59+
updateValue();
60+
});
61+
email.addValueChangeListener(listener ->
62+
{
63+
//We need to make sure that the orcid information within the orcid selection is reset as soon as manual entry has begun
64+
if (listener.isFromClient()) {
65+
orcidSelection.setValue(null);
66+
}
67+
updateValue();
68+
});
5469
}
5570

5671
private static void loadContact(ContactField field, Contact contact) {
@@ -235,7 +250,7 @@ private void addOidcInfoItem(OidcType oidcType, String oidc) {
235250
oidcLink.setTarget(AnchorTarget.BLANK);
236251
OidcLogo oidcLogo = new OidcLogo(oidcType);
237252
Span oidcSpan = new Span(oidcLogo, oidcLink);
238-
oidcSpan.addClassNames("gap-02", "icon-content-center");
253+
oidcSpan.addClassNames("gap-02", "flex-align-items-center", "flex-horizontal");
239254
add(oidcSpan);
240255
}
241256
}

0 commit comments

Comments
 (0)