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:
parent
e3324ba6b7
commit
234a64ee00
|
@ -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>
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class GCubeCkanDataCatalog implements EntryPoint {
|
||||||
*/
|
*/
|
||||||
public void onModuleLoad() {
|
public void onModuleLoad() {
|
||||||
|
|
||||||
GCubeCkanDataCatalogPanel panel =new GCubeCkanDataCatalogPanel(RootPanel.get(DIV_PORTLET_ID), eventManager.getEventBus());
|
GCubeCkanDataCatalogPanel panel = new GCubeCkanDataCatalogPanel(RootPanel.get(DIV_PORTLET_ID), eventManager.getEventBus());
|
||||||
eventManager.setPanel(panel);
|
eventManager.setPanel(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
||||||
insertMeta.setIcon(IconType.FILE);
|
insertMeta.setIcon(IconType.FILE);
|
||||||
editMeta.setIcon(IconType.EDIT_SIGN);
|
editMeta.setIcon(IconType.EDIT_SIGN);
|
||||||
statistics.setIcon(IconType.BAR_CHART);
|
statistics.setIcon(IconType.BAR_CHART);
|
||||||
manageProduct.setIcon(IconType.CHECK_SIGN);
|
manageProduct.setIcon(IconType.CHECK_SIGN);
|
||||||
|
|
||||||
// hide edit and insert
|
// hide edit and insert
|
||||||
shareLink.setEnabled(false);
|
shareLink.setEnabled(false);
|
||||||
|
@ -152,7 +152,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void addHandlers() {
|
private void addHandlers() {
|
||||||
|
|
||||||
home.addClickHandler(new ClickHandler() {
|
home.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
types.addClickHandler(new ClickHandler() {
|
types.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -308,7 +308,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
||||||
/**
|
/**
|
||||||
* Button to manage the product.. for example in grsf case
|
* Button to manage the product.. for example in grsf case
|
||||||
* @param value true or false
|
* @param value true or false
|
||||||
* @param isManageProductEnabled
|
* @param isManageProductEnabled
|
||||||
*/
|
*/
|
||||||
public void showManageProductButton(boolean value){
|
public void showManageProductButton(boolean value){
|
||||||
manageProduct.setVisible(value);
|
manageProduct.setVisible(value);
|
||||||
|
@ -359,6 +359,31 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
||||||
myGroups.setVisible(false);
|
myGroups.setVisible(false);
|
||||||
statistics.setVisible(false);
|
statistics.setVisible(false);
|
||||||
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,21 +68,21 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
||||||
|
|
||||||
this.rootPanel = rootPanel;
|
this.rootPanel = rootPanel;
|
||||||
this.eventBus = eventManager;
|
this.eventBus = eventManager;
|
||||||
|
|
||||||
//postMessage(obj.toString(), ckanFramePanel.getFrame());
|
//postMessage(obj.toString(), ckanFramePanel.getFrame());
|
||||||
// send message about gateway url
|
// send message about gateway url
|
||||||
obj = new JSONObject();
|
obj = new JSONObject();
|
||||||
String landingPageVREs = Window.Location.getProtocol() + "//" + Window.Location.getHostName() + "/explore";
|
String landingPageVREs = Window.Location.getProtocol() + "//" + Window.Location.getHostName() + "/explore";
|
||||||
JSONString value = new JSONString(landingPageVREs);
|
JSONString value = new JSONString(landingPageVREs);
|
||||||
obj.put("explore_vres_landing_page", value);
|
obj.put("explore_vres_landing_page", value);
|
||||||
|
|
||||||
ckanFramePanel = new CkanFramePanel(eventBus);
|
ckanFramePanel = new CkanFramePanel(eventBus);
|
||||||
managementPanel = new CkanMetadataManagementPanel(eventBus);
|
managementPanel = new CkanMetadataManagementPanel(eventBus);
|
||||||
ckanOrganizationsPanel = new CkanOrganizationsPanel(this);
|
ckanOrganizationsPanel = new CkanOrganizationsPanel(this);
|
||||||
ckanGroupsPanel = new CkanGroupsPanel(this);
|
ckanGroupsPanel = new CkanGroupsPanel(this);
|
||||||
initPanel();
|
initPanel();
|
||||||
setTopPanelVisible(true);
|
setTopPanelVisible(true);
|
||||||
|
|
||||||
// decode parameters (they could have been encoded)
|
// decode parameters (they could have been encoded)
|
||||||
final Map<String, String> paramsMap = new HashMap<String, String>(2);
|
final Map<String, String> paramsMap = new HashMap<String, String>(2);
|
||||||
String queryParameters = Window.Location.getQueryString();
|
String queryParameters = Window.Location.getQueryString();
|
||||||
|
@ -151,34 +151,34 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// check if management buttons need to be removed
|
// check if management buttons need to be removed
|
||||||
GCubeCkanDataCatalog.service.isViewPerVREEnabled(new AsyncCallback<String>() {
|
GCubeCkanDataCatalog.service.isViewPerVREEnabled(new AsyncCallback<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String result) {
|
public void onSuccess(String result) {
|
||||||
|
|
||||||
if(result != null && !result.isEmpty()){
|
if(result != null && !result.isEmpty()){
|
||||||
// hide all management buttons
|
// hide all management buttons
|
||||||
managementPanel.removeGenericManagementButtons();
|
managementPanel.removeGenericManagementButtons();
|
||||||
|
|
||||||
// set real relative path
|
// set real relative path
|
||||||
ckanAccessPoint.addPathInfo(result);
|
ckanAccessPoint.addPathInfo(result);
|
||||||
|
|
||||||
// save this information
|
// save this information
|
||||||
viewPerVREPath = result;
|
viewPerVREPath = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
// ?
|
// ?
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// retrieve organizations
|
// retrieve organizations
|
||||||
GCubeCkanDataCatalog.service.getCkanOrganizationsNamesAndUrlsForUser(new AsyncCallback<List<BeanUserInOrgGroupRole>>() {
|
GCubeCkanDataCatalog.service.getCkanOrganizationsNamesAndUrlsForUser(new AsyncCallback<List<BeanUserInOrgGroupRole>>() {
|
||||||
|
|
||||||
|
@ -207,15 +207,15 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
||||||
ckanGroupsPanel.setGroups(null);
|
ckanGroupsPanel.setGroups(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// check if the url encodes a revert operation to be performed
|
// check if the url encodes a revert operation to be performed
|
||||||
if(paramsMap.containsKey(GCubeCkanDataCatalog.REVERT_QUERY_PARAM) &&
|
if(paramsMap.containsKey(GCubeCkanDataCatalog.REVERT_QUERY_PARAM) &&
|
||||||
paramsMap.get(GCubeCkanDataCatalog.REVERT_QUERY_PARAM).equals("true")){
|
paramsMap.get(GCubeCkanDataCatalog.REVERT_QUERY_PARAM).equals("true")){
|
||||||
|
|
||||||
eventBus.fireEvent(new ShowRevertOperationWidgetEvent(Window.Location.getHref()));
|
eventBus.fireEvent(new ShowRevertOperationWidgetEvent(Window.Location.getHref()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Just check if it is enabled.. then we need to listen for dom events coming
|
* Just check if it is enabled.. then we need to listen for dom events coming
|
||||||
*/
|
*/
|
||||||
|
@ -410,11 +410,23 @@ 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){
|
||||||
height = object.get("height").isString().stringValue();
|
//Supporting Task #12286: parsing the translate values for 'dataset', 'organization' and so on
|
||||||
if(object.containsKey("product"))
|
if(object.containsKey("translate")){
|
||||||
productId = object.get("product").isString().stringValue();
|
JSONObject theTranslate = (JSONObject) object.get("translate");
|
||||||
else
|
for (String key : theTranslate.keySet()) {
|
||||||
isProductKeyMissing = true;
|
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();
|
||||||
|
if(object.containsKey("product"))
|
||||||
|
productId = object.get("product").isString().stringValue();
|
||||||
|
else
|
||||||
|
isProductKeyMissing = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
GWT.log("Exception is " + e);
|
GWT.log("Exception is " + e);
|
||||||
|
@ -524,15 +536,15 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
||||||
ckanOrganizationsPanel.setVisible(false);
|
ckanOrganizationsPanel.setVisible(false);
|
||||||
ckanFramePanel.setVisible(false);
|
ckanFramePanel.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show management panel
|
* Show management panel
|
||||||
* @param show
|
* @param show
|
||||||
*/
|
*/
|
||||||
public void showManagementPanel(boolean show){
|
public void showManagementPanel(boolean show){
|
||||||
|
|
||||||
managementPanel.showManageProductButton(show);
|
managementPanel.showManageProductButton(show);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -541,5 +553,5 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
||||||
public boolean isViewPerVREEnabled() {
|
public boolean isViewPerVREEnabled() {
|
||||||
return viewPerVREPath != null;
|
return viewPerVREPath != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue