ItEr46S18RFComportamentoGraficoPlanificadorItEr31S05: Fixed bug related with deadline mark not visible in order day view
This commit is contained in:
parent
259d0c0563
commit
29ba7b6025
12 changed files with 101 additions and 40 deletions
|
|
@ -20,15 +20,10 @@
|
|||
|
||||
package org.zkoss.ganttz.timetracker.zoom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Days;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.ReadablePeriod;
|
||||
import org.zkoss.ganttz.util.Interval;
|
||||
|
||||
/**
|
||||
* Zoom level for weeks in the first level and days in the second level
|
||||
|
|
@ -37,10 +32,8 @@ import org.zkoss.ganttz.util.Interval;
|
|||
*/
|
||||
public class DetailFiveTimeTrackerState extends TimeTrackerStateUsingJodaTime {
|
||||
|
||||
|
||||
private static final int NUMBER_OF_DAYS_MINIMUM = 50;
|
||||
public static final int FIRST_LEVEL_SIZE = 140;
|
||||
|
||||
public static final int SECOND_LEVEL_SIZE = 20;
|
||||
|
||||
DetailFiveTimeTrackerState(IDetailItemModificator firstLevelModificator,
|
||||
|
|
@ -98,30 +91,13 @@ public class DetailFiveTimeTrackerState extends TimeTrackerStateUsingJodaTime {
|
|||
.plusWeeks(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
// Just change styles for holidays
|
||||
public Collection<DetailItem> getSecondLevelDetails(Interval interval) {
|
||||
// Also mark holidays and current date
|
||||
List<DetailItem> items = (List<DetailItem>) createDetailsForSecondLevel(interval);
|
||||
ArrayList<DetailItem> result = new ArrayList<DetailItem>();
|
||||
int dayOfWeek;
|
||||
|
||||
for (DetailItem detailItem : items) {
|
||||
dayOfWeek = detailItem.getStartDate().dayOfWeek().get();
|
||||
if ((dayOfWeek == 6) || (dayOfWeek == 7)) {
|
||||
detailItem.setBankHoliday(true);
|
||||
result.add(detailItem);
|
||||
} else {
|
||||
detailItem.setBankHoliday(false);
|
||||
result.add(detailItem);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Days getMinimumPeriod() {
|
||||
return Days.days(NUMBER_OF_DAYS_MINIMUM);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ZoomLevel getZoomLevel() {
|
||||
return ZoomLevel.DETAIL_FIVE;
|
||||
}
|
||||
}
|
||||
|
|
@ -98,4 +98,9 @@ public class DetailFourTimeTrackerState extends TimeTrackerStateUsingJodaTime {
|
|||
return Days.days(7 * NUMBER_OF_WEEKS_MINIMUM);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ZoomLevel getZoomLevel() {
|
||||
return ZoomLevel.DETAIL_THREE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,4 +174,11 @@ public final class DetailItem {
|
|||
return offset;
|
||||
}
|
||||
|
||||
public void markBankHoliday() {
|
||||
int dayOfWeek = getStartDate().dayOfWeek().get();
|
||||
if ((dayOfWeek == 6) || (dayOfWeek == 7)) {
|
||||
setBankHoliday(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -112,4 +112,9 @@ public class DetailOneTimeTrackerState extends TimeTrackerState {
|
|||
return new Interval(year(pairYears[0]), year(pairYears[1] + 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ZoomLevel getZoomLevel() {
|
||||
return ZoomLevel.DETAIL_ONE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,4 +113,9 @@ public class DetailThreeTimeTrackerState extends TimeTrackerStateUsingJodaTime {
|
|||
return Days.days(NUMBER_OF_MONTHS_MINIMUM * 31);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ZoomLevel getZoomLevel() {
|
||||
return ZoomLevel.DETAIL_FOUR;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -178,4 +178,9 @@ public class DetailTwoTimeTrackerState extends TimeTrackerState {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ZoomLevel getZoomLevel() {
|
||||
return ZoomLevel.DETAIL_TWO;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,12 +19,13 @@
|
|||
*/
|
||||
package org.zkoss.ganttz.timetracker.zoom;
|
||||
|
||||
|
||||
/**
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*
|
||||
*/
|
||||
public interface IDetailItemModificator {
|
||||
|
||||
public DetailItem applyModificationsTo(DetailItem item);
|
||||
public DetailItem applyModificationsTo(DetailItem item, ZoomLevel z);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,10 +57,10 @@ public class SeveralModificators implements IDetailItemModificator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public DetailItem applyModificationsTo(DetailItem item) {
|
||||
public DetailItem applyModificationsTo(DetailItem item, ZoomLevel z) {
|
||||
DetailItem result = item;
|
||||
for (IDetailItemModificator each : modificators) {
|
||||
result = each.applyModificationsTo(result);
|
||||
result = each.applyModificationsTo(result, z);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,22 +72,29 @@ public abstract class TimeTrackerState {
|
|||
Interval interval);
|
||||
|
||||
public Collection<DetailItem> getSecondLevelDetails(Interval interval) {
|
||||
// Also mark holidays and current date
|
||||
return markEvens(applyConfiguredModifications(secondLevelModificator,
|
||||
createDetailsForSecondLevel(interval)));
|
||||
if (getZoomLevel() == ZoomLevel.DETAIL_FIVE) {
|
||||
// Evens are not highlighted in day view
|
||||
return applyConfiguredModifications(
|
||||
secondLevelModificator,
|
||||
createDetailsForSecondLevel(interval), getZoomLevel());
|
||||
} else {
|
||||
return markEvens(applyConfiguredModifications(
|
||||
secondLevelModificator,
|
||||
createDetailsForSecondLevel(interval), getZoomLevel()));
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<DetailItem> getFirstLevelDetails(Interval interval) {
|
||||
return markEvens(applyConfiguredModifications(firstLevelModificator,
|
||||
createDetailsForFirstLevel(interval)));
|
||||
return applyConfiguredModifications(firstLevelModificator,
|
||||
createDetailsForFirstLevel(interval), getZoomLevel());
|
||||
}
|
||||
|
||||
private static List<DetailItem> applyConfiguredModifications(
|
||||
IDetailItemModificator modificator,
|
||||
Collection<? extends DetailItem> detailsItems) {
|
||||
Collection<? extends DetailItem> detailsItems, ZoomLevel zoomlevel) {
|
||||
List<DetailItem> result = new ArrayList<DetailItem>(detailsItems.size());
|
||||
for (DetailItem each : detailsItems) {
|
||||
result.add(modificator.applyModificationsTo(each));
|
||||
result.add(modificator.applyModificationsTo(each, zoomlevel));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -138,4 +145,6 @@ public abstract class TimeTrackerState {
|
|||
|
||||
public abstract double daysPerPixel();
|
||||
|
||||
protected abstract ZoomLevel getZoomLevel();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ import org.navalplanner.web.planner.chart.EarnedValueChartFiller;
|
|||
import org.navalplanner.web.planner.chart.IChartFiller;
|
||||
import org.navalplanner.web.planner.chart.EarnedValueChartFiller.EarnedValueType;
|
||||
import org.navalplanner.web.planner.order.OrderPlanningModel;
|
||||
import org.navalplanner.web.planner.order.BankHolidaysMarker;
|
||||
import org.navalplanner.web.print.CutyPrint;
|
||||
import org.navalplanner.web.security.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -195,6 +196,7 @@ public abstract class CompanyPlanningModel implements ICompanyPlanningModel {
|
|||
addPrintSupport(configuration);
|
||||
disableSomeFeatures(configuration);
|
||||
OrderPlanningModel.configureInitialZoomLevelFor(planner, configuration);
|
||||
configuration.setSecondLevelModificators(new BankHolidaysMarker());
|
||||
planner.setConfiguration(configuration);
|
||||
Timeplot chartLoadTimeplot = new Timeplot();
|
||||
Timeplot chartEarnedValueTimeplot = new Timeplot();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* This file is part of NavalPlan
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.navalplanner.web.planner.order;
|
||||
|
||||
import org.zkoss.ganttz.timetracker.zoom.DetailItem;
|
||||
import org.zkoss.ganttz.timetracker.zoom.IDetailItemModificator;
|
||||
import org.zkoss.ganttz.timetracker.zoom.ZoomLevel;
|
||||
|
||||
/**
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*/
|
||||
public final class BankHolidaysMarker implements
|
||||
IDetailItemModificator {
|
||||
@Override
|
||||
public DetailItem applyModificationsTo(DetailItem item, ZoomLevel z) {
|
||||
if (z == ZoomLevel.DETAIL_FIVE) {
|
||||
item.markBankHoliday();
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
|
@ -110,6 +110,7 @@ import org.zkoss.ganttz.timetracker.TimeTracker;
|
|||
import org.zkoss.ganttz.timetracker.zoom.DetailItem;
|
||||
import org.zkoss.ganttz.timetracker.zoom.IDetailItemModificator;
|
||||
import org.zkoss.ganttz.timetracker.zoom.IZoomLevelChangedListener;
|
||||
import org.zkoss.ganttz.timetracker.zoom.SeveralModificators;
|
||||
import org.zkoss.ganttz.timetracker.zoom.ZoomLevel;
|
||||
import org.zkoss.ganttz.util.Interval;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
|
|
@ -336,14 +337,21 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
|
||||
private IDetailItemModificator createDeadlineShower(Date orderDeadline) {
|
||||
final DateTime deadline = new DateTime(orderDeadline);
|
||||
return new IDetailItemModificator() {
|
||||
IDetailItemModificator deadlineMarker = new IDetailItemModificator() {
|
||||
|
||||
@Override
|
||||
public DetailItem applyModificationsTo(DetailItem item) {
|
||||
public DetailItem applyModificationsTo(DetailItem item,
|
||||
ZoomLevel zoomlevel) {
|
||||
item.markDeadlineDay(deadline);
|
||||
return item;
|
||||
}
|
||||
};
|
||||
return SeveralModificators.create(deadlineMarker,
|
||||
createBankHolidayMarker());
|
||||
}
|
||||
|
||||
public static IDetailItemModificator createBankHolidayMarker() {
|
||||
return new BankHolidaysMarker();
|
||||
}
|
||||
|
||||
private void appendTabs(Tabbox chartComponent) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue