summaryrefslogblamecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/CheckUpdateWindow.java
blob: b3c8ae054470be230b4a2c760a3aca21dc81702a (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.apache.log4j.Logger;
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;

@SuppressWarnings("serial")
public class CheckUpdateWindow extends CheckUpdateWindowLayout implements UiFeedback, ActionListener {

	private final static Logger LOGGER = Logger.getLogger(CheckUpdateWindow.class);

	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();
	}
}