summaryrefslogblamecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/CheckUpdateWindow.java
blob: b2a4edd1896a8b2b977a298c459383020456e316 (plain) (tree)
1
2
3
4
5
6
7
8
9

                                      
                       

                                     
 

                                                                    
                                             
                                            

                                                       
 
                                                                                                      
 



                                                                          
 
                                                      
                                   
 

                                                 
 



                                                                                                      
                                                                   
                                                 

         
 


                                                    
                                                                    




                                                
 
                                                     












                                                                    
package org.openslx.dozmod.gui.window;

import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import org.openslx.dozmod.gui.helper.UiFeedback;
import org.openslx.dozmod.gui.window.layout.CheckUpdateWindowLayout;
import org.openslx.dozmod.util.ClientVersion;
import org.openslx.dozmod.util.FormatHelper;
import org.openslx.dozmod.util.DesktopEnvironment;
import org.openslx.dozmod.util.DesktopEnvironment.Link;

public class CheckUpdateWindow extends CheckUpdateWindowLayout implements UiFeedback, ActionListener {

	/**
	 * Version for serialization.
	 */
	private static final long serialVersionUID = 3992160915138023046L;

	public CheckUpdateWindow(Window modalParent) {
		super(modalParent);

		btnClose.addActionListener(this);
		btnLink.addActionListener(this);

		lblLocalVersion.setText(ClientVersion.getLocalRevision() + " ("
				+ FormatHelper.longDate(ClientVersion.getLocalRevTimestamp()) + ")");
		lblRemoteVersion.setText(ClientVersion.getRemoteRevision() + " ("
				+ FormatHelper.longDate(ClientVersion.getRemoteRevTimestamp()) + ")");
		txtChangelog.setText(ClientVersion.getChangelog());
		txtChangelog.setCaretPosition(0);

	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == btnLink) {
			DesktopEnvironment.openWebpage(Link.DOZMOD);
		}
		if (e.getSource() == btnClose) {
			dispose();
		}
	}

	public static void open(Window modalParent) {
		new CheckUpdateWindow(modalParent).setVisible(true);
	}

	@Override
	public boolean wantConfirmQuit() {
		return false;
	}

	@Override
	public void escapePressed() {
		dispose();
	}
}