JAVA Apache Wicket AutoComplete Setup

The ShieldUI AutoComplete Apache Wicket component offers streamlined setup and deployment of our libraries.

Since it is a wrapper of our javascript AutoComplete component, you need to include the references to the CSS and JavaScript resources in the HEAD section of your webpage:

<!DOCTYPE html>
<title>Shield AutoComplete</title>
<meta charset="utf-8" />

<link rel="stylesheet" type="text/css" href="css/light/all.min.css" />
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="js/shieldui-all.min.js"></script>

    <input type="text" wicket:id="autocomplete" />

Then init the autocomplete and add it to your wicket page like in the following example:

AutoComplete autocomplete = new AutoComplete("autocomplete");
AutoCompleteOptions options = autocomplete.getOptions();

options.setTextTemplate("[{code}] {name}");
options.setDataSource(new DataSourceOptions()
                        new HashMap() {{
                            put("code", "AR");
                            put("name", "Argentina");
                        new HashMap() {{
                            put("code", "US");
                            put("name", "United States");
                        new HashMap() {{
                            put("code", "GB");
                            put("name", "England");
                        new HashMap() {{
                            put("code", "CA");
                            put("name", "Canada");
                    .setSort(new DataSourceOptions.SortOption().setPath("code"))
                    .setFilter(new DataSourceOptions.FilterGroup()
                        .addFilter(new DataSourceOptions.FilterOption().setPath("name").setFilter(DataSourceOptions.Filter.CONTAINS).setValue("")


To see more information on this wrapper, please refer to the following startup guide.