当前位置: 首页>>代码示例>>Java>>正文


Java AuthoringUIMode类代码示例

本文整理汇总了Java中com.day.cq.wcm.api.AuthoringUIMode的典型用法代码示例。如果您正苦于以下问题:Java AuthoringUIMode类的具体用法?Java AuthoringUIMode怎么用?Java AuthoringUIMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AuthoringUIMode类属于com.day.cq.wcm.api包,在下文中一共展示了AuthoringUIMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getJSONResults

import com.day.cq.wcm.api.AuthoringUIMode; //导入依赖的package包/类
private JSONObject getJSONResults(Command cmd, SlingHttpServletRequest request, final Collection<Result> results) throws
        JSONException {
    final JSONObject json = new JSONObject();

    json.put(KEY_RESULTS, new JSONArray());

    final ValueMap requestConfig = new ValueMapDecorator(new HashMap<String, Object>());

    // Collect all items collected from OSGi Properties
    requestConfig.putAll(this.config);

    // Add Request specific configurations
    requestConfig.put(AuthoringUIMode.class.getName(),
            authoringUIModeService.getAuthoringUIMode(request));

    for (final Result result : results) {
        final JSONObject tmp = resultBuilder.toJSON(cmd, result, requestConfig);

        if (tmp != null) {
            json.accumulate(KEY_RESULTS, tmp);
        }
    }

    return json;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:26,代码来源:QuicklyEngineImpl.java

示例2: getGlobalDialogPath

import com.day.cq.wcm.api.AuthoringUIMode; //导入依赖的package包/类
private String getGlobalDialogPath(Resource resource, ResourceResolver resourceResolver, SlingHttpServletRequest request) {
    String currentGlobalDialogPath = GLOBAL_DIALOG_PATH;
    if (AuthoringUIMode.fromRequest(request) == AuthoringUIMode.TOUCH) {
        currentGlobalDialogPath = GLOBAL_DIALOG_PATH_TOUCH;
    }
    String globalDialogPath = APPS_ROOT + "/" + ResourceUtils.getAppName(resource) + currentGlobalDialogPath;
    if (null == resourceResolver.getResource(globalDialogPath)) {
        globalDialogPath = BLANK;
    }
    return globalDialogPath;
}
 
开发者ID:DantaFramework,项目名称:AEM,代码行数:12,代码来源:AddComponentPropertiesContextProcessor.java

示例3: execute

import com.day.cq.wcm.api.AuthoringUIMode; //导入依赖的package包/类
@Override
public CharSequence execute(final Object valueObj)
        throws Exception {

    StringBuffer buffer = new StringBuffer();
    TemplateContentModelImpl contentModel = contentModel();
    SlingHttpServletRequest slingRequest = contentModel.request();

    WCMMode wcmMode = WCMMode.fromRequest(slingRequest);
    ClientLibraryUtil clientLibUtil = new ClientLibraryUtil(htmlLibraryManager, slingRequest);
    clientLibUtil.setOptions(true, true, false, false, false, BLANK);

    if (wcmMode != WCMMode.DISABLED) {
        ComponentContext componentContext = WCMUtils.getComponentContext(slingRequest);
        EditContext editContext = componentContext.getEditContext();
        String dlgPath = null;
        if (editContext != null && editContext.getComponent() != null) {
            dlgPath = editContext.getComponent().getDialogPath();
        }

        if (AuthoringUIMode.fromRequest(slingRequest) == AuthoringUIMode.TOUCH) {
            buffer.append(clientLibUtil.generateClientLibrariesPristine("cq.authoring.page"));
        } else
        if (AuthoringUIMode.fromRequest(slingRequest) == AuthoringUIMode.CLASSIC) {
            buffer.append(clientLibUtil.generateClientLibrariesPristine("cq.wcm.edit"));
            boolean isEditMode = (wcmMode == WCMMode.EDIT) ? true : false;
            String dialogPath = dlgPath == null ? "" : dlgPath;
            buffer.append(this.getJavaScript(slingRequest, isEditMode, dialogPath));
        }
    }

    return new Handlebars.SafeString(buffer);
}
 
开发者ID:DantaFramework,项目名称:AEM,代码行数:34,代码来源:InitScriptHelperFunction.java

示例4: doTag

import com.day.cq.wcm.api.AuthoringUIMode; //导入依赖的package包/类
@Override
public void doTag() throws JspException, IOException {

    classicMode = AuthoringUIMode.fromRequest(getRequest()) == AuthoringUIMode.CLASSIC;
    touchMode = AuthoringUIMode.fromRequest(getRequest()) == AuthoringUIMode.TOUCH;

    getPageContext().setAttribute(JSP_ATTR_AUTHOR_TOUCHI_UI, touchMode);
    getPageContext().setAttribute(JSP_ATTR_AUTHOR_CLASSIC_UI, classicMode);
}
 
开发者ID:headwirecom,项目名称:aem-solr-search,代码行数:10,代码来源:AuthoringUIModeTag.java

示例5: acceptsAuthoringUIMode

import com.day.cq.wcm.api.AuthoringUIMode; //导入依赖的package包/类
@SuppressWarnings("checkstyle:abbreviationaswordinname")
protected final boolean acceptsAuthoringUIMode(Result result, AuthoringUIMode authoringUIMode) {
    if (result.getAuthoringMode() == null) {
        // All Authoring Modes
        return true;
    } else if (result.getAuthoringMode().equals(authoringUIMode)) {
        return true;
    } else {
        return false;
    }
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:12,代码来源:ResultBuilderImpl.java

示例6: toJSON

import com.day.cq.wcm.api.AuthoringUIMode; //导入依赖的package包/类
public JSONObject toJSON(final Result result, final ValueMap config) throws JSONException {
    final AuthoringUIMode authoringUIMode = config.get(AuthoringUIMode.class.getName(), AuthoringUIMode.TOUCH);

    if(authoringUIMode != null && AuthoringUIMode.CLASSIC.equals(authoringUIMode)) {
        // Classic
        result.getAction().setUri("/cf#" + result.getPath() + ".html");
    } else {
        // TouchUI
        result.getAction().setUri("/editor.html" + result.getPath() + ".html");
    }

    return super.toJSON(result);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:14,代码来源:OpenResultSerializerImpl.java

示例7: testIsClassic

import com.day.cq.wcm.api.AuthoringUIMode; //导入依赖的package包/类
@Test
public void testIsClassic() {
    when(request.getAttribute(AuthoringUIMode.REQUEST_ATTRIBUTE_NAME)).thenReturn(AuthoringUIMode.CLASSIC);
    assertTrue(ModeUtil.isClassic(request));
    verify(request, times(1)).getAttribute(AuthoringUIMode.class.getName());
    verifyNoMoreInteractions(request);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:8,代码来源:ModeUtilTest.java

示例8: testIsNotClassic

import com.day.cq.wcm.api.AuthoringUIMode; //导入依赖的package包/类
@Test
public void testIsNotClassic() {
    when(request.getAttribute(AuthoringUIMode.REQUEST_ATTRIBUTE_NAME)).thenReturn(AuthoringUIMode.TOUCH);
    assertFalse(ModeUtil.isClassic(request));
    verify(request, times(1)).getAttribute(AuthoringUIMode.class.getName());
    verifyNoMoreInteractions(request);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:8,代码来源:ModeUtilTest.java

示例9: testIsTouch

import com.day.cq.wcm.api.AuthoringUIMode; //导入依赖的package包/类
@Test
public void testIsTouch() {
    when(request.getAttribute(AuthoringUIMode.REQUEST_ATTRIBUTE_NAME)).thenReturn(AuthoringUIMode.TOUCH);
    assertTrue(ModeUtil.isTouch(request));
    verify(request, times(1)).getAttribute(AuthoringUIMode.class.getName());
    verifyNoMoreInteractions(request);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:8,代码来源:ModeUtilTest.java

示例10: testIsNotTouch

import com.day.cq.wcm.api.AuthoringUIMode; //导入依赖的package包/类
@Test
public void testIsNotTouch() {
    when(request.getAttribute(AuthoringUIMode.REQUEST_ATTRIBUTE_NAME)).thenReturn(AuthoringUIMode.CLASSIC);
    assertFalse(ModeUtil.isTouch(request));
    verify(request, times(1)).getAttribute(AuthoringUIMode.class.getName());
    verifyNoMoreInteractions(request);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:8,代码来源:ModeUtilTest.java

示例11: process

import com.day.cq.wcm.api.AuthoringUIMode; //导入依赖的package包/类
/**
 * @param executionContext
 * @param contentModel
 * @throws Exception
 */
@Override
public void process(final ExecutionContext executionContext, final TemplateContentModelImpl contentModel)
        throws ProcessException {
    try {
        SlingHttpServletRequest request = (SlingHttpServletRequest) executionContext.get(SLING_HTTP_REQUEST);
        Resource resource = request.getResource();
        log.debug("for {}", resource.getPath());
        if (resource != null) {
            ResourceResolver resourceResolver = request.getResourceResolver();
            Designer designer = resourceResolver.adaptTo(Designer.class);
            final PageManager pageManager = resourceResolver.adaptTo(PageManager.class);
            final TagManager tm = (TagManager) resource.getResourceResolver().adaptTo(TagManager.class);
            Page page = pageManager.getContainingPage(resource);
            if (page != null) {
                if (!contentModel.has(PAGE_PROPERTIES_KEY)) {
                    Configuration configuration = configurationProvider.getFor(page.getContentResource().getResourceType());
                    Collection<String> bodyClasses = configuration.asStrings(XK_CONTAINER_CLASSES_CP, Mode.MERGE);
                    Node pageContentNode = page.getContentResource().adaptTo(Node.class);
                    Map<String, Object> pageContent = propsToMap(pageContentNode.getProperties());
                    pageContent.put(PATH, page.getPath());
                    pageContent.put(PAGE_NAME, page.getName());
                    pageContent.put(LINK, page.getPath() + HTML_EXT);
                    pageContent.put(BODY_CLASSES, bodyClasses);
                    pageContent.put(TITLE, page.getTitle());
                    pageContent.put(DESCRIPTION, page.getProperties().get(JCR_DESCRIPTION, ""));
                    pageContent.put(PAGE_TITLE, page.getProperties().get(PAGE_TITLE, ""));
                    pageContent.put(SUBTITLE, page.getProperties().get(SUBTITLE, ""));
                    pageContent.put(HIDE_IN_NAV, page.getProperties().get(HIDE_IN_NAV, ""));
                    pageContent.put(KEYWORDS, PageUtils.getKeywords(pageContent, tm));
                    pageContent.put(TAGS, PageUtils.getTags(pageContent));
                    pageContent.put(WCM_MODE, GeneralRequestObjects.getWCMModeString(request));
                    pageContent.put(IS_EDIT_MODE, GeneralRequestObjects.isEditMode(request));
                    pageContent.put(IS_DESIGN_MODE, GeneralRequestObjects.isDesignMode(request));
                    pageContent.put(IS_EDIT_OR_DESIGN_MODE, GeneralRequestObjects.isEditOrDesignMode(request));

                    if (designer != null) {
                        Design design = designer.getDesign(page);
                        if (design != null && design.getPath() != null) {
                            pageContent.put(FAVICON, design.getPath() + "/" + FAVICON + ICO_EXT);
                        }
                    }

                    String navigationTitle = PageUtils.getNavigationTitle(page);
                    if (null != navigationTitle) {
                        pageContent.put(NAVIGATION_TITLE, PageUtils.getNavigationTitle(page));
                    }
                    // add transformed path image
                    String pageImagePath = assetPathService.getPageImagePath(page, page.getContentResource());
                    if(StringUtils.isNotEmpty(pageImagePath)){
                        pageContent.put(IMAGE_PATH, pageImagePath);
                    }

                    // add interface mode
                    if (AuthoringUIMode.fromRequest(request) == AuthoringUIMode.TOUCH) {
                        pageContent.put(IS_TOUCH_UI_MODE, true);
                        pageContent.put(IS_CLASSIC_UI_MODE, false);
                    } else {
                        pageContent.put(IS_CLASSIC_UI_MODE, true);
                        pageContent.put(IS_TOUCH_UI_MODE, false);
                    }
                    contentModel.set(PAGE_PROPERTIES_KEY, pageContent);
                }
            }
        }
    } catch (Exception e) {
        throw new ProcessException(e);
    }
}
 
开发者ID:DantaFramework,项目名称:AEM,代码行数:74,代码来源:AddPagePropertiesContextProcessor.java

示例12: getAuthoringMode

import com.day.cq.wcm.api.AuthoringUIMode; //导入依赖的package包/类
public AuthoringUIMode getAuthoringMode() {
    return authoringMode;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:4,代码来源:Result.java

示例13: setAuthoringMode

import com.day.cq.wcm.api.AuthoringUIMode; //导入依赖的package包/类
public void setAuthoringMode(final AuthoringUIMode authoringMode) {
    this.authoringMode = authoringMode;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:4,代码来源:Result.java

示例14: classic

import com.day.cq.wcm.api.AuthoringUIMode; //导入依赖的package包/类
public Builder classic() {
    this.authoringMode = AuthoringUIMode.CLASSIC;
    return this;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:5,代码来源:Result.java

示例15: touch

import com.day.cq.wcm.api.AuthoringUIMode; //导入依赖的package包/类
public Builder touch() {
    this.authoringMode = AuthoringUIMode.TOUCH;
    return this;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:5,代码来源:Result.java


注:本文中的com.day.cq.wcm.api.AuthoringUIMode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。