fixing Bug #12914 The form to add/choice the resources to publishing remains frozen
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@174234 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ea24c207dc
commit
b3e9a91388
|
@ -1,4 +1,9 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset
|
||||
component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-4-1"
|
||||
date="2018-11-20">
|
||||
<Change>[Bug #12914] The form to add/choice the resources to publishing remains frozen</Change>
|
||||
</Changeset>
|
||||
<Changeset
|
||||
component="org.gcube.portlets-widgets.ckan-metadata-publisher-widget.1-4-0"
|
||||
date="2018-09-28">
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -12,7 +12,7 @@
|
|||
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>ckan-metadata-publisher-widget</artifactId>
|
||||
<version>1.4.0-SNAPSHOT</version>
|
||||
<version>1.4.1-SNAPSHOT</version>
|
||||
<name>gCube Ckan metadata publisher widget</name>
|
||||
|
||||
<description>
|
||||
|
|
|
@ -53,7 +53,7 @@ public class ResourceCellRight extends AbstractCell<ResourceElementBean>{
|
|||
public void onBrowserEvent(com.google.gwt.cell.client.Cell.Context context,
|
||||
Element parent, ResourceElementBean value, NativeEvent event,
|
||||
ValueUpdater<ResourceElementBean> valueUpdater) {
|
||||
if(value == null || TwinColumnSelectionMainPanel.freezed)
|
||||
if(value == null || TwinColumnSelectionMainPanel.isFroozen())
|
||||
return;
|
||||
super.onBrowserEvent(context, parent, value, event, valueUpdater);
|
||||
ResourceInfoForm info = new ResourceInfoForm(value, valueUpdater);
|
||||
|
|
|
@ -35,12 +35,13 @@ import com.google.gwt.view.client.SelectionChangeEvent;
|
|||
/**
|
||||
* The twin column panels for selection of the files to attach to the catalague product.
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR
|
||||
*/
|
||||
public class TwinColumnSelectionMainPanel extends Composite{
|
||||
|
||||
@UiField
|
||||
@UiField
|
||||
VerticalPanel leftContainer;
|
||||
@UiField
|
||||
@UiField
|
||||
VerticalPanel rightContainer;
|
||||
@UiField
|
||||
VerticalPanel buttonsPanel;
|
||||
|
@ -79,7 +80,7 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean freezed = false;
|
||||
private static boolean frozen = false;
|
||||
private List<PathBean> pathListBeans = new ArrayList<PathBean>();
|
||||
private static final String PANEL_BORDER_COLOR = "#8899a6";
|
||||
private static final String PANEL_HEIGHT = "400px";
|
||||
|
@ -107,7 +108,8 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
|
||||
public TwinColumnSelectionMainPanel(ResourceElementBean initialBean) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
frozen = false;
|
||||
|
||||
GWT.log(initialBean.toString());
|
||||
|
||||
this.initialBean = initialBean;
|
||||
|
@ -146,10 +148,10 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
// initialize the left side list
|
||||
ResourceCellLeft cell = new ResourceCellLeft();
|
||||
|
||||
// Set a key provider that provides a unique key for each object.
|
||||
// Set a key provider that provides a unique key for each object.
|
||||
cellListLeft = new CellList<ResourceElementBean>(cell, ResourceElementBean.KEY_PROVIDER);
|
||||
cellListLeft.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
|
||||
|
||||
cellListLeft.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
|
||||
|
||||
// set page size
|
||||
int size = initialBean.isFolder() ? initialBean.getChildren().size() : 1;
|
||||
cellListLeft.setPageSize(size);
|
||||
|
@ -163,13 +165,13 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
|
||||
if(freezed)
|
||||
if(frozen)
|
||||
return;
|
||||
|
||||
Iterator<ResourceElementBean> selectedObjectsIterator = selectionModelLeft.getSelectedSet().iterator();
|
||||
|
||||
while (selectedObjectsIterator.hasNext()) {
|
||||
ResourceElementBean selectedBean = (ResourceElementBean) selectedObjectsIterator.next();
|
||||
ResourceElementBean selectedBean = selectedObjectsIterator.next();
|
||||
if(selectedBean.isFolder()){
|
||||
|
||||
// a single folder selected
|
||||
|
@ -240,7 +242,7 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
dataProviderLeft.setList(initialBean.getChildren());
|
||||
cellListLeft.setPageSize(initialBean.getChildren().size());
|
||||
dataProviderLeft.refresh();
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -303,9 +305,9 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
// initialize the left side list
|
||||
ResourceCellRight cell = new ResourceCellRight();
|
||||
|
||||
// Set a key provider that provides a unique key for each object.
|
||||
// Set a key provider that provides a unique key for each object.
|
||||
cellListRight = new CellList<ResourceElementBean>(cell, ResourceElementBean.KEY_PROVIDER);
|
||||
cellListRight.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
|
||||
cellListRight.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
|
||||
cellListRight.setValueUpdater(new ValueUpdater<ResourceElementBean>() {
|
||||
|
||||
@Override
|
||||
|
@ -325,7 +327,7 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
selectionModelRight.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
|
||||
if(freezed)
|
||||
if(frozen)
|
||||
return;
|
||||
|
||||
enableMoveToLeftButtons(selectionModelRight.getSelectedSet());
|
||||
|
@ -432,9 +434,9 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
|
||||
Iterator<ResourceElementBean> iterator = setSelected.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
ResourceElementBean resourceElementBean = (ResourceElementBean) iterator
|
||||
ResourceElementBean resourceElementBean = iterator
|
||||
.next();
|
||||
resourceElementBean.setToBeAdded(true);
|
||||
resourceElementBean.setToBeAdded(true);
|
||||
|
||||
int indexRight = dataProviderRight.getList().indexOf(resourceElementBean);
|
||||
if(indexRight >= 0)
|
||||
|
@ -461,8 +463,8 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
|
||||
Iterator<ResourceElementBean> iterator = setSelected.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
ResourceElementBean resourceElementBean = (ResourceElementBean) iterator.next();
|
||||
resourceElementBean.setToBeAdded(false);
|
||||
ResourceElementBean resourceElementBean = iterator.next();
|
||||
resourceElementBean.setToBeAdded(false);
|
||||
}
|
||||
|
||||
Collections.sort(dataProviderLeft.getList());
|
||||
|
@ -475,11 +477,11 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
*/
|
||||
public void freeze() {
|
||||
|
||||
freezed = true;
|
||||
frozen = true;
|
||||
|
||||
Iterator<Widget> iteratorOverPath = breadcrumbs.iterator();
|
||||
while (iteratorOverPath.hasNext()) {
|
||||
Widget widget = (Widget) iteratorOverPath.next();
|
||||
Widget widget = iteratorOverPath.next();
|
||||
if(widget instanceof NavLink)
|
||||
((NavLink)widget).setActive(false);
|
||||
}
|
||||
|
@ -495,12 +497,12 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
* @return the resources to save
|
||||
*/
|
||||
public ResourceElementBean getResourcesToPublish(){
|
||||
|
||||
|
||||
List<ResourceElementBean> current = dataProviderRight.getList();
|
||||
|
||||
|
||||
ResourceElementBean toReturn = new ResourceElementBean();
|
||||
List<ResourceElementBean> children = new ArrayList<ResourceElementBean>();
|
||||
|
||||
|
||||
for (ResourceElementBean resource : current) {
|
||||
if(resource.isToBeAdded() && !resource.isFolder()){ // be sure ...
|
||||
ResourceElementBean beanWithoutChildren = new ResourceElementBean(resource);
|
||||
|
@ -508,11 +510,20 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
children.add(beanWithoutChildren);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
toReturn.setChildren(children);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the freezed
|
||||
*/
|
||||
public static boolean isFroozen() {
|
||||
|
||||
return frozen;
|
||||
}
|
||||
|
||||
// @UiHandler("getResources")
|
||||
// void getResources(ClickEvent ce){
|
||||
// getResourcesToPublish();
|
||||
|
@ -527,7 +538,7 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
// boolean reduce = (pathListBeans.size() - 2) > PATH_THRESHOLD;
|
||||
//
|
||||
// GWT.log("Is to reduce? " + reduce);
|
||||
//
|
||||
//
|
||||
// GWT.log("Full size is " + pathListBeans.size());
|
||||
//
|
||||
// if(!reduce){
|
||||
|
|
|
@ -177,8 +177,8 @@ public class CreateDatasetForm extends Composite{
|
|||
private static final String TRYING_TO_CREATE_PRODUCT = "Trying to publish the item, please wait...";
|
||||
protected static final String MISSING_PUBLISH_RIGHTS = "It seems you are not authorized to publish on catalogue. Request it to the VRE manager or the portal administrator.";
|
||||
|
||||
// tab panel
|
||||
private TabPanel tabPanel;
|
||||
// tab panel
|
||||
private TabPanel tabPanel;
|
||||
|
||||
// add resource form
|
||||
private AddResourceToDataset resourceForm;
|
||||
|
@ -326,16 +326,16 @@ public class CreateDatasetForm extends Composite{
|
|||
tagsPanel.setVocabulary(vocabularyTags);
|
||||
|
||||
// retrieve custom fields
|
||||
Map<String, List<String>> customFieldsMap = bean.getCustomFields();
|
||||
Map<String, List<String>> customFieldsMap = bean.getCustomFields();
|
||||
|
||||
// TODO Check if these tags are ok for the vocabulary
|
||||
if(customFieldsMap != null && vocabularyTags == null){
|
||||
|
||||
// get the keys and put them as tags
|
||||
// get the keys and put them as tags
|
||||
Iterator<Entry<String, List<String>>> iteratorOverCustomField = customFieldsMap.entrySet().iterator();
|
||||
|
||||
while (iteratorOverCustomField.hasNext()) {
|
||||
Map.Entry<java.lang.String, java.util.List<java.lang.String>> entry = (Map.Entry<java.lang.String, java.util.List<java.lang.String>>) iteratorOverCustomField
|
||||
Map.Entry<java.lang.String, java.util.List<java.lang.String>> entry = iteratorOverCustomField
|
||||
.next();
|
||||
|
||||
List<String> values = entry.getValue();
|
||||
|
@ -372,7 +372,7 @@ public class CreateDatasetForm extends Composite{
|
|||
nameTitleOrganizationMap.put(organization.getTitle(), organization.getName());
|
||||
}
|
||||
|
||||
// force the selection of the first one, and retrieve the list of profiles
|
||||
// force the selection of the first one, and retrieve the list of profiles
|
||||
organizationsListbox.setSelectedIndex(0);
|
||||
|
||||
// add change handler to dynamically retrieve the list of profiles
|
||||
|
@ -535,7 +535,7 @@ public class CreateDatasetForm extends Composite{
|
|||
metadataTypeListbox.setSelectedIndex(0);
|
||||
|
||||
// get the name of the organization from the title
|
||||
String selectedOrganizationTitle = organizationsListbox.getSelectedItemText();
|
||||
String selectedOrganizationTitle = organizationsListbox.getSelectedItemText();
|
||||
final String orgName = nameTitleOrganizationMap.get(selectedOrganizationTitle);
|
||||
|
||||
// try to retrieve the profiles
|
||||
|
@ -597,7 +597,7 @@ public class CreateDatasetForm extends Composite{
|
|||
|
||||
|
||||
// check also for tags (if for that context there is a vocabulary or not)
|
||||
tagsPanel.setVisible(false);
|
||||
tagsPanel.setVisible(false);
|
||||
setAlertBlock("Checking for tags vocabulary, please wait...", AlertType.INFO, true);
|
||||
ckanServices.getTagsForOrganization(orgName, new AsyncCallback<List<String>>() {
|
||||
|
||||
|
@ -645,7 +645,7 @@ public class CreateDatasetForm extends Composite{
|
|||
if(profiles != null && !profiles.isEmpty()){
|
||||
for(MetaDataProfileBean metadataBean: profiles){
|
||||
|
||||
metadataTypeListbox.addItem(metadataBean.getType());
|
||||
metadataTypeListbox.addItem(metadataBean.getType());
|
||||
|
||||
// add handler on select
|
||||
metadataTypeListbox.addChangeHandler(new ChangeHandler() {
|
||||
|
@ -683,7 +683,7 @@ public class CreateDatasetForm extends Composite{
|
|||
}
|
||||
|
||||
metadataTypesControlGroup.setVisible(true);
|
||||
}else{
|
||||
}else{
|
||||
// just hide this listbox
|
||||
metadataTypesControlGroup.setVisible(false);
|
||||
metadataFieldsPanel.clear();
|
||||
|
@ -758,7 +758,7 @@ public class CreateDatasetForm extends Composite{
|
|||
}
|
||||
metadataFieldsPanel.add(extrasCategory);
|
||||
}
|
||||
metadataFieldsPanel.setVisible(true);
|
||||
metadataFieldsPanel.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -816,7 +816,7 @@ public class CreateDatasetForm extends Composite{
|
|||
*/
|
||||
private void actionsAfterOnContinue(){
|
||||
|
||||
// check what to do
|
||||
// check what to do
|
||||
if(isWorkspaceRequest){
|
||||
|
||||
// we need to show the page to handle resources one by one from the workspace
|
||||
|
@ -993,7 +993,7 @@ public class CreateDatasetForm extends Composite{
|
|||
receivedBean.setResourceRoot(resourcesTwinPanel.getResourcesToPublish());
|
||||
receivedBean.setCustomFields(customFieldsMap);
|
||||
|
||||
// alert
|
||||
// alert
|
||||
alertOnCreate(TRYING_TO_CREATE_PRODUCT, AlertType.INFO, false);
|
||||
|
||||
// invoke the create method
|
||||
|
@ -1020,8 +1020,8 @@ public class CreateDatasetForm extends Composite{
|
|||
goToDatasetButtonPanel.setVisible(true);
|
||||
goToDatasetButton.setVisible(true);
|
||||
goToDatasetButton.setText(
|
||||
(datasetUrl.length() > 100 ?
|
||||
datasetUrl.substring(0, 100) + "..." : datasetUrl)
|
||||
datasetUrl.length() > 100 ?
|
||||
datasetUrl.substring(0, 100) + "..." : datasetUrl
|
||||
);
|
||||
// goToDatasetButton.setHref(datasetUrl);
|
||||
goToDatasetButton.addClickHandler(new ClickHandler() {
|
||||
|
@ -1083,7 +1083,7 @@ public class CreateDatasetForm extends Composite{
|
|||
// add the new content of the main panel
|
||||
createDatasetMainPanel.add(container);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}else{
|
||||
|
@ -1337,8 +1337,8 @@ public class CreateDatasetForm extends Composite{
|
|||
return "Missing title";
|
||||
}
|
||||
|
||||
// better check for the title
|
||||
String[] splittedTitle = title.split(" ");
|
||||
// better check for the title
|
||||
String[] splittedTitle = title.split(" ");
|
||||
|
||||
for (String word : splittedTitle) {
|
||||
String replaced = word.replaceAll(REGEX_TITLE_PRODUCT_SUBWORD, "");
|
||||
|
@ -1390,7 +1390,7 @@ public class CreateDatasetForm extends Composite{
|
|||
* @return
|
||||
*/
|
||||
private boolean checkSelectedMetaDataProfile() {
|
||||
return metadataTypeListbox.getSelectedItemText().equals(NONE_PROFILE) && (metadataTypeListbox.getItemCount() != 1);
|
||||
return metadataTypeListbox.getSelectedItemText().equals(NONE_PROFILE) && metadataTypeListbox.getItemCount() != 1;
|
||||
}
|
||||
|
||||
@UiHandler("resetButton")
|
||||
|
@ -1520,8 +1520,8 @@ public class CreateDatasetForm extends Composite{
|
|||
*/
|
||||
private boolean hideManageResources(){
|
||||
|
||||
return receivedBean.getResourceRoot() == null || (receivedBean.getResourceRoot().isFolder() && (receivedBean.getResourceRoot().getChildren() == null ||
|
||||
receivedBean.getResourceRoot().getChildren().isEmpty()));
|
||||
return receivedBean.getResourceRoot() == null || receivedBean.getResourceRoot().isFolder() && (receivedBean.getResourceRoot().getChildren() == null ||
|
||||
receivedBean.getResourceRoot().getChildren().isEmpty());
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue