public String getDDLRecordSetDisplayStyle() {
    if (_ddlRecordDisplayStyle == null) {
      PortalPreferences portalPreferences =
          PortletPreferencesFactoryUtil.getPortalPreferences(_ddlRequestHelper.getRenderRequest());

      _ddlRecordDisplayStyle =
          ParamUtil.getString(_ddlRequestHelper.getRenderRequest(), "displayStyle");

      if (Validator.isNull(_ddlRecordDisplayStyle)) {
        _ddlRecordDisplayStyle =
            portalPreferences.getValue(
                DDLPortletKeys.DYNAMIC_DATA_LISTS,
                "display-style",
                _ddlWebConfiguration.defaultDisplayView());
      } else if (ArrayUtil.contains(getDDLRecordSetDisplayViews(), _ddlRecordDisplayStyle)) {

        portalPreferences.setValue(
            DDLPortletKeys.DYNAMIC_DATA_LISTS, "display-style", _ddlRecordDisplayStyle);
      }

      if (!ArrayUtil.contains(getDDLRecordSetDisplayViews(), _ddlRecordDisplayStyle)) {

        _ddlRecordDisplayStyle = getDDLRecordSetDisplayViews()[0];
      }
    }

    return _ddlRecordDisplayStyle;
  }
예제 #2
0
  public RecordSearch(
      PortletRequest portletRequest, PortletURL iteratorURL, List<String> headerNames) {

    super(
        portletRequest,
        new DisplayTerms(portletRequest),
        null,
        DEFAULT_CUR_PARAM,
        DEFAULT_DELTA,
        iteratorURL,
        headerNames,
        EMPTY_RESULTS_MESSAGE);

    try {
      PortalPreferences preferences =
          PortletPreferencesFactoryUtil.getPortalPreferences(portletRequest);

      String orderByCol = ParamUtil.getString(portletRequest, "orderByCol");
      String orderByType = ParamUtil.getString(portletRequest, "orderByType");

      if (Validator.isNotNull(orderByCol) && Validator.isNotNull(orderByType)) {

        preferences.setValue(
            DDLFormPortletKeys.DYNAMIC_DATA_LISTS_FORM_ADMIN,
            "view-entries-order-by-col",
            orderByCol);
        preferences.setValue(
            DDLFormPortletKeys.DYNAMIC_DATA_LISTS_FORM_ADMIN,
            "view-entries-order-by-type",
            orderByType);
      } else {
        orderByCol =
            preferences.getValue(
                DDLFormPortletKeys.DYNAMIC_DATA_LISTS_FORM_ADMIN,
                "view-entries-order-by-col",
                "id");
        orderByType =
            preferences.getValue(
                DDLFormPortletKeys.DYNAMIC_DATA_LISTS_FORM_ADMIN,
                "view-entries-order-by-type",
                "asc");
      }

      OrderByComparator<DDLRecord> orderByComparator =
          getRecordOrderByComparator(orderByCol, orderByType);

      setOrderableHeaders(orderableHeaders);
      setOrderByCol(orderByCol);
      setOrderByType(orderByType);
      setOrderByComparator(orderByComparator);
    } catch (Exception e) {
      _log.error(e, e);
    }
  }
  public String getDisplayStyle() {
    if (Validator.isNotNull(_displayStyle)) {
      return _displayStyle;
    }

    PortalPreferences portalPreferences =
        PortletPreferencesFactoryUtil.getPortalPreferences(_request);

    _displayStyle =
        portalPreferences.getValue(SiteBrowserPortletKeys.SITE_BROWSER, "display-style", "list");

    return _displayStyle;
  }