Example usage for com.google.gwt.search.client SafeSearchValue STRICT

List of usage examples for com.google.gwt.search.client SafeSearchValue STRICT

Introduction

In this page you can find the example usage for com.google.gwt.search.client SafeSearchValue STRICT.

Prototype

SafeSearchValue STRICT

To view the source code for com.google.gwt.search.client SafeSearchValue STRICT.

Click Source Link

Document

Apply strict filtering for both explicit text and explicit images.

Usage

From source file:next.celebs.page.SettingsPage.java

License:Apache License

public SettingsPage(Context ctx_) {
    this.ctx = ctx_;
    setStyleName("ySettingsPage yPopupPage");
    setWidth(WIDTH + "px");

    setPopupPosition(336, 88);/*from   w w  w  .j av a2 s  .  c  o  m*/
    show();

    final ImageButton btnClearCache = new ImageButton(RES.btnClearCache());
    doneHTML = new HTML("Cache cleared");

    btnClearCache.addMouseDownHandler(new MouseDownHandler() {
        @Override
        public void onMouseDown(MouseDownEvent event) {
            ctx.getPhotoDao().clear();
            ctx.getUi().getPageManager().clearPages();

            doneHTML.setText("Cache cleared");
            NShow eff = new NShow(doneHTML.getElement());
            eff.setDuration(0.5);
            eff.play();
        }
    });

    HorizontalPanel cachePanel = new HorizontalPanel();
    cachePanel.setStyleName("cachePanel");
    cachePanel.setWidth("100%");

    FlowPanel content = new FlowPanel();
    content.add(cachePanel);

    HTML disclaimerHTML = new HTML("Disclaimer");
    disclaimerHTML.setStyleName("disclaimer");
    content.add(disclaimerHTML);
    HTML disclaimerText = new HTML(disclaimer);
    disclaimerText.setStyleName("disclaimerText");
    content.add(disclaimerText);

    setWidget(content);

    cachePanel.setCellHorizontalAlignment(doneHTML, HasHorizontalAlignment.ALIGN_RIGHT);
    cachePanel.add(btnClearCache);
    cachePanel.add(doneHTML);

    Button adultBtn = new Button("Private Mode");
    // content.add(adultBtn);

    adultBtn.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            final OverlayPopup popup = new OverlayPopup();
            popup.addStyleName("yDialog");
            HTML disclaimer = new HTML(
                    "You've gone incognito. Pages you view in this window won't appear in your browser history or search history, and they won't leave other traces, like cookies, on your computer after you close the incognito window. Any files you download or bookmarks you create will be preserved, however.");
            Button okBtn = new Button("Ok");
            Button closeBtn = new Button("Close");
            FlowPanel fp = new FlowPanel();
            fp.setSize("450px", "300px");
            fp.add(disclaimer);
            fp.add(okBtn);
            fp.add(closeBtn);
            popup.setWidget(fp);

            okBtn.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    if (ctx.getSafeSearcrh() == SafeSearchValue.OFF) {
                        // System.out.println("is Adult enabled? " + ctx.isAdultEnabled());
                        ctx.setSafeSearcrh(SafeSearchValue.STRICT);
                    } else {
                        ctx.setSafeSearcrh(SafeSearchValue.OFF);
                    }
                }
            });
            closeBtn.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    popup.hide();
                }
            });

            popup.doShow();
        }
    });
}