package pt.inm.smartgwt_tester.client;

import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.BkgndRepeat;
import com.smartgwt.client.widgets.Label;

public class Component extends Label {

	private final int widthComponent = 80;
	private final int heightComponent = 50;
	private final ComponentType type;
	
	public Component(int left, int top, ComponentType type) {
		this.type = type;
		
		setWidth(this.widthComponent);
		setHeight(this.heightComponent);
		setLeft(left);
		setTop(top);
		setContents(this.type.toString());
		setAlign(Alignment.CENTER);
		setPadding(4);

		setBackgroundImage(this.type.getBackground());
		setBackgroundRepeat(BkgndRepeat.NO_REPEAT);
	}
	
	public ComponentType getType() {
		return type;
	}
}
