Package org.apache.cayenne.modeler.dialog

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


     * Creates and returns dialog for delete prompt
     *
     * @param allowAsking If false, no question will be asked no matter what settings are
     */
    public ConfirmRemoveDialog getConfirmDeleteDialog(boolean allowAsking) {
        return new ConfirmRemoveDialog(allowAsking);
    }
View Full Code Here


     */
    public void performAction(ActionEvent e, boolean allowAsking) {

        ProjectController mediator = getProjectController();

        ConfirmRemoveDialog dialog = getConfirmDeleteDialog(allowAsking);

        if (mediator.getCurrentObjEntity() != null) {
            if (dialog
                    .shouldDelete("ObjEntity", mediator.getCurrentObjEntity().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentObjEntity()));
                removeObjEntity(mediator.getCurrentDataMap(), mediator
                        .getCurrentObjEntity());
            }
        }
        else if (mediator.getCurrentDbEntity() != null) {
            if (dialog.shouldDelete("DbEntity", mediator.getCurrentDbEntity().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentDbEntity()));
                removeDbEntity(mediator.getCurrentDataMap(), mediator
                        .getCurrentDbEntity());
            }
        }
        else if (mediator.getCurrentQuery() != null) {
            if (dialog.shouldDelete("query", mediator.getCurrentQuery().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentQuery()));
                removeQuery(mediator.getCurrentDataMap(), mediator.getCurrentQuery());
            }
        }
        else if (mediator.getCurrentProcedure() != null) {
            if (dialog
                    .shouldDelete("procedure", mediator.getCurrentProcedure().getName())) {

                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentProcedure()));

                removeProcedure(mediator.getCurrentDataMap(), mediator
                        .getCurrentProcedure());

            }
        }
        else if (mediator.getCurrentEmbeddable() != null) {
            if (dialog.shouldDelete("embeddable", mediator
                    .getCurrentEmbeddable()
                    .getClassName())) {

                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentEmbeddable()));

                removeEmbeddable(mediator.getCurrentDataMap(), mediator
                        .getCurrentEmbeddable());
            }
        }
        else if (mediator.getCurrentDataMap() != null) {
            if (dialog.shouldDelete("data map", mediator.getCurrentDataMap().getName())) {

                // In context of Data node just remove from Data Node
                if (mediator.getCurrentDataNode() != null) {
                    application.getUndoManager().addEdit(
                            new RemoveUndoableEdit(application, mediator
                                    .getCurrentDataNode(), mediator.getCurrentDataMap()));

                    removeDataMapFromDataNode(mediator.getCurrentDataNode(), mediator
                            .getCurrentDataMap());

                }
                else {
                    // Not under Data Node, remove completely
                    application.getUndoManager().addEdit(
                            new RemoveUndoableEdit(application, mediator
                                    .getCurrentDataMap()));

                    removeDataMap(mediator.getCurrentDataMap());

                }
            }
        }
        else if (mediator.getCurrentDataNode() != null) {
            if (dialog.shouldDelete("data node", mediator.getCurrentDataNode().getName())) {
                application
                        .getUndoManager()
                        .addEdit(
                                new RemoveUndoableEdit(application, mediator
                                        .getCurrentDataNode()));

                removeDataNode(mediator.getCurrentDataNode());
            }
        }

        else if (mediator.getCurrentPaths() != null) { // multiple deletion
            if (dialog.shouldDelete("selected objects")) {
                Object[] paths = mediator.getCurrentPaths();

                CompoundEdit compoundEdit = new RemoveCompoundUndoableEdit();

                for (Object path : paths) {
View Full Code Here

     * Creates and returns dialog for delete prompt
     *
     * @param allowAsking If false, no question will be asked no matter what settings are
     */
    public ConfirmRemoveDialog getConfirmDeleteDialog(boolean allowAsking) {
        return new ConfirmRemoveDialog(allowAsking);
    }
View Full Code Here

     */
    public void performAction(ActionEvent e, boolean allowAsking) {

        ProjectController mediator = getProjectController();

        ConfirmRemoveDialog dialog = getConfirmDeleteDialog(allowAsking);

        if (mediator.getCurrentObjEntity() != null) {
            if (dialog
                    .shouldDelete("ObjEntity", mediator.getCurrentObjEntity().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentObjEntity()));
                removeObjEntity(mediator.getCurrentDataMap(), mediator
                        .getCurrentObjEntity());
            }
        }
        else if (mediator.getCurrentDbEntity() != null) {
            if (dialog.shouldDelete("DbEntity", mediator.getCurrentDbEntity().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentDbEntity()));
                removeDbEntity(mediator.getCurrentDataMap(), mediator
                        .getCurrentDbEntity());
            }
        }
        else if (mediator.getCurrentQuery() != null) {
            if (dialog.shouldDelete("query", mediator.getCurrentQuery().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentQuery()));
                removeQuery(mediator.getCurrentDataMap(), mediator.getCurrentQuery());
            }
        }
        else if (mediator.getCurrentProcedure() != null) {
            if (dialog
                    .shouldDelete("procedure", mediator.getCurrentProcedure().getName())) {

                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentProcedure()));

                removeProcedure(mediator.getCurrentDataMap(), mediator
                        .getCurrentProcedure());

            }
        }
        else if (mediator.getCurrentEmbeddable() != null) {
            if (dialog.shouldDelete("embeddable", mediator
                    .getCurrentEmbeddable()
                    .getClassName())) {

                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentEmbeddable()));

                removeEmbeddable(mediator.getCurrentDataMap(), mediator
                        .getCurrentEmbeddable());
            }
        }
        else if (mediator.getCurrentDataMap() != null) {
            if (dialog.shouldDelete("data map", mediator.getCurrentDataMap().getName())) {

                // In context of Data node just remove from Data Node
                if (mediator.getCurrentDataNode() != null) {
                    application.getUndoManager().addEdit(
                            new RemoveUndoableEdit(application, mediator
                                    .getCurrentDataNode(), mediator.getCurrentDataMap()));

                    removeDataMapFromDataNode(mediator.getCurrentDataNode(), mediator
                            .getCurrentDataMap());

                }
                else {
                    // Not under Data Node, remove completely
                    application.getUndoManager().addEdit(
                            new RemoveUndoableEdit(application, mediator
                                    .getCurrentDataMap()));

                    removeDataMap(mediator.getCurrentDataMap());

                }
            }
        }
        else if (mediator.getCurrentDataNode() != null) {
            if (dialog.shouldDelete("data node", mediator.getCurrentDataNode().getName())) {
                application
                        .getUndoManager()
                        .addEdit(
                                new RemoveUndoableEdit(application, mediator
                                        .getCurrentDataNode()));

                removeDataNode(mediator.getCurrentDataNode());
            }
        }

        else if (mediator.getCurrentPaths() != null) { // multiple deletion
            if (dialog.shouldDelete("selected objects")) {
                Object[] paths = mediator.getCurrentPaths();

                CompoundEdit compoundEdit = new RemoveCompoundUndoableEdit();

                for (Object path : paths) {
View Full Code Here

        return path.getObject() instanceof ProcedureParameter;
    }

    @Override
    public void performAction(ActionEvent e, boolean allowAsking) {
        ConfirmRemoveDialog dialog = getConfirmDeleteDialog(allowAsking);

        ProcedureParameter[] params = getProjectController()
                .getCurrentProcedureParameters();
        if (params.length > 0) {
            if ((params.length == 1 && dialog.shouldDelete(
                    "procedure parameter",
                    params[0].getName()))
                    || (params.length > 1 && dialog
                            .shouldDelete("selected procedure parameters"))) {
                removeProcedureParameters();
            }
        }
    }
View Full Code Here

    return path.getObject() instanceof Relationship;
  }

  @Override
  public void performAction(ActionEvent e, boolean allowAsking) {
    ConfirmRemoveDialog dialog = getConfirmDeleteDialog(allowAsking);
    ProjectController mediator = getProjectController();

    ObjRelationship[] rels = getProjectController()
        .getCurrentObjRelationships();
    if (rels != null && rels.length > 0) {
      if ((rels.length == 1 && dialog.shouldDelete("ObjRelationship",
          rels[0].getName()))
          || (rels.length > 1 && dialog
              .shouldDelete("selected ObjRelationships"))) {
        ObjEntity entity = mediator.getCurrentObjEntity();
        removeObjRelationships(entity, rels);
        Application.getInstance().getUndoManager().addEdit(
            new RemoveRelationshipUndoableEdit(entity, rels));
      }
    } else {
      DbRelationship[] dbRels = getProjectController()
          .getCurrentDbRelationships();
      if (dbRels != null && dbRels.length > 0) {
        if ((dbRels.length == 1 && dialog.shouldDelete(
            "DbRelationship", dbRels[0].getName()))
            || (dbRels.length > 1 && dialog
                .shouldDelete("selected DbRelationships"))) {
          DbEntity entity = mediator.getCurrentDbEntity();
          removeDbRelationships(entity, dbRels);
          Application.getInstance().getUndoManager().addEdit(
              new RemoveRelationshipUndoableEdit(entity, dbRels));
View Full Code Here

        return path.getObject() instanceof Attribute;
    }

    @Override
    public void performAction(ActionEvent e, boolean allowAsking) {
        ConfirmRemoveDialog dialog = getConfirmDeleteDialog(allowAsking);
        ProjectController mediator = getProjectController();

        EmbeddableAttribute[] embAttrs = getProjectController().getCurrentEmbAttrs();

        ObjAttribute[] attrs = getProjectController().getCurrentObjAttributes();

        if (embAttrs != null && embAttrs.length > 0) {
            if ((embAttrs.length == 1 && dialog.shouldDelete(
                    "Embeddable Attribute",
                    embAttrs[0].getName()))
                    || (embAttrs.length > 1 && dialog
                            .shouldDelete("selected EmbAttributes"))) {

                Embeddable embeddable = mediator.getCurrentEmbeddable();

                EmbeddableAttribute[] eAttrs = getProjectController()
                        .getCurrentEmbAttrs();

                application.getUndoManager().addEdit(
                        new RemoveAttributeUndoableEdit(embeddable, eAttrs));

                removeEmbeddableAttributes(embeddable, eAttrs);

            }
        }
        else if (attrs != null && attrs.length > 0) {
            if ((attrs.length == 1 && dialog.shouldDelete("ObjAttribute", attrs[0]
                    .getName()))
                    || (attrs.length > 1 && dialog.shouldDelete("selected ObjAttributes"))) {

                ObjEntity entity = mediator.getCurrentObjEntity();
                ObjAttribute[] attribs = mediator.getCurrentObjAttributes();

                application.getUndoManager().addEdit(
                        new RemoveAttributeUndoableEdit(
                                mediator.getCurrentDataDomain(),
                                mediator.getCurrentDataMap(),
                                entity,
                                attribs));

                removeObjAttributes(entity, attribs);
            }
        }
        else {
            DbAttribute[] dbAttrs = getProjectController().getCurrentDbAttributes();
            if (dbAttrs != null && dbAttrs.length > 0) {
                if ((dbAttrs.length == 1 && dialog.shouldDelete("DbAttribute", dbAttrs[0]
                        .getName()))
                        || (dbAttrs.length > 1 && dialog
                                .shouldDelete("selected DbAttributes"))) {

                    DbEntity entity = mediator.getCurrentDbEntity();
                    DbAttribute[] attribs = mediator.getCurrentDbAttributes();
View Full Code Here

     * Creates and returns dialog for delete prompt
     *
     * @param allowAsking If false, no question will be asked no matter what settings are
     */
    public ConfirmRemoveDialog getConfirmDeleteDialog(boolean allowAsking) {
        return new ConfirmRemoveDialog(allowAsking);
    }
View Full Code Here

     */
    public void performAction(ActionEvent e, boolean allowAsking) {

        ProjectController mediator = getProjectController();

        ConfirmRemoveDialog dialog = getConfirmDeleteDialog(allowAsking);

        if (mediator.getCurrentObjEntity() != null) {
            if (dialog
                    .shouldDelete("ObjEntity", mediator.getCurrentObjEntity().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentObjEntity()));
                removeObjEntity(mediator.getCurrentDataMap(), mediator
                        .getCurrentObjEntity());
            }
        }
        else if (mediator.getCurrentDbEntity() != null) {
            if (dialog.shouldDelete("DbEntity", mediator.getCurrentDbEntity().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentDbEntity()));
                removeDbEntity(mediator.getCurrentDataMap(), mediator
                        .getCurrentDbEntity());
            }
        }
        else if (mediator.getCurrentQuery() != null) {
            if (dialog.shouldDelete("query", mediator.getCurrentQuery().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentQuery()));
                removeQuery(mediator.getCurrentDataMap(), mediator.getCurrentQuery());
            }
        }
        else if (mediator.getCurrentProcedure() != null) {
            if (dialog
                    .shouldDelete("procedure", mediator.getCurrentProcedure().getName())) {

                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentProcedure()));

                removeProcedure(mediator.getCurrentDataMap(), mediator
                        .getCurrentProcedure());

            }
        }
        else if (mediator.getCurrentEmbeddable() != null) {
            if (dialog.shouldDelete("embeddable", mediator
                    .getCurrentEmbeddable()
                    .getClassName())) {

                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(mediator.getCurrentDataMap(), mediator
                                .getCurrentEmbeddable()));

                removeEmbeddable(mediator.getCurrentDataMap(), mediator
                        .getCurrentEmbeddable());
            }
        }
        else if (mediator.getCurrentDataMap() != null) {
            if (dialog.shouldDelete("data map", mediator.getCurrentDataMap().getName())) {

                // In context of Data node just remove from Data Node
                if (mediator.getCurrentDataNode() != null) {
                    application.getUndoManager().addEdit(
                            new RemoveUndoableEdit(application, mediator
                                    .getCurrentDataNode(), mediator.getCurrentDataMap()));

                    removeDataMapFromDataNode(mediator.getCurrentDataNode(), mediator
                            .getCurrentDataMap());

                }
                else {
                    // Not under Data Node, remove completely
                    application
                            .getUndoManager()
                            .addEdit(
                                    new RemoveUndoableEdit(application, mediator
                                            .getCurrentDataDomain(), mediator
                                            .getCurrentDataMap()));

                    removeDataMap(mediator.getCurrentDataDomain(), mediator
                            .getCurrentDataMap());

                }
            }
        }
        else if (mediator.getCurrentDataNode() != null) {
            if (dialog.shouldDelete("data node", mediator.getCurrentDataNode().getName())) {
                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(application, mediator
                                .getCurrentDataDomain(), mediator.getCurrentDataNode()));

                removeDataNode(mediator.getCurrentDataDomain(), mediator
                        .getCurrentDataNode());
            }
        }
        else if (mediator.getCurrentDataDomain() != null) {
            if (dialog.shouldDelete("data domain", mediator
                    .getCurrentDataDomain()
                    .getName())) {

                application.getUndoManager().addEdit(
                        new RemoveUndoableEdit(application, mediator
                                .getCurrentDataDomain()));

                removeDomain(mediator.getCurrentDataDomain());
            }
        }
        else if (mediator.getCurrentPaths() != null) { // multiple deletion
            if (dialog.shouldDelete("selected objects")) {
                ProjectPath[] paths = mediator.getCurrentPaths();

                CompoundEdit compoundEdit = new RemoveCompoundUndoableEdit();

                for (ProjectPath path : paths) {
View Full Code Here

     * Creates and returns dialog for delete prompt
     *
     * @param allowAsking If false, no question will be asked no matter what settings are
     */
    public ConfirmRemoveDialog getConfirmDeleteDialog(boolean allowAsking) {
        return new ConfirmRemoveDialog(allowAsking);
    }
View Full Code Here

TOP

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

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.