package com.github.aureliano.edocs.app.helper;

import java.net.URL;

import javax.swing.Icon;
import javax.swing.ImageIcon;

public final class GuiHelper {

	private GuiHelper() {}
	
	public static Icon createIcon(String resource) {
		URL url = ClassLoader.getSystemResource(resource);
		return new ImageIcon(url);
	}
}
@@ -41,16 +41,43 @@
 elper;%0A%0A
+import java.awt.Component;%0A
 import j
@@ -150,196 +150,2105 @@
 n;%0A%0A
-public final class GuiHelper %7B%0A%0A%09private GuiHelper() %7B%7D%0A%09%0A%09public static Icon createIcon(String resource) %7B%0A%09%09URL url = ClassLoader.getSystemResource(resource);%0A%09%09return new ImageIcon(url)
+import com.github.aureliano.edocs.app.gui.configuration.wizard.DatabasePanel;%0Aimport com.github.aureliano.edocs.app.gui.configuration.wizard.RepositoryPanel;%0Aimport com.github.aureliano.edocs.app.gui.configuration.wizard.SecurePanel;%0Aimport com.github.aureliano.edocs.common.config.AppConfiguration;%0Aimport com.github.aureliano.edocs.common.config.DatabaseConfiguration;%0Aimport com.github.aureliano.edocs.common.config.FileRepositoryConfiguration;%0Aimport com.github.aureliano.edocs.common.config.SecureConfiguration;%0Aimport com.github.aureliano.edocs.common.exception.EDocsException;%0A%0Apublic final class GuiHelper %7B%0A%0A%09private GuiHelper() %7B%7D%0A%09%0A%09public static Icon createIcon(String resource) %7B%0A%09%09URL url = ClassLoader.getSystemResource(resource);%0A%09%09return new ImageIcon(url);%0A%09%7D%0A%09%0A%09public static AppConfiguration buildConfigurationFromWizard(Component%5B%5D components) %7B%0A%09%09SecureConfiguration secure = new SecureConfiguration();%0A%09%09DatabaseConfiguration database = new DatabaseConfiguration();%0A%09%09FileRepositoryConfiguration repo = new FileRepositoryConfiguration();%0A%09%09%0A%09%09AppConfiguration configuration = new AppConfiguration()%0A%09%09%09.withSecureConfiguration(secure)%0A%09%09%09.withDatabaseConfiguration(database)%0A%09%09%09.withFileRepositoryConfiguration(repo);%0A%09%09%0A%09%09for (Component c : components) %7B%0A%09%09%09if (c instanceof SecurePanel) %7B%0A%09%09%09%09SecurePanel panel = (SecurePanel) c;%0A%09%09%09%09secure%0A%09%09%09%09%09.withAlgorithm(panel.getAlgorithm().name())%0A%09%09%09%09%09.withSalt(panel.getSalt())%0A%09%09%09%09%09.withHashIterations(panel.getHashIterations());%0A%09%09%09%7D else if (c instanceof DatabasePanel) %7B%0A%09%09%09%09DatabasePanel panel = (DatabasePanel) c;%0A%09%09%09%09database%0A%09%09%09%09%09.withUser(panel.getUserName())%0A%09%09%09%09%09.withPassword(panel.getPassword());%0A%09%09%09%7D else if (c instanceof RepositoryPanel) %7B%0A%09%09%09%09RepositoryPanel panel = (RepositoryPanel) c;%0A%09%09%09%09repo%0A%09%09%09%09%09.withRepositoryType(panel.getRepositoryType().name())%0A%09%09%09%09%09.withRootPath(panel.getRepositoryFile().getAbsolutePath())%0A%09%09%09%09%09.withLimboPath(panel.getLimboFile().getAbsolutePath());%0A%09%09%09%7D else %7B%0A%09%09%09%09throw new EDocsException(%22Unknown panel card type: %22 + c.getClass().getName());%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09return configuration
 ;%0A%09%7D

Add method to build configuration model from wizard.