*/
package gr.grnet.pithos.web.client;
-import gr.grnet.pithos.web.client.PithosDisclosurePanel.Style;
import gr.grnet.pithos.web.client.commands.UploadFileCommand;
import gr.grnet.pithos.web.client.foldertree.AccountResource;
import gr.grnet.pithos.web.client.foldertree.File;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.RepeatingCommand;
import com.google.gwt.http.client.Response;
import com.google.gwt.http.client.URL;
import com.google.gwt.i18n.client.Dictionary;
-import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.resources.client.ImageResource;
-import com.google.gwt.resources.client.ClientBundle.Source;
import com.google.gwt.resources.client.ImageResource.ImageOptions;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Cookies;
/**
* The bottom panel that contains the status bar.
*/
- private StatusPanel statusPanel = null;
+ StatusPanel statusPanel = null;
/**
* The file list widget.
fileList = new FileList(this, images);
inner.add(fileList);
- inner.add(createUploadArea());
-
trees = new VerticalPanel();
trees.setWidth("100%");
// Call the window resized handler to get the initial sizes setup. Doing
// this in a deferred command causes it to occur after all widgets'
// sizes have been computed by the browser.
- Scheduler.get().scheduleDeferred(new ScheduledCommand() {
-
- @Override
- public void execute() {
+ Scheduler.get().scheduleIncremental(new RepeatingCommand() {
+
+ @Override
+ public boolean execute() {
+ if (!isCloudbarReady())
+ return true;
onWindowResized(Window.getClientHeight());
- }
- });
-
+ return false;
+ }
+ });
+
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
Window.Location.assign(otherProperties.get("loginUrl") + Window.Location.getHref());
}
- protected void fetchAccount(final Command callback) {
+ public void fetchAccount(final Command callback) {
String path = "?format=json";
GetRequest<AccountResource> getAccount = new GetRequest<AccountResource>(AccountResource.class, getApiPath(), username, path) {
protected void onWindowResized(int height) {
// Adjust the split panel to take up the available room in the window.
- int newHeight = height - splitPanel.getAbsoluteTop();
+ int newHeight = height - splitPanel.getAbsoluteTop() - 153;
if (newHeight < 1)
newHeight = 1;
splitPanel.setHeight("" + newHeight);
inner.setHeight("" + newHeight);
}
-
+
+ native boolean isCloudbarReady()/*-{
+ if ($wnd.$("div.servicesbar") && $wnd.$("div.servicesbar").height() > 0)
+ return true;
+ return false;
+ }-*/;
+
@Override
public void onResize(ResizeEvent event) {
int height = event.getHeight();
*/
public void displayError(String msg) {
messagePanel.displayError(msg);
+ onWindowResized(Window.getClientHeight());
}
/**
*/
public void displayWarning(String msg) {
messagePanel.displayWarning(msg);
+ onWindowResized(Window.getClientHeight());
}
/**
*/
public void displayInformation(String msg) {
messagePanel.displayInformation(msg);
+ onWindowResized(Window.getClientHeight());
}
/**
return getSelectedTree().equals(getMySharedTreeView());
}
- private FlowPanel createUploadArea() {
- FlowPanel area = new FlowPanel();
- area.getElement().setId("container");
- HTML list = new HTML();
- list.getElement().setId("filelist");
- area.add(list);
- Scheduler.get().scheduleDeferred(new ScheduledCommand() {
-
- @Override
- public void execute() {
-// setupUploadArea(Pithos.this, getToken());
- }
- });
-
- return area;
- }
-
private Folder getUploadFolder() {
if (folderTreeView.equals(getSelectedTree()) || otherSharedTreeView.equals(getSelectedTree())) {
return getSelection();
}
}-*/;
- public void showUploadAlert(int numOfFiles) {
- uploadAlert = new UploadAlert(this, numOfFiles);
- uploadAlert.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
-
- @Override
- public void setPosition(int offsetWidth, int offsetHeight) {
- uploadAlert.setPopupPosition((Window.getClientWidth() - offsetWidth)/2, Window.getClientHeight() - offsetHeight);
- }
- });
+ public void showUploadAlert(int nOfFiles) {
+ if (uploadAlert == null)
+ uploadAlert = new UploadAlert(this, nOfFiles);
+ if (!uploadAlert.isShowing())
+ uploadAlert.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
+
+ @Override
+ public void setPosition(int offsetWidth, int offsetHeight) {
+ uploadAlert.setPopupPosition((Window.getClientWidth() - offsetWidth)/2, statusPanel.getAbsoluteTop() - offsetHeight);
+ }
+ });
+ uploadAlert.setNumOfFiles(nOfFiles);
}
public void hideUploadAlert() {
- uploadAlert.hide();
+ if (uploadAlert != null && uploadAlert.isShowing())
+ uploadAlert.hide();
}
public void selectUploadedFiles(JsArrayString urls) {