package ttworkbench.play.parameters.ipv6;

import java.util.Set;

import ttworkbench.play.parameters.ipv6.editors.DefaultEditor;
import ttworkbench.play.parameters.ipv6.widgets.DefaultWidget;
import ttworkbench.play.parameters.ipv6.widgets.IPv6Widget;

import com.testingtech.ttworkbench.ttman.parameters.api.IConfigurationComposer;
import com.testingtech.ttworkbench.ttman.parameters.api.IConfigurator;
import com.testingtech.ttworkbench.ttman.parameters.api.IParameter;
import com.testingtech.ttworkbench.ttman.parameters.api.IWidget;

public class IPv6ConfigurationComposer implements IConfigurationComposer {

	private static IWidget createAndComposeDefaultWidget( IConfigurator theConfigurator) {
		IWidget defaultWidget = new DefaultWidget();
		theConfigurator.addWidget( defaultWidget);
		
		// TODO: replace demo composition 
		Set<IParameter> parameters = theConfigurator.getParameterModel().getParameters();
		for (IParameter parameter : parameters) {
			theConfigurator.assign( new DefaultEditor(), parameter, defaultWidget);	
		}
		
		return defaultWidget;
	}
	
	
	private static IWidget createAndComposeIPv6Widget( IConfigurator theConfigurator) {
	  return new IPv6Widget();
	}
	
	@Override
	public void createWidgets(IConfigurator theConfigurator) {
		// first added widget will be set automatically as default widget.
		createAndComposeDefaultWidget( theConfigurator);
		createAndComposeIPv6Widget( theConfigurator);
		
		
	}

}

@@ -615,39 +615,36 @@
 %09private static 
-IWidget
+void
  createAndCompos
@@ -1036,35 +1036,8 @@
 %09%09%7D%0A
-%09%09%0A%09%09return defaultWidget;%0A
 %09%7D%0A%09
@@ -1055,23 +1055,20 @@
  static 
-IWidget
+void
  createA
@@ -1126,34 +1126,92 @@
  %7B%0A%09
-  return new IPv6Widget();
+%09IWidget IPv6Widget = new IPv6Widget();%0A%09%09theConfigurator.addWidget( IPv6Widget);%0A%09%09
 %0A%09%7D%0A

fix lost IPv6 tab widget