Examples of RelationshipEvent


Examples of org.apache.cayenne.map.event.RelationshipEvent

    /**
     * @deprecated since 3.0 - unused.
     */
    protected void firePropertyDidChange() {
        RelationshipEvent event = new RelationshipEvent(this, this, this
                .getSourceEntity());
        EventManager.getDefaultManager().postEvent(event, PROPERTY_DID_CHANGE);
    }
View Full Code Here

Examples of org.apache.cayenne.map.event.RelationshipEvent

                selectPath();
            }
        }

        if (savePath()) {
            mediator.fireObjRelationshipEvent(new RelationshipEvent(Application
                    .getFrame(), getRelationship(), getRelationship()
                    .getSourceEntity()));
        }
        view.sourceEntityLabel.setText(relationship.getSourceEntity().getName());
        view.dispose();
View Full Code Here

Examples of org.apache.cayenne.map.event.RelationshipEvent

    /**
     * @deprecated since 3.0 - unused.
     */
    protected void firePropertyDidChange() {
        RelationshipEvent event = new RelationshipEvent(this, this, this
                .getSourceEntity());
        EventManager.getDefaultManager().postEvent(event, PROPERTY_DID_CHANGE);
    }
View Full Code Here

Examples of org.apache.cayenne.map.event.RelationshipEvent

    /**
     * @deprecated since 3.0 - unused.
     */
    protected void firePropertyDidChange() {
        RelationshipEvent event = new RelationshipEvent(this, this, this
                .getSourceEntity());
        EventManager.getDefaultManager().postEvent(event, PROPERTY_DID_CHANGE);
    }
View Full Code Here

Examples of org.apache.cayenne.map.event.RelationshipEvent

            this.firePropertyDidChange();
        }
    }

    protected void firePropertyDidChange() {
        RelationshipEvent event = new RelationshipEvent(this, this, this
                .getSourceEntity());
        EventManager.getDefaultManager().postEvent(event, PROPERTY_DID_CHANGE);
    }
View Full Code Here

Examples of org.apache.cayenne.map.event.RelationshipEvent

    public void setUpdatedValueAt(Object aValue, int row, int column) {

        DbRelationship rel = getRelationship(row);
        // If name column
        if (column == NAME) {
            RelationshipEvent e = new RelationshipEvent(eventSource, rel, entity, rel
                    .getName());
            rel.setName((String) aValue);
            mediator.fireDbRelationshipEvent(e);
            fireTableCellUpdated(row, column);
        }
        // If target column
        else if (column == TARGET) {
            DbEntity target = (DbEntity) aValue;

            // clear joins...
            rel.removeAllJoins();
            rel.setTargetEntity(target);

            RelationshipEvent e = new RelationshipEvent(eventSource, rel, entity);
            mediator.fireDbRelationshipEvent(e);
        }
        else if (column == TO_DEPENDENT_KEY) {
            boolean flag = ((Boolean) aValue).booleanValue();

            // make sure reverse relationship "to-dep-pk" is unset.
            if (flag) {
                DbRelationship reverse = rel.getReverseRelationship();
                if (reverse != null && reverse.isToDependentPK()) {
                    String message = "Unset reverse relationship's \"To Dep PK\" setting?";
                    int answer = JOptionPane.showConfirmDialog(
                            Application.getFrame(),
                            message);
                    if (answer != JOptionPane.YES_OPTION) {
                        // no action needed
                        return;
                    }

                    // unset reverse
                    reverse.setToDependentPK(false);
                }
            }

            rel.setToDependentPK(flag);
            RelationshipEvent e = new RelationshipEvent(eventSource, rel, entity);
            mediator.fireDbRelationshipEvent(e);
        }
        else if (column == CARDINALITY) {
            Boolean temp = (Boolean) aValue;
            rel.setToMany(temp.booleanValue());
            RelationshipEvent e = new RelationshipEvent(eventSource, rel, entity);
            mediator.fireDbRelationshipEvent(e);

            updateDependentObjRelationships(rel);
        }
        fireTableRowsUpdated(row, row);
View Full Code Here

Examples of org.apache.cayenne.map.event.RelationshipEvent

            this.firePropertyDidChange();
        }
    }

    protected void firePropertyDidChange() {
        RelationshipEvent event = new RelationshipEvent(this, this, this
                .getSourceEntity());
        EventManager.getDefaultManager().postEvent(event, PROPERTY_DID_CHANGE);
    }
View Full Code Here

Examples of org.apache.cayenne.map.event.RelationshipEvent

            this.firePropertyDidChange();
        }
    }

    protected void firePropertyDidChange() {
        RelationshipEvent event = new RelationshipEvent(this, this, this
                .getSourceEntity());
        EventManager.getDefaultManager().postEvent(event, PROPERTY_DID_CHANGE);
    }
View Full Code Here

Examples of org.apache.cayenne.map.event.RelationshipEvent

            relationship.setName(sourceEntityName);

            undo.addNameUndo(relationship, oldName, sourceEntityName);

            getMediator().fireDbRelationshipEvent(
                    new RelationshipEvent(this, relationship, relationship
                            .getSourceEntity(), oldName));
        }

        model.commit();

        // check "to dep pk" setting,
        // maybe this is no longer valid
        if (relationship.isToDependentPK() && !relationship.isValidForDepPk()) {
            relationship.setToDependentPK(false);
        }

        // If new reverse DbRelationship was created, add it to the target
        // Don't create reverse with no joins - makes no sense...
        if (updatingReverse) {

            // If didn't find anything, create reverseDbRel
            if (reverseRelationship == null) {
                reverseRelationship = new DbRelationship(targetEntityName);
                reverseRelationship.setSourceEntity(relationship.getTargetEntity());
                reverseRelationship.setTargetEntity(relationship.getSourceEntity());
                reverseRelationship.setToMany(!relationship.isToMany());
                relationship.getTargetEntity().addRelationship(reverseRelationship);

                // fire only if the relationship is to the same entity...
                // this is needed to update entity view...
                if (relationship.getSourceEntity() == relationship.getTargetEntity()) {
                    getMediator().fireDbRelationshipEvent(
                            new RelationshipEvent(
                                    this,
                                    reverseRelationship,
                                    reverseRelationship.getSourceEntity(),
                                    MapEvent.ADD));
                }
            }
            else if (!Util
                    .nullSafeEquals(targetEntityName, reverseRelationship.getName())) {

                String oldName = reverseRelationship.getName();
               
                reverseRelationship.setName(targetEntityName);

                undo.addNameUndo(reverseRelationship, oldName, targetEntityName);

                getMediator().fireDbRelationshipEvent(
                        new RelationshipEvent(
                                this,
                                reverseRelationship,
                                reverseRelationship.getSourceEntity(),
                                oldName));
            }

            Collection reverseJoins = getReverseJoins();
            reverseRelationship.setJoins(reverseJoins);

            // check if joins map to a primary key of this entity
            if (!relationship.isToDependentPK() && reverseRelationship.isValidForDepPk()) {
                reverseRelationship.setToDependentPK(true);
            }
        }

        Application.getInstance().getUndoManager().addEdit(undo);

        getMediator()
                .fireDbRelationshipEvent(
                        new RelationshipEvent(this, relationship, relationship
                                .getSourceEntity()));
    }
View Full Code Here

Examples of org.apache.cayenne.map.event.RelationshipEvent

    protected void removeObjRelationship() {
        ProjectController mediator = getProjectController();
        ObjEntity entity = mediator.getCurrentObjEntity();
        ObjRelationship rel = mediator.getCurrentObjRelationship();
        entity.removeRelationship(rel.getName());
        RelationshipEvent e = new RelationshipEvent(
                Application.getFrame(),
                rel,
                entity,
                MapEvent.REMOVE);
        mediator.fireObjRelationshipEvent(e);
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.