Add i18n for some strings.

Code refactoring.
This commit is contained in:
Vova Perebykivskyi 2016-10-27 14:36:50 +03:00 committed by Dgray16
parent 2503ebf513
commit 8f23e7e863
5 changed files with 49 additions and 50 deletions

View file

@ -15,6 +15,34 @@ import org.zkoss.ganttz.util.Interval;
public class ResourceLoadDisplayData {
private final List<LoadTimeLine> timeLines;
private final Interval viewInterval;
private final Paginator<? extends BaseEntity> paginator;
private final Callable<List<Resource>> resourcesConsidered;
private final Callable<List<DayAssignment>> assignmentsConsidered;
public ResourceLoadDisplayData(
List<LoadTimeLine> timeLines,
Paginator<? extends BaseEntity> paginator,
Callable<List<Resource>> resourcesConsidered,
Callable<List<DayAssignment>> assignmentsConsidered) {
Validate.notNull(timeLines);
Validate.notNull(paginator);
Validate.notNull(resourcesConsidered);
Validate.notNull(assignmentsConsidered);
this.timeLines = timeLines;
this.viewInterval = getViewIntervalFrom(timeLines);
this.paginator = paginator;
this.resourcesConsidered = cached(resourcesConsidered);
this.assignmentsConsidered = cached(assignmentsConsidered);
}
private static <T> Callable<T> cached(Callable<T> callable) {
return new CachedCallable<>(callable);
}
@ -28,6 +56,7 @@ public class ResourceLoadDisplayData {
}
private static class CachedCallable<T> implements Callable<T> {
private final Callable<T> callable;
private T result;
@ -42,47 +71,14 @@ public class ResourceLoadDisplayData {
if (result != null) {
return result;
}
return result = callable.call();
result = callable.call();
return result;
}
}
private final List<LoadTimeLine> timeLines;
private final Interval viewInterval;
private final Paginator<? extends BaseEntity> paginator;
private final Callable<List<Resource>> resourcesConsidered;
private final Callable<List<DayAssignment>> assignmentsConsidered;
private final LocalDate filterStart;
private final LocalDate filterEnd;
public ResourceLoadDisplayData(
List<LoadTimeLine> timeLines,
LocalDate filterStart,
LocalDate filterEnd,
Paginator<? extends BaseEntity> paginator,
Callable<List<Resource>> resourcesConsidered,
Callable<List<DayAssignment>> assignmentsConsidered) {
Validate.notNull(timeLines);
Validate.notNull(paginator);
Validate.notNull(resourcesConsidered);
Validate.notNull(assignmentsConsidered);
this.timeLines = timeLines;
this.filterStart = filterStart;
this.filterEnd = filterEnd;
this.viewInterval = getViewIntervalFrom(timeLines);
this.paginator = paginator;
this.resourcesConsidered = cached(resourcesConsidered);
this.assignmentsConsidered = cached(assignmentsConsidered);
}
private static Interval getViewIntervalFrom(List<LoadTimeLine> timeLines) {
return LoadTimeLine.getIntervalFrom(timeLines);
}
@ -115,12 +111,4 @@ public class ResourceLoadDisplayData {
return resolve(assignmentsConsidered);
}
public LocalDate getFilterStart() {
return filterStart;
}
public LocalDate getFilterEnd() {
return filterEnd;
}
}

View file

@ -133,8 +133,6 @@ public class ResourceLoadModel implements IResourceLoadModel {
return new ResourceLoadDisplayData(
loadTimeLines,
parameters.getInitDateFilter(),
parameters.getEndDateFilter(),
allocationsFinder.getPaginator(),
allocationsFinder.lazilyGetResourcesIncluded(),
allocationsFinder.lazilyGetAssignmentsShown());

View file

@ -9432,4 +9432,16 @@ msgstr ""
#: libreplan-webapp/src/main/webapp/orders/_listOrderElementFiles.zul:32
msgid "No files"
msgstr ""
#: libreplan-webapp/src/main/webapp/common/pageNotFound.zul:57
msgid "Help/Info pages are not generated"
msgstr ""
#: libreplan-webapp/src/main/webapp/common/pageNotFound.zul:59
msgid "If you want to see help/info page then"
msgstr ""
#: libreplan-webapp/src/main/webapp/common/pageNotFound.zul:61
msgid "Open file HACKING.rst in project directory and read Part LibrePlan documentation generation, how to generate help/info pages"
msgstr ""

View file

@ -54,11 +54,11 @@
<separator height="5px"/>
<label value="Help/Info pages are not generated!"/>
<label value="${i18n:_('Help/Info pages are not generated')}!"/>
<label value="If you want to see help/info page then:"/>
<label value="${i18n:_('If you want to see help/info page then')}:"/>
<label value="Open file HACKING.rst in project directory and read Part 'LibrePlan documentation generation', how to generate help/info pages."/>
<label value="${i18n:_('Open file HACKING.rst in project directory and read Part LibrePlan documentation generation, how to generate help/info pages')}."/>
</vbox>
</vbox>
</window>

View file

@ -172,6 +172,7 @@ public class SubcontractServiceTest {
@Test
@Transactional
/** TODO Test could fail sometimes */
public void validSubcontractedTaskData() {
int previous = orderDAO.getOrders().size();