Final changes for version 1.0.0
This commit is contained in:
parent
711dde51a7
commit
592bbbb769
28
pom.xml
28
pom.xml
|
@ -6,17 +6,43 @@
|
||||||
|
|
||||||
<groupId>nl.andrewlalis</groupId>
|
<groupId>nl.andrewlalis</groupId>
|
||||||
<artifactId>EntityRelationMappingEditor</artifactId>
|
<artifactId>EntityRelationMappingEditor</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0.0</version>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>8</source>
|
<source>8</source>
|
||||||
<target>8</target>
|
<target>8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<version>3.1.1</version>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>nl.andrewlalis.erme.EntityRelationMappingEditor</mainClass>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
<descriptorRefs>
|
||||||
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||||
|
</descriptorRefs>
|
||||||
|
<appendAssemblyId>false</appendAssemblyId>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>make-assembly</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.formdev.flatlaf.FlatLightLaf;
|
||||||
import nl.andrewlalis.erme.view.EditorFrame;
|
import nl.andrewlalis.erme.view.EditorFrame;
|
||||||
|
|
||||||
public class EntityRelationMappingEditor {
|
public class EntityRelationMappingEditor {
|
||||||
|
public static final String VERSION = "1.0.0";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
if (!FlatLightLaf.install()) {
|
if (!FlatLightLaf.install()) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package nl.andrewlalis.erme.control.actions;
|
package nl.andrewlalis.erme.control.actions;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.InputEvent;
|
import java.awt.event.InputEvent;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
|
@ -23,6 +24,15 @@ public class ExitAction extends AbstractAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
int choice = JOptionPane.showConfirmDialog(
|
||||||
|
(Component) e.getSource(),
|
||||||
|
"Are you sure you want to quit?\nAll unsaved data will be lost.",
|
||||||
|
"Confirm Exit",
|
||||||
|
JOptionPane.OK_CANCEL_OPTION,
|
||||||
|
JOptionPane.QUESTION_MESSAGE
|
||||||
|
);
|
||||||
|
if (choice == JOptionPane.OK_OPTION) {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -42,6 +42,15 @@ public class ExportToImageAction extends AbstractAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
if (this.model.getRelations().isEmpty()) {
|
||||||
|
JOptionPane.showMessageDialog(
|
||||||
|
(Component) e.getSource(),
|
||||||
|
"Model is empty. Add some relations before exporting to an image.",
|
||||||
|
"Model Empty",
|
||||||
|
JOptionPane.WARNING_MESSAGE
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
JFileChooser fileChooser = new JFileChooser(this.lastSelectedFile);
|
JFileChooser fileChooser = new JFileChooser(this.lastSelectedFile);
|
||||||
fileChooser.setFileFilter(new FileNameExtensionFilter(
|
fileChooser.setFileFilter(new FileNameExtensionFilter(
|
||||||
"Image files", ImageIO.getReaderFileSuffixes()
|
"Image files", ImageIO.getReaderFileSuffixes()
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class RedoAction extends AbstractAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
public RedoAction() {
|
public RedoAction() {
|
||||||
super("Redo");
|
super("Redo (WIP)");
|
||||||
this.putValue(Action.SHORT_DESCRIPTION, "Redoes a previously undone action.");
|
this.putValue(Action.SHORT_DESCRIPTION, "Redoes a previously undone action.");
|
||||||
this.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));
|
this.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));
|
||||||
this.setEnabled(false);
|
this.setEnabled(false);
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class UndoAction extends AbstractAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
public UndoAction() {
|
public UndoAction() {
|
||||||
super("Undo");
|
super("Undo (WIP)");
|
||||||
this.putValue(Action.SHORT_DESCRIPTION, "Undo the last action.");
|
this.putValue(Action.SHORT_DESCRIPTION, "Undo the last action.");
|
||||||
this.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK));
|
this.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK));
|
||||||
this.setEnabled(false);
|
this.setEnabled(false);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package nl.andrewlalis.erme.view;
|
package nl.andrewlalis.erme.view;
|
||||||
|
|
||||||
import nl.andrewlalis.erme.model.*;
|
import nl.andrewlalis.erme.model.MappingModel;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
@ -11,23 +11,10 @@ import java.awt.*;
|
||||||
public class EditorFrame extends JFrame {
|
public class EditorFrame extends JFrame {
|
||||||
public EditorFrame() {
|
public EditorFrame() {
|
||||||
super("ER-Mapping Editor");
|
super("ER-Mapping Editor");
|
||||||
MappingModel model = new MappingModel();
|
this.setContentPane(new DiagramPanel(new MappingModel()));
|
||||||
Relation usersRelation = new Relation(model, new Point(50, 50), "Users");
|
|
||||||
usersRelation.addAttribute(new Attribute(usersRelation, AttributeType.ID_KEY, "username"));
|
|
||||||
usersRelation.addAttribute(new Attribute(usersRelation, AttributeType.PLAIN, "fullName"));
|
|
||||||
usersRelation.addAttribute(new Attribute(usersRelation, AttributeType.PLAIN, "language"));
|
|
||||||
usersRelation.addAttribute(new Attribute(usersRelation, AttributeType.PLAIN, "verified"));
|
|
||||||
usersRelation.addAttribute(new Attribute(usersRelation, AttributeType.PARTIAL_ID_KEY, "partialKey"));
|
|
||||||
model.addRelation(usersRelation);
|
|
||||||
Relation tokensRelation = new Relation(model, new Point(50, 120), "Tokens");
|
|
||||||
tokensRelation.addAttribute(new Attribute(tokensRelation, AttributeType.ID_KEY, "tokenCode"));
|
|
||||||
tokensRelation.addAttribute(new ForeignKeyAttribute(tokensRelation, AttributeType.PLAIN, "username", "Users", "username"));
|
|
||||||
tokensRelation.addAttribute(new Attribute(tokensRelation, AttributeType.PLAIN, "expirationDate"));
|
|
||||||
model.addRelation(tokensRelation);
|
|
||||||
|
|
||||||
this.setContentPane(new DiagramPanel(model));
|
|
||||||
this.setJMenuBar(new EditorMenuBar());
|
this.setJMenuBar(new EditorMenuBar());
|
||||||
this.setMinimumSize(new Dimension(500, 500));
|
this.setMinimumSize(new Dimension(400, 400));
|
||||||
|
this.setPreferredSize(new Dimension(800, 800));
|
||||||
this.pack();
|
this.pack();
|
||||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
this.setLocationRelativeTo(null);
|
this.setLocationRelativeTo(null);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package nl.andrewlalis.erme.view;
|
package nl.andrewlalis.erme.view;
|
||||||
|
|
||||||
|
import nl.andrewlalis.erme.EntityRelationMappingEditor;
|
||||||
import nl.andrewlalis.erme.control.actions.*;
|
import nl.andrewlalis.erme.control.actions.*;
|
||||||
import nl.andrewlalis.erme.control.actions.edits.AddAttributeAction;
|
import nl.andrewlalis.erme.control.actions.edits.AddAttributeAction;
|
||||||
import nl.andrewlalis.erme.control.actions.edits.AddRelationAction;
|
import nl.andrewlalis.erme.control.actions.edits.AddRelationAction;
|
||||||
|
@ -7,6 +8,9 @@ import nl.andrewlalis.erme.control.actions.edits.RemoveAttributeAction;
|
||||||
import nl.andrewlalis.erme.control.actions.edits.RemoveRelationAction;
|
import nl.andrewlalis.erme.control.actions.edits.RemoveRelationAction;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The menu bar that's visible atop the application.
|
* The menu bar that's visible atop the application.
|
||||||
|
@ -44,7 +48,28 @@ public class EditorMenuBar extends JMenuBar {
|
||||||
|
|
||||||
private JMenu buildHelpMenu() {
|
private JMenu buildHelpMenu() {
|
||||||
JMenu menu = new JMenu("Help");
|
JMenu menu = new JMenu("Help");
|
||||||
menu.add("About");
|
JMenuItem instructionsItem = new JMenuItem("GitHub (Instructions)");
|
||||||
|
instructionsItem.addActionListener(e -> {
|
||||||
|
try {
|
||||||
|
Desktop.getDesktop().browse(URI.create("https://github.com/andrewlalis/EntityRelationMappingEditor"));
|
||||||
|
} catch (IOException ioException) {
|
||||||
|
ioException.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
menu.add(instructionsItem);
|
||||||
|
JMenuItem aboutItem = new JMenuItem("About");
|
||||||
|
aboutItem.addActionListener(e -> JOptionPane.showMessageDialog(
|
||||||
|
(Component) e.getSource(),
|
||||||
|
"Entity-Relation Mapping Editor\n" +
|
||||||
|
"by Andrew Lalis\n" +
|
||||||
|
"Version " + EntityRelationMappingEditor.VERSION + "\n" +
|
||||||
|
"To report bugs or make suggestions, please visit the GitHub\n" +
|
||||||
|
"repository for this application and create a new issue.\n\n" +
|
||||||
|
"Thank you for using the ERME!",
|
||||||
|
"About ERME",
|
||||||
|
JOptionPane.INFORMATION_MESSAGE
|
||||||
|
));
|
||||||
|
menu.add(aboutItem);
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue