Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright (C) 2016 Premium Minds.
*
* This file is part of pm-wicket-utils.
*
* pm-wicket-utils is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* pm-wicket-utils is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with pm-wicket-utils. If not, see .
*/
package com.premiumminds.webapp.wicket.bootstrap.select;
import java.util.List;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.IChoiceRenderer;
import org.apache.wicket.model.IModel;
public class BootstrapDropDownChoice extends DropDownChoice {
private static final long serialVersionUID = 4557161449961511781L;
/**
* Constructor.
*
* @param id
* See Component
*/
public BootstrapDropDownChoice(final String id)
{
super(id);
}
/**
* Constructor.
*
* @param id
* See Component
* @param choices
* The collection of choices in the dropdown
*/
public BootstrapDropDownChoice(final String id, final List extends T> choices)
{
super(id, choices);
}
/**
* Constructor.
*
* @param id
* See Component
* @param renderer
* The rendering engine
* @param choices
* The collection of choices in the dropdown
*/
public BootstrapDropDownChoice(final String id, final List extends T> choices,
final IChoiceRenderer super T> renderer)
{
super(id, choices, renderer);
}
/**
* Constructor.
*
* @param id
* See Component
* @param model
* See Component
* @param choices
* The collection of choices in the dropdown
*/
public BootstrapDropDownChoice(final String id, IModel model, final List extends T> choices)
{
super(id, model, choices);
}
/**
* Constructor.
*
* @param id
* See Component
* @param model
* See Component
* @param choices
* The drop down choices
* @param renderer
* The rendering engine
*/
public BootstrapDropDownChoice(final String id, IModel model, final List extends T> choices,
final IChoiceRenderer super T> renderer)
{
super(id, model, choices, renderer);
}
/**
* Constructor.
*
* @param id
* See Component
* @param choices
* The collection of choices in the dropdown
*/
public BootstrapDropDownChoice(String id, IModel extends List extends T>> choices)
{
super(id, choices);
}
/**
* Constructor.
*
* @param id
* See Component
* @param model
* See Component
* @param choices
* The drop down choices
*/
public BootstrapDropDownChoice(String id, IModel model, IModel extends List extends T>> choices)
{
super(id, model, choices);
}
/**
* Constructor.
*
* @param id
* See Component
* @param choices
* The drop down choices
* @param renderer
* The rendering engine
*/
public BootstrapDropDownChoice(String id, IModel extends List extends T>> choices,
IChoiceRenderer super T> renderer)
{
super(id, choices, renderer);
}
/**
* Constructor.
*
* @param id
* See Component
* @param model
* See Component
* @param choices
* The drop down choices
* @param renderer
* The rendering engine
*/
public BootstrapDropDownChoice(String id, IModel model, IModel extends List extends T>> choices,
IChoiceRenderer super T> renderer)
{
super(id, model, choices, renderer);
}
@Override
protected void onConfigure() {
super.onConfigure();
setOutputMarkupId(true);
}
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.render(OnDomReadyHeaderItem.forScript("$(\".bootstrap-select .dropdown-toggle\").each(function(i, el){ if ( $(el).data('id')=='"+this.getMarkupId()+"') $(el).parent().remove(); });"));
response.render(OnDomReadyHeaderItem.forScript("$(\"#"+this.getMarkupId()+"\").selectpicker();"));
}
}