View Javadoc

1   /*
2    * Created on 20-Apr-2005
3    *
4    */
5   package org.bejug.javacareers.common.view.jsf.jsftab;
6   
7   import java.util.Iterator;
8   
9   import org.bejug.javacareers.jobs.view.jsf.util.Utils;
10  
11  import com.jsftab.model.Tab;
12  import com.jsftab.model.TabbedPanel;
13  
14  
15  
16  
17  /***
18   * This class inherits from TabbedPanel and ads some I18N to the TabbedPanel by using 
19   * inheritance the original jar remains unchanged. 
20   * This way you can update the jar without having to modify all changes made.
21   * @author Sven Schauwvliege (last modified by $Author: shally $)
22   * @version $Revision: 1.6 $ - $Date: 2005/12/20 15:36:46 $
23   */
24  public class TabbedPanelI18n extends TabbedPanel{
25  
26      /***
27       * default constructor
28       */
29      public TabbedPanelI18n(){
30  		
31  	}
32      
33  	/***
34  	 * @param configure is configure 
35  	 * @see com.jsftab.model.TabbedPanel#setConfigure(java.lang.String)
36  	 */
37  	public void setConfigure(String configure){
38  	    super.setConfigure(configure);
39  		Tab[] array = new Tab[tabs.size()];
40  		array = (Tab[]) tabs.toArray(array);
41  		for( Iterator itParent = tabs.iterator(); itParent.hasNext(); ){
42  		    Tab parent = (Tab)itParent.next();
43  		    String pname =getMessageIfMessage(parent.getName());	
44  		    parent.setName(pname);
45  		    for( Iterator itChild = parent.getChildren().iterator(); itChild.hasNext(); ){
46  		        Tab child = (Tab)itChild.next();
47  			    String cname =getMessageIfMessage(child.getName());	
48  			    child.setName(cname);
49  		    }
50  		}
51  	}
52  	
53      /***
54       * see if the message is a I18N key, if so return the value if not return the msg.
55       * @return Returns the message.
56       * @param msg the message
57       */
58      public  String getMessageIfMessage(String msg) {
59          String result = msg;
60  	    if (msg.startsWith("#{msgs.")){
61  	        result = msg.substring(7, msg.length()-1);
62  	        return Utils.getMessage(result);
63  	    }
64  	    return result;
65      }	
66  }
67  
68  /***
69   * $Log: TabbedPanelI18n.java,v $
70   * Revision 1.6  2005/12/20 15:36:46  shally
71   * CheckStyle and PMD changes.
72   *
73   * Revision 1.5  2005/09/13 08:11:06  schauwvliege
74   * organize imports
75   *
76   * Revision 1.4  2005/08/10 09:04:46  bavo_jcs
77   * Optimized imports according to checkstyle
78   *
79   * Revision 1.3  2005/08/09 12:59:54  bavo_jcs
80   * Optimized imports
81   *
82   * Revision 1.2  2005/06/14 12:05:54  schauwvliege
83   * CheckStyle and fixing tests
84   *
85   * Revision 1.1  2005/06/13 13:18:24  schauwvliege
86   * Added TabedPane
87   *
88   *
89   */