public with sharing class sccQuestionList {
Public Integer noOfRecords{get; set;}
Public Integer size{get;set;}
Public List<wrapperclass> wrapList{get;set;}
Public boolean showFlagcheck{get;set;}
public ApexPages.StandardSetController setCon {
get{
if(setCon == null){
size = 10;
Id UserId = UserInfo.getUserId();
string queryString = 'Select Id,Name, Line_Of_Discipline_C__r.Name,Status_C__c,Priority_C__c,Owner.name,Line_Of_Discipline_Focal_Point__r.Name,Site__c,Title_C__c,CreatedDate,CreatedById from Question__c where CreatedById =: UserId order by CreatedDate DESC';
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
setCon.setPageSize(size);
noOfRecords = setCon.getResultSize();
wrapList = new List<wrapperclass>();
}
return setCon;
}set;
}
/*Public Pagination_Demo(){
wrapList = new List<wrapperclass>();
} */
Public List<Question__c> getQuestions(){
List<Question__c> queList = new List<Question__c>();
for(Question__c q : (List<Question__c>)setCon.getRecords())
queList.add(q);
return queList;
}
Public List<wrapperclass> getwrapListshow(){
List<Question__c> queList = new List<Question__c>();
wrapList = new List<wrapperclass>();
for(Question__c q : (List<Question__c>)setCon.getRecords())
{
wrapList.add(new wrapperclass(q,false)) ;
queList.add(q);
}
showFlagcheck = true;
return wrapList ;
}
Public class wrapperclass{
Public Question__c ques{get;set;}
Public Boolean flagcheck{get;set;}
Public wrapperclass(Question__c que,boolean checkBox){
ques = que;
flagcheck = checkbox;
}
}
public pageReference refresh() {
setCon = null;
getQuestions();
setCon.setPageNumber(1);
return null;
}
//This is called by action poller in visualforce page
Integer count = 0;
public PageReference incrementCounter() {
count = setCon.getPageNumber();
return null;
}
}
Test class:
@isTest
public class testsccQuestionlist {
static testmethod void ssc()
{
Question__c Q=new Question__c ();
insert Q;
PageReference pageRef = Page.conatactsaved;
pageRef.getParameters().put('id', String.valueOf(Q.Id));
Test.setCurrentPage(pageRef);
sccQuestionList.wrapperclass sccQuestion = new sccQuestionList.wrapperclass(Q);
//sccQuestion.getQuestions();
}
}
new sccQuestionList.wrapperclass(Q, false);
- you need to provide both constructor arguments - should compile.