Example usage for com.google.gwt.query.client GQuery hide

List of usage examples for com.google.gwt.query.client GQuery hide

Introduction

In this page you can find the example usage for com.google.gwt.query.client GQuery hide.

Prototype

public GQuery hide() 

Source Link

Document

Make invisible all matched elements.

Usage

From source file:be.dramaix.ai.slidingpuzzle.client.ConfigPanel.java

License:Apache License

private void onDimensionChange(int newDimension) {
    GQuery algorithmSelector = SELECTOR.getAlgorithmSelectElement();
    GQuery algorithmSelectorSpan = algorithmSelector.siblings("span");
    GQuery heuristicSelectorRow = SELECTOR.getHeuristicSelectElement().parent().parent();

    if (newDimension == 4) {
        algorithmType = AlgorithmType.IDA_STAR;

        algorithmSelector.val(AlgorithmType.IDA_STAR.name());
        algorithmSelector.hide();
        algorithmSelectorSpan.text(AlgorithmType.IDA_STAR.getLabel());

        heuristicSelectorRow.show();//from  w  w w  . ja va  2s . co m
    } else {
        algorithmSelectorSpan.text("");
        algorithmSelector.show();

    }

    SELECTOR.getSolveButton().hide();
    SELECTOR.getPlayButton().hide();

}

From source file:be.dramaix.ai.slidingpuzzle.client.ConfigPanel.java

License:Apache License

private void onAlgorithmChange(String algorithm) {
    algorithmType = AlgorithmType.valueOf(algorithm);

    GQuery heuristicSelectorRow = SELECTOR.getHeuristicSelectElement().parent().parent();

    if (algorithmType == AlgorithmType.BDF) {
        heuristicSelectorRow.hide();
    } else {//from   www . j a  v  a 2  s .  co m
        heuristicSelectorRow.show();
    }

}

From source file:com.arcbees.chosen.client.gwt.ChosenListBox.java

License:Apache License

@Override
public void setVisible(boolean visible) {
    this.visible = visible;

    GQuery chosenElement = getChosenElement();

    if (visible) {
        chosenElement.show();/*from   w  w w . j a  va2  s .c  o m*/
    } else {
        chosenElement.hide();
    }
}

From source file:com.watopi.chosen.client.gwt.ChosenListBox.java

License:Open Source License

@Override
public void setVisible(boolean visible) {
    this.visible = visible;

    if (isSupported()) {
        GQuery chosenElement = getChosenElement();
        if (visible) {
            chosenElement.show();/*from   w  ww.j  av a 2s .co  m*/
        } else {
            chosenElement.hide();
        }
    } else {
        super.setVisible(visible);
    }
}

From source file:gwtquery.plugins.lazyload.client.LazyLoad.java

License:Apache License

/**
 * Lazy load selected pictures, only actually fetching the file when the
 * picture becomes visible in the user's viewport.
 *
 * Pictures must have a "data-original" attribute indicating the URL to load,
 * and they should have a correct size already.
 *
 * @param options configuration options.
 * @return this./*from  w w w .j  av  a 2s.  c om*/
 */
public LazyLoad lazyload(final Options options) {
    if (get().getLength() == 0) {
        return this;
    }

    final Options opt = options.copy();

    final Updater updater = new Updater(get(), opt);

    each(new Function() {
        @Override
        public void f(Element e) {

            final GQuery current = $(e);

            current.on(opt.getEventName(), new Function() {

                @Override
                public void f(final Element e) {

                    current.off(opt.getEventName(), this);

                    final String data = $(e).attr("data-original");
                    if (data == null) {
                        return;
                    }
                    $("<img/>").bind(Event.ONLOAD, new Function() {
                        @Override
                        public void f(final Element img) {
                            current.hide().attr("src", $(img).attr("src"));
                            if (opt.getEffect() == null) {
                                current.show();
                            } else {
                                opt.getEffect().f(e);
                            }
                        }
                    }).attr("src", data);
                    current.removeAttr("data-original");
                }
            }).attr("src", opt.getPlaceholder());
        }
    });

    if (opt.getContainer() == null) {
        final HandlerRegistration registration = Window.addWindowScrollHandler(new Window.ScrollHandler() {
            @Override
            public void onWindowScroll(Window.ScrollEvent event) {
                updater.update();
            }
        });
        updater.setHandler(registration);
    } else {
        final Function handler;
        opt.getContainer().on("scroll", handler = new Function() {
            @Override
            public boolean f(final Event e) {
                updater.update();
                return true;
            }
        });
        updater.setContainerHandler(handler);
    }

    updater.update();

    return this;
}

From source file:gwtquery.samples.client.GwtQueryBenchModule.java

License:Apache License

/**
 * Initialize the track with the horses/* www  .j av  a 2  s  . c o  m*/
 */
private void initTrack(Benchmark... benchs) {
    if (!useTrack)
        return;
    String tpl = "<div id=%ID%horse class=horse><nobr><img class=himg src=images/bench/horse.gif><span>%ID%</span></nobr></div>";
    GQuery g = $("#racefield").html("");
    for (Benchmark b : benchs) {
        String id = b.getId();
        String lg = id.contains("gwt") ? "gwt" : id;
        String s = tpl.replaceAll("%ID%", id).replaceAll("%LG%", lg);
        g.append($(s));
    }

    GQuery flag = $("<img class=flag src='images/bench/animated-flag.gif'/>").appendTo(document);

    // These values are set in the css.
    int horseHeight = 35;
    int horseWidth = 150;
    int flagWidth = 35;

    int height = horseHeight * (benchs.length + 1);
    $("#racetrack").css("height", height + "px");

    trackWidth = g.width() - horseWidth - flagWidth;
    flag.hide();
}

From source file:gwtquery.samples.client.GwtQueryDemoModule.java

License:Apache License

public void onModuleLoad() {
    // Ask GWT compiler to generate our interface
    final Slide s = GWT.create(Slide.class);
    final GQuery slides = $(s.allSlides());

    // we initially hide all slides and bullets
    slides.hide().eq(0).as(Effects).clipAppear();
    $(s.allSlideBullets()).hide();//w  w  w .jav  a2s. com

    // add onclick handler to body element
    $(slides).click(new Function() {
        // two state variables to note current slide being shown
        // and current bullet
        int curSlide = 0;
        int curBullets = 0;

        // query and store all bullets of current slide
        GQuery bullets = $(s.slideBulletsCtx(slides.get(curSlide)));

        public boolean f(Event e) {
            // onclick, if not all bullets shown, show a bullet and increment
            if (curBullets < bullets.size()) {
                bullets.eq(curBullets++).as(Effects).fadeIn(Speed.SLOW);
            } else {
                // all bullets shown, hide them and current slide
                bullets.hide();

                // move to next slide, checking for wrap around
                int lastSlide = curSlide++;
                if (curSlide == slides.size()) {
                    curSlide = 0;
                }

                // query for new set of bullets, and show next slide
                curBullets = 0;
                bullets = $(s.slideBulletsCtx(slides.get(curSlide)));

                // Hide the last slide and show the next when the effects finishes
                slides.eq(lastSlide).as(Effects).fadeOut(new Function() {
                    public void f(Element e) {
                        slides.eq(curSlide).as(Effects).clipAppear();
                    }
                });
            }
            return true;
        }
    });
}

From source file:org.bonitasoft.web.toolkit.client.ui.component.table.Table.java

License:Open Source License

public Table setShowSearch(final boolean show) {
    showSearch = show;/*from w w w .  ja  v  a 2s.  c  o  m*/

    if (isGenerated()) {
        final GQuery filter = $(".tablefilters > div:has(input[name=search])", rootElement);
        if (!show) {
            filter.hide();
        } else {
            filter.show();
        }
    }
    return this;
}

From source file:org.kaaproject.avro.ui.gwt.client.widget.choosen.AvroChoosenListBox.java

License:Apache License

public static int getChoosenListBoxWidth(ChosenListBox box) {
    int width = 0;
    ChosenImpl impl = $(box.getElement()).data(CHOSEN_DATA_KEY, ChosenImpl.class);
    if (impl != null) {
        GQuery searchchoice = impl.getContainer().find("li." + avroChoosenResources.css().searchChoice());
        searchchoice.hide();
        width = impl.getContainer().width();
        searchchoice.show();// w ww.  j  a  v  a  2s. c  o m
    }
    return width;
}

From source file:org.kaaproject.avro.ui.gwt.client.widget.choosen.AvroChoosenListBox.java

License:Apache License

public static void setChoosenSearchFieldVisible(ChosenListBox box, boolean visible) {
    ChosenImpl impl = $(box.getElement()).data(CHOSEN_DATA_KEY, ChosenImpl.class);
    if (impl != null) {
        GQuery searchfield = impl.getContainer().find("li." + avroChoosenResources.css().searchField()).first();
        if (visible) {
            searchfield.show();/*from   w  w  w .  j  a  v  a  2s. c o m*/
        } else {
            searchfield.hide();
        }
    }
}