Author: thanh_tung_do
Date: 2010-07-01 23:56:24 -0400 (Thu, 01 Jul 2010)
New Revision: 3545
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java
portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java
Log:
Update Java API document
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java 2010-07-01
10:55:16 UTC (rev 3544)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java 2010-07-02
03:56:24 UTC (rev 3545)
@@ -148,12 +148,29 @@
removal = new GateInSkinConfigRemoval(portalContainerName, this);
}
+ /**
+ * add category into portletThemes_ if portletThemes does not contain one
+ * @param categoryName: category's name that want to add into portletThemes_
+ */
public void addCategoryTheme(String categoryName)
{
if (!portletThemes_.containsKey(categoryName))
portletThemes_.put(categoryName, new HashSet<String>());
}
+ /**
+ * Register the stylesheet for a portal Skin. Do not replace any previous skin
+ *
+ * @param module
+ * skin module identifier
+ * @param skinName
+ * skin name
+ * @param cssPath
+ * path uri to the css file. This is relative to the root context,
+ * use leading '/'
+ * @param scontext
+ * the webapp's {@link javax.servlet.ServletContext}
+ */
public void addPortalSkin(String module, String skinName, String cssPath,
ServletContext scontext)
{
addPortalSkin(module, skinName, cssPath, scontext, false);
@@ -190,7 +207,20 @@
}
}
}
-
+
+ /**
+ * Register the stylesheet for a portal Skin.
+ *
+ * @param module
+ * skin module identifier
+ * @param skinName
+ * skin name
+ * @param cssPath
+ * path uri to the css file. This is relative to the root context,
+ * use leading '/'
+ * @param cssData
+ * the content of css
+ */
public void addPortalSkin(String module, String skinName, String cssPath, String
cssData)
{
SkinKey key = new SkinKey(module, skinName);
@@ -208,6 +238,7 @@
rtCache.put(cssPath, new CachedStylesheet(cssData));
}
+
public void addSkin(String module, String skinName, String cssPath, ServletContext
scontext)
{
addSkin(module, skinName, cssPath, scontext, false);
@@ -236,6 +267,22 @@
mainResolver.resolvers.addIfAbsent(resolver);
}
+ /**
+ *
+ * Register the Skin for available portal Skins.
+ *
+ * @param module
+ * skin module identifier
+ * @param skinName
+ * skin name
+ * @param cssPath
+ * path uri to the css file. This is relative to the root context,
+ * use leading '/'
+ * @param scontext
+ * the webapp's {@link javax.servlet.ServletContext}
+ * @param overwrite
+ * if any previous skin should be replaced by that one
+ */
public void addSkin(String module, String skinName, String cssPath, ServletContext
scontext, boolean overwrite)
{
availableSkins_.add(skinName);
@@ -248,6 +295,22 @@
}
}
+ /**
+ *
+ * Register the Skin for available portal Skins. Do not replace existed Skin
+ *
+ * @param module
+ * skin module identifier
+ * @param skinName
+ * skin name
+ * @param cssPath
+ * path uri to the css file. This is relative to the root context,
+ * use leading '/'
+ * @param scontext
+ * the webapp's {@link javax.servlet.ServletContext}
+ * @param overwrite
+ * if any previous skin should be replaced by that one
+ */
public void addSkin(String module, String skinName, String cssPath, String cssData)
{
availableSkins_.add(skinName);
@@ -261,6 +324,13 @@
rtCache.put(cssPath, new CachedStylesheet(cssData));
}
+ /**
+ * Registry theme category with its themes for portlet Theme
+ * @param categoryName
+ * category name that will be registried
+ * @param themesName
+ * list theme name of categoryName
+ */
public void addTheme(String categoryName, List<String> themesName)
{
if (!portletThemes_.containsKey(categoryName))
@@ -315,7 +385,15 @@
return null;
}
}
-
+ /**
+ * Render css content of the file specified by the given URI
+ * @param renderer
+ * the webapp's {@link org.exoplatform.portal.resource.ResourceRenderer}
+ * @param path
+ * path uri to the css file
+ * @throws RenderingException
+ * @throws IOException
+ */
public void renderCSS(ResourceRenderer renderer, String path) throws
RenderingException, IOException
{
Orientation orientation = Orientation.LT;
@@ -363,12 +441,25 @@
}
}
+ /**
+ * get css content of URI file
+ * @param cssPath
+ * path uri to the css file
+ * @return css content of URI file
+ */
public String getMergedCSS(String cssPath)
{
CachedStylesheet stylesheet = ltCache.get(cssPath);
return stylesheet != null ? stylesheet.getText() : null;
}
+ /**
+ * Get all SkinConfig of Portal Skin
+ * @param skinName
+ * name of Portal Skin
+ * @return
+ * all org.exoplatform.portal.resource.SkinConfig of Portal Skin
+ */
public Collection<SkinConfig> getPortalSkins(String skinName)
{
Set<SkinKey> keys = portalSkins_.keySet();
@@ -386,6 +477,12 @@
return portletThemes_;
}
+ /**
+ * Get SkinConfig by module and skin name
+ * @param module
+ * @param skinName
+ * @return
+ */
public SkinConfig getSkin(String module, String skinName)
{
SkinConfig config = skinConfigs_.get(new SkinKey(module, skinName));
@@ -400,6 +497,12 @@
skinConfigs_.remove(key);
}
+ /**
+ * Remove SkinConfig from Portal Skin Configs by module and skin name
+ * @param module
+ * @param skinName
+ * @throws Exception
+ */
public void remove(String module, String skinName) throws Exception
{
SkinKey key;
@@ -410,11 +513,23 @@
skinConfigs_.remove(key);
}
+ /**
+ * Remove Skin from Portal available Skin by skin name
+ * @param skinName
+ * name of skin that will be removed
+ * @throws Exception
+ */
public void removeSupportedSkin(String skinName) throws Exception
{
availableSkins_.remove(skinName);
}
+ /**
+ * Remove SkinConfig from Portal Skin Config by SkinKey
+ * @param keys
+ * SkinKey list these will be removed
+ * @throws Exception
+ */
public void remove(List<SkinKey> keys) throws Exception
{
if (keys == null)
@@ -427,6 +542,10 @@
}
}
+ /**
+ * get quantity of Portal Skin Config
+ * @return
+ */
public int size()
{
return skinConfigs_.size();
@@ -601,7 +720,12 @@
}
return suffixMap.get(orientation);
}
-
+
+ /**
+ * Get all available skin
+ * @return all available skin
+ *
+ */
@Managed
@ManagedDescription("The list of registered skins identifiers")
public String[] getSkinList()
@@ -623,6 +747,9 @@
mainResolver.registerContext(sContext);
}
+ /**
+ * Clean cache, reload all Skins
+ */
@Managed
@ManagedDescription("Reload all skins")
@Impact(ImpactType.WRITE)
@@ -633,6 +760,11 @@
rtCache.clear();
}
+ /**
+ * reload skin by skin ID
+ * @param skinId
+ * the skin ID that will be reloaded
+ */
@Managed
@ManagedDescription("Reload a specified skin")
public void reloadSkin(@ManagedDescription("The skin id")
@ManagedName("skinId") String skinId)
@@ -641,12 +773,20 @@
rtCache.remove(skinId);
}
+ /**
+ * Start service
+ * @see org.picocontainer.Startable#start()
+ */
public void start()
{
DefaultServletContainerFactory.getInstance().getServletContainer().addWebAppListener(deployer);
DefaultServletContainerFactory.getInstance().getServletContainer().addWebAppListener(removal);
}
+ /**
+ * Stop service
+ * @see org.picocontainer.Startable#stop()
+ */
public void stop()
{
DefaultServletContainerFactory.getInstance().getServletContainer().removeWebAppListener(deployer);
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java
===================================================================
---
portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java 2010-07-01
10:55:16 UTC (rev 3544)
+++
portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigService.java 2010-07-02
03:56:24 UTC (rev 3545)
@@ -69,7 +69,7 @@
}
/**
- * return a collection list This method should return the availables scripts
+ * Return a collection list This method should return the availables scripts
* in the service
*
* @return
@@ -79,11 +79,26 @@
return availableScripts_;
}
+ /**
+ * return a collection list This method should return the availables script paths
+ * @return
+ */
public Collection<String> getAvailableScriptsPaths()
{
return availableScriptsPaths_;
}
+ /**
+ * Add extended JavaScript into available JavaScript
+ * @param module
+ * module name
+ * @param scriptPath
+ * URI path of JavaScript
+ * @param scontext
+ * the webapp's {@link javax.servlet.ServletContext}
+ * @param scriptData
+ * Content of JavaScript that will be added into available JavaScript
+ */
public synchronized void addExtendedJavascript(String module, String scriptPath,
ServletContext scontext, String scriptData)
{
String servletContextName = scontext.getServletContextName();
@@ -93,6 +108,11 @@
extendedJavascripts.put(path, scriptData);
}
+ /**
+ * Clear available JavaScript and add new JavaScripts
+ * @param jsKeys
+ * new list of JavaScript will replace current available JavaScript
+ */
@SuppressWarnings("unchecked")
public synchronized void addJavascripts(List<Javascript> jsKeys)
{
@@ -125,6 +145,11 @@
}
}
+ /**
+ * Add an JavaScript into available JavaScript
+ * @param javascript
+ * JavaScript will be added into available JavaScript
+ */
private void addJavascript(Javascript javascript)
{
availableScripts_.add(javascript.getKey().getModule());
@@ -170,6 +195,12 @@
mergedJavascript = mergedJavascript.concat(sB.toString());
}
+ /**
+ * Remove JavaScripts from availabe JavaScipts by ServletContext
+ * @param scontext
+ * the webapp's {@link javax.servlet.ServletContext}
+ *
+ */
public synchronized void remove(ServletContext context)
{
// We clone to avoid concurrent modification exception
@@ -181,6 +212,11 @@
}
}
+ /**
+ * Remove JavaScript from available JavaScripts
+ * @param script
+ * JavaScript will be removed
+ */
public synchronized void removeJavascript(Javascript script)
{
availableScripts_.remove(script.getKey().getModule());
@@ -198,7 +234,9 @@
}
}
- /** Refresh the mergedJavascript **/
+ /**
+ * Refresh the mergedJavascript
+ */
public void refreshMergedJavascript()
{
mergedJavascript = "";
@@ -263,11 +301,26 @@
out.write(jsBytes);
}
+ /**
+ * Check the existence of module in Available Scripts
+ * @param module
+ * @return
+ */
public boolean isModuleLoaded(CharSequence module)
{
return getAvailableScripts().contains(module);
}
+ /**
+ * Remove JavaScript from available JavaScripts and extended JavaScripts
+ * @param module
+ * module will be removed
+ * @param scriptPath
+ * URI of script that will be removed
+ * @param scontext
+ * the webapp's {@link javax.servlet.ServletContext}
+ *
+ */
public void removeExtendedJavascript(String module, String scriptPath, ServletContext
scontext)
{
String servletContextName = scontext.getServletContextName();
@@ -278,12 +331,20 @@
jsBytes = null;
}
+ /**
+ * Start service
+ * @see org.picocontainer.Startable#start()
+ */
public void start()
{
DefaultServletContainerFactory.getInstance().getServletContainer().addWebAppListener(deployer);
DefaultServletContainerFactory.getInstance().getServletContainer().addWebAppListener(removal);
}
+ /**
+ * Stop service
+ * @see org.picocontainer.Startable#stop()
+ */
public void stop()
{
DefaultServletContainerFactory.getInstance().getServletContainer().removeWebAppListener(deployer);