task_21363 #1

Closed
francesco.mangiacrapa wants to merge 53 commits from task_21363 into master
5 changed files with 133 additions and 38 deletions
Showing only changes of commit ae9f61a4f2 - Show all commits

View File

@ -30,7 +30,7 @@ import com.google.gwt.view.client.Range;
import com.google.gwt.view.client.SelectionModel;
import com.google.gwt.view.client.SingleSelectionModel;
// TODO: Auto-generated Javadoc
/**
* The Class ContentModeratorPaginatedView.
*

View File

@ -4,7 +4,6 @@ import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class ContentModeratorSystemBaseView.
*
@ -42,7 +41,6 @@ public class ContentModeratorSystemBaseView {
centerPanel.add(w);
}
/**
* Adds the to bottom.
*

View File

@ -0,0 +1,63 @@
package org.gcube.portlets.widgets.ckancontentmoderator.client.ui;
import java.util.List;
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import com.github.gwtbootstrap.client.ui.AlertBlock;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.TextArea;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
public class DoActionCMS extends Composite {
private static DoActionCMSUiBinder uiBinder = GWT.create(DoActionCMSUiBinder.class);
interface DoActionCMSUiBinder extends UiBinder<Widget, DoActionCMS> {
}
@UiField
HTML htmlDisplayMessage;
@UiField
CheckBox checkBoxPermDelete;
@UiField
TextArea txtMsgReason;
@UiField
Button buttonActionConfirmYES;
@UiField
Button buttonActionConfirmNO;
@UiField
AlertBlock alertBlockDoAction;
public DoActionCMS(ItemStatus fromStatus, ItemStatus toStatus, List<CatalogueDataset> listSelectItems) {
initWidget(uiBinder.createAndBindUi(this));
int count = listSelectItems.size();
String msg = "Going to update status of";
if (count > 0) {
if (count == 1) {
msg += " one item";
} else {
msg += " " + count + " items";
}
msg += " from <b>" + fromStatus.getLabel() + "</b> to <b>" + toStatus.getLabel() + "</b>. Confirm?";
} else
return;
htmlDisplayMessage.setHTML(msg);
}
}

View File

@ -0,0 +1,24 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
</ui:style>
<g:HTMLPanel>
<b:AlertBlock ui:field="alertBlockDoAction">
<g:HTML ui:field="htmlDisplayMessage"></g:HTML>
<b:Form type="VERTICAL">
<b:TextArea placeholder="Rejecting reason..."
ui:field="txtMsgReason" />
<b:CheckBox ui:field="checkBoxPermDelete">Permanently Delete</b:CheckBox>
<b:Paragraph>
<b:Button type="PRIMARY" ui:field="buttonActionConfirmYES">YES</b:Button>
<b:Button ui:field="buttonActionConfirmNO">NO</b:Button>
</b:Paragraph>
</b:Form>
</b:AlertBlock>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -8,18 +8,11 @@ import org.gcube.portlets.widgets.ckancontentmoderator.client.events.CheckBoxSel
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.table.ItemsTable.DISPLAY_FIELD;
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
import com.github.gwtbootstrap.client.ui.AlertBlock;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.Dropdown;
import com.github.gwtbootstrap.client.ui.Heading;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.github.gwtbootstrap.client.ui.base.AlertBase;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.event.ClosedEvent;
import com.github.gwtbootstrap.client.ui.event.ClosedHandler;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
@ -143,23 +136,24 @@ public class HomeView extends Composite {
@Override
public void onClick(ClickEvent event) {
selectedItems = paginatedView.getSelectItems();
int count = selectedItems.size();
String msg = "Going to update status of";
if (count > 0) {
if (count == 1) {
msg += " one item";
} else {
msg += " " + count + " items";
// selectedItems = paginatedView.getSelectItems();
// int count = selectedItems.size();
// String msg = "Going to update status of";
// if (count > 0) {
// if (count == 1) {
// msg += " one item";
// } else {
// msg += " " + count + " items";
// }
//
// msg += " from <b>" + displayingItemStatus.getLabel() + "</b> to <b>" + navLink.getText()
// + "</b>. Confirm?";
// } else
// return;
if(paginatedView.getSelectItems().size()>0) {
showConfirm(navLink);
}
msg += " from <b>" + displayingItemStatus.getLabel() + "</b> to <b>" + navLink.getText()
+ "</b>. Confirm?";
}else
return;
showConfirm(msg);
}
});
}
@ -207,10 +201,27 @@ public class HomeView extends Composite {
*
* @param msg the msg
*/
public void showConfirm(String msg) {
public void showConfirm(NavLink navLink) {
confirmPanelContainer.clear();
GWT.log("showConfirm clicked link: "+navLink.getText());
ItemStatus fromStatus = displayingItemStatus;
ItemStatus toStatus = null;
final AlertBlock newAlertBlock = new AlertBlock(AlertType.DEFAULT);
for (ItemStatus theStatus : ItemStatus.values()) {
if(theStatus.getLabel().compareTo(navLink.getText().trim())==0) {
toStatus = theStatus;
break;
}
}
GWT.log("Do action on from: "+fromStatus + " to: "+toStatus);
if(toStatus==null) {
return;
}
DoActionCMS doActionCMS = new DoActionCMS(fromStatus, toStatus, paginatedView.getSelectItems());
/*final AlertBlock newAlertBlock = new AlertBlock(AlertType.DEFAULT);
newAlertBlock.setAnimation(true);
newAlertBlock.setClose(true);
@ -244,9 +255,9 @@ public class HomeView extends Composite {
buttonActionConfirmNo.setText("NO");
newAlertBlock.add(buttonActionConfirmNo);
newAlertBlock.setHTML(msg);
newAlertBlock.setHTML(msg);*/
confirmPanelContainer.add(newAlertBlock);
confirmPanelContainer.add(doActionCMS);
}
/**
@ -266,7 +277,6 @@ public class HomeView extends Composite {
}
paginatedView.loadItemsForStatus(itemStatus);
GWT.log("loadItemsWithStatus end");
}