Package net.sf.navigator.menu

Examples of net.sf.navigator.menu.MenuComponent


  protected void setUp() throws Exception {
    super.setUp();
    menuService = new MenuServiceImpl();
    oldRepository = new MenuRepository();
    MenuComponent mc = new MenuComponent();
    mc.setName("Exemple");
    mc.setTitle("Exemple");
    mc.setLocation("#");
    oldRepository.addMenu(mc);
    applications = new ArrayList();
    Application application = new Application("Appli1");
    applications.add(application);
    connections = new ArrayList();
View Full Code Here


  }

  public MenuRepository buildTree(MenuRepository oldRepository,
      String filter, String contextPath) throws Exception {
    if (filter == null || "".equals(filter.trim())) {
      MenuComponent rootMC = new MenuComponent();
      rootMC.setName(root);
      rootMC.setTitle(root);
      rootMC.setLocation(contextPath
          + "?method=build&decorator=popup&confirm=true&filter="
          + URLEncoderUtil.escape(root));
      oldRepository.addMenu(rootMC);
    } else {
      MenuComponent parent = getMenuComponent(oldRepository, filter);
      if (parent != null) {
        List children = getChildren(filter);
        parent.getComponents().clear();
        MenuComponent mc = null;
        for (Iterator it = children.iterator(); it.hasNext();) {
          String name = (String) it.next();
          mc = new MenuComponent();
          mc.setName(name);
          mc.setTitle(name);
          mc.setParent(parent);
          mc
              .setLocation(contextPath
                  + "?method=build&decorator=popup&confirm=true&filter="
                  + URLEncoderUtil.escape(getFullFilter(mc)));
        }
      }
View Full Code Here

  private MenuComponent getMenuComponent(MenuRepository repository,
      String filter) {
    List l = Arrays.asList(StringUtils.split(filter, ','));
    Collections.reverse(l);
    MenuComponent mc = repository.getMenu(root);
    String[] names = (String[]) l.toArray(new String[l.size()]);
    for (int i = 1; i < names.length; i++) {
      mc = getMenuComponentChild(mc, names[i]);
    }
    return mc;
View Full Code Here

    }
    return mc;
  }

  private MenuComponent getMenuComponentChild(MenuComponent mc, String name) {
    MenuComponent tmpmc = mc;
    for (Iterator it = mc.getComponents().iterator(); it.hasNext();) {
      tmpmc = (MenuComponent) it.next();
      if (tmpmc.getName().equals(name)) {
        break;
      }
    }
    return tmpmc;
  }
View Full Code Here

    return tmpmc;
  }

  private String getFullFilter(MenuComponent mc) {
    List l = new ArrayList();
    MenuComponent parent = mc.getParent();
    while (parent != null) {
      String name = parent.getName();
      if (name != null) {
        l.add(name);
      }
      parent = parent.getParent();
    }
    StringBuffer sb = new StringBuffer("");
    if (mc.getName() != null) {
      sb.append(mc.getName());
    }
View Full Code Here

  public MenuRepository buildMenu(MenuRepository oldRepository,
      Collection applications, Collection connexions, String isAppliModified, String currentAppli) {
        MenuRepository repository = new MenuRepository();
        repository.setDisplayers(oldRepository.getDisplayers());

        MenuComponent conMenu = new MenuComponent();
        conMenu.setName("Connections");
        conMenu.setTitle("Connections");
        conMenu.setLocation("javascript:saveBeforeLoad('"+isAppliModified+"','"+currentAppli+"','connection.do?method=init')");
    repository.addMenu(conMenu);
   
    for(Iterator it=connexions.iterator();it.hasNext();) {
          MenuComponent mc = new MenuComponent();
          Connection connection = (Connection) it.next();
          String name = connection.getName();
          mc.setName(name);
          mc.setTitle(name);
          mc.setLocation("javascript:saveBeforeLoad('"+isAppliModified+"','"+currentAppli+"','connection.do?method=edit&amp;forward=connection&amp;id="+URLEncoderUtil.escape(connection.getId())+"')");
          mc.setParent(conMenu);
    }

    MenuComponent appliMenu = new MenuComponent();
    appliMenu.setName("Applications");
        appliMenu.setTitle("Applications");
        appliMenu.setLocation("javascript:saveBeforeLoad('"+isAppliModified+"','"+currentAppli+"','application.do?method=init')");
    repository.addMenu(appliMenu);
    for(Iterator it=applications.iterator();it.hasNext();) {
          MenuComponent mc = new MenuComponent();
          Application application = (Application) it.next();
          String name = application.getName();
          mc.setName(name);
          mc.setTitle(name);
          mc.setLocation("javascript:saveBeforeLoad('"+isAppliModified+"','"+currentAppli+"','application.do?method=loadAppli&id="+URLEncoderUtil.escape(application.getId())+"')");
          mc.setParent(appliMenu);
    }
    return repository;
  }
View Full Code Here

    public MenuRepository buildConMenu(MenuRepository oldRepository,
        Collection applications, Collection connexions, String isConModified, String con) {
          MenuRepository repository = new MenuRepository();
          repository.setDisplayers(oldRepository.getDisplayers());

          MenuComponent conMenu = new MenuComponent();
          conMenu.setName("Connections");
          conMenu.setTitle("Connections");
          conMenu.setLocation("javascript:saveConBeforeLoad('"+isConModified+"','"+con+"','connection.do?method=init')");
      repository.addMenu(conMenu);
     
      for(Iterator it=connexions.iterator();it.hasNext();) {
            MenuComponent mc = new MenuComponent();
            Connection connection = (Connection) it.next();
            String name = connection.getName();
            mc.setName(name);
            mc.setTitle(name);
            mc.setLocation("javascript:saveConBeforeLoad('"+isConModified+"','"+con+"','connection.do?method=edit&amp;forward=connection&amp;id="+URLEncoderUtil.escape(connection.getId())+"')");
            mc.setParent(conMenu);
      }

      MenuComponent appliMenu = new MenuComponent();
      appliMenu.setName("Applications");
          appliMenu.setTitle("Applications");
          appliMenu.setLocation("javascript:saveConBeforeLoad('"+isConModified+"','"+con+"','application.do?method=init')");
      repository.addMenu(appliMenu);
      for(Iterator it=applications.iterator();it.hasNext();) {
            MenuComponent mc = new MenuComponent();
            Application application = (Application) it.next();
            String name = application.getName();
            mc.setName(name);
            mc.setTitle(name);
            mc.setLocation("javascript:saveConBeforeLoad('"+isConModified+"','"+con+"','application.do?method=loadAppli&id="+URLEncoderUtil.escape(application.getId())+"')");
            mc.setParent(appliMenu);
      }
      return repository;
    }
View Full Code Here

    List<OpcionMenu> opcionesMenu = opcionMenuDao.obtenerOpcionesMenuPorUsuario();
    for (Iterator<OpcionMenu> iterOpcion = opcionesMenu.iterator(); iterOpcion.hasNext();)
    {
     
      OpcionMenu opcionMenu = iterOpcion.next();       
        MenuComponent mc = new MenuComponent();
       
        String id = opcionMenu.getId().toString();
        String coOpcionMenuPadre = opcionMenu.getCoOpcionMenuPadre() == null ? null : opcionMenu.getCoOpcionMenuPadre().toString();
                 
        mc.setName(id);
        if (coOpcionMenuPadre != null)
        {
            MenuComponent parentMenu = repository.getMenu(coOpcionMenuPadre);       
            mc.setParent(parentMenu);
        }
       
        String title = opcionMenu.getDeOpcionMenu().toString();
        mc.setTitle(title)
View Full Code Here

TOP

Related Classes of net.sf.navigator.menu.MenuComponent

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.