Package org.apache.myfaces.trinidad.model

Examples of org.apache.myfaces.trinidad.model.ChildPropertyTreeModel$Node


      try
      {
        if (_menu == null)
        {
          List<PageImpl> al = _createPageList();
          TreeModel treeModel = new ChildPropertyTreeModel(al, "children");
          _menu = new MenuModelImpl(treeModel, "viewId", "/4.jspx");
        }

        return _menu;
      }
      catch(IntrospectionException e)
      {
        _LOG.severe(e);
        return null;
      }
    }
    else if ("navigationpath".equals(name))
    {
      try
      {
        if (_navigationpath == null)
        {
          List<PageImpl> al = _createPageList();
          TreeModel treeModel = new ChildPropertyTreeModel(al, "children");
          _navigationpath = new MenuModelImpl(treeModel, "viewId", "/7.jspx");
        }

        return _navigationpath;
      }
      catch(IntrospectionException e)
      {
        _LOG.severe(e);
        return null;
      }
    }
    else if ("simpleList".equals(name))
    {
      if (_simpleList == null)
      {
        _simpleList = new ArrayList<Map<String, Object>>();
        _simpleList.add(_createHashMap("First", 1));
        _simpleList.add(_createHashMap("Second", 2));
        _simpleList.add(_createHashMap("Three", 3));
        _simpleList.add(_createHashMap("Four", 4));
        _simpleList.add(_createHashMap("Five", 5));
        _simpleList.add(_createHashMap("Six", 6));
      }

      return _simpleList;
    }
    else if ("numberList".equals(name))
    {
      // A simple out-of-order list of numeric strings,
      // for use in the selectManyListbox test
      List<String> list = new ArrayList<String>(2);
      list.add("8");
      list.add("2");
      return list;
    }
    else if("iteratorList".equals(name))
    {
      if (_iteratorList == null)
      {
        // -= Simon Lessard =-
        // FIXME: _iteratorList will contains 5 null value since
        //        put return the value before the insertion at 
        //        specified key.
        // Ref: http://java.sun.com/j2se/1.5.0/docs/api/java/util/Map.html#put(K, V)
        _iteratorList = new ArrayList<String>();
        _iteratorList.add(new HashMap<String, String>().put("data","One"));
        _iteratorList.add(new HashMap<String, String>().put("data","Two"));
        _iteratorList.add(new HashMap<String, String>().put("data","Three"));
        _iteratorList.add(new HashMap<String, String>().put("data","Four"));
        _iteratorList.add(new HashMap<String, String>().put("data","Five"));
      }

      return _iteratorList;
    }
    else if("colorList".equals(name))
    {
      ArrayList<Color> colorList = new ArrayList<Color>();
      colorList.add(new Color(255, 0, 0));
      colorList.add(new Color(0, 0, 255));
      colorList.add(new Color(255, 255, 0));
      colorList.add(new Color(0, 255, 0));
      return colorList;
    }
    else if("treeModel".equals(name))
    {
      if (_treeModel == null)
      {
        Person john = new Person("John Smith");
        Person kim = new Person("Kim Smith");
        Person tom = new Person("Tom Smith");
        Person zoe = new Person("Zoe Smith");
        Person ira = new Person("Ira Wickrememsinghe");
        Person mallika = new Person("Mallika Wickremesinghe");

        john.getKids().add(kim);
        john.getKids().add(tom);
        tom.getKids().add(zoe);
        ira.getKids().add(mallika);

        List<Person> people = new ArrayList<Person>();
        people.add(john);
        people.add(ira);

        _treeModel = new ChildPropertyTreeModel(people, "kids");
      }

      return _treeModel;
    }
    else if("pathSet".equals(name))
View Full Code Here


      // Empty tree is created to prevent
      // later NPEs if menu model methods are called.
      _LOG.warning ("CREATE_TREE_WARNING: Empty Tree!");
     
      // Create empty treeModel
      ChildPropertyTreeModel treeModel = new ChildPropertyTreeModel();
                   
      // Put it in the map
      _treeModelMap.put(_currentTreeModelMapKey, treeModel);    
    }
    else
    {
      _menuList = _menuNodes.get(0);
     
      // Create the treeModel
      ChildPropertyTreeModel treeModel =
                    new ChildPropertyTreeModel(_menuList, "children");
                   
      // Put it in the map
      _treeModelMap.put(_currentTreeModelMapKey, treeModel);
     
      // If Model is the Root, then build Model's hashmaps
      // and set them on the Root Model.
      XMLMenuModel rootModel = getRootModel();
     
      if (rootModel == getModel())
      {
        _viewIdFocusPathMap = new HashMap<String,List<Object>>();
        _nodeFocusPathMap   = new HashMap<Object, List<Object>>();
        _idNodeMap          = new HashMap<String, Object>();
        Object oldPath      = treeModel.getRowKey();
    
        treeModel.setRowKey(null);
    
        // Populate the maps
        _addToMaps(treeModel, _viewIdFocusPathMap, _nodeFocusPathMap, _idNodeMap);
       
        // Cache the maps.  There is a possibility of multiple
        // root models so we must cache the maps on a per root model
        // basis.
        _viewIdFocusPathMapMap.put(_currentTreeModelMapKey, _viewIdFocusPathMap);
        _nodeFocusPathMapMap.put(_currentTreeModelMapKey, _nodeFocusPathMap);
        _idNodeMapMap.put(_currentTreeModelMapKey, _idNodeMap);
       
        treeModel.setRowKey(oldPath);
      }
    }
  }
View Full Code Here

    }
  }

  public static TreeModel createModel() throws IntrospectionException
  {
    TreeModel model = new ChildPropertyTreeModel(_ROOTS, "kids");
    return model;
  }
View Full Code Here

  public TreeModel getModel() throws IntrospectionException
  {
    if (_model == null)
    {
      _model = new ChildPropertyTreeModel(getInstance(), getChildProperty());
    }
    return _model;
  }
View Full Code Here

      // Empty tree is created to prevent
      // later NPEs if menu model methods are called.
      _LOG.warning ("CREATE_TREE_WARNING: Empty Tree!");
     
      // Create empty treeModel
      ChildPropertyTreeModel treeModel = new ChildPropertyTreeModel();
                   
      // Put it in the map
      _treeModelMap.put(_currentTreeModelMapKey, treeModel);    
    }
    else
    {
      _menuList = _menuNodes.get(0);
     
      // Create the treeModel
      ChildPropertyTreeModel treeModel =
                    new ChildPropertyTreeModel(_menuList, "children");
                   
      // Put it in the map
      _treeModelMap.put(_currentTreeModelMapKey, treeModel);
     
      // If Model is the Root, then build Model's hashmaps
      // and set them on the Root Model.
      XMLMenuModel rootModel = getRootModel();
     
      if (rootModel == getModel())
      {
        _viewIdFocusPathMap = new HashMap<String,List<Object>>();
        _nodeFocusPathMap   = new HashMap<Object, List<Object>>();
        _idNodeMap          = new HashMap<String, Object>();
        Object oldPath      = treeModel.getRowKey();
    
        treeModel.setRowKey(null);
    
        // Populate the maps
        _addToMaps(treeModel, _viewIdFocusPathMap, _nodeFocusPathMap, _idNodeMap);
       
        // Cache the maps.  There is a possibility of multiple
        // root models so we must cache the maps on a per root model
        // basis.
        _viewIdFocusPathMapMap.put(_currentTreeModelMapKey, _viewIdFocusPathMap);
        _nodeFocusPathMapMap.put(_currentTreeModelMapKey, _nodeFocusPathMap);
        _idNodeMapMap.put(_currentTreeModelMapKey, _idNodeMap);
       
        treeModel.setRowKey(oldPath);
      }
    }
  }
View Full Code Here

  public void endDocument()
  {
    _menuList = _menuNodes.get(0);
   
    // Create the treeModel
    ChildPropertyTreeModel treeModel =
                  new ChildPropertyTreeModel(_menuList, "children");
                 
    // Put it in the map
    _treeModelMap.put(_currentTreeModelMapKey, treeModel);
   
    // If Model is the Root, then build Model's hashmaps
    // and set them on the Root Model.
    XMLMenuModel rootModel = getRootModel();
   
    if (rootModel == getModel())
    {
      _viewIdFocusPathMap = new HashMap<String,List<Object>>();
      _nodeFocusPathMap   = new HashMap<Object, List<Object>>();
      _idNodeMap          = new HashMap<String, Object>();
      Object oldPath      = treeModel.getRowKey();

      treeModel.setRowKey(null);

      // Populate the maps
      _addToMaps(treeModel, _viewIdFocusPathMap, _nodeFocusPathMap, _idNodeMap);
     
      // Cache the maps.  There is a possibility of multiple
      // root models so we must cache the maps on a per root model
      // basis.
      _viewIdFocusPathMapMap.put(_currentTreeModelMapKey, _viewIdFocusPathMap);
      _nodeFocusPathMapMap.put(_currentTreeModelMapKey, _nodeFocusPathMap);
      _idNodeMapMap.put(_currentTreeModelMapKey, _idNodeMap);
     
      treeModel.setRowKey(oldPath);
    }
  }
View Full Code Here

                if (domainURI.equals(node.getDomainName())) {
                    currentDomain = node.getDomainName();
                    return true;
                }
            }
            Node node = factory.createNode(domainURI);
            currentDomain = node.getDomainName();
            nodes.put(currentDomain, node);
        }
        return true;
    }
View Full Code Here

        }
        return true;
    }

    boolean load(final String configXmlUrl) throws ContributionReadException, ActivationException, ValidationException {
        Node node = factory.createNodeFromXML(configXmlUrl);
        currentDomain = node.getDomainName();
        nodes.put(currentDomain, node);
        return true;
    }
View Full Code Here

            getNode().removeFromDomainLevelComposite(curi, toks.get(2));
        } else {
            if (standaloneNodes.containsKey(curi)) {
                standaloneNodes.remove(curi).stop();
            } else if (nodes.containsKey(curi)) {
                Node n = nodes.remove(curi);
                n.stop();
                if (n.getDomainName().equals(currentDomain)) {
                    currentDomain = "";
                }
            } else {
                for (String compositeURI : getNode().getDeployedComposites(curi)) {
                    getNode().removeFromDomainLevelComposite(curi, compositeURI);
View Full Code Here

        return true;
    }

    boolean start(String nodeName, String compositeURI, String contributionURL, String... dependentContributionURLs)
        throws ActivationException, ValidationException {
        Node node = NodeFactory.newStandaloneNode(compositeURI, contributionURL, dependentContributionURLs);
        standaloneNodes.put(nodeName, node);
        return true;
    }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidad.model.ChildPropertyTreeModel$Node

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.