Example #1
0
    /** @param searchFields */
    public void setFields(MessageListFields[] searchFields) {

      this.checkBoxFrom.setValue(GWTUtil.indexOf(searchFields, MessageListFields.FROM) >= 0);
      this.checkBoxTo.setValue(GWTUtil.indexOf(searchFields, MessageListFields.TO) >= 0);
      this.checkBoxCc.setValue(GWTUtil.indexOf(searchFields, MessageListFields.CC) >= 0);
      this.checkBoxSubject.setValue(GWTUtil.indexOf(searchFields, MessageListFields.SUBJECT) >= 0);
      this.checkBoxContent.setValue(GWTUtil.indexOf(searchFields, MessageListFields.CONTENT) >= 0);
    }
Example #2
0
    public void onFolderDrop(FolderDropEvent event) {

      if (event.getNodes() != null && event.getNodes().length > 0) {
        TreeNode sourceNode = event.getNodes()[0];
        IGWTFolder sourceFolder = GWTUtil.getGwtFolder(sourceNode);
        if (sourceFolder.isMoveSupported()) {
          TreeNode targetNode = event.getFolder();
          IGWTFolder targetFolder = GWTUtil.getGwtFolder(targetNode);
          if (!isSame(sourceFolder.getParent(), targetFolder)) {
            ActionRegistry.MOVE_FOLDER.get(MoveFolderAction.class).setSourceNode(sourceNode);
            ActionRegistry.MOVE_FOLDER.get(MoveFolderAction.class).setTargetNode(targetNode);
            ActionRegistry.MOVE_FOLDER.execute();
          }
        }
      }
    }
Example #3
0
  /** @return */
  private TreeNode getInboxTreeNode() {

    Tree treeData = this.tree.getData();
    TreeNode[] nodes = treeData.getChildren(treeData.getRoot());
    if (nodes != null && nodes.length > 0) {
      if (GWTUtil.getGwtFolder(nodes[0]) instanceof GWTMailbox) {
        nodes = treeData.getChildren(nodes[0]);
      }

      for (TreeNode node : nodes) {
        GWTMailFolder folder = (GWTMailFolder) GWTUtil.getGwtFolder(node);
        if (folder.isInbox()) {
          return (TreeNode) node;
        }
      }
    }
    return null;
  }
Example #4
0
  private void fireSearchEvent() {

    if (this.searchHandlerList != null) {
      String searchValue = (String) this.searchItem.getValue();
      if (GWTUtil.hasText(searchValue)) {
        this.searchValues = searchValue.split(" ");
      } else {
        this.searchValues = null;
      }
      for (SearchHandler handler : this.searchHandlerList) {
        handler.onSearch(this.searchFields, this.searchValues);
      }
    }
  }
Example #5
0
    public void onSelectionChanged(SelectionEvent event) {

      TreeNode selectedNode = (TreeNode) event.getRecord();
      IGWTFolder mailFolder = GWTUtil.getGwtFolder(selectedNode);
      if (!selectedNode.equals(currentTreeNode)) {
        currentTreeNode = selectedNode;
        prepareActions(selectedNode);
        changeToolbarButtonStatus(mailFolder);
        if (mailFolder instanceof GWTMailFolder) {
          GWTSessionManager.get().setCurrentMailFolder((GWTMailFolder) mailFolder);
          EventBroker.get().fireFolderSelected((GWTMailFolder) mailFolder);
        }
      }
    }
Example #6
0
    /**
     * Is new name empty or the same as before?
     *
     * @param event
     * @return
     */
    private boolean checkInput(EditorExitEvent event) {

      // only completion event ENTER is accepted
      if (!EditCompletionEvent.ENTER.equals(event.getEditCompletionEvent())) {
        return false;
      }
      String newName = event.getNewValue() != null ? event.getNewValue().toString() : null;
      String oldName = ((TreeNode) event.getRecord()).getName();
      if (!GWTUtil.hasText(newName) || newName.equalsIgnoreCase(oldName)) {
        this.alreadyDiscarded = true;
        tree.discardAllEdits();
        return false;
      }

      return true;
    }
Example #7
0
  /*
   * (non-Javadoc)
   *
   * @see
   * com.cubusmail.client.events.MessagesChangedListener#onMessagesChanged()
   */
  public void onMessagesChanged() {

    if (this.currentTreeNode != null) {
      final TreeNode selectedNode = this.currentTreeNode;
      ServiceProvider.getMailboxService()
          .getFormattedMessageCount(
              ((GWTMailFolder) GWTUtil.getGwtFolder(selectedNode)).getId(),
              new AsyncCallback<String>() {

                public void onFailure(Throwable caught) {

                  GWTExceptionHandler.handleException(caught);
                }

                public void onSuccess(String result) {

                  selectedNode.setTitle(result);
                }
              });
    }
  }