Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /
 package org.apache.cayenne.modeler.dialog.objentity;
 import  org.scopemvc.controller.basic.BasicController;
 import  org.scopemvc.core.Control;
 import  org.scopemvc.core.ControlException;

Andrei Adamchik
 public class ObjRelationshipInfoController extends BasicController {
     static final Logger logObj = Logger.getLogger(ObjRelationshipInfoController.class);
     public static final String SAVE_CONTROL = "";
     public static final String CANCEL_CONTROL = "cayenne.modeler.mapObjRelationship.cancel.button";
     public static final String NEW_TOONE_CONTROL = "cayenne.modeler.mapObjRelationship.newtoone.button";
     public static final String NEW_TOMANY_CONTROL = "cayenne.modeler.mapObjRelationship.newtomany.button";
     protected ProjectController mediator;
             ObjRelationship relationship) {
         this. = mediator;
         Collection objEntities = mediator.getCurrentDataMap().getNamespace().getObjEntities();
         ObjRelationshipInfoModel model = new ObjRelationshipInfoModel(

Creates and runs the classpath dialog.
     public void startup() {
         setView(new ObjRelationshipInfoDialog());
     protected void doHandleControl(Control controlthrows ControlException {
         if (control.matchesID()) {
         else if (control.matchesID()) {
         else if (control.matchesID()) {
         else if (control.matchesID()) {
     protected void saveMapping() {
         if (model.savePath()) {
             .fireObjRelationshipEvent(new RelationshipEvent(Application
                     .getFrame(), model.getRelationship(), model

Creates a new relationship connecting currently selected source entity with ObjRelationship target entity. User is allowed to edit the relationship, change its name, and create joins.
    protected void createRelationship(boolean toMany) {
        DbEntity source = model.getStartEntity();
        DbEntity target = model.getEndEntity();
        EntityRelationshipsModel selectedPathComponent = model.getSelectedPathComponent();
        if (selectedPathComponent != null) {
            source = (DbEntityselectedPathComponent.getSourceEntity();
        DbRelationship dbRelationship = (DbRelationship) NamedObjectFactory
        // note: NamedObjectFactory doesn't set source or target, just the name
        // TODO: creating relationship outside of ResolveDbRelationshipDialog confuses it
        // to send incorrect event - CHANGE instead of ADD
        if (dialog.isCancelPressed()) {
        else {
            if (selectedPathComponent == null) {
                selectedPathComponent = (EntityRelationshipsModelmodel
    protected void cancelEditing() {
New to GrepCode? Check out our FAQ X