below is one example of extending AbstractComponentBuilder class which implements ComponentConfigBuilder and ComponentDataBuilder Interfaces
package ext.sra.mvc;
@ComponentBuilder("ext.sra.PartSearchBuilder")
public class PartSearchBuilder extends AbstractComponentBuilder {
private static int level = 1;
@SuppressWarnings("deprecation")
@Override
public Object buildComponentData(ComponentConfig config, ComponentParams params) throws Exception {
ObjectVector result = new ObjectVector();
String topLevelPartCriteria = (String) params.getParameter("oid");
String name = (String) params.getParameter("name");
JcaComponentParams localJcaComponentParams = (JcaComponentParams) params;
HashMap<String, Object> map = localJcaComponentParams.getHelperBean().getNmCommandBean().getText();
for (Iterator<String> itr = set.iterator(); itr.hasNext();) {
String n = itr.next();
System.out.println(n + "----" + map.get(n));
}
System.out.println("--AAA--" + localJcaComponentParams.getHelperBean().getNmCommandBean().getPageOid());
System.out.println("--" + topLevelPartCriteria);
System.out.println("--" + params.getAttribute("oid"));
System.out.println("--" + params.getContextObject());
wt.fc.ReferenceFactory oid = new wt.fc.ReferenceFactory();
wt.fc.WTReference ref = oid.getReference(localJcaComponentParams.getHelperBean().getNmCommandBean().getPageOid().toString().split("~")[0]);
NavigationCriteria nc = new NavigationCriteria();
nc.setConfigSpecs(Arrays.asList(new LatestConfigSpec()));
WTPart part = (WTPart) ref.getObject();
QueryResult qr = new QueryResult();
getStructure(part, nc, 1, qr);
return qr;
}
@Override
public ComponentConfig buildComponentConfig(ComponentParams params) throws WTException {
ComponentConfigFactory factory = getComponentConfigFactory();
TableConfig table = factory.newTableConfig();
table.setLabel("MBOM");
table.setType("wt.part.WTPart");
// make row indd the table selectable
table.setSelectable(true);
table.setActionModel("shreyas_toolbar");
ColumnConfig col = factory.newColumnConfig("Name", false);
table.addComponent(col);
table.addComponent(factory.newColumnConfig("Level", false));
table.addComponent(factory.newColumnConfig(INFO_ACTION, false));
table.addComponent(factory.newColumnConfig("Quantity", false));
return table;
}
}