use of org.apache.cayenne.modeler.editor.dbimport.domain.DbImportTab in project cayenne by apache.
the class DataMapTabbedView method initView.
/**
* create tabs
*/
private void initView() {
setTabPlacement(JTabbedPane.TOP);
// add panels to tabs
// note that those panels that have no internal scrollable tables
// must be wrapped in a scroll pane
JScrollPane dataMapScrollPane = new JScrollPane(new DataMapView(mediator));
dbImportView = new DbImportView(mediator);
dbImportScrollPane = new JScrollPane(dbImportView);
codeGeneratorController = new CodeGeneratorController(mediator);
cgenView = new JScrollPane(codeGeneratorController.getView());
addTab("DataMap", dataMapScrollPane);
addTab("DB Import", dbImportScrollPane);
addTab("Class Generation", cgenView);
addChangeListener(tab -> {
if (isCgenTabActive()) {
codeGeneratorController.initFromModel();
} else if (isDbImportTabActive()) {
dbImportView.initFromModel();
}
});
mediator.addDataMapDisplayListener(e -> {
if (e.getSource() instanceof CgenTab) {
setSelectedComponent(cgenView);
} else if (e.getSource() instanceof DbImportTab) {
setSelectedComponent(dbImportScrollPane);
} else if (isCgenTabActive() || isDbImportTabActive()) {
fireStateChanged();
}
});
}
Aggregations