ItEr43S09ImplantacionAplicacionItEr42S13: PlannerConfiguration can be enabled with printing support
Calling CutyPrint to do the printing
This commit is contained in:
parent
a83a02d925
commit
1a149646f2
3 changed files with 46 additions and 0 deletions
|
|
@ -42,6 +42,10 @@ import org.zkoss.zk.ui.Component;
|
|||
*/
|
||||
public class PlannerConfiguration<T> implements IDisabilityConfiguration {
|
||||
|
||||
public interface IPrintAction {
|
||||
public void doPrint();
|
||||
}
|
||||
|
||||
public interface IReloadChartListener {
|
||||
public void reloadChart();
|
||||
}
|
||||
|
|
@ -124,6 +128,8 @@ public class PlannerConfiguration<T> implements IDisabilityConfiguration {
|
|||
|
||||
private List<IReloadChartListener> reloadChartListeners = new ArrayList<IReloadChartListener>();
|
||||
|
||||
private IPrintAction printAction;
|
||||
|
||||
public PlannerConfiguration(IAdapterToTaskFundamentalProperties<T> adapter,
|
||||
IStructureNavigator<T> navigator, List<? extends T> data) {
|
||||
this.adapter = adapter;
|
||||
|
|
@ -289,4 +295,19 @@ public class PlannerConfiguration<T> implements IDisabilityConfiguration {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isPrintEnabled() {
|
||||
return printAction != null;
|
||||
}
|
||||
|
||||
public void setPrintAction(IPrintAction printAction) {
|
||||
this.printAction = printAction;
|
||||
}
|
||||
|
||||
public void print() {
|
||||
if (!isPrintEnabled()) {
|
||||
throw new UnsupportedOperationException("print not supported");
|
||||
}
|
||||
printAction.doPrint();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,9 @@ import org.zkforge.timeplot.geometry.ValueGeometry;
|
|||
import org.zkoss.ganttz.Planner;
|
||||
import org.zkoss.ganttz.adapters.IStructureNavigator;
|
||||
import org.zkoss.ganttz.adapters.PlannerConfiguration;
|
||||
import org.zkoss.ganttz.adapters.PlannerConfiguration.IPrintAction;
|
||||
import org.zkoss.ganttz.extensions.ICommandOnTask;
|
||||
import org.zkoss.ganttz.print.CutyPrint;
|
||||
import org.zkoss.ganttz.timetracker.TimeTracker;
|
||||
import org.zkoss.ganttz.timetracker.zoom.IZoomLevelChangedListener;
|
||||
import org.zkoss.ganttz.timetracker.zoom.ZoomLevel;
|
||||
|
|
@ -181,6 +183,7 @@ public abstract class CompanyPlanningModel implements ICompanyPlanningModel {
|
|||
configuration.setDoubleClickCommand(doubleClickCommand);
|
||||
}
|
||||
addAdditionalCommands(additional, configuration);
|
||||
addPrintSupport(configuration);
|
||||
disableSomeFeatures(configuration);
|
||||
planner.setConfiguration(configuration);
|
||||
|
||||
|
|
@ -430,6 +433,15 @@ public abstract class CompanyPlanningModel implements ICompanyPlanningModel {
|
|||
}
|
||||
}
|
||||
|
||||
private void addPrintSupport(PlannerConfiguration<TaskElement> configuration) {
|
||||
configuration.setPrintAction(new IPrintAction() {
|
||||
@Override
|
||||
public void doPrint() {
|
||||
CutyPrint.print();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Chart setupChart(Timeplot chartComponent,
|
||||
IChartFiller loadChartFiller, TimeTracker timeTracker) {
|
||||
Chart loadChart = new Chart(chartComponent, loadChartFiller,
|
||||
|
|
|
|||
|
|
@ -87,8 +87,10 @@ import org.zkforge.timeplot.geometry.ValueGeometry;
|
|||
import org.zkoss.ganttz.Planner;
|
||||
import org.zkoss.ganttz.adapters.IStructureNavigator;
|
||||
import org.zkoss.ganttz.adapters.PlannerConfiguration;
|
||||
import org.zkoss.ganttz.adapters.PlannerConfiguration.IPrintAction;
|
||||
import org.zkoss.ganttz.adapters.PlannerConfiguration.IReloadChartListener;
|
||||
import org.zkoss.ganttz.extensions.ICommand;
|
||||
import org.zkoss.ganttz.print.CutyPrint;
|
||||
import org.zkoss.ganttz.timetracker.TimeTracker;
|
||||
import org.zkoss.ganttz.timetracker.zoom.DetailItem;
|
||||
import org.zkoss.ganttz.timetracker.zoom.IDetailItemModificator;
|
||||
|
|
@ -201,6 +203,7 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
configuration
|
||||
.addCommandOnTask(buildTaskPropertiesCommand(taskPropertiesController));
|
||||
configuration.setDoubleClickCommand(resourceAllocationCommand);
|
||||
addPrintSupport(configuration, order);
|
||||
Tabbox chartComponent = new Tabbox();
|
||||
chartComponent.setOrient("vertical");
|
||||
chartComponent.setHeight("200px");
|
||||
|
|
@ -232,6 +235,16 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
setEventListenerConfigurationCheckboxes(earnedValueChart);
|
||||
}
|
||||
|
||||
private void addPrintSupport(
|
||||
PlannerConfiguration<TaskElement> configuration, Order order) {
|
||||
configuration.setPrintAction(new IPrintAction() {
|
||||
@Override
|
||||
public void doPrint() {
|
||||
CutyPrint.print();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private IDeleteMilestoneCommand buildDeleteMilestoneCommand() {
|
||||
IDeleteMilestoneCommand result = getDeleteMilestoneCommand();
|
||||
result.setState(planningState);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue