// Path: src/main/java/es/upm/fi/dia/oeg/map4rdf/client/widget/event/FacetValueSelectionChangedEvent.java
// public class FacetValueSelectionChangedEvent extends GwtEvent<FacetValueSelectionChangedHandler> {
// 
// 	private static GwtEvent.Type<FacetValueSelectionChangedHandler> TYPE;
// 
// 	public static GwtEvent.Type<FacetValueSelectionChangedHandler> getType() {
// 		if (TYPE == null) {
// 			TYPE = new Type<FacetValueSelectionChangedHandler>();
// 		}
// 		return TYPE;
// 	}
// 
// 	private final String selectionOptionId;
// 	private final boolean selectionValue;
// 
// 	public FacetValueSelectionChangedEvent(String selectionOptionId, boolean selectionValue) {
// 		super();
// 		this.selectionOptionId = selectionOptionId;
// 		this.selectionValue = selectionValue;
// 	}
// 
// 	public String getSelectionOptionId() {
// 		return selectionOptionId;
// 	}
// 
// 	public boolean getSelectionValue() {
// 		return selectionValue;
// 	}
// 
// 	@Override
// 	protected void dispatch(FacetValueSelectionChangedHandler handler) {
// 		handler.onSelectionChanged(this);
// 	}
// 
// 	@Override
// 	public GwtEvent.Type<FacetValueSelectionChangedHandler> getAssociatedType() {
// 		return getType();
// 	}
// 
// }


import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.ResizeComposite;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Widget;
import es.upm.fi.dia.oeg.map4rdf.client.widget.event.FacetValueSelectionChangedEvent;
import es.upm.fi.dia.oeg.map4rdf.client.widget.event.FacetValueSelectionChangedHandler;
import es.upm.fi.dia.oeg.map4rdf.client.widget.event.HasFacetValueSelectionChangedHandler;
		});
		if (stylesheet != null) {
			checkBox.addStyleName(stylesheet.facetSelectionOption());
		}
		selectionOptions.put(id, checkBox);
		selectionsPanel.add(checkBox);
	}

	public void sort() {
		selectionsPanel.clear();
		for (CheckBox cb : getSortedSelections()) {
			selectionsPanel.add(cb);
		}
	}

	public void setStylesheet(Stylesheet stylesheet) {
		this.stylesheet = stylesheet;
		applyStylesheet(stylesheet);
	}

	public void applyStylesheet(Stylesheet stylesheet) {
		addStyleName(stylesheet.facet());
		label.addStyleName(stylesheet.facetHeader());
		for (Map.Entry<String, CheckBox> selectionOption : selectionOptions.entrySet()) {
			selectionOption.getValue().addStyleDependentName(stylesheet.facetSelectionOption());
		}
	}

	@Override
	public void addFacetValueSelectionChangedHandler(FacetValueSelectionChangedHandler handler) {
// Path: src/main/java/es/upm/fi/dia/oeg/map4rdf/client/widget/event/FacetValueSelectionChangedEvent.java
// public class FacetValueSelectionChangedEvent extends GwtEvent<FacetValueSelectionChangedHandler> {
// 
// 	private static GwtEvent.Type<FacetValueSelectionChangedHandler> TYPE;
// 
// 	public static GwtEvent.Type<FacetValueSelectionChangedHandler> getType() {
// 		if (TYPE == null) {
// 			TYPE = new Type<FacetValueSelectionChangedHandler>();
// 		}
// 		return TYPE;
// 	}
// 
// 	private final String selectionOptionId;
// 	private final boolean selectionValue;
// 
// 	public FacetValueSelectionChangedEvent(String selectionOptionId, boolean selectionValue) {
// 		super();
// 		this.selectionOptionId = selectionOptionId;
// 		this.selectionValue = selectionValue;
// 	}
// 
// 	public String getSelectionOptionId() {
// 		return selectionOptionId;
// 	}
// 
// 	public boolean getSelectionValue() {
// 		return selectionValue;
// 	}
// 
// 	@Override
// 	protected void dispatch(FacetValueSelectionChangedHandler handler) {
// 		handler.onSelectionChanged(this);
// 	}
// 
// 	@Override
// 	public GwtEvent.Type<FacetValueSelectionChangedHandler> getAssociatedType() {
// 		return getType();
// 	}
// 
// }


// Path: src/main/java/es/upm/fi/dia/oeg/map4rdf/client/widget/FacetWidget.java
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.ResizeComposite;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Widget;
import es.upm.fi.dia.oeg.map4rdf.client.widget.event.FacetValueSelectionChangedEvent;
import es.upm.fi.dia.oeg.map4rdf.client.widget.event.FacetValueSelectionChangedHandler;
import es.upm.fi.dia.oeg.map4rdf.client.widget.event.HasFacetValueSelectionChangedHandler;

		});
		if (stylesheet != null) {
			checkBox.addStyleName(stylesheet.facetSelectionOption());
		}
		selectionOptions.put(id, checkBox);
		selectionsPanel.add(checkBox);
	}

	public void sort() {
		selectionsPanel.clear();
		for (CheckBox cb : getSortedSelections()) {
			selectionsPanel.add(cb);
		}
	}

	public void setStylesheet(Stylesheet stylesheet) {
		this.stylesheet = stylesheet;
		applyStylesheet(stylesheet);
	}

	public void applyStylesheet(Stylesheet stylesheet) {
		addStyleName(stylesheet.facet());
		label.addStyleName(stylesheet.facetHeader());
		for (Map.Entry<String, CheckBox> selectionOption : selectionOptions.entrySet()) {
			selectionOption.getValue().addStyleDependentName(stylesheet.facetSelectionOption());
		}
	}

	@Override
	public void addFacetValueSelectionChangedHandler(FacetValueSelectionChangedHandler handler) {
		addHandler(handler, FacetValueSelectionChangedEvent.getType());