needs to be finished.. preparing for release 4.8

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/grsf-manage-widget@158344 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-11-09 21:11:10 +00:00
parent c21a7b1fbc
commit e54d2c1a4f
12 changed files with 534 additions and 72 deletions

View File

@ -11,7 +11,13 @@ import org.gcube.datacatalogue.common.enums.Status;
import org.gcube.datacatalogue.grsf_manage_widget.client.GRSFManageWidgetService;
import org.gcube.datacatalogue.grsf_manage_widget.client.GRSFManageWidgetServiceAsync;
import org.gcube.datacatalogue.grsf_manage_widget.client.events.HideManagementPanelEvent;
import org.gcube.datacatalogue.grsf_manage_widget.client.view.subwidgets.ConnectToWidget;
import org.gcube.datacatalogue.grsf_manage_widget.client.view.subwidgets.FormEntryModel;
import org.gcube.datacatalogue.grsf_manage_widget.client.view.subwidgets.SimilarGRSFRecordWidget;
import org.gcube.datacatalogue.grsf_manage_widget.client.view.subwidgets.SourceWidget;
import org.gcube.datacatalogue.grsf_manage_widget.shared.ManageProductBean;
import org.gcube.datacatalogue.grsf_manage_widget.shared.SimilarGRSFRecord;
import org.gcube.datacatalogue.grsf_manage_widget.shared.SourceRecord;
import org.gcube.datacatalogue.grsf_manage_widget.shared.ex.NoGRSFRecordException;
import com.github.gwtbootstrap.client.ui.AlertBlock;
@ -37,8 +43,14 @@ import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* Management widget main panel.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class ManageProductWidget extends Composite{
private static GRSFManageWidgetServiceAsync service = GWT.create(GRSFManageWidgetService.class);
@ -61,18 +73,24 @@ public class ManageProductWidget extends Composite{
@UiField
TextBox productGrsfType;
@UiField
CheckBox traceabilityFlag;
@UiField
TextArea GRSFNameTexBox;
@UiField
TextArea semanticIdentifierTextBox;
@UiField
TextBox sources;
VerticalPanel panelForSourceItems;
@UiField
VerticalPanel panelForSimilarGRSFRecords;
@UiField
VerticalPanel panelForConnectOtherRecords;
@UiField
TextBox currentStatus;
@ -108,7 +126,8 @@ public class ManageProductWidget extends Composite{
Image loadingImage;
public static final String LOADING_IMAGE_URL = GWT.getModuleBaseURL() + "../images/loader.gif";
private final static List<Status> STATUS = new ArrayList<Status>(Arrays.asList(Status.values()));
// messages used here and there
private final static String STATUS_UPDATE_SUCCESS = "The item has been correctly updated. Thanks for your collaboration!";
private final static String STATUS_UPDATE_ERROR = "Sorry, there was a problem while trying to update the status of this item";
protected static final String ERROR_ON_RETRIEVING_BEAN = "It seems there was a problem while contacting the service...";
@ -116,31 +135,47 @@ public class ManageProductWidget extends Composite{
protected static final String NO_ADMIN_ROLE = "Sorry but it seems you do not have the rights to manage items."
+ " You are suggested to contact the VRE Manager if something is wrong with this";
private ManageProductBean bean;
// event bus shared with the portlet
private HandlerManager eventBus = null;
// the objects to be managed
private ManageProductBean bean;
private final static List<Status> STATUS = new ArrayList<Status>(Arrays.asList(Status.values()));
/**
* Build a ManageProduct widget for the product with the specified id.
* @param productIdentifier
* @param eventBus
*/
public ManageProductWidget(String productIdentifier, HandlerManager eventBus) {
initWidget(uiBinder.createAndBindUi(this));
this.eventBus = eventBus;
if(productIdentifier == null || productIdentifier.isEmpty()){
GWT.log("The received item identifier is null..");
return;
}
GWT.log("item identifier is " + productIdentifier);
if(productIdentifier == null || productIdentifier.isEmpty())
return;
// start loader service
loadingImage.setUrl(LOADING_IMAGE_URL);
loadingImage.setVisible(true);
formUpdate.setVisible(false);
// show modal
manageProductModal.show();
manageProductModal.setWidth("50%");
// async request to fetch the product
retrieveProductBean(productIdentifier);
}
/**
* Actually builds the widget... asks for details about the record
* @param productIdentifier
*/
private void retrieveProductBean(final String productIdentifier) {
// check if it is an administrator
@ -157,9 +192,10 @@ public class ManageProductWidget extends Composite{
formUpdate.setVisible(false);
confirmButton.setEnabled(false);
loadingImage.setVisible(false);
// ask to hide management panel
eventBus.fireEvent(new HideManagementPanelEvent());
if(eventBus != null)
eventBus.fireEvent(new HideManagementPanelEvent());
}else{
service.getProductBeanById(productIdentifier, new AsyncCallback<ManageProductBean>() {
@ -167,41 +203,54 @@ public class ManageProductWidget extends Composite{
@Override
public void onSuccess(ManageProductBean result) {
if(result != null){
if(result == null){
showInfo(ERROR_ON_RETRIEVING_BEAN, AlertType.ERROR);
formUpdate.setVisible(false);
confirmButton.setEnabled(false);
}else{
bean = result;
annotationArea.setText("");
infoBlock.setVisible(false);
formUpdate.setVisible(true);
shortNameTextBox.setText(bean.getShortName());
currentStatus.setText(bean.getCurrentStatus().toString());
productGrsfType.setText(bean.getGrsfType());
// top: more or less fixed information
GRSFNameTexBox.setText(bean.getGrsfName());
semanticIdentifierTextBox.setText(bean.getSemanticId());
sources.setText(bean.getSources());
shortNameTextBox.setText(bean.getShortName());
semanticIdentifierTextBox.setText(bean.getSemanticIdentifier());
productGrsfType.setText(bean.getGrsfType());
currentStatus.setText(bean.getCurrentStatus().toString());
traceabilityFlag.setValue(bean.isTraceabilityFlag());
traceabilityFlag.setTitle("Current value for the record is " + bean.isTraceabilityFlag());
// manage sources
List<SourceRecord> availableSources = bean.getSources();
panelForSourceItems.add(new SourceWidget(availableSources));
// manage similar GRSF records, if any
List<SimilarGRSFRecord> availableGRSFSimilarRecords = bean.getSimilarGrsfRecords();
panelForSimilarGRSFRecords.add(new SimilarGRSFRecordWidget(availableGRSFSimilarRecords));
// prepare "connect" panel
panelForConnectOtherRecords.add(new ConnectToWidget());
// check if we need to show more
if(bean.getExtrasIfAvailable() != null && !bean.getExtrasIfAvailable().isEmpty())
addExtrasAfter(bean, productGrsfTypeGroup);
// check for new status box
List<Status> statusToShow = new ArrayList<Status>(STATUS);
statusToShow.remove(bean.getCurrentStatus());
// if the record isn't approved, then remove also archived
if(!bean.getCurrentStatus().equals(Status.Approved))
statusToShow.remove(Status.Archived);
listBoxStatus.addItem("Select the new status");
listBoxStatus.getElement().<SelectElement>cast().getOptions().getItem(0).setDisabled(true);
for (Status availableStatus : statusToShow) {
listBoxStatus.addItem(availableStatus.toString());
}
listBoxStatus.setSelectedIndex(0);
}
else{
showInfo(ERROR_ON_RETRIEVING_BEAN, AlertType.ERROR);
formUpdate.setVisible(false);
confirmButton.setEnabled(false);
formUpdate.setVisible(true);
}
loadingImage.setVisible(false);
@ -263,17 +312,9 @@ public class ManageProductWidget extends Composite{
}
@UiHandler("cancelButton")
void onCancelButton(ClickEvent ce){
manageProductModal.hide();
}
@UiHandler("confirmButton")
void onSaveButton(ClickEvent ce){
if(bean == null)
return;
listBoxStatusGroup.setType(ControlGroupType.NONE);
if(listBoxStatus.getSelectedIndex() <= 0){
@ -330,6 +371,12 @@ public class ManageProductWidget extends Composite{
});
}
@UiHandler("cancelButton")
void onCancelButton(ClickEvent ce){
// just hide the panel
manageProductModal.hide();
}
/**
* Show information

View File

@ -34,13 +34,14 @@
</b:Controls>
</b:ControlGroup>
<!-- SHORT NAME IS EDITABLE -->
<b:ControlGroup ui:field="productShortNameGroup">
<b:ControlLabel for="shortname" title="Short Name">
<b>GRSF Short Name:</b>
</b:ControlLabel>
<b:Controls>
<b:TextArea alternateSize="LARGE" placeholder="GRSF Short Name"
visibleLines="2" readOnly="true" width="97%" b:id="shortname"
visibleLines="2" readOnly="false" width="97%" b:id="shortname"
title="GRSF Short Name" ui:field="shortNameTextBox" />
</b:Controls>
</b:ControlGroup>
@ -67,27 +68,6 @@
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="sourcesGroup">
<b:ControlLabel for="sources" title="Sources">
<b>Source(s):</b>
</b:ControlLabel>
<b:Controls>
<b:TextBox b:id="sources" alternateSize="LARGE" width="97%"
placeholder="Sources of the GRSF record" title="Sources"
readOnly="true" ui:field="sources"></b:TextBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="traceabilityFlagGroup">
<b:ControlLabel for="traceabilityflag" title="Traceability Flag">
<b>Traceability Flag:</b>
</b:ControlLabel>
<b:Controls>
<b:CheckBox b:id="traceabilityflag" title="Traceability Flag"
ui:field="traceabilityFlag"></b:CheckBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="currentStatusGroup">
<b:ControlLabel for="currentStatus"
title="The current status of this Item">
@ -101,6 +81,36 @@
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="sourcesGroup">
<b:ControlLabel title="Sources">
<b>Source(s):</b>
</b:ControlLabel>
<b:Controls>
<g:VerticalPanel ui:field="panelForSourceItems">
</g:VerticalPanel>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="similarGRSFRecordGroup">
<b:ControlLabel title="Similar GRSF Records">
<b>Similar GRSF Records:</b>
</b:ControlLabel>
<b:Controls>
<g:VerticalPanel ui:field="panelForSimilarGRSFRecords">
</g:VerticalPanel>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="connectToOtherRecordsGroup">
<b:ControlLabel title="Connect to other Records">
<b>Suggest connections with other records:</b>
</b:ControlLabel>
<b:Controls>
<g:VerticalPanel ui:field="panelForConnectOtherRecords">
</g:VerticalPanel>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="listBoxStatusGroup">
<b:ControlLabel for="listboxStatus" title="The new status of this record">
<b>New Status:</b>
@ -111,6 +121,16 @@
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="traceabilityFlagGroup">
<b:ControlLabel for="traceabilityflag" title="Traceability Flag">
<b>Traceability Flag:</b>
</b:ControlLabel>
<b:Controls>
<b:CheckBox b:id="traceabilityflag" title="Traceability Flag"
ui:field="traceabilityFlag"></b:CheckBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup ui:field="annotationAreaGroup">
<b:ControlLabel for="annotation"
title="An annotation message to send along the update">
@ -130,7 +150,7 @@
<b:Icon type="GEAR" spin="true" ui:field="loaderIcon"
visible="false" />
<b:Button ui:field="cancelButton">Cancel</b:Button>
<b:Button icon="FILE" type="PRIMARY" ui:field="confirmButton">Apply</b:Button>
<b:Button icon="FILE" type="PRIMARY" ui:field="confirmButton">Confirm</b:Button>
</b:ModalFooter>
</b:Modal>
</g:HTMLPanel>

View File

@ -0,0 +1,26 @@
package org.gcube.datacatalogue.grsf_manage_widget.client.view.subwidgets;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
public class ConnectToWidget extends Composite{
private static ConnectToWidgetUiBinder uiBinder = GWT
.create(ConnectToWidgetUiBinder.class);
interface ConnectToWidgetUiBinder extends UiBinder<Widget, ConnectToWidget> {
}
public ConnectToWidget() {
initWidget(uiBinder.createAndBindUi(this));
}
public ConnectToWidget(String firstName) {
initWidget(uiBinder.createAndBindUi(this));
}
}

View File

@ -0,0 +1,12 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:style>
.important {
font-weight: bold;
}
</ui:style>
<g:HTMLPanel>
<g:VerticalPanel ui:field="connectPanel"></g:VerticalPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,4 +1,4 @@
package org.gcube.datacatalogue.grsf_manage_widget.client.view;
package org.gcube.datacatalogue.grsf_manage_widget.client.view.subwidgets;
import com.github.gwtbootstrap.client.ui.ControlLabel;
import com.github.gwtbootstrap.client.ui.TextBox;

View File

@ -0,0 +1,237 @@
package org.gcube.datacatalogue.grsf_manage_widget.client.view.subwidgets;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.gcube.datacatalogue.grsf_manage_widget.shared.SimilarGRSFRecord;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.ControlLabel;
import com.github.gwtbootstrap.client.ui.HelpBlock;
import com.github.gwtbootstrap.client.ui.Paragraph;
import com.github.gwtbootstrap.client.ui.TextBox;
import com.github.gwtbootstrap.client.ui.base.ComplexWidget;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Float;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
public class SimilarGRSFRecordWidget extends Composite {
private static SimilarGRSFRecordWidgetUiBinder uiBinder = GWT
.create(SimilarGRSFRecordWidgetUiBinder.class);
interface SimilarGRSFRecordWidgetUiBinder extends
UiBinder<Widget, SimilarGRSFRecordWidget> {
}
@UiField
VerticalPanel similarGrsfRecordsPanel;
@UiField
VerticalPanel similarGrsfRecordsSuggestedPanel;
@UiField
Button addSimilarRecord;
/**
* Class of Pairs
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
class Pair {
private SimilarGRSFRecord s;
private Widget w;
public Pair(SimilarGRSFRecord s, Widget w){
this.s = s;
this.w = w;
}
public SimilarGRSFRecord getS(){ return s; }
public Widget getW(){ return w; }
public void setS(SimilarGRSFRecord s){ this.s = s; }
public void setW(Widget w){ this.w = w; }
}
protected List<Pair> extraSimilarRecordsList = new ArrayList<Pair>(0);
private List<SimilarGRSFRecord> availableGRSFSimilarRecords;
/**
* Get widget for available similar grsf records
* @param availableGRSFSimilarRecords
*/
public SimilarGRSFRecordWidget(List<SimilarGRSFRecord> availableGRSFSimilarRecords) {
initWidget(uiBinder.createAndBindUi(this));
this.availableGRSFSimilarRecords = availableGRSFSimilarRecords;
similarGrsfRecordsPanel.setWidth("100%");
similarGrsfRecordsSuggestedPanel.setWidth("100%");
// add the existing ones, if any
for (final SimilarGRSFRecord similarGRSFRecord : availableGRSFSimilarRecords) {
Widget widget = buildWidgetForSimilarRecord(similarGRSFRecord);
similarGrsfRecordsPanel.add(widget);
}
// manage the "suggest button"
addSimilarRecord.setIcon(IconType.PLUS_SIGN);
addSimilarRecord.getElement().getStyle().setFloat(Float.RIGHT);
addSimilarRecord.setTitle("Suggest a Similar Record by using its GRSF UUID");
addSimilarRecord.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent arg0) {
Widget w = new Widget();
SimilarGRSFRecord s = new SimilarGRSFRecord(true);
buildWidgetForExtraSimilarRecord(w, s);
extraSimilarRecordsList.add(new Pair(s, w));
similarGrsfRecordsSuggestedPanel.add(w);
}
});
}
/**
* Builds widget for already present similar GRSF records
* @param similarGRSFRecord
* @return a Widget (actually a VerticalPanel)
*/
public static Widget buildWidgetForSimilarRecord(final SimilarGRSFRecord similarGRSFRecord){
VerticalPanel subPanel = new VerticalPanel();
Paragraph name = new Paragraph("Record name: " + similarGRSFRecord.getShortName());
subPanel.add(name);
if(similarGRSFRecord.getDescription() != null){
String shortDescrption = similarGRSFRecord.getDescription().length() > 30 ?
similarGRSFRecord.getDescription().substring(0, 30) + " ... " :
similarGRSFRecord.getDescription();
Paragraph description = new Paragraph(
"Description: " + shortDescrption);
description.setTitle("Description: " + similarGRSFRecord.getDescription());
subPanel.add(description);
}
Paragraph semanticIdentifier = new Paragraph("Semantic Identifier " +
similarGRSFRecord.getSemanticIdentifier());
subPanel.add(semanticIdentifier);
Anchor view = new Anchor();
view.setHref(similarGRSFRecord.getUrl());
view.setText("View");
view.setTarget("_blank");
subPanel.add(view);
subPanel.setWidth("100%");
// add merge checkbox
final CheckBox mergeSuggested = new CheckBox("Merge");
mergeSuggested.setValue(false);
mergeSuggested.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent arg0) {
similarGRSFRecord.setSuggestedMerge(mergeSuggested.getValue());
}
});
subPanel.add(mergeSuggested);
return subPanel;
}
/**
* Builds up a widget for suggested similar grsf records. Changes are performed in place with respect to w and s.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
* @param w the widget
* @param s the similar record.
*/
private void buildWidgetForExtraSimilarRecord(Widget w, final SimilarGRSFRecord s){
w = new HorizontalPanel();
w.setWidth("100%");
VerticalPanel vp = new VerticalPanel();
vp.setWidth("70%");
ControlLabel cLabel = new ControlLabel("Semantic Identifier");
TextBox box = new TextBox();
box.setPlaceholder("Insert the Semantic Identifier of the suggested record");
HelpBlock hb = new HelpBlock();
hb.setVisible(false);
// TODO add handler for remote GRSF semantic id check
vp.add(cLabel);
vp.add(box);
vp.add(hb);
// add merge checkbox
final CheckBox mergeSuggested = new CheckBox("Merge");
mergeSuggested.setValue(false);
mergeSuggested.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent arg0) {
s.setSuggestedMerge(mergeSuggested.getValue());
}
});
vp.add(mergeSuggested);
Button removeExtra = new Button();
removeExtra.setIcon(IconType.MINUS);
removeExtra.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent arg0) {
// remove this object from the pairs list
Iterator<Pair> iterator = extraSimilarRecordsList.iterator();
while (iterator.hasNext()) {
SimilarGRSFRecordWidget.Pair pair = (SimilarGRSFRecordWidget.Pair) iterator
.next();
if(pair.getS().equals(s)){
pair.getW().removeFromParent();
iterator.remove();
}
}
}
});
((ComplexWidget) w).add(vp);
((ComplexWidget) w).add(removeExtra);
}
/**
* Get the whole of similar records
* @return
*/
public List<SimilarGRSFRecord> getSuggestedRecords(){
if(availableGRSFSimilarRecords == null)
availableGRSFSimilarRecords = new ArrayList<SimilarGRSFRecord>();
for (Pair p : extraSimilarRecordsList) {
availableGRSFSimilarRecords.add(p.getS());
}
return availableGRSFSimilarRecords;
}
}

View File

@ -0,0 +1,10 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<g:HTMLPanel width="100%">
<g:VerticalPanel ui:field="similarGrsfRecordsPanel"></g:VerticalPanel>
<g:VerticalPanel ui:field="similarGrsfRecordsSuggestedPanel"></g:VerticalPanel>
<b:Button ui:field="addSimilarRecord"></b:Button>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,55 @@
package org.gcube.datacatalogue.grsf_manage_widget.client.view.subwidgets;
import java.util.List;
import org.gcube.datacatalogue.grsf_manage_widget.shared.SourceRecord;
import com.github.gwtbootstrap.client.ui.Paragraph;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
public class SourceWidget extends Composite {
private static SourceWidgetUiBinder uiBinder = GWT
.create(SourceWidgetUiBinder.class);
interface SourceWidgetUiBinder extends UiBinder<Widget, SourceWidget> {
}
@UiField
VerticalPanel sourcesInnerPanel;
public SourceWidget(List<SourceRecord> availableSources) {
initWidget(uiBinder.createAndBindUi(this));
int counter = 1;
sourcesInnerPanel.setWidth("90%");
for (SourceRecord sourceRecord : availableSources) {
VerticalPanel subPanel = new VerticalPanel();
String sourceNumber = "Source " + counter + ":";
String name = sourceRecord.getName();
Anchor url = new Anchor();
url.setHref(sourceRecord.getUrl());
url.setText("View");
url.setTarget("_blank");
subPanel.add(new Paragraph(sourceNumber));
HorizontalPanel hPanel = new HorizontalPanel();
hPanel.add(new Paragraph(name + " - "));
hPanel.add(url);
subPanel.add(hPanel);
subPanel.setWidth("100%");
sourcesInnerPanel.add(subPanel);
counter++;
}
}
}

View File

@ -0,0 +1,12 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:style>
.important {
font-weight: bold;
}
</ui:style>
<g:HTMLPanel>
<g:VerticalPanel ui:field="sourcesInnerPanel"></g:VerticalPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -19,7 +19,8 @@ public class ManageProductBean implements Serializable{
private String grsfType; // Fishery or Stock type (e.g., Assessment_Unit, Marine Resource and so on)
private String grsfDomain; // fishery/stock
private String grsfName; // Fishery name or stock name
private String shortName;
private String shortName; // it is editable ...
private String shortNameUpdated;
private boolean traceabilityFlag; //from false to true etc
private Status currentStatus;
private Status newStatus;
@ -47,6 +48,7 @@ public class ManageProductBean implements Serializable{
this.grsfDomain = grsfDomain;
this.grsfName = grsfName;
this.shortName = shortName;
this.shortNameUpdated = shortName;
this.traceabilityFlag = traceabilityFlag;
this.currentStatus = currentStatus;
this.newStatus = newStatus;
@ -170,6 +172,14 @@ public class ManageProductBean implements Serializable{
this.shortName = shortName;
}
public String getShortNameUpdated() {
return shortNameUpdated;
}
public void setShortNameUpdated(String shortNameUpdated) {
this.shortNameUpdated = shortNameUpdated;
}
@Override
public String toString() {
return "ManageProductBean [semanticIdentifier=" + semanticIdentifier
@ -177,6 +187,7 @@ public class ManageProductBean implements Serializable{
+ ", knowledgeBaseIdentifier=" + knowledgeBaseIdentifier
+ ", grsfType=" + grsfType + ", grsfDomain=" + grsfDomain
+ ", grsfName=" + grsfName + ", shortName=" + shortName
+ ", shortNameUpdated=" + shortNameUpdated
+ ", traceabilityFlag=" + traceabilityFlag + ", currentStatus="
+ currentStatus + ", newStatus=" + newStatus + ", annotation="
+ annotation + ", extrasIfAvailable=" + extrasIfAvailable

View File

@ -9,22 +9,28 @@ import org.json.simple.parser.ParseException;
/**
* A similar grsf record
* A similar grsf record.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class SimilarGRSFRecord implements Serializable{
private static final long serialVersionUID = 6501670015333073045L;
private String description;
private String semanticIdentifier;
private String shortName;
private String url; // within the catalogue
private String url;
private boolean suggestedMerge;
private boolean isExtra;
public SimilarGRSFRecord() {
super();
}
public SimilarGRSFRecord(boolean isExtra) {
this.isExtra = isExtra;
}
/**
* @param description
* @param semanticIdentifier
@ -63,13 +69,39 @@ public class SimilarGRSFRecord implements Serializable{
public void setUrl(String url) {
this.url = url;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isSuggestedMerge() {
return suggestedMerge;
}
public void setSuggestedMerge(boolean suggestedMerge) {
this.suggestedMerge = suggestedMerge;
}
public boolean isExtra() {
return isExtra;
}
public void setExtra(boolean isExtra) {
this.isExtra = isExtra;
}
@Override
public String toString() {
return "SimilarGRSFRecord [description=" + description
+ ", semanticIdentifier=" + semanticIdentifier + ", shortName="
+ shortName + ", url=" + url + "]";
+ shortName + ", url=" + url + ", suggestedMerge="
+ suggestedMerge + ", isExtra=" + isExtra + "]";
}
/**
* Get a {@link SimilarGRSFRecord} from a json string
* @param json
@ -77,20 +109,20 @@ public class SimilarGRSFRecord implements Serializable{
* @throws ParseException
*/
public static SimilarGRSFRecord fromJson(String json) throws ParseException{
if(json == null)
return null;
JSONParser parser = new JSONParser();
JSONObject object = (JSONObject)parser.parse(json);
return new SimilarGRSFRecord(
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_DESCRIPTION),
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_IDENTIFIER),
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_NAME),
(String)object.get(Constants.SIMILAR_RECORDS_BEAN_FIELD_URL)
);
}
}