}
public void preview()
{
// At some point some parts of this should probably be XULified
final PreviewDialog dialog;
if (designTimeContext != null)
{
final Window window = designTimeContext.getParentWindow();
if (window instanceof Dialog)
{
dialog = new PreviewDialog((Dialog) window);
}
else if (window instanceof Frame)
{
dialog = new PreviewDialog((Frame) window);
}
else
{
dialog = new PreviewDialog();
}
}
else
{
dialog = new PreviewDialog();
}
dialog.setTitle(messages.getString("LINEAR_WIZARD_CONTROLLER.Report_Preview"));
dialog.setModal(false);
try
{
final AbstractReportDefinition reportDefinition = editorModel.getReportDefinition();
final AbstractReportDefinition element = (AbstractReportDefinition) reportDefinition.derive();
final WizardSpecification spec = editorModel.getReportSpec();
element.setAttribute(AttributeNames.Wizard.NAMESPACE, "enable", Boolean.TRUE);
WizardProcessorUtil.applyWizardSpec(element, (WizardSpecification) spec.clone());
WizardProcessorUtil.ensureWizardProcessorIsAdded(element, null);
if (element instanceof MasterReport)
{
dialog.setReportJob((MasterReport) element);
}
else
{
final MasterReport report = new MasterReport();
report.getReportHeader().addSubReport((SubReport) element);
dialog.setReportJob(report);
}
dialog.pack();
LibSwingUtil.centerDialogInParent(dialog);
dialog.setVisible(true);
}
catch (Exception e)
{
if (designTimeContext != null)
{