1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
private List tree = new ArrayList();
public void buildHierarchy(final Group group, final Acceptor acceptor) {
final List<Group> groups = getHierarchy(group, acceptor);
panelCadre.setStyleClass("formCadre");
panelCadre.setColumns(groups.size());
panelCadre.getChildren().clear();
int index = 0;
for (Group g : groups) {
if (0L == g.getId()) {
//panelCadre.getChildren().add(createList(manager.getGroups(getSessionBean().getCurrentAcceptorId())));
panelCadre.getChildren().add(createTable(manager.getGroups(getSessionBean().getCurrentAcceptorId()), index++));
} else {
//panelCadre.getChildren().add(createList(manager.getChilds(g.getId())));
panelCadre.getChildren().add(createTable(manager.getChilds(g.getId()), index++));
}
}
}
public HtmlDataTable createTable(final List<Group> groups, final int index) {
final DataModel listGroup = new ListDataModel();
listGroup.setWrappedData(groups);
tree.add(listGroup);
final HtmlDataTable list = new HtmlDataTable();
final HtmlColumn column = new HtmlColumn();
list.setStyleClass("panelList");
list.setVar("item");
list.setValue(listGroup);
list.setId("dataTable" + index);
final ExpressionFactory factory = getApplication().getExpressionFactory();
final ELContext elContext = FacesContext.getCurrentInstance().getELContext();
final MethodExpression linkNextAction = factory.createMethodExpression(elContext,
"#{TerminalPool_1.linkNextAction}", String.class, new Class[]{});
final HtmlGraphicImage imgStatus = new HtmlGraphicImage();
imgStatus.setAlt(bundle.getString("status_alive"));
imgStatus.setTitle(bundle.getString("status_alive"));
imgStatus.setValue("../../resources/images/statut-gris.png");
imgStatus.setRendererType("#{item.status == 'ALIVE'}");
final HtmlGraphicImage imgType = new HtmlGraphicImage();
imgType.setUrl("../../public/images/acceptation_set_item.png");
imgType.setRendererType("not #{item.node}");
final HtmlCommandLink link = new HtmlCommandLink();
link.setTitle("#{item.description}");
link.setActionExpression(linkNextAction);
link.setValue("#{item.name}");
column.getChildren().add(imgStatus);
column.getChildren().add(imgType);
column.getChildren().add(link);
list.getChildren().add(column);
return list;
} |
Partager