Managed Error cases
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/workspace-explorer-app@131489 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
cc88c81a83
commit
a65f6c45ae
|
@ -7,12 +7,14 @@ package org.gcube.portlets.user.workspaceexplorerapp.client;
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Element;
|
import com.google.gwt.dom.client.Element;
|
||||||
|
import com.google.gwt.dom.client.NodeList;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.event.logical.shared.ResizeEvent;
|
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||||
import com.google.gwt.event.logical.shared.ResizeHandler;
|
import com.google.gwt.event.logical.shared.ResizeHandler;
|
||||||
import com.google.gwt.user.client.DOM;
|
import com.google.gwt.user.client.DOM;
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.ui.RootPanel;
|
import com.google.gwt.user.client.ui.RootPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class WorkspaceExplorerApp.
|
* The Class WorkspaceExplorerApp.
|
||||||
|
@ -31,9 +33,9 @@ public class WorkspaceExplorerApp implements EntryPoint {
|
||||||
public void onModuleLoad() {
|
public void onModuleLoad() {
|
||||||
|
|
||||||
|
|
||||||
boolean jQueryLoaded = isjQueryLoaded();
|
/*boolean jQueryLoaded = isjQueryLoaded();
|
||||||
// GWT.log("Injected : "+Resources.RESOURCES.jquery().getText());
|
// GWT.log("Injected : "+Resources.RESOURCES.jquery().getText());
|
||||||
GWT.log("jQueryLoaded: "+jQueryLoaded);
|
GWT.log("jQueryLoaded: "+jQueryLoaded);*/
|
||||||
|
|
||||||
/*if (!jQueryLoaded) {
|
/*if (!jQueryLoaded) {
|
||||||
ScriptInjector.fromString(Resources.RESOURCES.jquery().getText())
|
ScriptInjector.fromString(Resources.RESOURCES.jquery().getText())
|
||||||
|
@ -46,6 +48,7 @@ public class WorkspaceExplorerApp implements EntryPoint {
|
||||||
.inject();*/
|
.inject();*/
|
||||||
|
|
||||||
appController = new WorkspaceExplorerAppController();
|
appController = new WorkspaceExplorerAppController();
|
||||||
|
mainPanel = new WorkspaceExplorerAppMainPanel(appController.getEventBus(), appController.getDisplayFields());
|
||||||
appController.go(this);
|
appController.go(this);
|
||||||
Window.addResizeHandler(new ResizeHandler() {
|
Window.addResizeHandler(new ResizeHandler() {
|
||||||
|
|
||||||
|
@ -55,7 +58,6 @@ public class WorkspaceExplorerApp implements EntryPoint {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mainPanel = new WorkspaceExplorerAppMainPanel(appController.getEventBus(), appController.getDisplayFields());
|
|
||||||
RootPanel.get(WorkspaceExplorerAppConstants.APPLICATION_DIV).add(mainPanel);
|
RootPanel.get(WorkspaceExplorerAppConstants.APPLICATION_DIV).add(mainPanel);
|
||||||
|
|
||||||
// WorkspaceExplorerFoooterPanel footerPanel = new WorkspaceExplorerFoooterPanel();
|
// WorkspaceExplorerFoooterPanel footerPanel = new WorkspaceExplorerFoooterPanel();
|
||||||
|
@ -82,14 +84,24 @@ public class WorkspaceExplorerApp implements EntryPoint {
|
||||||
GWT.log("headerH " + headerH);
|
GWT.log("headerH " + headerH);
|
||||||
int footerH = DOM.getElementById("footer_we").getClientHeight();
|
int footerH = DOM.getElementById("footer_we").getClientHeight();
|
||||||
GWT.log("footerH " + footerH);
|
GWT.log("footerH " + footerH);
|
||||||
int breadcrumbsH = DOM.getElementById("breadcrumbs_we").getClientHeight();
|
|
||||||
|
com.google.gwt.user.client.Element eBread = DOM.getElementById("breadcrumbs_we");
|
||||||
|
int breadcrumbsH = 0;
|
||||||
|
if(eBread!=null){
|
||||||
|
breadcrumbsH = eBread.getClientHeight();
|
||||||
GWT.log("breadcrumbs_we " + breadcrumbsH);
|
GWT.log("breadcrumbs_we " + breadcrumbsH);
|
||||||
|
}
|
||||||
|
|
||||||
int windowHeight = Window.getClientHeight();
|
int windowHeight = Window.getClientHeight();
|
||||||
GWT.log("rootHeight " + windowHeight);
|
GWT.log("rootHeight " + windowHeight);
|
||||||
int diff = windowHeight - (headerH+footerH+breadcrumbsH)-10;
|
int diff = windowHeight - (headerH+footerH+breadcrumbsH)-10;
|
||||||
int containerH = diff>0?diff:50;
|
int containerH = diff>0?diff:50;
|
||||||
DOM.getElementById(WorkspaceExplorerAppConstants.APPLICATION_DIV).getElementsByTagName("main").getItem(0).getStyle().setHeight(containerH, Unit.PX);
|
NodeList<Element> listE = DOM.getElementById(WorkspaceExplorerAppConstants.APPLICATION_DIV).getElementsByTagName("main");
|
||||||
// DOM.getElementById(WorkspaceExplorerAppConstants.APPLICATION_DIV).getStyle().setHeight(containerH, Unit.PX);
|
|
||||||
|
if(listE!=null && listE.getLength()>0){
|
||||||
|
Element el = listE.getItem(0);
|
||||||
|
el.getStyle().setHeight(containerH, Unit.PX);
|
||||||
|
// DOM.getElementById(WorkspaceExplorerAppConstants.APPLICATION_DIV).getStyle().setHeight(containerH, Unit.PX);
|
||||||
GWT.log("containerH " + containerH);
|
GWT.log("containerH " + containerH);
|
||||||
|
|
||||||
Element table = DOM.getElementById("data_grid_explorer");
|
Element table = DOM.getElementById("data_grid_explorer");
|
||||||
|
@ -97,6 +109,8 @@ public class WorkspaceExplorerApp implements EntryPoint {
|
||||||
int headerTableH = 0;
|
int headerTableH = 0;
|
||||||
table.getStyle().setHeight(containerH-headerTableH, Unit.PX);
|
table.getStyle().setHeight(containerH-headerTableH, Unit.PX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,6 +120,16 @@ public class WorkspaceExplorerApp implements EntryPoint {
|
||||||
* @param workspaceExplorerAppPanel the workspace explorer app panel
|
* @param workspaceExplorerAppPanel the workspace explorer app panel
|
||||||
*/
|
*/
|
||||||
public void updateExplorerPanel(WorkspaceExplorerAppPanel workspaceExplorerAppPanel){
|
public void updateExplorerPanel(WorkspaceExplorerAppPanel workspaceExplorerAppPanel){
|
||||||
mainPanel.updateMainPanel(workspaceExplorerAppPanel);
|
mainPanel.updateToExplorerPanel(workspaceExplorerAppPanel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update to error.
|
||||||
|
*
|
||||||
|
* @param widget the widget
|
||||||
|
*/
|
||||||
|
public void updateToError(Widget widget){
|
||||||
|
mainPanel.updateToError(widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,13 @@
|
||||||
|
|
||||||
package org.gcube.portlets.user.workspaceexplorerapp.client;
|
package org.gcube.portlets.user.workspaceexplorerapp.client;
|
||||||
|
|
||||||
import gwt.material.design.client.ui.MaterialToast;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.client.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
import org.gcube.portlets.user.workspaceexplorerapp.client.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.client.grid.DisplayField;
|
import org.gcube.portlets.user.workspaceexplorerapp.client.grid.DisplayField;
|
||||||
|
import org.gcube.portlets.user.workspaceexplorerapp.client.resources.WorkspaceExplorerResources;
|
||||||
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Alert;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.event.dom.client.ContextMenuEvent;
|
import com.google.gwt.event.dom.client.ContextMenuEvent;
|
||||||
|
@ -17,6 +18,7 @@ import com.google.gwt.event.dom.client.ContextMenuHandler;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.Image;
|
||||||
import com.google.gwt.user.client.ui.RootPanel;
|
import com.google.gwt.user.client.ui.RootPanel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,9 +29,7 @@ import com.google.gwt.user.client.ui.RootPanel;
|
||||||
*/
|
*/
|
||||||
public class WorkspaceExplorerAppController {
|
public class WorkspaceExplorerAppController {
|
||||||
|
|
||||||
// private VerticalPanel mainPanel = new VerticalPanel();
|
private WorkspaceExplorerAppPanel workspaceERP;
|
||||||
|
|
||||||
private WorkspaceExplorerAppPanel mainPanel;
|
|
||||||
private WorkspaceResourcesExplorerPanel wsResourcesExplorerPanel;
|
private WorkspaceResourcesExplorerPanel wsResourcesExplorerPanel;
|
||||||
private final HandlerManager eventBus = new HandlerManager(null);
|
private final HandlerManager eventBus = new HandlerManager(null);
|
||||||
private WorkspaceExplorerApp app;
|
private WorkspaceExplorerApp app;
|
||||||
|
@ -56,8 +56,10 @@ public class WorkspaceExplorerAppController {
|
||||||
|
|
||||||
//TODO CHECK FOLDER ID
|
//TODO CHECK FOLDER ID
|
||||||
if(folderId==null){
|
if(folderId==null){
|
||||||
Window.alert("Folder Id not found, It is not possible to retrieve a folder without a valid id");
|
String msg = "Folder Id not found, It is not possible to retrieve a folder without a valid id";
|
||||||
//return;
|
// Window.alert("Folder Id not found, It is not possible to retrieve a folder without a valid id");
|
||||||
|
showErrorPanel(msg);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RootPanel.get().addDomHandler(new ContextMenuHandler() {
|
RootPanel.get().addDomHandler(new ContextMenuHandler() {
|
||||||
|
@ -69,7 +71,6 @@ public class WorkspaceExplorerAppController {
|
||||||
}
|
}
|
||||||
}, ContextMenuEvent.getType());
|
}, ContextMenuEvent.getType());
|
||||||
|
|
||||||
MaterialToast.fireToast("Checking permissions...");
|
|
||||||
WorkspaceExplorerAppConstants.workspaceNavigatorService.getFolderIdFromEncrypted(folderId, new AsyncCallback<String>() {
|
WorkspaceExplorerAppConstants.workspaceNavigatorService.getFolderIdFromEncrypted(folderId, new AsyncCallback<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -80,13 +81,15 @@ public class WorkspaceExplorerAppController {
|
||||||
initWorkspaceExplorer(folderId);
|
initWorkspaceExplorer(folderId);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Window.alert("Folder Id not valid. An occurred when converting folder id");
|
// Window.alert("Folder Id not valid. An occurred when converting folder id");
|
||||||
|
showErrorPanel("Folder Id not valid. An occurred when converting folder id");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
Window.alert(caught.getMessage());
|
// Window.alert(caught.getMessage());
|
||||||
|
showErrorPanel(caught.getMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -96,6 +99,23 @@ public class WorkspaceExplorerAppController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show error panel.
|
||||||
|
*
|
||||||
|
* @param message the message
|
||||||
|
*/
|
||||||
|
private void showErrorPanel(String message){
|
||||||
|
Image error = new Image(WorkspaceExplorerResources.INSTANCE.eUnhappy().getSafeUri());
|
||||||
|
error.getElement().getStyle().setPaddingLeft(5, Unit.PX);
|
||||||
|
Alert alert = new Alert();
|
||||||
|
alert.setType(AlertType.ERROR);
|
||||||
|
alert.add(error);
|
||||||
|
alert.setClose(false);
|
||||||
|
alert.setHeading(message);
|
||||||
|
app.updateToError(alert);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inits the workspace explorer.
|
* Inits the workspace explorer.
|
||||||
*
|
*
|
||||||
|
@ -146,21 +166,11 @@ public class WorkspaceExplorerAppController {
|
||||||
}
|
}
|
||||||
}.schedule(1000);*/
|
}.schedule(1000);*/
|
||||||
|
|
||||||
mainPanel = new WorkspaceExplorerAppPanel(wsResourcesExplorerPanel);
|
workspaceERP = new WorkspaceExplorerAppPanel(wsResourcesExplorerPanel);
|
||||||
app.updateExplorerPanel(mainPanel);
|
app.updateExplorerPanel(workspaceERP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Gets the main panel.
|
|
||||||
// *
|
|
||||||
// * @return the mainPanel
|
|
||||||
// */
|
|
||||||
// public WorkspaceExplorerAppPanel getMainPanel() {
|
|
||||||
// return mainPanel;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the event bus.
|
* Gets the event bus.
|
||||||
*
|
*
|
||||||
|
@ -176,6 +186,6 @@ public class WorkspaceExplorerAppController {
|
||||||
* @return the display fields
|
* @return the display fields
|
||||||
*/
|
*/
|
||||||
public DisplayField[] getDisplayFields(){
|
public DisplayField[] getDisplayFields(){
|
||||||
return new DisplayField[]{DisplayField.ICON, DisplayField.NAME, DisplayField.OWNER, DisplayField.CREATION_DATE};
|
return WorkspaceResourcesExplorerPanel.displayFields;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,8 +84,8 @@ public class WorkspaceExplorerAppMainPanel extends Composite {
|
||||||
* Note that depending on the widget that is used, it may be necessary to
|
* Note that depending on the widget that is used, it may be necessary to
|
||||||
* implement HasHTML instead of HasText.
|
* implement HasHTML instead of HasText.
|
||||||
*
|
*
|
||||||
* @param workspaceExplorerAppPanel the workspace explorer app panel
|
|
||||||
* @param handlerManager the handler manager
|
* @param handlerManager the handler manager
|
||||||
|
* @param displayFields the display fields
|
||||||
*/
|
*/
|
||||||
public WorkspaceExplorerAppMainPanel(HandlerManager handlerManager, DisplayField[] displayFields) {
|
public WorkspaceExplorerAppMainPanel(HandlerManager handlerManager, DisplayField[] displayFields) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
@ -153,9 +153,27 @@ public class WorkspaceExplorerAppMainPanel extends Composite {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateMainPanel(WorkspaceExplorerAppPanel workspaceExplorerAppPanel){
|
/**
|
||||||
|
* Update to explorer panel.
|
||||||
|
*
|
||||||
|
* @param workspaceExplorerAppPanel the workspace explorer app panel
|
||||||
|
*/
|
||||||
|
public void updateToExplorerPanel(WorkspaceExplorerAppPanel workspaceExplorerAppPanel){
|
||||||
explorer_main_container.clear();
|
explorer_main_container.clear();
|
||||||
explorer_main_container.add(workspaceExplorerAppPanel);
|
explorer_main_container.add(workspaceExplorerAppPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update to error.
|
||||||
|
*
|
||||||
|
* @param error the error
|
||||||
|
*/
|
||||||
|
public void updateToError(Widget error){
|
||||||
|
explorer_main_container.clear();
|
||||||
|
explorer_main_container.add(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,10 @@ import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class SplitPanel.
|
* The Class WorkspaceExplorerAppPanel.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
* Jun 23, 2015
|
* Sep 19, 2016
|
||||||
*/
|
*/
|
||||||
public class WorkspaceExplorerAppPanel extends SimplePanel{
|
public class WorkspaceExplorerAppPanel extends SimplePanel{
|
||||||
|
|
||||||
|
@ -19,15 +19,13 @@ public class WorkspaceExplorerAppPanel extends SimplePanel{
|
||||||
/**
|
/**
|
||||||
* Instantiates a new workspace explorer app panel.
|
* Instantiates a new workspace explorer app panel.
|
||||||
*
|
*
|
||||||
* @param splitterSize the splitter size
|
* @param aPanel the a panel
|
||||||
* @param navigation the navigation
|
|
||||||
* @param wsExplorer the ws explorer
|
|
||||||
*/
|
*/
|
||||||
public WorkspaceExplorerAppPanel(Widget wsExplorerPanel) {
|
public WorkspaceExplorerAppPanel(Widget aPanel) {
|
||||||
ensureDebugId("WorkspaceExplorerAppPanel");
|
ensureDebugId("WorkspaceExplorerAppPanel");
|
||||||
this.getElement().setId("WorkspaceExplorerAppPanel");
|
this.getElement().setId("WorkspaceExplorerAppPanel");
|
||||||
this.getElement().setAttribute("id","WorkspaceExplorerAppPanel");
|
this.getElement().setAttribute("id","WorkspaceExplorerAppPanel");
|
||||||
setWidth("100%");
|
setWidth("100%");
|
||||||
add(wsExplorerPanel);
|
add(aPanel);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -64,7 +64,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
// private ScrollPanel southPanel = new ScrollPanel();
|
// private ScrollPanel southPanel = new ScrollPanel();
|
||||||
private String folderId;
|
private String folderId;
|
||||||
private String folderName;
|
private String folderName;
|
||||||
private DisplayField[] displayFields = new DisplayField[]{DisplayField.ICON, DisplayField.NAME, DisplayField.OWNER, DisplayField.CREATION_DATE};
|
public static final DisplayField[] displayFields = new DisplayField[]{DisplayField.ICON, DisplayField.NAME, DisplayField.OWNER, DisplayField.CREATION_DATE};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new workspace folder explorer select panel.
|
* Instantiates a new workspace folder explorer select panel.
|
||||||
|
@ -102,15 +102,6 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
initPanel("");
|
initPanel("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the displayFields
|
|
||||||
*/
|
|
||||||
public DisplayField[] getDisplayFields() {
|
|
||||||
|
|
||||||
return displayFields;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new workspace explorer select panel.
|
* Instantiates a new workspace explorer select panel.
|
||||||
*
|
*
|
||||||
|
|
|
@ -33,4 +33,23 @@ public interface WorkspaceExplorerResources extends ClientBundle {
|
||||||
@Source("_32/groups_folder.png")
|
@Source("_32/groups_folder.png")
|
||||||
ImageResource shared_folder();
|
ImageResource shared_folder();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Warning.
|
||||||
|
*
|
||||||
|
* @return the image resource
|
||||||
|
*/
|
||||||
|
@Source("warning.png")
|
||||||
|
ImageResource warning();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* E unhappy.
|
||||||
|
*
|
||||||
|
* @return the image resource
|
||||||
|
*/
|
||||||
|
@Source("e-unhappy.png")
|
||||||
|
ImageResource eUnhappy();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 860 B |
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Loading…
Reference in New Issue