minor fix for actions allowed after product creation
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@132575 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
adfc7a1e77
commit
169974e09b
|
@ -111,7 +111,7 @@ public class CreateDatasetForm extends Composite{
|
||||||
@UiField Anchor licenseUrlAnchor;
|
@UiField Anchor licenseUrlAnchor;
|
||||||
@UiField Paragraph unavailableUrl;
|
@UiField Paragraph unavailableUrl;
|
||||||
@UiField TagsPanel tagsPanel;
|
@UiField TagsPanel tagsPanel;
|
||||||
|
|
||||||
// info panels
|
// info panels
|
||||||
@UiField Icon infoIconLicenses;
|
@UiField Icon infoIconLicenses;
|
||||||
@UiField FocusPanel focusPanelLicenses;
|
@UiField FocusPanel focusPanelLicenses;
|
||||||
|
@ -608,59 +608,72 @@ public class CreateDatasetForm extends Composite{
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
alertOnContinue("Checking if a product with such title already exists, please wait...", AlertType.INFO);
|
// better check for title (only if the dataset was not created.. if it is the case, fields are not frozen)
|
||||||
|
if(!titleTextBox.isEnabled())
|
||||||
|
actionsAfterOnContinue();
|
||||||
|
else{
|
||||||
|
alertOnContinue("Checking if a product with such title already exists, please wait...", AlertType.INFO);
|
||||||
|
|
||||||
// better check for title
|
ckanServices.datasetIdAlreadyExists(titleTextBox.getText(), new AsyncCallback<Boolean>() {
|
||||||
ckanServices.datasetIdAlreadyExists(titleTextBox.getText(), new AsyncCallback<Boolean>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Boolean result) {
|
public void onSuccess(Boolean result) {
|
||||||
|
|
||||||
if(result){
|
if(result){
|
||||||
|
|
||||||
alertOnContinue("Sorry but a product with such title already exists, try to change it", AlertType.WARNING);
|
alertOnContinue("Sorry but a product with such title already exists, try to change it", AlertType.WARNING);
|
||||||
|
|
||||||
}else{
|
|
||||||
// check what to do
|
|
||||||
if(isWorkspaceRequest){
|
|
||||||
|
|
||||||
// we need to show the page to handle resources one by one from the workspace
|
|
||||||
formFirstStep.setVisible(false);
|
|
||||||
boolean resourcesPresent = receivedBean.getResources() != null && receivedBean.getResources().size() > 0 ? true : false;
|
|
||||||
formSecondStep.setVisible(resourcesPresent);
|
|
||||||
formThirdStep.setVisible(!resourcesPresent);
|
|
||||||
|
|
||||||
// add the resources to the container panel
|
|
||||||
if(workspaceResourcesContainer.getWidget() == null)
|
|
||||||
workspaceResourcesContainer.add(resourcesTable);
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
// this is not a workspace request
|
actionsAfterOnContinue();
|
||||||
formFirstStep.setVisible(false);
|
|
||||||
formThirdStep.setVisible(true);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(metadataProfilesFormatListbox.getSelectedItemText().equals(NONE_PROFILE))
|
|
||||||
selectedProfile.setText("");
|
|
||||||
else
|
|
||||||
selectedProfile.setText("Selected Profile is " + metadataProfilesFormatListbox.getSelectedItemText());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
@Override
|
alertOnContinue("Sorry but there was a problem while checking if the inserted data are correct", AlertType.ERROR);
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
|
|
||||||
alertOnContinue("Sorry but there was a problem while checking if the inserted data are correct", AlertType.ERROR);
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* After onContinue ...
|
||||||
|
*/
|
||||||
|
private void actionsAfterOnContinue(){
|
||||||
|
|
||||||
|
// check what to do
|
||||||
|
if(isWorkspaceRequest){
|
||||||
|
|
||||||
|
// we need to show the page to handle resources one by one from the workspace
|
||||||
|
formFirstStep.setVisible(false);
|
||||||
|
boolean resourcesPresent = receivedBean.getResources() != null && receivedBean.getResources().size() > 0 ? true : false;
|
||||||
|
formSecondStep.setVisible(resourcesPresent);
|
||||||
|
formThirdStep.setVisible(!resourcesPresent);
|
||||||
|
|
||||||
|
// add the resources to the container panel
|
||||||
|
if(workspaceResourcesContainer.getWidget() == null)
|
||||||
|
workspaceResourcesContainer.add(resourcesTable);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
// this is not a workspace request
|
||||||
|
formFirstStep.setVisible(false);
|
||||||
|
formThirdStep.setVisible(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(metadataProfilesFormatListbox.getSelectedItemText().equals(NONE_PROFILE))
|
||||||
|
selectedProfile.setText("");
|
||||||
|
else
|
||||||
|
selectedProfile.setText("Selected Profile is " + metadataProfilesFormatListbox.getSelectedItemText());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@UiHandler("goBackButtonFirstStep")
|
@UiHandler("goBackButtonFirstStep")
|
||||||
void onGoBackButtonFirstStep(ClickEvent e){
|
void onGoBackButtonFirstStep(ClickEvent e){
|
||||||
|
@ -850,7 +863,6 @@ public class CreateDatasetForm extends Composite{
|
||||||
// add tabs to resources panel
|
// add tabs to resources panel
|
||||||
tabPanel.selectTab(0);
|
tabPanel.selectTab(0);
|
||||||
|
|
||||||
|
|
||||||
// form container
|
// form container
|
||||||
AddResourceContainer container = new AddResourceContainer(datasetUrl);
|
AddResourceContainer container = new AddResourceContainer(datasetUrl);
|
||||||
container.add(tabPanel);
|
container.add(tabPanel);
|
||||||
|
@ -879,7 +891,7 @@ public class CreateDatasetForm extends Composite{
|
||||||
* Prepare the info icons of all core metadata info
|
* Prepare the info icons of all core metadata info
|
||||||
*/
|
*/
|
||||||
private void prepareInfoIcons() {
|
private void prepareInfoIcons() {
|
||||||
|
|
||||||
// tags
|
// tags
|
||||||
tagsPanel.prepareIcon(popupOpenedIds);
|
tagsPanel.prepareIcon(popupOpenedIds);
|
||||||
|
|
||||||
|
@ -1173,6 +1185,10 @@ public class CreateDatasetForm extends Composite{
|
||||||
licenseListbox.setEnabled(false);
|
licenseListbox.setEnabled(false);
|
||||||
organizationsListbox.setEnabled(false);
|
organizationsListbox.setEnabled(false);
|
||||||
addCustomFieldButton.setEnabled(false);
|
addCustomFieldButton.setEnabled(false);
|
||||||
|
metadataProfilesFormatListbox.setEnabled(false);
|
||||||
|
|
||||||
|
for(CustomFieldEntry ce: customFieldEntriesList)
|
||||||
|
ce.freeze();
|
||||||
|
|
||||||
// disable profile fields
|
// disable profile fields
|
||||||
for (MetaDataFieldSkeleton field : listOfMetadataFields) {
|
for (MetaDataFieldSkeleton field : listOfMetadataFields) {
|
||||||
|
|
|
@ -41,13 +41,13 @@ public class CustomFieldEntry extends Composite {
|
||||||
|
|
||||||
public CustomFieldEntry(HandlerManager eventBus, String key, String value, boolean isCustomCreatedByUser) {
|
public CustomFieldEntry(HandlerManager eventBus, String key, String value, boolean isCustomCreatedByUser) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
|
||||||
// save information
|
// save information
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.isCustomCreatedByUser = isCustomCreatedByUser;
|
this.isCustomCreatedByUser = isCustomCreatedByUser;
|
||||||
|
|
||||||
// remove the first appendbox
|
// remove the first appendbox
|
||||||
if(!isCustomCreatedByUser){
|
if(!isCustomCreatedByUser){
|
||||||
this.valueFieldPrepend.removeFromParent();
|
this.valueFieldPrepend.removeFromParent();
|
||||||
|
@ -63,11 +63,11 @@ public class CustomFieldEntry extends Composite {
|
||||||
public String getKey(){
|
public String getKey(){
|
||||||
|
|
||||||
if(isCustomCreatedByUser){
|
if(isCustomCreatedByUser){
|
||||||
|
|
||||||
return ((TextBox)this.keyFieldPrepend.getWidget(1)).getText();
|
return ((TextBox)this.keyFieldPrepend.getWidget(1)).getText();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -77,11 +77,11 @@ public class CustomFieldEntry extends Composite {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getValue(){
|
public String getValue(){
|
||||||
|
|
||||||
if(isCustomCreatedByUser){
|
if(isCustomCreatedByUser){
|
||||||
|
|
||||||
return ((TextBox)this.valueFieldPrepend.getWidget(1)).getText();
|
return ((TextBox)this.valueFieldPrepend.getWidget(1)).getText();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
@ -95,4 +95,13 @@ public class CustomFieldEntry extends Composite {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove delete button
|
||||||
|
*/
|
||||||
|
public void freeze() {
|
||||||
|
|
||||||
|
removeCustomField.setEnabled(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue