Working on Task #12286: Align portlet container labels to the new CKAN mapping

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@171245 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-08-30 13:19:49 +00:00
parent e3324ba6b7
commit 234a64ee00
5 changed files with 76 additions and 34 deletions

View File

@ -1,4 +1,9 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="org.gcube.portlets.gcubeckan.gcube-ckan-datacatalog.1-6-0"
date="2018-30-08">
<Change>[Task #12286]: Align portlet container labels to the new CKAN
mapping</Change>
</Changeset>
<Changeset component="org.gcube.portlets.gcubeckan.gcube-ckan-datacatalog.1-5-3" <Changeset component="org.gcube.portlets.gcubeckan.gcube-ckan-datacatalog.1-5-3"
date="2018-03-22"> date="2018-03-22">
<Change>Minor fix</Change> <Change>Minor fix</Change>

View File

@ -13,7 +13,7 @@
<groupId>org.gcube.portlets.gcubeckan</groupId> <groupId>org.gcube.portlets.gcubeckan</groupId>
<artifactId>gcube-ckan-datacatalog</artifactId> <artifactId>gcube-ckan-datacatalog</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>1.5.3-SNAPSHOT</version> <version>1.6.0-SNAPSHOT</version>
<name>gCube CKAN Data Catalog</name> <name>gCube CKAN Data Catalog</name>
<description>The gCube CKAN Data Catalog portlet</description> <description>The gCube CKAN Data Catalog portlet</description>

View File

@ -361,4 +361,29 @@ public class CkanMetadataManagementPanel extends FlowPanel{
manageProduct.setVisible(false); manageProduct.setVisible(false);
} }
/**
* Customize label according translate.
*
* @param labelName the label name
* @param translateValue the translate value
*/
public void customizeLabelAccordingTranslate(String labelName, String translateValue){
if(labelName==null || labelName.isEmpty() || translateValue==null || translateValue.isEmpty())
return;
if(labelName==organizations.getText()){
organizations.setText(translateValue);
}else if(labelName==groups.getText()){
groups.setText(translateValue);
}else if(labelName==items.getText()){
items.setText(translateValue);
}else if(labelName==types.getText()){
types.setText(translateValue);
}
}
} }

View File

@ -410,12 +410,24 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
JSONObject object = parsedJSON.isObject(); JSONObject object = parsedJSON.isObject();
GWT.log("Object is " + object); GWT.log("Object is " + object);
if(object != null){ if(object != null){
//Supporting Task #12286: parsing the translate values for 'dataset', 'organization' and so on
if(object.containsKey("translate")){
JSONObject theTranslate = (JSONObject) object.get("translate");
for (String key : theTranslate.keySet()) {
String value = object.get(key).isString().stringValue();
GWT.log("Customizing key " + key +" with translate: "+value);
managementPanel.customizeLabelAccordingTranslate(key,value);
}
}else if(object.containsKey("height")){
height = object.get("height").isString().stringValue(); height = object.get("height").isString().stringValue();
if(object.containsKey("product")) if(object.containsKey("product"))
productId = object.get("product").isString().stringValue(); productId = object.get("product").isString().stringValue();
else else
isProductKeyMissing = true; isProductKeyMissing = true;
} }
}
}catch(Exception e){ }catch(Exception e){
GWT.log("Exception is " + e); GWT.log("Exception is " + e);
} }