org.odlabs.wiquery.core
Class WiQuerySettings

java.lang.Object
  extended by org.odlabs.wiquery.core.WiQuerySettings
All Implemented Interfaces:
Serializable

public class WiQuerySettings
extends Object
implements Serializable

$Id: WiQuerySettings.java 1050 2011-06-22 11:18:55Z hielke.hoeve@gmail.com $

Bean to get the wiQuery settings

Since:
1.1
Author:
Julien Roche
See Also:
Serialized Form

Constructor Summary
WiQuerySettings()
           
 
Method Summary
 boolean addInitializer(IWiQueryInitializer initializer)
           
 boolean addListener(WiQueryPluginRenderingListener listener)
           
 String findResourceGroupingKey(String packageName)
           Looks for the package name in the list of preferred packages.
static WiQuerySettings get()
          Get WiQuerySettings for current thread.
 List<IWiQueryInitializer> getInitializers()
           
 List<WiQueryPluginRenderingListener> getListeners()
           
 List<String> getResourceGroupingKeys()
           
 boolean isAutoImportJQueryResource()
           
 boolean isAutoImportJQueryUIJavaScriptResource()
           
 boolean isAutoImportJQueryUIStyleSheetResource()
           
 boolean isEnableWiqueryResourceManagement()
           
 boolean isMinifiedJavaScriptResources()
           When true wiquery delivers minimized versions js files, when false wiquery delivers normal (non-minimized) versions.
 boolean isMinifiedStyleSheetResources()
           When true wiquery delivers minimized versions css files, when false wiquery delivers normal (non-minimized) versions.
 void setAutoImportJQueryResource(boolean autoImportJQueryResource)
           
 void setAutoImportJQueryUIJavaScriptResource(boolean autoImportJQueryUIJavaScriptResource)
          If set to false, no jQueryUI JavaScript resources are contributed by the framework, which means the user is responsible to add required resources (javascript files) for jQueryUI to work.
 void setAutoImportJQueryUIStyleSheetResource(boolean autoImportJQueryUIStyleSheetResource)
           
 void setEnableWiqueryResourceManagement(boolean enableWiqueryResourceManagement)
          If set to false, all resource contributions by Wiquery are disabled.
 void setMinifiedJavaScriptResources(boolean minifiedJavaScriptResources)
          Sets the minifiedJavaScriptResources option
 void setMinifiedStyleSheetResources(boolean minifiedStyleSheetResources)
          Sets the minifiedStyleSheetResources option
 void setResourceGroupingKeys(List<String> resourceGroupingKeys)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WiQuerySettings

public WiQuerySettings()
Method Detail

get

public static WiQuerySettings get()
Get WiQuerySettings for current thread.

Returns:
The settings

addInitializer

public boolean addInitializer(IWiQueryInitializer initializer)
Parameters:
initializer -
Returns:
true when not already added and false when already added.

addListener

public boolean addListener(WiQueryPluginRenderingListener listener)
Parameters:
listener -
Returns:
true when not already added and false when already added.

getInitializers

public List<IWiQueryInitializer> getInitializers()

getListeners

public List<WiQueryPluginRenderingListener> getListeners()

isAutoImportJQueryResource

public boolean isAutoImportJQueryResource()

isAutoImportJQueryUIJavaScriptResource

public boolean isAutoImportJQueryUIJavaScriptResource()

isAutoImportJQueryUIStyleSheetResource

public boolean isAutoImportJQueryUIStyleSheetResource()

isEnableWiqueryResourceManagement

public boolean isEnableWiqueryResourceManagement()

isMinifiedJavaScriptResources

public boolean isMinifiedJavaScriptResources()

When true wiquery delivers minimized versions js files, when false wiquery delivers normal (non-minimized) versions. The default value depends on whether an IJavaScriptCompressor is used or not.

This setting WILL NOT enable the YUICompressor, you can set this yourself using Application.getResourceSettings().setJavaScriptCompressor(new YUIJavaScriptCompressor()); in a IWiQueryInitializer..

Always provide the normal (non-minimized) version, wiquery will reference to the minimized version when isMinifiedJavaScriptResources() is true.

The filename format for the 2 versions is:

Returns:
the state of the minifiedResources option.

isMinifiedStyleSheetResources

public boolean isMinifiedStyleSheetResources()

When true wiquery delivers minimized versions css files, when false wiquery delivers normal (non-minimized) versions. The default value depends on whether an ICssCompressor is used or not.

This setting WILL NOT enable the YUICompressor, you can set this yourself using Application.getResourceSettings().setCssCompressor(new YUIStyleSheetCompressor()); in a IWiQueryInitializer.

Always provide the normal (non-minimized) version, wiquery will reference to the minimized version when isMinifiedStyleSheetResources() is true.

The filename format for the 2 versions is:

Returns:
the state of the minifiedResources option.

setAutoImportJQueryResource

public void setAutoImportJQueryResource(boolean autoImportJQueryResource)

setAutoImportJQueryUIJavaScriptResource

public void setAutoImportJQueryUIJavaScriptResource(boolean autoImportJQueryUIJavaScriptResource)
If set to false, no jQueryUI JavaScript resources are contributed by the framework, which means the user is responsible to add required resources (javascript files) for jQueryUI to work. Useful if one wants to manage resources globally or use a CDN network to load resources.

Warning: If version does not match to the version contributed by the framework, functionality may be harmed!

Parameters:
autoImportJQueryUIJavaScriptResource - true to let the framework import required resources. false to disable automatic resources contribution by the framework.
See Also:
setEnableWiqueryResourceManagement(boolean)

setAutoImportJQueryUIStyleSheetResource

public void setAutoImportJQueryUIStyleSheetResource(boolean autoImportJQueryUIStyleSheetResource)

setEnableWiqueryResourceManagement

public void setEnableWiqueryResourceManagement(boolean enableWiqueryResourceManagement)
If set to false, all resource contributions by Wiquery are disabled. No jQuery or jQueryUI resource are contributed by the framework, nor any resources from plugins. Useful if one wants to manage resources globally or use a CDN network to load resources.

Warning: By setting this to false the frameworks functionality (or parts of it) is not guaranteed anymore! Activate only if you know what you do and import required resources manually.


setMinifiedJavaScriptResources

public void setMinifiedJavaScriptResources(boolean minifiedJavaScriptResources)
Sets the minifiedJavaScriptResources option

Parameters:
minifiedJavaScriptResources -
See Also:
isMinifiedJavaScriptResources()

setMinifiedStyleSheetResources

public void setMinifiedStyleSheetResources(boolean minifiedStyleSheetResources)
Sets the minifiedStyleSheetResources option

Parameters:
minifiedStyleSheetResources -
See Also:
isMinifiedStyleSheetResources()

getResourceGroupingKeys

public List<String> getResourceGroupingKeys()

setResourceGroupingKeys

public void setResourceGroupingKeys(List<String> resourceGroupingKeys)

findResourceGroupingKey

public String findResourceGroupingKey(String packageName)

Looks for the package name in the list of preferred packages.

When the full package name is not found we keep trying by removing a subpackage at a time and check if this is found.

For example: org.apache.wicket is listed and we have a package called org.apache.wicket.ajax.



Copyright © 2012. All Rights Reserved.