minor fix when retrieving groups list

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@141404 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-12-26 21:07:05 +00:00
parent 25bc395de0
commit 499086b882
1 changed files with 9 additions and 7 deletions

View File

@ -434,9 +434,7 @@ public class CreateDatasetForm extends Composite{
for (GroupBean group : groups) {
groupsListbox.addItem(group.getGroupTitle(), group.getGroupName());
}
hideGroupsAlreadyInProfile(profiles);
groupsControlGroup.setVisible(true);
}
// everything went ok
setAlertBlock("", AlertType.ERROR, false);
@ -492,6 +490,7 @@ public class CreateDatasetForm extends Composite{
organizationsListbox.setEnabled(false);
metadataProfilesFormatListbox.setEnabled(false);
groupsListbox.setEnabled(false);
groupsListbox.clear();
groupsControlGroup.setVisible(false);
// perform remote request of profiles for the selected organization
@ -506,7 +505,6 @@ public class CreateDatasetForm extends Composite{
prepareMetadataList(receivedBean);
organizationsListbox.setEnabled(true);
metadataProfilesFormatListbox.setEnabled(true);
groupsListbox.setEnabled(true);
// try to retrieve the licenses
setAlertBlock("Retrieving groups, please wait...", AlertType.INFO, true);
@ -529,12 +527,9 @@ public class CreateDatasetForm extends Composite{
for (GroupBean group : groups) {
groupsListbox.addItem(group.getGroupTitle(), group.getGroupName());
}
hideGroupsAlreadyInProfile(profiles);
groupsListbox.setEnabled(true);
groupsControlGroup.setVisible(true);
hideGroupsAlreadyInProfile(profiles);
}
// everything went ok
setAlertBlock("", AlertType.ERROR, false);
}
}
@ -1368,11 +1363,18 @@ public class CreateDatasetForm extends Composite{
SelectElement se = groupsListbox.getElement().cast();
int hiddenElements = 0;
for (int i = 0; i < groupsListbox.getItemCount(); i++) {
if(groupsToHide.contains(groupsListbox.getItemText(i))){
se.getOptions().getItem(i).getStyle().setProperty("display", "none");
hiddenElements++;
}
}
if(hiddenElements == groupsListbox.getItemCount())
groupsControlGroup.setVisible(false);
else
groupsControlGroup.setVisible(true);
}
}