Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jh-boot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jan Hrabal
jh-boot
Commits
dbda556e
Commit
dbda556e
authored
Sep 21, 2019
by
Jan Hrabal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small paging improvements
parent
1949ff93
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
58 deletions
+85
-58
AbstractHibernateRepository.java
...ain/java/com/jh/boot/jpa/AbstractHibernateRepository.java
+1
-1
DefaultSorting.java
src/main/java/com/jh/boot/web/list/DefaultSorting.java
+35
-35
ListHelper.java
src/main/java/com/jh/boot/web/list/ListHelper.java
+2
-2
Page.java
src/main/java/com/jh/boot/web/list/Page.java
+2
-2
SortTrend.java
src/main/java/com/jh/boot/web/list/SortTrend.java
+45
-18
No files found.
src/main/java/com/jh/boot/jpa/AbstractHibernateRepository.java
View file @
dbda556e
...
...
@@ -149,7 +149,7 @@ public abstract class AbstractHibernateRepository {
sortedCriteria
(
c
,
pagingInfo
);
return
new
Page
<>(
pagingInfo
.
getPage
(),
pag
ingInfo
.
getPageSize
(),
pagesCount
,
count
,
c
.
list
(),
pagingInfo
.
getField
(),
pagingInfo
.
getTrend
());
return
new
Page
<>(
pagingInfo
.
getPage
(),
pag
esCount
,
pagingInfo
.
getPageSize
()
,
count
,
c
.
list
(),
pagingInfo
.
getField
(),
pagingInfo
.
getTrend
());
}
...
...
src/main/java/com/jh/boot/web/list/DefaultSorting.java
View file @
dbda556e
/*
* Created on 25. 8. 2017 18:29:24
*
*/
package
com
.
jh
.
boot
.
web
.
list
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* The Interface DefaultSorting.
*
* @author Jan Hrabal
*/
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
({
ElementType
.
METHOD
,
ElementType
.
PARAMETER
})
public
@interface
DefaultSorting
{
/**
* Field.
*
* @return the string
*/
String
field
();
/**
* Trend.
*
* @return the sort trend
*/
SortTrend
trend
()
default
SortTrend
.
ASCENDING
;
}
/*
* Created on 25. 8. 2017 18:29:24
*
*/
package
com
.
jh
.
boot
.
web
.
list
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* The Interface DefaultSorting.
*
* @author Jan Hrabal
*/
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
({
ElementType
.
METHOD
,
ElementType
.
PARAMETER
})
public
@interface
DefaultSorting
{
/**
* Field.
*
* @return the string
*/
String
field
();
/**
* Trend.
*
* @return the sort trend
*/
SortTrend
trend
()
default
SortTrend
.
ASCENDING
;
}
src/main/java/com/jh/boot/web/list/ListHelper.java
View file @
dbda556e
...
...
@@ -94,12 +94,12 @@ public class ListHelper {
field
=
defaultField
;
}
if
(
trend
==
null
)
{
if
(
!
StringUtils
.
hasText
(
trend
)
)
{
if
(
defaultTrend
!=
null
)
{
st
=
defaultTrend
;
}
}
else
{
st
=
"desc"
.
equalsIgnoreCase
(
trend
)
?
SortTrend
.
DESCENDING
:
SortTrend
.
ASCENDING
;
st
=
SortTrend
.
parse
(
trend
)
;
}
if
(!
StringUtils
.
hasText
(
field
)
||
st
==
null
)
{
...
...
src/main/java/com/jh/boot/web/list/Page.java
View file @
dbda556e
...
...
@@ -128,8 +128,8 @@ public class Page<T> {
*
* @return the trend
*/
public
S
ortTrend
getTrend
()
{
return
trend
;
public
S
tring
getTrend
()
{
return
trend
==
null
?
null
:
trend
.
getTrend
()
;
}
/**
...
...
src/main/java/com/jh/boot/web/list/SortTrend.java
View file @
dbda556e
/*
* Created on 30. 10. 2016 7:32:25
*
*/
package
com
.
jh
.
boot
.
web
.
list
;
/**
* The Enum SortTrend.
*
* @author Jan Hrabal
*/
public
enum
SortTrend
{
/** The ascending. */
ASCENDING
,
/** The descending. */
DESCENDING
}
/*
* Created on 30. 10. 2016 7:32:25
*
*/
package
com
.
jh
.
boot
.
web
.
list
;
/**
* The Enum SortTrend.
*
* @author Jan Hrabal
*/
public
enum
SortTrend
{
/** The ascending. */
ASCENDING
(
"asc"
),
/** The descending. */
DESCENDING
(
"desc"
);
private
String
trend
;
private
SortTrend
(
String
trend
)
{
this
.
trend
=
trend
;
}
public
String
getTrend
()
{
return
trend
;
}
@Override
public
String
toString
()
{
return
trend
;
}
public
static
SortTrend
parse
(
String
s
)
{
for
(
SortTrend
st
:
values
())
{
if
(
st
.
trend
.
equalsIgnoreCase
(
s
)
||
st
.
name
().
equalsIgnoreCase
(
s
))
{
return
st
;
}
}
return
null
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment