• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java Components类的典型用法和代码示例

java 1次浏览

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

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

示例1: ComponentTemplateSelectFieldFactory

点赞 3

import info.magnolia.objectfactory.Components; //导入依赖的package包/类
@Inject
public ComponentTemplateSelectFieldFactory(Definition definition, Item relatedFieldItem, SimpleTranslator i18n, MessagesManager oldi18n, TemplateDefinitionRegistry registry) {
    super(definition, relatedFieldItem);
    this.i18n = i18n;
    this.oldi18n = oldi18n;
    currentComponent = relatedFieldItem;
    this.registry = registry;
    try {
        this.siteManager = Components.getComponent(Class.forName("info.magnolia.module.templatingkit.sites.SiteManager"));
    } catch (Exception e) {
        log.debug(e.getMessage(), e);
        try {
            this.siteManager = Components.getComponent(Class.forName("info.magnolia.module.site.SiteManager"));
        } catch (ClassNotFoundException e1) {
            log.debug(e.getMessage(), e);
        }
    }
}
 

开发者ID:rah003,
项目名称:neat-tweaks,
代码行数:19,
代码来源:ComponentTemplateSelectFieldFactory.java

示例2: getAddtionalComponents

点赞 2

import info.magnolia.objectfactory.Components; //导入依赖的package包/类
private Map<String, ComponentAvailability> getAddtionalComponents() {
    Map<String, ComponentAvailability> additionalComponents = new LinkedHashMap<String, ComponentAvailability>();
    if (StringUtils.isNotBlank(availabilityKey)) {
        FoundationTemplatingModule module = Components.getComponent(FoundationTemplatingModule.class);
        if (module.getComponentAvailability().containsKey(availabilityKey)) {
            AvailabilityConfig availabilityConfig = module.getComponentAvailability().get(availabilityKey);
            additionalComponents.putAll(availabilityConfig.getComponents());
        }
    }
    return additionalComponents;
}
 

开发者ID:gtenham,
项目名称:magnolia-templating,
代码行数:12,
代码来源:EnhancedConfiguredAreaDefinition.java

示例3: setUp

点赞 2

import info.magnolia.objectfactory.Components; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    MgnlContext.setInstance(mockWebContext);
    doReturn(parameters).when(mockWebContext).getParameters();

    Components.setComponentProvider(mockComponentProvider);
    doReturn(i18nContentSupport).when(mockComponentProvider).getComponent(I18nContentSupport.class);

    spyTemplatingFunctions = Mockito.spy(new TemplatingFunctions(mock(TemplateTypeHelper.class), mock(Provider.class), webContextProviderMock));
}
 

开发者ID:tricode,
项目名称:magnolia-blog,
代码行数:13,
代码来源:BlogRenderableDefinitionTest.java

示例4: getInstallConditions

点赞 2

import info.magnolia.objectfactory.Components; //导入依赖的package包/类
@Override
protected List<Condition> getInstallConditions() {
    List<Condition> conditions = new ArrayList<Condition>(super.getInstallConditions());
    conditions.add(new AbstractCondition("NeatCentral Theme check",
            "neatcentral theme must be configured in order to use functionality if this module succesfully. Please edit your magnolia.properties file and set magnolia.ui.vaadin.theme property to value \"neatcentral53\" or \"neatcentral54\" (w/o quotes) based on your Magnolia version.") {

        @Override
        public boolean check(InstallContext installContext) {
            MagnoliaConfigurationProperties props = Components.getComponent(MagnoliaConfigurationProperties.class);
            String theme = props.getProperty("magnolia.ui.vaadin.theme");
            return "neatcentral53".equals(theme) || "neatcentral54".equals(theme) || theme.startsWith("neatcentralcustom");
        }
    });
    return conditions;
}
 

开发者ID:rah003,
项目名称:neat-tweaks,
代码行数:16,
代码来源:DefaultNeatVersionHandler.java

示例5: generateRenditionLink

点赞 2

import info.magnolia.objectfactory.Components; //导入依赖的package包/类
private Object generateRenditionLink(String rendition, Node node) {
    try {
        Class<?> clazz = Class.forName("info.magnolia.dam.templating.functions.DamTemplatingFunctions");
        Method dammethod = clazz.getMethod("getAssetLink", String.class, String.class);
        Object damfn = Components.newInstance(clazz);
        return dammethod.invoke(damfn, "jcr:" + node.getIdentifier(), rendition);
    } catch (RepositoryException | ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
        // bad luck we handle it the usual way
        e.printStackTrace();
    }
    return null;
}
 

开发者ID:rah003,
项目名称:neat-jsonfn,
代码行数:13,
代码来源:JsonBuilder.java

示例6: setUp

点赞 2

import info.magnolia.objectfactory.Components; //导入依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    session = MgnlContext.getInstance().getJCRSession("website");
    // register node type
    NodeTypeManager nodeTypeManager = session.getWorkspace().getNodeTypeManager();
    NodeTypeTemplate type = NodeTypeTemplateUtil.createSimpleNodeType(nodeTypeManager, "mgnl:apex",
            Arrays.asList(NodeType.NT_HIERARCHY_NODE, NodeType.MIX_REFERENCEABLE, NodeTypes.Created.NAME, NodeTypes.Activatable.NAME, NodeTypes.LastModified.NAME, NodeTypes.Renderable.NAME));
    nodeTypeManager.registerNodeType(type, true);
    session.save();

    new PropertiesImportExport().createNodes(session.getRootNode(), IOUtils.toInputStream(rootTree));
    session.save();

    // silly but can't use : in name in util
    session.move("/home/mgnl_apex", "/home/mgnl:apex");
    session.move("/home/section/mgnl_apex", "/home/section/mgnl:apex");
    session.move("/home/section2/mgnl_apex", "/home/section2/mgnl:apex");
    session.move("/home/section/article/mgnl_apex", "/home/section/article/mgnl:apex");
    session.move("/home/section2/article/mgnl_apex", "/home/section2/article/mgnl:apex");
    session.save();

    Components.getSingleton(RepositoryManager.class).createWorkspace("magnolia", "category");
    Session catSession = MgnlContext.getInstance().getJCRSession("category");
    // register node type
    NodeTypeManager catNodeTypeManager = catSession.getWorkspace().getNodeTypeManager();
    type = NodeTypeTemplateUtil.createSimpleNodeType(nodeTypeManager, "category", Arrays.asList(NodeType.NT_HIERARCHY_NODE, NodeType.MIX_REFERENCEABLE, NodeTypes.Created.NAME, NodeTypes.Activatable.NAME, NodeTypes.LastModified.NAME, NodeTypes.Renderable.NAME));
    nodeTypeManager.registerNodeType(type, true);

    catNode = catSession.getRootNode().addNode("foo", "category");
    catNode.addNode("foobar", "mgnl:content");
    catNode.setProperty("name", "myCategory");
    catSession.save();
    MgnlContext.setLocale(null);
    ComponentsTestUtil.setInstance(I18nContentSupport.class, new DefaultI18nContentSupport());

}
 

开发者ID:rah003,
项目名称:neat-jsonfn,
代码行数:39,
代码来源:JsonBuilderTest.java

示例7: createTemplatingElement

点赞 2

import info.magnolia.objectfactory.Components; //导入依赖的package包/类
protected C createTemplatingElement() {
    // FIXME use scope instead of fetching the RenderingContext for passing it as an argument
    final RenderingEngine renderingEngine = Components.getComponent(RenderingEngine.class);
    final RenderingContext renderingContext = renderingEngine.getRenderingContext();

    return Components.getComponentProvider().newInstance(getTemplatingElementClass(), renderingContext);
}
 

开发者ID:magnoliales,
项目名称:magnolia-handlebars,
代码行数:8,
代码来源:AbstractTemplateHelper.java

示例8: start

点赞 2

import info.magnolia.objectfactory.Components; //导入依赖的package包/类
public void start(ModuleLifecycleContext moduleLifecycleContext) {
    initBlossomDispatcherServlet(SERVLET_NAME,
            "classpath:/base-handlebars-context.xml classpath:/handlebars-context.xml");
    for (DispatcherServlet servlet : getDispatcherServlets()) {
        if (servlet.getServletName().equals(SERVLET_NAME)) {
            ApplicationContextContainer container = Components.getComponent(ApplicationContextContainer.class);
            container.setContext(servlet.getWebApplicationContext());
        }
    }
}
 

开发者ID:magnoliales,
项目名称:magnolia-handlebars,
代码行数:11,
代码来源:HandlebarsModule.java

示例9: BeanTemplateHelper

点赞 2

import info.magnolia.objectfactory.Components; //导入依赖的package包/类
public BeanTemplateHelper() {
    this.damTemplatingFunctions = Components.getComponent(DamTemplatingFunctions.class);
}
 

开发者ID:magnoliales,
项目名称:magnolia-handlebars,
代码行数:4,
代码来源:BeanTemplateHelper.java

示例10: ImgTemplateHelper

点赞 2

import info.magnolia.objectfactory.Components; //导入依赖的package包/类
public ImgTemplateHelper() {
    this.damTemplatingFunctions = Components.getComponent(DamTemplatingFunctions.class);
}
 

开发者ID:magnoliales,
项目名称:magnolia-handlebars,
代码行数:4,
代码来源:ImgTemplateHelper.java

示例11: renderingEngine

点赞 2

import info.magnolia.objectfactory.Components; //导入依赖的package包/类
@Bean
public RenderingEngine renderingEngine() {
    return Components.getComponent(RenderingEngine.class);
}
 

开发者ID:magnoliales,
项目名称:magnolia-handlebars,
代码行数:5,
代码来源:BlossomConfiguration.java

示例12: getPublicUrlService

点赞 2

import info.magnolia.objectfactory.Components; //导入依赖的package包/类
public PublicUrlService getPublicUrlService() {
    if (_publicUrlService == null) {
        _publicUrlService = Components.getComponent(PublicUrlService.class);
    }
    return _publicUrlService;
}
 

开发者ID:aperto,
项目名称:magnolia-vanity-url,
代码行数:7,
代码来源:VanityUrlModule.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)