Search in sources :

Example 91 with Widget

use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.

the class WidgetTypeAction method checkWidgetToCopy.

private String checkWidgetToCopy() throws Throwable {
    IPage page = this.getPageManager().getDraftPage(this.getPageCode());
    if (null == page) {
        this.addActionError(this.getText("error.page.invalidPageCode.adv", new String[] { this.getPageCode() }));
        return "inputWidgetTypes";
    }
    if (!this.getAuthorizationManager().isAuth(this.getCurrentUser(), page)) {
        this.addActionError(this.getText("error.page.userNotAllowed.adv", new String[] { this.getPageCode() }));
        return "inputWidgetTypes";
    }
    Widget[] widgets = page.getWidgets();
    if (null == this.getFramePos() || widgets.length <= this.getFramePos()) {
        String framePos = (null != this.getFramePos()) ? this.getFramePos().toString() : null;
        this.addActionError(this.getText("error.page.invalidPageFrame.adv", new String[] { this.getPageCode(), framePos }));
        return "inputWidgetTypes";
    }
    Widget widget = widgets[this.getFramePos()];
    if (null == widget) {
        this.addActionError(this.getText("error.page.nullWidgetOnFrame", new String[] { this.getPageCode(), this.getFramePos().toString() }));
        return "inputWidgetTypes";
    }
    this.setWidgetToCopy(widget);
    return null;
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) Widget(com.agiletec.aps.system.services.page.Widget)

Example 92 with Widget

use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.

the class WidgetTypeAction method extractWidgetToCopy.

private Widget extractWidgetToCopy() throws Throwable {
    IPage page = this.getPageManager().getDraftPage(this.getPageCode());
    if (null == page) {
        return null;
    }
    Widget[] widgets = page.getWidgets();
    return widgets[this.getFramePos()];
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) Widget(com.agiletec.aps.system.services.page.Widget)

Example 93 with Widget

use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.

the class PageActionReferencesHelper method checkContentsForSetOnline.

@Override
public boolean checkContentsForSetOnline(IPage page, ActionSupport action) {
    try {
        for (Widget widget : page.getWidgets()) {
            if (null != widget) {
                ApsProperties config = widget.getConfig();
                String contentId = (null != config) ? config.getProperty("contentId") : null;
                this.checkContent(action, contentId);
            }
        }
    } catch (ApsSystemException e) {
        _logger.error("error checking draft page - content references");
        return false;
    }
    return true;
}
Also used : Widget(com.agiletec.aps.system.services.page.Widget) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) ApsProperties(com.agiletec.aps.util.ApsProperties)

Example 94 with Widget

use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.

the class SimpleWidgetConfigAction method extractInitConfig.

protected String extractInitConfig() {
    if (null != this.getWidget()) {
        return SUCCESS;
    }
    Widget widget = this.getCurrentPage().getWidgets()[this.getFrame()];
    if (null == widget) {
        widget = this.createNewWidget();
        if (null == widget) {
            this.addActionError(this.getText("error.page.nullWidgetOnFrame", this.getPageCode(), String.valueOf(this.getFrame())));
            return "pageTree";
        }
        /*
			} catch (Exception e) {
				_logger.error("error in extractInitConfig", e);
				//TODO METTI MESSAGGIO DI ERRORE NON PREVISTO... Vai in pageTree con messaggio di errore Azione non prevista o cosa del genere
				this.addActionError(this.getText("Message.userNotAllowed"));
				return "pageTree";
			}
			 */
        _logger.info("Configurating new Widget {} - Page {} - Frame {}", this.getWidgetTypeCode(), this.getPageCode(), this.getFrame());
    } else {
        _logger.info("Edit Widget config {} - Page {} - Frame {}", this.getWidgetTypeCode(), this.getPageCode(), this.getFrame());
        widget = this.createCloneFrom(widget);
    }
    this.setWidget(widget);
    return SUCCESS;
}
Also used : Widget(com.agiletec.aps.system.services.page.Widget)

Example 95 with Widget

use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.

the class SimpleWidgetConfigAction method createCloneFrom.

protected Widget createCloneFrom(Widget widget) {
    Widget clone = new Widget();
    clone.setType(widget.getType());
    if (null != widget.getConfig()) {
        clone.setConfig((ApsProperties) widget.getConfig().clone());
    }
    return clone;
}
Also used : Widget(com.agiletec.aps.system.services.page.Widget)

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