mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
[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:
parent
6f653d3ce7
commit
4c3035fa06
6 changed files with 48 additions and 6 deletions
7
Mage.Plugins/Mage.Rating.Plugin/MANIFEST.MF
Normal file
7
Mage.Plugins/Mage.Rating.Plugin/MANIFEST.MF
Normal 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
|
BIN
Mage.Plugins/Mage.Rating.Plugin/executable/lib/mage-sets.jar
Normal file
BIN
Mage.Plugins/Mage.Rating.Plugin/executable/lib/mage-sets.jar
Normal file
Binary file not shown.
Binary file not shown.
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
@ -20,7 +22,7 @@ public class RateFrame extends JFrame {
|
|||
|
||||
private static Logger log = Logger.getLogger(RateFrame.class);
|
||||
private BigCard bigCard;
|
||||
|
||||
|
||||
public RateFrame() {
|
||||
setTitle("Mage Rate Cards, version 0.1");
|
||||
|
||||
|
@ -30,24 +32,34 @@ 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);
|
||||
|
||||
|
||||
bigCard = new BigCard();
|
||||
bigCard.setBounds(20, 10, RateThread.bigCardDimension.frameWidth, RateThread.bigCardDimension.frameHeight);
|
||||
bigCard.setBorder(BorderFactory.createLineBorder(Color.gray));
|
||||
add(bigCard);
|
||||
|
||||
|
||||
JLabel label = new JLabel("The results are stored for every 10 compare.");
|
||||
label.setBounds(290, 270, 300, 30);
|
||||
add(label);
|
||||
|
||||
|
||||
JButton rate = new JButton("Create results.txt");
|
||||
rate.setBounds(340, 230, 120, 25);
|
||||
rate.addActionListener(new ActionListener() {
|
||||
|
@ -63,8 +75,10 @@ public class RateFrame extends JFrame {
|
|||
}
|
||||
});
|
||||
add(rate);
|
||||
|
||||
System.out.println("test");
|
||||
}
|
||||
|
||||
|
||||
public void startRating() {
|
||||
RateThread.getInstance().start(this, this.bigCard);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue