[Bug #765] Fixes the position of the scroll bar in the limiting planning.
it calculates the new position of the scrollbar when the zoom is changed. FEA : ItEr68S04BugFixing
This commit is contained in:
parent
6b16b19327
commit
ea39f8e08b
2 changed files with 114 additions and 3 deletions
|
|
@ -28,6 +28,7 @@ import java.util.Set;
|
|||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.Period;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
|
|
@ -97,6 +98,9 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
private Component insertionPointRightPanel;
|
||||
private Component insertionPointTimetracker;
|
||||
|
||||
private LocalDate previousStart;
|
||||
private Interval previousInterval;
|
||||
|
||||
public void paginationDown() {
|
||||
horizontalPagination.setSelectedIndex(horizontalPagination
|
||||
.getSelectedIndex() - 1);
|
||||
|
|
@ -179,14 +183,20 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
}
|
||||
|
||||
public void setZoomLevel(final ZoomLevel zoomLevel) {
|
||||
savePreviousData();
|
||||
getTimeTrackerComponent().updateDayScroll();
|
||||
timeTracker.setZoomLevel(zoomLevel);
|
||||
}
|
||||
|
||||
public void zoomIncrease() {
|
||||
savePreviousData();
|
||||
getTimeTrackerComponent().updateDayScroll();
|
||||
timeTracker.zoomIncrease();
|
||||
}
|
||||
|
||||
public void zoomDecrease() {
|
||||
savePreviousData();
|
||||
getTimeTrackerComponent().updateDayScroll();
|
||||
timeTracker.zoomDecrease();
|
||||
}
|
||||
|
||||
|
|
@ -228,6 +238,42 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
return toolbar;
|
||||
}
|
||||
|
||||
private TimeTrackerComponent timeTrackerForLimitingResourcesPanel(
|
||||
TimeTracker timeTracker) {
|
||||
return new TimeTrackerComponent(timeTracker) {
|
||||
@Override
|
||||
protected void scrollHorizontalPercentage(int daysDisplacement) {
|
||||
response("", new AuInvoke(queueListComponent,
|
||||
"scroll_horizontal", daysDisplacement + ""));
|
||||
moveCurrentPositionScroll();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void moveCurrentPositionScroll() {
|
||||
// get the previous data.
|
||||
LocalDate previousStart = getPreviousStart();
|
||||
|
||||
// get the current data
|
||||
int diffDays = getTimeTrackerComponent().getDiffDays(
|
||||
previousStart);
|
||||
double pixelPerDay = getTimeTrackerComponent().getPixelPerDay();
|
||||
|
||||
response("move_scroll", new AuInvoke(queueListComponent,
|
||||
"move_scroll", "" + diffDays, "" + pixelPerDay));
|
||||
}
|
||||
|
||||
protected void updateCurrentDayScroll() {
|
||||
System.out.println("updateCurrentDayScroll");
|
||||
double previousPixelPerDay = getTimeTracker().getMapper()
|
||||
.getPixelsPerDay().doubleValue();
|
||||
|
||||
response("update_day_scroll", new AuInvoke(queueListComponent,
|
||||
"update_day_scroll", "" + previousPixelPerDay));
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompose() {
|
||||
|
||||
|
|
@ -286,6 +332,7 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
timeTracker.setFilter(paginatorFilter);
|
||||
paginatorFilter.populateHorizontalListbox();
|
||||
paginatorFilter.goToHorizontalPage(0);
|
||||
adjustZoomPositionScroll();
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -318,6 +365,10 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
};
|
||||
}
|
||||
|
||||
private void adjustZoomPositionScroll() {
|
||||
getTimeTrackerComponent().movePositionScroll();
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private TimeTrackerComponent createTimeTrackerComponent() {
|
||||
return new TimeTrackerComponent(timeTracker) {
|
||||
|
|
@ -578,4 +629,18 @@ public class LimitingResourcesPanel extends HtmlMacroComponent {
|
|||
}
|
||||
}
|
||||
|
||||
private void savePreviousData() {
|
||||
TimeTracker timeTracker = getTimeTrackerComponent().getTimeTracker();
|
||||
this.previousStart = timeTracker.getRealInterval().getStart();
|
||||
this.previousInterval = timeTracker.getMapper().getInterval();
|
||||
}
|
||||
|
||||
public LocalDate getPreviousStart() {
|
||||
return previousStart;
|
||||
}
|
||||
|
||||
public Interval getPreviousInterval() {
|
||||
return previousInterval;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ zkLimitingResourcesList.SetVisibleDeadlineForQueueElement = function(task, visib
|
|||
function addLimitingResourcesListMethods(object) {
|
||||
var scrollSync;
|
||||
|
||||
var SCROLL_DAY = 0;
|
||||
|
||||
function watermark() {
|
||||
return document.getElementById('watermark');
|
||||
}
|
||||
|
|
@ -132,9 +134,53 @@ function addLimitingResourcesListMethods(object) {
|
|||
});
|
||||
};
|
||||
|
||||
object.adjustScrollHorizontalPosition = function(cmp, offsetInPx) {
|
||||
cmp.scrollLeft = offsetInPx;
|
||||
}
|
||||
object.update_day_scroll = function(cmp,previousPixelPerDay) {
|
||||
var div1 = cmp;
|
||||
var div2 = div1.parentNode;
|
||||
var div3 = div2.parentNode;
|
||||
|
||||
var maxHPosition = div3.scrollWidth - div3.clientWidth;
|
||||
if( maxHPosition > 0 ){
|
||||
var proportion = div3.scrollWidth / maxHPosition;
|
||||
var positionInScroll = div3.scrollLeft;
|
||||
var positionInPx = positionInScroll * proportion;
|
||||
if(positionInPx > 0){
|
||||
var position = positionInPx / previousPixelPerDay;
|
||||
var day = position;
|
||||
SCROLL_DAY = position;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Scrolls horizontally the ganttpanel when the zoom has resized the component
|
||||
* width.
|
||||
*/
|
||||
|
||||
object.scroll_horizontal = function(cmp,daysDisplacement) {
|
||||
SCROLL_DAY = daysDisplacement;
|
||||
};
|
||||
|
||||
object.move_scroll = function(cmp,diffDays,pixelPerDay) {
|
||||
var div1 = cmp;
|
||||
var div2 = div1.parentNode;
|
||||
var div3 = div2.parentNode;
|
||||
|
||||
var day = SCROLL_DAY;
|
||||
day += parseInt(diffDays);
|
||||
var newPosInPx = parseInt(day * pixelPerDay);
|
||||
var maxHPosition = div3.scrollWidth - div3.clientWidth;
|
||||
var newProportion = div3.scrollWidth / maxHPosition;
|
||||
if( newProportion > 0){
|
||||
var newPosInScroll = newPosInPx / newProportion;
|
||||
if(newPosInScroll < 0){
|
||||
newPosInScroll = 0;
|
||||
}
|
||||
div1.scrollLeft = newPosInScroll;
|
||||
div2.scrollLeft = newPosInScroll;
|
||||
div3.scrollLeft = newPosInScroll;
|
||||
}
|
||||
};
|
||||
|
||||
return object;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue