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);
}
}
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;
}
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);
}
}
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;
}
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);
}
}
}
Aggregations