1 /* 2 * SSL-Explorer 3 * 4 * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public 16 * License along with this program; if not, write to the Free Software 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 */ 19 20 package com.sslexplorer.tabs; 21 22 /** 23 * Interface that supports that HTML <i>Tab Component</i>. If you wish a form 24 * to be 'tabbable', you should implement this interface. 25 * <p> 26 * The displayed tab titles by default are retrieved from resource bundles by 27 * using the bundle and resource prefix specified in the <tabSet> tag 28 * suffixed by the value returned from {@link #getTabName(int)} and <b>.title</b>. 29 * <p> 30 * If you wish to return a hard coded title, return a <code>non-null</code> 31 * value from {@link #getTabTitle(int)}. This will override the use of 32 * resources. 33 * 34 * @author Brett Smith <a HREF="mailto: brett@3sp.com"><brett@3sp.com></a> 35 * @see com.sslexplorer.tabs.tags.TabHeadingsTag 36 * @see com.sslexplorer.tabs.tags.TabSetTag 37 * @see com.sslexplorer.tabs.tags.TabTag 38 */ 39 public interface TabModel { 40 41 /** 42 * Get the number of tabs to display 43 * 44 * @return tab count 45 */ 46 public int getTabCount(); 47 48 /** 49 * Get the name of the tab. This is used together with the the bundle 50 * specified in the <tabSet> tag to determine the title from 51 * resources. 52 * <p> 53 * It is also used in the CSS and Javascript to identify each tab and will 54 * be the the value used for selected tab so <strong> must not</strong> 55 * contain spaces (best to use lowerCamelCase). 56 * 57 * @param idx index of tab 58 * @return tab name 59 */ 60 public String getTabName(int idx); 61 62 /** 63 * Get the selected tab <b>name</i>. 64 * 65 * @return selected tab name 66 * @see #getTabName(int) 67 */ 68 public String getSelectedTab(); 69 70 /** 71 * Set the selected tab <b>name</i>. 72 * 73 * @param selectedTab selected tab name 74 * @see #getTabName(int) 75 */ 76 public void setSelectedTab(String selectedTab); 77 78 /** 79 * If you wish to return a hard coded title, return a <code>non-null</code> 80 * value here. This will override the use of resources. Return <code>null</code> 81 * to get the tab title from resources. 82 * 83 * @param idx index of tab 84 * @return tab title 85 */ 86 public String getTabTitle(int idx); 87 88 /** 89 * Return an alternative bundle to use for tab title message resources. 90 * This is useful when tabs are added by plugins. <code>null</code> 91 * will be returned if there is no alternative bundle and the default 92 * one provided in the JSP should be used. 93 * 94 * @param idx tab index 95 * @return alternative bundle 96 */ 97 public String getTabBundle(int idx); 98 } 99