Package com.google.gwt.view.client

Examples of com.google.gwt.view.client.TreeViewModel


          int imageWidth = nodeView.tree.getImageWidth();
          int paddingLeft = imageWidth * nodeView.depth;

          // Render the child nodes.
          ProvidesKey<C> providesKey = nodeInfo.getProvidesKey();
          TreeViewModel model = nodeView.tree.getTreeViewModel();
          for (C value : values) {
            Object key = providesKey.getKey(value);
            boolean isOpen = savedViews.containsKey(key);

            // Outer div contains image, value, and children (when open).
            sb.append("<div>");

            // The selection pads the content based on the depth.
            sb.append("<div style='padding-left:");
            sb.append(paddingLeft);
            sb.append("px;' class='").append(itemStyle);
            if (isOpen) {
              sb.append(" ").append(openStyle);
            }
            if (isRootNode) {
              sb.append(" ").append(topStyle);
            }
            if (selectionModel != null && selectionModel.isSelected(value)) {
              sb.append(" ").append(selectedStyle);
            }
            sb.append("'>");

            // Inner div contains image and value.
            sb.append("<div onclick='' style='position:relative;padding-left:");
            sb.append(imageWidth);
            sb.append("px;' class='").append(itemImageValueStyle);
            if (isRootNode) {
              sb.append(" ").append(topImageValueStyle);
            }
            sb.append("'>");

            // Add the open/close icon.
            if (isOpen) {
              sb.append(openImage);
            } else if (model.isLeaf(value)) {
              sb.append(LEAF_IMAGE);
            } else {
              sb.append(closedImage);
            }

View Full Code Here


          }
        }

        // Render the child nodes.
        ProvidesKey<C> keyProvider = nodeInfo.getProvidesKey();
        TreeViewModel model = nodeView.tree.getTreeViewModel();
        for (int i = start; i < end; i++) {
          C value = values.get(i - start);
          Object key = keyProvider.getKey(value);
          boolean isOpen = openNodes.contains(key);

          // Outer div contains image, value, and children (when open)
          StringBuilder outerClasses = new StringBuilder(itemStyle);
          if (isOpen) {
            outerClasses.append(openStyle);
          }
          if (isRootNode) {
            outerClasses.append(topStyle);
          }
          if (selectionModel != null && selectionModel.isSelected(value)) {
            outerClasses.append(selectedStyle);
          }

          // Inner div contains image and value
          StringBuilder innerClasses = new StringBuilder(itemStyle);
          innerClasses.append(itemImageValueStyle);
          if (isRootNode) {
            innerClasses.append(topImageValueStyle);
          }
          // Add the open/close icon.
          SafeHtml image;
          if (isOpen) {
            image = openImage;
          } else if (model.isLeaf(value)) {
            image = LEAF_IMAGE;
          } else {
            image = closedImage;
          }
          // Render cell contents
View Full Code Here

          }
        }

        // Render the child nodes.
        ProvidesKey<C> keyProvider = nodeInfo.getProvidesKey();
        TreeViewModel model = nodeView.tree.getTreeViewModel();
        for (int i = start; i < end; i++) {
          C value = values.get(i - start);
          Object key = keyProvider.getKey(value);
          boolean isOpen = openNodes.contains(key);

          // Outer div contains image, value, and children (when open)
          StringBuilder outerClasses = new StringBuilder(itemStyle);
          if (isOpen) {
            outerClasses.append(openStyle);
          }
          if (isRootNode) {
            outerClasses.append(topStyle);
          }
          if (selectionModel != null && selectionModel.isSelected(value)) {
            outerClasses.append(selectedStyle);
          }

          // Inner div contains image and value
          StringBuilder innerClasses = new StringBuilder(itemStyle);
          innerClasses.append(itemImageValueStyle);
          if (isRootNode) {
            innerClasses.append(topImageValueStyle);
          }
          // Add the open/close icon.
          SafeHtml image;
          if (isOpen) {
            image = openImage;
          } else if (model.isLeaf(value)) {
            image = LEAF_IMAGE;
          } else {
            image = closedImage;
          }
          // Render cell contents
View Full Code Here

        assertEquals(call, key);
      }
    };

    // Create a model with only one level, and three values at that level.
    TreeViewModel model = new TreeViewModel() {
      @Override
      public NodeInfo<?> getNodeInfo(Object value) {
        // The key provider returns the first char as an integer.
        ProvidesKey<String> keyProvider = new ProvidesKey<String>() {
          @Override
View Full Code Here

  }

  public void testRefreshEmptyNode() {
    // An empty data provider.
    final ListDataProvider<String> provider = new ListDataProvider<String>();
    TreeViewModel model = new TreeViewModel() {
      @Override
      public NodeInfo<?> getNodeInfo(Object value) {
        TextCell cell = new TextCell();
        return new DefaultNodeInfo<String>(provider, cell);
      }
View Full Code Here

    final ListDataProvider<Integer> root = new ListDataProvider<Integer>();
    for (int i = 0; i < 9; i++) {
      root.getList().add(i);
    }

    TreeViewModel model = new TreeViewModel() {
      @Override
      public NodeInfo<?> getNodeInfo(Object value) {
        if (value == null) {
          // Return the root node.
          return new DefaultNodeInfo<Integer>(root, intCell);
View Full Code Here

  }

  public void onModuleLoad() {
    // Create a model for the browser.
    TreeViewModel model = new CustomTreeModel();

    /*
     * Create the browser using the model. We use <code>null</code> as the
     * default value of the root node. The default value will be passed to
     * CustomTreeModel#getNodeInfo();
 
View Full Code Here

  }

  public void onModuleLoad() {
    // Create a model for the tree.
    TreeViewModel model = new CustomTreeModel();

    /*
     * Create the tree using the model. We use <code>null</code> as the default
     * value of the root node. The default value will be passed to
     * CustomTreeModel#getNodeInfo();
 
View Full Code Here

    }
  }

  public void onModuleLoad() {
    // Create a model for the browser.
    TreeViewModel model = new CustomTreeModel();

    /*
     * Create the browser using the model. We specify the default value of the
     * hidden root node as "Item 1".
     */
 
View Full Code Here

    }
  }

  public void onModuleLoad() {
    // Create a model for the tree.
    TreeViewModel model = new CustomTreeModel();

    /*
     * Create the tree using the model. We specify the default value of the
     * hidden root node as "Item 1".
     */
 
View Full Code Here

TOP

Related Classes of com.google.gwt.view.client.TreeViewModel

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.