Package com.agiletec.aps.system.services.page

Examples of com.agiletec.aps.system.services.page.Widget


  public void testInitConfig_1() throws Throwable {
    String result = this.executeConfigFacetNavResult("admin", "homepage", "1", "jpfacetnav_results");
    assertEquals(Action.SUCCESS, result);
    FacetNavResultWidgetAction action = (FacetNavResultWidgetAction) this.getAction();
    Widget widget = action.getWidget();
    assertNotNull(widget);
    assertEquals(0, widget.getConfig().size());
    List<SmallContentType> contentTypes = action.getContentTypes();
    assertNotNull(contentTypes);
    assertEquals(4, contentTypes.size());
  }
View Full Code Here


      ICacheManager cacheManager = (ICacheManager) ApsWebApplicationUtils.getBean(SystemConstants.CACHE_MANAGER, this.getRequest());
      PublicContentAuthorizationInfo authInfo = new PublicContentAuthorizationInfo(content);
      cacheManager.putInCache(JacmsSystemConstants.CONTENT_AUTH_INFO_CACHE_PREFIX + contentId, authInfo);
      this.setUserOnSession("admin");
      this._contentManager.loadContent(contentId, true);
      Widget showlet = new Widget();
            IWidgetTypeManager showletTypeMan =
              (IWidgetTypeManager) this.getService(SystemConstants.WIDGET_TYPE_MANAGER);
            WidgetType WidgetType = showletTypeMan.getWidgetType("content_feedback_viewer");
            showlet.setType(WidgetType);
            ApsProperties prop = new ApsProperties();
            prop.put("contentId", contentId);
            prop.put(ContentFeedbackWidgetAction.WIDGET_PARAM_COMMENT_ACTIVE, "true");
            prop.put(ContentFeedbackWidgetAction.WIDGET_PARAM_COMMENT_MODERATED, "false");
            prop.put(ContentFeedbackWidgetAction.WIDGET_PARAM_COMMENT_ANONYMOUS, "false");
            prop.put(ContentFeedbackWidgetAction.WIDGET_PARAM_RATE_COMMENT, "true");
            prop.put(ContentFeedbackWidgetAction.WIDGET_PARAM_RATE_CONTENT, "true");
            showlet.setConfig(prop);

            RequestContext e = new RequestContext();
            e.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET, showlet);
            Lang lang = new Lang();
        lang.setCode("en");
View Full Code Here

  @Override
  public int doEndTag() throws JspException {
    ServletRequest req =  this.pageContext.getRequest();
    RequestContext reqCtx = (RequestContext) req.getAttribute(RequestContext.REQCTX);
    try {
      Widget currentShowlet = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
      String pageCode = currentShowlet.getConfig().getProperty("pageCodeParam");
      IPageManager pageManager = (IPageManager) ApsWebApplicationUtils.getBean(SystemConstants.PAGE_MANAGER, this.pageContext);
      IPage targetPage = pageManager.getPage(pageCode);
      if (null != targetPage) {
        String frameIdString = currentShowlet.getConfig().getProperty("frameIdParam");
        int frameId = Integer.parseInt(frameIdString);
        Widget[] showlets = targetPage.getWidgets();
        if (showlets.length>=frameId) {
          Widget targetShowlet = targetPage.getWidgets()[frameId];
          if (null != targetShowlet) {
            reqCtx.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET, targetShowlet);
            WidgetType WidgetType = targetShowlet.getType();
            if (WidgetType.isLogic()) {
              WidgetType = WidgetType.getParentType();
            }
            String pluginCode = WidgetType.getPluginCode();
            boolean isPluginShowlet = (null != pluginCode && pluginCode.trim().length()>0);
View Full Code Here

  @Override
  public int doStartTag() throws JspException {
    ServletRequest request = this.pageContext.getRequest();
    try {
      RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
      Widget widget = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
            ApsProperties showletConfig = widget.getConfig();
            String modelId = this.extractModelId(showletConfig, reqCtx);
      if (null != modelId) {
        String var = this.getVar();
        if (null == var || "".equals(var)) {
          this.pageContext.getOut().print(modelId);
View Full Code Here

   * @return content types filter
   * @throws ApsSystemException
   */
  private List<String> getContentTypesFilter(RequestContext reqCtx) throws ApsSystemException {
    List<String> contentTypes = new ArrayList<String>();
    Widget currentShowlet = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
    if (null == currentShowlet.getConfig()) return contentTypes;
    String paramName = JpFacetNavSystemConstants.CONTENT_TYPES_FILTER_SHOWLET_PARAM_NAME;
    String contentTypesParamValue = currentShowlet.getConfig().getProperty(paramName);
    if (null != contentTypesParamValue) {
      IContentManager contentManager = (IContentManager) ApsWebApplicationUtils.getBean(JacmsSystemConstants.CONTENT_MANAGER, reqCtx.getRequest());
      String[] contentTypesArray = contentTypesParamValue.split(",");
      for (int i=0; i<contentTypesArray.length; i++) {
        String contentTypeCode = contentTypesArray[i].trim();
View Full Code Here

    IPage page = (IPage) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE);
    Integer currentFrame = (Integer) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_FRAME);
    Widget[] widgets = page.getWidgets();
    for (int i = 0; i < widgets.length; i++) {
      if (i == currentFrame.intValue()) continue;
      Widget widget = widgets[i];
      String configParamName = JpFacetNavSystemConstants.FACET_ROOTS_SHOWLET_PARAM_NAME;
      if (null != widget && null != widget.getConfig()
          && null != widget.getConfig().getProperty(configParamName)) {
        String facetParamConfig = widget.getConfig().getProperty(configParamName);
        return this.getFacetRoots(facetParamConfig);
      }
    }
    return null;
  }
View Full Code Here

    return super.doStartTag();
  }

  protected List<ITreeNode> getFacetRootNodes(RequestContext reqCtx) {
    List<ITreeNode> facets = null;
    Widget currentWidget = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
    String configParamName = JpFacetNavSystemConstants.FACET_ROOTS_SHOWLET_PARAM_NAME;
    String facetParamConfig = currentWidget.getConfig().getProperty(configParamName);
    if (null != facetParamConfig && facetParamConfig.trim().length()>0) {
      facets = super.getFacetRoots(facetParamConfig);
    }
    return facets;
  }
View Full Code Here

   */
  protected String extractTypeCode() {
    String typeCode = null;
    RequestContext reqCtx = (RequestContext) this.getRequest().getAttribute(RequestContext.REQCTX);
    if (reqCtx != null) {
      Widget showlet = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
      if (showlet != null) {
        ApsProperties config = showlet.getConfig();
        if (null != config) {
          String showletTypeCode = config.getProperty(JpUserRegSystemConstants.TYPECODE_SHOWLET_PARAM);
          if (showletTypeCode!=null && showletTypeCode.trim().length()>0) {
            typeCode = showletTypeCode.trim();
          }
View Full Code Here

   */
  private String getContentId(Page page) {
    String content = null;
    int mainFrame = page.getModel().getMainFrame();
    if(mainFrame >= 0) {
      Widget widget = page.getWidgets()[mainFrame];
      if(null != widget && null != widget.getPublishedContent()) {
        content = widget.getPublishedContent();
      }
    }
    return content;
  }
View Full Code Here

  protected int getMaxElementForItem(int maxItems, ServletRequest request) {
    if (maxItems == 0) {
      RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
      if (reqCtx != null) {
        Widget showlet = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
        ApsProperties config = showlet.getConfig();
        String stringMax = (String) config.get("maxElemForItem");
        if (stringMax != null && stringMax.length() > 0) {
          maxItems = Integer.parseInt(stringMax);
        }
      }
View Full Code Here

TOP

Related Classes of com.agiletec.aps.system.services.page.Widget

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.