All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nosi.core.gui.components.IGRPMenu Maven / Gradle / Ivy

Go to download

IGRP Framework is a powerful and highly customizable platform developed by the Operational Nucleus for the Information Society (NOSi) to create web applications, it provides out of box, several modules to make easy to create stand-alone, production-grade web applications: authentication and access-control, business processes automation, reporting, page builder with automatic code generation and incorporation of the Once-Only-Principle, written in Java. IGRP Framework WAR - Contains some keys resources that give UI to IGRP Framework and others supports files.

There is a newer version: 2.0.0.241121-RCM
Show newest version
package nosi.core.gui.components;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: Emanuel Pereira
 * 28 Sep 2017
 
* Description: class to generate xml for Menu
*
/*

		Activiti REST - 
		redglobal.glb_db.save_favourite?p_id=
		
			Deployed
			
				Processo Manipulação
				https://nosiappsdev.gov.cv/redglobal_lab/!REDGLOBAL.GLB_DISPATCHER.main?igrpaddcbecdae=53599590500408406218&p_env_dad=//ce&p_env_menu=//C9C6C9CCCD&p_prm_definitionId=ProcTeste1:1:150264&p_prm_definitionKey=ProcTeste1&p_prm_processName=PROCESSO MANIPULACAO
				
				
				LEFT_MENU
			
			....
		

*/
public class IGRPMenu extends IGRPComponent{
	private String title;
	private String link;
	private List menus;
	private List listMenu;
	
	public IGRPMenu(String tag_name) {
		super(tag_name);
	}
	
	public IGRPMenu(String title, String link) {
		this(null);
		this.title = title;
		this.link = link;
		this.menus = new ArrayList<>();
	}

	public IGRPMenu(String tag_name, String title, String link, List menus) {
		this(tag_name, title);
		this.link = link;
		this.menus = menus;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	public List getMenus() {
		return menus;
	}

	public void setMenus(List menus) {
		this.menus = menus;
	}
	
	public void addMenu(Menu menu){
		this.menus.add(menu);
	}
	
	public List getListMenu() {
		return listMenu;
	}

	public void setListMenu(List listMenu) {
		this.listMenu = listMenu;
	}


	public static class Menu{

		private String title;
		private List submenus;
		
		public Menu(){
			this.submenus = new ArrayList<>();
		}
		public Menu(String title) {
			this();
			this.title = title;
		}
		
		public Menu(String title, List submenus) {
			this(title);
			this.title = title;
			this.submenus = submenus;
		}

		public String getTitle() {
			return title;
		}
		public void setTitle(String title) {
			this.title = title;
		}
		public List getSubmenus() {
			return submenus;
		}
		public void setSubmenus(List submenus) {
			this.submenus = submenus;
		}
		
		public void addSubMenu(String title,String link,String id, boolean status,String target){
			this.submenus.add(new SubMenu(title, link, id, status, target));
		}
		
		public void addSubMenu(SubMenu submenu){
			this.submenus.add(submenu);
		}
	}
	public static class SubMenu{
		private String title;
		private String link;
		private String id;
		private boolean status;
		private String target;
		
		public SubMenu(String title, String link, String id, boolean status, String target) {
			super();
			this.title = title;
			this.link = link;
			this.id = id;
			this.status = status;
			this.target = target;
		}
		
		public String getTitle() {
			return title;
		}
		public void setTitle(String title) {
			this.title = title;
		}
		public String getLink() {
			return link;
		}
		public void setLink(String link) {
			this.link = link;
		}
		public String getId() {
			return id;
		}
		public void setId(String id) {
			this.id = id;
		}
		public boolean getStatus() {
			return status;
		}
		public void setStatus(boolean status) {
			this.status = status;
		}
		public String getTarget() {
			return target;
		}
		public void setTarget(String target) {
			this.target = target;
		}
	}
	@Override
	public String toString() {
		if(!this.listMenu.isEmpty()){
			for(IGRPMenu igrpMenu:this.listMenu){
				xml.startElement("menus");
				xml.setElement("title", igrpMenu.getTitle());
				xml.setElement("link", igrpMenu.getLink());
				for(Menu menu:igrpMenu.getMenus()){
					xml.startElement("menu");
						xml.setElement("title", menu.getTitle());
						for(SubMenu submenu:menu.getSubmenus()){
							xml.startElement("submenu");
								xml.setElement("title", submenu.getTitle());
								xml.setElement("link", submenu.getLink());
								xml.setElement("id", submenu.getId());
								xml.setElement("status", ""+submenu.getStatus());
								xml.setElement("target", submenu.getTarget());
							xml.endElement();
						}
					xml.endElement();
				}
				xml.endElement();
			}
		}
		this.listMenu = null;
		return xml.toString();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy