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;
}
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()];
}
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;
}
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;
}
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;
}
Aggregations