ItEr59S07RFAspectosGraficosRecursoLimitantesItEr58S08: Applied filtering to limiting resources
This commit is contained in:
parent
acbad5c9ff
commit
761529e5cd
9 changed files with 199 additions and 139 deletions
|
|
@ -55,6 +55,10 @@ public class TimeTracker {
|
|||
public Collection<DetailItem> selectsSecondLevel(
|
||||
Collection<DetailItem> secondLevelDetails);
|
||||
|
||||
public Interval getCurrentPaginationInterval();
|
||||
|
||||
public void resetInterval();
|
||||
|
||||
}
|
||||
|
||||
private ZoomLevel detailLevel = ZoomLevel.DETAIL_ONE;
|
||||
|
|
@ -80,6 +84,10 @@ public class TimeTracker {
|
|||
|
||||
private IDetailItemFilter filter = null;
|
||||
|
||||
public IDetailItemFilter getFilter() {
|
||||
return filter;
|
||||
}
|
||||
|
||||
public TimeTracker(Interval interval, ZoomLevel zoomLevel, Component parent) {
|
||||
this(interval, zoomLevel, SeveralModificators.empty(),
|
||||
SeveralModificators.empty(), parent);
|
||||
|
|
@ -115,6 +123,7 @@ public class TimeTracker {
|
|||
|
||||
public void setFilter(IDetailItemFilter filter) {
|
||||
this.filter = filter;
|
||||
datesMapper = null;
|
||||
}
|
||||
|
||||
public ZoomLevel getDetailLevel() {
|
||||
|
|
@ -194,10 +203,20 @@ public class TimeTracker {
|
|||
realIntervalCached = null;
|
||||
}
|
||||
|
||||
public void resetMapper() {
|
||||
datesMapper = null;
|
||||
realIntervalCached = null;
|
||||
}
|
||||
|
||||
public IDatesMapper getMapper() {
|
||||
if (datesMapper == null) {
|
||||
datesMapper = new DatesMapperOnInterval(getHorizontalSize(),
|
||||
getRealInterval());
|
||||
if (filter == null) {
|
||||
datesMapper = new DatesMapperOnInterval(getHorizontalSize(),
|
||||
getRealInterval());
|
||||
} else {
|
||||
datesMapper = new DatesMapperOnInterval(getHorizontalSize(),
|
||||
filter.getCurrentPaginationInterval());
|
||||
}
|
||||
}
|
||||
return datesMapper;
|
||||
}
|
||||
|
|
@ -313,4 +332,5 @@ public class TimeTracker {
|
|||
}
|
||||
return new LocalDate(start).minusWeeks(2).toDateMidnight().toDate();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@ public class Interval {
|
|||
|
||||
public double getProportion(Date date) {
|
||||
if (!isIncluded(date)) {
|
||||
throw new IllegalArgumentException("date " + date
|
||||
+ " must be between [" + start + "," + finish + "]");
|
||||
// Negative proportions are allowed for tasks starting before
|
||||
// interval so no exception raised
|
||||
}
|
||||
return ((double) date.getTime() - start.getTime()) / lengthBetween;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,12 +112,8 @@ public interface ILimitingResourceQueueModel {
|
|||
|
||||
/**
|
||||
* Loads {@link LimitingResourceQueue} and unassigned {@link LimitingResourceQueueElement} from DB
|
||||
*
|
||||
* @param filterByResources
|
||||
*/
|
||||
void initGlobalView(boolean filterByResources);
|
||||
|
||||
void initGlobalView(Order filterBy, boolean filterByResources);
|
||||
void initGlobalView();
|
||||
|
||||
/**
|
||||
* Inserts element into queue at a specific time
|
||||
|
|
@ -134,12 +130,17 @@ public interface ILimitingResourceQueueModel {
|
|||
void appropriativeAllocation(LimitingResourceQueueElement element, LimitingResourceQueue queue,
|
||||
DateAndHour allocationTime);
|
||||
|
||||
void unschedule(LimitingResourceQueueElement element);
|
||||
|
||||
|
||||
void removeUnassignedLimitingResourceQueueElement(
|
||||
LimitingResourceQueueElement element);
|
||||
|
||||
void setTimeTrackerState(ZoomLevel zoomLevel);
|
||||
|
||||
void unschedule(LimitingResourceQueueElement element);
|
||||
List<LimitingResourceQueue> getAssignableQueues(
|
||||
LimitingResourceQueueElement element);
|
||||
|
||||
void init(LimitingResourceQueueElement element);
|
||||
|
||||
boolean userCanRead(Order order, String loginName);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ import org.apache.commons.lang.Validate;
|
|||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.Period;
|
||||
import org.navalplanner.business.calendars.entities.BaseCalendar;
|
||||
import org.navalplanner.business.calendars.entities.CalendarAvailability;
|
||||
import org.navalplanner.business.calendars.entities.CalendarData;
|
||||
|
|
@ -114,48 +113,25 @@ public class LimitingResourceQueueModel implements ILimitingResourceQueueModel {
|
|||
|
||||
private Set<LimitingResourceQueueElement> toBeSaved = new HashSet<LimitingResourceQueueElement>();
|
||||
|
||||
private ZoomLevel zoomLevel = ZoomLevel.DETAIL_THREE;
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public void initGlobalView(boolean filterByResources) {
|
||||
public void initGlobalView() {
|
||||
doGlobalView();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public void initGlobalView(Order filterBy, boolean filterByResources) {
|
||||
doGlobalView();
|
||||
}
|
||||
|
||||
private void doGlobalView() {
|
||||
List<LimitingResourceQueueElement> unassigned = findUnassignedLimitingResourceQueueElements();
|
||||
List<LimitingResourceQueue> queues = loadLimitingResourceQueues();
|
||||
queuesState = new QueuesState(queues, unassigned);
|
||||
final Date startingDate = getEarliestDate();
|
||||
Date endDate = (new LocalDate(startingDate)).plus(intervalIncrease())
|
||||
// TODO Replace by get latestDate and fill with minimum size
|
||||
System.out.println("DOGLOBAL!");
|
||||
Date endDate = (new LocalDate(startingDate)).plusYears(2)
|
||||
.toDateTimeAtCurrentTime().toDate();
|
||||
viewInterval = new Interval(startingDate, endDate);
|
||||
}
|
||||
|
||||
private Period intervalIncrease() {
|
||||
switch (zoomLevel) {
|
||||
case DETAIL_ONE:
|
||||
return Period.years(5);
|
||||
case DETAIL_TWO:
|
||||
return Period.years(5);
|
||||
case DETAIL_THREE:
|
||||
return Period.years(2);
|
||||
case DETAIL_FOUR:
|
||||
return Period.months(6);
|
||||
case DETAIL_FIVE:
|
||||
return Period.weeks(6);
|
||||
case DETAIL_SIX:
|
||||
return Period.weeks(6);
|
||||
}
|
||||
return Period.years(5);
|
||||
}
|
||||
|
||||
private Date getEarliestDate() {
|
||||
final LimitingResourceQueueElement element = getEarliestQueueElement();
|
||||
return (element != null) ? element.getStartDate()
|
||||
|
|
@ -649,11 +625,6 @@ public class LimitingResourceQueueModel implements ILimitingResourceQueueModel {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTimeTrackerState(ZoomLevel timeTrackerState) {
|
||||
this.zoomLevel = timeTrackerState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LimitingResourceQueue> getAssignableQueues(
|
||||
LimitingResourceQueueElement element) {
|
||||
|
|
@ -687,6 +658,7 @@ public class LimitingResourceQueueModel implements ILimitingResourceQueueModel {
|
|||
return beingEdited;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void appropriativeAllocation(LimitingResourceQueueElement _element, LimitingResourceQueue _queue,
|
||||
DateAndHour allocationTime) {
|
||||
|
|
@ -759,5 +731,4 @@ public class LimitingResourceQueueModel implements ILimitingResourceQueueModel {
|
|||
return (element.getStartTime().isBefore(time) || element.getStartTime().isEquals(time))
|
||||
&& (element.getEndTime().isAfter(time) || element.getEndTime().isEquals(time));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,26 +112,17 @@ public class LimitingResourcesController extends GenericForwardComposer {
|
|||
reload();
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
// by default show the task by resources
|
||||
boolean filterByResources = true;
|
||||
reload(filterByResources);
|
||||
}
|
||||
private Listbox listAssignableQueues;
|
||||
|
||||
private void reload(boolean filterByResources) {
|
||||
private Listbox listCandidateGaps;
|
||||
|
||||
public void reload() {
|
||||
try {
|
||||
|
||||
if (filterBy == null) {
|
||||
limitingResourceQueueModel.initGlobalView(filterByResources);
|
||||
} else {
|
||||
limitingResourceQueueModel.initGlobalView(filterBy,
|
||||
filterByResources);
|
||||
}
|
||||
limitingResourceQueueModel.initGlobalView();
|
||||
|
||||
// Initialize interval
|
||||
timeTracker = buildTimeTracker();
|
||||
limitingResourceQueueModel.setTimeTrackerState(timeTracker
|
||||
.getDetailLevel());
|
||||
|
||||
limitingResourcesPanel = buildLimitingResourcesPanel();
|
||||
addListeners();
|
||||
|
|
@ -187,7 +178,7 @@ public class LimitingResourcesController extends GenericForwardComposer {
|
|||
|
||||
public void onApplyFilter(boolean filterByResources) {
|
||||
limitingResourcesPanel.clearComponents();
|
||||
reload(filterByResources);
|
||||
reload();
|
||||
}
|
||||
|
||||
private void addCommands(LimitingResourcesPanel limitingResourcesPanel) {
|
||||
|
|
@ -196,8 +187,8 @@ public class LimitingResourcesController extends GenericForwardComposer {
|
|||
|
||||
private TimeTracker buildTimeTracker() {
|
||||
return timeTracker = new TimeTracker(limitingResourceQueueModel
|
||||
.getViewInterval(), ZoomLevel.DETAIL_THREE, SeveralModificators
|
||||
.create(),
|
||||
.getViewInterval(), ZoomLevel.DETAIL_THREE,
|
||||
SeveralModificators.create(),
|
||||
SeveralModificators.create(new BankHolidaysMarker()), parent);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import org.navalplanner.business.planner.limiting.entities.LimitingResourceQueue
|
|||
import org.navalplanner.business.resources.daos.IResourceDAO;
|
||||
import org.navalplanner.business.resources.entities.LimitingResourceQueue;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.zkoss.ganttz.resourceload.IFilterChangedListener;
|
||||
import org.zkoss.ganttz.timetracker.TimeTracker;
|
||||
import org.zkoss.ganttz.timetracker.TimeTrackerComponent;
|
||||
import org.zkoss.ganttz.timetracker.TimeTracker.IDetailItemFilter;
|
||||
|
|
@ -46,7 +45,6 @@ import org.zkoss.ganttz.util.ComponentsFinder;
|
|||
import org.zkoss.ganttz.util.Interval;
|
||||
import org.zkoss.ganttz.util.MutableTreeModel;
|
||||
import org.zkoss.ganttz.util.OnZKDesktopRegistry;
|
||||
import org.zkoss.ganttz.util.WeakReferencedListeners;
|
||||
import org.zkoss.ganttz.util.script.IScriptsRegister;
|
||||
import org.zkoss.zk.au.out.AuInvoke;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
|
|
@ -61,7 +59,6 @@ import org.zkoss.zul.Listitem;
|
|||
import org.zkoss.zul.Separator;
|
||||
import org.zkoss.zul.SimpleListModel;
|
||||
|
||||
|
||||
public class LimitingResourcesPanel extends HtmlMacroComponent {
|
||||
|
||||
public interface IToolbarCommand {
|
||||
|
|
@ -87,37 +84,41 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
private Listbox listZoomLevels;
|
||||
|
||||
private Button paginationDownButton;
|
||||
@Autowired
|
||||
|
||||
private Button paginationUpButton;
|
||||
|
||||
private Listbox horizontalPagination;
|
||||
|
||||
private Component insertionPointLeftPanel;
|
||||
private Component insertionPointRightPanel;
|
||||
private Component insertionPointTimetracker;
|
||||
|
||||
public void paginationDown() {
|
||||
paginatorFilter.previous();
|
||||
doPaginationStuff();
|
||||
reloadPanelComponents();
|
||||
horizontalPagination.setSelectedIndex(Math.max(0, horizontalPagination
|
||||
.getSelectedIndex()) + 1);
|
||||
}
|
||||
|
||||
public void paginationUp() {
|
||||
paginatorFilter.next();
|
||||
doPaginationStuff();
|
||||
reloadPanelComponents();
|
||||
horizontalPagination.setSelectedIndex(Math.max(0, horizontalPagination
|
||||
.getSelectedIndex()) + 1);
|
||||
}
|
||||
|
||||
private Listbox horizontalPagination;
|
||||
|
||||
private WeakReferencedListeners<IFilterChangedListener> zoomListeners = WeakReferencedListeners
|
||||
.create();
|
||||
|
||||
@Autowired
|
||||
IResourceDAO resourcesDAO;
|
||||
|
||||
private LimitingDependencyList dependencyList = new LimitingDependencyList(this);
|
||||
private LimitingDependencyList dependencyList = new LimitingDependencyList(
|
||||
this);
|
||||
|
||||
private PaginatorFilter paginatorFilter;
|
||||
|
||||
private TimeTrackerComponent timeTrackerHeader;
|
||||
|
||||
private IZoomLevelChangedListener zoomChangedListener;
|
||||
|
||||
/**
|
||||
* Returns the closest upper {@link LimitingResourcesPanel} instance going
|
||||
* all the way up from comp
|
||||
|
|
@ -125,7 +126,8 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
* @param comp
|
||||
* @return
|
||||
*/
|
||||
public static LimitingResourcesPanel getLimitingResourcesPanel(Component comp) {
|
||||
public static LimitingResourcesPanel getLimitingResourcesPanel(
|
||||
Component comp) {
|
||||
if (comp == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -135,7 +137,8 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
return getLimitingResourcesPanel(comp.getParent());
|
||||
}
|
||||
|
||||
public LimitingResourcesPanel(LimitingResourcesController limitingResourcesController,
|
||||
public LimitingResourcesPanel(
|
||||
LimitingResourcesController limitingResourcesController,
|
||||
TimeTracker timeTracker) {
|
||||
init(limitingResourcesController, timeTracker);
|
||||
}
|
||||
|
|
@ -148,11 +151,11 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
limitingResourcesController, true);
|
||||
|
||||
treeModel = createModelForTree();
|
||||
|
||||
timeTrackerComponent = timeTrackerForLimitingResourcesPanel(timeTracker);
|
||||
queueListComponent = new QueueListComponent(timeTracker, treeModel);
|
||||
|
||||
leftPane = new LimitingResourcesLeftPane(treeModel,
|
||||
queueListComponent);
|
||||
leftPane = new LimitingResourcesLeftPane(treeModel, queueListComponent);
|
||||
registerNeededScripts();
|
||||
}
|
||||
|
||||
|
|
@ -257,51 +260,52 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
|
||||
super.afterCompose();
|
||||
paginatorFilter = new PaginatorFilter();
|
||||
listZoomLevels = (Listbox) getFellow("listZoomLevels");
|
||||
horizontalPagination = (Listbox) getFellow("horizontalPagination");
|
||||
// First two levels are excluded
|
||||
|
||||
initializeBindings();
|
||||
|
||||
listZoomLevels
|
||||
.setSelectedIndex(timeTracker.getDetailLevel().ordinal() - 2);
|
||||
|
||||
// Pagination stuff
|
||||
paginationUpButton = (Button) getFellow("paginationUpButton");
|
||||
paginationDownButton = (Button) getFellow("paginationDownButton");
|
||||
paginationUpButton.setDisabled(isLastPage());
|
||||
|
||||
paginatorFilter.setInterval(timeTracker.getRealInterval());
|
||||
timeTracker.setFilter(paginatorFilter);
|
||||
paginatorFilter.setZoomLevel(timeTracker.getDetailLevel());
|
||||
doPaginationStuff();
|
||||
|
||||
// Insert leftPane component with limitingresources list
|
||||
getFellow("insertionPointLeftPanel").appendChild(leftPane);
|
||||
insertionPointLeftPanel.appendChild(leftPane);
|
||||
leftPane.afterCompose();
|
||||
|
||||
getFellow("insertionPointRightPanel").appendChild(timeTrackerComponent);
|
||||
getFellow("insertionPointRightPanel").appendChild(queueListComponent);
|
||||
insertionPointRightPanel.appendChild(timeTrackerComponent);
|
||||
insertionPointRightPanel.appendChild(queueListComponent);
|
||||
queueListComponent.afterCompose();
|
||||
|
||||
dependencyList = generateDependencyComponentsList();
|
||||
if (dependencyList != null) {
|
||||
dependencyList.afterCompose();
|
||||
getFellow("insertionPointRightPanel").appendChild(dependencyList);
|
||||
insertionPointRightPanel.appendChild(dependencyList);
|
||||
}
|
||||
|
||||
IZoomLevelChangedListener zoomChangedListener = new IZoomLevelChangedListener() {
|
||||
zoomChangedListener = new IZoomLevelChangedListener() {
|
||||
@Override
|
||||
public void zoomLevelChanged(ZoomLevel newDetailLevel) {
|
||||
dependencyList.getChildren().clear();
|
||||
getFellow("insertionPointRightPanel").appendChild(
|
||||
dependencyList);
|
||||
dependencyList = generateDependencyComponentsList();
|
||||
dependencyList.afterCompose();
|
||||
rebuildDependencies();
|
||||
timeTracker.resetMapper();
|
||||
|
||||
paginatorFilter.setInterval(timeTracker.getRealInterval());
|
||||
timeTracker.setFilter(paginatorFilter);
|
||||
|
||||
reloadPanelComponents();
|
||||
|
||||
paginatorFilter.populateHorizontalListbox();
|
||||
|
||||
// Position in first page
|
||||
paginatorFilter.goToHorizontalPage(0);
|
||||
reloadComponent();
|
||||
queueListComponent.invalidate();
|
||||
queueListComponent.afterCompose();
|
||||
rebuildDependencies();
|
||||
|
||||
paginatorFilter.setZoomLevel(newDetailLevel);
|
||||
doPaginationStuff();
|
||||
}
|
||||
|
||||
};
|
||||
|
|
@ -309,22 +313,45 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
|
||||
// Insert timetracker headers
|
||||
timeTrackerHeader = createTimeTrackerHeader();
|
||||
getFellow("insertionPointTimetracker").appendChild(timeTrackerHeader);
|
||||
insertionPointTimetracker.appendChild(timeTrackerHeader);
|
||||
timeTrackerHeader.afterCompose();
|
||||
timeTrackerComponent.afterCompose();
|
||||
|
||||
paginatorFilter.populateHorizontalListbox();
|
||||
}
|
||||
|
||||
private void doPaginationStuff() {
|
||||
paginatorFilter.setInterval(timeTracker.getRealInterval());
|
||||
timeTracker.setFilter(paginatorFilter);
|
||||
private void rebuildDependencies() {
|
||||
dependencyList.getChildren().clear();
|
||||
insertionPointRightPanel.appendChild(dependencyList);
|
||||
dependencyList = generateDependencyComponentsList();
|
||||
dependencyList.afterCompose();
|
||||
}
|
||||
|
||||
private void initializeBindings() {
|
||||
|
||||
// Zoom and pagination
|
||||
listZoomLevels = (Listbox) getFellow("listZoomLevels");
|
||||
horizontalPagination = (Listbox) getFellow("horizontalPagination");
|
||||
paginationUpButton = (Button) getFellow("paginationUpButton");
|
||||
paginationDownButton = (Button) getFellow("paginationDownButton");
|
||||
|
||||
insertionPointLeftPanel = getFellow("insertionPointLeftPanel");
|
||||
insertionPointRightPanel = getFellow("insertionPointRightPanel");
|
||||
insertionPointTimetracker = getFellow("insertionPointTimetracker");
|
||||
}
|
||||
|
||||
private void reloadPanelComponents() {
|
||||
|
||||
timeTrackerComponent.getChildren().clear();
|
||||
paginatorFilter.populateHorizontalListbox();
|
||||
|
||||
// paginatorFilter.setInterval(timeTracker.getRealInterval());
|
||||
// timeTracker.setFilter(paginatorFilter);
|
||||
|
||||
if (timeTrackerHeader != null) {
|
||||
timeTrackerHeader.afterCompose();
|
||||
timeTrackerComponent.afterCompose();
|
||||
}
|
||||
dependencyList.invalidate();
|
||||
}
|
||||
|
||||
private void doDirectPaginationStuff() {
|
||||
|
|
@ -337,8 +364,6 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private boolean isLastPage() {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -351,24 +376,26 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
.keySet()) {
|
||||
for (LimitingResourceQueueDependency dependency : queueElement
|
||||
.getDependenciesAsOrigin()) {
|
||||
addDependencyComponent(dependencyList, queueElementsMap, dependency);
|
||||
addDependencyComponent(dependencyList, queueElementsMap,
|
||||
dependency);
|
||||
}
|
||||
}
|
||||
return dependencyList;
|
||||
}
|
||||
|
||||
public void addDependencyComponent(LimitingResourceQueueDependency dependency) {
|
||||
public void addDependencyComponent(
|
||||
LimitingResourceQueueDependency dependency) {
|
||||
final Map<LimitingResourceQueueElement, QueueTask> queueElementsMap = queueListComponent
|
||||
.getLimitingResourceElementToQueueTaskMap();
|
||||
addDependencyComponent(dependencyList, queueElementsMap, dependency);
|
||||
}
|
||||
|
||||
private void addDependencyComponent(
|
||||
LimitingDependencyList dependencyList,
|
||||
private void addDependencyComponent(LimitingDependencyList dependencyList,
|
||||
Map<LimitingResourceQueueElement, QueueTask> queueElementsMap,
|
||||
LimitingResourceQueueDependency dependency) {
|
||||
|
||||
LimitingDependencyComponent component = createDependencyComponent(queueElementsMap, dependency);
|
||||
LimitingDependencyComponent component = createDependencyComponent(
|
||||
queueElementsMap, dependency);
|
||||
if (component != null) {
|
||||
dependencyList.addDependencyComponent(component);
|
||||
}
|
||||
|
|
@ -430,8 +457,16 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
paginatorFilter.goToHorizontalPage(horizontalPagination
|
||||
.getSelectedIndex());
|
||||
|
||||
|
||||
doDirectPaginationStuff();
|
||||
reloadComponent();
|
||||
|
||||
queueListComponent.invalidate();
|
||||
queueListComponent.afterCompose();
|
||||
|
||||
rebuildDependencies();
|
||||
// paginatorFilter.populateHorizontalListbox();
|
||||
|
||||
}
|
||||
|
||||
private void reloadComponent() {
|
||||
|
|
@ -441,14 +476,13 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
timeTracker.addZoomListener(new IZoomLevelChangedListener() {
|
||||
@Override
|
||||
public void zoomLevelChanged(ZoomLevel detailLevel) {
|
||||
paginatorFilter.setZoomLevel(detailLevel);
|
||||
timeTracker.getDetailsFirstLevel().iterator().next();
|
||||
paginatorFilter.setInterval(timeTracker.getRealInterval());
|
||||
timeTracker.setFilter(paginatorFilter);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private class PaginatorFilter implements IDetailItemFilter {
|
||||
|
||||
private DateTime intervalStart;
|
||||
|
|
@ -457,10 +491,13 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
private DateTime paginatorStart;
|
||||
private DateTime paginatorEnd;
|
||||
|
||||
private ZoomLevel zoomLevel = ZoomLevel.DETAIL_THREE;
|
||||
@Override
|
||||
public Interval getCurrentPaginationInterval() {
|
||||
return new Interval(paginatorStart.toDate(), paginatorEnd.toDate());
|
||||
}
|
||||
|
||||
private Period intervalIncrease() {
|
||||
switch (zoomLevel) {
|
||||
switch (timeTracker.getDetailLevel()) {
|
||||
case DETAIL_ONE:
|
||||
return Period.years(5);
|
||||
case DETAIL_TWO:
|
||||
|
|
@ -489,13 +526,14 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
updatePaginationButtons();
|
||||
}
|
||||
|
||||
public void setZoomLevel(ZoomLevel detailLevel) {
|
||||
zoomLevel = detailLevel;
|
||||
@Override
|
||||
public void resetInterval() {
|
||||
setInterval(timeTracker.getRealInterval());
|
||||
}
|
||||
|
||||
public void paginationDown() {
|
||||
paginatorFilter.previous();
|
||||
doPaginationStuff();
|
||||
reloadPanelComponents();
|
||||
horizontalPagination.setSelectedIndex(horizontalPagination
|
||||
.getSelectedIndex() - 1);
|
||||
|
||||
|
|
@ -503,7 +541,7 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
|
||||
public void paginationUp() {
|
||||
paginatorFilter.next();
|
||||
doPaginationStuff();
|
||||
reloadPanelComponents();
|
||||
horizontalPagination.setSelectedIndex(Math.max(0,
|
||||
horizontalPagination.getSelectedIndex()) + 1);
|
||||
}
|
||||
|
|
@ -537,9 +575,7 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
}
|
||||
|
||||
public void populateHorizontalListbox() {
|
||||
if (horizontalPagination != null) {
|
||||
horizontalPagination.getItems().clear();
|
||||
}
|
||||
horizontalPagination.getItems().clear();
|
||||
DateTimeFormatter df = DateTimeFormat.forPattern("dd/MMM/yyyy");
|
||||
DateTime intervalStart = new DateTime(timeTracker.getRealInterval()
|
||||
.getStart());
|
||||
|
|
@ -564,17 +600,21 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
}
|
||||
|
||||
public void goToHorizontalPage(int interval) {
|
||||
if (interval >= 0) {
|
||||
paginatorStart = intervalStart;
|
||||
for (int i = 0; i < interval; i++) {
|
||||
paginatorStart = paginatorStart.plus(intervalIncrease());
|
||||
}
|
||||
paginatorEnd = paginatorStart.plus(intervalIncrease());
|
||||
if ((paginatorEnd.plus(intervalIncrease()).isAfter(intervalEnd))) {
|
||||
paginatorEnd = paginatorEnd.plus(intervalIncrease());
|
||||
}
|
||||
updatePaginationButtons();
|
||||
paginatorStart = intervalStart;
|
||||
// paginatorStart = new
|
||||
// DateTime(timeTracker.getRealInterval().getStart());
|
||||
paginatorStart = timeTracker.getDetailsFirstLevel().iterator()
|
||||
.next().getStartDate();
|
||||
|
||||
for (int i = 0; i < interval; i++) {
|
||||
paginatorStart = paginatorStart.plus(intervalIncrease());
|
||||
}
|
||||
paginatorEnd = paginatorStart.plus(intervalIncrease());
|
||||
if ((paginatorEnd.plus(intervalIncrease()).isAfter(intervalEnd))) {
|
||||
paginatorEnd = paginatorEnd.plus(intervalIncrease());
|
||||
}
|
||||
timeTracker.resetMapper();
|
||||
updatePaginationButtons();
|
||||
}
|
||||
|
||||
private void updatePaginationButtons() {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.navalplanner.business.common.exceptions.ValidationException;
|
||||
import org.navalplanner.business.orders.entities.OrderElement;
|
||||
import org.navalplanner.business.planner.entities.DayAssignment;
|
||||
|
|
@ -103,7 +104,7 @@ public class QueueComponent extends XulElement implements
|
|||
public void zoomLevelChanged(ZoomLevel detailLevel) {
|
||||
getChildren().clear();
|
||||
createChildren(limitingResourceQueue, timeTracker.getMapper());
|
||||
invalidate();
|
||||
// invalidate();
|
||||
}
|
||||
};
|
||||
this.timeTracker.addZoomListener(zoomChangedListener);
|
||||
|
|
@ -147,13 +148,27 @@ public class QueueComponent extends XulElement implements
|
|||
appendChild(queueTask);
|
||||
}
|
||||
|
||||
private static List<QueueTask> createQueueTasks(
|
||||
IDatesMapper datesMapper,
|
||||
private List<QueueTask> createQueueTasks(IDatesMapper datesMapper,
|
||||
Set<LimitingResourceQueueElement> list) {
|
||||
|
||||
List<QueueTask> result = new ArrayList<QueueTask>();
|
||||
|
||||
org.zkoss.ganttz.util.Interval interval = null;
|
||||
if (timeTracker.getFilter() != null) {
|
||||
timeTracker.getFilter().resetInterval();
|
||||
interval = timeTracker.getFilter().getCurrentPaginationInterval();
|
||||
}
|
||||
for (LimitingResourceQueueElement each : list) {
|
||||
result.add(createQueueTask(datesMapper, each));
|
||||
if (interval != null) {
|
||||
if (each.getEndDate().toDateMidnight().isAfter(
|
||||
(new DateTime(interval.getStart())).toDateMidnight())
|
||||
&& each.getStartDate().toDateMidnight().isBefore(
|
||||
new DateTime(interval.getFinish()))) {
|
||||
result.add(createQueueTask(datesMapper, each));
|
||||
}
|
||||
} else {
|
||||
result.add(createQueueTask(datesMapper, each));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -188,6 +203,8 @@ public class QueueComponent extends XulElement implements
|
|||
final GenericResourceAllocation generic = (GenericResourceAllocation) resourceAllocation;
|
||||
result.append(_("Criteria: {0} ", Criterion.getNames(generic.getCriterions())));
|
||||
}
|
||||
result.append("[" + element.getStartDate().toString() + ","
|
||||
+ element.getEndDate().toString() + "]");
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
|
@ -223,14 +240,19 @@ public class QueueComponent extends XulElement implements
|
|||
LimitingResourceQueueElement queueElement) {
|
||||
|
||||
QueueTask result = new QueueTask(queueElement);
|
||||
result.setClass("queue-element");
|
||||
String cssClass = "queue-element";
|
||||
|
||||
result.setTooltiptext(createTooltiptext(queueElement));
|
||||
|
||||
result.setLeft(forCSS(getStartPixels(datesMapper, queueElement)));
|
||||
int startPixels = getStartPixels(datesMapper, queueElement);
|
||||
result.setLeft(forCSS(startPixels));
|
||||
if (startPixels < 0) {
|
||||
cssClass += " truncated-start";
|
||||
}
|
||||
result.setWidth(forCSS(getWidthPixels(datesMapper, queueElement)));
|
||||
|
||||
result.appendChild(generateNonWorkableShade(datesMapper, queueElement));
|
||||
result.setClass(cssClass);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -469,6 +469,11 @@ public class AdvancedAllocationController extends GenericForwardComposer {
|
|||
|
||||
private ZoomLevel zoomLevel = ZoomLevel.DETAIL_ONE;
|
||||
|
||||
@Override
|
||||
public Interval getCurrentPaginationInterval() {
|
||||
return new Interval(intervalStart.toDate(), intervalEnd.toDate());
|
||||
}
|
||||
|
||||
private Period intervalIncrease() {
|
||||
switch (zoomLevel) {
|
||||
case DETAIL_ONE:
|
||||
|
|
@ -595,6 +600,11 @@ public class AdvancedAllocationController extends GenericForwardComposer {
|
|||
}
|
||||
updatePaginationButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetInterval() {
|
||||
setInterval(timeTracker.getRealInterval());
|
||||
}
|
||||
}
|
||||
|
||||
private void createComponents() {
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@ function addLimitingResourcesListMethods(object) {
|
|||
}
|
||||
|
||||
object.adjustTimeTrackerSize = function(cmp) {
|
||||
var _firstWatarmark = YAHOO.util.Selector.query('.rightpanellayout tr#watermark td')[0];
|
||||
|
||||
if (watermark() != null) {
|
||||
watermark().style["height"] = cmp.clientHeight + "px";
|
||||
}
|
||||
|
|
@ -93,10 +95,13 @@ function addLimitingResourcesListMethods(object) {
|
|||
if (timetracker() != null) {
|
||||
timetracker().style["width"] = cmp.clientWidth + "px";
|
||||
|
||||
YAHOO.util.Selector.query('.limitingresourceslist')[0].style["width"] = YAHOO.util.Selector
|
||||
YAHOO.util.Selector.query('.limitingresourceslist')[0].style["width"] = YAHOO.util.Selector
|
||||
.query('.second_level_')[0].clientWidth + "px";
|
||||
YAHOO.util.Selector.query('.rightpanellayout tr#watermark td')[0].style["height"] =
|
||||
YAHOO.util.Selector.query('.limitingresourceslist')[0].clientHeight + 120 + "px";
|
||||
|
||||
if (_firstWatarmark != undefined ) {
|
||||
_firstWatarmark.style["height"] =YAHOO.util.Selector.query('.limitingresourceslist')[0].clientHeight + 120 + "px";
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue