Révision de code
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
#Thu Apr 22 12:13:10 CEST 2021
|
#Fri Apr 23 15:08:28 CEST 2021
|
||||||
version=1.0.0
|
version=1.0.0
|
||||||
showHomeAtStartup=true
|
showHomeAtStartup=true
|
||||||
|
isFirstLaunch=false
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ public class ATProperties extends Properties {
|
|||||||
|
|
||||||
private String _savePath;
|
private String _savePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur de ATProperties, propriétés de l'utilisateur
|
||||||
|
*/
|
||||||
public ATProperties() {
|
public ATProperties() {
|
||||||
_savePath = "user.properties";
|
_savePath = "user.properties";
|
||||||
}
|
}
|
||||||
@@ -17,7 +20,7 @@ public class ATProperties extends Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Charger les préférences utilisateur depuis un fichier
|
* Charger les préférences utilisateur depuis un fichier de propriété
|
||||||
*/
|
*/
|
||||||
public void loadPreferencesFromFile() {
|
public void loadPreferencesFromFile() {
|
||||||
InputStream input = null;
|
InputStream input = null;
|
||||||
@@ -47,6 +50,7 @@ public class ATProperties extends Properties {
|
|||||||
public void setToDefault() {
|
public void setToDefault() {
|
||||||
setProperty("version", "1.0.0");
|
setProperty("version", "1.0.0");
|
||||||
setProperty("showHomeAtStartup", "true");
|
setProperty("showHomeAtStartup", "true");
|
||||||
|
setProperty("isFirstLaunch", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.thinkode.appthinker;
|
package com.thinkode.appthinker;
|
||||||
|
|
||||||
|
import com.thinkode.appthinker.controllers.ChangelogWindowController;
|
||||||
import com.thinkode.appthinker.controllers.WindowController;
|
import com.thinkode.appthinker.controllers.WindowController;
|
||||||
import com.thinkode.appthinker.views.Splashscreen;
|
import com.thinkode.appthinker.views.Splashscreen;
|
||||||
import com.thinkode.appthinker.views.Window;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -15,8 +15,8 @@ import java.util.List;
|
|||||||
public class AppThinker {
|
public class AppThinker {
|
||||||
//JavaDoc tags : @param @return @throws @author @version @see @since @serial @deprecated
|
//JavaDoc tags : @param @return @throws @author @version @see @since @serial @deprecated
|
||||||
|
|
||||||
public static String version = "1.0.0-dev6";
|
public static String version = "1.0.0";
|
||||||
public static String dateVersion = "18/03/2021";
|
public static String dateVersion = "23/04/2021";
|
||||||
public static List<String> changelog;
|
public static List<String> changelog;
|
||||||
public static String developer = "V. BOULANGER";
|
public static String developer = "V. BOULANGER";
|
||||||
public static String copyright = "© 2021 - Valentin Boulanger";
|
public static String copyright = "© 2021 - Valentin Boulanger";
|
||||||
@@ -35,8 +35,10 @@ public class AppThinker {
|
|||||||
_appProperties = new ATProperties("app.properties");
|
_appProperties = new ATProperties("app.properties");
|
||||||
|
|
||||||
changelog = new ArrayList<String>();
|
changelog = new ArrayList<String>();
|
||||||
changelog.add("#16 Workspace");
|
changelog.add("#16 Workspace implementation");
|
||||||
changelog.add("#15 Multi-project and multi-composition editing");
|
changelog.add("#15 Multi-project and multi-composition editing");
|
||||||
|
changelog.add("#39 MVC implementation");
|
||||||
|
changelog.add("Resolve some graphic bugs");
|
||||||
|
|
||||||
_splash = new Splashscreen();
|
_splash = new Splashscreen();
|
||||||
|
|
||||||
@@ -46,14 +48,14 @@ public class AppThinker {
|
|||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
_splash.dispose();
|
_splash.dispose();
|
||||||
|
|
||||||
new WindowController(new Window());
|
new WindowController();
|
||||||
|
|
||||||
//Si le logiciel s'ouvre pour la 1ère fois, on affiche la fenêtre de changelog
|
//Si le logiciel s'ouvre pour la 1ère fois, on affiche la fenêtre de changelog
|
||||||
/*if (_appProperties.getProperty("isFirstLaunch").equals("true")) {
|
if (_appProperties.getProperty("isFirstLaunch").equals("true")) {
|
||||||
_appProperties.setProperty("isFirstLaunch", "false");
|
_appProperties.setProperty("isFirstLaunch", "false");
|
||||||
_appProperties.storeConfiguration();
|
_appProperties.storeConfiguration();
|
||||||
ATChangelogWindow changelog = new ATChangelogWindow();
|
new ChangelogWindowController();
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.thinkode.appthinker.controllers;
|
package com.thinkode.appthinker.controllers;
|
||||||
|
|
||||||
import com.thinkode.appthinker.views.AboutWindow;
|
import com.thinkode.appthinker.views.AboutWindow;
|
||||||
import com.thinkode.appthinker.views.ChangelogWindow;
|
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -12,12 +11,18 @@ public class AboutWindowController {
|
|||||||
|
|
||||||
private AboutWindow _atAboutWindow;
|
private AboutWindow _atAboutWindow;
|
||||||
|
|
||||||
public AboutWindowController(AboutWindow atAboutWindow) {
|
/**
|
||||||
_atAboutWindow = atAboutWindow;
|
* Constructeur de AboutWindowController
|
||||||
|
*/
|
||||||
|
public AboutWindowController() {
|
||||||
|
_atAboutWindow = new AboutWindow();
|
||||||
_atAboutWindow.setController(this);
|
_atAboutWindow.setController(this);
|
||||||
_atAboutWindow.setVisible(true);
|
_atAboutWindow.initializeGraphics();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lance l'URL du centre de téléchargement.
|
||||||
|
*/
|
||||||
public void checkForUpdates() {
|
public void checkForUpdates() {
|
||||||
try {
|
try {
|
||||||
Desktop.getDesktop().browse(new URL("https://insset-my.sharepoint.com/:f:/g/personal/valentin_boulanger_insset_onmicrosoft_com/En4LybbeF2ZMpeSiesh_Af8BX3Fl1aDzTUWyw4dtQzJaag").toURI());
|
Desktop.getDesktop().browse(new URL("https://insset-my.sharepoint.com/:f:/g/personal/valentin_boulanger_insset_onmicrosoft_com/En4LybbeF2ZMpeSiesh_Af8BX3Fl1aDzTUWyw4dtQzJaag").toURI());
|
||||||
@@ -26,10 +31,16 @@ public class AboutWindowController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lance la fenetre de Changelog
|
||||||
|
*/
|
||||||
public void launchChangelogWindow() {
|
public void launchChangelogWindow() {
|
||||||
ChangelogWindowController _atChangelogWindowController = new ChangelogWindowController(new ChangelogWindow());
|
new ChangelogWindowController();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lance l'URL du formulaire pour la soumission d'idées ou bugs
|
||||||
|
*/
|
||||||
public void giveFeedback() {
|
public void giveFeedback() {
|
||||||
try {
|
try {
|
||||||
Desktop.getDesktop().browse(new URL("https://forms.gle/WG32HT947MKqdzhbA").toURI());
|
Desktop.getDesktop().browse(new URL("https://forms.gle/WG32HT947MKqdzhbA").toURI());
|
||||||
@@ -38,6 +49,9 @@ public class AboutWindowController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lance l'URL pour faire un don.
|
||||||
|
*/
|
||||||
public void makeDonation() {
|
public void makeDonation() {
|
||||||
try {
|
try {
|
||||||
Desktop.getDesktop().browse(new URL("https://www.paypal.com/paypalme/valentinboulanger").toURI());
|
Desktop.getDesktop().browse(new URL("https://www.paypal.com/paypalme/valentinboulanger").toURI());
|
||||||
|
|||||||
@@ -11,6 +11,13 @@ public class ArgumentsPropertiesController {
|
|||||||
private ClassPropertiesController _classPropertiesController;
|
private ClassPropertiesController _classPropertiesController;
|
||||||
private Method _method;
|
private Method _method;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur de ArgumentsPropertiesController
|
||||||
|
*
|
||||||
|
* @param umlDiagramController Une instance de UmlDiagramController qui a effectuée la demande
|
||||||
|
* @param classPropertiesController Une instance de ClassPropertiesController
|
||||||
|
* @param method La méthode modifiée
|
||||||
|
*/
|
||||||
public ArgumentsPropertiesController(UmlDiagramController umlDiagramController, ClassPropertiesController classPropertiesController, Method method) {
|
public ArgumentsPropertiesController(UmlDiagramController umlDiagramController, ClassPropertiesController classPropertiesController, Method method) {
|
||||||
_umlDiagramController = umlDiagramController;
|
_umlDiagramController = umlDiagramController;
|
||||||
_classPropertiesController = classPropertiesController;
|
_classPropertiesController = classPropertiesController;
|
||||||
@@ -20,6 +27,11 @@ public class ArgumentsPropertiesController {
|
|||||||
_argumentsPropertiesWindow.initializeGraphics();
|
_argumentsPropertiesWindow.initializeGraphics();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoie à la fenêtre le nom de la méthode en cours d'édition
|
||||||
|
*
|
||||||
|
* @return Le nom de la méthode en cours d'édition.
|
||||||
|
*/
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return _method.getName();
|
return _method.getName();
|
||||||
}
|
}
|
||||||
@@ -52,6 +64,8 @@ public class ArgumentsPropertiesController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Monte l'argument
|
* Monte l'argument
|
||||||
|
*
|
||||||
|
* @param index L'index de la méthode dans le tableau.
|
||||||
*/
|
*/
|
||||||
public void goUpArgument(int index) {
|
public void goUpArgument(int index) {
|
||||||
if (_method.upArgument(index)) {
|
if (_method.upArgument(index)) {
|
||||||
@@ -64,6 +78,8 @@ public class ArgumentsPropertiesController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Baisse l'argument
|
* Baisse l'argument
|
||||||
|
*
|
||||||
|
* @param index L'index de la méthode dans le tableau.
|
||||||
*/
|
*/
|
||||||
public void goDownArgument(int index) {
|
public void goDownArgument(int index) {
|
||||||
if (_method.downArgument(index)) {
|
if (_method.downArgument(index)) {
|
||||||
@@ -74,12 +90,19 @@ public class ArgumentsPropertiesController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Commande le rafraîchissement du tableau des arguments
|
||||||
|
*/
|
||||||
public void refreshArguments() {
|
public void refreshArguments() {
|
||||||
_argumentsPropertiesWindow.listArguments(_method.getArguments());
|
_argumentsPropertiesWindow.listArguments(_method.getArguments());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sauvegarde les modifications pour la méthode en cours et ferme la fenêtre.
|
* Sauvegarde les modifications pour la méthode en cours et ferme la fenêtre.
|
||||||
|
*
|
||||||
|
* @param index Le numéro de l'argument à sauvegarder.
|
||||||
|
* @param type Le type de l'argument à sauvegarder.
|
||||||
|
* @param name Le nom de l'argument à sauvegarder.
|
||||||
*/
|
*/
|
||||||
public void save(int index, String type, String name) {
|
public void save(int index, String type, String name) {
|
||||||
_method.getArguments().get(index).setType(type);
|
_method.getArguments().get(index).setType(type);
|
||||||
|
|||||||
@@ -12,18 +12,36 @@ public class ChangelogWindowController {
|
|||||||
|
|
||||||
private ChangelogWindow _atChangelogWindow;
|
private ChangelogWindow _atChangelogWindow;
|
||||||
|
|
||||||
public ChangelogWindowController(ChangelogWindow atChangelogWindow) {
|
/**
|
||||||
_atChangelogWindow = atChangelogWindow;
|
* Constructeur de ChangelogWindowController.
|
||||||
|
*/
|
||||||
|
public ChangelogWindowController() {
|
||||||
|
_atChangelogWindow = new ChangelogWindow();
|
||||||
_atChangelogWindow.setController(this);
|
_atChangelogWindow.setController(this);
|
||||||
displayChangelog();
|
_atChangelogWindow.displayChangelog();
|
||||||
_atChangelogWindow.setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayChangelog() {
|
/**
|
||||||
_atChangelogWindow.displayChangelog(AppThinker.version, AppThinker.changelog);
|
* Renvoie le numéro de version du logiciel à la fenêtre.
|
||||||
|
*
|
||||||
|
* @return Le numéro de version du logiciel.
|
||||||
|
*/
|
||||||
|
public String getVersion() {
|
||||||
|
return AppThinker.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoie les dernières modifications apportées au logiciel à la fenêtre.
|
||||||
|
*
|
||||||
|
* @return Les dernières modifications apportées au logiciel.
|
||||||
|
*/
|
||||||
|
public java.util.List<String> getChangelog() {
|
||||||
|
return AppThinker.changelog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lance l'URL du formulaire pour la soumission d'idées ou bugs.
|
||||||
|
*/
|
||||||
public void giveFeedback() {
|
public void giveFeedback() {
|
||||||
try {
|
try {
|
||||||
Desktop.getDesktop().browse(new URL("https://forms.gle/WG32HT947MKqdzhbA").toURI());
|
Desktop.getDesktop().browse(new URL("https://forms.gle/WG32HT947MKqdzhbA").toURI());
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ public class ClassPropertiesController {
|
|||||||
private UmlDiagramController _umlDiagramController;
|
private UmlDiagramController _umlDiagramController;
|
||||||
private com.thinkode.appthinker.models.Class _class;
|
private com.thinkode.appthinker.models.Class _class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur de ClassPropertiesController
|
||||||
|
*
|
||||||
|
* @param umlDiagramController Le contrôleur du diagramme UML qui a demandée l'affichage.
|
||||||
|
* @param c La classe en cours d'édition.
|
||||||
|
*/
|
||||||
public ClassPropertiesController(UmlDiagramController umlDiagramController, com.thinkode.appthinker.models.Class c) {
|
public ClassPropertiesController(UmlDiagramController umlDiagramController, com.thinkode.appthinker.models.Class c) {
|
||||||
_class = c;
|
_class = c;
|
||||||
_umlDiagramController = umlDiagramController;
|
_umlDiagramController = umlDiagramController;
|
||||||
@@ -22,7 +28,9 @@ public class ClassPropertiesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Donne à l'interface le nom de la classe
|
* Donne le nom de la classe en cours d'édition à la fenêtre.
|
||||||
|
*
|
||||||
|
* @return Le nom de la classe en cours d'édition.
|
||||||
*/
|
*/
|
||||||
public String getClassName() {
|
public String getClassName() {
|
||||||
return _class.getName();
|
return _class.getName();
|
||||||
@@ -40,7 +48,7 @@ public class ClassPropertiesController {
|
|||||||
/**
|
/**
|
||||||
* Retourne si la classe en cours d'édition est la classe principale
|
* Retourne si la classe en cours d'édition est la classe principale
|
||||||
*
|
*
|
||||||
* @return
|
* @return Un booléen représentant l'affirmation.
|
||||||
*/
|
*/
|
||||||
public boolean isMainClass() {
|
public boolean isMainClass() {
|
||||||
return _umlDiagramController.getMainClass() == _class;
|
return _umlDiagramController.getMainClass() == _class;
|
||||||
@@ -66,6 +74,8 @@ public class ClassPropertiesController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retire un attribut à la classe et rafraîchit la liste des attributs.
|
* Retire un attribut à la classe et rafraîchit la liste des attributs.
|
||||||
|
*
|
||||||
|
* @param index Le numéro de l'attribut dans le tableau.
|
||||||
*/
|
*/
|
||||||
public void removeAttribute(int index) {
|
public void removeAttribute(int index) {
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
@@ -78,7 +88,18 @@ public class ClassPropertiesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sauvegarde les informations d'un attribut
|
* Sauvegarde les informations d'un attribut.
|
||||||
|
*
|
||||||
|
* @param index Le numéro de l'attribut à modifier.
|
||||||
|
* @param name Le nom de l'attribut.
|
||||||
|
* @param access L'accès de l'attribut.
|
||||||
|
* @param type Le type de l'attribut.
|
||||||
|
* @param isStatic L'attribut est statique.
|
||||||
|
* @param isFinal L'attribut est final.
|
||||||
|
* @param isAbstract L'attribut est abstrait.
|
||||||
|
* @param isSynchronized L'attribut est synchronisé.
|
||||||
|
* @param isVolatile L'attribut est volatile.
|
||||||
|
* @param isTransient L'attribut est éphémère.
|
||||||
*/
|
*/
|
||||||
public void saveAttribute(int index, String name, String access, String type, boolean isStatic, boolean isFinal, boolean isAbstract, boolean isSynchronized, boolean isVolatile, boolean isTransient) {
|
public void saveAttribute(int index, String name, String access, String type, boolean isStatic, boolean isFinal, boolean isAbstract, boolean isSynchronized, boolean isVolatile, boolean isTransient) {
|
||||||
_class.getAttributes().get(index).setName(name);
|
_class.getAttributes().get(index).setName(name);
|
||||||
@@ -94,6 +115,8 @@ public class ClassPropertiesController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Go up the selected attribute
|
* Go up the selected attribute
|
||||||
|
*
|
||||||
|
* @param attributeRow Le numéro de l'attribut.
|
||||||
*/
|
*/
|
||||||
public void goUpAttribute(int attributeRow) {
|
public void goUpAttribute(int attributeRow) {
|
||||||
if (_class.upAttribute(attributeRow)) {
|
if (_class.upAttribute(attributeRow)) {
|
||||||
@@ -106,6 +129,8 @@ public class ClassPropertiesController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Go down the selected attribute
|
* Go down the selected attribute
|
||||||
|
*
|
||||||
|
* @param attributeRow Le numéro de l'attribut.
|
||||||
*/
|
*/
|
||||||
public void goDownAttribute(int attributeRow) {
|
public void goDownAttribute(int attributeRow) {
|
||||||
if (_class.downAttribute(attributeRow)) {
|
if (_class.downAttribute(attributeRow)) {
|
||||||
@@ -118,6 +143,8 @@ public class ClassPropertiesController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the arguments properties window
|
* Open the arguments properties window
|
||||||
|
*
|
||||||
|
* @param methodRow Le numéro de la méthode.
|
||||||
*/
|
*/
|
||||||
public void openArgumentsWindow(int methodRow) {
|
public void openArgumentsWindow(int methodRow) {
|
||||||
new ArgumentsPropertiesController(_umlDiagramController, this, _class.getMethods().get(methodRow));
|
new ArgumentsPropertiesController(_umlDiagramController, this, _class.getMethods().get(methodRow));
|
||||||
@@ -125,14 +152,14 @@ public class ClassPropertiesController {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh attributes
|
* Rafraîchissement des attributs
|
||||||
*/
|
*/
|
||||||
public void refreshAttributes() {
|
public void refreshAttributes() {
|
||||||
_classPropertiesWindow.listAttributes(_class.getAttributes());
|
_classPropertiesWindow.listAttributes(_class.getAttributes());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh methods
|
* Rafraîchissement des méthodes
|
||||||
*/
|
*/
|
||||||
public void refreshMethods() {
|
public void refreshMethods() {
|
||||||
_classPropertiesWindow.listMethods(_class.getMethods());
|
_classPropertiesWindow.listMethods(_class.getMethods());
|
||||||
@@ -151,17 +178,9 @@ public class ClassPropertiesController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajoute une méthode à la classe à une position donnée et rafraîchit la liste des attributs.
|
* Ajoute une méthode à la classe à une position donnée et rafraîchit la liste des attributs.
|
||||||
*/
|
*
|
||||||
public void addMethod(int index) {
|
* @param index Le numéro de la méthode.
|
||||||
_classPropertiesWindow.saveMethods();
|
* @param m La méthode à insérer.
|
||||||
_class.addMethod(index, new Method());
|
|
||||||
refreshMethods();
|
|
||||||
_umlDiagramController.needToSave();
|
|
||||||
refreshGraphics();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ajoute une méthode à la classe à une position donnée et rafraîchit la liste des attributs.
|
|
||||||
*/
|
*/
|
||||||
private void addMethod(int index, Method m) {
|
private void addMethod(int index, Method m) {
|
||||||
_classPropertiesWindow.saveMethods();
|
_classPropertiesWindow.saveMethods();
|
||||||
@@ -173,6 +192,8 @@ public class ClassPropertiesController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retire une méthode à la classe et rafraîchit la liste des méthodes.
|
* Retire une méthode à la classe et rafraîchit la liste des méthodes.
|
||||||
|
*
|
||||||
|
* @param index Le numéro de la méthode.
|
||||||
*/
|
*/
|
||||||
public void removeMethod(int index) {
|
public void removeMethod(int index) {
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ public class HomeFrameController {
|
|||||||
WindowController _windowController;
|
WindowController _windowController;
|
||||||
HomeFrame _homeFrame;
|
HomeFrame _homeFrame;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur de HomeFrameController.
|
||||||
|
*
|
||||||
|
* @param homeFrame Une instance de la page d'accueil.
|
||||||
|
* @param windowController Le contrôleur de la fenêtre principale qui a demandé l'affichage
|
||||||
|
*/
|
||||||
public HomeFrameController(HomeFrame homeFrame, WindowController windowController) {
|
public HomeFrameController(HomeFrame homeFrame, WindowController windowController) {
|
||||||
_windowController = windowController;
|
_windowController = windowController;
|
||||||
_homeFrame = homeFrame;
|
_homeFrame = homeFrame;
|
||||||
@@ -33,10 +39,18 @@ public class HomeFrameController {
|
|||||||
_windowController.newUmlProject();
|
_windowController.newUmlProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Commande l'ouverture d'un projet existant.
|
||||||
|
*
|
||||||
|
* @param path Le chemin du projet.
|
||||||
|
*/
|
||||||
public void openProject(String path) {
|
public void openProject(String path) {
|
||||||
_windowController.openProject(path);
|
_windowController.openProject(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lance l'URL du formumlaire de soumission d'idées ou bugs.
|
||||||
|
*/
|
||||||
public void giveFeedback() {
|
public void giveFeedback() {
|
||||||
try {
|
try {
|
||||||
Desktop.getDesktop().browse(new URL("https://forms.gle/WG32HT947MKqdzhbA").toURI());
|
Desktop.getDesktop().browse(new URL("https://forms.gle/WG32HT947MKqdzhbA").toURI());
|
||||||
@@ -45,6 +59,9 @@ public class HomeFrameController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lance l'URL du dépôt.
|
||||||
|
*/
|
||||||
public void visitRepository() {
|
public void visitRepository() {
|
||||||
try {
|
try {
|
||||||
Desktop.getDesktop().browse(new URL("https://gitlab.com/thinkode/appthinker").toURI());
|
Desktop.getDesktop().browse(new URL("https://gitlab.com/thinkode/appthinker").toURI());
|
||||||
@@ -53,6 +70,9 @@ public class HomeFrameController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lance l'URL pour faire un don.
|
||||||
|
*/
|
||||||
public void makeDonation() {
|
public void makeDonation() {
|
||||||
try {
|
try {
|
||||||
Desktop.getDesktop().browse(new URL("https://www.paypal.com/paypalme/valentinboulanger").toURI());
|
Desktop.getDesktop().browse(new URL("https://www.paypal.com/paypalme/valentinboulanger").toURI());
|
||||||
@@ -62,12 +82,23 @@ public class HomeFrameController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Actions sur la checkbox
|
//Actions sur la checkbox
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modifie le paramètre utilisateur pour l'ouverture automatique de la page d'accueil au démarrage.
|
||||||
|
*
|
||||||
|
* @param state L'état.
|
||||||
|
*/
|
||||||
public void showHomeAtStartup(boolean state) {
|
public void showHomeAtStartup(boolean state) {
|
||||||
String stringState = (!state) ? "true" : "false";
|
String stringState = (!state) ? "true" : "false";
|
||||||
AppThinker.getATProperties().setProperty("showHomeAtStartup", stringState);
|
AppThinker.getATProperties().setProperty("showHomeAtStartup", stringState);
|
||||||
AppThinker.getATProperties().storeConfiguration();
|
AppThinker.getATProperties().storeConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne le paramètre utilisateur d'ouverture automatique de la page d'accueil.
|
||||||
|
*
|
||||||
|
* @return L'état.
|
||||||
|
*/
|
||||||
public boolean isHomeAtStartup() {
|
public boolean isHomeAtStartup() {
|
||||||
String state = AppThinker.getATProperties().getProperty("showHomeAtStartup");
|
String state = AppThinker.getATProperties().getProperty("showHomeAtStartup");
|
||||||
return (state.equals("true")) ? true : false;
|
return (state.equals("true")) ? true : false;
|
||||||
|
|||||||
@@ -9,6 +9,12 @@ public class LinkPropertiesController {
|
|||||||
private UmlDiagramController _umlDiagramController;
|
private UmlDiagramController _umlDiagramController;
|
||||||
private Link _link;
|
private Link _link;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur de LinkPropertiesController.
|
||||||
|
*
|
||||||
|
* @param umlDiagramController Le contrôleur du diagramme UML qui a commandé l'affichage.
|
||||||
|
* @param link Le lien en cours d'édition.
|
||||||
|
*/
|
||||||
public LinkPropertiesController(UmlDiagramController umlDiagramController, Link link) {
|
public LinkPropertiesController(UmlDiagramController umlDiagramController, Link link) {
|
||||||
_umlDiagramController = umlDiagramController;
|
_umlDiagramController = umlDiagramController;
|
||||||
_link = link;
|
_link = link;
|
||||||
@@ -17,27 +23,57 @@ public class LinkPropertiesController {
|
|||||||
_linkPropertiesWindow.initializeGraphics();
|
_linkPropertiesWindow.initializeGraphics();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne le nom du lien en cours d'édition.
|
||||||
|
*
|
||||||
|
* @return Le nom du lien en cours d'édition.
|
||||||
|
*/
|
||||||
public String getLinkName() {
|
public String getLinkName() {
|
||||||
return _link.getName();
|
return _link.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paramètre le nom du lien en cours d'édition.
|
||||||
|
*
|
||||||
|
* @param name Le nouveau nom.
|
||||||
|
*/
|
||||||
public void setLinkName(String name) {
|
public void setLinkName(String name) {
|
||||||
_link.setName(name);
|
_link.setName(name);
|
||||||
_umlDiagramController.needToSave();
|
_umlDiagramController.needToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne le nom de la classe de départ du lien.
|
||||||
|
*
|
||||||
|
* @return Le nom de la classe de départ du lien.
|
||||||
|
*/
|
||||||
public String getLinkStartName() {
|
public String getLinkStartName() {
|
||||||
return _link.getStart().getName();
|
return _link.getStart().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne le nom de la classe de d'arrivée du lien.
|
||||||
|
*
|
||||||
|
* @return Le nom de la classe de d'arrivée du lien.
|
||||||
|
*/
|
||||||
public String getLinkEndName() {
|
public String getLinkEndName() {
|
||||||
return _link.getEnd().getName();
|
return _link.getEnd().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne le type du lien en cours d'édition.
|
||||||
|
*
|
||||||
|
* @return Le type du lien en cours d'édition.
|
||||||
|
*/
|
||||||
public Link.LinkType getLinkType() {
|
public Link.LinkType getLinkType() {
|
||||||
return _link.getType();
|
return _link.getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paramètre le type du lien en cours d'édition.
|
||||||
|
*
|
||||||
|
* @param type Le nouveau type.
|
||||||
|
*/
|
||||||
public void setLinkType(Link.LinkType type) {
|
public void setLinkType(Link.LinkType type) {
|
||||||
_link.setType(type);
|
_link.setType(type);
|
||||||
_umlDiagramController.refreshGraphics();
|
_umlDiagramController.refreshGraphics();
|
||||||
@@ -45,48 +81,94 @@ public class LinkPropertiesController {
|
|||||||
_umlDiagramController.needToSave();
|
_umlDiagramController.needToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne le numéro du lien en cours d'édition.
|
||||||
|
*
|
||||||
|
* @return Le numéro du lien en cours d'édition.
|
||||||
|
*/
|
||||||
public int getLinkId() {
|
public int getLinkId() {
|
||||||
return _link.getId();
|
return _link.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne la cardinalité minimum de la classe de départ.
|
||||||
|
*
|
||||||
|
* @return La cardinalité minimum de la classe de départ.
|
||||||
|
*/
|
||||||
public int getLinkMinCardinalityStart() {
|
public int getLinkMinCardinalityStart() {
|
||||||
return _link.getMinCardinalityStart();
|
return _link.getMinCardinalityStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne la cardinalité maximum de la classe de départ.
|
||||||
|
*
|
||||||
|
* @return La cardinalité maximum de la classe de départ.
|
||||||
|
*/
|
||||||
public int getLinkMaxCardinalityStart() {
|
public int getLinkMaxCardinalityStart() {
|
||||||
return _link.getMaxCardinalityStart();
|
return _link.getMaxCardinalityStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne la cardinalité minimum de la classe d'arrivée.
|
||||||
|
*
|
||||||
|
* @return La cardinalité minimum de la classe d'arrivée.
|
||||||
|
*/
|
||||||
public int getLinkMinCardinalityEnd() {
|
public int getLinkMinCardinalityEnd() {
|
||||||
return _link.getMinCardinalityEnd();
|
return _link.getMinCardinalityEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne la cardinalité maximum de la classe d'arrivée.
|
||||||
|
*
|
||||||
|
* @return La cardinalité maximum de la classe d'arrivée.
|
||||||
|
*/
|
||||||
public int getLinkMaxCardinalityEnd() {
|
public int getLinkMaxCardinalityEnd() {
|
||||||
return _link.getMaxCardinalityEnd();
|
return _link.getMaxCardinalityEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paramètre la cardinalité minimum de la classe de départ.
|
||||||
|
*
|
||||||
|
* @param card La cardinalité minimum de la classe de départ.
|
||||||
|
*/
|
||||||
public void setLinkMinCardinalityStart(int card) {
|
public void setLinkMinCardinalityStart(int card) {
|
||||||
_link.setMinCardinalityStart(card);
|
_link.setMinCardinalityStart(card);
|
||||||
_umlDiagramController.needToSave();
|
_umlDiagramController.needToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paramètre la cardinalité maximum de la classe de départ.
|
||||||
|
*
|
||||||
|
* @param card La cardinalité maximum de la classe de départ.
|
||||||
|
*/
|
||||||
public void setLinkMaxCardinalityStart(int card) {
|
public void setLinkMaxCardinalityStart(int card) {
|
||||||
_link.setMaxCardinalityStart(card);
|
_link.setMaxCardinalityStart(card);
|
||||||
_umlDiagramController.needToSave();
|
_umlDiagramController.needToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paramètre la cardinalité minimum de la classe d'arrivée.
|
||||||
|
*
|
||||||
|
* @param card La cardinalité minimum de la classe d'arrivée.
|
||||||
|
*/
|
||||||
public void setLinkMinCardinalityEnd(int card) {
|
public void setLinkMinCardinalityEnd(int card) {
|
||||||
_link.setMinCardinalityEnd(card);
|
_link.setMinCardinalityEnd(card);
|
||||||
_umlDiagramController.needToSave();
|
_umlDiagramController.needToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paramètre la cardinalité maximum de la classe d'arrivée.
|
||||||
|
*
|
||||||
|
* @param card La cardinalité maximum de la classe d'arrivée.
|
||||||
|
*/
|
||||||
public void setLinkMaxCardinalityEnd(int card) {
|
public void setLinkMaxCardinalityEnd(int card) {
|
||||||
_link.setMaxCardinalityEnd(card);
|
_link.setMaxCardinalityEnd(card);
|
||||||
_umlDiagramController.needToSave();
|
_umlDiagramController.needToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inverse la direction du lien en cours d'édition.
|
||||||
|
*/
|
||||||
public void switchDirection() {
|
public void switchDirection() {
|
||||||
_link.switchDirection();
|
_link.switchDirection();
|
||||||
_linkPropertiesWindow.save();
|
_linkPropertiesWindow.save();
|
||||||
|
|||||||
@@ -12,95 +12,205 @@ public class UmlDiagramController {
|
|||||||
private UmlDiagramFrame _umlDiagramFrame;
|
private UmlDiagramFrame _umlDiagramFrame;
|
||||||
private UmlDiagram _umlDiagram;
|
private UmlDiagram _umlDiagram;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur de UmlDiagramController
|
||||||
|
*
|
||||||
|
* @param umlDiagramFrame La fenêtre contrôlée.
|
||||||
|
* @param umlDiagram Le diagramme UML concerné.
|
||||||
|
*/
|
||||||
public UmlDiagramController(UmlDiagramFrame umlDiagramFrame, UmlDiagram umlDiagram) {
|
public UmlDiagramController(UmlDiagramFrame umlDiagramFrame, UmlDiagram umlDiagram) {
|
||||||
_umlDiagramFrame = umlDiagramFrame;
|
_umlDiagramFrame = umlDiagramFrame;
|
||||||
_umlDiagram = umlDiagram;
|
_umlDiagram = umlDiagram;
|
||||||
_umlDiagramFrame.setController(this);
|
_umlDiagramFrame.setController(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne le nom du diagramme UML.
|
||||||
|
*
|
||||||
|
* @return Le nom du diagramme UML.
|
||||||
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return _umlDiagram.getName();
|
return _umlDiagram.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne la liste des classes du diagramme UML.
|
||||||
|
*
|
||||||
|
* @return La liste des classes du diagramme UML.
|
||||||
|
*/
|
||||||
public List<Class> getClassesList() {
|
public List<Class> getClassesList() {
|
||||||
return _umlDiagram.getClasses();
|
return _umlDiagram.getClasses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retire une classe du diagramme.
|
||||||
|
*
|
||||||
|
* @param a La classe à retirer.
|
||||||
|
*/
|
||||||
public void removeClass(Class a) {
|
public void removeClass(Class a) {
|
||||||
_umlDiagram.removeClass(a);
|
_umlDiagram.removeClass(a);
|
||||||
needToSave();
|
needToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supprime l'ensemble des classes du diagramme.
|
||||||
|
*/
|
||||||
public void clearClasses() {
|
public void clearClasses() {
|
||||||
_umlDiagram.clearClasses();
|
_umlDiagram.clearClasses();
|
||||||
needToSave();
|
needToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne la liste des liens du diagramme.
|
||||||
|
*
|
||||||
|
* @return La liste des liens du diagramme.
|
||||||
|
*/
|
||||||
public List<Link> getLinksList() {
|
public List<Link> getLinksList() {
|
||||||
return _umlDiagram.getLinks();
|
return _umlDiagram.getLinks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne la classe principale du diagramme.
|
||||||
|
*
|
||||||
|
* @return La classe principale du diagramme.
|
||||||
|
*/
|
||||||
public Class getMainClass() {
|
public Class getMainClass() {
|
||||||
return _umlDiagram.getMainClass();
|
return _umlDiagram.getMainClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paramètre la classe principale du diagramme.
|
||||||
|
*
|
||||||
|
* @param c La classe principale.
|
||||||
|
*/
|
||||||
public void setMainClass(Class c) {
|
public void setMainClass(Class c) {
|
||||||
_umlDiagram.setMainClass(c);
|
_umlDiagram.setMainClass(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajoute une classe dans le diagramme
|
||||||
|
*
|
||||||
|
* @param posX La coordonnée X de la classe
|
||||||
|
* @param posY La coordonnée Y de la classe
|
||||||
|
*/
|
||||||
public void addClass(int posX, int posY) {
|
public void addClass(int posX, int posY) {
|
||||||
_umlDiagram.addClass(new Class(posX, posY));
|
_umlDiagram.addClass(new Class(posX, posY));
|
||||||
needToSave();
|
needToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redimensionne une classe vers le haut.
|
||||||
|
*
|
||||||
|
* @param a La classe à redimensionner.
|
||||||
|
* @param posY Le décalage Y de la souris.
|
||||||
|
*/
|
||||||
public void resizeUp(Class a, int posY) {
|
public void resizeUp(Class a, int posY) {
|
||||||
a.resizeUp(posY);
|
a.resizeUp(posY);
|
||||||
needToSave();
|
needToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redimensionne une classe vers la droite.
|
||||||
|
*
|
||||||
|
* @param a La classe à redimensionner.
|
||||||
|
* @param posX Le décalage X de la souris.
|
||||||
|
*/
|
||||||
public void resizeRight(Class a, int posX) {
|
public void resizeRight(Class a, int posX) {
|
||||||
a.resizeRight(posX);
|
a.resizeRight(posX);
|
||||||
needToSave();
|
needToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redimensionne une classe vers le bas.
|
||||||
|
*
|
||||||
|
* @param a La classe à redimensionner.
|
||||||
|
* @param posY Le décalage Y de la souris.
|
||||||
|
*/
|
||||||
public void resizeDown(Class a, int posY) {
|
public void resizeDown(Class a, int posY) {
|
||||||
a.resizeDown(posY);
|
a.resizeDown(posY);
|
||||||
needToSave();
|
needToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redimensionne une classe vers la gauche.
|
||||||
|
*
|
||||||
|
* @param a La classe à redimensionner.
|
||||||
|
* @param posX Le décalage X de la souris.
|
||||||
|
*/
|
||||||
public void resizeLeft(Class a, int posX) {
|
public void resizeLeft(Class a, int posX) {
|
||||||
a.resizeLeft(posX);
|
a.resizeLeft(posX);
|
||||||
needToSave();
|
needToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paramètre la position X d'une classe du diagramme.
|
||||||
|
*
|
||||||
|
* @param a La classe à modifier.
|
||||||
|
* @param posX La nouvelle position X.
|
||||||
|
*/
|
||||||
public void setPosX(Class a, int posX) {
|
public void setPosX(Class a, int posX) {
|
||||||
a.setPosX(posX);
|
a.setPosX(posX);
|
||||||
needToSave();
|
needToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paramètre la position Y d'une classe du diagramme.
|
||||||
|
*
|
||||||
|
* @param a La classe à modifier.
|
||||||
|
* @param posY La nouvelle position Y.
|
||||||
|
*/
|
||||||
public void setPosY(Class a, int posY) {
|
public void setPosY(Class a, int posY) {
|
||||||
a.setPosY(posY);
|
a.setPosY(posY);
|
||||||
needToSave();
|
needToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajoute un nouveau lien au diagramme.
|
||||||
|
*
|
||||||
|
* @param start La classe de départ
|
||||||
|
* @param end La classe d'arrivée
|
||||||
|
* @param gripStart La position de départ
|
||||||
|
* @param gripEnd La position d'arrivée
|
||||||
|
* @param minCardStart La cardinalité minimum de la classe de départ
|
||||||
|
* @param maxCardStart La cardinalité maximum de la classe de départ
|
||||||
|
* @param minCardEnd La cardinalité minimum de la classe d'arrivée
|
||||||
|
* @param maxCardEnd La cardinalité maximum de la classe d'arrivée
|
||||||
|
* @param type Le type du lien
|
||||||
|
*/
|
||||||
public void addLink(Class start, Class end, UmlDiagramFrame.ClassGrip gripStart, UmlDiagramFrame.ClassGrip gripEnd, int minCardStart, int maxCardStart, int minCardEnd, int maxCardEnd, Link.LinkType type) {
|
public void addLink(Class start, Class end, UmlDiagramFrame.ClassGrip gripStart, UmlDiagramFrame.ClassGrip gripEnd, int minCardStart, int maxCardStart, int minCardEnd, int maxCardEnd, Link.LinkType type) {
|
||||||
_umlDiagram.addLink(new Link(start, end, gripStart, gripEnd, minCardStart, maxCardStart, minCardEnd, maxCardEnd, type));
|
_umlDiagram.addLink(new Link(start, end, gripStart, gripEnd, minCardStart, maxCardStart, minCardEnd, maxCardEnd, type));
|
||||||
needToSave();
|
needToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invalidation du diagramme pour sauvegarde
|
||||||
|
*/
|
||||||
public void needToSave() {
|
public void needToSave() {
|
||||||
_umlDiagram.needsToSave(true);
|
_umlDiagram.needsToSave(true);
|
||||||
_umlDiagramFrame.needWorkspaceRefresh();
|
_umlDiagramFrame.needWorkspaceRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rafraîchissement du diagramme
|
||||||
|
*/
|
||||||
public void refreshGraphics() {
|
public void refreshGraphics() {
|
||||||
_umlDiagramFrame.redraw();
|
_umlDiagramFrame.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Affichage de la fenêtre de modification d'une classe
|
||||||
|
*
|
||||||
|
* @param c La classe à modifier
|
||||||
|
*/
|
||||||
public void showClassWindow(Class c) {
|
public void showClassWindow(Class c) {
|
||||||
new ClassPropertiesController(this, c);
|
new ClassPropertiesController(this, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Affichage de la fenêtre de modification d'un lien
|
||||||
|
*
|
||||||
|
* @param l Le lien à modifier
|
||||||
|
*/
|
||||||
public void showLinkWindow(Link l) {
|
public void showLinkWindow(Link l) {
|
||||||
new LinkPropertiesController(this, l);
|
new LinkPropertiesController(this, l);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.thinkode.appthinker.AppThinker;
|
|||||||
import com.thinkode.appthinker.models.Composition;
|
import com.thinkode.appthinker.models.Composition;
|
||||||
import com.thinkode.appthinker.models.Project;
|
import com.thinkode.appthinker.models.Project;
|
||||||
import com.thinkode.appthinker.models.UmlDiagram;
|
import com.thinkode.appthinker.models.UmlDiagram;
|
||||||
import com.thinkode.appthinker.views.AboutWindow;
|
|
||||||
import com.thinkode.appthinker.views.HomeFrame;
|
import com.thinkode.appthinker.views.HomeFrame;
|
||||||
import com.thinkode.appthinker.views.UmlDiagramFrame;
|
import com.thinkode.appthinker.views.UmlDiagramFrame;
|
||||||
import com.thinkode.appthinker.views.Window;
|
import com.thinkode.appthinker.views.Window;
|
||||||
@@ -24,14 +23,11 @@ public class WindowController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur du contrôleur de la vue principale
|
* Constructeur du contrôleur de la vue principale
|
||||||
*
|
|
||||||
* @param atWindow Instance de la vue principale
|
|
||||||
*/
|
*/
|
||||||
public WindowController(Window atWindow) {
|
public WindowController() {
|
||||||
_atWindow = atWindow;
|
|
||||||
_projects = new java.util.ArrayList<Project>();
|
_projects = new java.util.ArrayList<Project>();
|
||||||
atWindow.setController(this);
|
_atWindow = new Window();
|
||||||
atWindow.setVisible(true);
|
_atWindow.setController(this);
|
||||||
String state = AppThinker.getATProperties().getProperty("showHomeAtStartup");
|
String state = AppThinker.getATProperties().getProperty("showHomeAtStartup");
|
||||||
if (state.equals("true")) showHomeFrame();
|
if (state.equals("true")) showHomeFrame();
|
||||||
refreshWorkspace();
|
refreshWorkspace();
|
||||||
@@ -39,6 +35,9 @@ public class WindowController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ouvre une composition dans la fenêtre
|
* Ouvre une composition dans la fenêtre
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro du projet
|
||||||
|
* @param compositionListId Le numéro de la composition
|
||||||
*/
|
*/
|
||||||
public void openComposition(int projectListId, int compositionListId) {
|
public void openComposition(int projectListId, int compositionListId) {
|
||||||
Composition composition = _projects.get(projectListId).getCompositions().get(compositionListId);
|
Composition composition = _projects.get(projectListId).getCompositions().get(compositionListId);
|
||||||
@@ -60,7 +59,7 @@ public class WindowController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajoute un nouveau projet vide à la fenêtre en cours
|
* Ajoute un nouveau projet UML à la fenêtre en cours
|
||||||
*/
|
*/
|
||||||
public void newUmlProject() {
|
public void newUmlProject() {
|
||||||
Project proj = new Project();
|
Project proj = new Project();
|
||||||
@@ -74,19 +73,26 @@ public class WindowController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajoute une composition UML à un projet
|
* Ajoute une composition UML à un projet
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro du projet
|
||||||
*/
|
*/
|
||||||
public void addUmlComposition(int projectListId) {
|
public void addUmlComposition(int projectListId) {
|
||||||
_projects.get(projectListId).addComposition(new UmlDiagram());
|
_projects.get(projectListId).addComposition(new UmlDiagram());
|
||||||
|
_atWindow.setStatusMessage("The UML Diagram has been added to the project.");
|
||||||
refreshWorkspace();
|
refreshWorkspace();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renomme le projet sélectionné
|
* Renomme le projet sélectionné
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro du projet
|
||||||
|
* @param newName Le nouveau nom
|
||||||
*/
|
*/
|
||||||
public void renameProject(int projectListId, String newName) {
|
public void renameProject(int projectListId, String newName) {
|
||||||
Project project = _projects.get(projectListId);
|
Project project = _projects.get(projectListId);
|
||||||
if (!projectNameExists(project, newName)) {
|
if (!projectNameExists(project, newName)) {
|
||||||
_projects.get(projectListId).setName(newName);
|
_projects.get(projectListId).setName(newName);
|
||||||
|
_atWindow.setStatusMessage("The project has been removed.");
|
||||||
refreshWorkspace();
|
refreshWorkspace();
|
||||||
} else {
|
} else {
|
||||||
_atWindow.showMessage("Another project in the workspace has the same name ! Please choose another name.");
|
_atWindow.showMessage("Another project in the workspace has the same name ! Please choose another name.");
|
||||||
@@ -95,6 +101,9 @@ public class WindowController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Vérifie si le projet peut être modifié avec ce nom
|
* Vérifie si le projet peut être modifié avec ce nom
|
||||||
|
*
|
||||||
|
* @param project Le projet cible
|
||||||
|
* @param name Le nouveau nom
|
||||||
*/
|
*/
|
||||||
private boolean projectNameExists(Project project, String name) {
|
private boolean projectNameExists(Project project, String name) {
|
||||||
for (Project p : _projects) {
|
for (Project p : _projects) {
|
||||||
@@ -105,6 +114,8 @@ public class WindowController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Supprime un projet existant
|
* Supprime un projet existant
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro du projet
|
||||||
*/
|
*/
|
||||||
public void deleteProject(int projectListId) {
|
public void deleteProject(int projectListId) {
|
||||||
Project project = _projects.get(projectListId);
|
Project project = _projects.get(projectListId);
|
||||||
@@ -117,11 +128,16 @@ public class WindowController {
|
|||||||
deleteCompositionFrame(project.getName(), comp.getName());
|
deleteCompositionFrame(project.getName(), comp.getName());
|
||||||
}
|
}
|
||||||
_projects.remove(projectListId);
|
_projects.remove(projectListId);
|
||||||
|
_atWindow.setStatusMessage("The project has been removed from the Workspace.");
|
||||||
refreshWorkspace();
|
refreshWorkspace();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renomme la composition d'un projet
|
* Renomme la composition d'un projet
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro du projet
|
||||||
|
* @param compositionListId Le numéro de la composition
|
||||||
|
* @param newName Le nouveau nom de composition
|
||||||
*/
|
*/
|
||||||
public void renameComposition(int projectListId, int compositionListId, String newName) {
|
public void renameComposition(int projectListId, int compositionListId, String newName) {
|
||||||
Project project = _projects.get(projectListId);
|
Project project = _projects.get(projectListId);
|
||||||
@@ -131,12 +147,17 @@ public class WindowController {
|
|||||||
comp.setName(newName);
|
comp.setName(newName);
|
||||||
refreshWorkspace();
|
refreshWorkspace();
|
||||||
_atWindow.updateCompositionTitle(project.getName(), oldName, newName);
|
_atWindow.updateCompositionTitle(project.getName(), oldName, newName);
|
||||||
|
_atWindow.setStatusMessage("The composition has been renamed.");
|
||||||
} else
|
} else
|
||||||
_atWindow.showMessage("Another composition in the project has the same name ! Please choose another name.");
|
_atWindow.showMessage("Another composition in the project has the same name ! Please choose another name.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vérifie si la composition peut être modifiée avec ce nom
|
* Vérifie si la composition peut être modifiée avec ce nom
|
||||||
|
*
|
||||||
|
* @param project Le projet incluant la composition
|
||||||
|
* @param composition La composition cible
|
||||||
|
* @param name Le nouveau nom de la composition.
|
||||||
*/
|
*/
|
||||||
private boolean compositionNameExists(Project project, Composition composition, String name) {
|
private boolean compositionNameExists(Project project, Composition composition, String name) {
|
||||||
for (Composition c : project.getCompositions()) {
|
for (Composition c : project.getCompositions()) {
|
||||||
@@ -147,6 +168,9 @@ public class WindowController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Supprimer une composition d'un projet
|
* Supprimer une composition d'un projet
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro du projet
|
||||||
|
* @param compositionListId Le numéro de la composition
|
||||||
*/
|
*/
|
||||||
public void deleteComposition(int projectListId, int compositionListId) {
|
public void deleteComposition(int projectListId, int compositionListId) {
|
||||||
Project project = _projects.get(projectListId);
|
Project project = _projects.get(projectListId);
|
||||||
@@ -154,10 +178,14 @@ public class WindowController {
|
|||||||
project.removeComposition(compositionListId);
|
project.removeComposition(compositionListId);
|
||||||
refreshWorkspace();
|
refreshWorkspace();
|
||||||
deleteCompositionFrame(project.getName(), comp.getName());
|
deleteCompositionFrame(project.getName(), comp.getName());
|
||||||
|
_atWindow.setStatusMessage("The composition has been removed from the project.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retire la CompositionFrame du widget
|
* Retire la CompositionFrame du widget
|
||||||
|
*
|
||||||
|
* @param projectName Le nom du projet.
|
||||||
|
* @param compositionName Le nom de la composition.
|
||||||
*/
|
*/
|
||||||
public void deleteCompositionFrame(String projectName, String compositionName) {
|
public void deleteCompositionFrame(String projectName, String compositionName) {
|
||||||
_atWindow.deleteCompositionFrame(projectName, compositionName);
|
_atWindow.deleteCompositionFrame(projectName, compositionName);
|
||||||
@@ -201,13 +229,13 @@ public class WindowController {
|
|||||||
if (ois != null) {
|
if (ois != null) {
|
||||||
ois.close();
|
ois.close();
|
||||||
//Ajout du projet à la fenêtre en cours
|
//Ajout du projet à la fenêtre en cours
|
||||||
for (Project p : _projects) {
|
|
||||||
|
|
||||||
}
|
|
||||||
if (!projectAlreadyOpened(project)) {
|
if (!projectAlreadyOpened(project)) {
|
||||||
_projects.add(project);
|
_projects.add(project);
|
||||||
refreshWorkspace();
|
refreshWorkspace();
|
||||||
_atWindow.setStatusMessage("The project has been opened.");
|
_atWindow.setStatusMessage("The project has been opened.");
|
||||||
|
} else {
|
||||||
|
_atWindow.showMessage("An opened project in the workspace has the same name. Please close this project and try again.");
|
||||||
|
_atWindow.setStatusMessage("Unable to open this project.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final IOException ex) {
|
} catch (final IOException ex) {
|
||||||
@@ -219,7 +247,7 @@ public class WindowController {
|
|||||||
/**
|
/**
|
||||||
* Vérifie si le projet est déjà dans le workspace
|
* Vérifie si le projet est déjà dans le workspace
|
||||||
*
|
*
|
||||||
* @return
|
* @return Le projet concerné.
|
||||||
*/
|
*/
|
||||||
private boolean projectAlreadyOpened(Project project) {
|
private boolean projectAlreadyOpened(Project project) {
|
||||||
for (Project p : _projects) {
|
for (Project p : _projects) {
|
||||||
@@ -239,6 +267,9 @@ public class WindowController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne le nom du projet sélectionné dans le Workspace
|
* Retourne le nom du projet sélectionné dans le Workspace
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro du projet.
|
||||||
|
* @return Le nom du projet sélectionné.
|
||||||
*/
|
*/
|
||||||
public String getProjectName(int projectListId) {
|
public String getProjectName(int projectListId) {
|
||||||
return _projects.get(projectListId).getName();
|
return _projects.get(projectListId).getName();
|
||||||
@@ -246,6 +277,9 @@ public class WindowController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne si le projet nécessite d'être sauvegardé ou non
|
* Retourne si le projet nécessite d'être sauvegardé ou non
|
||||||
|
*
|
||||||
|
* @param project Le projet concerné.
|
||||||
|
* @return Le projet a besoin d'être sauvegardé.
|
||||||
*/
|
*/
|
||||||
public boolean askForProjectSaved(Project project) {
|
public boolean askForProjectSaved(Project project) {
|
||||||
if (project.getPath() == null || project.isNeededToSave()) return true;
|
if (project.getPath() == null || project.isNeededToSave()) return true;
|
||||||
@@ -257,6 +291,10 @@ public class WindowController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne le nom de la composition sélectionnée dans le Workspace
|
* Retourne le nom de la composition sélectionnée dans le Workspace
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro du projet
|
||||||
|
* @param compositionListId Le numéro de la composition
|
||||||
|
* @return Le nom de la composition sélectionnée
|
||||||
*/
|
*/
|
||||||
public String getCompositionName(int projectListId, int compositionListId) {
|
public String getCompositionName(int projectListId, int compositionListId) {
|
||||||
return _projects.get(projectListId).getCompositions().get(compositionListId).getName();
|
return _projects.get(projectListId).getCompositions().get(compositionListId).getName();
|
||||||
@@ -264,22 +302,32 @@ public class WindowController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sauvegarder le projet
|
* Sauvegarder le projet
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro du projet
|
||||||
*/
|
*/
|
||||||
public void saveProject(int projectListId) {
|
public void saveProject(int projectListId) {
|
||||||
_projects.get(projectListId).saveProject();
|
if (_projects.get(projectListId).saveProject()) {
|
||||||
|
_atWindow.setStatusMessage("The project has been saved.");
|
||||||
refreshWorkspace();
|
refreshWorkspace();
|
||||||
|
} else _atWindow.setStatusMessage("Unable to save the project.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sauvegarder le projet sous
|
* Sauvegarder le projet sous
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro du projet
|
||||||
*/
|
*/
|
||||||
public void saveAsProject(int projectListId) {
|
public void saveAsProject(int projectListId) {
|
||||||
_projects.get(projectListId).saveAsProject();
|
if (_projects.get(projectListId).saveAsProject()) {
|
||||||
|
_atWindow.setStatusMessage("The project has been saved to the specified location.");
|
||||||
refreshWorkspace();
|
refreshWorkspace();
|
||||||
|
} else _atWindow.setStatusMessage("Unable to save the project to the specified location.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vérifie si la fenêtre contient des projets non-enregistrés avant la fermeture
|
* Vérifie si la fenêtre contient des projets non-enregistrés avant la fermeture
|
||||||
|
*
|
||||||
|
* @return L'autorisation de fermer la fenêtre
|
||||||
*/
|
*/
|
||||||
public boolean askForExit() {
|
public boolean askForExit() {
|
||||||
boolean allProjectsSaved = true;
|
boolean allProjectsSaved = true;
|
||||||
@@ -295,10 +343,17 @@ public class WindowController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Méthodes relatives à la barre de menu
|
//Méthodes relatives à la barre de menu
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lance l'ouverture de la fenêtre A Propos
|
||||||
|
*/
|
||||||
public void launchAboutWindow() {
|
public void launchAboutWindow() {
|
||||||
AboutWindowController _atAboutWindowController = new AboutWindowController(new AboutWindow());
|
new AboutWindowController();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lance l'URL du centre de téléchargement du logiciel.
|
||||||
|
*/
|
||||||
public void checkForUpdates() {
|
public void checkForUpdates() {
|
||||||
try {
|
try {
|
||||||
Desktop.getDesktop().browse(new URL("https://insset-my.sharepoint.com/:f:/g/personal/valentin_boulanger_insset_onmicrosoft_com/En4LybbeF2ZMpeSiesh_Af8BX3Fl1aDzTUWyw4dtQzJaag").toURI());
|
Desktop.getDesktop().browse(new URL("https://insset-my.sharepoint.com/:f:/g/personal/valentin_boulanger_insset_onmicrosoft_com/En4LybbeF2ZMpeSiesh_Af8BX3Fl1aDzTUWyw4dtQzJaag").toURI());
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gère un argument d'une méthode.
|
* Gère un argument d'une méthode.
|
||||||
|
*
|
||||||
* @author V.BOULANGER
|
* @author V.BOULANGER
|
||||||
*/
|
*/
|
||||||
public class Argument implements Serializable {
|
public class Argument implements Serializable {
|
||||||
@@ -15,9 +16,9 @@ public class Argument implements Serializable {
|
|||||||
private String _name;
|
private String _name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur - Crée une instance de AppThinker.UmlUtilities.Engine.Argument.
|
* Constructeur - Crée une instance de Argument.
|
||||||
*/
|
*/
|
||||||
public Argument(){
|
public Argument() {
|
||||||
_argumentId++;
|
_argumentId++;
|
||||||
this._id = _argumentId;
|
this._id = _argumentId;
|
||||||
this._type = "int";
|
this._type = "int";
|
||||||
@@ -25,11 +26,12 @@ public class Argument implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur - Crée une instance de AppThinker.UmlUtilities.Engine.Argument avec des paramètres donnés.
|
* Constructeur - Crée une instance de Argument avec des paramètres donnés.
|
||||||
|
*
|
||||||
* @param type Le type de l'argument.
|
* @param type Le type de l'argument.
|
||||||
* @param name Le nom de l'argument.
|
* @param name Le nom de l'argument.
|
||||||
*/
|
*/
|
||||||
public Argument(String type, String name){
|
public Argument(String type, String name) {
|
||||||
_argumentId++;
|
_argumentId++;
|
||||||
this._id = _argumentId;
|
this._id = _argumentId;
|
||||||
this._type = type;
|
this._type = type;
|
||||||
@@ -38,6 +40,7 @@ public class Argument implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Récupère le numéro de l'argument.
|
* Récupère le numéro de l'argument.
|
||||||
|
*
|
||||||
* @return Le numéro de l'argument.
|
* @return Le numéro de l'argument.
|
||||||
*/
|
*/
|
||||||
public int getId() {
|
public int getId() {
|
||||||
@@ -46,6 +49,7 @@ public class Argument implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Récupère le type de l'argument.
|
* Récupère le type de l'argument.
|
||||||
|
*
|
||||||
* @return Le type de l'argument.
|
* @return Le type de l'argument.
|
||||||
*/
|
*/
|
||||||
public String getType() {
|
public String getType() {
|
||||||
@@ -54,6 +58,7 @@ public class Argument implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Paramètre le type de l'argument.
|
* Paramètre le type de l'argument.
|
||||||
|
*
|
||||||
* @param type Le type de l'argument.
|
* @param type Le type de l'argument.
|
||||||
*/
|
*/
|
||||||
public void setType(String type) {
|
public void setType(String type) {
|
||||||
@@ -62,6 +67,7 @@ public class Argument implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Récupère le nom de l'argument.
|
* Récupère le nom de l'argument.
|
||||||
|
*
|
||||||
* @return Le nom de l'argument.
|
* @return Le nom de l'argument.
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@@ -70,6 +76,7 @@ public class Argument implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Paramètre le nom de l'argument.
|
* Paramètre le nom de l'argument.
|
||||||
|
*
|
||||||
* @param name Le nom de l'argument.
|
* @param name Le nom de l'argument.
|
||||||
*/
|
*/
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class Attribute implements Serializable {
|
|||||||
private boolean _isTransient;
|
private boolean _isTransient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur - Crée une instance de AppThinker.UmlUtilities.Engine.Attribute.
|
* Constructeur - Crée une instance de Attribute.
|
||||||
*/
|
*/
|
||||||
public Attribute() {
|
public Attribute() {
|
||||||
_attributeId++;
|
_attributeId++;
|
||||||
@@ -38,7 +38,7 @@ public class Attribute implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur - Crée une instance de AppThinker.UmlUtilities.Engine.Attribute avec des paramètres donnés.
|
* Constructeur - Crée une instance de Attribute avec des paramètres donnés.
|
||||||
*
|
*
|
||||||
* @param access Le modificateur d'accès de l'attribut.
|
* @param access Le modificateur d'accès de l'attribut.
|
||||||
* @param name Le nom de l'attribut.
|
* @param name Le nom de l'attribut.
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class Class implements Serializable {
|
|||||||
private List<Method> _methods;
|
private List<Method> _methods;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur - Crée une instance de AppThinker.UmlUtilities.Engine.Class.
|
* Constructeur - Crée une instance de Class.
|
||||||
*
|
*
|
||||||
* @param posX La position sur l'axe X de la nouvelle classe.
|
* @param posX La position sur l'axe X de la nouvelle classe.
|
||||||
* @param posY La position sur l'axe Y de la nouvelle classe.
|
* @param posY La position sur l'axe Y de la nouvelle classe.
|
||||||
@@ -48,7 +48,7 @@ public class Class implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur - Crée une instance de Class avec les paramètres déterminés.
|
* Constructeur - Crée une instance de Class avec les paramètres donnés.
|
||||||
*
|
*
|
||||||
* @param name Le nom de la classe importée.
|
* @param name Le nom de la classe importée.
|
||||||
* @param posX La position sur l'axe X de la classe importée.
|
* @param posX La position sur l'axe X de la classe importée.
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ public class Composition implements Serializable {
|
|||||||
protected String _name;
|
protected String _name;
|
||||||
protected boolean _needToSave = true;
|
protected boolean _needToSave = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur de la Composition.
|
||||||
|
*/
|
||||||
public Composition() {
|
public Composition() {
|
||||||
_id = _compositionId++;
|
_id = _compositionId++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class Link implements Serializable {
|
|||||||
private UmlDiagramFrame.ClassGrip _gripEnd;
|
private UmlDiagramFrame.ClassGrip _gripEnd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur - Crée une instance d'une classe.
|
* Constructeur - Crée une instance d'un lien.
|
||||||
*
|
*
|
||||||
* @param start La classe de départ.
|
* @param start La classe de départ.
|
||||||
* @param end La classe d'arrivée.
|
* @param end La classe d'arrivée.
|
||||||
@@ -59,7 +59,7 @@ public class Link implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur - Crée une instance d'une classe avec des paramètres déterminés.
|
* Constructeur - Crée une instance d'un lien avec des paramètres donnés.
|
||||||
*
|
*
|
||||||
* @param start La classe de départ.
|
* @param start La classe de départ.
|
||||||
* @param end La classe d'arrivée.
|
* @param end La classe d'arrivée.
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class Method implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur - Crée une instance de AppThinker.UmlUtilities.Engine.Method avec des paramètres donnés.
|
* Constructeur - Crée une instance de Method avec des paramètres donnés.
|
||||||
*
|
*
|
||||||
* @param access Le modificateur d'accès de la méthode.
|
* @param access Le modificateur d'accès de la méthode.
|
||||||
* @param type Le type de la méthode.
|
* @param type Le type de la méthode.
|
||||||
@@ -61,7 +61,7 @@ public class Method implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur - Crée une instance de AppThinker.UmlUtilities.Engine.Method avec des paramètres donnés.
|
* Constructeur - Crée une instance de Method avec des paramètres donnés.
|
||||||
*
|
*
|
||||||
* @param access Le modificateur d'accès de la méthode.
|
* @param access Le modificateur d'accès de la méthode.
|
||||||
* @param type Le type de la méthode.
|
* @param type Le type de la méthode.
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ public class UmlDiagram extends Composition {
|
|||||||
private List<Link> _links;
|
private List<Link> _links;
|
||||||
private Class _mainClass = null;
|
private Class _mainClass = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur de UmlDiagram
|
||||||
|
*/
|
||||||
public UmlDiagram() {
|
public UmlDiagram() {
|
||||||
_name = "UML Diagram " + _compositionId;
|
_name = "UML Diagram " + _compositionId;
|
||||||
_classes = new ArrayList<Class>();
|
_classes = new ArrayList<Class>();
|
||||||
|
|||||||
@@ -20,7 +20,12 @@ public class AboutWindow extends JDialog {
|
|||||||
* Constructeur - Crée une fenêtre A propos
|
* Constructeur - Crée une fenêtre A propos
|
||||||
*/
|
*/
|
||||||
public AboutWindow() {
|
public AboutWindow() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Charge les informations dans la fenêtre
|
||||||
|
*/
|
||||||
|
public void initializeGraphics() {
|
||||||
//Paramétrage de la fenêtre
|
//Paramétrage de la fenêtre
|
||||||
this.setTitle("AppThinker");
|
this.setTitle("AppThinker");
|
||||||
this.setModal(true);
|
this.setModal(true);
|
||||||
@@ -107,6 +112,7 @@ public class AboutWindow extends JDialog {
|
|||||||
donation.setBounds(320, 275, 250, 20);
|
donation.setBounds(320, 275, 250, 20);
|
||||||
|
|
||||||
this.getContentPane().add(panel);
|
this.getContentPane().add(panel);
|
||||||
|
this.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -28,13 +28,24 @@ public class ArgumentsPropertiesWindow extends JDialog {
|
|||||||
private String[] _argumentsColumns = {"Name", "Type"};
|
private String[] _argumentsColumns = {"Name", "Type"};
|
||||||
private DefaultTableModel _argumentModel;
|
private DefaultTableModel _argumentModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur de ArgumentsPropertiesWindow
|
||||||
|
*/
|
||||||
public ArgumentsPropertiesWindow() {
|
public ArgumentsPropertiesWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lie la vue à un contrôleur.
|
||||||
|
*
|
||||||
|
* @param argumentsPropertiesController La classe contrôleur
|
||||||
|
*/
|
||||||
public void setController(ArgumentsPropertiesController argumentsPropertiesController) {
|
public void setController(ArgumentsPropertiesController argumentsPropertiesController) {
|
||||||
_argumentsPropertiesController = argumentsPropertiesController;
|
_argumentsPropertiesController = argumentsPropertiesController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Charge les informations dans la fenêtre
|
||||||
|
*/
|
||||||
public void initializeGraphics() {
|
public void initializeGraphics() {
|
||||||
//Paramétrage de la fenêtre
|
//Paramétrage de la fenêtre
|
||||||
this.setTitle("Edit arguments - " + _argumentsPropertiesController.getMethodName());
|
this.setTitle("Edit arguments - " + _argumentsPropertiesController.getMethodName());
|
||||||
@@ -160,6 +171,8 @@ public class ArgumentsPropertiesWindow extends JDialog {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sélectionne une ligne du tableau d'arguments
|
* Sélectionne une ligne du tableau d'arguments
|
||||||
|
*
|
||||||
|
* @param index L'index de la ligne à sélectionner
|
||||||
*/
|
*/
|
||||||
public void selectArgument(int index) {
|
public void selectArgument(int index) {
|
||||||
_argumentsTable.setRowSelectionInterval(index, index);
|
_argumentsTable.setRowSelectionInterval(index, index);
|
||||||
@@ -167,6 +180,8 @@ public class ArgumentsPropertiesWindow extends JDialog {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Affiche la liste des arguments de la méthode dans le tableau
|
* Affiche la liste des arguments de la méthode dans le tableau
|
||||||
|
*
|
||||||
|
* @param arguments La liste des arguments.
|
||||||
*/
|
*/
|
||||||
public void listArguments(java.util.List<Argument> arguments) {
|
public void listArguments(java.util.List<Argument> arguments) {
|
||||||
//Import des attributs dans la table
|
//Import des attributs dans la table
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ public class ChangelogWindow extends JDialog {
|
|||||||
private ChangelogWindowController _atChangelogWindowController;
|
private ChangelogWindowController _atChangelogWindowController;
|
||||||
private JPanel _panel;
|
private JPanel _panel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur de ChangelogWindow
|
||||||
|
*/
|
||||||
public ChangelogWindow() {
|
public ChangelogWindow() {
|
||||||
//Paramétrage de la fenêtre
|
//Paramétrage de la fenêtre
|
||||||
Image img = null;
|
Image img = null;
|
||||||
@@ -24,20 +27,28 @@ public class ChangelogWindow extends JDialog {
|
|||||||
img = ImageIO.read(AppThinker.class.getResource("img/logoAppThinker.png"));
|
img = ImageIO.read(AppThinker.class.getResource("img/logoAppThinker.png"));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
}
|
}
|
||||||
|
this.setModal(true);
|
||||||
this.setIconImage(img);
|
this.setIconImage(img);
|
||||||
this.setResizable(false);
|
this.setResizable(false);
|
||||||
this.setLocationRelativeTo(null);
|
|
||||||
this.setLayout(new BorderLayout());
|
this.setLayout(new BorderLayout());
|
||||||
this.setModal(true);
|
|
||||||
this.setSize(new Dimension(800, 375));
|
this.setSize(new Dimension(800, 375));
|
||||||
|
this.setLocationRelativeTo(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setController(ChangelogWindowController atChangelogWindowController) {
|
/**
|
||||||
_atChangelogWindowController = atChangelogWindowController;
|
* Lie la vue à un contrôleur
|
||||||
|
*
|
||||||
|
* @param changelogWindowController La classe contrôleur.
|
||||||
|
*/
|
||||||
|
public void setController(ChangelogWindowController changelogWindowController) {
|
||||||
|
_atChangelogWindowController = changelogWindowController;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayChangelog(String version, java.util.List<String> changelog) {
|
/**
|
||||||
this.setTitle("Version " + version);
|
* Affiche les informations du changelog dans la fenêtre
|
||||||
|
*/
|
||||||
|
public void displayChangelog() {
|
||||||
|
this.setTitle("Version " + _atChangelogWindowController.getVersion());
|
||||||
_panel = new JPanel() {
|
_panel = new JPanel() {
|
||||||
@Override
|
@Override
|
||||||
protected void paintComponent(Graphics g) {
|
protected void paintComponent(Graphics g) {
|
||||||
@@ -51,15 +62,15 @@ public class ChangelogWindow extends JDialog {
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
}
|
}
|
||||||
g2.drawImage(img, 0, 20, 300, 300, this);
|
g2.drawImage(img, 0, 20, 300, 300, this);
|
||||||
/*Informations du logiciel*/
|
//Informations du logiciel/
|
||||||
g2.setColor(new Color(63, 169, 245));
|
g2.setColor(new Color(63, 169, 245));
|
||||||
g2.setFont(new Font("Arial", Font.BOLD, 40));
|
g2.setFont(new Font("Arial", Font.BOLD, 40));
|
||||||
g2.drawString("Thanks for downloading AppThinker !", 50, 45);
|
g2.drawString("Thanks for downloading AppThinker !", 50, 45);
|
||||||
g2.setFont(new Font("Arial", Font.PLAIN, 20));
|
g2.setFont(new Font("Arial", Font.PLAIN, 20));
|
||||||
g2.drawString("Version " + version, 305, 80);
|
g2.drawString("Version " + _atChangelogWindowController.getVersion(), 305, 80);
|
||||||
g2.setFont(new Font("Arial", Font.PLAIN, 14));
|
g2.setFont(new Font("Arial", Font.PLAIN, 14));
|
||||||
int i = 140;
|
int i = 140;
|
||||||
for (String a : changelog) {
|
for (String a : _atChangelogWindowController.getChangelog()) {
|
||||||
g2.drawString("> " + a, 305, i);
|
g2.drawString("> " + a, 305, i);
|
||||||
i += 25;
|
i += 25;
|
||||||
}
|
}
|
||||||
@@ -75,7 +86,9 @@ public class ChangelogWindow extends JDialog {
|
|||||||
_panel.add(ideas);
|
_panel.add(ideas);
|
||||||
ideas.setBounds(305, 90, 250, 20);
|
ideas.setBounds(305, 90, 250, 20);
|
||||||
_panel.setLayout(null);
|
_panel.setLayout(null);
|
||||||
|
|
||||||
this.getContentPane().add(_panel);
|
this.getContentPane().add(_panel);
|
||||||
|
_panel.repaint();
|
||||||
|
this.revalidate();
|
||||||
|
this.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ public class ClassPropertiesWindow extends JDialog {
|
|||||||
public ClassPropertiesWindow() {
|
public ClassPropertiesWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Charge les informations dans la fenêtre
|
||||||
|
*/
|
||||||
public void initializeGraphics() {
|
public void initializeGraphics() {
|
||||||
//Paramétrage de la fenêtre
|
//Paramétrage de la fenêtre
|
||||||
this.setTitle("Edit properties - " + _classPropertiesController.getClassName());
|
this.setTitle("Edit properties - " + _classPropertiesController.getClassName());
|
||||||
@@ -265,12 +268,19 @@ public class ClassPropertiesWindow extends JDialog {
|
|||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lie la vue à un contrôleur
|
||||||
|
*
|
||||||
|
* @param classPropertiesController La classe contrôleur
|
||||||
|
*/
|
||||||
public void setController(ClassPropertiesController classPropertiesController) {
|
public void setController(ClassPropertiesController classPropertiesController) {
|
||||||
_classPropertiesController = classPropertiesController;
|
_classPropertiesController = classPropertiesController;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sélectionne une ligne dans le tableau d'attribut
|
* Sélectionne une ligne dans le tableau d'attributs
|
||||||
|
*
|
||||||
|
* @param index L'index de la ligne à sélectionner
|
||||||
*/
|
*/
|
||||||
public void selectAttribute(int index) {
|
public void selectAttribute(int index) {
|
||||||
_attributesTable.setRowSelectionInterval(index, index);
|
_attributesTable.setRowSelectionInterval(index, index);
|
||||||
@@ -278,6 +288,8 @@ public class ClassPropertiesWindow extends JDialog {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sélectionne une ligne dans le tableau des méthodes
|
* Sélectionne une ligne dans le tableau des méthodes
|
||||||
|
*
|
||||||
|
* @param index L'index de la ligne à sélectionner
|
||||||
*/
|
*/
|
||||||
public void selectMethod(int index) {
|
public void selectMethod(int index) {
|
||||||
_methodsTable.setRowSelectionInterval(index, index);
|
_methodsTable.setRowSelectionInterval(index, index);
|
||||||
@@ -285,6 +297,8 @@ public class ClassPropertiesWindow extends JDialog {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Affiche la liste des attributs de la classe dans le tableau
|
* Affiche la liste des attributs de la classe dans le tableau
|
||||||
|
*
|
||||||
|
* @param attributes La liste des attributs
|
||||||
*/
|
*/
|
||||||
public void listAttributes(java.util.List<Attribute> attributes) {
|
public void listAttributes(java.util.List<Attribute> attributes) {
|
||||||
//Import des attributs dans la table
|
//Import des attributs dans la table
|
||||||
@@ -312,6 +326,8 @@ public class ClassPropertiesWindow extends JDialog {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Affiche la liste des méthodes de la classe dans le tableau.
|
* Affiche la liste des méthodes de la classe dans le tableau.
|
||||||
|
*
|
||||||
|
* @param methods La liste des méthodes
|
||||||
*/
|
*/
|
||||||
public void listMethods(java.util.List<Method> methods) {
|
public void listMethods(java.util.List<Method> methods) {
|
||||||
//Import des méthodes dans la table
|
//Import des méthodes dans la table
|
||||||
|
|||||||
@@ -19,10 +19,18 @@ public class CompositionFrame extends JPanel implements MouseListener, MouseMoti
|
|||||||
public CompositionFrame() {
|
public CompositionFrame() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajoute un CompositionListener à la vue
|
||||||
|
*
|
||||||
|
* @param atCompositionListener La classe d'écoute
|
||||||
|
*/
|
||||||
public void addCompositionListener(CompositionListener atCompositionListener) {
|
public void addCompositionListener(CompositionListener atCompositionListener) {
|
||||||
_atCompositionListener = atCompositionListener;
|
_atCompositionListener = atCompositionListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retire le CompositionListener
|
||||||
|
*/
|
||||||
public void removeCompositionListener() {
|
public void removeCompositionListener() {
|
||||||
_atCompositionListener = null;
|
_atCompositionListener = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,16 +9,6 @@ public interface CompositionListener {
|
|||||||
*/
|
*/
|
||||||
void statusEmitted(String status);
|
void statusEmitted(String status);
|
||||||
|
|
||||||
/**
|
|
||||||
* Met à jour la position de la souris
|
|
||||||
*/
|
|
||||||
void mousePositionUpdated(int mouseX, int mouseY);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Element size updated
|
|
||||||
*/
|
|
||||||
void elementSizeUpdated(int sizeX, int sizeY);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Need composition save
|
* Need composition save
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -14,19 +14,23 @@ public class CompositionWidget extends JTabbedPane implements CompositionListene
|
|||||||
private ArrayList<String> _projectPans;
|
private ArrayList<String> _projectPans;
|
||||||
private CompositionWidgetListener _listener;
|
private CompositionWidgetListener _listener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur de CompositionWidget
|
||||||
|
*/
|
||||||
public CompositionWidget() {
|
public CompositionWidget() {
|
||||||
_titlePans = new ArrayList<String>();
|
_titlePans = new ArrayList<String>();
|
||||||
_projectPans = new ArrayList<String>();
|
_projectPans = new ArrayList<String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajoute un écouteur d'évenement
|
||||||
|
*
|
||||||
|
* @param listener La classe d'écoute
|
||||||
|
*/
|
||||||
public void addCompositionWidgetListener(CompositionWidgetListener listener) {
|
public void addCompositionWidgetListener(CompositionWidgetListener listener) {
|
||||||
_listener = listener;
|
_listener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeCompositionWidgetListener() {
|
|
||||||
_listener = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajoute un nouvel onglet au composant contenant la composition à ajouter
|
* Ajoute un nouvel onglet au composant contenant la composition à ajouter
|
||||||
*
|
*
|
||||||
@@ -53,9 +57,9 @@ public class CompositionWidget extends JTabbedPane implements CompositionListene
|
|||||||
/**
|
/**
|
||||||
* Vérifie que l'onglet à ajouter n'est pas déjà ouvert
|
* Vérifie que l'onglet à ajouter n'est pas déjà ouvert
|
||||||
*
|
*
|
||||||
* @param title
|
* @param title Le titre de la composition
|
||||||
* @param project
|
* @param project Le nom du projet
|
||||||
* @return
|
* @return L'index de l'occurence, -1 si introuvable
|
||||||
*/
|
*/
|
||||||
private int checkIfExist(String title, String project) {
|
private int checkIfExist(String title, String project) {
|
||||||
for (int index = 0; index < this.getTabCount(); index++) {
|
for (int index = 0; index < this.getTabCount(); index++) {
|
||||||
@@ -67,7 +71,9 @@ public class CompositionWidget extends JTabbedPane implements CompositionListene
|
|||||||
/**
|
/**
|
||||||
* Crée l'objet graphique du titre de l'onglet
|
* Crée l'objet graphique du titre de l'onglet
|
||||||
*
|
*
|
||||||
* @return
|
* @param title Le titre de la composition
|
||||||
|
* @param index L'index d'insertion de l'onglet
|
||||||
|
* @return Le contenu JPanel créé
|
||||||
*/
|
*/
|
||||||
private JPanel createTitlePan(String title, int index) {
|
private JPanel createTitlePan(String title, int index) {
|
||||||
JPanel titlePan = new JPanel();
|
JPanel titlePan = new JPanel();
|
||||||
@@ -95,8 +101,6 @@ public class CompositionWidget extends JTabbedPane implements CompositionListene
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Vérifie qu'il n'y ait pas 2 compositions ouvertes du même nom. Rajoute le nom de projet pour les différencier dans ce cas.
|
* Vérifie qu'il n'y ait pas 2 compositions ouvertes du même nom. Rajoute le nom de projet pour les différencier dans ce cas.
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
private void optimizeNames() {
|
private void optimizeNames() {
|
||||||
for (String title : _titlePans) {
|
for (String title : _titlePans) {
|
||||||
@@ -119,8 +123,9 @@ public class CompositionWidget extends JTabbedPane implements CompositionListene
|
|||||||
/**
|
/**
|
||||||
* Met à jour le titre de la composition modifiée
|
* Met à jour le titre de la composition modifiée
|
||||||
*
|
*
|
||||||
* @param projectName
|
* @param projectName Le nom du projet
|
||||||
* @param newName
|
* @param oldName L'ancien nom
|
||||||
|
* @param newName Le nouveau nom
|
||||||
*/
|
*/
|
||||||
public void updateCompositionTitle(String projectName, String oldName, String newName) {
|
public void updateCompositionTitle(String projectName, String oldName, String newName) {
|
||||||
for (int i = 0; i < this.getTabCount(); i++) {
|
for (int i = 0; i < this.getTabCount(); i++) {
|
||||||
@@ -132,6 +137,9 @@ public class CompositionWidget extends JTabbedPane implements CompositionListene
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Supprime la composition du widget
|
* Supprime la composition du widget
|
||||||
|
*
|
||||||
|
* @param projectName Le nom du projet
|
||||||
|
* @param composition Le nom de la composition
|
||||||
*/
|
*/
|
||||||
public void deleteCompositionFrame(String projectName, String composition) {
|
public void deleteCompositionFrame(String projectName, String composition) {
|
||||||
for (int i = 0; i < this.getTabCount(); i++) {
|
for (int i = 0; i < this.getTabCount(); i++) {
|
||||||
@@ -144,6 +152,11 @@ public class CompositionWidget extends JTabbedPane implements CompositionListene
|
|||||||
optimizeNames();
|
optimizeNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supprime une vue de composition dans les onglets
|
||||||
|
*
|
||||||
|
* @param index L'index de la vue de composition à supprimer
|
||||||
|
*/
|
||||||
public void deleteCompositionFrame(int index) {
|
public void deleteCompositionFrame(int index) {
|
||||||
_titlePans.remove(index);
|
_titlePans.remove(index);
|
||||||
_projectPans.remove(index);
|
_projectPans.remove(index);
|
||||||
@@ -152,21 +165,20 @@ public class CompositionWidget extends JTabbedPane implements CompositionListene
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Evenements de la composition
|
//Evenements de la composition
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Affiche un message dans la barre de statut
|
||||||
|
*
|
||||||
|
* @param status Le message à afficher
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void statusEmitted(String status) {
|
public void statusEmitted(String status) {
|
||||||
/*setStatusMessage(status);*/
|
_listener.statusEmitted(status);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void mousePositionUpdated(int mouseX, int mouseY) {
|
|
||||||
/*setPositionLabel(mouseX, mouseY);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void elementSizeUpdated(int sizeX, int sizeY) {
|
|
||||||
/*setSizeLabel(sizeX, sizeY);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Commande le rafraîchissement du Workspace
|
||||||
|
*/
|
||||||
@java.lang.Override
|
@java.lang.Override
|
||||||
public void refreshWorkspaceNeeded() {
|
public void refreshWorkspaceNeeded() {
|
||||||
_listener.refreshWorkspaceNeeded();
|
_listener.refreshWorkspaceNeeded();
|
||||||
|
|||||||
@@ -5,4 +5,11 @@ public interface CompositionWidgetListener {
|
|||||||
* Demande le rafraîchissement du Workspace
|
* Demande le rafraîchissement du Workspace
|
||||||
*/
|
*/
|
||||||
void refreshWorkspaceNeeded();
|
void refreshWorkspaceNeeded();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Affiche un message dans la barre de statut
|
||||||
|
*
|
||||||
|
* @param message Le message à afficher
|
||||||
|
*/
|
||||||
|
void statusEmitted(String message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ public class HomeFrame extends CompositionFrame {
|
|||||||
private JPanel _makeDonation;
|
private JPanel _makeDonation;
|
||||||
private JCheckBox _dontShow;
|
private JCheckBox _dontShow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur de HomeFrameController
|
||||||
|
*/
|
||||||
public HomeFrame() {
|
public HomeFrame() {
|
||||||
this.setBackground(new Color(63, 169, 245));
|
this.setBackground(new Color(63, 169, 245));
|
||||||
this.setLayout(new BorderLayout());
|
this.setLayout(new BorderLayout());
|
||||||
@@ -74,7 +77,7 @@ public class HomeFrame extends CompositionFrame {
|
|||||||
//--Bouton nouveau projet
|
//--Bouton nouveau projet
|
||||||
_newBlankProject = new JPanel();
|
_newBlankProject = new JPanel();
|
||||||
_newBlankProject.setLayout(new FlowLayout(FlowLayout.LEFT));
|
_newBlankProject.setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||||
JLabel imgNewProject = new JLabel(new ImageIcon(AppThinker.class.getResource("img/x32/newProject.png")));
|
JLabel imgNewProject = new JLabel(new ImageIcon(AppThinker.class.getResource("img/x32/blankProject.png")));
|
||||||
_newBlankProject.add(imgNewProject);
|
_newBlankProject.add(imgNewProject);
|
||||||
JLabel newProjectLabel = new JLabel("Create a blank project");
|
JLabel newProjectLabel = new JLabel("Create a blank project");
|
||||||
_newBlankProject.setToolTipText("Create a new project without composition");
|
_newBlankProject.setToolTipText("Create a new project without composition");
|
||||||
@@ -84,7 +87,7 @@ public class HomeFrame extends CompositionFrame {
|
|||||||
//--Bouton nouveau projet UML
|
//--Bouton nouveau projet UML
|
||||||
_newUmlProject = new JPanel();
|
_newUmlProject = new JPanel();
|
||||||
_newUmlProject.setLayout(new FlowLayout(FlowLayout.LEFT));
|
_newUmlProject.setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||||
JLabel imgNewUmlProject = new JLabel(new ImageIcon(AppThinker.class.getResource("img/x32/newProject.png")));
|
JLabel imgNewUmlProject = new JLabel(new ImageIcon(AppThinker.class.getResource("img/x32/umlProject.png")));
|
||||||
_newUmlProject.add(imgNewUmlProject);
|
_newUmlProject.add(imgNewUmlProject);
|
||||||
JLabel newUmlProjectLabel = new JLabel("Create a UML project");
|
JLabel newUmlProjectLabel = new JLabel("Create a UML project");
|
||||||
_newUmlProject.setToolTipText("Create a new project and initialize it with an UML diagram");
|
_newUmlProject.setToolTipText("Create a new project and initialize it with an UML diagram");
|
||||||
@@ -161,12 +164,23 @@ public class HomeFrame extends CompositionFrame {
|
|||||||
this.add(content, BorderLayout.CENTER);
|
this.add(content, BorderLayout.CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lie la vue au contrôleur
|
||||||
|
*
|
||||||
|
* @param homeFrameController La classe contrôleur
|
||||||
|
*/
|
||||||
public void setController(HomeFrameController homeFrameController) {
|
public void setController(HomeFrameController homeFrameController) {
|
||||||
_homeFrameController = homeFrameController;
|
_homeFrameController = homeFrameController;
|
||||||
_dontShow.setSelected(!_homeFrameController.isHomeAtStartup());
|
_dontShow.setSelected(!_homeFrameController.isHomeAtStartup());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Evenements souris
|
//Evenements souris
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gestion des clics sur les boutons
|
||||||
|
*
|
||||||
|
* @param e L'Evenement souris
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
Object obj = e.getSource();
|
Object obj = e.getSource();
|
||||||
@@ -194,6 +208,11 @@ public class HomeFrame extends CompositionFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grise les boutons lors du survol de la souris
|
||||||
|
*
|
||||||
|
* @param e L'evenement souris
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
Object obj = e.getSource();
|
Object obj = e.getSource();
|
||||||
@@ -203,6 +222,11 @@ public class HomeFrame extends CompositionFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dégrise les boutons lors du survol de la souris
|
||||||
|
*
|
||||||
|
* @param e L'événement souris
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void mouseExited(MouseEvent e) {
|
public void mouseExited(MouseEvent e) {
|
||||||
Object obj = e.getSource();
|
Object obj = e.getSource();
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ public class LinkPropertiesWindow extends JDialog {
|
|||||||
public LinkPropertiesWindow() {
|
public LinkPropertiesWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Charge les informations dans la fenêtre
|
||||||
|
*/
|
||||||
public void initializeGraphics() {
|
public void initializeGraphics() {
|
||||||
//Paramétrage de la fenêtre
|
//Paramétrage de la fenêtre
|
||||||
this.setTitle("Edit properties - " + _linkPropertiesController.getLinkName());
|
this.setTitle("Edit properties - " + _linkPropertiesController.getLinkName());
|
||||||
@@ -106,6 +109,11 @@ public class LinkPropertiesWindow extends JDialog {
|
|||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lie la vue à un contrôleur
|
||||||
|
*
|
||||||
|
* @param linkPropertiesController La classe contrôleur
|
||||||
|
*/
|
||||||
public void setController(LinkPropertiesController linkPropertiesController) {
|
public void setController(LinkPropertiesController linkPropertiesController) {
|
||||||
_linkPropertiesController = linkPropertiesController;
|
_linkPropertiesController = linkPropertiesController;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class MenuBar extends JMenuBar {
|
|||||||
private MenuBarListener _menuBarListener;
|
private MenuBarListener _menuBarListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur de la classe ATMenuBar
|
* Constructeur de la classe MenuBar
|
||||||
*/
|
*/
|
||||||
public MenuBar() {
|
public MenuBar() {
|
||||||
//Création de la barre menu
|
//Création de la barre menu
|
||||||
@@ -83,6 +83,7 @@ public class MenuBar extends JMenuBar {
|
|||||||
_appMenu = new JMenu("AppThinker");
|
_appMenu = new JMenu("AppThinker");
|
||||||
|
|
||||||
_appSettings = new JMenuItem("Settings");
|
_appSettings = new JMenuItem("Settings");
|
||||||
|
_appSettings.setEnabled(false);
|
||||||
_appSettings.setIcon(new ImageIcon(AppThinker.class.getResource("img/x16/settings.png")));
|
_appSettings.setIcon(new ImageIcon(AppThinker.class.getResource("img/x16/settings.png")));
|
||||||
_appMenu.add(_appSettings);
|
_appMenu.add(_appSettings);
|
||||||
_appInfo = new JMenuItem("About AppThinker");
|
_appInfo = new JMenuItem("About AppThinker");
|
||||||
@@ -107,12 +108,12 @@ public class MenuBar extends JMenuBar {
|
|||||||
this.add(_appMenu);
|
this.add(_appMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajoute un écouteur d'événement
|
||||||
|
*
|
||||||
|
* @param listener La classe écouteur
|
||||||
|
*/
|
||||||
public void addMenuBarListener(MenuBarListener listener) {
|
public void addMenuBarListener(MenuBarListener listener) {
|
||||||
_menuBarListener = listener;
|
_menuBarListener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeMenuBarLister() {
|
|
||||||
_menuBarListener = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,39 +12,20 @@ import java.awt.*;
|
|||||||
public class Statusbar extends JPanel {
|
public class Statusbar extends JPanel {
|
||||||
|
|
||||||
private JLabel _statusLabel;
|
private JLabel _statusLabel;
|
||||||
private JLabel _posXLabel;
|
|
||||||
private JLabel _posYLabel;
|
|
||||||
private JLabel _sizeXLabel;
|
|
||||||
private JLabel _sizeYLabel;
|
|
||||||
private JLabel _fileLabel;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur de la classe AppThinker.Application.UI.AppThinkerStatusbar
|
* Constructeur de la classe AppThinkerStatusbar
|
||||||
*/
|
*/
|
||||||
public Statusbar() {
|
public Statusbar() {
|
||||||
//Création de la statusBar
|
//Création de la statusBar
|
||||||
this.setBorder(new BevelBorder(BevelBorder.LOWERED));
|
this.setBorder(new BevelBorder(BevelBorder.LOWERED));
|
||||||
this.setLayout(new GridLayout(1, 3));
|
this.setLayout(new GridLayout(1, 3));
|
||||||
|
_statusLabel = new JLabel();
|
||||||
_statusLabel = new JLabel("Create or import a project to start.");
|
_statusLabel.setForeground(Color.WHITE);
|
||||||
this.add(_statusLabel);
|
this.add(_statusLabel);
|
||||||
|
this.setBackground(Color.GRAY);
|
||||||
JPanel actionBar = new JPanel();
|
this.setBorder(null);
|
||||||
|
setStatusMessage("Create or import a project to start");
|
||||||
_posXLabel = new JLabel("PX : - |");
|
|
||||||
actionBar.add(_posXLabel);
|
|
||||||
_posYLabel = new JLabel("PY : - |");
|
|
||||||
actionBar.add(_posYLabel);
|
|
||||||
_sizeXLabel = new JLabel("SX : - |");
|
|
||||||
actionBar.add(_sizeXLabel);
|
|
||||||
_sizeYLabel = new JLabel("SY : -");
|
|
||||||
actionBar.add(_sizeYLabel);
|
|
||||||
|
|
||||||
this.add(actionBar);
|
|
||||||
|
|
||||||
_fileLabel = new JLabel("No project opened.");
|
|
||||||
_fileLabel.setHorizontalAlignment(JLabel.RIGHT);
|
|
||||||
this.add(_fileLabel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,37 +34,6 @@ public class Statusbar extends JPanel {
|
|||||||
* @param statusMessage Le message à afficher.
|
* @param statusMessage Le message à afficher.
|
||||||
*/
|
*/
|
||||||
public void setStatusMessage(String statusMessage) {
|
public void setStatusMessage(String statusMessage) {
|
||||||
this._statusLabel.setText(statusMessage);
|
this._statusLabel.setText(" " + statusMessage);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Met à jour le nom du fichier dans la barre de statut.
|
|
||||||
*
|
|
||||||
* @param fileMessage Le nom du fichier à afficher.
|
|
||||||
*/
|
|
||||||
public void setFileMessage(String fileMessage) {
|
|
||||||
this._fileLabel.setText(fileMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Met à jour les labels de position.
|
|
||||||
*
|
|
||||||
* @param posX La position X.
|
|
||||||
* @param posY La position Y.
|
|
||||||
*/
|
|
||||||
public void setPosLabel(int posX, int posY) {
|
|
||||||
this._posXLabel.setText("X : " + Integer.toString(posX) + " |");
|
|
||||||
this._posYLabel.setText("Y : " + Integer.toString(posY) + " |");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Met à jour les labels de taille.
|
|
||||||
*
|
|
||||||
* @param sizeX La taille X.
|
|
||||||
* @param sizeY La taille Y.
|
|
||||||
*/
|
|
||||||
public void setSizeLabel(int sizeX, int sizeY) {
|
|
||||||
this._sizeXLabel.setText("SX : " + ((sizeX == 0) ? "-" : Integer.toString(sizeX)) + " |");
|
|
||||||
this._sizeYLabel.setText("SY : " + ((sizeY == 0) ? "-" : Integer.toString(sizeY)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -400,7 +400,6 @@ public class UmlDiagramFrame extends CompositionFrame implements UmlToolbarListe
|
|||||||
//Si la classe est sélectionnée, on enregistre le décalage entre la souris et le centre de la classe
|
//Si la classe est sélectionnée, on enregistre le décalage entre la souris et le centre de la classe
|
||||||
if (_selected instanceof Class) {
|
if (_selected instanceof Class) {
|
||||||
Class a = (Class) _selected;
|
Class a = (Class) _selected;
|
||||||
_atCompositionListener.elementSizeUpdated(a.getSizeX(), a.getSizeY());
|
|
||||||
_shiftX = getX - a.getPosX();
|
_shiftX = getX - a.getPosX();
|
||||||
_shiftY = getY - a.getPosY();
|
_shiftY = getY - a.getPosY();
|
||||||
}
|
}
|
||||||
@@ -585,7 +584,6 @@ public class UmlDiagramFrame extends CompositionFrame implements UmlToolbarListe
|
|||||||
@Override
|
@Override
|
||||||
public void mouseDragged(MouseEvent e) {
|
public void mouseDragged(MouseEvent e) {
|
||||||
//Mise à jour des coordonnées de la souris dans la statusbar
|
//Mise à jour des coordonnées de la souris dans la statusbar
|
||||||
_atCompositionListener.mousePositionUpdated(e.getX(), e.getY());
|
|
||||||
int posX = e.getX();
|
int posX = e.getX();
|
||||||
int posY = e.getY();
|
int posY = e.getY();
|
||||||
if (_selected instanceof Class) {
|
if (_selected instanceof Class) {
|
||||||
@@ -623,7 +621,6 @@ public class UmlDiagramFrame extends CompositionFrame implements UmlToolbarListe
|
|||||||
_umlDiagramController.resizeLeft(a, posX);
|
_umlDiagramController.resizeLeft(a, posX);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_atCompositionListener.elementSizeUpdated(a.getSizeX(), a.getSizeY());
|
|
||||||
}
|
}
|
||||||
//Sinon on déplace
|
//Sinon on déplace
|
||||||
else {
|
else {
|
||||||
@@ -679,19 +676,20 @@ public class UmlDiagramFrame extends CompositionFrame implements UmlToolbarListe
|
|||||||
public void mouseMoved(MouseEvent e) {
|
public void mouseMoved(MouseEvent e) {
|
||||||
int getX = e.getX();
|
int getX = e.getX();
|
||||||
int getY = e.getY();
|
int getY = e.getY();
|
||||||
int sens = 5;
|
|
||||||
//Mise à jour des coordonnées de la souris dans la statusbar
|
|
||||||
_atCompositionListener.mousePositionUpdated(getX, getY);
|
|
||||||
//Si une classe est sélectionnée, on recherche si le curseur est à proximité d'un point d'accroche
|
//Si une classe est sélectionnée, on recherche si le curseur est à proximité d'un point d'accroche
|
||||||
if (_selected instanceof Class) {
|
if (_selected instanceof Class) {
|
||||||
Class a = (Class) _selected;
|
Class a = (Class) _selected;
|
||||||
_atCompositionListener.elementSizeUpdated(a.getSizeX(), a.getSizeY());
|
|
||||||
//Si une classe est sélectionnée, on recherche si le curseur est à proximité d'un point d'accroche
|
|
||||||
checkHoveredGrip(a, getX, getY);
|
checkHoveredGrip(a, getX, getY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Evenements de la UmlToolbar
|
//Evenements de la UmlToolbar
|
||||||
|
|
||||||
|
/**
|
||||||
|
* L'outil UML sélectionné a été modifié
|
||||||
|
*
|
||||||
|
* @param newTool Le nouvel outil sélectionné.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void toolChanged(UmlToolbar.UmlTool newTool) {
|
public void toolChanged(UmlToolbar.UmlTool newTool) {
|
||||||
//Changement du curseur du diagramme UML
|
//Changement du curseur du diagramme UML
|
||||||
@@ -711,6 +709,11 @@ public class UmlDiagramFrame extends CompositionFrame implements UmlToolbarListe
|
|||||||
else this.setViewGripsEnabled(false);
|
else this.setViewGripsEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Affiche la description de l'outil UML
|
||||||
|
*
|
||||||
|
* @param description La description de l'outil sélectionné
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void showToolDescription(String description) {
|
public void showToolDescription(String description) {
|
||||||
_atCompositionListener.statusEmitted(description);
|
_atCompositionListener.statusEmitted(description);
|
||||||
|
|||||||
@@ -246,14 +246,15 @@ public class UmlToolbar extends JPanel {
|
|||||||
this.setEnabled(false);
|
this.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajoute un écouteur d'événement
|
||||||
|
*
|
||||||
|
* @param atUmlToolbarListener La classe écouteur
|
||||||
|
*/
|
||||||
public void addUmlToolbarListener(UmlToolbarListener atUmlToolbarListener) {
|
public void addUmlToolbarListener(UmlToolbarListener atUmlToolbarListener) {
|
||||||
_atUmlToolbarListener = atUmlToolbarListener;
|
_atUmlToolbarListener = atUmlToolbarListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeUmlToolbarListener() {
|
|
||||||
_atUmlToolbarListener = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Récupère l'outil actuellement en fonction.
|
* Récupère l'outil actuellement en fonction.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ public class Window extends JFrame implements MenuBarListener, WorkspaceListener
|
|||||||
_compositionWidget = new CompositionWidget();
|
_compositionWidget = new CompositionWidget();
|
||||||
_compositionWidget.addCompositionWidgetListener(this);
|
_compositionWidget.addCompositionWidgetListener(this);
|
||||||
this.add(_compositionWidget, BorderLayout.CENTER);
|
this.add(_compositionWidget, BorderLayout.CENTER);
|
||||||
|
this.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -125,35 +126,39 @@ public class Window extends JFrame implements MenuBarListener, WorkspaceListener
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Affiche un message d'alerte
|
* Affiche un message d'alerte
|
||||||
|
*
|
||||||
|
* @param message Le message à afficher.
|
||||||
*/
|
*/
|
||||||
public void showMessage(String message) {
|
public void showMessage(String message) {
|
||||||
JOptionPane.showMessageDialog(this, message);
|
JOptionPane.showMessageDialog(this, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Affiche une boîte de dialogue
|
||||||
|
*
|
||||||
|
* @param message Le message à afficher
|
||||||
|
* @param title Le titre de la boite de dialogue
|
||||||
|
* @param option Les choix disponibles
|
||||||
|
* @param type Le type d'alerte
|
||||||
|
* @return Un entier correspondant au choix de l'utilisateur
|
||||||
|
*/
|
||||||
public int showMessage(String message, String title, int option, int type) {
|
public int showMessage(String message, String title, int option, int type) {
|
||||||
return JOptionPane.showOptionDialog(this, message, title, option, type, null, null, null);
|
return JOptionPane.showOptionDialog(this, message, title, option, type, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Affiche un message d'erreur dans la barre de statut
|
||||||
|
*
|
||||||
|
* @param message Le message à afficher
|
||||||
|
*/
|
||||||
public void setStatusMessage(String message) {
|
public void setStatusMessage(String message) {
|
||||||
_statusbar.setStatusMessage(message);
|
_statusbar.setStatusMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPositionLabel(int posX, int posY) {
|
|
||||||
_statusbar.setPosLabel(posX, posY);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSizeLabel(int sizeX, int sizeY) {
|
|
||||||
_statusbar.setSizeLabel(sizeX, sizeY);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFileMessage(String fileMessage) {
|
|
||||||
_statusbar.setFileMessage(fileMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remet à jour le Workspace à l'aide des projets de la fenêtre
|
* Remet à jour le Workspace à l'aide des projets de la fenêtre
|
||||||
*
|
*
|
||||||
* @param projects
|
* @param projects La liste de projets
|
||||||
*/
|
*/
|
||||||
public void refreshWorkspace(java.util.List<Project> projects) {
|
public void refreshWorkspace(java.util.List<Project> projects) {
|
||||||
_workspace.refreshTree(projects);
|
_workspace.refreshTree(projects);
|
||||||
@@ -162,9 +167,9 @@ public class Window extends JFrame implements MenuBarListener, WorkspaceListener
|
|||||||
/**
|
/**
|
||||||
* Remet à jour le titre de la composition ouverte dans le CompositionWidget
|
* Remet à jour le titre de la composition ouverte dans le CompositionWidget
|
||||||
*
|
*
|
||||||
* @param project
|
* @param project Le projet contenant la composition
|
||||||
* @param oldName
|
* @param oldName L'ancien nom de la composition
|
||||||
* @param newName
|
* @param newName Le nouveau nom de la composition
|
||||||
*/
|
*/
|
||||||
public void updateCompositionTitle(String project, String oldName, String newName) {
|
public void updateCompositionTitle(String project, String oldName, String newName) {
|
||||||
_compositionWidget.updateCompositionTitle(project, oldName, newName);
|
_compositionWidget.updateCompositionTitle(project, oldName, newName);
|
||||||
@@ -172,106 +177,210 @@ public class Window extends JFrame implements MenuBarListener, WorkspaceListener
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Supprime la composition du CompositionWidget
|
* Supprime la composition du CompositionWidget
|
||||||
|
*
|
||||||
|
* @param project Le projet contenant la composition à supprimer
|
||||||
|
* @param composition La composition à supprimer
|
||||||
*/
|
*/
|
||||||
public void deleteCompositionFrame(String project, String composition) {
|
public void deleteCompositionFrame(String project, String composition) {
|
||||||
_compositionWidget.deleteCompositionFrame(project, composition);
|
_compositionWidget.deleteCompositionFrame(project, composition);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Evenements du Workspace
|
//Evenements du Workspace
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Page d'accueil cliquée
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void homePageClicked() {
|
public void homePageClicked() {
|
||||||
_mainWindowController.showHomeFrame();
|
_mainWindowController.showHomeFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajout d'une composition UML
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro de projet
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addUmlComposition(int projectListId) {
|
public void addUmlComposition(int projectListId) {
|
||||||
_mainWindowController.addUmlComposition(projectListId);
|
_mainWindowController.addUmlComposition(projectListId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne le nom du projet
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro du projet
|
||||||
|
* @return Le nom du projet
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String askForProjectName(int projectListId) {
|
public String askForProjectName(int projectListId) {
|
||||||
return _mainWindowController.getProjectName(projectListId);
|
return _mainWindowController.getProjectName(projectListId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne si le projet a besoin d'être sauvegardé au non
|
||||||
|
*
|
||||||
|
* @param project Le projet concerné
|
||||||
|
* @return Un booléen représentant l'affirmation.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean askForProjectSaved(Project project) {
|
public boolean askForProjectSaved(Project project) {
|
||||||
return _mainWindowController.askForProjectSaved(project);
|
return _mainWindowController.askForProjectSaved(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renomme le projet
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro de projet concerné
|
||||||
|
* @param newName Le nouveau nom
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void renameProject(int projectListId, String newName) {
|
public void renameProject(int projectListId, String newName) {
|
||||||
_mainWindowController.renameProject(projectListId, newName);
|
_mainWindowController.renameProject(projectListId, newName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sauvegarde du projet
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro du projet concerné
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void saveProjectClicked(int projectListId) {
|
public void saveProjectClicked(int projectListId) {
|
||||||
_mainWindowController.saveProject(projectListId);
|
_mainWindowController.saveProject(projectListId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sauvegarde du projet sous...
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro du projet concerné
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void saveAsProjectClicked(int projectListId) {
|
public void saveAsProjectClicked(int projectListId) {
|
||||||
_mainWindowController.saveAsProject(projectListId);
|
_mainWindowController.saveAsProject(projectListId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Suppression du projet
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro du projet concerné
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteProject(int projectListId) {
|
public void deleteProject(int projectListId) {
|
||||||
_mainWindowController.deleteProject(projectListId);
|
_mainWindowController.deleteProject(projectListId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retourne le nom de la composition
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro de projet
|
||||||
|
* @param compositionListId Le numéro de la composition
|
||||||
|
* @return Le nom de la composition
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String askForCompositionName(int projectListId, int compositionListId) {
|
public String askForCompositionName(int projectListId, int compositionListId) {
|
||||||
return _mainWindowController.getCompositionName(projectListId, compositionListId);
|
return _mainWindowController.getCompositionName(projectListId, compositionListId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renomme la composition
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro de projet
|
||||||
|
* @param compositionListId Le numéro de la composition
|
||||||
|
* @param newName Le nouveau nom
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void renameComposition(int projectListId, int compositionListId, String newName) {
|
public void renameComposition(int projectListId, int compositionListId, String newName) {
|
||||||
_mainWindowController.renameComposition(projectListId, compositionListId, newName);
|
_mainWindowController.renameComposition(projectListId, compositionListId, newName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Suppression de la composition
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro du projet
|
||||||
|
* @param compositionListId Le numéro de la composition
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteComposition(int projectListId, int compositionListId) {
|
public void deleteComposition(int projectListId, int compositionListId) {
|
||||||
_mainWindowController.deleteComposition(projectListId, compositionListId);
|
_mainWindowController.deleteComposition(projectListId, compositionListId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Evènements de la barre de menu (MenuBarListener)
|
//Evènements de la barre de menu (MenuBarListener)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bouton Nouveau projet cliqué
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void newBlankProjectClicked() {
|
public void newBlankProjectClicked() {
|
||||||
_mainWindowController.newBlankProject();
|
_mainWindowController.newBlankProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Double-clic sur une composition
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro de projet
|
||||||
|
* @param compositionListId Le numéro de composition
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void compositionDoubleClick(int projectListId, int compositionListId) {
|
public void compositionDoubleClick(int projectListId, int compositionListId) {
|
||||||
_mainWindowController.openComposition(projectListId, compositionListId);
|
_mainWindowController.openComposition(projectListId, compositionListId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bouton nouveau projet cliqué
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void newUmlProjectClicked() {
|
public void newUmlProjectClicked() {
|
||||||
_mainWindowController.newUmlProject();
|
_mainWindowController.newUmlProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bouton Ouvrir projet cliqué
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void openProjectClicked() {
|
public void openProjectClicked() {
|
||||||
openProject();
|
openProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Demande de la fermeture de la fenêtre
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void quitClicked() {
|
public void quitClicked() {
|
||||||
if (_mainWindowController.askForExit()) System.exit(0);
|
if (_mainWindowController.askForExit()) System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clic sur le bouton A Propos
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void aboutAppThinkerClicked() {
|
public void aboutAppThinkerClicked() {
|
||||||
_mainWindowController.launchAboutWindow();
|
_mainWindowController.launchAboutWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clic sur le bouton de mise à jour
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void checkUpdatesClicked() {
|
public void checkUpdatesClicked() {
|
||||||
_mainWindowController.checkForUpdates();
|
_mainWindowController.checkForUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Evenement du CompositionWidget
|
//Evenement du CompositionWidget
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Demande la mise à jour du Workspace
|
||||||
|
*/
|
||||||
@java.lang.Override
|
@java.lang.Override
|
||||||
public void refreshWorkspaceNeeded() {
|
public void refreshWorkspaceNeeded() {
|
||||||
_mainWindowController.refreshWorkspace();
|
_mainWindowController.refreshWorkspace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Demande l'affichage d'un message dans la barre de statut
|
||||||
|
*
|
||||||
|
* @param message Le message à afficher
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void statusEmitted(String message) {
|
||||||
|
setStatusMessage(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ public class Workspace extends JPanel implements ActionListener, MouseListener,
|
|||||||
private JMenuItem _renameComposition;
|
private JMenuItem _renameComposition;
|
||||||
private JMenuItem _deleteComposition;
|
private JMenuItem _deleteComposition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur de Workspace
|
||||||
|
*/
|
||||||
public Workspace() {
|
public Workspace() {
|
||||||
this.setLayout(new BorderLayout());
|
this.setLayout(new BorderLayout());
|
||||||
this.setPreferredSize(new Dimension(300, 10000));
|
this.setPreferredSize(new Dimension(300, 10000));
|
||||||
@@ -51,6 +54,10 @@ public class Workspace extends JPanel implements ActionListener, MouseListener,
|
|||||||
_homePage.addMouseListener(this);
|
_homePage.addMouseListener(this);
|
||||||
_actionPanel.add(_homePage, BorderLayout.WEST);
|
_actionPanel.add(_homePage, BorderLayout.WEST);
|
||||||
|
|
||||||
|
JLabel workspace = new JLabel("Workspace");
|
||||||
|
workspace.setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
_actionPanel.add(workspace, BorderLayout.CENTER);
|
||||||
|
|
||||||
_newProject = new JPanel();
|
_newProject = new JPanel();
|
||||||
_newProject.setBackground(new Color(238, 238, 238));
|
_newProject.setBackground(new Color(238, 238, 238));
|
||||||
_newProject.setLayout(new FlowLayout(FlowLayout.LEFT));
|
_newProject.setLayout(new FlowLayout(FlowLayout.LEFT));
|
||||||
@@ -67,6 +74,8 @@ public class Workspace extends JPanel implements ActionListener, MouseListener,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Crée l'arborescence des projets dans le Workspace
|
* Crée l'arborescence des projets dans le Workspace
|
||||||
|
*
|
||||||
|
* @param La liste de projets
|
||||||
*/
|
*/
|
||||||
public void refreshTree(java.util.List<Project> projects) {
|
public void refreshTree(java.util.List<Project> projects) {
|
||||||
//Suppression de la scrollbar
|
//Suppression de la scrollbar
|
||||||
@@ -186,15 +195,23 @@ public class Workspace extends JPanel implements ActionListener, MouseListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Evenements du Workspace
|
//Evenements du Workspace
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajoute un écouteur d'événement
|
||||||
|
*
|
||||||
|
* @param listener La classe écouteur
|
||||||
|
*/
|
||||||
public void addWorkspaceListener(WorkspaceListener listener) {
|
public void addWorkspaceListener(WorkspaceListener listener) {
|
||||||
_listener = listener;
|
_listener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeWorkspaceListener() {
|
|
||||||
_listener = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Evenements souris
|
//Evenements souris
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gestion des clics sur les boutons
|
||||||
|
*
|
||||||
|
* @param e L'événement souris
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
Object obj = e.getSource();
|
Object obj = e.getSource();
|
||||||
@@ -215,21 +232,31 @@ public class Workspace extends JPanel implements ActionListener, MouseListener,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grise le bouton lors du survol de la souris
|
||||||
|
*
|
||||||
|
* @param e L'événement souris
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
Object obj = e.getSource();
|
Object obj = e.getSource();
|
||||||
if (obj instanceof JPanel) {
|
if (obj instanceof JPanel) {
|
||||||
JPanel pan = (JPanel) obj;
|
JPanel pan = (JPanel) obj;
|
||||||
if (pan == _homePage || pan == _newProject) pan.setBackground(Color.GRAY);
|
if (pan == _homePage || pan == _newProject) pan.setBackground(new Color(63, 169, 245));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dégrise le bouton lors du survol de la souris
|
||||||
|
*
|
||||||
|
* @param e L'événement souris
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void mouseExited(MouseEvent e) {
|
public void mouseExited(MouseEvent e) {
|
||||||
Object obj = e.getSource();
|
Object obj = e.getSource();
|
||||||
if (obj instanceof JPanel) {
|
if (obj instanceof JPanel) {
|
||||||
JPanel pan = (JPanel) obj;
|
JPanel pan = (JPanel) obj;
|
||||||
if (pan == _homePage || pan == _newProject) pan.setBackground(new Color(222, 222, 222));
|
if (pan == _homePage || pan == _newProject) pan.setBackground(new Color(238, 238, 238));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,6 +271,12 @@ public class Workspace extends JPanel implements ActionListener, MouseListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Clic sur un JMenuItem
|
//Clic sur un JMenuItem
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gestion des clics sur le menu contextuel
|
||||||
|
*
|
||||||
|
* @param e L'événement souris
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Object obj = e.getSource();
|
Object obj = e.getSource();
|
||||||
|
|||||||
@@ -16,56 +16,84 @@ public interface WorkspaceListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ouverture d'une composition
|
* Ouverture d'une composition
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro de projet
|
||||||
|
* @param compositionListId Le numéro de composition
|
||||||
*/
|
*/
|
||||||
void compositionDoubleClick(int projectListId, int compositionListId);
|
void compositionDoubleClick(int projectListId, int compositionListId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajoute une composition UML à un projet
|
* Ajoute une composition UML à un projet
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro de projet
|
||||||
*/
|
*/
|
||||||
void addUmlComposition(int projectListId);
|
void addUmlComposition(int projectListId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Demande le nom du projet sélectionné dans le Workspace
|
* Demande le nom du projet sélectionné dans le Workspace
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro de projet
|
||||||
*/
|
*/
|
||||||
String askForProjectName(int projectListId);
|
String askForProjectName(int projectListId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Demande si le projet doit être sauvegardé ou non
|
* Demande si le projet doit être sauvegardé ou non
|
||||||
|
*
|
||||||
|
* @param project Le projet concerné
|
||||||
*/
|
*/
|
||||||
boolean askForProjectSaved(Project project);
|
boolean askForProjectSaved(Project project);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renomme le projet sélectionné
|
* Renomme le projet sélectionné
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro de projet
|
||||||
|
* @param newName Le nouveau nom
|
||||||
*/
|
*/
|
||||||
void renameProject(int projectListId, String newName);
|
void renameProject(int projectListId, String newName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sauvegarde le projet
|
* Sauvegarde le projet
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro de projet
|
||||||
*/
|
*/
|
||||||
void saveProjectClicked(int projectListId);
|
void saveProjectClicked(int projectListId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sauvegarde le projet sous
|
* Sauvegarde le projet sous
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro de projet
|
||||||
*/
|
*/
|
||||||
void saveAsProjectClicked(int projectListId);
|
void saveAsProjectClicked(int projectListId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supprime un projet via le menu contextuel Projet
|
* Supprime un projet via le menu contextuel Projet
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro de projet
|
||||||
*/
|
*/
|
||||||
void deleteProject(int projectListId);
|
void deleteProject(int projectListId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Demande le nom d'une composition sélectionnée dans le Workspace
|
* Demande le nom d'une composition sélectionnée dans le Workspace
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro de projet
|
||||||
|
* @param compositionListId Le numéro de composition
|
||||||
*/
|
*/
|
||||||
String askForCompositionName(int projectListId, int compositionListId);
|
String askForCompositionName(int projectListId, int compositionListId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renomme la composition d'un projet
|
* Renomme la composition d'un projet
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro de projet
|
||||||
|
* @param compositionListId Le numéro de composition
|
||||||
|
* @param newName Le nouveau nom
|
||||||
*/
|
*/
|
||||||
void renameComposition(int projectListId, int compositionListId, String newName);
|
void renameComposition(int projectListId, int compositionListId, String newName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supprime une composition d'un projet via le menu contextuel Composition
|
* Supprime une composition d'un projet via le menu contextuel Composition
|
||||||
|
*
|
||||||
|
* @param projectListId Le numéro de projet
|
||||||
|
* @param compositionListId Le numéro de composition
|
||||||
*/
|
*/
|
||||||
void deleteComposition(int projectListId, int compositionListId);
|
void deleteComposition(int projectListId, int compositionListId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user