Example usage for com.google.gwt.user.client Window open

List of usage examples for com.google.gwt.user.client Window open

Introduction

In this page you can find the example usage for com.google.gwt.user.client Window open.

Prototype

public static void open(String url, String name, String features) 

Source Link

Usage

From source file:org.olanto.TranslationText.client.ResearchWidget.java

License:Open Source License

public void draWidget() {
    setbuttonstyle(GoSrch, GoSrch.getText().length() * 2 * CHAR_W, H_Unit);
    setbuttonstyle(myQuote, myQuote.getText().length() * CHAR_W, H_Unit);
    setbuttonstyle(coll, coll.getText().length() * CHAR_W, H_Unit);
    setbuttonstyle(help, help.getText().length() * CHAR_W, H_Unit);
    setbuttonstyle(resize, resize.getText().length() * CHAR_W, H_Unit);
    GoSrch.setAutoWidth(true);//from w  w  w .  ja  v a2  s. c  o  m
    myQuote.setAutoWidth(true);
    coll.setAutoWidth(true);
    help.setAutoWidth(true);
    resize.setAutoWidth(true);

    search.setWidth("300px");
    search.setStyleName("x-form-text");
    TAText.setText(GuiConstant.TEXT_ALIGNER_LBL);
    TAText.setStyleName("gwt-im-text");
    chooseLang.setStyleName("gwt-w-label");

    setMessage("info", "");
    for (int i = 0; i < SORT_BY.length; i++) {
        sortBy.addItem(SORT_BY[i]);
    }
    langS.setWidth(3 * W_Unit + "px");
    langT.setWidth(3 * W_Unit + "px");
    sortBy.setWidth(6 * W_Unit + "px");
    sortBy.setSelectedIndex(Utility.getIndex(SORT_BY_Eff, Cookies.getCookie(CookiesNamespace.SortBy)));

    for (int i = 0; i < INT_LANG.length; i++) {
        langInterface.addItem(INT_LANG[i]);
    }
    langInterface.setWidth(2 * W_Unit + "px");
    langInterface.setSelectedIndex(
            Utility.getIndex(INT_LANG, Cookies.getCookie(CookiesNamespace.InterfaceLanguage)));

    docListContainer.setSize(MainEntryPoint.IMeasures.DOC_LIST_WIDTH, MainEntryPoint.IMeasures.DOC_LIST_HEIGHT);
    staticDecorator.setStyleName("doclist");
    staticDecorator.setWidget(staticTreeWrapper);
    staticTreeWrapper.setAlwaysShowScrollBars(true);
    staticTreeWrapper.setPixelSize(MainEntryPoint.IMeasures.DOC_LIST_WIDTH,
            MainEntryPoint.IMeasures.DOC_LIST_HEIGHT - H_Unit);
    if ((GuiConstant.JOBS_ITEMS != null) && (GuiConstant.JOBS_ITEMS.length() > 1)) {
        String jobs = GuiConstant.JOBS_ITEMS;
        String[] tablist = jobs.split("\\;");
        Tab tinv = new Tab();
        topJobsSet.addTab(tinv);
        tinv.setTitle("Select Tab : ");
        tinv.setID("Empty");
        tinv.setDisabled(true);
        if (tablist.length > 0) {
            for (int i = 0; i < tablist.length; i++) {
                Tab tTab = new Tab();
                tTab.setIcon("./icons/16/folder_document.png");
                tTab.setTitle(tablist[i].substring(0, tablist[i].indexOf("|")));
                tTab.setAttribute("URL",
                        tablist[i].substring(tablist[i].indexOf("|") + 1, tablist[i].lastIndexOf("|")));
                tTab.setAttribute("MODE", tablist[i].substring(tablist[i].lastIndexOf("|") + 1));
                topJobsSet.addTab(tTab);
            }
        }
        topJobsSet.setSelectedTab(0);
        topJobsSet.addTabSelectedHandler(new TabSelectedHandler() {
            @Override
            public void onTabSelected(TabSelectedEvent event) {
                if (!(event.getTab().getID().contains("Empty"))) {
                    //                        Window.alert("URL: " + event.getTab().getAttribute("URL") + "mode: " + event.getTab().getAttribute("MODE"));
                    Window.open(event.getTab().getAttribute("URL"), event.getTab().getAttribute("MODE"), "");
                }
            }
        });
        topJobsSet.setWidth(headerPanel.getOffsetWidth());
        topJobsSet.draw();
        topJobsSet.setCursor(Cursor.HAND);
    } else {
        leftheadPanel.remove(topJobsSet);
    }
}

From source file:org.onecmdb.ui.gwt.desktop.client.widget.ContentViewerWidget.java

License:Open Source License

public Menu getContentMenu() {
    Menu contextMenu = new Menu();
    contextMenu.setWidth(130);/*w  w w. ja  va2 s  .c  o  m*/

    {
        MenuItem open = new MenuItem();
        open.setText("<b>Open in Browser</b>");
        open.setIconStyle("icon-open");
        open.addSelectionListener(new SelectionListener<ComponentEvent>() {

            @Override
            public void componentSelected(ComponentEvent ce) {
                final TreeItem item = (TreeItem) tree.getSelectionModel().getSelectedItem();
                if (item == null) {
                    return;
                }
                ContentData folder = (ContentData) item.getModel();
                if (folder instanceof ContentFile) {
                    updateEditArea((ContentFile) folder, null, false);
                }
            }

        });
        contextMenu.add(open);
    }

    if (permissions == null || permissions.isEditable()) {
        MenuItem edit = new MenuItem();
        edit.setIconStyle("icon-edit");
        edit.setText("Edit");

        edit.addSelectionListener(new SelectionListener<ComponentEvent>() {

            @Override
            public void componentSelected(ComponentEvent ce) {
                TreeItem item = tree.getSelectedItem();
                if (item.getModel() instanceof ContentFile) {
                    final ContentFile file = (ContentFile) item.getModel();
                    Info.display("Loading...", (String) file.getName());
                    ContentServiceFactory.get().get("token", file, new CMDBAsyncCallback<String>() {

                        @Override
                        public void onSuccess(String arg0) {
                            updateEditArea(file, arg0, true);
                        }

                    });
                }
            }

        });
        contextMenu.add(edit);

    }
    contextMenu.add(new SeparatorMenuItem());

    if (permissions == null || permissions.isEditable()) {
        MenuItem insert = new MenuItem();
        insert.setText("New Folder");
        insert.setIconStyle("icon-add");
        insert.addSelectionListener(new SelectionListener<MenuEvent>() {
            public void componentSelected(MenuEvent ce) {
                final TreeItem item = (TreeItem) tree.getSelectionModel().getSelectedItem();
                ContentData folder = new ContentFolder();
                folder.setPath("");
                if (item != null) {
                    folder = (ContentData) item.getModel();
                }
                final ContentData data = folder;
                final MessageBox box = MessageBox.prompt("Folder Name", "Please enter folder name:");
                box.addCallback(new Listener<MessageBoxEvent>() {
                    public void handleEvent(MessageBoxEvent be) {
                        Button btn = be.buttonClicked;
                        if (btn.getItemId().equals(Dialog.OK)) {
                            final ContentFolder folder = new ContentFolder();
                            folder.setPath(data.getPath() + "/" + be.value);
                            ContentServiceFactory.get().create(CMDBSession.get().getToken(), folder,
                                    new AsyncCallback<Boolean>() {

                                        public void onFailure(Throwable arg0) {
                                            Info.display("Failed", "Can't create folder " + folder.getPath());

                                        }

                                        public void onSuccess(Boolean arg0) {
                                            if (arg0) {
                                                Info.display("Created", folder.getPath() + " created");
                                                if (item == null) {
                                                    getLoader().load(rootFolder);
                                                } else {
                                                    getLoader().loadChildren(item.getModel());
                                                }
                                            } else {
                                                Info.display("Failed",
                                                        "Can't create folder " + folder.getPath());
                                            }
                                        }

                                    });
                        }
                    }
                });
            }
        });
        contextMenu.add(insert);
    }
    if (permissions == null || permissions.isEditable()) {
        MenuItem insert = new MenuItem();
        insert.setText("New File");
        insert.setIconStyle("icon-add");
        insert.addSelectionListener(new SelectionListener<MenuEvent>() {
            public void componentSelected(MenuEvent ce) {
                final TreeItem item = (TreeItem) tree.getSelectionModel().getSelectedItem();
                ContentData folder = new ContentFolder();
                folder.setPath("");
                if (item != null) {
                    folder = (ContentData) item.getModel();
                }

                final ContentData data = (ContentData) folder;
                final MessageBox box = MessageBox.prompt("File Name", "Please enter file name:");
                box.addCallback(new Listener<MessageBoxEvent>() {
                    public void handleEvent(MessageBoxEvent be) {
                        Button btn = be.buttonClicked;
                        if (btn.getItemId().equals(Dialog.OK)) {
                            final ContentFile folder = new ContentFile();
                            folder.setPath(data.getPath() + "/" + be.value);
                            ContentServiceFactory.get().create(CMDBSession.get().getToken(), folder,
                                    new AsyncCallback<Boolean>() {

                                        public void onFailure(Throwable arg0) {
                                            Info.display("Failed", "Can't create file " + folder.getPath());

                                        }

                                        public void onSuccess(Boolean arg0) {
                                            if (arg0) {
                                                Info.display("Created", folder.getPath() + " created");
                                                if (item == null) {
                                                    getLoader().load(rootFolder);
                                                } else {
                                                    getLoader().loadChildren(item.getModel());
                                                }
                                            } else {
                                                Info.display("Failed", "Can't create file " + folder.getPath());
                                            }
                                        }

                                    });
                        }
                    }
                });
            }
        });
        contextMenu.add(insert);
    }

    if (permissions == null || permissions.isDeletable()) {
        MenuItem remove = new MenuItem();
        remove.setText("Delete");
        remove.setIconStyle("icon-delete");
        remove.addSelectionListener(new SelectionListener<MenuEvent>() {
            public void componentSelected(MenuEvent ce) {
                TreeItem item = (TreeItem) tree.getSelectionModel().getSelectedItem();
                if (item == null) {
                    return;
                }
                final TreeItem parent = item.getParentItem();
                final ContentData data = (ContentData) item.getModel();
                final MessageBox box = MessageBox.confirm("Delete",
                        "Delete " + data.getPath() + "<br/>Are you sure?", new Listener<WindowEvent>() {
                            public void handleEvent(WindowEvent be) {
                                Button btn = be.buttonClicked;
                                if (btn.getItemId().equals(Dialog.YES)) {
                                    ContentServiceFactory.get().delete(CMDBSession.get().getToken(), data,
                                            new AsyncCallback<Boolean>() {

                                                public void onFailure(Throwable arg0) {
                                                    Info.display("Failed", "Can't delete " + data.getPath());

                                                }

                                                public void onSuccess(Boolean arg0) {
                                                    if (arg0) {
                                                        Info.display("Delete", data.getPath() + " deleted");
                                                        ModelData model = parent.getModel();
                                                        if (model == null) {
                                                            getLoader().load(rootFolder);
                                                        } else {
                                                            getLoader().loadChildren(model);
                                                        }
                                                    } else {
                                                        Info.display("Failed",
                                                                "Can't delete " + data.getPath());
                                                    }
                                                }

                                            });
                                }
                            }
                        });
            }
        });
        contextMenu.add(remove);
        contextMenu.add(new SeparatorMenuItem());
    }

    if (permissions == null || permissions.isEditable()) {
        MenuItem upload = new MenuItem();
        upload.setText("Upload");
        //remove.setIconStyle("icon-delete");  
        upload.addSelectionListener(new SelectionListener<MenuEvent>() {
            public void componentSelected(MenuEvent ce) {
                TreeItem item = (TreeItem) getTree().getSelectionModel().getSelectedItem();
                new FileUploadWidget((ContentData) item.getModel()).show();
            }
        });
        contextMenu.add(upload);
    }

    MenuItem download = new MenuItem();
    download.setText("Download");
    //remove.setIconStyle("icon-delete");  
    download.addSelectionListener(new SelectionListener<MenuEvent>() {
        public void componentSelected(MenuEvent ce) {
            TreeItem item = (TreeItem) getTree().getSelectionModel().getSelectedItem();
            if (item.getModel() instanceof ContentFile) {
                ContentFile file = (ContentFile) item.getModel();
                String url = CMDBSession.get().getContentRepositoryURL() + file.getPath();
                Window.open(url, "_blank", "");
            }
        }
    });
    contextMenu.add(download);

    contextMenu.add(new SeparatorMenuItem());

    MenuItem refresh = new MenuItem();
    refresh.setText("Refresh");
    //remove.setIconStyle("icon-delete");  
    refresh.addSelectionListener(new SelectionListener<MenuEvent>() {
        public void componentSelected(MenuEvent ce) {
            DeferredCommand.addCommand(new Command() {

                public void execute() {
                    TreeItem item = (TreeItem) getTree().getSelectionModel().getSelectedItem();
                    if (item == null) {
                        getLoader().load(rootFolder);
                    } else {
                        getLoader().loadChildren(item.getModel());
                    }

                }

            });
        }
    });
    contextMenu.add(refresh);

    return (contextMenu);
}

From source file:org.onecmdb.ui.gwt.toolkit.client.view.input.basefield.NewURIFieldWidget.java

License:Open Source License

public NewURIFieldWidget(AttributeValue v) {
    super(v.getLabel());
    this.value = v;
    if (value.getCtrl().isReadonly()) {
        HTML html = new HTML();
        if (!this.value.isNullValue()) {
            html.setHTML("<a href='javascript:;'>" + this.value.getStringValue() + "</a>");
        }/*from w w  w .ja v a  2 s .  co  m*/
        html.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                Window.open(value.getStringValue(), "_blank", "");

            }

        });

        html.setWordWrap(true);
        html.setTitle(this.value.getStringValue());
        addField(html);
        html.setStyleName("mdv-form-input-readonly");
        setRequired(false);

    } else {
        box = new TextBox();
        box.setText(value.getStringValue());
        box.addKeyboardListener(this);
        setRequired(value.getCtrl().isRequiered());
        addField(box);
    }

}

From source file:org.onecmdb.ui.gwt.toolkit.client.view.screen.header.HeaderScreen.java

License:Apache License

private Widget getFeedbackWidget() {
    HTML good = new HTML("<a href='javascript:;'>[Good]</a>&nbsp;");
    HTML bad = new HTML("<a href='javascript:;'>[Bad]</a>");
    good.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            Window.open("http://www.onecmdb.org/feedback/good.html" + "?version="
                    + getBaseEntryScreen().getVersion() + "&action=" + getBaseEntryScreen().getCurrentPage(),
                    "Good", "height=500,width=500");
        }//  w ww . java 2  s  . co m

    });
    bad.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            Window.open(
                    "http://www.onecmdb.org/feedback/bad.html" + "?version=" + getBaseEntryScreen().getVersion()
                            + "&action=" + getBaseEntryScreen().getCurrentPage(),
                    "Bad", "height=500,width=500");
        }
    });

    HTML info = new HTML("Your feedback to onecmdb.org:&nbsp;");
    HorizontalPanel panel = new HorizontalPanel();
    panel.setStyleName("onecmdb-header-label");

    panel.add(info);
    panel.add(good);
    panel.add(bad);
    return (panel);
}

From source file:org.onecmdb.ui.gwt.toolkit.client.view.screen.header.HeaderScreen.java

License:Apache License

public Widget getCheckUpdateWidget() {
    HTML html = new HTML("<a href='javascript:;'>[Check for updates]</a>");
    html.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            Window.open("http://sourceforge.net/project/showfiles.php?group_id=176340", "_blank", "");
        }// w w  w.  j  a v a  2  s .  c  o m

    });
    return (html);
}

From source file:org.opencms.gwt.client.ui.resourceinfo.CmsResourceRelationView.java

License:Open Source License

/**
 * Creates and renders the resource boxes for the related resources.<p>
 *//*from  ww w  .j a v  a2s. c  o  m*/
protected void fill() {

    m_list.clear();
    List<CmsResourceStatusRelationBean> relationBeans = getRelationBeans();
    if (relationBeans.isEmpty()) {
        CmsSimpleListItem item = new CmsSimpleListItem();
        item.add(new Label(getEmptyMessage()));
        m_list.add(item);
    } else {
        if ((m_mode == Mode.sources) && !m_statusBean.getOtherSiteRelationSources().isEmpty()) {
            m_otherSitesList = createList(Messages.get().key(Messages.GUI_RESOURCEINFO_OTHERSITES_LEGEND_0));
            for (CmsResourceStatusRelationBean relationBean : m_statusBean.getOtherSiteRelationSources()) {
                CmsListItemWidget itemWidget = new CmsListItemWidget(relationBean.getInfoBean());
                CmsListItem item = new CmsListItem(itemWidget);
                m_otherSitesList.add(item);
            }
        }
        for (CmsResourceStatusRelationBean relationBean : relationBeans) {
            CmsListItemWidget itemWidget = new CmsListItemWidget(relationBean.getInfoBean());
            CmsListItem item = new CmsListItem(itemWidget);
            //   itemWidget.setWidth("490px");
            CmsContextMenuButton button = new CmsContextMenuButton(relationBean.getStructureId(),
                    new CmsResourceInfoView.ContextMenuHandler());
            item.getListItemWidget().addButton(button);
            final CmsResourceStatusRelationBean currentRelationBean = relationBean;
            final boolean isContainerpage = CmsGwtConstants.TYPE_CONTAINERPAGE
                    .equals(relationBean.getInfoBean().getResourceType());
            final boolean isXmlContent = relationBean.isXmlContent();
            final boolean isEditable = (isXmlContent || isContainerpage)
                    && relationBean.getPermissionInfo().hasWritePermission();
            if (isEditable) {

                m_editButton = new CmsPushButton();
                m_editButton.setImageClass(I_CmsButton.PEN_SMALL);
                m_editButton.setButtonStyle(ButtonStyle.FONT_ICON, null);
                m_editButton.setTitle(org.opencms.gwt.client.Messages.get()
                        .key(org.opencms.gwt.client.Messages.GUI_BUTTON_ELEMENT_EDIT_0));
                if (CmsStringUtil
                        .isNotEmptyOrWhitespaceOnly(relationBean.getPermissionInfo().getNoEditReason())) {
                    m_editButton.disable(relationBean.getPermissionInfo().getNoEditReason());
                } else {
                    m_editButton.setEnabled(true);
                }
                item.getListItemWidget().addButton(m_editButton);
                m_editButton.addClickHandler(new ClickHandler() {

                    public void onClick(ClickEvent event) {

                        if (isContainerpage) {
                            Window.open(currentRelationBean.getLink(), "_blank", "");
                        } else {
                            CmsEditableData editableData = new CmsEditableData();
                            editableData.setElementLanguage(CmsCoreProvider.get().getLocale());
                            editableData.setStructureId(currentRelationBean.getStructureId());
                            editableData.setSitePath(currentRelationBean.getSitePath());
                            CmsContentEditorDialog.get().openEditDialog(editableData, false, null,
                                    new DialogOptions(), new I_CmsContentEditorHandler() {

                                        public void onClose(String sitePath, CmsUUID structureId,
                                                boolean isNew) {

                                            if (m_popup != null) {
                                                m_popup.hide();
                                            }
                                        }
                                    });
                            ((CmsPushButton) event.getSource()).clearHoverState();
                        }
                    }
                });
            }

            if (isContainerpage) {
                if (relationBean.getLink() != null) {
                    final String link = relationBean.getLink();
                    itemWidget.setIconCursor(Cursor.POINTER);
                    itemWidget.addIconClickHandler(new ClickHandler() {

                        public void onClick(ClickEvent e) {

                            Window.open(link, "_blank", "");
                        }
                    });
                }
            }
            m_list.add(item);
        }
    }

    m_list.truncate("RES_INFO", CmsPopup.DEFAULT_WIDTH - 5);
    if (m_otherSitesList != null) {
        m_otherSitesList.truncate("RES_INFO", CmsPopup.DEFAULT_WIDTH - 5);
    }

}

From source file:org.opendatakit.aggregate.client.widgets.EnketoWebformButton.java

License:Apache License

public void onClick(ClickEvent event) {
    super.onClick(event);

    RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, UIConsts.ENKETO_API_HANDLER_ADDR);
    builder.setHeader("Content-type", "application/x-www-form-urlencoded");

    StringBuffer requestdata = new StringBuffer();
    if (selectedInstanceId == null) {
        String enketoURL = ENKETO_API_URL + Preferences.getEnketoApiUrl() + ENKETO_SURVEY_ID;
        requestdata.append(enketoURL);/*from w w w .  j ava 2  s . c  o  m*/
        requestdata.append(ENKETO_API_FORM_ID + selectedForm);
        requestdata.append(ENKETO_API_TOKEN + Preferences.getEnketoApiToken());
    }
    try {
        builder.sendRequest(requestdata.toString(), new RequestCallback() {
            public void onError(Request request, Throwable e) {
                Window.alert(e.getMessage());
            }

            public void onResponseReceived(Request request, Response response) {
                int statusCode = response.getStatusCode();
                EnketoRedirectErrorPopup popup;
                switch (statusCode) {
                case 200:
                    Window.open(response.getHeader("enketo_url"), "_self", "");
                    break;
                case 201:
                    Window.open(response.getHeader("enketo_url"), "_self", "");
                    break;
                case 400:
                    popup = new EnketoRedirectErrorPopup(ENKETO_ERROR_400);
                    popup.setPopupPositionAndShow(popup.getPositionCallBack());
                    break;
                case 401:
                    popup = new EnketoRedirectErrorPopup(ENKETO_ERROR_401);
                    popup.setPopupPositionAndShow(popup.getPositionCallBack());
                    break;
                case 403:
                    popup = new EnketoRedirectErrorPopup(ENKETO_ERROR_403);
                    popup.setPopupPositionAndShow(popup.getPositionCallBack());
                    break;
                case 404:
                    popup = new EnketoRedirectErrorPopup(ENKETO_ERROR_404);
                    popup.setPopupPositionAndShow(popup.getPositionCallBack());
                    break;
                case 405:
                    popup = new EnketoRedirectErrorPopup(ENKETO_ERROR_405);
                    popup.setPopupPositionAndShow(popup.getPositionCallBack());
                    break;
                case 410:
                    popup = new EnketoRedirectErrorPopup(ENKETO_ERROR_410);
                    popup.setPopupPositionAndShow(popup.getPositionCallBack());
                    break;
                case 411:
                    popup = new EnketoRedirectErrorPopup(ENKETO_ERROR_411);
                    popup.setPopupPositionAndShow(popup.getPositionCallBack());
                    break;
                default:
                    popup = new EnketoRedirectErrorPopup(response.getHeader("error"));
                    popup.setPopupPositionAndShow(popup.getPositionCallBack());
                    break;
                }
            }

        });
    } catch (RequestException e) {
        // Couldn't connect to server
        EnketoRedirectErrorPopup popup = new EnketoRedirectErrorPopup(e.getMessage());
        popup.setPopupPositionAndShow(popup.getPositionCallBack());
        // }

    }
}

From source file:org.openelis.modules.main.client.OpenELIS.java

License:Open Source License

/**
 * logout the user//from   w w  w .ja v a2  s  .  c  om
 */
private void logout() {

    OpenELISService.get().logout(new SyncCallback<Void>() {
        public void onSuccess(Void result) {
        }

        public void onFailure(Throwable caught) {
        }
    });
    Window.open("/openelis/OpenELIS.html", "_self", null);
}

From source file:org.openelis.modules.order1.client.SendoutOrderScreenUI.java

License:Open Source License

protected void orderRequestForm() {
    Query query;/*from   w  w  w  .j a  v  a 2 s  . co m*/
    QueryData field;

    query = new Query();
    field = new QueryData();
    field.setKey("ORDER_ID");
    field.setQuery(manager.getIorder().getId().toString());
    field.setType(QueryData.Type.INTEGER);
    query.setFields(field);

    field = new QueryData();
    field.setKey("PRINTER");
    field.setQuery("-view-");
    field.setType(QueryData.Type.INTEGER);
    query.setFields(field);

    setBusy(Messages.get().gen_generatingReport());
    RequestFormReportService.get().runReport(query, new AsyncCallback<ReportStatus>() {
        public void onSuccess(ReportStatus status) {
            String url;
            if (ReportStatus.Status.SAVED.equals(status.getStatus())) {
                url = "/openelis/openelis/report?file=" + status.getMessage();
                Window.open(URL.encode(url), "OrderRequestFormReport", null);
                setDone(Messages.get().gen_loadCompleteMessage());
            } else {
                setDone(status.getMessage());
            }
        }

        public void onFailure(Throwable caught) {
            setError("Failed");
            caught.printStackTrace();
            Window.alert(caught.getMessage());
        }
    });
    // window.clearStatus();
}

From source file:org.openelis.modules.report.client.ReportScreen.java

License:Open Source License

public void runReport(T query) {
    window.setBusy(Messages.get().genReportMessage());

    runReport(query, new AsyncCallback<ReportStatus>() {
        public void onSuccess(ReportStatus status) {
            String url;//from ww w .j  av a 2  s.com

            if (status.getStatus() == ReportStatus.Status.SAVED) {
                url = "/openelis/openelis/report?file=" + status.getMessage();
                if (attachmentName != null)
                    url += "&attachment=" + attachmentName;

                Window.open(URL.encode(url), name, null);
                window.setDone("Generated file " + status.getMessage());
            } else {
                window.setDone(status.getMessage());
            }
        }

        public void onFailure(Throwable caught) {
            window.setError("Failed");
            Window.alert(caught.getMessage());
        }
    });
}