use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class PageConfigAction method editFrame.
public String editFrame() {
try {
String result = this.checkBaseParams();
if (null != result) {
return result;
}
// can be null
Widget widget = this.getCurrentPage().getWidgets()[this.getFrame()];
this.setWidget(widget);
if (widget != null) {
WidgetType widgetType = widget.getType();
_logger.debug("pageCode: {}, frame: {}, widgetType: {}", this.getPageCode(), this.getFrame(), widgetType.getCode());
this.setWidgetAction(widgetType.getAction());
if (null == widgetType.getConfig() && null != this.getWidgetAction()) {
return "configureSpecialWidget";
}
} else {
_logger.debug("pageCode: {} frame: {}, empty widhet to config", this.getPageCode(), this.getFrame());
}
} catch (Exception e) {
_logger.error("error in edit frame", e);
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class PageConfigAction method joinWidget.
public String joinWidget() {
try {
String result = this.checkBaseParams();
if (null != result) {
return result;
}
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;
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class WidgetTypeAction method saveUserWidget.
protected String saveUserWidget() {
try {
boolean isCopy = (null != this.getPageCode() && this.getPageCode().trim().length() > 0);
String check = (isCopy) ? this.checkWidgetToCopy() : this.checkNewUserWidget();
if (null != check) {
return check;
}
WidgetType newType = null;
Widget widgetToCopy = this.extractWidgetToCopy();
if (null == widgetToCopy) {
this.setReplaceOnPage(false);
newType = this.createNewWidgetType();
WidgetType parentType = this.getWidgetTypeManager().getWidgetType(this.getParentWidgetTypeCode());
newType.setParentType(parentType);
ApsProperties config = this.extractWidgetTypeConfig(parentType.getTypeParameters());
newType.setConfig(config);
} else {
newType = this.createCopiedWidget(widgetToCopy);
}
// TODO CHECK MainGroup
newType.setMainGroup(this.getMainGroup());
this.getWidgetTypeManager().addWidgetType(newType);
if (this.isReplaceOnPage()) {
WidgetType type = this.getWidgetType(this.getWidgetTypeCode());
Widget widget = new Widget();
widget.setType(type);
IPage page = this.getPageManager().getDraftPage(this.getPageCode());
page.getWidgets()[this.getFramePos()] = widget;
this.getPageManager().updatePage(page);
return "replaceOnPage";
}
} catch (Throwable t) {
_logger.error("error in saveUserWidget", t);
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class NavigatorWidgetConfigAction method createNavigatorParams.
/**
* Crea e valorizza l'action corrente in base ai parametri ricavati da una
* lista di espressioni.
*
* @param expressions La lista di espressioni tramite il quale valorizzare
* l'action corrente.
* @throws Throwable Il caso di errore.
*/
protected void createNavigatorParams(List<NavigatorExpression> expressions) throws Throwable {
Widget prototype = this.createNewShowlet();
// COSTRUISCE SHOWLET PROTOTIPO VUOTA E SETTA SPECIFICATORE
String navSpec = this.getNavigatorParser().getSpec(expressions);
prototype.getConfig().setProperty("navSpec", navSpec);
// COSTRUISCE LE NUOVE ESPRESSIONI IN BASE AL NUOVO PARAMETRO
this.createExpressions(expressions);
this.setWidget(prototype);
// SETTA IL WIDGET COSTRUITO
this.setNavSpec(navSpec);
}
use of com.agiletec.aps.system.services.page.Widget in project entando-core by entando.
the class PageConfigurationControllerWidgetsIntegrationTest method createPage.
protected Page createPage(String pageCode) {
IPage parentPage = pageManager.getDraftPage("service");
PageModel pageModel = parentPage.getMetadata().getModel();
PageMetadata metadata = PageTestUtil.createPageMetadata(pageModel.getCode(), true, pageCode + "_title", null, null, false, null, null);
ApsProperties config = PageTestUtil.createProperties("temp", "tempValue", "contentId", "ART11");
Widget widgetToAdd = PageTestUtil.createWidget("content_viewer", config, this.widgetTypeManager);
Widget[] widgets = { widgetToAdd };
Page pageToAdd = PageTestUtil.createPage(pageCode, parentPage, "free", metadata, widgets);
return pageToAdd;
}
Aggregations