@Test public void testActionPerformed() { NewWizardReportAction reportActionSpy = spy( new NewWizardReportAction() ); doReturn( reportDesignerContext ).when( reportActionSpy ).getReportDesignerContext(); doReturn( reportDesignerView ).when( reportDesignerContext ).getView(); doReturn( component ).when( reportDesignerView ).getParent(); doReturn( window ).when( reportActionSpy ).getWindowAncestor( component ); doReturn( wizard ).when( reportActionSpy ).getEmbeddedWizard( window ); try { doReturn( masterReport ).when( reportActionSpy ).runDialog( wizard ); } catch ( ReportProcessingException e ) { e.printStackTrace(); } doReturn( bundle ).when( masterReport ).getBundle(); reportActionSpy.actionPerformed( null ); verify( reportActionSpy, times( 1 ) ).getReportDesignerContext(); verify( reportDesignerContext, times( 1 ) ).getView(); verify( reportDesignerView, times( 1 ) ).getParent(); verify( reportActionSpy, times( 1 ) ).getWindowAncestor( (Component) anyObject() ); verify( reportActionSpy, times( 1 ) ).getEmbeddedWizard( (Window) anyObject() ); }
public void actionPerformed( final ActionEvent e ) { final ReportDesignerContext designerContext = getReportDesignerContext(); if ( designerContext == null ) { return; } final Component parent = designerContext.getView().getParent(); final Window window = getWindowAncestor( parent ); final EmbeddedWizard dialog = getEmbeddedWizard( window ); try { final MasterReport def = runDialog( dialog ); if ( def == null ) { return; } try { final MemoryDocumentBundle bundle = (MemoryDocumentBundle) def.getBundle(); if ( bundle.isEntryExists( TRANSLATIONS_PROPERTIES ) == false ) { final String defaultMessage = ActionMessages.getString( "Translations.DefaultContent" ); final OutputStream outputStream = bundle.createEntry( TRANSLATIONS_PROPERTIES, "text/plain" ); outputStream.write( defaultMessage.getBytes( "ISO-8859-1" ) ); outputStream.close(); bundle.getWriteableDocumentMetaData().setEntryAttribute( TRANSLATIONS_PROPERTIES, BundleUtilities.STICKY_FLAG, "true" ); } } catch ( Exception ex ) { DebugLog.log( "Failed to created default translation entry", ex ); } designerContext.addMasterReport( def ); } catch ( ReportProcessingException e1 ) { UncaughtExceptionsModel.getInstance().addException( e1 ); } }
NewWizardReportAction extends AbstractDesignerContextAction { public void actionPerformed( final ActionEvent e ) { final ReportDesignerContext designerContext = getReportDesignerContext(); if ( designerContext == null ) { return; } final Component parent = designerContext.getView().getParent(); final Window window = getWindowAncestor( parent ); final EmbeddedWizard dialog = getEmbeddedWizard( window ); try { final MasterReport def = runDialog( dialog ); if ( def == null ) { return; } try { final MemoryDocumentBundle bundle = (MemoryDocumentBundle) def.getBundle(); if ( bundle.isEntryExists( TRANSLATIONS_PROPERTIES ) == false ) { final String defaultMessage = ActionMessages.getString( "Translations.DefaultContent" ); final OutputStream outputStream = bundle.createEntry( TRANSLATIONS_PROPERTIES, "text/plain" ); outputStream.write( defaultMessage.getBytes( "ISO-8859-1" ) ); outputStream.close(); bundle.getWriteableDocumentMetaData().setEntryAttribute( TRANSLATIONS_PROPERTIES, BundleUtilities.STICKY_FLAG, "true" ); } } catch ( Exception ex ) { DebugLog.log( "Failed to created default translation entry", ex ); } designerContext.addMasterReport( def ); } catch ( ReportProcessingException e1 ) { UncaughtExceptionsModel.getInstance().addException( e1 ); } } }
NewWizardReportAction extends AbstractDesignerContextAction { public void actionPerformed( final ActionEvent e ) { final ReportDesignerContext designerContext = getReportDesignerContext(); if ( designerContext == null ) { return; } final Component parent = designerContext.getView().getParent(); final Window window = getWindowAncestor( parent ); final EmbeddedWizard dialog = getEmbeddedWizard( window ); try { final MasterReport def = runDialog( dialog ); if ( def == null ) { return; } try { final MemoryDocumentBundle bundle = (MemoryDocumentBundle) def.getBundle(); if ( bundle.isEntryExists( TRANSLATIONS_PROPERTIES ) == false ) { final String defaultMessage = ActionMessages.getString( "Translations.DefaultContent" ); final OutputStream outputStream = bundle.createEntry( TRANSLATIONS_PROPERTIES, "text/plain" ); outputStream.write( defaultMessage.getBytes( "ISO-8859-1" ) ); outputStream.close(); bundle.getWriteableDocumentMetaData().setEntryAttribute( TRANSLATIONS_PROPERTIES, BundleUtilities.STICKY_FLAG, "true" ); } } catch ( Exception ex ) { DebugLog.log( "Failed to created default translation entry", ex ); } designerContext.addMasterReport( def ); } catch ( ReportProcessingException e1 ) { UncaughtExceptionsModel.getInstance().addException( e1 ); } } NewWizardReportAction(); }
NewWizardReportAction extends AbstractDesignerContextAction { public void actionPerformed( final ActionEvent e ) { final ReportDesignerContext designerContext = getReportDesignerContext(); if ( designerContext == null ) { return; } final Component parent = designerContext.getView().getParent(); final Window window = getWindowAncestor( parent ); final EmbeddedWizard dialog = getEmbeddedWizard( window ); try { final MasterReport def = runDialog( dialog ); if ( def == null ) { return; } try { final MemoryDocumentBundle bundle = (MemoryDocumentBundle) def.getBundle(); if ( bundle.isEntryExists( TRANSLATIONS_PROPERTIES ) == false ) { final String defaultMessage = ActionMessages.getString( "Translations.DefaultContent" ); final OutputStream outputStream = bundle.createEntry( TRANSLATIONS_PROPERTIES, "text/plain" ); outputStream.write( defaultMessage.getBytes( "ISO-8859-1" ) ); outputStream.close(); bundle.getWriteableDocumentMetaData().setEntryAttribute( TRANSLATIONS_PROPERTIES, BundleUtilities.STICKY_FLAG, "true" ); } } catch ( Exception ex ) { DebugLog.log( "Failed to created default translation entry", ex ); } designerContext.addMasterReport( def ); } catch ( ReportProcessingException e1 ) { UncaughtExceptionsModel.getInstance().addException( e1 ); } } NewWizardReportAction(); void actionPerformed( final ActionEvent e ); }
NewWizardReportAction extends AbstractDesignerContextAction { public void actionPerformed( final ActionEvent e ) { final ReportDesignerContext designerContext = getReportDesignerContext(); if ( designerContext == null ) { return; } final Component parent = designerContext.getView().getParent(); final Window window = getWindowAncestor( parent ); final EmbeddedWizard dialog = getEmbeddedWizard( window ); try { final MasterReport def = runDialog( dialog ); if ( def == null ) { return; } try { final MemoryDocumentBundle bundle = (MemoryDocumentBundle) def.getBundle(); if ( bundle.isEntryExists( TRANSLATIONS_PROPERTIES ) == false ) { final String defaultMessage = ActionMessages.getString( "Translations.DefaultContent" ); final OutputStream outputStream = bundle.createEntry( TRANSLATIONS_PROPERTIES, "text/plain" ); outputStream.write( defaultMessage.getBytes( "ISO-8859-1" ) ); outputStream.close(); bundle.getWriteableDocumentMetaData().setEntryAttribute( TRANSLATIONS_PROPERTIES, BundleUtilities.STICKY_FLAG, "true" ); } } catch ( Exception ex ) { DebugLog.log( "Failed to created default translation entry", ex ); } designerContext.addMasterReport( def ); } catch ( ReportProcessingException e1 ) { UncaughtExceptionsModel.getInstance().addException( e1 ); } } NewWizardReportAction(); void actionPerformed( final ActionEvent e );  }