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

nosi.core.gui.components.IGRPToolsBar 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;
/**
 * @author: Emanuel Pereira
 * 
 * Apr 17, 2017
 *
 * Description: class to generate xml of tools-bar 
 */
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;

import nosi.core.gui.fields.FieldProperties;
import nosi.core.xml.XMLWritter;

public class IGRPToolsBar {
	
	protected String tag_name;
	protected List buttons;
	protected Object class_name = this;
	protected XMLWritter xml;
	protected String type = "toolsbar";
	protected FieldProperties properties;
	private boolean isVisible = true;
	
	public IGRPToolsBar(String tag_name) {
		this.tag_name = tag_name;
		this.buttons = new ArrayList<>();
		this.xml = new XMLWritter();
		this.properties = new FieldProperties();
		this.properties.add("type", this.type);
		this.properties.add("xml-type", this.type);
	}
	
	public void setClassName(Object class_name){
		this.class_name = class_name;
	}
	
	public String getClassName(){
		return this.class_name.getClass().getSimpleName();
	}
	
	public FieldProperties getProperties() {
		return properties;
	}

	public void setProperties(FieldProperties properties) {
		this.properties = properties;
	}

	public boolean isVisible() {
		return isVisible;
	}

	public void setVisible(boolean isVisible) {
		this.isVisible = isVisible;
	}

	public String toString(){
		return this.toXmlTools();
	}
	
	/*Generate xml item
	 *  
            Button
            
            
            
            _blank
            fa-dot-circle-o
            default|fa-dot-circle-o|www
        
	 */
	public String toXmlTools(){
		if(this.buttons!=null && !this.buttons.isEmpty()){
			xml.startElement(this.tag_name);
			if(this.getClassName().compareTo("IGRPToolsBar") == 0){
				for(Entry prop : properties.entrySet()) {
					if(prop.getKey()!=null && prop.getValue()!=null)
						xml.writeAttribute(prop.getKey().toString(), prop.getValue().toString());
				}
			}
			for(IGRPButton item:buttons){
				xml.addXml(item.toString());
			}
			xml.endElement();
		}
		this.buttons = null;
		return xml.toString();
	}
	
	/*Generate xml button
	 * 
	 */
	public String toXmlButton(){
		if(!this.buttons.isEmpty()){
			for(IGRPButton item:buttons){
				item.setTag("button");
				this.xml.addXml(item.toString());
			}
		}
		this.buttons = null;
		return xml.toString();
	}
	
	public void addButton(IGRPButton button){
		if(this.buttons!=null){
			button.propertie.put("type", "specific");
			this.buttons.add(button);
		}
	}
	
	public void setButtons(List buttons){
		if(this.buttons!=null)
			this.buttons = buttons;
	}
	
	public List getButtons(){
		return this.buttons;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy