package com.gitplex.server.web.page.admin;

import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;

import com.gitplex.server.web.component.link.ViewStateAwarePageLink;

@SuppressWarnings("serial")
public class AdministrationTabLink extends Panel {

	private final AdministrationTab tab;
	
	public AdministrationTabLink(String id, AdministrationTab tab) {
		super(id);
		
		this.tab = tab;
	}

	@Override
	protected void onInitialize() {
		super.onInitialize();
		
		Link<Void> link = new ViewStateAwarePageLink<Void>("link", tab.getMainPageClass());
		link.add(new WebMarkupContainer("icon").add(AttributeAppender.append("class", tab.getIconClass())));
		link.add(new Label("label", tab.getTitleModel()));
		add(link);
	}

}
