package com.exedio.copernica;

import java.util.Collection;
import java.util.Collections;

import com.exedio.cope.lib.Attribute;
import com.exedio.cope.lib.Item;
import com.exedio.cope.lib.Type;


public class TransientCopernicaProvider implements CopernicaProvider
{
	public Collection getDisplayLanguages()
	{
		return Collections.EMPTY_LIST;
	}
	
	public Collection getRootCategories()
	{
		return Collections.EMPTY_LIST;
	}
	
	public Collection getMainAttributes(final Type type)
	{
		return Collections.EMPTY_LIST;
	}

	public Collection getSections(final Type type)
	{
		return Collections.EMPTY_LIST;
	}
	
	public String getDisplayName(final com.exedio.copernica.Language displayLanguage, final Type type)
	{
		return type.getID();
	}

	public String getDisplayName(final com.exedio.copernica.Language displayLanguage, final Attribute attribute)
	{
		String name = attribute.getName();
		if(name.endsWith("Internal"))
			name = name.substring(0, name.length()-"Internal".length());

		final StringBuffer result = new StringBuffer(name.length());
		boolean wordStart = true;
		for(int i=0; i<name.length(); i++)
		{
			final char c = name.charAt(i);

			if(Character.isUpperCase(c))
			{
				if(!wordStart)
					result.append(' ');
				wordStart = true;
			}
			else
				wordStart = false;

			if(i==0)
				result.append(Character.toUpperCase(c));
			else
				result.append(c);
		}

		return result.toString();
	}
	
	public String getDisplayName(final com.exedio.copernica.Language displayLanguage, final Item item)
	{
		return item.toString();
	}
	
	public String getIconURL(final Type type)
	{
		return null;
	}

	public com.exedio.copernica.Language findLanguageByUniqueID(final String uniqueID)
	{
		return null;
	}
	
	public Category findCategoryByUniqueID(final String uniqueID)
	{
		return null;
	}
	
	public Section findSectionByUniqueID(final String uniqueID)
	{
		return null;
	}

	public void initializeExampleSystem()
	{
	}

}

@@ -618,376 +618,61 @@
 lic 
-String getDisplayName(final com.exedio.copernica.Language displayLanguage, final Type type)%0A%09%7B%0A%09%09return type.getID();%0A%09%7D%0A%0A%09public String getDisplayName(final com.exedio.copernica.Language displayLanguage, final Attribute attribute)%0A%09%7B%0A%09%09String name = attribute.getName();%0A%09%09if(name.endsWith(%22Internal%22))%0A%09%09%09name = name.subs
+static final String breakupName(final S
 tring
-(0,
  name
-.length()-%22Internal%22.length());%0A
+)%0A%09%7B
 %0A%09%09f
@@ -1066,17 +1066,16 @@
 c);%0A%09%09%7D%0A
-%0A
 %09%09return
@@ -1091,32 +1091,455 @@
 oString();%0A%09%7D%0A%09%0A
+%09public String getDisplayName(final com.exedio.copernica.Language displayLanguage, final Type type)%0A%09%7B%0A%09%09return breakupName(type.getID());%0A%09%7D%0A%0A%09public String getDisplayName(final com.exedio.copernica.Language displayLanguage, final Attribute attribute)%0A%09%7B%0A%09%09String name = attribute.getName();%0A%09%09if(name.endsWith(%22Internal%22))%0A%09%09%09name = name.substring(0, name.length()-%22Internal%22.length());%0A%0A%09%09return breakupName(name);%0A%09%7D%0A%09%0A
 %09public String g

make type names nicer