View Javadoc

1   /*
2    * Created on Jun 20, 2005
3    *
4    */
5   package org.musicontroller.gui.components;
6   
7   import org.apache.tapestry.BaseComponent;
8   import org.musicontroller.core.Keyword;
9   
10  /**
11   * A Component create navigation elements to a Keyword. At least one of the two
12   * parameters (keyword and keywordinfo) have to be set.
13   * @author Varienaja
14   */
15  public abstract class KeywordLink extends BaseComponent {
16  	public abstract Keyword getKeyword();
17  	public abstract void setKeyword(Keyword keyword);
18  
19  	public abstract Object[] getKeywordinfo();
20  	public abstract void setKeywordinfo(Object[] info);
21  
22  	/**
23  	 * @return The id of the Keyword we're linking to.
24  	 */
25  	public Long getKeywordid() {
26  		return getKeyword()==null ? (Long) getKeywordinfo()[0] : Long.valueOf(getKeyword().getId());
27  	}
28  	
29  	/**
30  	 * @return The name of the Keyword we're linking to.
31  	 */
32  	public String getKeywordname() {
33  		return getKeyword()==null ? (String) getKeywordinfo()[1] : getKeyword().getName();
34  	}
35  
36  }