本文整理汇总了Java中com.adobe.granite.ui.clientlibs.ClientLibrary类的典型用法代码示例。如果您正苦于以下问题:Java ClientLibrary类的具体用法?Java ClientLibrary怎么用?Java ClientLibrary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClientLibrary类属于com.adobe.granite.ui.clientlibs包,在下文中一共展示了ClientLibrary类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateClientLibraries
import com.adobe.granite.ui.clientlibs.ClientLibrary; //导入依赖的package包/类
/**
* This method generates the clientlib includes for the categories specified, taking into account the options
* specified using the com.xumak.base.util.ClientLibraryUtil#setOptions(boolean, boolean, boolean, boolean,
* boolean) method (like minification, cache buster, etc.).
*
* @param categories comma separated list with the client libraries categories
* @return the html tags to include the clientlibs
*/
public String generateClientLibraries(String categories) {
StringBuffer buffer = new StringBuffer();
String[] categoriesArray = splitStringToArray(categories);
if (this.cssCategories) {
List<ClientLibrary> cssClientLibraries = new ArrayList<>(htmlLibraryManager.getLibraries(categoriesArray,
LibraryType.CSS, false, false));
buildCssIncludes(cssClientLibraries, buffer);
}
if (this.jsCategories) {
List<ClientLibrary> jsClientLibraries = new ArrayList<>(htmlLibraryManager.getLibraries(categoriesArray,
LibraryType.JS, false, false));
buildJsIncludes(jsClientLibraries, buffer);
}
return buffer.toString();
}
示例2: buildJsIncludes
import com.adobe.granite.ui.clientlibs.ClientLibrary; //导入依赖的package包/类
/**
* Builds our Javascript include tags given an ArrayList of ClientLibrary objects
* and a StringBuffer.
*
* @param jsLibs -> our list of ClientLibrary objects.
* @param buffer -> our StringBuffer.
* @return void
**/
private void buildJsIncludes(List<ClientLibrary> jsLibs, StringBuffer buffer) {
for (ClientLibrary lib : jsLibs) {
LOG.debug("JS LIB : " + lib.getPath());
freshenLibrary(LibraryType.JS, lib.getPath());
String path = lib.getPath();
path = this.minificationChecker(path); // check minify option
path = this.browserCacheOptionChecker(lib.getPath(), path, LibraryType.JS);
try {
buffer.append("<script src=\"");
buffer.append(path + ".js");
buffer.append("\"></script>\n");
} catch (Exception e) {
LOG.error("Caught exception generating library path", e);
}
}
}
示例3: buildCssIncludes
import com.adobe.granite.ui.clientlibs.ClientLibrary; //导入依赖的package包/类
/**
* Builds our CSS include tags given an ArrayList of ClientLibrary objects
* and a StringBuffer.
*
* @param cssLibs -> our list of ClientLibrary objects.
* @param buffer -> our StringBuffer.
* @return void
**/
protected void buildCssIncludes(List<ClientLibrary> cssLibs, StringBuffer buffer) {
for (ClientLibrary lib : cssLibs) {
LOG.debug("CSS LIB : " + lib.getPath());
freshenLibrary(LibraryType.CSS, lib.getPath());
String path = lib.getPath();
path = this.minificationChecker(path); // check minify option
path = this.browserCacheOptionChecker(lib.getPath(), path, LibraryType.CSS);
try {
buffer.append("<link rel=\"stylesheet\" href=\"");
buffer.append(path + ".css");
buffer.append("\" type=\"text/css\"");
buffer.append(buildMediaAttribute());
buffer.append(" / >\n");
} catch (Exception e) {
LOG.error("Caught exception generating library path", e);
}
}
}
示例4: getProxyPath
import com.adobe.granite.ui.clientlibs.ClientLibrary; //导入依赖的package包/类
private String getProxyPath(ClientLibrary lib) {
String path = lib.getPath();
if (lib.allowProxy()) {
for (String searchPath : request.getResourceResolver().getSearchPath()) {
if (path.startsWith(searchPath)) {
path = request.getContextPath() + "/etc.clientlibs/" + path.replaceFirst(searchPath, "");
}
}
} else {
if (request.getResourceResolver().getResource(lib.getPath()) == null) {
path = null;
}
}
if (path != null) {
path = path + "/resources";
}
return path;
}
示例5: initModel
import com.adobe.granite.ui.clientlibs.ClientLibrary; //导入依赖的package包/类
@PostConstruct
protected void initModel() {
super.initModel();
String resourcesClientLibrary = currentStyle.get(PN_APP_RESOURCES_CLIENTLIB, String.class);
if (resourcesClientLibrary != null) {
Collection<ClientLibrary> clientLibraries =
htmlLibraryManager.getLibraries(new String[]{resourcesClientLibrary}, LibraryType.CSS, true, true);
ArrayList<ClientLibrary> clientLibraryList = Lists.newArrayList(clientLibraries.iterator());
if (!clientLibraryList.isEmpty()) {
appResourcesPath = getProxyPath(clientLibraryList.get(0));
}
}
setRedirect();
}
示例6: setUp
import com.adobe.granite.ui.clientlibs.ClientLibrary; //导入依赖的package包/类
@BeforeClass
public static void setUp() {
internalSetUp(CONTEXT, TEST_BASE, ROOT);
mockClientLibrary = Mockito.mock(ClientLibrary.class);
when(mockClientLibrary.getPath()).thenReturn("/apps/wcm/core/page/clientlibs/favicon");
when(mockClientLibrary.allowProxy()).thenReturn(true);
CONTEXT.registerInjectActivateService(new MockHtmlLibraryManager(mockClientLibrary));
}
示例7: getClientLibrary
import com.adobe.granite.ui.clientlibs.ClientLibrary; //导入依赖的package包/类
private ClientLibrary getClientLibrary() {
ClientLibrary cl = mock(ClientLibrary.class);
when(cl.getIncludePath(any(LibraryType.class), anyBoolean())).then(i -> {
return path + (i.getArgumentAt(1, Boolean.class) ? ".min" : "") + i.getArgumentAt(0, LibraryType.class).extension;
});
return cl;
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:8,代码来源:DynamicTouchUiClientLibraryServletTest.java
示例8: testWithNormalType
import com.adobe.granite.ui.clientlibs.ClientLibrary; //导入依赖的package包/类
@Test
public void testWithNormalType() throws Exception {
Map<String, ClientLibrary> libraries = new HashMap<String, ClientLibrary>();
String jsOnlyCategory1 = RandomStringUtils.randomAlphanumeric(5);
String jsOnlyCategory2 = RandomStringUtils.randomAlphanumeric(5);
String bothCategory1 = RandomStringUtils.randomAlphanumeric(5);
String bothCategory2 = RandomStringUtils.randomAlphanumeric(5);
addLibrary(libraries, RandomStringUtils.random(10), new String[] { "js" }, new String[] { jsOnlyCategory1,
jsOnlyCategory2 });
addLibrary(libraries, RandomStringUtils.random(10), new String[] { "js" },
new String[] { jsOnlyCategory2 });
addLibrary(libraries, RandomStringUtils.random(10), new String[] { "js", "css" }, new String[] {
bothCategory1, bothCategory2 });
addLibrary(libraries, RandomStringUtils.random(10), new String[] { "js", "css" },
new String[] { bothCategory2 });
when(manager.getLibraries()).thenReturn(libraries);
MockSlingHttpServletRequest request = new MockSlingHttpServletRequest(
"/apps/acs-commons/components/utilities/designer/clientlibsmanager/options", "js", "json", null,
null);
MockSlingHttpServletResponse response = new MockSlingHttpServletResponse();
servlet.doGet(request, response);
assertEquals("application/json", response.getContentType());
JSONArray array = new JSONArray(response.getOutput().toString());
assertEquals(4, array.length());
}
示例9: addLibrary
import com.adobe.granite.ui.clientlibs.ClientLibrary; //导入依赖的package包/类
private void
addLibrary(Map<String, ClientLibrary> libraries, String path, String[] types, String[] categories) {
ClientLibrary library = mock(ClientLibrary.class);
when(library.getTypes()).thenReturn(toLibraryTypeSet(types));
when(library.getCategories()).thenReturn(categories);
libraries.put(path, library);
}
示例10: MockHtmlLibraryManager
import com.adobe.granite.ui.clientlibs.ClientLibrary; //导入依赖的package包/类
public MockHtmlLibraryManager(ClientLibrary mockClientLibrary) {
clientLibraries = Arrays.asList(mockClientLibrary);
}
示例11: getLibraries
import com.adobe.granite.ui.clientlibs.ClientLibrary; //导入依赖的package包/类
@Override
public Map<String, ClientLibrary> getLibraries() {
return null;
}
示例12: getThemeLibraries
import com.adobe.granite.ui.clientlibs.ClientLibrary; //导入依赖的package包/类
@Override
public Collection<ClientLibrary> getThemeLibraries(String[] strings, LibraryType libraryType, String s, boolean b) {
return null;
}
示例13: getThemeLibraries
import com.adobe.granite.ui.clientlibs.ClientLibrary; //导入依赖的package包/类
@Override
public Collection<ClientLibrary> getThemeLibraries(String[] categories, LibraryType type,
String themeName, boolean transitive) {
// TODO Auto-generated method stub
return null;
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:7,代码来源:DesignHtmlLibraryManagerImplTest.java
示例14: getLibraries
import com.adobe.granite.ui.clientlibs.ClientLibrary; //导入依赖的package包/类
@Override
public Collection<ClientLibrary> getLibraries(String[] categories, LibraryType type, boolean ignoreThemed,
boolean transitive) {
// TODO Auto-generated method stub
return null;
}
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:7,代码来源:DesignHtmlLibraryManagerImplTest.java