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:com.square.composant.tarificateur.square.client.presenter.popup.PopupImpressionDevisPresenter.java

License:Open Source License

/**
 * Lance l'impression des modles de devis.
 *//*  w  w w  .  jav a  2s .  co m*/
private void imprimerDevis() {
    // Rcupration des choix des documents
    final List<Long> listeIdsModelesSelectionnes = view.getIdsModelesSelectionnes();

    // Rcupration des bnficiaires
    final List<Long> listeIdsBeneficiairesSelectionnes = view.getIdsBeneficiairesSelectionnes();

    // Construction du paramtre des identifiants des lignes de devis slectionnes
    String idsLignesDevis = "";
    if (listeIdsLignesSelectionnees != null && listeIdsLignesSelectionnees.size() > 0) {
        idsLignesDevis = listeIdsLignesSelectionnees.get(0).toString();
        for (int i = 1; i < listeIdsLignesSelectionnees.size(); i++) {
            idsLignesDevis = idsLignesDevis + ComposantTarificateurConstants.SEPARATOR_IDENTIFIANTS
                    + listeIdsLignesSelectionnees.get(i).toString();
        }
    }

    // Construction du paramtre des identifiants des modles de devis slectionns
    String idsModelesDevis = "";
    if (listeIdsModelesSelectionnes != null && listeIdsModelesSelectionnes.size() > 0) {
        idsModelesDevis = listeIdsModelesSelectionnes.get(0).toString();
        for (int i = 1; i < listeIdsModelesSelectionnes.size(); i++) {
            idsModelesDevis = idsModelesDevis + ComposantTarificateurConstants.SEPARATOR_IDENTIFIANTS
                    + listeIdsModelesSelectionnes.get(i).toString();
        }
    }

    // Construction du paramtre des identifiants des bnficiaires slectionns
    String idsBeneficiaires = "";
    if (listeIdsBeneficiairesSelectionnes != null && listeIdsBeneficiairesSelectionnes.size() > 0) {
        idsBeneficiaires = listeIdsBeneficiairesSelectionnes.get(0).toString();
        for (int i = 1; i < listeIdsBeneficiairesSelectionnes.size(); i++) {
            idsBeneficiaires = idsBeneficiaires + ComposantTarificateurConstants.SEPARATOR_IDENTIFIANTS
                    + listeIdsBeneficiairesSelectionnes.get(i).toString();
        }
    }

    // On prpare les fichiers  imprimer
    tarificateurRpcService.construireFichiersDevisAImprimer(devis.getId(), idsLignesDevis, idsModelesDevis,
            idsBeneficiaires, referenceOpportunite.toString(), new AsyncCallback<Long>() {
                public void onSuccess(Long idImpression) {
                    // Dfinition des paramtres de la servlet
                    final ParamServlet[] params = new ParamServlet[] { FormatServletUtil.getIntanceParamServlet(
                            ComposantTarificateurConstants.PARAM_ID_IMPRESSION, Long.toString(idImpression)) };

                    final String url = FormatServletUtil
                            .formatUrl(ComposantTarificateurConstants.URL_IMPRIMER_DEVIS, params);
                    Window.open(url, "_blank", "resizable=yes,menubar=no,location=no");

                    // Event pas utilis
                    // fireEventLocalBus(new SuccesImpressionEvent());
                    LoadingPopup.stop();
                    view.hidePopup();
                }

                public void onFailure(Throwable caught) {
                    if (caught.getMessage()
                            .equals(ComposantTarificateurConstants.ERROR_LIGNE_DEVIS_PRINT_ABSENT)) {
                        view.onRpcServiceFailure(new ErrorPopupConfiguration(new BusinessExceptionGwt(
                                composantTarificateurConstants.errorLigneDevisAbsent())));
                    } else if (caught.getMessage()
                            .equals(ComposantTarificateurConstants.ERROR_MODELE_DEVIS_ABSENT)) {
                        view.onRpcServiceFailure(new ErrorPopupConfiguration(new BusinessExceptionGwt(
                                composantTarificateurConstants.errorModeleDevisAbsent())));
                    } else if (caught.getMessage().equals(ComposantTarificateurConstants.ERROR_USER_ABSENT)) {
                        view.onRpcServiceFailure(new ErrorPopupConfiguration(
                                new BusinessExceptionGwt(composantTarificateurConstants.errorUserAbsent())));
                    } else {
                        view.onRpcServiceFailure(new ErrorPopupConfiguration(caught));
                    }
                }
            });
}

From source file:com.sun.labs.aura.dbbrowser.client.shell.ShellUI.java

License:Open Source License

public ShellUI() {
    service = GWTMainEntryPoint.getShellService();

    final HorizontalPanel inputArea = new HorizontalPanel();
    inputArea.setStylePrimaryName("shell-input");
    final Button runBtn = new Button("Run", new ClickListener() {
        public void onClick(Widget sender) {
            ////  ww w. ja v a2 s  .  c o m
            // Get the command from the text box
            String cmd = cmdInput.getText();
            Label history = addToHistory(cmd);
            cmdInput.selectAll();
            sendCommand(history, cmd);
        }
    });
    runBtn.setStylePrimaryName("shell-inputButton");
    cmdInput.addKeyboardListener(new KeyboardListener() {
        public void onKeyDown(Widget arg0, char arg1, int arg2) {
        }

        public void onKeyPress(Widget w, char c, int mod) {
            if (c == KEY_ENTER) {
                runBtn.click();
            }
        }

        public void onKeyUp(Widget arg0, char arg1, int arg2) {
        }

    });
    Button clearBtn = new Button("Clear", new ClickListener() {
        public void onClick(Widget sender) {
            //
            // Get the command from the text box
            cmdInput.setText("");
        }

    });
    clearBtn.setStylePrimaryName("shell-inputButton");
    Button scriptBtn = new Button("Script...", new ClickListener() {
        public void onClick(Widget sender) {
            scriptDialog.show();
        }
    });
    scriptBtn.setStylePrimaryName("shell-inputButton");
    scriptDialog = new ScriptDialog();

    cmdInput.setVisibleLength(80);
    inputArea.add(cmdInput);
    inputArea.add(runBtn);
    inputArea.add(clearBtn);
    inputArea.add(scriptBtn);
    add(inputArea, NORTH);

    resultArea.setCharacterWidth(120);
    resultArea.setVisibleLines(40);
    resultArea.setReadOnly(true);
    add(resultArea, CENTER);

    history.setStylePrimaryName("shell-historyPanel");
    add(history, EAST);

    add(time, SOUTH);

    //
    // Set up a button that we can use to get help, but don't add it
    // to the UI until help is available
    final Button helpBtn = new Button("Help", new ClickListener() {
        public void onClick(Widget sender) {
            //
            // Open a browser window to the help page
            String url = Window.Location.getHref() + "ShellHelpText";
            String target = "_blank";
            String features = "toolbar=0,location=0,status=0,menubar=0";
            Window.open(url, target, features);
        }
    });
    helpBtn.setStylePrimaryName("shell-inputButton");

    //
    // Make a call so that the servlet init happens and we can get
    // our help text
    final AsyncCallback callback = new AsyncCallback() {
        public void onFailure(Throwable t) {
        }

        public void onSuccess(Object result) {
            inputArea.add(helpBtn);
        }
    };
    service.runCommand("", "", callback);
}

From source file:com.sun.labs.aura.music.wsitm.client.ui.widget.PageHeaderWidget.java

License:Open Source License

public PageHeaderWidget(ClientDataManager tCdm) {
    super("pageHeader", tCdm);
    menuItems = new ArrayList<MenuItem>();

    VerticalPanel vP = new VerticalPanel();
    vP.setWidth("100%");
    vP.setSpacing(0);/*from w  w  w.  j  ava  2 s.co  m*/
    vP.add(getMainWidget());

    activeSubHeaderPanel = new FlowPanel();
    activeSubHeaderPanel.setWidth("100%");
    activeSubHeaderPanel.setVisible(false);
    activeSubHeaderPanel.getElement().getStyle().setPropertyPx("marginLeft", 8);
    vP.add(activeSubHeaderPanel);

    // Create buttons
    HorizontalPanel hP = new HorizontalPanel();
    hP.setStyleName("pageConfigMargin");
    hP.add(createHeaderButton("Help", null, new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            cdm.getCurrSwidget().displayHelp();
        }
    }));
    hP.add(createHeaderButton("Config", null, new ClickHandler() {
        @Override
        public void onClick(ClickEvent ce) {
            setSubHeaderPanel(SubHeaderPanels.CONFIG);
        }
    }));
    hP.add(createHeaderButton("Survey", "Tell us what you think; take our 1 minute survey", new ClickHandler() {
        @Override
        public void onClick(ClickEvent ce) {
            Window.open("http://www.tastekeeper.com/wmesurvey", "_blank", "");
        }
    }));
    vP.add(hP);

    createConfigSubHeaderPanel();

    initWidget(vP);

}

From source file:com.sun.labs.aura.music.wsitm.client.ui.widget.PageHeaderWidget.java

License:Open Source License

public Grid getMainWidget() {

    mainPanel = new Grid(1, 4);

    // Set the logo
    populateMainPanel();//from  w ww  . j  a va2s  .c o m

    // Set the section menu
    mm = new MainMenu();
    cdm.getLoginListenerManager().addListener(mm);
    mainPanel.setWidget(0, 1, mm);

    // Set the recommendation type toolbar
    VerticalPanel hP = new VerticalPanel();
    hP.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
    hP.setSpacing(0);

    searchBoxContainerPanel = new FlowPanel();
    search = new SearchWidget(musicServer, cdm, searchBoxContainerPanel);
    search.updateSuggestBox(Oracles.ARTIST);
    hP.add(search);

    Label surveyTxt = new Label("Tell us what you think; take our 1 minute survey");
    surveyTxt.addStyleName("smallSurveyLink pointer");
    surveyTxt.getElement().getStyle().setPropertyPx("fontSize", 10);
    surveyTxt.getElement().getStyle().setPropertyPx("marginTop", -5);
    surveyTxt.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Window.open("http://www.tastekeeper.com/wmesurvey", "_blank", "");
        }
    });
    hP.add(surveyTxt);

    mainPanel.setWidget(0, 2, hP);

    // Set right filler
    Image rightFill = new Image("header_right_fill.gif");
    rightFill.setWidth("26px");
    mainPanel.setWidget(0, 3, rightFill);

    // Set mainPanel visual properties
    mainPanel.setHeight("66px");
    mainPanel.setWidth("100%");
    mainPanel.setStyleName("pageHeader");
    mainPanel.setCellSpacing(0);

    mainPanel.getCellFormatter().setWidth(0, 0, "279px");
    // this should be * but makes ie blow up so just set a big % to fill the space
    mainPanel.getCellFormatter().setWidth(0, 1, "80%");
    mainPanel.getCellFormatter().setWidth(0, 2, "100px");
    mainPanel.getCellFormatter().setWidth(0, 3, "28px");

    mainPanel.getCellFormatter().getElement(0, 0).getStyle().setProperty("backgroundImage",
            "url(header_left.png)");
    mainPanel.getCellFormatter().getElement(0, 1).getStyle().setProperty("backgroundImage",
            "url(header_middle.png)");
    mainPanel.getCellFormatter().getElement(0, 2).getStyle().setProperty("backgroundImage",
            "url(header_middle.png)");
    mainPanel.getCellFormatter().getElement(0, 3).getStyle().setProperty("backgroundImage",
            "url(header_right.png)");

    mainPanel.getCellFormatter().setHorizontalAlignment(0, 1, HorizontalPanel.ALIGN_CENTER);
    mainPanel.getCellFormatter().setHorizontalAlignment(0, 2, HorizontalPanel.ALIGN_RIGHT);
    mainPanel.getCellFormatter().setVerticalAlignment(0, 1, VerticalPanel.ALIGN_MIDDLE);
    mainPanel.getCellFormatter().setVerticalAlignment(0, 2, VerticalPanel.ALIGN_MIDDLE);

    mainPanel.getElement().getStyle().setPropertyPx("marginBottom", 0);

    return mainPanel;
}

From source file:com.sun.labs.aura.music.wsitm.client.ui.widget.PlayButton.java

License:Open Source License

private void popupSimilarArtistRadio(boolean useTags) {
    Window.open(getSimilarArtistRadioLink(useTags), "lastfm_popup",
            "width=400,height=170,menubar=no,toolbar=no,directories=no,"
                    + "location=no,resizable=no,scrollbars=no,status=no");
}

From source file:com.sun.labs.aura.music.wsitm.client.ui.widget.PlayButton.java

License:Open Source License

private void popupArtistRadio() {
    //Window.open(getArtistRadioLink(), "lastfm_popup", "width=300,height=266,menubar=no,toolbar=no,directories=no," 
    //        + "location=no,titlebar=no,dialog=no,resizable=yes,scrollbars=no,status=no");
    Window.open(getArtistRadioLink(), "lastfm_popup", "width=330,height=296,titlebar=no");
}

From source file:com.sun.labs.aura.music.wsitm.client.WebLib.java

License:Open Source License

public static Widget getListenWidget(final TagDetails tagDetails) {
    Image image = PlayButton.playImgBundle.playLastfm30().createImage();
    image.setTitle("Play music like " + tagDetails.getName() + " at last.fm");
    image.setStyleName("pointer");
    image.addClickHandler(new ClickHandler() {
        @Override//from www  . j  a v  a  2s .co  m
        public void onClick(ClickEvent ce) {
            //Window.open(getTagRadioLink(tagDetails.getName()), "lastfm_popup", "width=300,height=266,menubar=no,toolbar=no,directories=no," + "location=no,resizable=no,scrollbars=no,status=no");
            Window.open(getTagRadioLink(tagDetails.getName()), "lastfm_popup", "width=340,height=286");
        }
    });
    return image;
}

From source file:com.tasktop.c2c.server.common.web.client.widgets.hyperlink.UrlHyperlink.java

License:Open Source License

@Override
public void open() {
    String href = Window.Location.getHref();
    String uri = getUri();//from   w w  w  . j  a va2s  .c om

    int idxOfHrefHash = href.indexOf('#');
    if (idxOfHrefHash != -1) {
        int idxOfUriHash = uri.indexOf('#');
        if (idxOfUriHash == idxOfHrefHash) {
            if (uri.substring(0, idxOfUriHash).equals(href.substring(0, idxOfHrefHash))) {
                String newHashTag = uri.substring(idxOfUriHash + 1);
                History.newItem(newHashTag);
                return;
            }
        }
    }

    Window.open(getUri(), getUri(), "");
}

From source file:com.vaadin.client.extensions.BrowserWindowOpenerConnector.java

License:Apache License

@Override
public void onClick(ClickEvent event) {
    String url = getResourceUrl(BrowserWindowOpenerState.locationResource);
    url = addParametersAndFragment(url);
    if (url != null) {
        Window.open(url, getState().target, getState().features);
    }/*from w ww  .ja  v a  2 s.  c  o  m*/
}

From source file:com.vaadin.client.extensions.FileDownloaderConnector.java

License:Apache License

@Override
public void onClick(ClickEvent event) {
    final String url = getResourceUrl("dl");
    if (url != null && !url.isEmpty()) {
        BrowserInfo browser = BrowserInfo.get();
        if (browser.isIOS()) {
            Window.open(url, "_blank", "");
        } else {/*from  w w  w.  ja va 2  s . c o  m*/
            if (iframe != null) {
                // make sure it is not on dom tree already, might start
                // multiple downloads at once
                iframe.removeFromParent();
            }
            iframe = Document.get().createIFrameElement();

            Style style = iframe.getStyle();
            style.setVisibility(Visibility.HIDDEN);
            style.setHeight(0, Unit.PX);
            style.setWidth(0, Unit.PX);

            iframe.setFrameBorder(0);
            iframe.setTabIndex(-1);
            iframe.setSrc(url);
            RootPanel.getBodyElement().appendChild(iframe);
        }
    }
}