package hibergui.assoc;

import hibergui.Form;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

public abstract class O2MEdit_Button<T> extends O2MEdit<T, Set<T>> {

	public O2MEdit_Button(Form<?> form, Composite cptParent, int style, String prop, String name) {
		super(form, cptParent, style, prop, name);
	}
	
	@Override
	protected Control createContents(final Composite cptParent) {
        return createAssocDialogButton(cptParent);
	}

	@Override
	public void clear() {
	}
	
	@Override
	public void fill() {
	}

	@Override
	protected void setSelection(T[] value) {
		if (value == null)
			set(new HashSet<T>());
		else
			set(new HashSet<T>(Arrays.asList(value)));
	}	
}
