@@ -0,0 +1,3462 @@
+package lemming.context.inbound;%0A%0Aimport lemming.context.BaseContext;%0Aimport org.apache.wicket.Component;%0Aimport org.apache.wicket.MarkupContainer;%0Aimport org.apache.wicket.extensions.markup.html.repeater.tree.AbstractTree;%0Aimport org.apache.wicket.extensions.markup.html.repeater.tree.ITreeProvider;%0Aimport org.apache.wicket.extensions.markup.html.repeater.tree.NestedTree;%0Aimport org.apache.wicket.extensions.markup.html.repeater.tree.content.Folder;%0Aimport org.apache.wicket.model.IModel;%0Aimport org.apache.wicket.model.Model;%0A%0Aimport java.util.Iterator;%0A%0A/**%0A * A tree used to map inbound contexts to contexts.%0A */%0Apublic class ContextTree extends NestedTree%3CBaseContext%3E %7B%0A    /**%0A     * Creates a tree.%0A     *%0A     * @param provider tree provider%0A     */%0A    public ContextTree(ITreeProvider%3CBaseContext%3E provider) %7B%0A        super(%22inboundContextTree%22, provider);%0A    %7D%0A%0A    /**%0A     * Creates a content component.%0A     *%0A     * @param id if of the component%0A     * @param model model of the component%0A     * @return The component.%0A     */%0A    @Override%0A    protected Component newContentComponent(String id, IModel%3CBaseContext%3E model) %7B%0A        return new ContextFolder(id, this, model);%0A    %7D%0A%0A    /**%0A     * Collapses all roots.%0A     */%0A    public void collapseAll() %7B%0A        Iterator%3C? extends BaseContext%3E iterator = getProvider().getRoots();%0A%0A        while (iterator.hasNext()) %7B%0A            collapse(iterator.next());%0A        %7D%0A    %7D%0A%0A    /**%0A     * Expands all roots.%0A     */%0A    public void expandAll() %7B%0A        Iterator%3C? extends BaseContext%3E iterator = getProvider().getRoots();%0A%0A        while (iterator.hasNext()) %7B%0A            expand(iterator.next());%0A        %7D%0A    %7D%0A%0A    /**%0A     * A folder component for contexts.%0A     */%0A    private class ContextFolder extends Folder%3CBaseContext%3E %7B%0A        /**%0A         * Creates a folder.%0A         *%0A         * @param id if of the folder%0A         * @param tree parent tree%0A         * @param model folder model%0A         */%0A        ContextFolder(String id, AbstractTree%3CBaseContext%3E tree, IModel%3CBaseContext%3E model) %7B%0A            super(id, tree, model);%0A        %7D%0A%0A        /**%0A         * Creates a label model.%0A         *%0A         * @param model folder model%0A         * @return The label model.%0A         */%0A        @Override%0A        protected IModel%3C?%3E newLabelModel(IModel%3CBaseContext%3E model) %7B%0A            BaseContext context = model.getObject();%0A            return Model.of(String.format(%22%3Cb%3E%25d%3C/b%3E: %25s%22, context.getNumber(), context.getKeyword()));%0A        %7D%0A%0A        /**%0A         * Creates a label component.%0A         *%0A         * @param id id of the component%0A         * @param model model of the component%0A         * @return The component.%0A         */%0A        @Override%0A        protected Component newLabelComponent(String id, IModel%3CBaseContext%3E model) %7B%0A            Component component = super.newLabelComponent(id, model);%0A            component.setEscapeModelStrings(false);%0A            return component;%0A        %7D%0A%0A        /**%0A         * Creates a link component.%0A         *%0A         * @param id id of the component%0A         * @param model model of the component%0A         * @return The component.%0A         */%0A        @Override%0A        protected MarkupContainer newLinkComponent(String id, IModel%3CBaseContext%3E model) %7B%0A            MarkupContainer container = super.newLinkComponent(id, model);%0A            container.setEscapeModelStrings(false);%0A            return container;%0A        %7D%0A    %7D%0A%7D%0A

Implement a tree used to map contexts.