Examples of CayenneModelerController


Examples of org.apache.cayenne.modeler.CayenneModelerController

            return;
        }

        boolean isNew = project.isLocationUndefined();

        CayenneModelerController controller = getApplication().getFrameController();

        // close ... don't use OpenProjectAction close method as it will ask for save, we
        // don't want that here
        controller.projectClosedAction();

        // reopen existing
        if (!isNew && project.getMainFile().isFile()) {
            OpenProjectAction openAction = (OpenProjectAction) controller
                    .getApplication()
                    .getAction(OpenProjectAction.getActionName());
            openAction.openProject(project.getMainFile());
        }
        // create new
        else if (!(project instanceof ApplicationProject)) {
            throw new CayenneRuntimeException("Only ApplicationProjects are supported.");
        }
        else {
            controller
                    .getApplication()
                    .getAction(NewProjectAction.getActionName())
                    .performAction(e);
        }
    }
View Full Code Here

Examples of org.apache.cayenne.modeler.CayenneModelerController

        return KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
    }

    public void performAction(ActionEvent e) {

        CayenneModelerController controller = Application
                .getInstance()
                .getFrameController();
        // Save and close (if needed) currently open project.
        if (getCurrentProject() != null && !closeProject(true)) {
            return;
        }

        Configuration config = buildProjectConfiguration(null);
        Project project = new ApplicationProject(null, config);

        // stick a DataDomain
        DataDomain domain = (DataDomain) NamedObjectFactory.createObject(
                DataDomain.class,
                config);
        domain.getEntityResolver().setIndexedByClass(false);
        config.addDomain(domain);

        controller.projectOpenedAction(project);

        // select default domain
        getProjectController().fireDomainDisplayEvent(
                new DomainDisplayEvent(this, domain));
    }
View Full Code Here

Examples of org.apache.cayenne.modeler.CayenneModelerController

        if (checkUnsaved && !checkSaveOnClose()) {
            return false;
        }

        CayenneModelerController controller = Application
                .getInstance()
                .getFrameController();
        controller.projectClosedAction();

        return true;
    }
View Full Code Here

Examples of org.apache.cayenne.modeler.CayenneModelerController

        builder.bindToAction(view.getSyncWithLocal(), "syncDataSourceAction()");

    }

    public void syncDataSourceAction() {
        CayenneModelerController mainController = getApplication().getFrameController();

        if (getNode() == null || getNode().getDataSource() == null) {
            return;
        }

        ProjectDataSource projectDS = (ProjectDataSource) getNode().getDataSource();

        ProjectController parent = (ProjectController) getParent();
        String key = parent.getDataNodePreferences().getLocalDataSource();
        if (key == null) {
            mainController.updateStatus("No Local DataSource selected for node...");
            return;
        }

        DBConnectionInfo dataSource = (DBConnectionInfo) parent
                .getApplicationPreferenceDomain()
                .getDetail(key, DBConnectionInfo.class, false);

        if (dataSource != null) {
            if (dataSource.copyTo(projectDS.getDataSourceInfo())) {
                refreshView();
                super.nodeChangeProcessor.modelUpdated(null, null, null);
                mainController.updateStatus(null);
            }
            else {
                mainController.updateStatus("DataNode is up to date...");
            }
        }
        else {
            mainController.updateStatus("Invalid Local DataSource selected for node...");
        }
    }
View Full Code Here

Examples of org.apache.cayenne.modeler.CayenneModelerController

     * password fields depending on the option that was selected.
     */


    public void syncDataSourceAction() {
        CayenneModelerController mainController = getApplication().getFrameController();

        if (getNode() == null || getNode().getDataSourceDescriptor() == null) {
            return;
        }

        DataSourceInfo projectDSI = getNode().getDataSourceDescriptor();

        ProjectController parent = (ProjectController) getParent();
        String key = parent.getDataNodePreferences().getLocalDataSource();
        if (key == null) {
            mainController.updateStatus("No Local DataSource selected for node...");
            return;
        }

        DBConnectionInfo dataSource = (DBConnectionInfo) getApplication()
            .getCayenneProjectPreferences()
            .getDetailObject(DBConnectionInfo.class)
            .getObject(key);

        if (dataSource != null) {
            if (dataSource.copyTo(projectDSI)) {
                refreshView();
                super.nodeChangeProcessor.modelUpdated(null, null, null);
                mainController.updateStatus(null);
            }
            else {
                mainController.updateStatus("DataNode is up to date...");
            }
        }
        else {
            mainController.updateStatus("Invalid Local DataSource selected for node...");
        }
    }
View Full Code Here

Examples of org.apache.cayenne.modeler.CayenneModelerController

     * password fields depending on the option that was selected.
     */


    public void syncDataSourceAction() {
        CayenneModelerController mainController = getApplication().getFrameController();

        if (getNode() == null || getNode().getDataSource() == null) {
            return;
        }

        ProjectDataSource projectDS = (ProjectDataSource) getNode().getDataSource();

        ProjectController parent = (ProjectController) getParent();
        String key = parent.getDataNodePreferences().getLocalDataSource();
        if (key == null) {
            mainController.updateStatus("No Local DataSource selected for node...");
            return;
        }

        DBConnectionInfo dataSource = (DBConnectionInfo) parent
                .getApplicationPreferenceDomain()
                .getDetail(key, DBConnectionInfo.class, false);

        if (dataSource != null) {
            if (dataSource.copyTo(projectDS.getDataSourceInfo())) {
                refreshView();
                super.nodeChangeProcessor.modelUpdated(null, null, null);
                mainController.updateStatus(null);
            }
            else {
                mainController.updateStatus("DataNode is up to date...");
            }
        }
        else {
            mainController.updateStatus("Invalid Local DataSource selected for node...");
        }
    }
View Full Code Here

Examples of org.apache.cayenne.modeler.CayenneModelerController

            return;
        }

        boolean isNew = project.isLocationUndefined();

        CayenneModelerController controller = getApplication().getFrameController();

        // close ... don't use OpenProjectAction close method as it will ask for save, we
        // don't want that here
        controller.projectClosedAction();

        // reopen existing
        if (!isNew && project.getMainFile().isFile()) {
            OpenProjectAction openAction = (OpenProjectAction) controller
                    .getApplication()
                    .getAction(OpenProjectAction.getActionName());
            openAction.openProject(project.getMainFile());
        }
        // create new
        else if (!(project instanceof ApplicationProject)) {
            throw new CayenneRuntimeException("Only ApplicationProjects are supported.");
        }
        else {
            controller
                    .getApplication()
                    .getAction(NewProjectAction.getActionName())
                    .performAction(e);
        }
       
View Full Code Here

Examples of org.apache.cayenne.modeler.CayenneModelerController

        return KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
    }

    public void performAction(ActionEvent e) {

        CayenneModelerController controller = Application
                .getInstance()
                .getFrameController();
        // Save and close (if needed) currently open project.
        if (getCurrentProject() != null && !closeProject(true)) {
            return;
        }

        Configuration config = buildProjectConfiguration(null);
        Project project = new ApplicationProject(null, config);

        // stick a DataDomain
        DataDomain domain = (DataDomain) NamedObjectFactory.createObject(
                DataDomain.class,
                config);
        domain.getEntityResolver().setIndexedByClass(false);
        config.addDomain(domain);

        controller.projectOpenedAction(project);

        // select default domain
        getProjectController().fireDomainDisplayEvent(
                new DomainDisplayEvent(this, domain));
    }
View Full Code Here

Examples of org.apache.cayenne.modeler.CayenneModelerController

        if (checkUnsaved && !checkSaveOnClose()) {
            return false;
        }

        CayenneModelerController controller = Application
                .getInstance()
                .getFrameController();
       
        application.getUndoManager().discardAllEdits();
       
        controller.projectClosedAction();

        return true;
    }
View Full Code Here

Examples of org.apache.cayenne.modeler.CayenneModelerController

        if (checkUnsaved && !checkSaveOnClose()) {
            return false;
        }

        CayenneModelerController controller = Application
                .getInstance()
                .getFrameController();

        application.getUndoManager().discardAllEdits();

        controller.projectClosedAction();

        return true;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.