Search in sources :

Example 96 with Widget

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

Example 97 with 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);
}
Also used : Widget(com.agiletec.aps.system.services.page.Widget) WidgetTypeParameter(org.entando.entando.aps.system.services.widgettype.WidgetTypeParameter)

Example 98 with 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;
}
Also used : Widget(com.agiletec.aps.system.services.page.Widget)

Example 99 with Widget

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());
}
Also used : Widget(com.agiletec.aps.system.services.page.Widget) Properties(java.util.Properties) ApsProperties(com.agiletec.aps.util.ApsProperties)

Example 100 with Widget

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"));
}
Also used : Widget(com.agiletec.aps.system.services.page.Widget) ApsProperties(com.agiletec.aps.util.ApsProperties)

Aggregations

Widget (com.agiletec.aps.system.services.page.Widget)117 ApsProperties (com.agiletec.aps.util.ApsProperties)60 IPage (com.agiletec.aps.system.services.page.IPage)41 WidgetType (org.entando.entando.aps.system.services.widgettype.WidgetType)20 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)17 HashMap (java.util.HashMap)12 Lang (com.agiletec.aps.system.services.lang.Lang)10 Page (com.agiletec.aps.system.services.page.Page)7 PageModel (com.agiletec.aps.system.services.pagemodel.PageModel)7 ArrayList (java.util.ArrayList)7 PageMetadata (com.agiletec.aps.system.services.page.PageMetadata)6 NavigatorExpression (com.agiletec.aps.system.services.page.widget.NavigatorExpression)6 Properties (java.util.Properties)6 RequestContext (com.agiletec.aps.system.RequestContext)5 ActionSupport (com.opensymphony.xwork2.ActionSupport)4 JspException (javax.servlet.jsp.JspException)4 WidgetTypeParameter (org.entando.entando.aps.system.services.widgettype.WidgetTypeParameter)4 List (java.util.List)3 ServletRequest (javax.servlet.ServletRequest)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)3