Package com.smartgwt.client.widgets.tree

Examples of com.smartgwt.client.widgets.tree.TreeNode


    MenuItem addChildSeq = new MenuItem();
    addChildSeq.setTitle("Sequance");
    addChildSeq
        .addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
          public void onClick(MenuItemClickEvent event) {
            TreeNode node = newChild(Sequence);
            node.setAttribute(Type, Sequence);
            node.setAttribute(Min, 1);
            node.setAttribute(Max, 1);

          }
        });
    mainMenu.addItem(addChildSeq);

    MenuItem addChildChoce = new MenuItem();
    addChildChoce.setTitle("Choice");
    addChildChoce
        .addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
          public void onClick(MenuItemClickEvent event) {
            TreeNode node = newChild(Choice);
            node.setAttribute("Type", Choice);
            node.setAttribute("Min", 1);
            node.setAttribute("Max", 1);

          }
        });
    mainMenu.addItem(addChildChoce);

    MenuItem addChildSimple = new MenuItem();
    addChildSimple.setTitle("Simple");
    addChildSimple
        .addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
          public void onClick(MenuItemClickEvent event) {
            TreeNode node = newChild(Simple);
            node.setAttribute(Type, Simple);
            node.setAttribute(Min, 1);
            node.setAttribute(Max, 1);
          }
        });
    mainMenu.addItem(addChildSimple);

    return mainMenu;
View Full Code Here


    return mainMenu;
  }

  private TreeNode newChild(String type) {
    TreeNode newNode = new TreeNode();
    TreeNode selected = (TreeNode) treeGrid.getSelectedRecord();
    if (selected == null)
      selected = rootNode;
    newNode.setAttribute(Name, getUniqueName(type, selected));
    treeGrid.getTree().add(newNode, selected);
    treeGrid.getTree().openFolder(selected);
View Full Code Here

  }

  private void paste() {
    if (copy != null) {
      TreeNode toPaste = clone(copy);
      TreeNode selected = (TreeNode) treeGrid.getSelectedRecord();
      treeGrid.getTree().add(toPaste, selected);
      treeGrid.getTree().openFolder(selected);
    }

  }
View Full Code Here

    }

  }

  private TreeNode clone(TreeNode copy2) {
    TreeNode result = new TreeNode();
    for (String attr : copy2.getAttributes()) {
      if (!attr.startsWith("_") && !attr.startsWith("$"))
        result.setAttribute(attr, copy2.getAttribute(attr));
    }
    for (TreeNode child : treeGrid.getTree().getChildren(copy2)) {
      treeGrid.getTree().add(clone(child), result);
    }
View Full Code Here

    }

    if (parent.getChildren() != null)
      for (Struct child : parent.getChildren()) {
        TreeNode newNode = new TreeNode();
        treeGrid.getTree().add(newNode, node);
        getTreeNode(child, treeGrid, newNode);
      }

  }
View Full Code Here

  public static TreeNode[] createAddressFolderTreeNodes( List<AddressFolder> folderList ) {

    TreeNode[] nodes = new TreeNode[folderList.size()];
    for (int i = 0; i < folderList.size(); i++) {
      AddressFolder folder = folderList.get( i );
      nodes[i] = new TreeNode( folder.getName() );
      nodes[i].setAttribute( "icon", ImageProvider.ADDRESS_FOLDER );
      nodes[i].setID( folder.getName() );
      nodes[i].setAttribute( GWTConstants.ADDRESS_FOLDER, folder );
    }
View Full Code Here

   * @param mailFolder
   * @return
   */
  public static TreeNode createTreeNode( IGWTFolder mailFolder ) {

    TreeNode node = new TreeNode( mailFolder.getName() );
    node.setAttribute( "icon", getFolderIcon( mailFolder ) );
    node.setID( mailFolder.getId() );
    node.setCanAcceptDrop( true );
    if ( mailFolder.isMoveSupported() ) {
      node.setCanDrag( true );
    }
    else {
      node.setCanDrag( false );
    }
    GWTUtil.setGwtFolder( node, mailFolder );

    if ( mailFolder.getSubfolders() != null && mailFolder.getSubfolders().length > 0 ) {
      TreeNode[] nodes = new TreeNode[mailFolder.getSubfolders().length];
      for (int i = 0; i < mailFolder.getSubfolders().length; i++) {
        nodes[i] = createTreeNode( mailFolder.getSubfolders()[i] );
        nodes[i].setAttribute( GWTConstants.PARAM_PARENT_FOLDER, node );
      }
      node.setChildren( nodes );
    }

    return node;
  }
View Full Code Here

   */
  @Override
  protected void executeAdd( final String requestId, final DSRequest request, final DSResponse response ) {

    JavaScriptObject jsObject = request.getAttributeAsJavaScriptObject( GWTConstants.PARAM_PARENT_FOLDER );
    TreeNode parentNode = TreeNode.getOrCreateRef( jsObject );
    String parentId = parentNode.getAttributeAsString( "id" );
    TreeNode newFolderNode = TreeNode.getOrCreateRef( request.getData() );
    String folderName = newFolderNode.getName();

    ServiceProvider.getMailboxService().createFolder( parentId, folderName, new AsyncCallback<GWTMailFolder>() {

      public void onSuccess( GWTMailFolder result ) {

        TreeNode newNode = UIFactory.createTreeNode( result );
        response.setData( new TreeNode[] { newNode } );
        processResponse( requestId, response );
      }

      public void onFailure( Throwable caught ) {
View Full Code Here

   */
  private void mapResponse( DSResponse response, GWTMailFolder[] folderTree ) {

    GWTMailbox mailbox = GWTSessionManager.get().getMailbox();
    mailbox.setMailFolders( folderTree );
    TreeNode root = UIFactory.createTreeNode( mailbox );
    response.setData( new TreeNode[] { root } );
  }
View Full Code Here

    this.tree.addEditorEnterHandler( new EditorEnterHandler() {

      public void onEditorEnter( EditorEnterEvent event ) {

        // block unauthorized editing
        TreeNode node = (TreeNode) event.getRecord();
        if ( !GWTUtil.getGwtFolder( node ).isRenameSupported() ) {
          tree.cancelEditing();
        }
        editorExitHandler.setAlreadyDiscarded( false );
      }
View Full Code Here

TOP

Related Classes of com.smartgwt.client.widgets.tree.TreeNode

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.