When no profile is available the listbox is hide

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@130571 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-07-19 19:24:42 +00:00
parent 624199e9aa
commit 71407b502f
2 changed files with 35 additions and 29 deletions

View File

@ -157,6 +157,7 @@ public class CreateDatasetForm extends Composite{
@UiField Icon infoIconResources;
@UiField FocusPanel focusPanelResources;
@UiField Popover popoverResources;
@UiField ControlGroup metadataProfilesControlGroup;
protected static final String ERROR_PRODUCT_CREATION = "There was an error while trying to publish your product, sorry.. Retry later";
@ -192,7 +193,7 @@ public class CreateDatasetForm extends Composite{
// resource table
private ResourcesTable resourcesTable;
// List of opened popup'ids
List<String> popupOpenedIds = new ArrayList<String>();
@ -204,7 +205,7 @@ public class CreateDatasetForm extends Composite{
initWidget(uiBinder.createAndBindUi(this));
this.owner = owner;
// save event bus
this.eventBus = eventBus;
@ -315,7 +316,7 @@ public class CreateDatasetForm extends Composite{
initWidget(uiBinder.createAndBindUi(this));
this.owner = owner;
// save event bus
this.eventBus = eventBus;
@ -469,29 +470,34 @@ public class CreateDatasetForm extends Composite{
List<MetaDataProfileBean> beans = receivedBean.getMetadataList();
for(MetaDataProfileBean metadataBean: beans){
if(beans != null && !beans.isEmpty()){
for(MetaDataProfileBean metadataBean: beans){
metadataProfilesFormatListbox.addItem(metadataBean.getType().getName());
metadataProfilesFormatListbox.addItem(metadataBean.getType().getName());
// add handler on select
metadataProfilesFormatListbox.addChangeHandler(new ChangeHandler() {
// add handler on select
metadataProfilesFormatListbox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
@Override
public void onChange(ChangeEvent event) {
String selectedItem = metadataProfilesFormatListbox.getSelectedItemText();
String selectedItem = metadataProfilesFormatListbox.getSelectedItemText();
if(selectedItem.equals("none")){
// hide the panel
metadataFieldsPanel.clear();
metadataFieldsPanel.setVisible(false);
}else{
if(selectedItem.equals("none")){
// hide the panel
metadataFieldsPanel.clear();
metadataFieldsPanel.setVisible(false);
}else{
metadataFieldsPanel.clear();
addFields(selectedItem);
metadataFieldsPanel.clear();
addFields(selectedItem);
}
}
}
});
});
}
}else{
// just hide this listbox
metadataProfilesControlGroup.setVisible(true);
}
}
@ -534,17 +540,17 @@ public class CreateDatasetForm extends Composite{
}
});
// on close form
eventBus.addHandler(CloseCreationFormEvent.TYPE, new CloseCreationFormEventHandler() {
@Override
public void onClose(CloseCreationFormEvent event) {
closeDialogBox();
}
});
}
@ -811,7 +817,7 @@ public class CreateDatasetForm extends Composite{
popoverTags,
focusPanelTags
);
// licenses
preparePopupPanelAndPopover(
InfoIconsLabels.LICENSES_INFO_ID_POPUP,
@ -1288,12 +1294,12 @@ public class CreateDatasetForm extends Composite{
tagsPanel.clear();
}
/**
* Close any dialog box opened
*/
private void closeDialogBox() {
for (String popupid : popupOpenedIds) {
GcubeDialogExtended popup = null;
try{
@ -1350,7 +1356,7 @@ public class CreateDatasetForm extends Composite{
popup = new GcubeDialogExtended(captionText, text);
popup.getElement().setId(popupId);
popup.setModal(false);
// add its id
popupOpenedIds.add(popupId);

View File

@ -251,7 +251,7 @@
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:ControlGroup ui:field="metadataProfilesControlGroup">
<b:ControlLabel for="metadataProfilesFormat" title="Product profile formats">Product
Profile:</b:ControlLabel>
<b:Controls>