use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestNavigatorWidgetConfigAction method testFailureAddExpression_3.
public void testFailureAddExpression_3() throws Throwable {
Map<String, String> params = new HashMap<String, String>();
params.put("pageCode", "pagina_2");
params.put("frame", "3");
params.put("widgetTypeCode", "leftmenu");
params.put("navSpec", "parent.subtree(2)+current");
params.put("specId", "4");
params.put("specAbsLevel", "-1");
String result = this.executeAddExpression("admin", params);
assertEquals(Action.INPUT, result);
ActionSupport action = this.getAction();
assertEquals(1, action.getActionErrors().size());
NavigatorWidgetConfigAction navAction = (NavigatorWidgetConfigAction) action;
Widget widget = navAction.getWidget();
assertNotNull(widget);
ApsProperties props = widget.getConfig();
assertEquals(0, props.size());
assertEquals("parent.subtree(2)+current", navAction.getNavSpec());
assertEquals(2, navAction.getExpressions().size());
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestNavigatorWidgetConfigAction method testInitConfigNavigator_1.
public void testInitConfigNavigator_1() throws Throwable {
String result = this.executeConfigNavigator("admin", "homepage", "1", "leftmenu");
assertEquals(Action.SUCCESS, result);
NavigatorWidgetConfigAction action = (NavigatorWidgetConfigAction) this.getAction();
Widget widget = action.getWidget();
assertNotNull(widget);
assertEquals(0, widget.getConfig().size());
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestContentListViewerWidgetAction method testFailureConfigContentType_1.
public void testFailureConfigContentType_1() throws Throwable {
String result = this.executeConfigContentType("admin", "homepage", "1", "content_viewer_list", "");
assertEquals(Action.INPUT, result);
ContentListViewerWidgetAction action = (ContentListViewerWidgetAction) this.getAction();
Widget widget = action.getWidget();
assertNotNull(widget);
ApsProperties props = widget.getConfig();
assertEquals(0, props.size());
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class PageAction method setViewerPageAPI.
public String setViewerPageAPI() {
IPage page = null;
try {
page = this.getPage(this.getPageCode());
int mainFrame = page.getMetadata().getModel().getMainFrame();
if (mainFrame > -1) {
IWidgetTypeManager showletTypeManager = (IWidgetTypeManager) ApsWebApplicationUtils.getBean(SystemConstants.WIDGET_TYPE_MANAGER, this.getRequest());
Widget viewer = new Widget();
viewer.setConfig(new ApsProperties());
WidgetType type = showletTypeManager.getWidgetType(this.getViewerWidgetCode());
if (null == type) {
_logger.warn("No widget found for on-the-fly publishing config for page {}", page.getCode());
return SUCCESS;
}
viewer.setType(type);
Widget[] widgets = page.getWidgets();
widgets[mainFrame] = viewer;
}
this.getPageManager().updatePage(page);
} catch (Throwable t) {
_logger.error("Error setting on-the-fly publishing config to page {}", page.getCode(), t);
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class PageConfigAction method joinWidgetJson.
public String joinWidgetJson() {
try {
String result = this.checkBaseParams();
if (null != result) {
return result;
}
IPage page = this.getPage(this.getPageCode());
if (null != page.getWidgets()[this.getFrame()]) {
this.addActionError(this.getText("error.page.join.frameNotEmpty"));
return "pageTree";
}
if (null != this.getWidgetTypeCode() && this.getWidgetTypeCode().length() == 0) {
this.addActionError(this.getText("error.page.widgetTypeCodeUnknown"));
return INPUT;
}
_logger.debug("code={}, pageCode={}, frame={}" + this.getWidgetTypeCode(), this.getPageCode(), this.getFrame());
WidgetType widgetType = this.getShowletType(this.getWidgetTypeCode());
if (null == widgetType) {
this.addActionError(this.getText("error.page.widgetTypeCodeUnknown"));
return INPUT;
}
if (null == widgetType.getConfig() && null != widgetType.getAction()) {
this.setWidgetAction(widgetType.getAction());
// continue to widget configuration
return "configureSpecialWidget";
}
Widget widget = new Widget();
widget.setType(widgetType);
this.getPageManager().joinWidget(this.getPageCode(), widget, this.getFrame());
this.addActivityStreamInfo(ApsAdminSystemConstants.ADD, true);
} catch (Exception e) {
_logger.error("error in joinWidget", e);
return FAILURE;
}
return SUCCESS;
}
Aggregations