Package org.springframework.richclient.dialog

Examples of org.springframework.richclient.dialog.ConfirmationDialog


        }

        if (getDetailForm().isDirty()) {
            String title = getMessage(new String[]{getId() + ".dirtyNew.title", "masterForm.dirtyNew.title"});
            String message = getMessage(new String[]{getId() + ".dirtyNew.message", "masterForm.dirtyNew.message"});
            ConfirmationDialog dlg = new ConfirmationDialog(title, message) {

                @Override
                protected void onConfirm() {
                    cloneSelectedItems();
                }
            };
            dlg.showDialog();
        } else {
            cloneSelectedItems();
        }
    }
View Full Code Here


  protected void onCancel() {
    // Warn the user if they are about to discard their changes
    if (form.getFormModel().isDirty()) {
      String msg = getMessage("contactProperties.dirtyCancelMessage");
      String title = getMessage("contactProperties.dirtyCancelTitle");
      ConfirmationDialog dlg = new ConfirmationDialog(title, msg) {
        protected void onConfirm() {
          ContactPropertiesDialog.super.onCancel();
        }
      };
      dlg.showDialog();
    }
    else {
      super.onCancel();
    }
  }
View Full Code Here

    {
        public void execute()
        {
            String title = getMessage("contact.confirmDelete.title");
            String message = getMessage("contact.confirmDelete.message");
            ConfirmationDialog dlg = new ConfirmationDialog(title, message)
            {
                protected void onConfirm()
                {
                    for (Object selected : widget.getSelectedRows())
                    {
                        Contact contact = (Contact) selected;
                        // Delete the object from the persistent store.
                        getContactDataStore().delete(contact);
                        // And notify the rest of the application of the change
                        getApplicationContext().publishEvent(
                                new LifecycleApplicationEvent(LifecycleApplicationEvent.DELETED, contact));
                    }
                }
            };
            dlg.showDialog();
        }
View Full Code Here

                    petCount++;
                }
                nodesToDelete.add(node);
            }

            ConfirmationDialog dialog = new ConfirmationDialog() {
                protected void onConfirm() {
                    for (Iterator i = nodesToDelete.iterator(); i.hasNext();) {
                        DefaultMutableTreeNode node = (DefaultMutableTreeNode)i.next();
                        ownersTreeModel.removeNodeFromParent(node);
                        if (node.getUserObject() instanceof Owner) {
                            // clinic.deleteOwner((Owner) node.getUserObject());
                        }
                        else {
                            // clinic.deletePet((Pet) node.getUserObject());
                        }
                    }
                }
            };
            //  TODO check default closeAction on ConfirmationDialog
            // setting closeAction explicitly to dispose, if confirmationDialog has this default,
            // this line may be removed.
            dialog.setCloseAction(CloseAction.DISPOSE);

            if (ownerCount > 0 && petCount > 0) {
                dialog.setTitle(getMessage("confirmDeleteOwnerAndPetDialog.title"));
                dialog.setConfirmationMessage(getMessage("confirmDeleteOwnerAndPetDialog.label"));
            }
            else if (ownerCount > 0) {
                dialog.setTitle(getMessage("confirmDeleteOwnerDialog.title"));
                dialog.setConfirmationMessage(getMessage("confirmDeleteOwnerDialog.label"));
            }
            else {
                dialog.setTitle(getMessage("confirmDeletePetDialog.title"));
                dialog.setConfirmationMessage(getMessage("confirmDeletePetDialog.label"));
            }

            dialog.showDialog();
        }
View Full Code Here

        // If configured, have the user confirm the delete operation
        if( isConfirmDelete() ) {
            String title = getMessage( new String[] { getId() + ".confirmDelete.title", "masterForm.confirmDelete.title" } );
            String message = getConfirmDeleteMessage();
            ConfirmationDialog dlg = new ConfirmationDialog( title, message ) {

                protected void onConfirm() {
                    deleteSelectedItems();
                    getSelectionModel().clearSelection();
                }
            };
            dlg.showDialog();
        } else {
            deleteSelectedItems();
            getSelectionModel().clearSelection();
        }
    }
View Full Code Here

        final ActionCommand detailNewObjectCommand = detailForm.getNewFormObjectCommand();

        if( getDetailForm().isDirty() ) {
            String title = getMessage( new String[] { getId() + ".dirtyNew.title", "masterForm.dirtyNew.title" } );
            String message = getMessage( new String[] { getId() + ".dirtyNew.message", "masterForm.dirtyNew.message" } );
            ConfirmationDialog dlg = new ConfirmationDialog( title, message ) {
                protected void onConfirm() {
                    // Tell both forms that we are creating a new object
                    detailNewObjectCommand.execute(); // Do subform action first
                    creatingNewObject();
                    detailForm.creatingNewObject();
                }
            };
            dlg.showDialog();
        } else {
            // Tell both forms that we are creating a new object
            detailNewObjectCommand.execute(); // Do subform action first
            creatingNewObject();
            detailForm.creatingNewObject();
View Full Code Here

                return;
            }
            if( getDetailForm().isDirty() ) {
                String title = getMessage( new String[] { getId() + ".dirtyChange.title", "masterForm.dirtyChange.title" } );
                String message = getMessage( new String[] { getId() + ".dirtyChange.message", "masterForm.dirtyChange.message" } );
                ConfirmationDialog dlg = new ConfirmationDialog( title, message ) {

                    protected void onConfirm() {
                        getDetailForm().setSelectedIndex( newIndex );
                    }

                    protected void onCancel() {
                        // Force the selction back
                        super.onCancel();
                        if( getDetailForm().isEditingNewFormObject() ) {
                            // Since they were editing a new object, we just
                            // need to clear the selection
                            getSelectionModel().clearSelection();
                        } else {
                            int index = getDetailForm().getSelectedIndex();
                            getSelectionModel().setSelectionInterval( index, index );
                        }
                    }

                };
                dlg.showDialog();
            } else {
                getDetailForm().setSelectedIndex( newIndex );
            }
        }
View Full Code Here

  @Override
  public void revert( @Nullable final Runnable callback ) {
    if ( getFormModel().isDirty() ) {
      String msg = springSupport.getMessage( baseId + ".dirtyRevertMessage" );
      String title = springSupport.getMessage( baseId + ".dirtyRevertTitle" );
      ConfirmationDialog dlg = new ConfirmationDialog( title, msg ) {
        @Override
        protected void onConfirm() {
          getFormModel().revert();
          if ( callback != null ) {
            callback.run();
          }
        }
      };
      dlg.showDialog();
    } else {
      getFormModel().revert();
      if ( callback != null ) {
        callback.run();
      }
View Full Code Here

  @Override
  protected void doExecuteCommand() {
    String title = SpringSupport.INSTANCE.getMessage( DELETE_COMMAND_ID + ".title" );
    String message = SpringSupport.INSTANCE.getMessage( DELETE_COMMAND_ID + ".message" );
    ConfirmationDialog dlg = new ConfirmationDialog( title, message ) {
      @Override
      protected void onConfirm() {
        final List<? extends T> objectsToDelete = objectAccess.getElements();

        new BlockingBackgroundActionRunner( SpringSupport.INSTANCE.getActiveApplicationWindow(), new BackgroundAction( idStrategy.getBaseId() + AddRemoveAspect.KEY_DELETE_BEAN ) {
          @Override
          protected boolean confirm() {
            if ( callback != null ) {
              return callback.confirm();
            }
            return true;
          }

          @Override
          protected void executeInBackground() throws Exception {
            for ( T entry : objectsToDelete ) {
              objectRemove.remove( entry );
              // And notify the rest of the application of the change
              SpringSupport.INSTANCE.publishDeleted( entry );
            }
          }
        } ).run();
      }
    };
    dlg.showDialog();
  }
View Full Code Here

      throw new IllegalStateException( "Bean is null" );
    }

    String title = "delete." + listView.getBeanType().getName();
    String message = "delete." + listView.getBeanType().getName() + bean; //TODO message format
    ConfirmationDialog dialog = new ConfirmationDialog( title, listView.getContext().getWindow().getControl(), message ) {
      @Override
      protected void onConfirm() {
        listView.getBeanManager().delete( bean );
      }
    };
    dialog.showDialog();
  }
View Full Code Here

TOP

Related Classes of org.springframework.richclient.dialog.ConfirmationDialog

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.