Package org.damour.base.client.ui.dialogs

Examples of org.damour.base.client.ui.dialogs.PromptDialogBox


  }

  public void execute() {
    popup.hide();
    final EditGroupsForUserPanel editGroupsForUserPanel = new EditGroupsForUserPanel(null, null, null, user);
    final PromptDialogBox editGroupDialogBox = new PromptDialogBox("Join/Leave Groups", "OK", null, null, false, true);
    editGroupDialogBox.setContent(editGroupsForUserPanel);
    editGroupDialogBox.center();
  }
View Full Code Here


  }

  public void execute() {
    final TextBox folderNameTextBox = new TextBox();
    folderNameTextBox.setVisibleLength(60);
    PromptDialogBox dialogBox = new PromptDialogBox("Enter New Folder Name", "OK", null, "Cancel", false, true);
    dialogBox.setContent(folderNameTextBox);
    dialogBox.setCallback(new IDialogCallback() {
      public void okPressed() {
        PermissibleObject parentFolder = null;
        if (repositoryTree.getLastItem() != null && repositoryTree.getLastItem().getUserObject() instanceof PermissibleObject) {
          PermissibleObject permissibleObject = (PermissibleObject) repositoryTree.getLastItem().getUserObject();
          parentFolder = permissibleObject.getParent();
        }
        AsyncCallback<Folder> callback = new AsyncCallback<Folder>() {
          public void onFailure(Throwable caught) {
            MessageDialogBox messageDialog = new MessageDialogBox("Error", caught.getMessage(), false, true, true);
            messageDialog.center();
          }

          public void onSuccess(Folder newFolder) {
            repositoryTree.setLastItemId(newFolder.getId());
            repositoryTree.fetchRepositoryTree(repositoryCallback);
          }
        };
        Folder newFolder = new Folder();
        newFolder.setParent(parentFolder);
        newFolder.setName(folderNameTextBox.getText());
        newFolder.setDescription(folderNameTextBox.getText());
        BaseServiceCache.getService().createNewFolder(newFolder, callback);
      }

      public void cancelPressed() {
      }
    });
    dialogBox.setValidatorCallback(new IDialogValidatorCallback() {
      public boolean validate() {
        return (folderNameTextBox.getText() != null && !"".equals(folderNameTextBox.getText()));
      }
    });
    dialogBox.center();

  }
View Full Code Here

    this.user = user;
  }

  public void execute() {
    popup.hide();
    PromptDialogBox promptDialog = new PromptDialogBox("Pending Group Memberships", "OK", null, null, false, true);
    ManagePendingGroupMembershipsPanel panel = new ManagePendingGroupMembershipsPanel(user, promptDialog);
    promptDialog.setContent(panel);
    promptDialog.center();
  }
View Full Code Here

    popup.hide();
    final UserGroup group = new UserGroup();
    group.setOwner(user);

    final EditGroupPanel editGroupPanel = new EditGroupPanel(null, callback, null, group, false, false);
    final PromptDialogBox editGroupDialogBox = new PromptDialogBox("Create New Group", "OK", null, "Cancel", false, true);
    editGroupDialogBox.setContent(editGroupPanel);
    editGroupDialogBox.setFocusWidget(editGroupPanel.getNameTextBox());
    editGroupDialogBox.setValidatorCallback(new IDialogValidatorCallback() {
      public boolean validate() {
        if (editGroupPanel.getNameTextBox().getText() == null || "".equals(editGroupPanel.getNameTextBox().getText())) {
          MessageDialogBox dialog = new MessageDialogBox("Error", "Enter a group name.", true, true, true);
          dialog.center();
          return false;
        }
        return true;
      }
    });
    editGroupDialogBox.setCallback(new IDialogCallback() {
      public void okPressed() {
        if (!editGroupPanel.apply()) {
          editGroupDialogBox.center();
        }
      }

      public void cancelPressed() {
      }
    });
    editGroupDialogBox.center();

  }
View Full Code Here

  }

  public void execute() {
    try {
      if (permissibleObject != null) {
        final PromptDialogBox dialogBox = new PromptDialogBox("Properties", "OK", null, "Cancel", false, true);
        final AsyncCallback<Void> callback = new AsyncCallback<Void>() {
          public void onFailure(Throwable caught) {
            MessageDialogBox messageDialog = new MessageDialogBox("Error", caught.getMessage(), false, true, true);
            messageDialog.setCallback(new IDialogCallback() {
              public void okPressed() {
              }

              public void cancelPressed() {
                dialogBox.center();
              }
            });
            messageDialog.center();
          }

          public void onSuccess(Void result) {
          }
        };
        final PropertiesPanel propertiesPanel = new PropertiesPanel(permissibleObject, null, VIEW.GENERAL);
        dialogBox.setContent(propertiesPanel);
        dialogBox.setCallback(new IDialogCallback() {
          public void okPressed() {
            propertiesPanel.apply(callback);
          }

          public void cancelPressed() {
          }
        });
        dialogBox.center();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

    newGroupButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        final UserGroup group = new UserGroup();
        group.setOwner(user);
        editGroupPanel = new EditGroupPanel(callback, EditGroupsPanel.this, users, group, false, true);
        final PromptDialogBox editGroupDialogBox = new PromptDialogBox("Create New Group", "OK", null, "Cancel", false, true);
        editGroupDialogBox.setContent(editGroupPanel);
        editGroupDialogBox.setCallback(new IDialogCallback() {
          public void okPressed() {
            if (!editGroupPanel.apply()) {
              editGroupDialogBox.center();
            } else {
              populateUI();
              if (callback != null) {
                callback.userGroupsFetched(groups);
              }
            }
          }

          public void cancelPressed() {
          }
        });
        editGroupDialogBox.center();
      }
    });

    deleteGroupButton.setTitle("Delete Group");
    deleteGroupButton.setEnabled(false);
    deleteGroupButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {

        if (groupsList.getSelectedIndex() < 0) {
          return;
        }

        final UserGroup group = groupMap.get(groupsList.getItemText(groupsList.getSelectedIndex()));

        final PromptDialogBox deleteGroupDialogBox = new PromptDialogBox("Confirm", "Yes", null, "No", false, true);
        deleteGroupDialogBox.setContent(new Label("Delete Group: " + group.getName() + "?"));
        deleteGroupDialogBox.setCallback(new IDialogCallback() {
          public void okPressed() {
            final AsyncCallback<Void> deleteGroupCallback = new AsyncCallback<Void>() {
              public void onFailure(Throwable caught) {
                MessageDialogBox dialog = new MessageDialogBox("Error", caught.getMessage(), true, true, true);
                dialog.center();
              }

              public void onSuccess(Void nothing) {
                groups.remove(group);
                lastListSelection = null;
                populateUI();
                if (callback != null) {
                  callback.userGroupsFetched(groups);
                }
              };
            };
            BaseServiceCache.getService().deleteGroup(group, deleteGroupCallback);

          }

          public void cancelPressed() {
          }
        });
        deleteGroupDialogBox.center();
      }
    });
    editGroupButton.setTitle("Edit Group Settings");
    editGroupButton.setEnabled(false);
    editGroupButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        if (groupsList.getSelectedIndex() < 0) {
          return;
        }
        final UserGroup group = groupMap.get(groupsList.getItemText(groupsList.getSelectedIndex()));
        editGroupPanel = new EditGroupPanel(callback, EditGroupsPanel.this, users, group, false, true);
        final PromptDialogBox editGroupDialogBox = new PromptDialogBox("Edit Group", "OK", null, "Cancel", false, true);
        editGroupDialogBox.setContent(editGroupPanel);
        editGroupDialogBox.setCallback(new IDialogCallback() {
          public void okPressed() {
            if (!editGroupPanel.apply()) {
              editGroupDialogBox.center();
            } else {
              if (callback != null) {
                callback.userGroupsFetched(groups);
              }
            }
          }

          public void cancelPressed() {
          }
        });
        editGroupDialogBox.center();
      }
    });
    buttonPanel.add(newGroupButton);
    buttonPanel.add(editGroupButton);
    buttonPanel.add(deleteGroupButton);
View Full Code Here

TOP

Related Classes of org.damour.base.client.ui.dialogs.PromptDialogBox

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.