Added dialog confirm

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@119761 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-10-14 15:15:13 +00:00
parent 9dc3d531c5
commit 1b763d0978
2 changed files with 147 additions and 46 deletions

View File

@ -592,32 +592,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
});
eventBus.addHandler(DeleteBulkEvent.TYPE, new DeleteBulkEventHandler() {
@Override
public void onDeleteBulk(final DeleteBulkEvent deleteBulkEvent) {
/*NEVER USED
rpcWorkspaceService.deleteBulk(deleteBulkEvent.getBulkId(), new AsyncCallback<Boolean>() {
@Override
public void onFailure(Throwable caught) {
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR+ "deleting bulk "+ ConstantsExplorer.TRY_AGAIN, null);
}
@Override
public void onSuccess(Boolean result) {
if(result)
BulkCreatorWindow.getInstance().removeProgress(deleteBulkEvent.getBulkId());
}
});*/
}
});
eventBus.addHandler(GetShareLinkEvent.TYPE, new GetSharedLinkEventHandler() {
@Override
@ -811,9 +785,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
default:
}
}
});
@ -842,8 +813,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
}
});
}
});
@ -879,7 +848,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
});
eventBus.addHandler(PreviewMessageEvent.TYPE, new PreviewMessageEventHandler() {
@Override
@ -936,23 +904,10 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override
public void onSuccess(MessageModel result) {
//Commented for Massi
// if(openMessageEvent.getOpenType().equals(OpenType.REPLY))
//// new SendMessage(result, MessageOperationType.OPEN); //OPEN MESSAGE
//// notifySubscriber(openMessageEvent);
// else{
// openMessageEvent.setMessage(result);
//// notifySubscriber(openMessageEvent);
//// new SendMessage(result, MessageOperationType.FORWARD);
// }
openMessageEvent.setMessage(result); //This fill item text and list contact
notifySubscriber(openMessageEvent);
}
});
}
});
@ -965,7 +920,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
});
eventBus.addHandler(SendMessageEvent.TYPE, new SendMessageEventHandler() {
@Override

View File

@ -0,0 +1,147 @@
/**
*
*/
package org.gcube.portlets.user.workspace.client.view.windows;
import org.gcube.portlets.user.workspace.client.resources.Resources;
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.resources.client.ImageResource;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class DialogConfirm.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 19, 2015
*/
public class DialogConfirm extends DialogBox implements ClickHandler {
private DockPanel dock = new DockPanel();
private Button yesButton;
private VerticalPanel vpContainer;
private ImageResource loading = Resources.ICONS.loading();
private HorizontalPanel hpButtons = new HorizontalPanel();
private Button noButton;
/**
* Instantiates a new dialog confirm.
*
* @param img the img
* @param caption the caption
* @param text the text
*/
public DialogConfirm(Image img, String caption, String text) {
dock.setSpacing(4);
dock.setWidth("100%");
setText(caption);
yesButton = new Button("Yes");
noButton = new Button("No", this);
noButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
hide();
}
});
vpContainer = new VerticalPanel();
vpContainer.getElement().getStyle().setMargin(20.0, Unit.PX);
vpContainer.add(new HTML(text));
hpButtons = new HorizontalPanel();
hpButtons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
// hpButtons.getElement().getStyle().setMarginTop(20.0, Unit.PX);
hpButtons.setSpacing(3);
yesButton.getElement().getStyle().setMarginRight(20.0, Unit.PX);
hpButtons.add(yesButton);
hpButtons.add(noButton);
dock.add(hpButtons, DockPanel.SOUTH);
dock.setCellHorizontalAlignment(hpButtons, DockPanel.ALIGN_CENTER);
if (img != null)
dock.add(img, DockPanel.WEST);
dock.add(vpContainer, DockPanel.CENTER);
setWidget(dock);
}
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event
* .dom.client.ClickEvent)
*/
@Override
public void onClick(ClickEvent event) {
// hide();
}
/**
* Loader.
*
* @param message the message
*/
public void loader(String message){
try{
dock.remove(hpButtons);
}catch(Exception e){}
vpContainer.clear();
HorizontalPanel hpMask = new HorizontalPanel();
hpMask.add(new Image(loading));
HTML html = new HTML(message);
html.getElement().getStyle().setMarginLeft(5, Unit.PX);
hpMask.add(html);
vpContainer.add(hpMask);
}
/**
* Adds the to center panel.
*
* @param w the w
*/
public void addToCenterPanel(Widget w) {
vpContainer.add(w);
}
/**
* Gets the dock.
*
* @return the dock
*/
public DockPanel getDock() {
return dock;
}
/**
* Gets the yes button.
*
* @return the yes button
*/
public Button getYesButton() {
return yesButton;
}
/**
* Gets the no button.
*
* @return the no button
*/
public Button getNoButton() {
return noButton;
}
}