[mage.rating.plugin] Added executable folder with built jar. Added maven assembly. Added manifest. Added saving option before exiting from app.

This commit is contained in:
magenoxx 2010-12-01 17:01:31 +00:00
parent 6f653d3ce7
commit 4c3035fa06
6 changed files with 48 additions and 6 deletions

View file

@ -0,0 +1,7 @@
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: natfullina
Build-Jdk: 1.6.0_16
Main-Class: org.mage.plugins.rating.RateFrame
Class-Path: lib/mage-sets.jar

View file

@ -65,6 +65,20 @@
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>org.mage.plugins.rating.RateFrame</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
<finalName>mage-card-plugin</finalName>

View file

@ -3,6 +3,8 @@ package org.mage.plugins.rating;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.BorderFactory;
import javax.swing.JButton;
@ -30,12 +32,22 @@ public class RateFrame extends JFrame {
log.error(ex.getMessage(), ex);
}
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
if (JOptionPane.showConfirmDialog(null, "Do you want to save recent compares?", "Save before exit", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) {
RateThread.getInstance().forceSave();
}
}
});
int width = 621;
int height = 384;
setSize(width, height);
setResizable(false);
int w = getGraphicsConfiguration().getBounds().width;
int h = getGraphicsConfiguration().getBounds().height;
setLocation((w - width)/2, (h - height)/2);
setLocation((w - width) / 2, (h - height) / 2);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setLayout(null);
@ -63,6 +75,8 @@ public class RateFrame extends JFrame {
}
});
add(rate);
System.out.println("test");
}
public void startRating() {

View file

@ -96,6 +96,13 @@ public class RateThread extends Thread {
generateNext();
}
public void forceSave() {
if (results.size() > 0) {
ResultHandler.getInstance().save(results);
results.clear();
}
}
private void removeCard(Component component) {
if (component != null) {
frame.remove(component);