Package de.agilecoders.wicket.extensions.markup.html.bootstrap.form.typeaheadV10.bloodhound

Examples of de.agilecoders.wicket.extensions.markup.html.bootstrap.form.typeaheadV10.bloodhound.Bloodhound


                // create the datum for the choice
                return String.format("{\"value\":\"%s\"}", choice);
            }
        };

        TypeaheadConfig config = new TypeaheadConfig(new DataSet(bloodhound));

        return new Typeahead<String>(id, Model.of(""), config);
    }
View Full Code Here


     */
    private Typeahead<String> newLocalTypeahead(final String markupId) {
        final List<String> dataSource = Lists.newArrayList("abc", "def", "ghi");

        Bloodhound<String> bloodhound = new LocalBloodhound<String>("sample", dataSource);
        TypeaheadConfig config = new TypeaheadConfig(new DataSet<String>(bloodhound));
        final Typeahead<String> typeahead = new Typeahead<String>(markupId, Model.of(""), config);

        return typeahead;
    }
View Full Code Here

                // create the datum for the choice
                return String.format("{\"value\":\"%s\"}", choice);
            }
        };

        TypeaheadConfig config = new TypeaheadConfig(new DataSet(bloodhound));

        return new Typeahead<String>(id, Model.of(""), config);
    }
View Full Code Here

        StringBuilder builder = new StringBuilder();

        for (DataSet dataSet : config.getDatasets()) {
            // initialize Bloodhound instances it the source is a Bloodhound object
            if (dataSet.getSource() instanceof Bloodhound) {
                Bloodhound bh = (Bloodhound) dataSet.getSource();
                String bhParams = bh.getConfig().isEmpty() ? "" : bh.getConfig().toJsonString();
                builder
                    .append(String.format("var %s = new Bloodhound(%s);", bh.getName(), bhParams));
                builder.append(String.format("%s.initialize();", bh.getName()));
            }
        }

        JQuery functionCall = $(this).chain("typeahead", config, config.getDatasets());
        builder.append(functionCall.get());
View Full Code Here

    public DataSet(Source<T> source) {
        this.source = source;

        if (source instanceof Bloodhound) {
            Bloodhound bh = (Bloodhound) source;
            withName(bh.getName());
        }
    }
View Full Code Here

    @Test
    public void assertValidHeaderScript() {

        WicketTester tester = tester();

        Bloodhound bloodhound = new Bloodhound("engine", new BloodhoundConfig()) {

            @Override
            public Iterable getChoices(String input) {
                return Collections.EMPTY_LIST;
            }
View Full Code Here

    @Test
    public void assertValidHeaderScript() {

        WicketTester tester = tester();

        Bloodhound bloodhound = new Bloodhound("engine", new BloodhoundConfig()) {

            @Override
            public Iterable getChoices(String input) {
                return Collections.EMPTY_LIST;
            }
View Full Code Here

    public void testComplexRemote() {

        Remote remote = new Remote();
        remote.withUrl("foo").withWildcard("%FOO");

        BloodhoundConfig config = new BloodhoundConfig();
        config.withRemote(remote);

        String expected = "{\"datumTokenizer\":function(d) { return Bloodhound.tokenizers.whitespace(d.value); },\"queryTokenizer\":Bloodhound.tokenizers.whitespace,\"remote\":\"{\\\"wildcard\\\":\\\"%FOO\\\",\\\"url\\\":\\\"foo\\\"}\"}";
        assertEquals(expected, config.toJsonString());

    }
View Full Code Here

    @Test
    public void testSimpleRemote() {

        Remote remote = new Remote("foo");

        BloodhoundConfig config = new BloodhoundConfig();
        config.withRemote(remote);

        String expected = "{\"datumTokenizer\":function(d) { return Bloodhound.tokenizers.whitespace(d.value); },\"queryTokenizer\":Bloodhound.tokenizers.whitespace,\"remote\":\"foo\"}";
        assertEquals(expected, config.toJsonString());

    }
View Full Code Here

    }

    @Test
    public void testComplexRemote() {

        Remote remote = new Remote();
        remote.withUrl("foo").withWildcard("%FOO");

        BloodhoundConfig config = new BloodhoundConfig();
        config.withRemote(remote);

        String expected = "{\"datumTokenizer\":function(d) { return Bloodhound.tokenizers.whitespace(d.value); },\"queryTokenizer\":Bloodhound.tokenizers.whitespace,\"remote\":\"{\\\"wildcard\\\":\\\"%FOO\\\",\\\"url\\\":\\\"foo\\\"}\"}";
View Full Code Here

TOP

Related Classes of de.agilecoders.wicket.extensions.markup.html.bootstrap.form.typeaheadV10.bloodhound.Bloodhound

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.