Search in sources :

Example 6 with WidgetType

use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.

the class WidgetTypeManagerCacheWrapper method initCache.

@Override
public void initCache(IWidgetTypeDAO widgetTypeDAO) throws ApsSystemException {
    try {
        Cache cache = this.getCache();
        this.releaseCachedObjects(cache);
        Map<String, WidgetType> widgetTypes = widgetTypeDAO.loadWidgetTypes();
        Iterator<WidgetType> iter = widgetTypes.values().iterator();
        while (iter.hasNext()) {
            WidgetType type = iter.next();
            String mainTypeCode = type.getParentTypeCode();
            if (null != mainTypeCode) {
                type.setParentType(widgetTypes.get(mainTypeCode));
            }
        }
        this.insertObjectsOnCache(cache, widgetTypes);
    } catch (Throwable t) {
        _logger.error("Error loading widgets types", t);
        throw new ApsSystemException("Error loading widgets types", t);
    }
}
Also used : ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType) Cache(org.springframework.cache.Cache)

Example 7 with WidgetType

use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.

the class TestContentListHelper method getShowletForTest.

private Widget getShowletForTest(String showletTypeCode, ApsProperties config) throws Throwable {
    WidgetType type = this._showletTypeManager.getWidgetType(showletTypeCode);
    Widget widget = new Widget();
    widget.setType(type);
    if (null != config) {
        widget.setConfig(config);
    }
    return widget;
}
Also used : Widget(com.agiletec.aps.system.services.page.Widget) WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType)

Example 8 with WidgetType

use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.

the class TestContentViewerHelper method init.

private void init() throws Exception {
    try {
        _requestContext = this.getRequestContext();
        Lang lang = new Lang();
        lang.setCode("it");
        lang.setDescr("italiano");
        _requestContext.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG, lang);
        Widget widget = new Widget();
        IWidgetTypeManager showletTypeMan = (IWidgetTypeManager) this.getService(SystemConstants.WIDGET_TYPE_MANAGER);
        WidgetType showletType = showletTypeMan.getWidgetType("content_viewer");
        widget.setType(showletType);
        widget.setConfig(new ApsProperties());
        _requestContext.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET, widget);
        this._helper = (IContentViewerHelper) this.getApplicationContext().getBean("jacmsContentViewerHelper");
    } catch (Throwable t) {
        throw new Exception(t);
    }
}
Also used : IWidgetTypeManager(org.entando.entando.aps.system.services.widgettype.IWidgetTypeManager) Widget(com.agiletec.aps.system.services.page.Widget) Lang(com.agiletec.aps.system.services.lang.Lang) WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType) ApsProperties(com.agiletec.aps.util.ApsProperties)

Example 9 with WidgetType

use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.

the class TestPageManager method getWidgetForTest.

private Widget getWidgetForTest(String widgetTypeCode, ApsProperties config) throws Throwable {
    WidgetType type = this._widgetTypeManager.getWidgetType(widgetTypeCode);
    Widget widget = new Widget();
    widget.setType(type);
    if (null != config) {
        widget.setConfig(config);
    }
    return widget;
}
Also used : WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType)

Example 10 with WidgetType

use of org.entando.entando.aps.system.services.widgettype.WidgetType in project entando-core by entando.

the class TestPageModelManager method testGetModel.

public void testGetModel() throws Throwable {
    PageModel model = this._pageModelManager.getPageModel("internal");
    assertNotNull(model);
    assertEquals(9, model.getFrames().length);
    Widget[] defaultWidgets = model.getDefaultWidget();
    assertEquals(model.getFrames().length, defaultWidgets.length);
    for (int i = 0; i < defaultWidgets.length; i++) {
        Widget widget = defaultWidgets[i];
        if (i == 3) {
            assertNotNull(widget);
            WidgetType type = widget.getType();
            assertEquals("leftmenu", type.getCode());
            assertEquals(1, type.getTypeParameters().size());
            assertNull(type.getConfig());
            ApsProperties config = widget.getConfig();
            assertEquals(1, config.size());
            assertEquals("code(homepage).subtree(1)", config.getProperty("navSpec"));
        } else {
            assertNull(widget);
        }
    }
}
Also used : Widget(com.agiletec.aps.system.services.page.Widget) WidgetType(org.entando.entando.aps.system.services.widgettype.WidgetType) ApsProperties(com.agiletec.aps.util.ApsProperties)

Aggregations

WidgetType (org.entando.entando.aps.system.services.widgettype.WidgetType)70 ApsProperties (com.agiletec.aps.util.ApsProperties)33 Widget (com.agiletec.aps.system.services.page.Widget)20 IPage (com.agiletec.aps.system.services.page.IPage)11 GuiFragment (org.entando.entando.aps.system.services.guifragment.GuiFragment)10 ApiException (org.entando.entando.aps.system.services.api.model.ApiException)9 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)5 WidgetTypeParameter (org.entando.entando.aps.system.services.widgettype.WidgetTypeParameter)5 ActionSupport (com.opensymphony.xwork2.ActionSupport)4 IManager (com.agiletec.aps.system.common.IManager)3 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)3 Lang (com.agiletec.aps.system.services.lang.Lang)3 List (java.util.List)3 JAXBGuiFragment (org.entando.entando.aps.system.services.guifragment.api.JAXBGuiFragment)3 IWidgetTypeManager (org.entando.entando.aps.system.services.widgettype.IWidgetTypeManager)3 ILangManager (com.agiletec.aps.system.services.lang.ILangManager)2 SelectItem (com.agiletec.aps.util.SelectItem)2 Properties (java.util.Properties)2 ApiMethod (org.entando.entando.aps.system.services.api.model.ApiMethod)2