ItEr58S18CUEscaladoPantallaCargaRecursosEmpresaItEr57S10: Created the interface IPaginationFilterChangedListener to notify the changes in the name filter from the widget to the controller.

This commit is contained in:
Jacobo Aragunde Pérez 2010-05-19 21:01:07 +02:00 committed by Javier Moran Rua
parent 618196a780
commit c95b5f71c4
3 changed files with 39 additions and 7 deletions

View file

@ -0,0 +1,27 @@
/*
* 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.zkoss.ganttz.resourceload;
public interface IPaginationFilterChangedListener {
public void filterChanged(int initialPosition);
}

View file

@ -90,7 +90,7 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
private int filterByNamePosition = 0;
private int numberOfGroupsByName = 10;
private WeakReferencedListeners<IFilterChangedListener> nameFilterListener =
private WeakReferencedListeners<IPaginationFilterChangedListener> nameFilterListener =
WeakReferencedListeners.create();
private Component loadChart;
@ -416,10 +416,10 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
resourceLoadList = new ResourceLoadList(timeTracker, treeModel);
leftPane = new ResourceLoadLeftPane(treeModel, resourceLoadList);
registerNeededScripts();
nameFilterListener.fireEvent(new IListenerNotification<IFilterChangedListener>() {
nameFilterListener.fireEvent(new IListenerNotification<IPaginationFilterChangedListener>() {
@Override
public void doNotify(IFilterChangedListener listener) {
listener.filterChanged(getFilter());
public void doNotify(IPaginationFilterChangedListener listener) {
listener.filterChanged(filterByNamePosition);
}
});
afterCompose();
@ -442,7 +442,7 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
}
public void addNameFilterListener(
IFilterChangedListener iFilterChangedListener) {
IPaginationFilterChangedListener iFilterChangedListener) {
nameFilterListener.addListener(iFilterChangedListener);
}
@ -471,4 +471,8 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
this.loadChart = loadChart;
}
public int getPaginationFilterPageSize() {
return numberOfGroupsByName;
}
}

View file

@ -62,6 +62,7 @@ import org.zkforge.timeplot.geometry.ValueGeometry;
import org.zkoss.ganttz.IChartVisibilityChangedListener;
import org.zkoss.ganttz.data.resourceload.LoadTimeLine;
import org.zkoss.ganttz.resourceload.IFilterChangedListener;
import org.zkoss.ganttz.resourceload.IPaginationFilterChangedListener;
import org.zkoss.ganttz.resourceload.ISeeScheduledOfListener;
import org.zkoss.ganttz.resourceload.ResourcesLoadPanel;
import org.zkoss.ganttz.resourceload.ResourcesLoadPanel.IToolbarCommand;
@ -186,9 +187,9 @@ public class ResourceLoadController implements Composer {
}
private void addNameFilterListener() {
resourcesLoadPanel.addNameFilterListener(new IFilterChangedListener() {
resourcesLoadPanel.addNameFilterListener(new IPaginationFilterChangedListener() {
@Override
public void filterChanged(boolean filter) {
public void filterChanged(int initialPosition) {
addSchedulingScreenListeners();
}
});