Skip to content

Commit

Permalink
LPD-40036 Divide constants according whether they are PortletKeys or …
Browse files Browse the repository at this point in the history
…WebKeys
  • Loading branch information
antonio-ortega authored and brianchandotcom committed Dec 17, 2024
1 parent f236d75 commit 7062edb
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,7 @@
*/
public class SamplePortletKeys {

public static final String SAMPLE_DISPLAY_CONTEXT =
"SAMPLE_DISPLAY_CONTEXT";

public static final String SAMPLE_PORTLET =
"com_liferay_frontend_taglib_sample_web_portlet_SamplePortlet";

public static final String SEARCH_ITERATOR_DISPLAY_CONTEXT =
"SEARCH_ITERATOR_DISPLAY_CONTEXT";

public static final String SEARCH_PAGINATOR_DISPLAY_CONTEXT =
"SEARCH_PAGINATOR_DISPLAY_CONTEXT";

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* SPDX-FileCopyrightText: (c) 2024 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/

package com.liferay.frontend.taglib.sample.web.internal.constants;

/**
* @author Antonio Ortega
*/
public class SampleWebKeys {

public static final String SAMPLE_DISPLAY_CONTEXT =
"SAMPLE_DISPLAY_CONTEXT";

public static final String SEARCH_ITERATOR_DISPLAY_CONTEXT =
"SEARCH_ITERATOR_DISPLAY_CONTEXT";

public static final String SEARCH_PAGINATOR_DISPLAY_CONTEXT =
"SEARCH_PAGINATOR_DISPLAY_CONTEXT";

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package com.liferay.frontend.taglib.sample.web.internal.portlet;

import com.liferay.frontend.taglib.sample.web.internal.constants.SamplePortletKeys;
import com.liferay.frontend.taglib.sample.web.internal.constants.SampleWebKeys;
import com.liferay.frontend.taglib.sample.web.internal.display.context.SampleDisplayContext;
import com.liferay.frontend.taglib.sample.web.internal.display.context.SearchIteratorDisplayContext;
import com.liferay.frontend.taglib.sample.web.internal.display.context.SearchPaginatorDisplayContext;
Expand Down Expand Up @@ -54,14 +55,14 @@ public void doDispatch(
throws IOException, PortletException {

renderRequest.setAttribute(
SamplePortletKeys.SAMPLE_DISPLAY_CONTEXT,
SampleWebKeys.SAMPLE_DISPLAY_CONTEXT,
new SampleDisplayContext(renderRequest, renderResponse));
renderRequest.setAttribute(
SamplePortletKeys.SEARCH_ITERATOR_DISPLAY_CONTEXT,
SampleWebKeys.SEARCH_ITERATOR_DISPLAY_CONTEXT,
new SearchIteratorDisplayContext(
_portal, renderRequest, renderResponse));
renderRequest.setAttribute(
SamplePortletKeys.SEARCH_PAGINATOR_DISPLAY_CONTEXT,
SampleWebKeys.SEARCH_PAGINATOR_DISPLAY_CONTEXT,
new SearchPaginatorDisplayContext(
_portal, renderRequest, renderResponse));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %><%@
taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %><%@
taglib uri="http://liferay.com/tld/util" prefix="liferay-util" %>

<%@ page import="com.liferay.frontend.taglib.sample.web.internal.constants.SamplePortletKeys" %><%@
<%@ page import="com.liferay.frontend.taglib.sample.web.internal.constants.SampleWebKeys" %><%@
page import="com.liferay.frontend.taglib.sample.web.internal.display.context.SampleDisplayContext" %><%@
page import="com.liferay.frontend.taglib.sample.web.internal.display.context.SearchIteratorDisplayContext" %><%@
page import="com.liferay.frontend.taglib.sample.web.internal.display.context.SearchPaginatorDisplayContext" %><%@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<%@ include file="/init.jsp" %>

<%
SearchIteratorDisplayContext searchIteratorDisplayContext = (SearchIteratorDisplayContext)request.getAttribute(SamplePortletKeys.SEARCH_ITERATOR_DISPLAY_CONTEXT);
SearchIteratorDisplayContext searchIteratorDisplayContext = (SearchIteratorDisplayContext)request.getAttribute(SampleWebKeys.SEARCH_ITERATOR_DISPLAY_CONTEXT);
%>

<clay:container-fluid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<%@ include file="/init.jsp" %>

<%
SearchPaginatorDisplayContext searchPaginatorDisplayContext = (SearchPaginatorDisplayContext)request.getAttribute(SamplePortletKeys.SEARCH_PAGINATOR_DISPLAY_CONTEXT);
SearchPaginatorDisplayContext searchPaginatorDisplayContext = (SearchPaginatorDisplayContext)request.getAttribute(SampleWebKeys.SEARCH_PAGINATOR_DISPLAY_CONTEXT);
%>

<clay:container-fluid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

<%@ include file="/init.jsp" %>


<%
SampleDisplayContext sampleDisplayContext = (SampleDisplayContext)request.getAttribute(SamplePortletKeys.SAMPLE_DISPLAY_CONTEXT);
SampleDisplayContext sampleDisplayContext = (SampleDisplayContext)request.getAttribute(SampleWebKeys.SAMPLE_DISPLAY_CONTEXT);
%>

<clay:navigation-bar
Expand Down

0 comments on commit 7062edb

Please sign in to comment.