minor fixes on GUI
This commit is contained in:
parent
9edce943b2
commit
3450eda4f2
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.BasicTabPanel;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.BasicTabPanel;
|
||||||
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.ui.BasicTabPanel.PAGER;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.Ckan2ZenodoViewManager;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.Ckan2ZenodoViewManager;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.FormValidator;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.FormValidator;
|
||||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.LoaderIcon;
|
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.view.LoaderIcon;
|
||||||
|
@ -147,7 +148,7 @@ public class CkanToZendoPublisherWidget {
|
||||||
erroLabel.setClose(false);
|
erroLabel.setClose(false);
|
||||||
erroLabel.setType(AlertType.ERROR);
|
erroLabel.setType(AlertType.ERROR);
|
||||||
erroLabel.setText(caught.getLocalizedMessage());
|
erroLabel.setText(caught.getLocalizedMessage());
|
||||||
modal.add(erroLabel);
|
modalFooter.add(erroLabel);
|
||||||
Button close = new Button("Close");
|
Button close = new Button("Close");
|
||||||
close.addClickHandler(new ClickHandler() {
|
close.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@ -161,14 +162,39 @@ public class CkanToZendoPublisherWidget {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String result) {
|
public void onSuccess(String result) {
|
||||||
buttonPublish.setEnabled(true);
|
buttonPublish.setEnabled(false);
|
||||||
basicTabPanel.getElement().getStyle().setOpacity(1.0);
|
basicTabPanel.getElement().getStyle().setOpacity(1.0);
|
||||||
|
try {
|
||||||
modalFooter.remove(loaderPublishing);
|
modalFooter.remove(loaderPublishing);
|
||||||
String msg = "Publishing: \n\n"+result+"\n\nIs it right?";
|
}catch (Exception e) {
|
||||||
Window.alert(msg);
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
String msg = "The item has been uploaded to Zenodo correctly";
|
||||||
|
|
||||||
|
Alert infoLabel = new Alert();
|
||||||
|
infoLabel.setClose(false);
|
||||||
|
infoLabel.setType(AlertType.INFO);
|
||||||
|
infoLabel.setText(msg);
|
||||||
|
modalFooter.add(infoLabel);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}else {
|
||||||
|
basicTabPanel.managePager(PAGER.BACK); //TO SHOW THE FIELD MISSING
|
||||||
|
// Alert infoLabel = new Alert(true);
|
||||||
|
// infoLabel.setAnimation(true);
|
||||||
|
// infoLabel.set
|
||||||
|
// infoLabel.setType(AlertType.WARNING);
|
||||||
|
// infoLabel.setText("Please, check your inputs, a required field is missing...");
|
||||||
|
// modalFooter.add(infoLabel);
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// Alert infoLabel = new Alert();
|
||||||
|
// infoLabel.setClose(false);
|
||||||
|
// infoLabel.setType(AlertType.WARNING);
|
||||||
|
// infoLabel.setText("Please, check your inputs, a required field is missing...");
|
||||||
|
// modalFooter.add(infoLabel);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -114,11 +114,18 @@ public class BasicTabPanel extends Composite {
|
||||||
int selectTab = tabPanel.getSelectedTab();
|
int selectTab = tabPanel.getSelectedTab();
|
||||||
GWT.log("selectTab tab: "+selectTab);
|
GWT.log("selectTab tab: "+selectTab);
|
||||||
GWT.log("tabPanel.getWidgetCount(): "+tabPanel.getWidgetCount());
|
GWT.log("tabPanel.getWidgetCount(): "+tabPanel.getWidgetCount());
|
||||||
|
int totatTab = tabPanel.getWidgetCount()-1;
|
||||||
|
|
||||||
checkPagerVisibility(selectTab);
|
checkPagerVisibility(selectTab);
|
||||||
|
|
||||||
if(direction!=null) {
|
if(direction!=null) {
|
||||||
int newSelectTabIndex = direction.equals(PAGER.BACK)?selectTab-1:selectTab+1;
|
int newSelectTabIndex = direction.equals(PAGER.BACK)?selectTab-1:selectTab+1;
|
||||||
|
//Checking boundary
|
||||||
|
if(newSelectTabIndex<=0)
|
||||||
|
newSelectTabIndex = 0;
|
||||||
|
if(newSelectTabIndex>totatTab)
|
||||||
|
newSelectTabIndex = totatTab;
|
||||||
|
|
||||||
GWT.log("newSelectTabIndex: "+newSelectTabIndex);
|
GWT.log("newSelectTabIndex: "+newSelectTabIndex);
|
||||||
tabPanel.selectTab(newSelectTabIndex);
|
tabPanel.selectTab(newSelectTabIndex);
|
||||||
checkPagerVisibility(newSelectTabIndex);
|
checkPagerVisibility(newSelectTabIndex);
|
||||||
|
|
|
@ -108,11 +108,11 @@ public class CreatorView extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(userRole.toLowerCase().startsWith("creator")) {
|
if(userRole.toLowerCase().startsWith("creator")) {
|
||||||
InfoTextAndLabels.addFieldDescriptionInfo("creators", field_cl_author);
|
InfoTextAndLabels.addTooltipForFieldKey("creators", field_cl_author);
|
||||||
}else if(userRole.toLowerCase().startsWith("contributor")) {
|
}else if(userRole.toLowerCase().startsWith("contributor")) {
|
||||||
InfoTextAndLabels.addFieldDescriptionInfo("contributors", field_cl_author);
|
InfoTextAndLabels.addTooltipForFieldKey("contributors", field_cl_author);
|
||||||
}else {
|
}else {
|
||||||
InfoTextAndLabels.addFieldDescriptionInfo("authors", field_cl_author);
|
InfoTextAndLabels.addTooltipForFieldKey("authors", field_cl_author);
|
||||||
}
|
}
|
||||||
|
|
||||||
GWT.log("Created creator view with author: "+this.author);
|
GWT.log("Created creator view with author: "+this.author);
|
||||||
|
|
|
@ -227,7 +227,7 @@ public class CreatorsFormView extends Composite implements FormValidator{
|
||||||
boolean isValid = FieldUtil.isValidValue(value);
|
boolean isValid = FieldUtil.isValidValue(value);
|
||||||
if(!isValid) {
|
if(!isValid) {
|
||||||
FieldUtil.setControlGroup(cgAuthor, ControlGroupType.ERROR);
|
FieldUtil.setControlGroup(cgAuthor, ControlGroupType.ERROR);
|
||||||
return "The Name is required";
|
return "The field "+userRole+" Name is required";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -254,16 +254,21 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
private void fillForm() {
|
private void fillForm() {
|
||||||
|
|
||||||
field_title.setValue(zenodoItem.getTitle());
|
field_title.setValue(zenodoItem.getTitle());
|
||||||
InfoTextAndLabels.addFieldDescriptionInfo("title", cl_title);
|
InfoTextAndLabels.addTooltipForFieldKey("title", cl_title);
|
||||||
field_description.setValue(zenodoItem.getMetadata().getDescription());
|
field_description.setValue(zenodoItem.getMetadata().getDescription());
|
||||||
InfoTextAndLabels.addFieldDescriptionInfo("description", cl_description);
|
InfoTextAndLabels.addTooltipForFieldKey("description", cl_description);
|
||||||
field_doi.setValue(zenodoItem.getDoi().toString());
|
field_doi.setValue(zenodoItem.getDoi());
|
||||||
|
|
||||||
ZenodoMetadata zMeta = zenodoItem.getMetadata();
|
ZenodoMetadata zMeta = zenodoItem.getMetadata();
|
||||||
if (zMeta != null) {
|
if (zMeta != null) {
|
||||||
|
|
||||||
String title = zenodoItem.getTitle() != null ? zenodoItem.getTitle() : zMeta.getTitle();
|
String title = zenodoItem.getTitle() != null ? zenodoItem.getTitle() : zMeta.getTitle();
|
||||||
field_title.setValue(title); // Re.fill title to be sure
|
field_title.setValue(title); // Re.fill title to be sure
|
||||||
|
|
||||||
|
if(zMeta.getPublication_date()!=null) {
|
||||||
|
field_publication_date.setValue(zenodoItem.getMetadata().getPublication_date());
|
||||||
|
}
|
||||||
|
|
||||||
// Upload type
|
// Upload type
|
||||||
if (zMeta.getUpload_type() != null) {
|
if (zMeta.getUpload_type() != null) {
|
||||||
FieldUtil.addValuesToListBox(field_upload_type, zMeta.getUpload_type().getSelectableValues());
|
FieldUtil.addValuesToListBox(field_upload_type, zMeta.getUpload_type().getSelectableValues());
|
||||||
|
@ -271,7 +276,7 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
} else
|
} else
|
||||||
field_upload_type.setEnabled(false);
|
field_upload_type.setEnabled(false);
|
||||||
|
|
||||||
InfoTextAndLabels.addFieldDescriptionInfo("upload_type", cl_upload_type);
|
InfoTextAndLabels.addTooltipForFieldKey("upload_type", cl_upload_type);
|
||||||
|
|
||||||
// Publication Type
|
// Publication Type
|
||||||
if (zMeta.getPublication_type() != null) {
|
if (zMeta.getPublication_type() != null) {
|
||||||
|
@ -284,7 +289,7 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
} else
|
} else
|
||||||
cg_publication_type.setVisible(false);
|
cg_publication_type.setVisible(false);
|
||||||
|
|
||||||
InfoTextAndLabels.addFieldDescriptionInfo("publication_type", cl_publication_type);
|
InfoTextAndLabels.addTooltipForFieldKey("publication_type", cl_publication_type);
|
||||||
|
|
||||||
if(zMeta.getImage_type() != null) {
|
if(zMeta.getImage_type() != null) {
|
||||||
FieldUtil.addValuesToListBox(field_image_type, zMeta.getImage_type().getSelectableValues());
|
FieldUtil.addValuesToListBox(field_image_type, zMeta.getImage_type().getSelectableValues());
|
||||||
|
@ -304,7 +309,7 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
} else
|
} else
|
||||||
field_access_right.setEnabled(false);
|
field_access_right.setEnabled(false);
|
||||||
|
|
||||||
InfoTextAndLabels.addFieldDescriptionInfo("access_right", cl_access_right);
|
InfoTextAndLabels.addTooltipForFieldKey("access_right", cl_access_right);
|
||||||
|
|
||||||
if(zMeta.getEmbargo_date()!=null) {
|
if(zMeta.getEmbargo_date()!=null) {
|
||||||
embargoDate.setValue(zMeta.getEmbargo_date());
|
embargoDate.setValue(zMeta.getEmbargo_date());
|
||||||
|
@ -312,14 +317,14 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
}else
|
}else
|
||||||
cg_embargo_date.setVisible(false);
|
cg_embargo_date.setVisible(false);
|
||||||
|
|
||||||
InfoTextAndLabels.addFieldDescriptionInfo("embargo_date", cl_embargo_date);
|
InfoTextAndLabels.addTooltipForFieldKey("embargo_date", cl_embargo_date);
|
||||||
|
|
||||||
if(zMeta.getAccess_conditions()!=null) {
|
if(zMeta.getAccess_conditions()!=null) {
|
||||||
field_access_conditions.setValue(zMeta.getAccess_conditions());
|
field_access_conditions.setValue(zMeta.getAccess_conditions());
|
||||||
}else
|
}else
|
||||||
cg_access_conditions.setVisible(false);
|
cg_access_conditions.setVisible(false);
|
||||||
|
|
||||||
InfoTextAndLabels.addFieldDescriptionInfo("access_conditions", cl_access_conditions);
|
InfoTextAndLabels.addTooltipForFieldKey("access_conditions", cl_access_conditions);
|
||||||
|
|
||||||
// License
|
// License
|
||||||
if (zMeta.getLicenses() != null) {
|
if (zMeta.getLicenses() != null) {
|
||||||
|
@ -339,7 +344,7 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
}else
|
}else
|
||||||
field_license.setEnabled(false);
|
field_license.setEnabled(false);
|
||||||
|
|
||||||
InfoTextAndLabels.addFieldDescriptionInfo("license", cl_license);
|
InfoTextAndLabels.addTooltipForFieldKey("license", cl_license);
|
||||||
|
|
||||||
// Keywords
|
// Keywords
|
||||||
if (zMeta.getKeywords() != null && zMeta.getKeywords().size() > 0) {
|
if (zMeta.getKeywords() != null && zMeta.getKeywords().size() > 0) {
|
||||||
|
@ -410,8 +415,9 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
boolean isValid = FieldUtil.isValidValue(value);
|
boolean isValid = FieldUtil.isValidValue(value);
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
FieldUtil.setControlGroup(cgDOI, ControlGroupType.ERROR);
|
FieldUtil.setControlGroup(cgDOI, ControlGroupType.ERROR);
|
||||||
error_alert.setVisible(true);
|
showErrorAlert(true, "The field DOI is required");
|
||||||
error_alert.setText("This field DOI is required");
|
// error_alert.setVisible(true);
|
||||||
|
// error_alert.setText("This field DOI is required");
|
||||||
return "This field is required";
|
return "This field is required";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -424,8 +430,9 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
GWT.log("isValid: " + isValid);
|
GWT.log("isValid: " + isValid);
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
FieldUtil.setControlGroup(cgTitle, ControlGroupType.ERROR);
|
FieldUtil.setControlGroup(cgTitle, ControlGroupType.ERROR);
|
||||||
error_alert.setVisible(true);
|
showErrorAlert(true, "The field Title is required");
|
||||||
error_alert.setText("The field Title is required");
|
// error_alert.setVisible(true);
|
||||||
|
// error_alert.setText("The field Title is required");
|
||||||
return "This field is required";
|
return "This field is required";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -434,8 +441,9 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
boolean isValid = embargoDate.getValue()!=null;
|
boolean isValid = embargoDate.getValue()!=null;
|
||||||
if(!isValid) {
|
if(!isValid) {
|
||||||
FieldUtil.setControlGroup(cg_embargo_date, ControlGroupType.ERROR);
|
FieldUtil.setControlGroup(cg_embargo_date, ControlGroupType.ERROR);
|
||||||
error_alert.setVisible(true);
|
showErrorAlert(true, "The field Embargo Date is required");
|
||||||
error_alert.setText("The field Embargo Date is required");
|
// error_alert.setVisible(true);
|
||||||
|
// error_alert.setText("The field Embargo Date is required");
|
||||||
return "This field is required";
|
return "This field is required";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -444,8 +452,9 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
boolean isValid = field_access_conditions.getValue()!= null && !field_access_conditions.getValue().isEmpty();
|
boolean isValid = field_access_conditions.getValue()!= null && !field_access_conditions.getValue().isEmpty();
|
||||||
if(!isValid) {
|
if(!isValid) {
|
||||||
FieldUtil.setControlGroup(cg_access_conditions, ControlGroupType.ERROR);
|
FieldUtil.setControlGroup(cg_access_conditions, ControlGroupType.ERROR);
|
||||||
error_alert.setVisible(true);
|
showErrorAlert(true, "The field Access Condition is required");
|
||||||
error_alert.setText("The field Access Condition is required");
|
// error_alert.setVisible(true);
|
||||||
|
// error_alert.setText("The field Access Condition is required");
|
||||||
return "This field is required";
|
return "This field is required";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -454,8 +463,9 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
for (CreatorsFormView cfv : listOfCreatorsView) {
|
for (CreatorsFormView cfv : listOfCreatorsView) {
|
||||||
String error = cfv.validateFormFields();
|
String error = cfv.validateFormFields();
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
error_alert.setVisible(true);
|
// error_alert.setVisible(true);
|
||||||
error_alert.setText(error);
|
// error_alert.setText(error);
|
||||||
|
showErrorAlert(true, error);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -464,8 +474,9 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
for (CreatorsFormView cfv : listOfContributorsView) {
|
for (CreatorsFormView cfv : listOfContributorsView) {
|
||||||
String error = cfv.validateFormFields();
|
String error = cfv.validateFormFields();
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
error_alert.setVisible(true);
|
showErrorAlert(true, error);
|
||||||
error_alert.setText(error);
|
// error_alert.setVisible(true);
|
||||||
|
// error_alert.setText(error);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -473,6 +484,17 @@ public class BasicInformationView extends Composite implements FormValidator {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showErrorAlert(boolean visible, String message) {
|
||||||
|
error_alert.setText(message);
|
||||||
|
error_alert.setVisible(visible);
|
||||||
|
try {
|
||||||
|
error_alert.getElement().focus();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
|
|
@ -40,6 +40,16 @@
|
||||||
</b:TextBox>
|
</b:TextBox>
|
||||||
</b:Controls>
|
</b:Controls>
|
||||||
</b:ControlGroup>
|
</b:ControlGroup>
|
||||||
|
<b:ControlGroup ui:field="cg_publication_date">
|
||||||
|
<b:ControlLabel for="cl_publication_date"
|
||||||
|
ui:field="cl_publication_date">
|
||||||
|
Publication date
|
||||||
|
</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<b2:DateBox format="dd/mm/yyyy" autoClose="true"
|
||||||
|
ui:field="field_publication_date" enabled="false" />
|
||||||
|
</b:Controls>
|
||||||
|
</b:ControlGroup>
|
||||||
<b:ControlGroup ui:field="cg_title">
|
<b:ControlGroup ui:field="cg_title">
|
||||||
<b:ControlLabel for="cl_title" ui:field="cl_title">
|
<b:ControlLabel for="cl_title" ui:field="cl_title">
|
||||||
<font color="red">*</font>
|
<font color="red">*</font>
|
||||||
|
@ -166,16 +176,6 @@
|
||||||
</b:Controls>
|
</b:Controls>
|
||||||
</b:ControlGroup>
|
</b:ControlGroup>
|
||||||
|
|
||||||
<b:ControlGroup ui:field="cg_publication_date">
|
|
||||||
<b:ControlLabel for="cl_publication_date"
|
|
||||||
ui:field="cl_publication_date">
|
|
||||||
Publication date
|
|
||||||
</b:ControlLabel>
|
|
||||||
<b:Controls>
|
|
||||||
<b2:DateBox format="dd/mm/yyyy" autoClose="true"
|
|
||||||
ui:field="field_publication_date" />
|
|
||||||
</b:Controls>
|
|
||||||
</b:ControlGroup>
|
|
||||||
<!-- <b:Label type="INFO" ui:field="label_files" -->
|
<!-- <b:Label type="INFO" ui:field="label_files" -->
|
||||||
<!-- addStyleNames="{style.margin-left-100}" visible="false">File/s</b:Label> -->
|
<!-- addStyleNames="{style.margin-left-100}" visible="false">File/s</b:Label> -->
|
||||||
</b:Fieldset>
|
</b:Fieldset>
|
||||||
|
|
|
@ -91,8 +91,10 @@ public class PublishFileView extends Composite {
|
||||||
public void hideSwitchButton(boolean bool, String msg) {
|
public void hideSwitchButton(boolean bool, String msg) {
|
||||||
if(bool) {
|
if(bool) {
|
||||||
switchButton.setVisible(false);
|
switchButton.setVisible(false);
|
||||||
|
field_file_name.setEnabled(false);
|
||||||
}else {
|
}else {
|
||||||
switchButton.setVisible(true);
|
switchButton.setVisible(true);
|
||||||
|
field_file_name.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
field_label_info.setText(msg);
|
field_label_info.setText(msg);
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class TagsPanel extends Composite{
|
||||||
tagsList.clear();
|
tagsList.clear();
|
||||||
tagsPanel.clear();
|
tagsPanel.clear();
|
||||||
|
|
||||||
InfoTextAndLabels.addFieldDescriptionInfo("keywords", cl_keywords);
|
InfoTextAndLabels.addTooltipForFieldKey("keywords", cl_keywords);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,14 @@ public class InfoTextAndLabels {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addFieldDescriptionInfo(String theFieldKey, Widget widget) {
|
|
||||||
|
/**
|
||||||
|
* Adds the tooltip for field key.
|
||||||
|
*
|
||||||
|
* @param theFieldKey the the field key
|
||||||
|
* @param widget the widget
|
||||||
|
*/
|
||||||
|
public static void addTooltipForFieldKey(String theFieldKey, Widget widget) {
|
||||||
String value = CkanToZendoPublisherWidget.mapOfFieldsDescriptions.get(theFieldKey);
|
String value = CkanToZendoPublisherWidget.mapOfFieldsDescriptions.get(theFieldKey);
|
||||||
if(value!=null) {
|
if(value!=null) {
|
||||||
String caption = theFieldKey.substring(0,1).toUpperCase()+theFieldKey.substring(1,theFieldKey.length());
|
String caption = theFieldKey.substring(0,1).toUpperCase()+theFieldKey.substring(1,theFieldKey.length());
|
||||||
|
@ -163,6 +170,13 @@ public class InfoTextAndLabels {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup popover.
|
||||||
|
*
|
||||||
|
* @param w the w
|
||||||
|
* @param message the message
|
||||||
|
* @param heading the heading
|
||||||
|
*/
|
||||||
public static void setupPopover(Widget w, String message, String heading) {
|
public static void setupPopover(Widget w, String message, String heading) {
|
||||||
Popover popover = new Popover();
|
Popover popover = new Popover();
|
||||||
popover.setWidget(w);
|
popover.setWidget(w);
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class Ckan2ZenodoViewManager {
|
||||||
|
|
||||||
boolean isUpdate = false;
|
boolean isUpdate = false;
|
||||||
if (zenodoItem.getMetadata() != null) {
|
if (zenodoItem.getMetadata() != null) {
|
||||||
isUpdate = zenodoItem.getMetadata().getDoi() != null ? true : false;
|
isUpdate = zenodoItem.getMetadata().getDoi() != null || zenodoItem.getDoi() != null? true : false;
|
||||||
}
|
}
|
||||||
// Basic Information
|
// Basic Information
|
||||||
int tabIndex = 0;
|
int tabIndex = 0;
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class CkanToZenodoPublisherServiceImpl extends RemoteServiceServlet imple
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String error = "Error during upload to Zenodo the catalogue item: "+zenodoItem.getName();
|
String error = "Error during upload to Zenodo the catalogue item: "+zenodoItem.getName();
|
||||||
LOG.error(error, e);
|
LOG.error(error, e);
|
||||||
String clientError = String.format("%s. %s", error, CkanToZendoPublisherWidgetConstant.MSG_OF_ERROR_REFRESH_AND_TRY_AGAIN_OR_CONTACT_THE_SUPPORT);
|
String clientError = String.format("%s. %s", error, e.getMessage());
|
||||||
throw new Exception(clientError);
|
throw new Exception(clientError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -456,35 +456,51 @@ public class ItemToZenodoConverter {
|
||||||
SerializableEnum<String> accessRight = metadata.getAccess_right();
|
SerializableEnum<String> accessRight = metadata.getAccess_right();
|
||||||
LOG.debug("Read access type: "+accessRight);
|
LOG.debug("Read access type: "+accessRight);
|
||||||
if(accessRight!=null) {
|
if(accessRight!=null) {
|
||||||
|
try {
|
||||||
String theAccessRightValue = accessRight.getSelectedValues().get(0);
|
String theAccessRightValue = accessRight.getSelectedValues().get(0);
|
||||||
LOG.debug("Set access right: "+theAccessRightValue);
|
LOG.debug("Set access right: "+theAccessRightValue);
|
||||||
depositionMetadata.setAccess_right(AccessRights.valueOf(theAccessRightValue));
|
depositionMetadata.setAccess_right(AccessRights.valueOf(theAccessRightValue));
|
||||||
|
}catch (Exception e) {
|
||||||
|
LOG.warn("Set access right error: ",e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//publication type
|
//publication type
|
||||||
SerializableEnum<String> publicationType = metadata.getPublication_type();
|
SerializableEnum<String> publicationType = metadata.getPublication_type();
|
||||||
LOG.debug("Read publication type: "+publicationType);
|
LOG.debug("Read publication type: "+publicationType);
|
||||||
if(publicationType!=null) {
|
if(publicationType!=null) {
|
||||||
|
try {
|
||||||
String thePublicationTypeValue = publicationType.getSelectedValues().get(0);
|
String thePublicationTypeValue = publicationType.getSelectedValues().get(0);
|
||||||
LOG.debug("Set publication type: "+thePublicationTypeValue);
|
LOG.debug("Set publication type: "+thePublicationTypeValue);
|
||||||
depositionMetadata.setPublication_type(PublicationType.valueOf(thePublicationTypeValue));
|
depositionMetadata.setPublication_type(PublicationType.valueOf(thePublicationTypeValue));
|
||||||
|
}catch (Exception e) {
|
||||||
|
LOG.warn("Set publication type error: ",e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//image type
|
//image type
|
||||||
SerializableEnum<String> imageType = metadata.getImage_type();
|
SerializableEnum<String> imageType = metadata.getImage_type();
|
||||||
LOG.debug("Read image type: "+imageType);
|
LOG.debug("Read image type: "+imageType);
|
||||||
if(imageType!=null) {
|
if(imageType!=null) {
|
||||||
|
try {
|
||||||
String imageTypeValue = imageType.getSelectedValues().get(0);
|
String imageTypeValue = imageType.getSelectedValues().get(0);
|
||||||
LOG.debug("Set image type: "+imageTypeValue);
|
LOG.debug("Set image type: "+imageTypeValue);
|
||||||
depositionMetadata.setImage_type(ImageType.valueOf(imageTypeValue));
|
depositionMetadata.setImage_type(ImageType.valueOf(imageTypeValue));
|
||||||
|
}catch (Exception e) {
|
||||||
|
LOG.warn("Set image type error: ",e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//embargo_date
|
//embargo_date
|
||||||
Date embargoDate = metadata.getEmbargo_date();
|
Date embargoDate = metadata.getEmbargo_date();
|
||||||
LOG.debug("Read embargo date: "+imageType);
|
LOG.debug("Read embargo date: "+imageType);
|
||||||
if(embargoDate!=null) {
|
if(embargoDate!=null) {
|
||||||
|
try {
|
||||||
LOG.debug("Set embargo date: "+embargoDate);
|
LOG.debug("Set embargo date: "+embargoDate);
|
||||||
depositionMetadata.setEmbargo_date(embargoDate);
|
depositionMetadata.setEmbargo_date(embargoDate);
|
||||||
|
}catch (Exception e) {
|
||||||
|
LOG.warn("Set embargo date error: ",e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//access conditions
|
//access conditions
|
||||||
|
@ -499,9 +515,13 @@ public class ItemToZenodoConverter {
|
||||||
SerializableEnum<LicenseBean> licenses = metadata.getLicenses();
|
SerializableEnum<LicenseBean> licenses = metadata.getLicenses();
|
||||||
LOG.debug("Read licenses: "+licenses);
|
LOG.debug("Read licenses: "+licenses);
|
||||||
if(licenses!=null) {
|
if(licenses!=null) {
|
||||||
|
try {
|
||||||
LicenseBean lB = licenses.getSelectedValues().get(0);
|
LicenseBean lB = licenses.getSelectedValues().get(0);
|
||||||
LOG.debug("Set license: "+lB);
|
LOG.debug("Set license: "+lB);
|
||||||
depositionMetadata.setLicense(lB.getId());
|
depositionMetadata.setLicense(lB.getId());
|
||||||
|
}catch (Exception e) {
|
||||||
|
LOG.warn("Set license error: ",e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//creators
|
//creators
|
||||||
|
@ -584,7 +604,7 @@ public class ItemToZenodoConverter {
|
||||||
theType = zenodoAuthor.getType().getSelectedValues().get(0);
|
theType = zenodoAuthor.getType().getSelectedValues().get(0);
|
||||||
type = Type.valueOf(theType);
|
type = Type.valueOf(theType);
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
LOG.error("No able to convert "+theType + " as value of "+Type.class.getName());
|
LOG.error("I'm not able to convert "+theType + " as value of "+Type.class.getName());
|
||||||
}
|
}
|
||||||
contributor.setType(type);
|
contributor.setType(type);
|
||||||
listOfContributors.add(contributor);
|
listOfContributors.add(contributor);
|
||||||
|
|
Loading…
Reference in New Issue