com.talk2object.plum.interaction.viewbuilder.ListViewBuilder Maven / Gradle / Ivy
package com.talk2object.plum.interaction.viewbuilder;
import java.util.List;
import com.talk2object.plum.interaction.application.PlumApplicationContextUtils;
import com.talk2object.plum.interaction.viewgeneneration.AbstractViewBuilder;
import com.talk2object.plum.interaction.viewgeneneration.BuilderMatchPolicy;
import com.talk2object.plum.interaction.viewgeneneration.ViewBuildContext;
import com.talk2object.plum.interaction.viewgeneneration.ViewClass;
import com.talk2object.plum.interaction.viewgeneneration.ViewFactory;
import com.talk2object.plum.view._abstract.components.Label;
import com.talk2object.plum.view._abstract.components.containers.layout.HorizontalBox;
import com.talk2object.plum.view._abstract.components.containers.layout.VerticalBox;
import com.talk2object.plum.view._abstract.window.UIComponent;
public class ListViewBuilder extends AbstractViewBuilder {
@Override
public UIComponent build(Object model, String viewClass,
ViewBuildContext context, UIComponent parentView) {
List list = (List) model;
ViewFactory factory = PlumApplicationContextUtils.getViewFactory();
VerticalBox box = new VerticalBox();
Label label = new Label();
box.addChild(label);
String[] viewClasses = new String[] {
ViewClass.LIST_ITEM.compatibleExpr(),
ViewClass.SHOW.compatibleExpr() };
for (Object obj : list) {
UIComponent childView = factory.create(obj,
BuilderMatchPolicy.BEAN, viewClasses, context, box);
HorizontalBox row = new HorizontalBox();
row.addChild(childView);
box.addChild(row);
}
return box;
}
@Override
public Class getModelClass() {
return List.class;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy