Search in sources :

Example 1 with CodeGeneratorController

use of org.apache.cayenne.modeler.editor.cgen.CodeGeneratorController 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();
        }
    });
}
Also used : JScrollPane(javax.swing.JScrollPane) DbImportTab(org.apache.cayenne.modeler.editor.dbimport.domain.DbImportTab) DbImportView(org.apache.cayenne.modeler.editor.dbimport.DbImportView) CodeGeneratorController(org.apache.cayenne.modeler.editor.cgen.CodeGeneratorController) CgenTab(org.apache.cayenne.modeler.editor.cgen.domain.CgenTab)

Aggregations

JScrollPane (javax.swing.JScrollPane)1 CodeGeneratorController (org.apache.cayenne.modeler.editor.cgen.CodeGeneratorController)1 CgenTab (org.apache.cayenne.modeler.editor.cgen.domain.CgenTab)1 DbImportView (org.apache.cayenne.modeler.editor.dbimport.DbImportView)1 DbImportTab (org.apache.cayenne.modeler.editor.dbimport.domain.DbImportTab)1