use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class SimpleWidgetConfigAction method createNewWidget.
protected Widget createNewWidget() {
if (this.getWidgetTypeCode() == null || this.getWidgetType(this.getWidgetTypeCode()) == null) {
_logger.error("Widget Code missin or invalid : " + this.getWidgetTypeCode());
// throw new Exception("Widget Code missin or invalid : " + this.getWidgetTypeCode());
return null;
}
Widget widget = new Widget();
WidgetType type = this.getWidgetType(this.getWidgetTypeCode());
widget.setType(type);
widget.setConfig(new ApsProperties());
return widget;
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class SimpleWidgetConfigAction method createValuedShowlet.
protected void createValuedShowlet() throws Exception {
Widget widget = this.createNewShowlet();
List<WidgetTypeParameter> parameters = widget.getType().getTypeParameters();
for (int i = 0; i < parameters.size(); i++) {
WidgetTypeParameter param = parameters.get(i);
String paramName = param.getName();
String value = this.getRequest().getParameter(paramName);
if (value != null && value.trim().length() > 0) {
widget.getConfig().setProperty(paramName, value);
}
}
this.setWidget(widget);
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class NavigatorWidgetConfigAction method extractInitConfig.
@Override
protected String extractInitConfig() {
try {
String result = super.extractInitConfig();
if (!result.equals(SUCCESS)) {
return result;
}
Widget widget = this.getWidget();
String navSpec = null;
if (null != widget.getConfig()) {
navSpec = widget.getConfig().getProperty("navSpec");
}
this.createExpressions(navSpec);
this.setNavSpec(navSpec);
} catch (Throwable t) {
_logger.error("error in extractInitConfig", t);
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestContentListViewerWidgetAction method testInitConfigListViewer_1.
public void testInitConfigListViewer_1() throws Throwable {
String result = this.executeConfigListViewer("admin", "homepage", "1", "content_viewer_list");
assertEquals(Action.SUCCESS, result);
ContentListViewerWidgetAction action = (ContentListViewerWidgetAction) this.getAction();
Widget widget = action.getWidget();
assertNotNull(widget);
assertEquals(0, widget.getConfig().size());
List<Properties> filtersProperties = action.getFiltersProperties();
assertNotNull(filtersProperties);
assertEquals(0, filtersProperties.size());
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class TestContentListViewerWidgetAction method testConfigContentType.
public void testConfigContentType() throws Throwable {
String result = this.executeConfigContentType("admin", "homepage", "1", "content_viewer_list", "ART");
assertEquals(Action.SUCCESS, result);
ContentListViewerWidgetAction action = (ContentListViewerWidgetAction) this.getAction();
Widget widget = action.getWidget();
assertNotNull(widget);
assertEquals("content_viewer_list", widget.getType().getCode());
ApsProperties props = widget.getConfig();
assertEquals(1, props.size());
assertEquals("ART", props.getProperty("contentType"));
}
Aggregations