be.personify.iam.frontend.wicket.panel.common.EnumerationsPanel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of personify-frontend Show documentation
Show all versions of personify-frontend Show documentation
frontend library for different usages
package be.personify.iam.frontend.wicket.panel.common;
import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.DataView;
import org.apache.wicket.markup.repeater.data.IDataProvider;
import be.personify.iam.frontend.wicket.dataprovider.common.EnumerationListDataProvider;
import be.personify.iam.frontend.wicket.model.common.EnumerationsModel;
public class EnumerationsPanel extends Panel {
private static final long serialVersionUID = 4393427992271062106L;
private static final Logger logger = LogManager.getLogger(EnumerationsPanel.class);
public EnumerationsPanel(String id) {
super(id);
}
public EnumerationsPanel(String id, List e) {
super(id);
}
/**
* Gets the dataview
* @param id the id of the component
* @param enums the enums
* @return a dataview
*/
public DataView getDataView( String id, List enums) {
logger.debug("initializing dataview");
IDataProvider dataProvider = new EnumerationListDataProvider(new EnumerationsModel(enums));
setVisible(dataProvider.size() > 0);
DataView view = new DataView(id, dataProvider) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(Item item) {
add(new Label("name", item.getModelObject().name()));
}
};
return view;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy