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.bonitasoft.console.client.view.cases.AdminCaseMenuBarWidget.java

License:Open Source License

protected void displayDesignOfSelectedCases() {

    ArrayList<CaseUUID> theSelectedCases = myCaseSelection.getSelectedItems();
    if (theSelectedCases != null && !theSelectedCases.isEmpty()) {
        CaseUUID theCaseUUID = theSelectedCases.get(0);
        myCaseDataSource.getItem(theCaseUUID, new AsyncHandler<CaseItem>() {
            public void handleFailure(Throwable aT) {
                // Do nothing.

            }//  w w  w.j  ava2s . c  om

            public void handleSuccess(final CaseItem aCase) {
                if (aCase != null && aCase.getProcessUUID() != null) {
                    myProcessDataSource.getProcessImage(aCase.getProcessUUID(), new AsyncHandler<String>() {

                        public void handleFailure(Throwable aT) {
                            // Do nothing.

                        }

                        public void handleSuccess(String aURL) {
                            if (aURL != null) {
                                Window.open(GWT.getModuleBaseURL() + SERVLET_PATH + aURL, "_blank", "");
                            }

                        }
                    });
                }
            }
        });
    }

}

From source file:org.broadleafcommerce.openadmin.client.service.AbstractCallback.java

License:Apache License

@Override
protected void onOtherException(final Throwable exception) {
    final String msg = "Service Exception";
    if ("com.google.gwt.user.client.rpc.InvocationException".equals(exception.getClass().getName())
            || exception.getMessage().contains("XSRF token mismatch")) {
        SC.logWarn("Retrieving admin user (AbstractCallback.onOtherException)...");
        java.util.logging.Logger.getLogger(getClass().toString()).log(Level.SEVERE,
                "Retrieving admin user (AbstractCallback.onOtherException)...", exception);
        AppServices.SECURITY.getAdminUser(new AbstractCallback<AdminUser>() {
            @Override/*from   w w  w .j  a va 2 s  .  c om*/
            public void onSuccess(AdminUser result) {
                if (result == null) {
                    logout(msg, exception);
                } else {
                    if (exception.getMessage().contains("XSRF token mismatch")) {
                        //user must have remember me enabled - just refresh the app in order to update the token
                        UrlBuilder builder = Window.Location.createUrlBuilder();
                        builder.setParameter("time", String.valueOf(System.currentTimeMillis()));
                        Window.open(builder.buildString(), "_self", null);
                    } else {
                        SC.logWarn(
                                "Admin user found. Reporting calback exception (AbstractCallback.onOtherException)...");
                        java.util.logging.Logger.getLogger(getClass().toString()).warning(
                                "Admin user found. Reporting calback exception (AbstractCallback.onOtherException)...");
                        ;
                        reportException(msg, exception);
                        String errorMsg = exception.getMessage();
                        SC.warn(errorMsg);
                        java.util.logging.Logger.getLogger(getClass().toString()).warning(errorMsg);
                        ;
                    }
                }
            }
        });
    } else {
        reportException(msg, exception);
        String errorMsg = exception.getMessage();
        SC.warn(errorMsg);
        java.util.logging.Logger.getLogger(getClass().toString()).log(Level.SEVERE, errorMsg, exception);
    }
}

From source file:org.broadleafcommerce.openadmin.client.service.AbstractCallback.java

License:Apache License

protected void logout(String msg, Throwable exception) {
    SC.logWarn("Admin user not found. Logging out (AbstractCallback.onSecurityException)...");
    java.util.logging.Logger.getLogger(getClass().toString())
            .warning("Admin user not found. Logging out (AbstractCallback.onSecurityException)...");
    ;// www.j a v  a2s. co m
    reportException(msg, exception);
    UrlBuilder builder = Window.Location.createUrlBuilder();
    builder.setPath(BLCMain.webAppContext + "/admin/adminLogout.htm");
    builder.setParameter("time", String.valueOf(System.currentTimeMillis()));
    Window.open(builder.buildString(), "_self", null);
}

From source file:org.broadleafcommerce.openadmin.client.setup.AppController.java

License:Apache License

protected void setupView(final String viewKey, final String presenterKey, final String itemId) {
    AppServices.SECURITY.getAdminUser(new AbstractCallback<AdminUser>() {

        @Override/*from  www  .j a v  a2  s. c o  m*/
        public void onSuccess(AdminUser result) {
            if (result == null) {
                UrlBuilder builder = Window.Location.createUrlBuilder();
                builder.setPath(BLCMain.webAppContext + "/admin/adminLogout.htm");
                builder.setParameter("time", String.valueOf(System.currentTimeMillis()));
                Window.open(builder.buildString(), "_self", null);
            } else {
                if (SecurityManager.getInstance().isUserAuthorizedToViewSection(viewKey)) {
                    uiFactory.clearCurrentView();
                    uiFactory.getView(viewKey, false, false, new AsyncClient() {

                        @Override
                        public void onSuccess(Object instance) {
                            final Display view = (Display) instance;
                            uiFactory.getPresenter(presenterKey, new AsyncClient() {

                                @Override
                                public void onSuccess(Object instance) {
                                    EntityPresenter presenter = (EntityPresenter) instance;

                                    List<PresenterModifier> presenterModifierList = findPresenterModifiers(
                                            presenter.getClass());
                                    if (presenterModifierList != null
                                            && presenter instanceof DynamicEntityPresenter) {
                                        for (PresenterModifier modifier : presenterModifierList) {
                                            modifier.setParentPresenter(((DynamicEntityPresenter) presenter));
                                        }
                                        ((DynamicEntityPresenter) presenter).getModifierList()
                                                .addAll(presenterModifierList);
                                    }
                                    presenter.setDefaultItemId(itemId);
                                    presenter.setDisplay(view);
                                    presenter.setEventBus(eventBus);
                                    BLCMain.currentViewKey = viewKey;
                                    if (presenter.getPresenterSequenceSetupManager() != null) {
                                        presenter.getPresenterSequenceSetupManager().setCanvas(container);

                                        presenter.setup();
                                        if (presenterModifierList != null) {
                                            for (PresenterModifier modifier : presenterModifierList) {
                                                modifier.setup();
                                            }
                                        }
                                        presenter.getPresenterSequenceSetupManager().launch();
                                    } else {
                                        if (presenterModifierList != null) {
                                            for (PresenterModifier modifier : presenterModifierList) {
                                                modifier.setup();
                                            }
                                        }
                                        presenter.setup();
                                    }
                                }

                                @Override
                                public void onUnavailable() {
                                    throw new RuntimeException("Unable to show item: " + presenterKey);
                                }
                            });
                        }

                        @Override
                        public void onUnavailable() {
                            throw new RuntimeException("Unable to show item: " + viewKey);
                        }
                    });
                }
            }
        }
    });
}

From source file:org.broadleafcommerce.openadmin.client.setup.UserSecurityPreProcessor.java

License:Apache License

@Override
public void preProcess(final ServerProcessProgressWindow progressWindow, Map<String, String> piplineSeed,
        final PreProcessStatus cb) {
    SimpleProgress progress = new SimpleProgress(24);
    progressWindow.setProgressBar(progress);
    progressWindow.setTitleKey("userSecurityPreProcessTitle");
    progressWindow.startProgress();//from  w  w w. ja va  2  s. com
    java.util.logging.Logger.getLogger(UserSecurityPreProcessor.class.getName())
            .info("Retrieving user security...");

    AppServices.SECURITY.getAdminUser(new AbstractCallback<AdminUser>() {
        @Override
        public void onSuccess(AdminUser result) {
            org.broadleafcommerce.openadmin.client.security.SecurityManager.USER = result;
            if (result == null) {
                java.util.logging.Logger.getLogger(UserSecurityPreProcessor.class.getName())
                        .info("Admin user not found. Logging out...");
                UrlBuilder builder = Window.Location.createUrlBuilder();
                builder.setPath(BLCMain.webAppContext + "/admin/adminLogout.htm");
                builder.setParameter("time", String.valueOf(System.currentTimeMillis()));
                Window.open(builder.buildString(), "_self", null);
            } else {
                progressWindow.stopProgress();
                progressWindow.finalizeProgress();
                cb.complete();
            }
        }
    });
}

From source file:org.celstec.arlearn2.portal.client.author.ui.game.GamesTab.java

protected void download(ListGridRecord record) {
    Window.open("../download/game?gameId=" + record.getAttributeAsLong(GameModel.GAMEID_FIELD) + "&auth="
            + OauthClient.checkAuthentication().getAccessToken() + "&type=game", "_self", "");
}

From source file:org.celstec.arlearn2.portal.client.Entry.java

License:Open Source License

@Override
public void onModuleLoad() {
    if (Window.Location.getParameter("onBehalfOf") != null) {
        LocalSettings.getInstance().setOnBehalfOf(Window.Location.getParameter("onBehalfOf"));
    } else {//from  ww w .  j  a  v  a 2 s .  c o  m
        LocalSettings.getInstance().setOnBehalfOf(null);
    }
    String localeExtension = LocalSettings.getInstance().getLocateExtension();

    if (!"".equals(localeExtension) && Window.Location.getParameter("locale") == null) {

        Map<String, List<String>> paramMap = Window.Location.getParameterMap();
        if (paramMap.size() != 0) {
            String params = "";
            for (java.util.Map.Entry<String, List<String>> entry : paramMap.entrySet()) {
                params += "&" + entry.getKey() + "=" + Window.Location.getParameter(entry.getKey());
            }
            Window.open(Window.Location.getPath() + localeExtension + params, "_self", "");
        } else {
            Window.open(Window.Location.getPath() + localeExtension, "_self", "");
        }
    } else
        OauthNetworkClient.getInstance()
                .getOauthClientPackage(new JsonObjectListCallback("oauthInfoList", null) {
                    public void onJsonArrayReceived(JSONObject jsonObject) {
                        super.onJsonArrayReceived(jsonObject);
                        loadPage();
                    }

                    public void onJsonObjectReceived(JSONObject object) {

                        switch ((int) object.get("providerId").isNumber().doubleValue()) {
                        case OauthClient.FBCLIENT:
                            OauthFbClient.init(object.get("clientId").isString().stringValue(),
                                    object.get("redirectUri").isString().stringValue());
                            break;
                        case OauthClient.GOOGLECLIENT:
                            OauthGoogleClient.init(object.get("clientId").isString().stringValue(),
                                    object.get("redirectUri").isString().stringValue());
                            break;
                        case OauthClient.LINKEDINCLIENT:
                            OauthLinkedIn.init(object.get("clientId").isString().stringValue(),
                                    object.get("redirectUri").isString().stringValue());
                            break;
                        case OauthClient.WESPOTCLIENT:
                            OauthWespot.init(object.get("clientId").isString().stringValue(),
                                    object.get("redirectUri").isString().stringValue());
                            break;
                        case OauthClient.ECOCLIENT:
                            OauthECO.init(object.get("clientId").isString().stringValue(),
                                    object.get("redirectUri").isString().stringValue());
                            break;
                        default:
                            break;
                        }
                    }
                });
}

From source file:org.celstec.arlearn2.portal.client.Entry.java

License:Open Source License

public void loadPage() {
    final OauthClient client = OauthClient.checkAuthentication();
    if (client != null) {
        String href = Cookies.getCookie("redirectAfterOauth");
        if (href != null) {
            Cookies.removeCookie("redirectAfterOauth");
            Window.open(href, "_self", "");

        } else {/* w ww.java  2 s . c o  m*/
            if (RootPanel.get("button-facebook") != null)
                (new OauthPage()).loadPage();
            if (RootPanel.get("author") != null)
                (new AuthorPage()).loadPage();
            if (RootPanel.get("test") != null)
                (new TestPage()).loadPage();
            if (RootPanel.get("contact") != null)
                (new AddContactPage()).loadPage();
            if (RootPanel.get("register") != null && Window.Location.getParameter("gameId") != null)
                (new RegisterForGame()).loadPage();
            if (RootPanel.get("register") != null && Window.Location.getParameter("runId") != null)
                (new RegisterForRun()).loadPage();
            if (RootPanel.get("result") != null)
                (new ResultDisplayPage()).loadPage();
            if (RootPanel.get("portal") != null)
                (new org.celstec.arlearn2.portal.client.portal.PortalPage()).loadPage();
            if (RootPanel.get("oauth_new") != null)
                (new OauthPage()).loadPage();
            if (RootPanel.get("resultDisplayRuns") != null)
                (new ResultDisplayRuns()).loadPage();
            if (RootPanel.get("htmlDisplay") != null)
                (new CrsDisplay()).loadPage();
            if (RootPanel.get("resultDisplayRunsParticipate") != null)
                (new ResultDisplayRunsParticipate()).loadPage();

            if (RootPanel.get("network") != null)
                (new NetworkPage()).loadPage();
            if (RootPanel.get("search") != null)
                (new SearchPage()).loadPage();
            if (RootPanel.get("game") != null)
                (new GamePage()).loadPage();
            if (RootPanel.get("debug") != null)
                (new DebugPage()).loadPage();
            if (RootPanel.get("testContentUpload") != null)
                (new ContentUploadPage()).loadPage();
            if (RootPanel.get("authToken") != null)
                (new AuthTokenPage()).loadPage();
        }
    } else {
        String href = Window.Location.getHref();
        if (href.contains("oauth.html")) {
            (new OauthPage()).loadPage();
        } else {
            Cookies.setCookie("redirectAfterOauth", href);
            Window.open("/oauth.html", "_self", "");
        }
    }
}

From source file:org.celstec.arlearn2.portal.client.OauthPage.java

License:Creative Commons License

private void createButtons() {
    tileGrid = new TileGrid();
    tileGrid.setTileWidth(250);/*from   w ww  .j  a  va 2  s  . com*/
    tileGrid.setTileHeight(250);
    tileGrid.setHeight(400);
    tileGrid.setWidth(1100);
    tileGrid.setID("boundList");
    tileGrid.setCanReorderTiles(false);
    tileGrid.setShowAllRecords(false);

    tileGrid.addRecordClickHandler(new RecordClickHandler() {

        @Override
        public void onRecordClick(RecordClickEvent event) {
            switch (event.getRecord().getAttributeAsInt("rec")) {
            case 1:
                Window.open((new OauthFbClient()).getLoginRedirectURL(), "_self", "");
                break;
            case 2:
                Window.open((new OauthGoogleClient()).getLoginRedirectURLWithGlass(), "_self", "");

                break;
            case 3:
                Window.open((new OauthLinkedIn()).getLoginRedirectURL(), "_self", "");
                break;
            case 4:
                Window.open((new OauthTwitter()).getLoginRedirectURL(), "_self", "");
                break;
            case 5:
                Window.open((new OauthWespot()).getLoginRedirectURL(), "_self", "");
                break;
            case 6:
                Window.open((new OauthECO()).getLoginRedirectURL(), "_self", "");
                break;
            default:
                break;
            }

        }
    });
    //           tileGrid.setBorder("1px solid gray");

    Record facebook = new Record();
    facebook.setAttribute("picture", "facebook.png");
    facebook.setAttribute("commonName", "Sign in with Facebook");
    facebook.setAttribute("rec", 1);

    Record google = new Record();
    google.setAttribute("picture", "google.png");
    google.setAttribute("commonName", "Sign in with Google");
    google.setAttribute("rec", 2);

    Record linkedIn = new Record();
    linkedIn.setAttribute("picture", "linked-in.png");
    linkedIn.setAttribute("commonName", "Sign in with LinkedIn");
    linkedIn.setAttribute("rec", 3);

    Record twitterRec = new Record();
    twitterRec.setAttribute("picture", "twitter.png");
    twitterRec.setAttribute("commonName", "Sign in with Twitter");
    twitterRec.setAttribute("rec", 4);

    Record wespot = new Record();
    wespot.setAttribute("picture", "wespot.png");
    wespot.setAttribute("commonName", "Sign in with weSPOT");
    wespot.setAttribute("rec", 5);

    Record eco = new Record();
    eco.setAttribute("picture", "eco.png");
    eco.setAttribute("commonName", "Sign in with ECO");
    eco.setAttribute("rec", 6);

    DataSource ds = new DataSource();
    ds.setClientOnly(true);

    DataSourceField field = new DataSourceField();
    field.setName("rec");
    field.setHidden(true);
    field.setPrimaryKey(true);
    ds.addField(field);

    ds.addData(facebook);
    ds.addData(google);
    ds.addData(linkedIn);
    //            ds.addData(twitterRec);
    ds.addData(eco);
    //            ds.addData(wespot);

    tileGrid.setDataSource(ds);
    tileGrid.setAutoFetchData(true);

    DetailViewerField pictureField = new DetailViewerField("picture");
    pictureField.setType("image");
    pictureField.setImageHeight(200);
    pictureField.setImageWidth(200);

    DetailViewerField commonNameField = new DetailViewerField("commonName");
    //           commonNameField.setCellStyle("commonName");

    //           DetailViewerField lifeSpanField = new DetailViewerField("lifeSpan");  
    //           lifeSpanField.setCellStyle("lifeSpan");  
    commonNameField.setDetailFormatter(new DetailFormatter() {
        public String format(Object value, Record record, DetailViewerField field) {
            return "<h1> " + value + "</h1>";
        }
    });

    DetailViewerField statusField = new DetailViewerField("status");

    tileGrid.setFields(pictureField, commonNameField);

}

From source file:org.celstec.arlearn2.portal.client.ResultDisplayRunsParticipate.java

License:Open Source License

private void createRunsDataSource() {
    masterList = new GenericListGrid(false, false, false, false, false);
    masterList.setShowRecordComponentsByCell(true);
    //      masterList.setCanRemoveRecords(true);
    masterList.setShowRollOverCanvas(true);

    masterList.setShowAllRecords(true);/*ww w.j av a  2  s  . c  o  m*/
    masterList.setShowRecordComponents(true);

    masterList.setHeight(400);
    masterList.setWidth(800);
    //      masterList.setHeight("40%");
    masterList.setAutoFetchData(true);
    masterList.setCanEdit(true);

    masterList.addRecordClickHandler(new RecordClickHandler() {
        public void onRecordClick(RecordClickEvent event) {
            Window.open("/ResultDisplay.html?runId=" + event.getRecord().getAttribute(RunModel.RUNID_FIELD)
                    + "&version=1", "_self", "");

        }
    });

    masterList.setDataSource(RunParticipateDataSource.getInstance());

    ListGridField idField = new ListGridField(RunModel.RUNID_FIELD, "id ");
    idField.setWidth(30);
    idField.setCanEdit(false);
    idField.setHidden(true);

    ListGridField gameIdField = new ListGridField(RunModel.GAMEID_FIELD, "GameId ");
    gameIdField.setCanEdit(false);
    gameIdField.setHidden(true);

    ListGridField titleRunField = new ListGridField(RunModel.RUNTITLE_FIELD, "Run Title ");
    ListGridField titleGameField = new ListGridField(RunModel.GAME_TITLE_FIELD, "Game Title ");
    titleGameField.setCanEdit(false);

    //        ListGridField accessRunField = new ListGridField(RunModel.RUN_ACCESS_STRING, "Run access ");
    //        accessRunField.setCanEdit(false);
    //        accessRunField.setWidth(100);

    masterList.setFields(new ListGridField[] { idField, gameIdField, titleRunField, titleGameField });

}