當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。