/*
* Created on 26.4.2004
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package is.idega.idegaweb.golf.tournament.presentation;
import is.idega.idegaweb.golf.tournament.business.TournamentSession;
import com.idega.business.IBOLookup;
import com.idega.business.IBOLookupException;
import com.idega.business.IBORuntimeException;
import com.idega.presentation.IWContext;
import com.idega.presentation.text.Text;
/**
* @author laddi
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class TournamentName extends Text {
/**
* Creates a new <code>SchoolNameText</code>.
*/
public TournamentName() {
super();
}
/**
* @see com.idega.presentation.PresentationObject#main(IWContext)
*/
public void main(IWContext iwc) throws Exception {
int schoolID = getTournamentSession(iwc).getTournamentID();
if (schoolID != -1) {
String tournamentName = getTournamentSession(iwc).getTournament().getName();
setText(tournamentName);
}
else {
setText("");
}
}
private TournamentSession getTournamentSession(IWContext iwc) {
try {
return (TournamentSession) IBOLookup.getSessionInstance(iwc, TournamentSession.class);
}
catch (IBOLookupException ile) {
throw new IBORuntimeException(ile);
}
}
}