|
Example of Tabbed Panel Data Model |
|
package testingapplication.tabbedPanel;
import com.softaspects.jsf.component.label.model.LabelModel;
import com.softaspects.jsf.component.label.model.LabelModelImpl;
import com.softaspects.jsf.component.listmodel.ListDataModelImpl;
import com.softaspects.jsf.component.tabbedPanel.TabbedPanelDataModel;
import com.softaspects.framework.galileo.support.util.Validation;
import java.util.Collection;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* Title: TabbedPanelDataModelBean
* Description: Data Model bean for tabbedpanel component sample
*/
public class TabbedPanelDataModelBean extends TabbedPanelDataModel {
private static final String IMAGES_PATH = "images/tabbedPanel/large/";
private static final String SMALL_IMAGES_PATH = "images/tabbedPanel/large/";
/**
* Constructor - assemble the model
*/
public TabbedPanelDataModelBean() {
addValue(createFirstTab());
addValue(createSecondTab());
addValue(createThirdTab());
addValue(createFourthTab());
addValue(createFifthTab());
}
/**
* Create first tab for the TabbedPanel
*
*/
private LabelModel createFirstTab() {
LabelModelImpl tab = new LabelModelImpl();
tab.setText("Home");
tab.setHintText("Go to home");
//Standard image
tab.setDefaultImage(new StringBuffer(IMAGES_PATH).append("folder_closed.gif").toString());
tab.setDefaultSmallImage(new StringBuffer(SMALL_IMAGES_PATH).append("folder_closed.gif").toString());
//Highlighted image
tab.setHightLightImage(new StringBuffer(IMAGES_PATH).append("folder.gif").toString());
tab.setHightLightSmallImage(new StringBuffer(SMALL_IMAGES_PATH).append("folder.gif").toString());
//Rollover image
tab.setActiveImage(new StringBuffer(IMAGES_PATH).append("folder.gif").toString());
tab.setActiveSmallImage(new StringBuffer(SMALL_IMAGES_PATH).append("folder.gif").toString());
return tab;
}
/**
* Create second tab for the TabbedPanel
*
*/
private LabelModel createSecondTab() {
LabelModelImpl tab = new LabelModelImpl();
tab.setText("Products");
tab.setHintText("Offered products");
tab.setDefaultImage(new StringBuffer(IMAGES_PATH).append("workplace.gif").toString());
tab.setDefaultSmallImage(new StringBuffer(SMALL_IMAGES_PATH).append("workplace.gif").toString());
tab.setHightLightImage(new StringBuffer(IMAGES_PATH).append("workplace2.gif").toString());
tab.setHightLightSmallImage(new StringBuffer(SMALL_IMAGES_PATH).append("workplace2.gif").toString());
tab.setActiveImage(new StringBuffer(IMAGES_PATH).append("workplace2.gif").toString());
tab.setActiveSmallImage(new StringBuffer(SMALL_IMAGES_PATH).append("workplace2.gif").toString());
return tab;
}
/**
* Create third tab for the TabbedPanel
*
*/
private LabelModel createThirdTab() {
LabelModelImpl tab = new LabelModelImpl();
tab.setText("Consulting");
tab.setHintText("Offered services");
tab.setDefaultImage(new StringBuffer(IMAGES_PATH).append("book_blue.gif").toString());
tab.setDefaultSmallImage(new StringBuffer(SMALL_IMAGES_PATH).append("book_blue.gif").toString());
tab.setHightLightImage(new StringBuffer(IMAGES_PATH).append("book_open.gif").toString());
tab.setHightLightSmallImage(new StringBuffer(SMALL_IMAGES_PATH).append("book_open.gif").toString());
tab.setActiveImage(new StringBuffer(IMAGES_PATH).append("book_open.gif").toString());
tab.setActiveSmallImage(new StringBuffer(SMALL_IMAGES_PATH).append("book_open.gif").toString());
return tab;
}
/**
* Create fourth tab for the TabbedPanel
*
*/
private LabelModel createFourthTab() {
LabelModelImpl tab = new LabelModelImpl();
tab.setText("Company");
tab.setHintText("Company info");
tab.setDefaultImage(new StringBuffer(IMAGES_PATH).append("document_info.gif").toString());
tab.setDefaultSmallImage(new StringBuffer(SMALL_IMAGES_PATH).append("document_info.gif").toString());
tab.setHightLightImage(new StringBuffer(IMAGES_PATH).append("document.gif").toString());
tab.setHightLightSmallImage(new StringBuffer(SMALL_IMAGES_PATH).append("document.gif").toString());
tab.setActiveImage(new StringBuffer(IMAGES_PATH).append("document.gif").toString());
tab.setActiveSmallImage(new StringBuffer(SMALL_IMAGES_PATH).append("document.gif").toString());
return tab;
}
/**
* Create fifth tab for the TabbedPanel
*
*/
private LabelModel createFifthTab() {
LabelModelImpl tab = new LabelModelImpl();
tab.setText("Buy");
tab.setHintText("Buy the products");
tab.setDefaultImage(new StringBuffer(IMAGES_PATH).append("currency_dollar.gif").toString());
tab.setDefaultSmallImage(new StringBuffer(SMALL_IMAGES_PATH).append("currency_dollar.gif").toString());
tab.setHightLightImage(new StringBuffer(IMAGES_PATH).append("moneybag_dollar.gif").toString());
tab.setHightLightSmallImage(new StringBuffer(SMALL_IMAGES_PATH).append("moneybag_dollar.gif").toString());
tab.setActiveImage(new StringBuffer(IMAGES_PATH).append("moneybag_dollar.gif").toString());
tab.setActiveSmallImage(new StringBuffer(SMALL_IMAGES_PATH).append("moneybag_dollar.gif").toString());
return tab;
}
}