gn="justify">}. addSeries (series); model;
}
X getMin () {result=null; resultValue=Double.MAX_VALUE; y=0; (X x: getRangeOfX ()) {= getNextY (y, x); (y lt;=resultValue ) {= y;=x;
}
} result;
}
public X getMax () {result=null; resultValue=Double.MIN_VALUE; y=0; (X x: getRangeOfX ()) {= getNextY (y, x); (y gt;= resultValue) {= y;=x;
}
} result;
}
double getMinValue () {resultValue=Double.MAX_VALUE; y=0; (X x: getRangeOfX ()) {= getNextY (y, x); (y lt;=resultValue) {= y ;
}
} resultValue;
}
double getMaxValue () {resultValue=Double.MIN_VALUE; y=0; (X x: getRangeOfX ()) {= getNextY (y, x); (y gt;=resultValue) {= y ;
}
} (resultValue == Double.MIN_VALUE) {0;
} resultValue;
}
abstract void prepareRedirect (X selected);
abstract String getRedirect ();
String redirect (X selected) {(selected); redirect=getRedirect () + »? faces-redirect=true »; redirect;
}
}. javaru.ulstu.secretaryart;
java.util. Calendar; java.util. Date; java.util. GregorianCalendar; java.util.concurrent. TimeUnit; java.util.stream. IntStream;
import javax.annotation. PostConstruct; javax.inject. Inject;
ru.ulstu.secretary.grid. DateBacking; ru.ulstu.secretary.utils. DateUtil;
abstract class DateChartBacking extends ChartBacking lt; Date gt; {
static final long serialVersionUID=- 5928036826842490016L;
Date from;
Date to;
@ InjectDateBacking dateBacking;
@ PostConstructvoid init () {= DateUtil.getToday ();=DateUtil.getToday (); (- 1, 1);
}
@ OverrideIterable lt; Date gt; getRangeOfX () {dayCount=TimeUnit.DAYS.convert (to.getTime () - from.getTime (), TimeUnit.MILLISECONDS) + 1; () - gt; IntStream.iterate (0, i - gt; i + 1) .limit (dayCount) .mapToObj (i - gt; {calendar=new GregorianCalendar () ;. setTime (from) ;. add (Calendar.DATE, i); calendar.getTime ();
}). iterator ();
}
Date getFrom () {from;
}
void setFrom (Date from) {.from=from;
}
Date getTo () {to;
}
void setTo (Date to) {.to=to;
}
void change (int left, int right) {calendar=new GregorianCalendar () ;. setTime (from) ;. add (Calendar.DATE, left);=calendar.getTime () ;. setTime (to) ;. add (Calendar.DATE, right);=calendar.getTime ();
}
@ Overridevoid prepareRedirect (Date selected) {.setDate (selected);
}
}. javaru.ulstu.secretaryart;
java.util. Date;
javax.faces.view. ViewScoped; javax.inject. Inject; javax.inject. Named;
ru.ulstu.secretary.db. ActionByDateService;
@ Named
@ ViewScopedclass DayBacking extends DateChartBacking {
static final long serialVersionUID=8470304964338154695L;
@ InjectActionByDateService actionByDateService;
double getNextY (double y, Date x) {actionByDateService.getList (x) .stream (). mapToDouble (task - gt; task.getBalance ()). sum ();
}
@ OverrideString getRedirect () {«diary»;
}
}. javaru.ulstu.secretaryart;
java.util. Date;
javax.faces.view. ViewScoped; javax.inject. Inject; javax.inject. Named;
ru.ulstu.secretary.db. EntityService; ru.ulstu.secretary.entity. Debt;
@ Named
@ ViewScopedclass UnpaidBacking extends DateChartBacking {
static final long serialVersionUID=981680502855109121L;
@ InjectEntityService entityService;
@ Overridedouble getNextY (double y, Date x) {entityService.getList (Debt.c...