Package org.apache.cayenne.modeler.dialog

Examples of org.apache.cayenne.modeler.dialog.ResolveDbRelationshipDialog


        dbRelationship.setToMany(targetModel.isToMany());
        targetModel.getSource().addRelationship(dbRelationship);

        // TODO: creating relationship outside of ResolveDbRelationshipDialog confuses it
        // to send incorrect event - CHANGE instead of ADD
        ResolveDbRelationshipDialog dialog = new ResolveDbRelationshipDialog(
                dbRelationship);

        dialog.setVisible(true);
        if (dialog.isCancelPressed()) {
            targetModel.getSource().removeRelationship(dbRelationship.getName());
        }
        else {
            MultiColumnBrowser pathBrowser = getPathBrowser();
            Object[] oldPath = targetModel.isSource1Selected() ? new Object[] {
                    getStartEntity()
                } : pathBrowser.getSelectionPath().getPath();

            /**
             * Update the view
             */
            EntityTreeModel treeModel = (EntityTreeModel) pathBrowser.getModel();
            treeModel.invalidate();

            pathBrowser.setSelectionPath(new TreePath(new Object[] {
                getStartEntity()
            }));
            pathBrowser.repaint();

            Object[] path = new Object[oldPath.length + 1];
            System.arraycopy(oldPath, 0, path, 0, path.length - 1);

            path[path.length - 1] = dbRelationship;
            pathBrowser.setSelectionPath(new TreePath(path));
        }

        dialog.dispose();
    }
View Full Code Here


        }

        // Get DbRelationship
        DbRelationshipTableModel model = (DbRelationshipTableModel) table.getModel();
        DbRelationship rel = model.getRelationship(row);
        ResolveDbRelationshipDialog dialog = new ResolveDbRelationshipDialog(rel);
        dialog.setVisible(true);
        dialog.dispose();
    }
View Full Code Here

        }

        // Get DbRelationship
        DbRelationshipTableModel model = (DbRelationshipTableModel) table.getModel();
        DbRelationship rel = model.getRelationship(row);
        ResolveDbRelationshipDialog dialog = new ResolveDbRelationshipDialog(rel);
        dialog.setVisible(true);
        dialog.dispose();
    }
View Full Code Here

        dbRelationship.setToMany(toMany);
        source.addRelationship(dbRelationship);

        // TODO: creating relationship outside of ResolveDbRelationshipDialog confuses it
        // to send incorrect event - CHANGE instead of ADD
        ResolveDbRelationshipDialog dialog = new ResolveDbRelationshipDialog(
                dbRelationship);

        dialog.setVisible(true);
        if (dialog.isCancelPressed()) {
            source.removeRelationship(dbRelationship.getName());
        }
        else {
            if (selectedPathComponent == null) {
                selectedPathComponent = (EntityRelationshipsModel) model
                        .getDbRelationshipPath()
                        .get(0);
                model.setSelectedPathComponent(selectedPathComponent);
            }

            selectedPathComponent.setRelationshipName(dbRelationship.getName());
        }

        dialog.dispose();
    }
View Full Code Here

        }

        // Get DbRelationship
        DbRelationshipTableModel model = (DbRelationshipTableModel) table.getModel();
        DbRelationship rel = model.getRelationship(row);
        ResolveDbRelationshipDialog dialog = new ResolveDbRelationshipDialog(rel);
        dialog.setVisible(true);
        dialog.dispose();
    }
View Full Code Here

        }

        // Get DbRelationship
        DbRelationshipTableModel model = (DbRelationshipTableModel) table.getModel();
        DbRelationship rel = model.getRelationship(row);
        ResolveDbRelationshipDialog dialog = new ResolveDbRelationshipDialog(rel);
        dialog.setVisible(true);
        dialog.dispose();
    }
View Full Code Here

        dbRelationship.setToMany(targetModel.isToMany());
        targetModel.getSource().addRelationship(dbRelationship);

        // TODO: creating relationship outside of ResolveDbRelationshipDialog confuses it
        // to send incorrect event - CHANGE instead of ADD
        ResolveDbRelationshipDialog dialog = new ResolveDbRelationshipDialog(
                dbRelationship);

        dialog.setVisible(true);
        if (dialog.isCancelPressed()) {
            targetModel.getSource().removeRelationship(dbRelationship.getName());
        }
        else {
            MultiColumnBrowser pathBrowser = ((ObjRelationshipInfoDialog) getView())
                    .getPathBrowser();
            Object[] oldPath = targetModel.isSource1Selected() ? new Object[] {
                model.getStartEntity()
            } : pathBrowser.getSelectionPath().getPath();

            /**
             * Update the view
             */
            EntityTreeModel treeModel = (EntityTreeModel) pathBrowser.getModel();
            treeModel.invalidate();

            pathBrowser.setSelectionPath(new TreePath(new Object[] {
                model.getStartEntity()
            }));
            pathBrowser.repaint();

            Object[] path = new Object[oldPath.length + 1];
            System.arraycopy(oldPath, 0, path, 0, path.length - 1);

            path[path.length - 1] = dbRelationship;
            pathBrowser.setSelectionPath(new TreePath(path));
        }

        dialog.dispose();
    }
View Full Code Here

        dbRelationship.setToMany(targetModel.isToMany());
        targetModel.getSource().addRelationship(dbRelationship);

        // TODO: creating relationship outside of ResolveDbRelationshipDialog confuses it
        // to send incorrect event - CHANGE instead of ADD
        ResolveDbRelationshipDialog dialog = new ResolveDbRelationshipDialog(
                dbRelationship);

        dialog.setVisible(true);
        if (dialog.isCancelPressed()) {
            targetModel.getSource().removeRelationship(dbRelationship.getName());
        }
        else {
            MultiColumnBrowser pathBrowser = ((ObjRelationshipInfoDialog) getView())
                    .getPathBrowser();
            Object[] oldPath = targetModel.isSource1Selected() ? new Object[] {
                model.getStartEntity()
            } : pathBrowser.getSelectionPath().getPath();

            /**
             * Update the view
             */
            EntityTreeModel treeModel = (EntityTreeModel) pathBrowser.getModel();
            treeModel.invalidate();

            pathBrowser.setSelectionPath(new TreePath(new Object[] {
                model.getStartEntity()
            }));
            pathBrowser.repaint();

            Object[] path = new Object[oldPath.length + 1];
            System.arraycopy(oldPath, 0, path, 0, path.length - 1);

            path[path.length - 1] = dbRelationship;
            pathBrowser.setSelectionPath(new TreePath(path));
        }

        dialog.dispose();
    }
View Full Code Here

 
    @Override
  public void redo() throws CannotRedoException {
    super.redo();
   
    ResolveDbRelationshipDialog dialog = new ResolveDbRelationshipDialog(
        relationship, false);

    dialog.setVisible(true);
  }
View Full Code Here

  @Override
  public void undo() throws CannotUndoException {
    super.undo();
   
    ResolveDbRelationshipDialog dialog = new ResolveDbRelationshipDialog(
        relationship, false);

    dialog.setVisible(true);
  }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.modeler.dialog.ResolveDbRelationshipDialog

Copyright © 2018 www.massapicom. 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.