package org.onehippo.cms7.essentials.components.gui;

import java.util.ArrayList;
import java.util.List;

import org.onehippo.cms7.essentials.components.gui.panel.AttachComponentPanel;
import org.onehippo.cms7.essentials.components.gui.panel.ComponentsPanel;
import org.onehippo.cms7.essentials.dashboard.InstallablePlugin;
import org.onehippo.cms7.essentials.dashboard.Plugin;
import org.onehippo.cms7.essentials.dashboard.ctx.PluginContext;
import org.onehippo.cms7.essentials.dashboard.wizard.AjaxWizardPanel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @version "$Id$"
 */
public class ComponentsWizard extends InstallablePlugin<ComponentsInstaller> {

    private static final long serialVersionUID = 1L;
    private static Logger log = LoggerFactory.getLogger(ComponentsWizard.class);
    private final List<String> registeredDocuments = new ArrayList<>();

    public ComponentsWizard(final String id, final Plugin descriptor, final PluginContext context) {
        super(id, descriptor, context);
        final AjaxWizardPanel panel = new AjaxWizardPanel("wizard");
        // TODO move attach to last
        panel.addWizard(new ComponentsPanel(this, "Component installer"));
        panel.addWizard(new AttachComponentPanel(this, "Attach components"));
        //
        // panel.addWizard(new DocumentRegisterPanel("installer2"));
        //
        add(panel);

    }

    @Override
    public ComponentsInstaller getInstaller() {
        return new ComponentsInstaller();
    }

    public List<String> getRegisteredDocuments() {
        return registeredDocuments;
    }

    public void addRegisteredDocument(final String documentName) {
        registeredDocuments.add(documentName);
    }

    public void clearRegistered() {
        registeredDocuments.clear();
    }
}

@@ -1086,16 +1086,229 @@
 wizard%22)
+ %7B%0A            @Override%0A            public void onFinish() %7B%0A                info(%22Finished installing components. You might need to re-deploy you site.war due to new templates on disk.%22);%0A            %7D%0A        %7D
 ;%0A      

Add more informative message in case the components have been installed