Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
7a00acd4
"...git@git.uibk.ac.at:c102348/olat-ci-cd-testing-project.git" did not exist on "0b93e0a5abec807b2d4ef35a29d4d3fa95c9e6a7"
Commit
7a00acd4
authored
11 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-916: implement a sort algorithm for the AC column in the repository list
parent
dc42770b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/olat/repository/RepositoryTableModel.java
+44
-3
44 additions, 3 deletions
src/main/java/org/olat/repository/RepositoryTableModel.java
with
44 additions
and
3 deletions
src/main/java/org/olat/repository/RepositoryTableModel.java
+
44
−
3
View file @
7a00acd4
...
...
@@ -117,7 +117,48 @@ public class RepositoryTableModel extends DefaultTableDataModel<RepositoryEntry>
//fxdiff VCRP-1,2: access control of resources
CustomCellRenderer
acRenderer
=
new
RepositoryEntryACColumnDescriptor
();
tableCtr
.
addColumnDescriptor
(
new
CustomRenderColumnDescriptor
(
"table.header.ac"
,
RepoCols
.
ac
.
ordinal
(),
null
,
loc
,
ColumnDescriptor
.
ALIGNMENT_LEFT
,
acRenderer
));
loc
,
ColumnDescriptor
.
ALIGNMENT_LEFT
,
acRenderer
)
{
@Override
public
int
compareTo
(
int
rowa
,
int
rowb
)
{
Object
o1
=
table
.
getTableDataModel
().
getObject
(
rowa
);
Object
o2
=
table
.
getTableDataModel
().
getObject
(
rowb
);
if
(
o1
==
null
||
!(
o1
instanceof
RepositoryEntry
))
return
-
1
;
if
(
o2
==
null
||
!(
o2
instanceof
RepositoryEntry
))
return
1
;
RepositoryEntry
re1
=
(
RepositoryEntry
)
o1
;
RepositoryEntry
re2
=
(
RepositoryEntry
)
o2
;
if
(
re1
.
isMembersOnly
())
{
if
(!
re2
.
isMembersOnly
())
{
return
1
;
}
}
else
if
(
re2
.
isMembersOnly
())
{
return
-
1
;
}
OLATResourceAccess
ac1
=
repoEntriesWithOffer
.
get
(
re1
.
getOlatResource
().
getKey
());
OLATResourceAccess
ac2
=
repoEntriesWithOffer
.
get
(
re2
.
getOlatResource
().
getKey
());
if
(
ac1
==
null
&&
ac2
!=
null
)
return
-
1
;
if
(
ac1
!=
null
&&
ac2
==
null
)
return
1
;
if
(
ac1
!=
null
&&
ac2
!=
null
)
return
compareAccess
(
re1
,
ac1
,
re2
,
ac2
);
return
super
.
compareString
(
re1
.
getDisplayname
(),
re2
.
getDisplayname
());
}
private
int
compareAccess
(
RepositoryEntry
re1
,
OLATResourceAccess
ac1
,
RepositoryEntry
re2
,
OLATResourceAccess
ac2
)
{
int
s1
=
ac1
.
getMethods
().
size
();
int
s2
=
ac2
.
getMethods
().
size
();
int
compare
=
s1
-
s2
;
if
(
compare
!=
0
)
return
compare
;
if
(
s1
>
0
&&
s2
>
0
)
{
String
t1
=
ac1
.
getMethods
().
get
(
0
).
getMethod
().
getType
();
String
t2
=
ac2
.
getMethods
().
get
(
0
).
getMethod
().
getType
();
int
compareType
=
super
.
compareString
(
t1
,
t2
);
if
(
compareType
!=
0
)
return
compareType
;
}
return
super
.
compareString
(
re1
.
getDisplayname
(),
re2
.
getDisplayname
());
}
});
tableCtr
.
addColumnDescriptor
(
new
RepositoryEntryTypeColumnDescriptor
(
"table.header.typeimg"
,
RepoCols
.
repoEntry
.
ordinal
(),
null
,
loc
,
ColumnDescriptor
.
ALIGNMENT_LEFT
));
...
...
@@ -133,7 +174,7 @@ public class RepositoryTableModel extends DefaultTableDataModel<RepositoryEntry>
ColumnDescriptor
nameColDesc
=
new
DefaultColumnDescriptor
(
"table.header.displayname"
,
RepoCols
.
displayname
.
ordinal
(),
enableDirectLaunch
?
TABLE_ACTION_SELECT_ENTRY
:
null
,
loc
)
{
@Override
public
int
compareTo
(
int
rowa
,
int
rowb
)
{
Object
o1
=
table
.
getTableDataModel
().
getValueAt
(
rowa
,
1
);
Object
o1
=
table
.
getTableDataModel
().
getValueAt
(
rowa
,
1
);
Object
o2
=
table
.
getTableDataModel
().
getValueAt
(
rowb
,
1
);
if
(
o1
==
null
||
!(
o1
instanceof
RepositoryEntry
))
return
-
1
;
...
...
@@ -191,7 +232,7 @@ public class RepositoryTableModel extends DefaultTableDataModel<RepositoryEntry>
* @see org.olat.core.gui.components.table.TableDataModel#getValueAt(int, int)
*/
public
Object
getValueAt
(
int
row
,
int
col
)
{
RepositoryEntry
re
=
(
RepositoryEntry
)
getObject
(
row
);
RepositoryEntry
re
=
getObject
(
row
);
switch
(
RepoCols
.
values
()[
col
])
{
//fxdiff VCRP-1,2: access control of resources
case
ac:
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment