try {
DataModel parent_model = parent_viewer.getDataModel();
// look for the associated model
Viewable model = parent_model.getViewableChild(getModelFieldName());
DataViewer viewer = null;
CFJTabbedPane tabbedPane = (CFJTabbedPane) parent_viewer.getJComponent();
if (viewerCreator == null) {
viewer = parent_viewer.getFactory().createViewer(model, parent_viewer.isEditor());
} else {
viewer = parent_viewer.getFactory().createViewer(viewerCreator, model);
}
// layout the associated model
viewer.setLayout(layout);
// create a JComponent from the associated viewer
JComponent comp = viewer.getJComponent();
int tabIndex = tabbedPane.indexOfTab(tabLabel);
if (tabIndex < 0) {
// have to create a new tab
tabbedPane.addTab(tabLabel, tabIcon, comp);
tabIndex = tabbedPane.getTabCount() - 1;
if (model instanceof DataModel) {
DataModel dataModel = (DataModel) model;
tabModelListeners.add(new TabModelListener(tabbedPane, tabIndex, dataModel));