src/main/java/org/efaps/ui/wicket/models/objects/UIStructurBrowser.java
protected void executeTreeTable(final Map<Instance, Boolean> _map,
                                    final boolean _expand)
    {
        try {
            final List<Instance> instances = new ArrayList<>();
            for (final Instance inst : _map.keySet()) {
                instances.add(inst);
            }
            final List<Integer> userWidthList = getUserWidths();
            // evaluate for all expressions in the table
            final MultiPrintQuery multi = new MultiPrintQuery(instances);
            Type type = instances.isEmpty() ? null : instances.get(0).getType();
            int i = 0;
            for (final Field field : getUserSortedColumns()) {
                Attribute attr = null;
                if (field.hasAccess(getMode(), getInstance()) && !field.isNoneDisplay(getMode())) {
                    if (_map.size() > 0) {
                        if (field.getSelect() != null) {
                            multi.addSelect(field.getSelect());
                        } else if (field.getAttribute() != null) {
                            multi.addAttribute(field.getAttribute());
                        } else if (field.getPhrase() != null) {
                            multi.addPhrase(field.getName(), field.getPhrase());
                        } else if (field.getMsgPhrase() != null) {
                            multi.addMsgPhrase(new SelectBuilder(getBaseSelect4MsgPhrase(field)), field.getMsgPhrase());
                        }
                        if (field.getSelectAlternateOID() != null) {
                            multi.addSelect(field.getSelectAlternateOID());
                        }
                        if (field.containsProperty(UITableFieldProperty.SORT_SELECT)) {
                            multi.addSelect(field.getProperty(UITableFieldProperty.SORT_SELECT));
                        } else if (field.containsProperty(UITableFieldProperty.SORT_PHRASE)) {
                            multi.addPhrase(field.getProperty(UITableFieldProperty.SORT_PHRASE),
                                            field.getProperty(UITableFieldProperty.SORT_PHRASE));
                        } else if (field.containsProperty(UITableFieldProperty.SORT_MSG_PHRASE)) {
                            multi.addMsgPhrase(field.getProperty(UITableFieldProperty.SORT_MSG_PHRASE));
                        }
                    }
                    if (field.getAttribute() != null && type != null) {
                        attr = type.getAttribute(field.getAttribute());
                    }
                    if (isRoot()) {
                        SortDirection sortdirection = SortDirection.NONE;
                        if (field.getName().equals(getSortKey())) {
                            sortdirection = getSortDirection();
                        }
                        if (!field.isHiddenDisplay(getMode())) {
                            final FieldConfiguration fieldConfig = new FieldConfiguration(field.getId());
                            final UITableHeader uiTableHeader = new UITableHeader(this, fieldConfig, sortdirection,
                                            attr);
                            getHeaders().add(uiTableHeader);
                            if (!fieldConfig.isFixedWidth()) {
                                if (userWidthList != null && userWidthList.size() > i) {
                                    if (isShowCheckBoxes() && userWidthList.size() > i + 1) {
                                        uiTableHeader.setWidth(userWidthList.get(i + 1));
                                    } else {
                                        uiTableHeader.setWidth(userWidthList.get(i));
                                    }
                                }
                                setWidthWeight(getWidthWeight() + fieldConfig.getWidthWeight());
                            }
                        }
                    }
                    i++;
                }
            }
            if (!multi.execute()) {
                type = getTypeFromEvent();
            }
            Attribute attr = null;
            while (multi.next()) {
                Instance instance = multi.getCurrentInstance();
                final UIStructurBrowser child = getNewStructurBrowser(instance, this);
                child.setDirection(_map.get(instance));
                for (final Field field : getUserSortedColumns()) {
                    instance = evaluateFieldInstance(multi, field);
                    if (field.hasAccess(getMode(), getInstance()) && !field.isNoneDisplay(getMode())) {
                        Object value = null;
                        Object sortValue = null;
                        attr = null;
                        if (field.getSelect() != null) {
                            value = multi.getSelect(field.getSelect());
                            attr = multi.getAttribute4Select(field.getSelect());
                        } else if (field.getAttribute() != null) {
                            value = multi.getAttribute(field.getAttribute());
                            attr = multi.getAttribute4Attribute(field.getAttribute());
                        } else if (field.getPhrase() != null) {
                            value = multi.getPhrase(field.getName());
                        } else if (field.getMsgPhrase() != null) {
                            value = multi.getMsgPhrase(new SelectBuilder(getBaseSelect4MsgPhrase(field)),
                                            field.getMsgPhrase());
                        }
                        if (field.containsProperty(UITableFieldProperty.SORT_SELECT)) {
                            sortValue = multi.getSelect(field.getProperty(UITableFieldProperty.SORT_SELECT));
                        } else if (field.containsProperty(UITableFieldProperty.SORT_PHRASE)) {
                            sortValue = multi.getPhrase(field.getProperty(UITableFieldProperty.SORT_PHRASE));
                        } else if (field.containsProperty(UITableFieldProperty.SORT_MSG_PHRASE)) {
                            sortValue = multi.getMsgPhrase(field.getProperty(UITableFieldProperty.SORT_MSG_PHRASE));
                        }

                        final UIField uiField = new UIField(this, instance.getKey(),
                                        UIValue.get(field, attr, value)
                                            .setInstance(instance)
                                            .setClassObject(this)
                                            .setCallInstance(getInstance())
                                            .setRequestInstances(multi.getInstanceList()));
                        uiField.setCompareValue(sortValue);

                        if (field.getName().equals(getBrowserFieldName())) {
                            child.setLabel(uiField.getValue().getReadOnlyValue(uiField.getParent().getMode()));
                            child.setAllowChildren(checkForAllowChildren(instance));
                            if (child.isAllowChildren()) {
                                child.setAllowItems(checkForAllowItems(instance));
                                child.setParent(checkForChildren(instance));
                            }
                            child.setImage(Image.getTypeIcon(instance.getType()) != null ? Image.getTypeIcon(
                                            instance.getType()).getName() : null);
                            child.setBrowserFieldIndex(child.getColumns().size());
                        }
                        if (field.isHiddenDisplay(getMode())) {
                            child.getHidden().add(uiField);
                        } else {
                            child.getColumns().add(uiField);
                        }
                    }
                }
                this.children.add(child);
                child.checkHideColumn4Row();
            }
        } catch (final EFapsException e) {
            throw new RestartResponseException(new ErrorPage(e));
        }
        sortModel();
        expand(_expand);
        super.setInitialized(true);
    }
protected void executeTreeTable(final Map<Instance, Boolean> _map,
                                    final boolean _expand)
    {
        try {
            final List<Instance> instances = new ArrayList<>();
            for (final Instance inst : _map.keySet()) {
                instances.add(inst);
            }
            final List<Integer> userWidthList = getUserWidths();
            // evaluate for all expressions in the table
            final MultiPrintQuery multi = new MultiPrintQuery(instances);
            Type type = instances.isEmpty() ? null : instances.get(0).getType();
            int i = 0;
            for (final Field field : getUserSortedColumns()) {
                Attribute attr = null;
                if (field.hasAccess(getMode(), getInstance()) && !field.isNoneDisplay(getMode())) {
                    if (_map.size() > 0) {
                        if (field.getSelect() != null) {
                            multi.addSelect(field.getSelect());
                        } else if (field.getAttribute() != null) {
                            multi.addAttribute(field.getAttribute());
                        } else if (field.getPhrase() != null) {
                            multi.addPhrase(field.getName(), field.getPhrase());
                        } else if (field.getMsgPhrase() != null) {
                            multi.addMsgPhrase(new SelectBuilder(getBaseSelect4MsgPhrase(field)), field.getMsgPhrase());
                        }
                        if (field.getSelectAlternateOID() != null) {
                            multi.addSelect(field.getSelectAlternateOID());
                        }
                        if (field.containsProperty(UITableFieldProperty.SORT_SELECT)) {
                            multi.addSelect(field.getProperty(UITableFieldProperty.SORT_SELECT));
                        } else if (field.containsProperty(UITableFieldProperty.SORT_PHRASE)) {
                            multi.addPhrase(field.getProperty(UITableFieldProperty.SORT_PHRASE),
                                            field.getProperty(UITableFieldProperty.SORT_PHRASE));
                        } else if (field.containsProperty(UITableFieldProperty.SORT_MSG_PHRASE)) {
                            multi.addMsgPhrase(field.getProperty(UITableFieldProperty.SORT_MSG_PHRASE));
                        }
                    }
                    if (field.getAttribute() != null && type != null) {
                        attr = type.getAttribute(field.getAttribute());
                    }
                    if (isRoot()) {
                        SortDirection sortdirection = SortDirection.NONE;
                        if (field.getName().equals(getSortKey())) {
                            sortdirection = getSortDirection();
                        }
                        if (!field.isHiddenDisplay(getMode())) {
                            final FieldConfiguration fieldConfig = new FieldConfiguration(field.getId());
                            final UITableHeader uiTableHeader = new UITableHeader(this, fieldConfig, sortdirection,
                                            attr);
                            getHeaders().add(uiTableHeader);
                            if (!fieldConfig.isFixedWidth()) {
                                if (userWidthList != null && userWidthList.size() > i) {
                                    if (isShowCheckBoxes() && userWidthList.size() > i + 1) {
                                        uiTableHeader.setWidth(userWidthList.get(i + 1));
                                    } else {
                                        uiTableHeader.setWidth(userWidthList.get(i));
                                    }
                                }
                                setWidthWeight(getWidthWeight() + fieldConfig.getWidthWeight());
                            }
                        }
                    }
                    i++;
                }
            }
            if (!multi.execute()) {
                type = getTypeFromEvent();
            }
            Attribute attr = null;
            while (multi.next()) {
                Instance instance = multi.getCurrentInstance();
                final UIStructurBrowser child = getNewStructurBrowser(instance, this);
                child.setDirection(_map.get(instance));
                for (final Field field : getUserSortedColumns()) {
                    instance = evaluateFieldInstance(multi, field);
                    if (field.hasAccess(getMode(), getInstance()) && !field.isNoneDisplay(getMode())) {
                        Object value = null;
                        Object sortValue = null;
                        attr = null;
                        if (field.getSelect() != null) {
                            value = multi.getSelect(field.getSelect());
                            attr = multi.getAttribute4Select(field.getSelect());
                        } else if (field.getAttribute() != null) {
                            value = multi.getAttribute(field.getAttribute());
                            attr = multi.getAttribute4Attribute(field.getAttribute());
                        } else if (field.getPhrase() != null) {
                            value = multi.getPhrase(field.getName());
                        } else if (field.getMsgPhrase() != null) {
                            value = multi.getMsgPhrase(new SelectBuilder(getBaseSelect4MsgPhrase(field)),
                                            field.getMsgPhrase());
                        }
                        if (field.containsProperty(UITableFieldProperty.SORT_SELECT)) {
                            sortValue = multi.getSelect(field.getProperty(UITableFieldProperty.SORT_SELECT));
                        } else if (field.containsProperty(UITableFieldProperty.SORT_PHRASE)) {
                            sortValue = multi.getPhrase(field.getProperty(UITableFieldProperty.SORT_PHRASE));
                        } else if (field.containsProperty(UITableFieldProperty.SORT_MSG_PHRASE)) {
                            sortValue = multi.getMsgPhrase(field.getProperty(UITableFieldProperty.SORT_MSG_PHRASE));
                        }

                        final UIField uiField = new UIField(this, instance.getKey(),
                                        UIValue.get(field, attr, value)
                                            .setInstance(instance)
                                            .setClassObject(this)
                                            .setCallInstance(getInstance())
                                            .setRequestInstances(multi.getInstanceList()));
                        uiField.setCompareValue(sortValue);

                        if (field.getName().equals(getBrowserFieldName())) {
                            child.setLabel(uiField.getValue().getReadOnlyValue(uiField.getParent().getMode()));
                            child.setAllowChildren(checkForAllowChildren(instance));
                            if (child.isAllowChildren()) {
                                child.setAllowItems(checkForAllowItems(instance));
                                child.setParent(checkForChildren(instance));
                            }
                            child.setImage(Image.getTypeIcon(instance.getType()) != null ? Image.getTypeIcon(
                                            instance.getType()).getName() : null);
                            child.setBrowserFieldIndex(child.getColumns().size());
                        }
                        if (field.isHiddenDisplay(getMode())) {
                            child.getHidden().add(uiField);
                        } else {
                            child.getColumns().add(uiField);
                        }
                    }
                }
                this.children.add(child);
                child.checkHideColumn4Row();
            }
        } catch (final EFapsException e) {
            throw new RestartResponseException(new ErrorPage(e));
        }
        sortModel();
        expand(_expand);
        super.setInitialized(true);
    }
This method is called in case of a TreeTable from the {@link #execute()}
method to fill this StructurBrowserModel with live.

@param _map      List of Objects
@param _expand   inside an expand