All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.nakeduml.seamgeneration.page.SeamPageSource Maven / Gradle / Ivy

The newest version!
package net.sf.nakeduml.seamgeneration.page;

import java.util.List;

import net.sf.nakeduml.textmetamodel.TextSource;

import org.jboss.seam.navigation.Page;

public class SeamPageSource extends AbstractSeamPagesSource implements TextSource{
	
	private StringBuffer applicationPages = new StringBuffer();
	List exceptions;
	
	public SeamPageSource(Page page,List exceptions){
		super(page);
		this.exceptions = exceptions;
	}
	
	public StringBuffer getApplicationPages() {
		return applicationPages;
	}
	
	public void setApplicationPages(StringBuffer applicationPages) {
		this.applicationPages = applicationPages;
	}
	
	protected void startComposition(){
		stringBuilder.append("\n");
		stringBuilder.append("\n\n");
		
		stringBuilder.append("    \n\n");		
		
		stringBuilder.append("    \n");
	}
	protected void endComposition(){
		composeExceptions();
		stringBuilder.append("        \n");
		stringBuilder.append("            \n");
		stringBuilder.append("        \n");
		stringBuilder.append("        \n");
		stringBuilder.append("            \n");
		stringBuilder.append("                Unexpected error, please try again\n");
		stringBuilder.append("            \n");
		stringBuilder.append("        \n");
		stringBuilder.append("");
	}
	private void composeExceptions(){
		for(PagesException pagesException:exceptions){
			pagesException.addTo(stringBuilder, 2);
		}
	}
	public char[] toCharArray(){
		startComposition();
		outEvents();
		outActions();
		outBeginConversation();
		outEndConversation();
		outNavigations();
		outApplicationPageXml();
		stringBuilder.append("    \n");
		endComposition();
		return stringBuilder.toString().toCharArray();
	}
	
	private void outApplicationPageXml() {
		stringBuilder.append(applicationPages);
	}

	public boolean hasContent(){
		return true;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy