View Javadoc

1   package org.musicontroller.gui;
2   
3   import java.util.List;
4   
5   import org.apache.tapestry.html.BasePage;
6   import org.musicontroller.security.User;
7   import org.musicontroller.service.McService;
8   
9   public abstract class Bands extends BasePage {
10  	
11  	public abstract McService getMcService();
12  	
13  	public abstract User getUser();
14  	
15  	public abstract Object[] getBandinfo();
16  	public abstract void setBandinfo(Object[] band);
17  
18  	public List<Object[]> getBands() {
19  		return getMcService().listBands(getUser());
20  	}
21  	
22  	public long getBandid() {
23  		return (Long) getBandinfo()[0];
24  	}
25  	
26  	public String getBandname() {
27  		return (String) getBandinfo()[1];
28  	}
29  	
30  	public String getFontsizeParam() {
31  		return getFontsize()+"px";
32  	}
33  	
34  	public String getTitle() {
35  		String result = getBandinfo()[2]+" play";
36  		return "1".equals(getBandinfo()[2]) ? result : result+"s";
37  	}
38  	
39  	/**
40  	 * @return A String varying from "1px" to "6px", depending on a discriminator-value.
41  	 */
42  	public int getFontsize() {
43  		long eventcount = (Long) getBandinfo()[2];
44  		int category=1;
45  		
46  		if (eventcount>8) category++;
47  		if (eventcount>16) category++;
48  		if (eventcount>32) category++;
49  		if (eventcount>64) category++;
50  		if (eventcount>128) category++;
51  		
52  		return category;
53  	}
54  
55  }