some cleanup
This commit is contained in:
parent
246f13b7f6
commit
dc836137f2
@ -93,11 +93,9 @@ public abstract class CheckListTemplateDataPanel extends Panel {
|
|||||||
columns = new IColumn[4];
|
columns = new IColumn[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
columns[0] = new ClickableTitleColumn<CheckListTemplate>(Model.of("Name"), "name", "name") {
|
columns[0] = new ClickableTitleColumn<CheckListTemplate>(Model.of("Name"), "name", "name") {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick(IModel<CheckListTemplate> clicked, AjaxRequestTarget target) {
|
protected void onClick(IModel<CheckListTemplate> clicked, AjaxRequestTarget target) {
|
||||||
// System.out.println(clicked.getObject().getName());
|
|
||||||
cltdp.onClick(clicked, target);
|
cltdp.onClick(clicked, target);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -121,6 +119,7 @@ public abstract class CheckListTemplateDataPanel extends Panel {
|
|||||||
columns[4] = new ClickableDeleteColumn<CheckListTemplate>(Model.of("Delete"), "name") {
|
columns[4] = new ClickableDeleteColumn<CheckListTemplate>(Model.of("Delete"), "name") {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick(IModel<CheckListTemplate> clicked, AjaxRequestTarget target) {
|
protected void onClick(IModel<CheckListTemplate> clicked, AjaxRequestTarget target) {
|
||||||
|
//peer templates can be connected to peer requests and cannot be deleted
|
||||||
boolean isPeer = false;
|
boolean isPeer = false;
|
||||||
for (ChecklistCategory clc : clicked.getObject().getCategories()){
|
for (ChecklistCategory clc : clicked.getObject().getCategories()){
|
||||||
if (clc.getCategoryName().equalsIgnoreCase("peer")){
|
if (clc.getCategoryName().equalsIgnoreCase("peer")){
|
||||||
@ -136,7 +135,6 @@ public abstract class CheckListTemplateDataPanel extends Panel {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
table = new DataTable<CheckListTemplate>("datatable", columns, checklistTemplateProvider = new ChecklistTemplateProvider(), 10);
|
table = new DataTable<CheckListTemplate>("datatable", columns, checklistTemplateProvider = new ChecklistTemplateProvider(), 10);
|
||||||
table.setOutputMarkupId(true);
|
table.setOutputMarkupId(true);
|
||||||
table.addBottomToolbar(navigationToolbar = new NavigationToolbar(table));
|
table.addBottomToolbar(navigationToolbar = new NavigationToolbar(table));
|
||||||
@ -155,8 +153,6 @@ public abstract class CheckListTemplateDataPanel extends Panel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<? extends CheckListTemplate> iterator(int first, int count) {
|
public Iterator<? extends CheckListTemplate> iterator(int first, int count) {
|
||||||
// Sort(Direction direction, String... properties)
|
|
||||||
// new Sort(Sort.Direction.ASC, "name")
|
|
||||||
Sort sort;
|
Sort sort;
|
||||||
if (getSort().isAscending()){
|
if (getSort().isAscending()){
|
||||||
sort = new Sort(Sort.Direction.ASC, getSort().getProperty());
|
sort = new Sort(Sort.Direction.ASC, getSort().getProperty());
|
||||||
@ -164,10 +160,6 @@ public abstract class CheckListTemplateDataPanel extends Panel {
|
|||||||
else {
|
else {
|
||||||
sort = new Sort(Sort.Direction.DESC, getSort().getProperty());
|
sort = new Sort(Sort.Direction.DESC, getSort().getProperty());
|
||||||
}
|
}
|
||||||
// new Sort(Sort.Direction.ASC, getSort().toString())
|
|
||||||
|
|
||||||
//Changed from count to table.getRowsPerPage to make pagination work.
|
|
||||||
//return checklistTemplateService.find(filterString, new PageRequest(table.getCurrentPage(), count, sort)).iterator();
|
|
||||||
return checklistTemplateService.find(filterString, new PageRequest(table.getCurrentPage(), table.getRowsPerPage(), sort)).iterator();
|
return checklistTemplateService.find(filterString, new PageRequest(table.getCurrentPage(), table.getRowsPerPage(), sort)).iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user