private void createArchive() { System.out.println("Creating archive.."); swapContainers(exportingProgressContainer); attachListenersForArchiveOutputUtil(); archiveOutputUtil.setOutputLocation(outputFileLocation.getSelectedFilePath()); archiveOutputUtil.setCompressionLevel(getCompressionLevel()); final Thread archiveCreation = new Thread(archiveOutputUtil); archiveCreation.start(); }
private void attachListenersForArchiveOutputUtil() { archiveOutputUtil.addPropertyChangeListener( "archiveOutputFailed", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { // if the output fails, tell the user why it failed and point to the error report SwingUtilities.invokeLater( new Runnable() { public void run() { OutputFailedUI failUI = new OutputFailedUI(archiveOutputUtil.getArchiveOutputStatus().getText()); failUI.addPropertyChangeListener( "viewErrors", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { ViewErrorUI enw = new ViewErrorUI(archiveOutputUtil.getBrowseViewErrorPane()); enw.setLocation(getX(), getY()); dispose(); } }); swapContainers(failUI); } }); } }); archiveOutputUtil.addPropertyChangeListener( "archiveOutputCompleted", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { // if the output completes, tell the user it has completed and where the files were // saved, // then automatically close the window after 3 seconds :) SwingUtilities.invokeLater( new Runnable() { public void run() { OutputSuccessUI successUI = new OutputSuccessUI( archiveOutputUtil.getStatistics().getStatisticsAsHTML()); swapContainers(successUI); } }); closeWindowTimer.start(); } }); }
public void createProgressScreen() { exportingProgressContainer = new JPanel(); exportingProgressContainer.setSize(new Dimension(this.getWidth(), this.getHeight())); exportingProgressContainer.setLayout(new BorderLayout()); exportingProgressContainer.setBackground(UIHelper.BG_COLOR); exportingProgressContainer.add( UIHelper.wrapComponentInPanel(new JLabel(creatingArchiveAnimation, JLabel.CENTER)), BorderLayout.CENTER); exportingProgressContainer.add( UIHelper.wrapComponentInPanel(archiveOutputUtil.getArchiveOutputStatus()), BorderLayout.SOUTH); }