diff --git a/AppThinker/app.properties b/AppThinker/app.properties index 5eecd22..ef0128d 100644 --- a/AppThinker/app.properties +++ b/AppThinker/app.properties @@ -1,3 +1,4 @@ -#Thu Apr 22 12:13:10 CEST 2021 +#Fri Apr 23 15:08:28 CEST 2021 version=1.0.0 showHomeAtStartup=true +isFirstLaunch=false diff --git a/AppThinker/src/com/thinkode/appthinker/ATProperties.java b/AppThinker/src/com/thinkode/appthinker/ATProperties.java index c65d9c4..1208584 100644 --- a/AppThinker/src/com/thinkode/appthinker/ATProperties.java +++ b/AppThinker/src/com/thinkode/appthinker/ATProperties.java @@ -8,6 +8,9 @@ public class ATProperties extends Properties { private String _savePath; + /** + * Constructeur de ATProperties, propriétés de l'utilisateur + */ public ATProperties() { _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() { InputStream input = null; @@ -47,6 +50,7 @@ public class ATProperties extends Properties { public void setToDefault() { setProperty("version", "1.0.0"); setProperty("showHomeAtStartup", "true"); + setProperty("isFirstLaunch", "true"); } /** diff --git a/AppThinker/src/com/thinkode/appthinker/AppThinker.java b/AppThinker/src/com/thinkode/appthinker/AppThinker.java index 134a5fc..0927c2e 100644 --- a/AppThinker/src/com/thinkode/appthinker/AppThinker.java +++ b/AppThinker/src/com/thinkode/appthinker/AppThinker.java @@ -1,8 +1,8 @@ package com.thinkode.appthinker; +import com.thinkode.appthinker.controllers.ChangelogWindowController; import com.thinkode.appthinker.controllers.WindowController; import com.thinkode.appthinker.views.Splashscreen; -import com.thinkode.appthinker.views.Window; import java.util.ArrayList; import java.util.List; @@ -15,8 +15,8 @@ import java.util.List; public class AppThinker { //JavaDoc tags : @param @return @throws @author @version @see @since @serial @deprecated - public static String version = "1.0.0-dev6"; - public static String dateVersion = "18/03/2021"; + public static String version = "1.0.0"; + public static String dateVersion = "23/04/2021"; public static List changelog; public static String developer = "V. BOULANGER"; public static String copyright = "© 2021 - Valentin Boulanger"; @@ -35,8 +35,10 @@ public class AppThinker { _appProperties = new ATProperties("app.properties"); changelog = new ArrayList(); - changelog.add("#16 Workspace"); + changelog.add("#16 Workspace implementation"); changelog.add("#15 Multi-project and multi-composition editing"); + changelog.add("#39 MVC implementation"); + changelog.add("Resolve some graphic bugs"); _splash = new Splashscreen(); @@ -46,14 +48,14 @@ public class AppThinker { Thread.sleep(3000); _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 - /*if (_appProperties.getProperty("isFirstLaunch").equals("true")) { + if (_appProperties.getProperty("isFirstLaunch").equals("true")) { _appProperties.setProperty("isFirstLaunch", "false"); _appProperties.storeConfiguration(); - ATChangelogWindow changelog = new ATChangelogWindow(); - }*/ + new ChangelogWindowController(); + } } /** diff --git a/AppThinker/src/com/thinkode/appthinker/controllers/AboutWindowController.java b/AppThinker/src/com/thinkode/appthinker/controllers/AboutWindowController.java index 64589bf..03a41e7 100644 --- a/AppThinker/src/com/thinkode/appthinker/controllers/AboutWindowController.java +++ b/AppThinker/src/com/thinkode/appthinker/controllers/AboutWindowController.java @@ -1,7 +1,6 @@ package com.thinkode.appthinker.controllers; import com.thinkode.appthinker.views.AboutWindow; -import com.thinkode.appthinker.views.ChangelogWindow; import java.awt.*; import java.io.IOException; @@ -12,12 +11,18 @@ public class AboutWindowController { private AboutWindow _atAboutWindow; - public AboutWindowController(AboutWindow atAboutWindow) { - _atAboutWindow = atAboutWindow; + /** + * Constructeur de AboutWindowController + */ + public AboutWindowController() { + _atAboutWindow = new AboutWindow(); _atAboutWindow.setController(this); - _atAboutWindow.setVisible(true); + _atAboutWindow.initializeGraphics(); } + /** + * Lance l'URL du centre de téléchargement. + */ public void checkForUpdates() { try { 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() { - ChangelogWindowController _atChangelogWindowController = new ChangelogWindowController(new ChangelogWindow()); + new ChangelogWindowController(); } + /** + * Lance l'URL du formulaire pour la soumission d'idées ou bugs + */ public void giveFeedback() { try { 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() { try { Desktop.getDesktop().browse(new URL("https://www.paypal.com/paypalme/valentinboulanger").toURI()); diff --git a/AppThinker/src/com/thinkode/appthinker/controllers/ArgumentsPropertiesController.java b/AppThinker/src/com/thinkode/appthinker/controllers/ArgumentsPropertiesController.java index 519904c..1db904c 100644 --- a/AppThinker/src/com/thinkode/appthinker/controllers/ArgumentsPropertiesController.java +++ b/AppThinker/src/com/thinkode/appthinker/controllers/ArgumentsPropertiesController.java @@ -11,6 +11,13 @@ public class ArgumentsPropertiesController { private ClassPropertiesController _classPropertiesController; 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) { _umlDiagramController = umlDiagramController; _classPropertiesController = classPropertiesController; @@ -20,6 +27,11 @@ public class ArgumentsPropertiesController { _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() { return _method.getName(); } @@ -52,6 +64,8 @@ public class ArgumentsPropertiesController { /** * Monte l'argument + * + * @param index L'index de la méthode dans le tableau. */ public void goUpArgument(int index) { if (_method.upArgument(index)) { @@ -64,6 +78,8 @@ public class ArgumentsPropertiesController { /** * Baisse l'argument + * + * @param index L'index de la méthode dans le tableau. */ public void goDownArgument(int index) { if (_method.downArgument(index)) { @@ -74,12 +90,19 @@ public class ArgumentsPropertiesController { } } + /** + * Commande le rafraîchissement du tableau des arguments + */ public void refreshArguments() { _argumentsPropertiesWindow.listArguments(_method.getArguments()); } /** * 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) { _method.getArguments().get(index).setType(type); diff --git a/AppThinker/src/com/thinkode/appthinker/controllers/ChangelogWindowController.java b/AppThinker/src/com/thinkode/appthinker/controllers/ChangelogWindowController.java index 9b3d3b4..7665a7c 100644 --- a/AppThinker/src/com/thinkode/appthinker/controllers/ChangelogWindowController.java +++ b/AppThinker/src/com/thinkode/appthinker/controllers/ChangelogWindowController.java @@ -12,18 +12,36 @@ public class ChangelogWindowController { private ChangelogWindow _atChangelogWindow; - public ChangelogWindowController(ChangelogWindow atChangelogWindow) { - _atChangelogWindow = atChangelogWindow; - + /** + * Constructeur de ChangelogWindowController. + */ + public ChangelogWindowController() { + _atChangelogWindow = new ChangelogWindow(); _atChangelogWindow.setController(this); - displayChangelog(); - _atChangelogWindow.setVisible(true); + _atChangelogWindow.displayChangelog(); } - 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 getChangelog() { + return AppThinker.changelog; + } + + /** + * Lance l'URL du formulaire pour la soumission d'idées ou bugs. + */ public void giveFeedback() { try { Desktop.getDesktop().browse(new URL("https://forms.gle/WG32HT947MKqdzhbA").toURI()); diff --git a/AppThinker/src/com/thinkode/appthinker/controllers/ClassPropertiesController.java b/AppThinker/src/com/thinkode/appthinker/controllers/ClassPropertiesController.java index 778e1e3..6f49044 100644 --- a/AppThinker/src/com/thinkode/appthinker/controllers/ClassPropertiesController.java +++ b/AppThinker/src/com/thinkode/appthinker/controllers/ClassPropertiesController.java @@ -13,6 +13,12 @@ public class ClassPropertiesController { private UmlDiagramController _umlDiagramController; 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) { _class = c; _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() { return _class.getName(); @@ -40,7 +48,7 @@ public class ClassPropertiesController { /** * Retourne si la classe en cours d'édition est la classe principale * - * @return + * @return Un booléen représentant l'affirmation. */ public boolean isMainClass() { return _umlDiagramController.getMainClass() == _class; @@ -66,6 +74,8 @@ public class ClassPropertiesController { /** * 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) { 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) { _class.getAttributes().get(index).setName(name); @@ -94,6 +115,8 @@ public class ClassPropertiesController { /** * Go up the selected attribute + * + * @param attributeRow Le numéro de l'attribut. */ public void goUpAttribute(int attributeRow) { if (_class.upAttribute(attributeRow)) { @@ -106,6 +129,8 @@ public class ClassPropertiesController { /** * Go down the selected attribute + * + * @param attributeRow Le numéro de l'attribut. */ public void goDownAttribute(int attributeRow) { if (_class.downAttribute(attributeRow)) { @@ -118,6 +143,8 @@ public class ClassPropertiesController { /** * Open the arguments properties window + * + * @param methodRow Le numéro de la méthode. */ public void openArgumentsWindow(int 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() { _classPropertiesWindow.listAttributes(_class.getAttributes()); } /** - * Refresh methods + * Rafraîchissement des méthodes */ public void refreshMethods() { _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. - */ - public void addMethod(int index) { - _classPropertiesWindow.saveMethods(); - _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. + * + * @param index Le numéro de la méthode. + * @param m La méthode à insérer. */ private void addMethod(int index, Method m) { _classPropertiesWindow.saveMethods(); @@ -173,6 +192,8 @@ public class ClassPropertiesController { /** * 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) { if (index != -1) { diff --git a/AppThinker/src/com/thinkode/appthinker/controllers/HomeFrameController.java b/AppThinker/src/com/thinkode/appthinker/controllers/HomeFrameController.java index 1475b21..d6c7650 100644 --- a/AppThinker/src/com/thinkode/appthinker/controllers/HomeFrameController.java +++ b/AppThinker/src/com/thinkode/appthinker/controllers/HomeFrameController.java @@ -13,6 +13,12 @@ public class HomeFrameController { WindowController _windowController; 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) { _windowController = windowController; _homeFrame = homeFrame; @@ -33,10 +39,18 @@ public class HomeFrameController { _windowController.newUmlProject(); } + /** + * Commande l'ouverture d'un projet existant. + * + * @param path Le chemin du projet. + */ public void openProject(String path) { _windowController.openProject(path); } + /** + * Lance l'URL du formumlaire de soumission d'idées ou bugs. + */ public void giveFeedback() { try { 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() { try { 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() { try { Desktop.getDesktop().browse(new URL("https://www.paypal.com/paypalme/valentinboulanger").toURI()); @@ -62,12 +82,23 @@ public class HomeFrameController { } //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) { String stringState = (!state) ? "true" : "false"; AppThinker.getATProperties().setProperty("showHomeAtStartup", stringState); AppThinker.getATProperties().storeConfiguration(); } + /** + * Retourne le paramètre utilisateur d'ouverture automatique de la page d'accueil. + * + * @return L'état. + */ public boolean isHomeAtStartup() { String state = AppThinker.getATProperties().getProperty("showHomeAtStartup"); return (state.equals("true")) ? true : false; diff --git a/AppThinker/src/com/thinkode/appthinker/controllers/LinkPropertiesController.java b/AppThinker/src/com/thinkode/appthinker/controllers/LinkPropertiesController.java index d8165dc..baa43c6 100644 --- a/AppThinker/src/com/thinkode/appthinker/controllers/LinkPropertiesController.java +++ b/AppThinker/src/com/thinkode/appthinker/controllers/LinkPropertiesController.java @@ -9,6 +9,12 @@ public class LinkPropertiesController { private UmlDiagramController _umlDiagramController; 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) { _umlDiagramController = umlDiagramController; _link = link; @@ -17,27 +23,57 @@ public class LinkPropertiesController { _linkPropertiesWindow.initializeGraphics(); } + /** + * Retourne le nom du lien en cours d'édition. + * + * @return Le nom du lien en cours d'édition. + */ public String getLinkName() { return _link.getName(); } + /** + * Paramètre le nom du lien en cours d'édition. + * + * @param name Le nouveau nom. + */ public void setLinkName(String name) { _link.setName(name); _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() { 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() { 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() { return _link.getType(); } + /** + * Paramètre le type du lien en cours d'édition. + * + * @param type Le nouveau type. + */ public void setLinkType(Link.LinkType type) { _link.setType(type); _umlDiagramController.refreshGraphics(); @@ -45,48 +81,94 @@ public class LinkPropertiesController { _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() { 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() { 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() { 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() { 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() { 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) { _link.setMinCardinalityStart(card); _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) { _link.setMaxCardinalityStart(card); _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) { _link.setMinCardinalityEnd(card); _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) { _link.setMaxCardinalityEnd(card); _umlDiagramController.needToSave(); } + /** + * Inverse la direction du lien en cours d'édition. + */ public void switchDirection() { _link.switchDirection(); _linkPropertiesWindow.save(); diff --git a/AppThinker/src/com/thinkode/appthinker/controllers/UmlDiagramController.java b/AppThinker/src/com/thinkode/appthinker/controllers/UmlDiagramController.java index 2e96bcd..edd72d9 100644 --- a/AppThinker/src/com/thinkode/appthinker/controllers/UmlDiagramController.java +++ b/AppThinker/src/com/thinkode/appthinker/controllers/UmlDiagramController.java @@ -12,95 +12,205 @@ public class UmlDiagramController { private UmlDiagramFrame _umlDiagramFrame; 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) { _umlDiagramFrame = umlDiagramFrame; _umlDiagram = umlDiagram; _umlDiagramFrame.setController(this); } + /** + * Retourne le nom du diagramme UML. + * + * @return Le nom du diagramme UML. + */ public String getName() { return _umlDiagram.getName(); } + /** + * Retourne la liste des classes du diagramme UML. + * + * @return La liste des classes du diagramme UML. + */ public List getClassesList() { return _umlDiagram.getClasses(); } + /** + * Retire une classe du diagramme. + * + * @param a La classe à retirer. + */ public void removeClass(Class a) { _umlDiagram.removeClass(a); needToSave(); } + /** + * Supprime l'ensemble des classes du diagramme. + */ public void clearClasses() { _umlDiagram.clearClasses(); needToSave(); } + /** + * Retourne la liste des liens du diagramme. + * + * @return La liste des liens du diagramme. + */ public List getLinksList() { return _umlDiagram.getLinks(); } + /** + * Retourne la classe principale du diagramme. + * + * @return La classe principale du diagramme. + */ public Class getMainClass() { return _umlDiagram.getMainClass(); } + /** + * Paramètre la classe principale du diagramme. + * + * @param c La classe principale. + */ public void setMainClass(Class 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) { _umlDiagram.addClass(new Class(posX, posY)); 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) { a.resizeUp(posY); 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) { a.resizeRight(posX); 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) { a.resizeDown(posY); 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) { a.resizeLeft(posX); 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) { a.setPosX(posX); 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) { a.setPosY(posY); 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) { _umlDiagram.addLink(new Link(start, end, gripStart, gripEnd, minCardStart, maxCardStart, minCardEnd, maxCardEnd, type)); needToSave(); } + /** + * Invalidation du diagramme pour sauvegarde + */ public void needToSave() { _umlDiagram.needsToSave(true); _umlDiagramFrame.needWorkspaceRefresh(); } + /** + * Rafraîchissement du diagramme + */ public void refreshGraphics() { _umlDiagramFrame.redraw(); } + /** + * Affichage de la fenêtre de modification d'une classe + * + * @param c La classe à modifier + */ public void showClassWindow(Class 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) { new LinkPropertiesController(this, l); } diff --git a/AppThinker/src/com/thinkode/appthinker/controllers/WindowController.java b/AppThinker/src/com/thinkode/appthinker/controllers/WindowController.java index 2c24f57..7289a45 100644 --- a/AppThinker/src/com/thinkode/appthinker/controllers/WindowController.java +++ b/AppThinker/src/com/thinkode/appthinker/controllers/WindowController.java @@ -4,7 +4,6 @@ import com.thinkode.appthinker.AppThinker; import com.thinkode.appthinker.models.Composition; import com.thinkode.appthinker.models.Project; import com.thinkode.appthinker.models.UmlDiagram; -import com.thinkode.appthinker.views.AboutWindow; import com.thinkode.appthinker.views.HomeFrame; import com.thinkode.appthinker.views.UmlDiagramFrame; import com.thinkode.appthinker.views.Window; @@ -24,14 +23,11 @@ public class WindowController { /** * Constructeur du contrôleur de la vue principale - * - * @param atWindow Instance de la vue principale */ - public WindowController(Window atWindow) { - _atWindow = atWindow; + public WindowController() { _projects = new java.util.ArrayList(); - atWindow.setController(this); - atWindow.setVisible(true); + _atWindow = new Window(); + _atWindow.setController(this); String state = AppThinker.getATProperties().getProperty("showHomeAtStartup"); if (state.equals("true")) showHomeFrame(); refreshWorkspace(); @@ -39,6 +35,9 @@ public class WindowController { /** * 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) { 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() { Project proj = new Project(); @@ -74,19 +73,26 @@ public class WindowController { /** * Ajoute une composition UML à un projet + * + * @param projectListId Le numéro du projet */ public void addUmlComposition(int projectListId) { _projects.get(projectListId).addComposition(new UmlDiagram()); + _atWindow.setStatusMessage("The UML Diagram has been added to the project."); refreshWorkspace(); } /** * Renomme le projet sélectionné + * + * @param projectListId Le numéro du projet + * @param newName Le nouveau nom */ public void renameProject(int projectListId, String newName) { Project project = _projects.get(projectListId); if (!projectNameExists(project, newName)) { _projects.get(projectListId).setName(newName); + _atWindow.setStatusMessage("The project has been removed."); refreshWorkspace(); } else { _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 + * + * @param project Le projet cible + * @param name Le nouveau nom */ private boolean projectNameExists(Project project, String name) { for (Project p : _projects) { @@ -105,6 +114,8 @@ public class WindowController { /** * Supprime un projet existant + * + * @param projectListId Le numéro du projet */ public void deleteProject(int projectListId) { Project project = _projects.get(projectListId); @@ -117,11 +128,16 @@ public class WindowController { deleteCompositionFrame(project.getName(), comp.getName()); } _projects.remove(projectListId); + _atWindow.setStatusMessage("The project has been removed from the Workspace."); refreshWorkspace(); } /** * 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) { Project project = _projects.get(projectListId); @@ -131,12 +147,17 @@ public class WindowController { comp.setName(newName); refreshWorkspace(); _atWindow.updateCompositionTitle(project.getName(), oldName, newName); + _atWindow.setStatusMessage("The composition has been renamed."); } else _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 + * + * @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) { for (Composition c : project.getCompositions()) { @@ -147,6 +168,9 @@ public class WindowController { /** * 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) { Project project = _projects.get(projectListId); @@ -154,10 +178,14 @@ public class WindowController { project.removeComposition(compositionListId); refreshWorkspace(); deleteCompositionFrame(project.getName(), comp.getName()); + _atWindow.setStatusMessage("The composition has been removed from the project."); } /** * 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) { _atWindow.deleteCompositionFrame(projectName, compositionName); @@ -201,13 +229,13 @@ public class WindowController { if (ois != null) { ois.close(); //Ajout du projet à la fenêtre en cours - for (Project p : _projects) { - - } if (!projectAlreadyOpened(project)) { _projects.add(project); refreshWorkspace(); _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) { @@ -219,7 +247,7 @@ public class WindowController { /** * Vérifie si le projet est déjà dans le workspace * - * @return + * @return Le projet concerné. */ private boolean projectAlreadyOpened(Project project) { for (Project p : _projects) { @@ -239,6 +267,9 @@ public class WindowController { /** * 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) { return _projects.get(projectListId).getName(); @@ -246,6 +277,9 @@ public class WindowController { /** * 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) { 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 + * + * @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) { return _projects.get(projectListId).getCompositions().get(compositionListId).getName(); @@ -264,22 +302,32 @@ public class WindowController { /** * Sauvegarder le projet + * + * @param projectListId Le numéro du projet */ public void saveProject(int projectListId) { - _projects.get(projectListId).saveProject(); - refreshWorkspace(); + if (_projects.get(projectListId).saveProject()) { + _atWindow.setStatusMessage("The project has been saved."); + refreshWorkspace(); + } else _atWindow.setStatusMessage("Unable to save the project."); } /** * Sauvegarder le projet sous + * + * @param projectListId Le numéro du projet */ public void saveAsProject(int projectListId) { - _projects.get(projectListId).saveAsProject(); - refreshWorkspace(); + if (_projects.get(projectListId).saveAsProject()) { + _atWindow.setStatusMessage("The project has been saved to the specified location."); + 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 + * + * @return L'autorisation de fermer la fenêtre */ public boolean askForExit() { boolean allProjectsSaved = true; @@ -295,10 +343,17 @@ public class WindowController { } //Méthodes relatives à la barre de menu + + /** + * Lance l'ouverture de la fenêtre A Propos + */ 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() { try { Desktop.getDesktop().browse(new URL("https://insset-my.sharepoint.com/:f:/g/personal/valentin_boulanger_insset_onmicrosoft_com/En4LybbeF2ZMpeSiesh_Af8BX3Fl1aDzTUWyw4dtQzJaag").toURI()); diff --git a/AppThinker/src/com/thinkode/appthinker/models/Argument.java b/AppThinker/src/com/thinkode/appthinker/models/Argument.java index eb46211..9c95cd8 100644 --- a/AppThinker/src/com/thinkode/appthinker/models/Argument.java +++ b/AppThinker/src/com/thinkode/appthinker/models/Argument.java @@ -4,6 +4,7 @@ import java.io.Serializable; /** * Gère un argument d'une méthode. + * * @author V.BOULANGER */ public class Argument implements Serializable { @@ -15,9 +16,9 @@ public class Argument implements Serializable { 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++; this._id = _argumentId; 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 name Le nom de l'argument. */ - public Argument(String type, String name){ + public Argument(String type, String name) { _argumentId++; this._id = _argumentId; this._type = type; @@ -38,6 +40,7 @@ public class Argument implements Serializable { /** * Récupère le numéro de l'argument. + * * @return Le numéro de l'argument. */ public int getId() { @@ -46,6 +49,7 @@ public class Argument implements Serializable { /** * Récupère le type de l'argument. + * * @return Le type de l'argument. */ public String getType() { @@ -54,6 +58,7 @@ public class Argument implements Serializable { /** * Paramètre le type de l'argument. + * * @param type Le type de l'argument. */ public void setType(String type) { @@ -62,6 +67,7 @@ public class Argument implements Serializable { /** * Récupère le nom de l'argument. + * * @return Le nom de l'argument. */ public String getName() { @@ -70,6 +76,7 @@ public class Argument implements Serializable { /** * Paramètre le nom de l'argument. + * * @param name Le nom de l'argument. */ public void setName(String name) { diff --git a/AppThinker/src/com/thinkode/appthinker/models/Attribute.java b/AppThinker/src/com/thinkode/appthinker/models/Attribute.java index b3db141..3f1d2eb 100644 --- a/AppThinker/src/com/thinkode/appthinker/models/Attribute.java +++ b/AppThinker/src/com/thinkode/appthinker/models/Attribute.java @@ -27,7 +27,7 @@ public class Attribute implements Serializable { private boolean _isTransient; /** - * Constructeur - Crée une instance de AppThinker.UmlUtilities.Engine.Attribute. + * Constructeur - Crée une instance de Attribute. */ public Attribute() { _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 name Le nom de l'attribut. diff --git a/AppThinker/src/com/thinkode/appthinker/models/Class.java b/AppThinker/src/com/thinkode/appthinker/models/Class.java index d53d3d4..f2a3cad 100644 --- a/AppThinker/src/com/thinkode/appthinker/models/Class.java +++ b/AppThinker/src/com/thinkode/appthinker/models/Class.java @@ -29,7 +29,7 @@ public class Class implements Serializable { private List _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 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 posX La position sur l'axe X de la classe importée. diff --git a/AppThinker/src/com/thinkode/appthinker/models/Composition.java b/AppThinker/src/com/thinkode/appthinker/models/Composition.java index 0fcec7a..14e5672 100644 --- a/AppThinker/src/com/thinkode/appthinker/models/Composition.java +++ b/AppThinker/src/com/thinkode/appthinker/models/Composition.java @@ -14,6 +14,9 @@ public class Composition implements Serializable { protected String _name; protected boolean _needToSave = true; + /** + * Constructeur de la Composition. + */ public Composition() { _id = _compositionId++; } diff --git a/AppThinker/src/com/thinkode/appthinker/models/Link.java b/AppThinker/src/com/thinkode/appthinker/models/Link.java index 9f44951..358c950 100644 --- a/AppThinker/src/com/thinkode/appthinker/models/Link.java +++ b/AppThinker/src/com/thinkode/appthinker/models/Link.java @@ -40,7 +40,7 @@ public class Link implements Serializable { 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 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 end La classe d'arrivée. diff --git a/AppThinker/src/com/thinkode/appthinker/models/Method.java b/AppThinker/src/com/thinkode/appthinker/models/Method.java index fd86fd8..35d38df 100644 --- a/AppThinker/src/com/thinkode/appthinker/models/Method.java +++ b/AppThinker/src/com/thinkode/appthinker/models/Method.java @@ -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 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 type Le type de la méthode. diff --git a/AppThinker/src/com/thinkode/appthinker/models/UmlDiagram.java b/AppThinker/src/com/thinkode/appthinker/models/UmlDiagram.java index 303f574..0f58b4f 100644 --- a/AppThinker/src/com/thinkode/appthinker/models/UmlDiagram.java +++ b/AppThinker/src/com/thinkode/appthinker/models/UmlDiagram.java @@ -15,6 +15,9 @@ public class UmlDiagram extends Composition { private List _links; private Class _mainClass = null; + /** + * Constructeur de UmlDiagram + */ public UmlDiagram() { _name = "UML Diagram " + _compositionId; _classes = new ArrayList(); diff --git a/AppThinker/src/com/thinkode/appthinker/views/AboutWindow.java b/AppThinker/src/com/thinkode/appthinker/views/AboutWindow.java index 0b6ec57..d579f10 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/AboutWindow.java +++ b/AppThinker/src/com/thinkode/appthinker/views/AboutWindow.java @@ -20,7 +20,12 @@ public class AboutWindow extends JDialog { * Constructeur - Crée une fenêtre A propos */ public AboutWindow() { + } + /** + * Charge les informations dans la fenêtre + */ + public void initializeGraphics() { //Paramétrage de la fenêtre this.setTitle("AppThinker"); this.setModal(true); @@ -107,6 +112,7 @@ public class AboutWindow extends JDialog { donation.setBounds(320, 275, 250, 20); this.getContentPane().add(panel); + this.setVisible(true); } /** diff --git a/AppThinker/src/com/thinkode/appthinker/views/ArgumentsPropertiesWindow.java b/AppThinker/src/com/thinkode/appthinker/views/ArgumentsPropertiesWindow.java index 8d63ce4..dfdabc0 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/ArgumentsPropertiesWindow.java +++ b/AppThinker/src/com/thinkode/appthinker/views/ArgumentsPropertiesWindow.java @@ -28,13 +28,24 @@ public class ArgumentsPropertiesWindow extends JDialog { private String[] _argumentsColumns = {"Name", "Type"}; private DefaultTableModel _argumentModel; + /** + * Constructeur de ArgumentsPropertiesWindow + */ public ArgumentsPropertiesWindow() { } + /** + * Lie la vue à un contrôleur. + * + * @param argumentsPropertiesController La classe contrôleur + */ public void setController(ArgumentsPropertiesController argumentsPropertiesController) { _argumentsPropertiesController = argumentsPropertiesController; } + /** + * Charge les informations dans la fenêtre + */ public void initializeGraphics() { //Paramétrage de la fenêtre this.setTitle("Edit arguments - " + _argumentsPropertiesController.getMethodName()); @@ -160,6 +171,8 @@ public class ArgumentsPropertiesWindow extends JDialog { /** * Sélectionne une ligne du tableau d'arguments + * + * @param index L'index de la ligne à sélectionner */ public void selectArgument(int 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 + * + * @param arguments La liste des arguments. */ public void listArguments(java.util.List arguments) { //Import des attributs dans la table diff --git a/AppThinker/src/com/thinkode/appthinker/views/ChangelogWindow.java b/AppThinker/src/com/thinkode/appthinker/views/ChangelogWindow.java index 4da8b7d..26fb86b 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/ChangelogWindow.java +++ b/AppThinker/src/com/thinkode/appthinker/views/ChangelogWindow.java @@ -17,6 +17,9 @@ public class ChangelogWindow extends JDialog { private ChangelogWindowController _atChangelogWindowController; private JPanel _panel; + /** + * Constructeur de ChangelogWindow + */ public ChangelogWindow() { //Paramétrage de la fenêtre Image img = null; @@ -24,20 +27,28 @@ public class ChangelogWindow extends JDialog { img = ImageIO.read(AppThinker.class.getResource("img/logoAppThinker.png")); } catch (Exception ex) { } + this.setModal(true); this.setIconImage(img); this.setResizable(false); - this.setLocationRelativeTo(null); this.setLayout(new BorderLayout()); - this.setModal(true); 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 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() { @Override protected void paintComponent(Graphics g) { @@ -51,15 +62,15 @@ public class ChangelogWindow extends JDialog { } catch (Exception ex) { } g2.drawImage(img, 0, 20, 300, 300, this); - /*Informations du logiciel*/ + //Informations du logiciel/ g2.setColor(new Color(63, 169, 245)); g2.setFont(new Font("Arial", Font.BOLD, 40)); g2.drawString("Thanks for downloading AppThinker !", 50, 45); 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)); int i = 140; - for (String a : changelog) { + for (String a : _atChangelogWindowController.getChangelog()) { g2.drawString("> " + a, 305, i); i += 25; } @@ -75,7 +86,9 @@ public class ChangelogWindow extends JDialog { _panel.add(ideas); ideas.setBounds(305, 90, 250, 20); _panel.setLayout(null); - this.getContentPane().add(_panel); + _panel.repaint(); + this.revalidate(); + this.setVisible(true); } } diff --git a/AppThinker/src/com/thinkode/appthinker/views/ClassPropertiesWindow.java b/AppThinker/src/com/thinkode/appthinker/views/ClassPropertiesWindow.java index 68c6f1d..3ec97a6 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/ClassPropertiesWindow.java +++ b/AppThinker/src/com/thinkode/appthinker/views/ClassPropertiesWindow.java @@ -41,6 +41,9 @@ public class ClassPropertiesWindow extends JDialog { public ClassPropertiesWindow() { } + /** + * Charge les informations dans la fenêtre + */ public void initializeGraphics() { //Paramétrage de la fenêtre this.setTitle("Edit properties - " + _classPropertiesController.getClassName()); @@ -265,12 +268,19 @@ public class ClassPropertiesWindow extends JDialog { this.setVisible(true); } + /** + * Lie la vue à un contrôleur + * + * @param classPropertiesController La classe contrôleur + */ public void setController(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) { _attributesTable.setRowSelectionInterval(index, index); @@ -278,6 +288,8 @@ public class ClassPropertiesWindow extends JDialog { /** * Sélectionne une ligne dans le tableau des méthodes + * + * @param index L'index de la ligne à sélectionner */ public void selectMethod(int 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 + * + * @param attributes La liste des attributs */ public void listAttributes(java.util.List attributes) { //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. + * + * @param methods La liste des méthodes */ public void listMethods(java.util.List methods) { //Import des méthodes dans la table diff --git a/AppThinker/src/com/thinkode/appthinker/views/CompositionFrame.java b/AppThinker/src/com/thinkode/appthinker/views/CompositionFrame.java index e40319f..0f7f6ad 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/CompositionFrame.java +++ b/AppThinker/src/com/thinkode/appthinker/views/CompositionFrame.java @@ -19,10 +19,18 @@ public class CompositionFrame extends JPanel implements MouseListener, MouseMoti public CompositionFrame() { } + /** + * Ajoute un CompositionListener à la vue + * + * @param atCompositionListener La classe d'écoute + */ public void addCompositionListener(CompositionListener atCompositionListener) { _atCompositionListener = atCompositionListener; } + /** + * Retire le CompositionListener + */ public void removeCompositionListener() { _atCompositionListener = null; } diff --git a/AppThinker/src/com/thinkode/appthinker/views/CompositionListener.java b/AppThinker/src/com/thinkode/appthinker/views/CompositionListener.java index 000e8f5..a282d17 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/CompositionListener.java +++ b/AppThinker/src/com/thinkode/appthinker/views/CompositionListener.java @@ -9,16 +9,6 @@ public interface CompositionListener { */ 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 */ diff --git a/AppThinker/src/com/thinkode/appthinker/views/CompositionWidget.java b/AppThinker/src/com/thinkode/appthinker/views/CompositionWidget.java index fc65254..67c9d33 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/CompositionWidget.java +++ b/AppThinker/src/com/thinkode/appthinker/views/CompositionWidget.java @@ -14,19 +14,23 @@ public class CompositionWidget extends JTabbedPane implements CompositionListene private ArrayList _projectPans; private CompositionWidgetListener _listener; + /** + * Constructeur de CompositionWidget + */ public CompositionWidget() { _titlePans = new ArrayList(); _projectPans = new ArrayList(); } + /** + * Ajoute un écouteur d'évenement + * + * @param listener La classe d'écoute + */ public void addCompositionWidgetListener(CompositionWidgetListener listener) { _listener = listener; } - public void removeCompositionWidgetListener() { - _listener = null; - } - /** * 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 * - * @param title - * @param project - * @return + * @param title Le titre de la composition + * @param project Le nom du projet + * @return L'index de l'occurence, -1 si introuvable */ private int checkIfExist(String title, String project) { 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 * - * @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) { 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. - * - * @return */ private void optimizeNames() { for (String title : _titlePans) { @@ -119,8 +123,9 @@ public class CompositionWidget extends JTabbedPane implements CompositionListene /** * Met à jour le titre de la composition modifiée * - * @param projectName - * @param newName + * @param projectName Le nom du projet + * @param oldName L'ancien nom + * @param newName Le nouveau nom */ public void updateCompositionTitle(String projectName, String oldName, String newName) { for (int i = 0; i < this.getTabCount(); i++) { @@ -132,6 +137,9 @@ public class CompositionWidget extends JTabbedPane implements CompositionListene /** * 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) { for (int i = 0; i < this.getTabCount(); i++) { @@ -144,6 +152,11 @@ public class CompositionWidget extends JTabbedPane implements CompositionListene optimizeNames(); } + /** + * Supprime une vue de composition dans les onglets + * + * @param index L'index de la vue de composition à supprimer + */ public void deleteCompositionFrame(int index) { _titlePans.remove(index); _projectPans.remove(index); @@ -152,21 +165,20 @@ public class CompositionWidget extends JTabbedPane implements CompositionListene } //Evenements de la composition + + /** + * Affiche un message dans la barre de statut + * + * @param status Le message à afficher + */ @Override public void statusEmitted(String status) { - /*setStatusMessage(status);*/ - } - - @Override - public void mousePositionUpdated(int mouseX, int mouseY) { - /*setPositionLabel(mouseX, mouseY);*/ - } - - @Override - public void elementSizeUpdated(int sizeX, int sizeY) { - /*setSizeLabel(sizeX, sizeY);*/ + _listener.statusEmitted(status); } + /** + * Commande le rafraîchissement du Workspace + */ @java.lang.Override public void refreshWorkspaceNeeded() { _listener.refreshWorkspaceNeeded(); diff --git a/AppThinker/src/com/thinkode/appthinker/views/CompositionWidgetListener.java b/AppThinker/src/com/thinkode/appthinker/views/CompositionWidgetListener.java index 31c92b5..7c6ac1c 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/CompositionWidgetListener.java +++ b/AppThinker/src/com/thinkode/appthinker/views/CompositionWidgetListener.java @@ -5,4 +5,11 @@ public interface CompositionWidgetListener { * Demande le rafraîchissement du Workspace */ void refreshWorkspaceNeeded(); + + /** + * Affiche un message dans la barre de statut + * + * @param message Le message à afficher + */ + void statusEmitted(String message); } diff --git a/AppThinker/src/com/thinkode/appthinker/views/HomeFrame.java b/AppThinker/src/com/thinkode/appthinker/views/HomeFrame.java index deec095..e78f373 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/HomeFrame.java +++ b/AppThinker/src/com/thinkode/appthinker/views/HomeFrame.java @@ -20,6 +20,9 @@ public class HomeFrame extends CompositionFrame { private JPanel _makeDonation; private JCheckBox _dontShow; + /** + * Constructeur de HomeFrameController + */ public HomeFrame() { this.setBackground(new Color(63, 169, 245)); this.setLayout(new BorderLayout()); @@ -74,7 +77,7 @@ public class HomeFrame extends CompositionFrame { //--Bouton nouveau projet _newBlankProject = new JPanel(); _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); JLabel newProjectLabel = new JLabel("Create a blank project"); _newBlankProject.setToolTipText("Create a new project without composition"); @@ -84,7 +87,7 @@ public class HomeFrame extends CompositionFrame { //--Bouton nouveau projet UML _newUmlProject = new JPanel(); _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); JLabel newUmlProjectLabel = new JLabel("Create a UML project"); _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); } + /** + * Lie la vue au contrôleur + * + * @param homeFrameController La classe contrôleur + */ public void setController(HomeFrameController homeFrameController) { _homeFrameController = homeFrameController; _dontShow.setSelected(!_homeFrameController.isHomeAtStartup()); } //Evenements souris + + /** + * Gestion des clics sur les boutons + * + * @param e L'Evenement souris + */ @Override public void mouseClicked(MouseEvent e) { 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 public void mouseEntered(MouseEvent e) { 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 public void mouseExited(MouseEvent e) { Object obj = e.getSource(); diff --git a/AppThinker/src/com/thinkode/appthinker/views/LinkPropertiesWindow.java b/AppThinker/src/com/thinkode/appthinker/views/LinkPropertiesWindow.java index 8a506c1..fb82bed 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/LinkPropertiesWindow.java +++ b/AppThinker/src/com/thinkode/appthinker/views/LinkPropertiesWindow.java @@ -46,6 +46,9 @@ public class LinkPropertiesWindow extends JDialog { public LinkPropertiesWindow() { } + /** + * Charge les informations dans la fenêtre + */ public void initializeGraphics() { //Paramétrage de la fenêtre this.setTitle("Edit properties - " + _linkPropertiesController.getLinkName()); @@ -106,6 +109,11 @@ public class LinkPropertiesWindow extends JDialog { this.setVisible(true); } + /** + * Lie la vue à un contrôleur + * + * @param linkPropertiesController La classe contrôleur + */ public void setController(LinkPropertiesController linkPropertiesController) { _linkPropertiesController = linkPropertiesController; } diff --git a/AppThinker/src/com/thinkode/appthinker/views/MenuBar.java b/AppThinker/src/com/thinkode/appthinker/views/MenuBar.java index 1425bd7..3fcecba 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/MenuBar.java +++ b/AppThinker/src/com/thinkode/appthinker/views/MenuBar.java @@ -32,7 +32,7 @@ public class MenuBar extends JMenuBar { private MenuBarListener _menuBarListener; /** - * Constructeur de la classe ATMenuBar + * Constructeur de la classe MenuBar */ public MenuBar() { //Création de la barre menu @@ -83,6 +83,7 @@ public class MenuBar extends JMenuBar { _appMenu = new JMenu("AppThinker"); _appSettings = new JMenuItem("Settings"); + _appSettings.setEnabled(false); _appSettings.setIcon(new ImageIcon(AppThinker.class.getResource("img/x16/settings.png"))); _appMenu.add(_appSettings); _appInfo = new JMenuItem("About AppThinker"); @@ -107,12 +108,12 @@ public class MenuBar extends JMenuBar { this.add(_appMenu); } + /** + * Ajoute un écouteur d'événement + * + * @param listener La classe écouteur + */ public void addMenuBarListener(MenuBarListener listener) { _menuBarListener = listener; } - - public void removeMenuBarLister() { - _menuBarListener = null; - } - } diff --git a/AppThinker/src/com/thinkode/appthinker/views/Statusbar.java b/AppThinker/src/com/thinkode/appthinker/views/Statusbar.java index 7538c40..f772bec 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/Statusbar.java +++ b/AppThinker/src/com/thinkode/appthinker/views/Statusbar.java @@ -12,39 +12,20 @@ import java.awt.*; public class Statusbar extends JPanel { 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() { //Création de la statusBar this.setBorder(new BevelBorder(BevelBorder.LOWERED)); this.setLayout(new GridLayout(1, 3)); - - _statusLabel = new JLabel("Create or import a project to start."); + _statusLabel = new JLabel(); + _statusLabel.setForeground(Color.WHITE); this.add(_statusLabel); - - JPanel actionBar = new JPanel(); - - _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); + this.setBackground(Color.GRAY); + this.setBorder(null); + setStatusMessage("Create or import a project to start"); } /** @@ -53,37 +34,6 @@ public class Statusbar extends JPanel { * @param statusMessage Le message à afficher. */ public void setStatusMessage(String 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))); + this._statusLabel.setText(" " + statusMessage); } } diff --git a/AppThinker/src/com/thinkode/appthinker/views/UmlDiagramFrame.java b/AppThinker/src/com/thinkode/appthinker/views/UmlDiagramFrame.java index c8e1f7e..520d643 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/UmlDiagramFrame.java +++ b/AppThinker/src/com/thinkode/appthinker/views/UmlDiagramFrame.java @@ -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 if (_selected instanceof Class) { Class a = (Class) _selected; - _atCompositionListener.elementSizeUpdated(a.getSizeX(), a.getSizeY()); _shiftX = getX - a.getPosX(); _shiftY = getY - a.getPosY(); } @@ -585,7 +584,6 @@ public class UmlDiagramFrame extends CompositionFrame implements UmlToolbarListe @Override public void mouseDragged(MouseEvent e) { //Mise à jour des coordonnées de la souris dans la statusbar - _atCompositionListener.mousePositionUpdated(e.getX(), e.getY()); int posX = e.getX(); int posY = e.getY(); if (_selected instanceof Class) { @@ -623,7 +621,6 @@ public class UmlDiagramFrame extends CompositionFrame implements UmlToolbarListe _umlDiagramController.resizeLeft(a, posX); break; } - _atCompositionListener.elementSizeUpdated(a.getSizeX(), a.getSizeY()); } //Sinon on déplace else { @@ -679,19 +676,20 @@ public class UmlDiagramFrame extends CompositionFrame implements UmlToolbarListe public void mouseMoved(MouseEvent e) { int getX = e.getX(); 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 if (_selected instanceof Class) { 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); } } //Evenements de la UmlToolbar + + /** + * L'outil UML sélectionné a été modifié + * + * @param newTool Le nouvel outil sélectionné. + */ @Override public void toolChanged(UmlToolbar.UmlTool newTool) { //Changement du curseur du diagramme UML @@ -711,6 +709,11 @@ public class UmlDiagramFrame extends CompositionFrame implements UmlToolbarListe else this.setViewGripsEnabled(false); } + /** + * Affiche la description de l'outil UML + * + * @param description La description de l'outil sélectionné + */ @Override public void showToolDescription(String description) { _atCompositionListener.statusEmitted(description); diff --git a/AppThinker/src/com/thinkode/appthinker/views/UmlToolbar.java b/AppThinker/src/com/thinkode/appthinker/views/UmlToolbar.java index 7e2a238..d63c880 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/UmlToolbar.java +++ b/AppThinker/src/com/thinkode/appthinker/views/UmlToolbar.java @@ -246,14 +246,15 @@ public class UmlToolbar extends JPanel { this.setEnabled(false); } + /** + * Ajoute un écouteur d'événement + * + * @param atUmlToolbarListener La classe écouteur + */ public void addUmlToolbarListener(UmlToolbarListener atUmlToolbarListener) { _atUmlToolbarListener = atUmlToolbarListener; } - public void removeUmlToolbarListener() { - _atUmlToolbarListener = null; - } - /** * Récupère l'outil actuellement en fonction. * diff --git a/AppThinker/src/com/thinkode/appthinker/views/Window.java b/AppThinker/src/com/thinkode/appthinker/views/Window.java index 33690b4..bdb56d1 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/Window.java +++ b/AppThinker/src/com/thinkode/appthinker/views/Window.java @@ -68,6 +68,7 @@ public class Window extends JFrame implements MenuBarListener, WorkspaceListener _compositionWidget = new CompositionWidget(); _compositionWidget.addCompositionWidgetListener(this); 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 + * + * @param message Le message à afficher. */ public void showMessage(String 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) { 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) { _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 * - * @param projects + * @param projects La liste de projets */ public void refreshWorkspace(java.util.List 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 * - * @param project - * @param oldName - * @param newName + * @param project Le projet contenant la composition + * @param oldName L'ancien nom de la composition + * @param newName Le nouveau nom de la composition */ public void updateCompositionTitle(String project, String oldName, String newName) { _compositionWidget.updateCompositionTitle(project, oldName, newName); @@ -172,106 +177,210 @@ public class Window extends JFrame implements MenuBarListener, WorkspaceListener /** * 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) { _compositionWidget.deleteCompositionFrame(project, composition); } //Evenements du Workspace + + /** + * Page d'accueil cliquée + */ @Override public void homePageClicked() { _mainWindowController.showHomeFrame(); } + /** + * Ajout d'une composition UML + * + * @param projectListId Le numéro de projet + */ @Override public void addUmlComposition(int projectListId) { _mainWindowController.addUmlComposition(projectListId); } + /** + * Retourne le nom du projet + * + * @param projectListId Le numéro du projet + * @return Le nom du projet + */ @Override public String askForProjectName(int 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 public boolean askForProjectSaved(Project project) { return _mainWindowController.askForProjectSaved(project); } + /** + * Renomme le projet + * + * @param projectListId Le numéro de projet concerné + * @param newName Le nouveau nom + */ @Override public void renameProject(int projectListId, String newName) { _mainWindowController.renameProject(projectListId, newName); } + /** + * Sauvegarde du projet + * + * @param projectListId Le numéro du projet concerné + */ @Override public void saveProjectClicked(int projectListId) { _mainWindowController.saveProject(projectListId); } + /** + * Sauvegarde du projet sous... + * + * @param projectListId Le numéro du projet concerné + */ @Override public void saveAsProjectClicked(int projectListId) { _mainWindowController.saveAsProject(projectListId); } + /** + * Suppression du projet + * + * @param projectListId Le numéro du projet concerné + */ @Override public void deleteProject(int 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 public String askForCompositionName(int projectListId, int 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 public void renameComposition(int projectListId, int compositionListId, String 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 public void deleteComposition(int projectListId, int compositionListId) { _mainWindowController.deleteComposition(projectListId, compositionListId); } //Evènements de la barre de menu (MenuBarListener) + + /** + * Bouton Nouveau projet cliqué + */ @Override public void newBlankProjectClicked() { _mainWindowController.newBlankProject(); } + /** + * Double-clic sur une composition + * + * @param projectListId Le numéro de projet + * @param compositionListId Le numéro de composition + */ @Override public void compositionDoubleClick(int projectListId, int compositionListId) { _mainWindowController.openComposition(projectListId, compositionListId); } + /** + * Bouton nouveau projet cliqué + */ @Override public void newUmlProjectClicked() { _mainWindowController.newUmlProject(); } + /** + * Bouton Ouvrir projet cliqué + */ @Override public void openProjectClicked() { openProject(); } + /** + * Demande de la fermeture de la fenêtre + */ @Override public void quitClicked() { if (_mainWindowController.askForExit()) System.exit(0); } + /** + * Clic sur le bouton A Propos + */ @Override public void aboutAppThinkerClicked() { _mainWindowController.launchAboutWindow(); } + /** + * Clic sur le bouton de mise à jour + */ @Override public void checkUpdatesClicked() { _mainWindowController.checkForUpdates(); } //Evenement du CompositionWidget + + /** + * Demande la mise à jour du Workspace + */ @java.lang.Override public void refreshWorkspaceNeeded() { _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); + } } diff --git a/AppThinker/src/com/thinkode/appthinker/views/Workspace.java b/AppThinker/src/com/thinkode/appthinker/views/Workspace.java index c206a80..95b7ed2 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/Workspace.java +++ b/AppThinker/src/com/thinkode/appthinker/views/Workspace.java @@ -33,6 +33,9 @@ public class Workspace extends JPanel implements ActionListener, MouseListener, private JMenuItem _renameComposition; private JMenuItem _deleteComposition; + /** + * Constructeur de Workspace + */ public Workspace() { this.setLayout(new BorderLayout()); this.setPreferredSize(new Dimension(300, 10000)); @@ -51,6 +54,10 @@ public class Workspace extends JPanel implements ActionListener, MouseListener, _homePage.addMouseListener(this); _actionPanel.add(_homePage, BorderLayout.WEST); + JLabel workspace = new JLabel("Workspace"); + workspace.setHorizontalAlignment(JLabel.CENTER); + _actionPanel.add(workspace, BorderLayout.CENTER); + _newProject = new JPanel(); _newProject.setBackground(new Color(238, 238, 238)); _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 + * + * @param La liste de projets */ public void refreshTree(java.util.List projects) { //Suppression de la scrollbar @@ -186,15 +195,23 @@ public class Workspace extends JPanel implements ActionListener, MouseListener, } //Evenements du Workspace + + /** + * Ajoute un écouteur d'événement + * + * @param listener La classe écouteur + */ public void addWorkspaceListener(WorkspaceListener listener) { _listener = listener; } - public void removeWorkspaceListener() { - _listener = null; - } - //Evenements souris + + /** + * Gestion des clics sur les boutons + * + * @param e L'événement souris + */ @Override public void mouseClicked(MouseEvent e) { 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 public void mouseEntered(MouseEvent e) { Object obj = e.getSource(); if (obj instanceof JPanel) { 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 public void mouseExited(MouseEvent e) { Object obj = e.getSource(); if (obj instanceof JPanel) { 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 + + /** + * Gestion des clics sur le menu contextuel + * + * @param e L'événement souris + */ @Override public void actionPerformed(ActionEvent e) { Object obj = e.getSource(); diff --git a/AppThinker/src/com/thinkode/appthinker/views/WorkspaceListener.java b/AppThinker/src/com/thinkode/appthinker/views/WorkspaceListener.java index 61aef44..633c53b 100644 --- a/AppThinker/src/com/thinkode/appthinker/views/WorkspaceListener.java +++ b/AppThinker/src/com/thinkode/appthinker/views/WorkspaceListener.java @@ -16,56 +16,84 @@ public interface WorkspaceListener { /** * Ouverture d'une composition + * + * @param projectListId Le numéro de projet + * @param compositionListId Le numéro de composition */ void compositionDoubleClick(int projectListId, int compositionListId); /** * Ajoute une composition UML à un projet + * + * @param projectListId Le numéro de projet */ void addUmlComposition(int projectListId); /** * Demande le nom du projet sélectionné dans le Workspace + * + * @param projectListId Le numéro de projet */ String askForProjectName(int projectListId); /** * Demande si le projet doit être sauvegardé ou non + * + * @param project Le projet concerné */ boolean askForProjectSaved(Project project); - + /** * Renomme le projet sélectionné + * + * @param projectListId Le numéro de projet + * @param newName Le nouveau nom */ void renameProject(int projectListId, String newName); /** * Sauvegarde le projet + * + * @param projectListId Le numéro de projet */ void saveProjectClicked(int projectListId); /** * Sauvegarde le projet sous + * + * @param projectListId Le numéro de projet */ void saveAsProjectClicked(int projectListId); /** * Supprime un projet via le menu contextuel Projet + * + * @param projectListId Le numéro de projet */ void deleteProject(int projectListId); /** * 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); /** * 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); /** * 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); }