de.chandre.admintool.core.AdminTool Maven / Gradle / Ivy
package de.chandre.admintool.core;
import java.util.Comparator;
import java.util.Map;
import java.util.Set;
import de.chandre.admintool.core.component.AdminComponent;
/**
* AdminTool core interface to get and add components.
* a component represents a main menu entry with possible sub menu entries
* it's also possible to add custom java scripts and css
*
* @author Andre
*
*/
public interface AdminTool {
/**
* just a slash
*/
String SLASH = "/";
/**
* name of admintool.
*/
String ROOTCONTEXT_NAME = "admintool";
/**
* root context path with a leading slash
*/
String ROOTCONTEXT = SLASH + ROOTCONTEXT_NAME;
/**
* path to default error template: admintool/content/error
*/
String GENERIC_ERROR_TPL_PATH = ROOTCONTEXT_NAME + SLASH + "content" + SLASH + "error";
/**
* to set a custom comparator for ordering components.
*
* @since 1.0.1
* @param comparator own comparator or null. if null the default compare implementation of AdminComponent will be used
*/
void setComponentComparator(Comparator comparator);
/**
*
* @return
*/
public Set getComponents();
/**
*
* @param components
*/
public void addComponent(AdminComponent components);
/**
*
* @param components
*/
public void addComponents(Set components);
/**
* A map with script url as key and a boolean if it's a relative url
* Example:
*
* getGlobalJavaScripts().put("/static/myComponent/js/myScript.js", true);
* getGlobalJavaScripts().put("http://example.com/script.js", false);
*
* @return
*/
public Map getGlobalJavaScripts();
/**
* Example:
*
* addGlobalJavaScript("/static/myComponent/js/myScript.js", true);
* addGlobalJavaScript("http://example.com/script.js", false);
*
*
* @param globalJavaScript
* @param relative if url is relative (not absolute) and pointing to the server
*/
public void addGlobalJavaScript(String globalJavaScript, boolean relative);
/**
* A map with css url as key and a boolean if it's a relative url
* Example:
*
* getGlobalStyleSheets().put("/static/myComponent/css/myStyles.css", true);
* getGlobalStyleSheets().put("http://example.com/styles.css", false);
*
* @return
*/
public Map getGlobalStyleSheets();
/**
* Example:
*
* addGlobalStyleSheet("/static/myComponent/css/myStyles.css", true);
* addGlobalStyleSheet("http://example.com/styles.css", false);
*
*
* @param globalStyleSheet
* @param relative if url is relative (not absolute) and pointing to the server
*/
public void addGlobalStyleSheet(String globalStyleSheet, boolean relative);
/**
* searches for a menuEntry with specified name
* @since 1.0.1
* @param menuName
* @return null or MenuEntrySearchResult
*/
MenuEntrySearchResult searchComponent(String menuName);
}