package com.decker.Essentials.Category;

import java.awt.List;
import java.util.LinkedList;

import com.decker.Essentials.User.UserType;
import com.google.gson.Gson;

public class Category
{
    public static Category _Instance;

    public static Category getInstance()
    {
	if (_Instance == null)
	{
	    _Instance = new Category();
	}
	return _Instance;
    }

    public LinkedList<CategoryChild> AnonymousCategory;
    public LinkedList<CategoryChild> StudentCategory;
    public LinkedList<CategoryChild> TeacherCategory;
    public LinkedList<CategoryChild> AdministrarorCategory;

    private Category()
    {
	this.AnonymousCategory = new LinkedList<CategoryChild>();
	this.StudentCategory = new LinkedList<CategoryChild>();
	this.TeacherCategory = new LinkedList<CategoryChild>();
	this.AdministrarorCategory = new LinkedList<CategoryChild>();
    }

    public void addFunctionToCategory(UserType category, String iconName, String title, String url)
    {
	CategoryChild child = new CategoryChild(iconName, title, url);
	switch (category)
	{
	case Anonymous:
	    this.AnonymousCategory.add(child);
	    break;
	case Student:
	    this.AnonymousCategory.add(child);
	    break;
	case Teacher:
	    this.AnonymousCategory.add(child);
	    break;
	case SystemAdmin:
	    this.AnonymousCategory.add(child);
	    break;

	default:
	    break;
	}
    }

    public  String getJsonCategory(UserType type)
    {
	Gson serializator = new Gson();
	switch (type)
	{
	case Anonymous:
	    return serializator.toJson(_Instance.AnonymousCategory);

	case Student:
	    return serializator.toJson(_Instance.StudentCategory);

	case Teacher:
	    return serializator.toJson(_Instance.TeacherCategory);

	case SystemAdmin:
	    return serializator.toJson(_Instance.AdministrarorCategory);

	default:
	    return null;
	}

    }
}

@@ -881,16 +881,422 @@
 ld%3E();%0D%0A
+%09%0D%0A%09this.AnonymousCategory.add(new CategoryChild(%22icon-home%22, %22Homepage%22, %22Template/Homepage.html%22));%0D%0A%09this.StudentCategory.add(new CategoryChild(%22icon-home%22, %22Homepage%22, %22Template/Homepage.html%22));%0D%0A%09this.TeacherCategory.add(new CategoryChild(%22icon-home%22, %22Homepage%22, %22Template/Homepage.html%22));%0D%0A%09this.AdministrarorCategory.add(new CategoryChild(%22icon-home%22, %22Homepage%22, %22Template/Homepage.html%22));%0D%0A%09%0D%0A
     %7D%0D%0A%0D

Add defalut mainpage to each category