@@ -1,4 +1,6 @@
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* La classe principale du logiciel AppThinker.
|
* La classe principale du logiciel AppThinker.
|
||||||
* @author V.BOULANGER
|
* @author V.BOULANGER
|
||||||
@@ -6,12 +8,78 @@ import javax.swing.*;
|
|||||||
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
|
||||||
|
|
||||||
|
private static Project _project;
|
||||||
|
private static AppThinkerWindow _window;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* La méthode principale exécutée
|
* La méthode principale exécutée
|
||||||
* @param args Les arguments de la méthode principale.
|
* @param args Les arguments de la méthode principale.
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
AppThinkerWindow window = new AppThinkerWindow();
|
_window = new AppThinkerWindow();
|
||||||
window.setVisible(true);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récupère la fenêtre de l'application
|
||||||
|
* @return La fenêtre de l'application.
|
||||||
|
*/
|
||||||
|
public static AppThinkerWindow getWindow(){
|
||||||
|
return _window;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Crée un nouveau Projet.
|
||||||
|
*/
|
||||||
|
public static void newProject(){
|
||||||
|
_project = new Project();
|
||||||
|
_window.setTitle("AppThinker | " + _project.getName());
|
||||||
|
_window.getMenubar().enableEditing();
|
||||||
|
_window.getToolbar().enableEditing();
|
||||||
|
_window.getStatusbar().setStatusMessage("Le projet a été créé.");
|
||||||
|
_window.getStatusbar().setFileMessage(_project.getName());
|
||||||
|
_window.setGrid(_project.getGrid());
|
||||||
|
AppThinker.getProject().getGrid().getDiagram().displayDiagram();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ouvre un projet existant dans la fenêtre.
|
||||||
|
*/
|
||||||
|
public static void openProject(){
|
||||||
|
//_window.getGrid().repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sauvegarde le projet en cours.
|
||||||
|
*/
|
||||||
|
public static void saveProject(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sauvegarde le projet en cours à un autre emplacement.
|
||||||
|
*/
|
||||||
|
public static void saveAsProject(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ferme le projet en cours.
|
||||||
|
*/
|
||||||
|
public static void closeProject(){
|
||||||
|
_window.setTitle("AppThinker");
|
||||||
|
_window.getMenubar().disableEditing();
|
||||||
|
_window.getToolbar().disableEditing();
|
||||||
|
_window.getStatusbar().setStatusMessage("Le projet a été fermé.");
|
||||||
|
_window.getStatusbar().setFileMessage("Aucun projet ouvert");
|
||||||
|
_window.remove(_project.getGrid());
|
||||||
|
_project = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récupère le projet en cours.
|
||||||
|
* @return Le projet en cours.
|
||||||
|
*/
|
||||||
|
public static Project getProject(){
|
||||||
|
return _project;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,44 +2,40 @@ import javax.swing.*;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Affiche une grille pour l'affichage du projet.
|
* Affiche une grille de projet pour l'affichage du diagramme.
|
||||||
* @author V.BOULANGER
|
* @author V.BOULANGER
|
||||||
*/
|
*/
|
||||||
public class AppThinkerGrid extends JPanel {
|
public class AppThinkerGrid extends JPanel {
|
||||||
|
|
||||||
|
private Project _project;
|
||||||
|
private UmlDiagram _umlDiagram;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur de la classe AppThinkerGrid
|
* Constructeur de la classe AppThinkerGrid.
|
||||||
|
* @param project Le projet associé.
|
||||||
*/
|
*/
|
||||||
public AppThinkerGrid(){
|
public AppThinkerGrid(Project project){
|
||||||
|
this._project = project;
|
||||||
this.setBackground(new Color(192, 192, 192));
|
this.setBackground(new Color(192, 192, 192));
|
||||||
|
this._umlDiagram = new UmlDiagram(_project);
|
||||||
|
|
||||||
|
_umlDiagram.setPreferredSize(new Dimension(30000,30000));
|
||||||
|
|
||||||
|
this.setLayout(new BorderLayout());
|
||||||
|
|
||||||
|
JScrollPane scrollPane = new JScrollPane(_umlDiagram);
|
||||||
|
scrollPane.setVisible(true);
|
||||||
|
scrollPane.setBackground(new Color(60, 158, 163));
|
||||||
|
|
||||||
|
this.add(scrollPane, BorderLayout.CENTER);
|
||||||
|
this._umlDiagram.displayDiagram();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Affiche les éléments du projet dans la grille.
|
* Récupère le diagramme de la grille.
|
||||||
* @param project Projet à afficher.
|
* @return Le diagramme de la grille.
|
||||||
*/
|
*/
|
||||||
public void displayProject(Project project){
|
public UmlDiagram getDiagram(){
|
||||||
|
return _umlDiagram;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Détruit tous les éléments de la grille.
|
|
||||||
*/
|
|
||||||
public void cleanProject(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Applique un zoom sur la grille.
|
|
||||||
* @param percent Pourcentage du zoom (1 - 500).
|
|
||||||
*/
|
|
||||||
public void zoom(int percent){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rafraîchit les modifications sur la grille.
|
|
||||||
*/
|
|
||||||
public void refresh(){
|
|
||||||
this.updateUI();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,14 +35,10 @@ public class AppThinkerMenuBar extends JMenuBar {
|
|||||||
|
|
||||||
private AppThinkerWindow _window;
|
private AppThinkerWindow _window;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur de la classe AppThinkerMenuBar
|
* Constructeur de la classe AppThinkerMenuBar
|
||||||
* @param window Une instance de AppThinkerWindow.
|
|
||||||
*/
|
*/
|
||||||
public AppThinkerMenuBar(AppThinkerWindow window){
|
public AppThinkerMenuBar(){
|
||||||
this._window = window;
|
|
||||||
|
|
||||||
//Création de la barre menu
|
//Création de la barre menu
|
||||||
_fileMenu = new JMenu("Fichier");
|
_fileMenu = new JMenu("Fichier");
|
||||||
_fileMenu.setMnemonic( 'F' );
|
_fileMenu.setMnemonic( 'F' );
|
||||||
@@ -52,7 +48,7 @@ public class AppThinkerMenuBar extends JMenuBar {
|
|||||||
_newProject.addActionListener(new ActionListener() {
|
_newProject.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
_window.newProject();
|
AppThinker.newProject();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_fileMenu.add(_newProject);
|
_fileMenu.add(_newProject);
|
||||||
@@ -61,7 +57,7 @@ public class AppThinkerMenuBar extends JMenuBar {
|
|||||||
_openProject.addActionListener(new ActionListener() {
|
_openProject.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
_window.openProject();
|
AppThinker.openProject();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_fileMenu.add(_openProject);
|
_fileMenu.add(_openProject);
|
||||||
@@ -70,7 +66,7 @@ public class AppThinkerMenuBar extends JMenuBar {
|
|||||||
_saveProject.addActionListener(new ActionListener() {
|
_saveProject.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
_window.saveProject();
|
AppThinker.saveProject();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_fileMenu.add(_saveProject);
|
_fileMenu.add(_saveProject);
|
||||||
@@ -79,7 +75,7 @@ public class AppThinkerMenuBar extends JMenuBar {
|
|||||||
_saveAsProject.addActionListener(new ActionListener() {
|
_saveAsProject.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
_window.saveAsProject();
|
AppThinker.saveAsProject();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_fileMenu.add(_saveAsProject);
|
_fileMenu.add(_saveAsProject);
|
||||||
@@ -88,7 +84,7 @@ public class AppThinkerMenuBar extends JMenuBar {
|
|||||||
_closeProject.addActionListener(new ActionListener() {
|
_closeProject.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
_window.closeProject();
|
AppThinker.closeProject();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_fileMenu.add(_closeProject);
|
_fileMenu.add(_closeProject);
|
||||||
@@ -112,7 +108,7 @@ public class AppThinkerMenuBar extends JMenuBar {
|
|||||||
_newClass.addActionListener(new ActionListener() {
|
_newClass.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
_window.getToolbar().changeTool(AppThinkerToolbar.CLASS_TOOL);
|
_window.getToolbar().setCurrentTool(AppThinkerToolbar.CLASS_TOOL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_projectMenu.add(_newClass);
|
_projectMenu.add(_newClass);
|
||||||
@@ -121,7 +117,7 @@ public class AppThinkerMenuBar extends JMenuBar {
|
|||||||
_newAssociation.addActionListener(new ActionListener() {
|
_newAssociation.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
_window.getToolbar().changeTool(AppThinkerToolbar.ASSOCIATION_TOOL);
|
_window.getToolbar().setCurrentTool(AppThinkerToolbar.ASSOCIATION_TOOL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_projectMenu.add(_newAssociation);
|
_projectMenu.add(_newAssociation);
|
||||||
@@ -130,7 +126,7 @@ public class AppThinkerMenuBar extends JMenuBar {
|
|||||||
_newLink.addActionListener(new ActionListener() {
|
_newLink.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
_window.getToolbar().changeTool(AppThinkerToolbar.LINK_TOOL);
|
_window.getToolbar().setCurrentTool(AppThinkerToolbar.LINK_TOOL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_projectMenu.add(_newLink);
|
_projectMenu.add(_newLink);
|
||||||
@@ -139,7 +135,7 @@ public class AppThinkerMenuBar extends JMenuBar {
|
|||||||
_selectElement.addActionListener(new ActionListener() {
|
_selectElement.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
_window.getToolbar().changeTool(AppThinkerToolbar.SELECT_TOOL);
|
_window.getToolbar().setCurrentTool(AppThinkerToolbar.SELECT_TOOL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_projectMenu.add(_selectElement);
|
_projectMenu.add(_selectElement);
|
||||||
@@ -148,7 +144,7 @@ public class AppThinkerMenuBar extends JMenuBar {
|
|||||||
_editElement.addActionListener(new ActionListener() {
|
_editElement.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
_window.getToolbar().changeTool(AppThinkerToolbar.EDIT_TOOL);
|
_window.getToolbar().setCurrentTool(AppThinkerToolbar.EDIT_TOOL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_projectMenu.add(_editElement);
|
_projectMenu.add(_editElement);
|
||||||
@@ -157,7 +153,7 @@ public class AppThinkerMenuBar extends JMenuBar {
|
|||||||
_deleteElement.addActionListener(new ActionListener() {
|
_deleteElement.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
_window.getToolbar().changeTool(AppThinkerToolbar.DELETE_TOOL);
|
_window.getToolbar().setCurrentTool(AppThinkerToolbar.DELETE_TOOL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_projectMenu.add(_deleteElement);
|
_projectMenu.add(_deleteElement);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class AppThinkerStatusbar extends JPanel {
|
|||||||
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("Prêt.");
|
_statusLabel = new JLabel("Créez ou importez un projet pour commencer.");
|
||||||
this.add(_statusLabel);
|
this.add(_statusLabel);
|
||||||
|
|
||||||
JPanel actionBar = new JPanel();
|
JPanel actionBar = new JPanel();
|
||||||
@@ -46,34 +46,18 @@ public class AppThinkerStatusbar extends JPanel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Met à jour le texte de statut de la barre de statut.
|
* Met à jour le texte de statut de la barre de statut.
|
||||||
* @param msg Le message à afficher.
|
* @param statusMessage Le message à afficher.
|
||||||
*/
|
*/
|
||||||
public void setStatusMessage(String msg){
|
public void setStatusMessage(String statusMessage){
|
||||||
this._statusLabel.setText(msg);
|
this._statusLabel.setText(statusMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Met à jour le nom du fichier dans la barre de statut.
|
* Met à jour le nom du fichier dans la barre de statut.
|
||||||
* @param file Le nom du fichier à afficher.
|
* @param fileMessage Le nom du fichier à afficher.
|
||||||
*/
|
*/
|
||||||
public void setFileMessage(String file){
|
public void setFileMessage(String fileMessage){
|
||||||
this._fileLabel.setText(file);
|
this._fileLabel.setText(fileMessage);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Met à jour le label de position X.
|
|
||||||
* @param posX La position X.
|
|
||||||
*/
|
|
||||||
public void setPosXLabel(int posX){
|
|
||||||
this._posXLabel.setText(Integer.toString(posX));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Met à jour le label de position Y.
|
|
||||||
* @param posY La position Y.
|
|
||||||
*/
|
|
||||||
public void setPosYLabel(int posY){
|
|
||||||
this._posYLabel.setText(Integer.toString(posY));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,24 +66,8 @@ public class AppThinkerStatusbar extends JPanel {
|
|||||||
* @param posY La position Y.
|
* @param posY La position Y.
|
||||||
*/
|
*/
|
||||||
public void setPosLabel(int posX, int posY){
|
public void setPosLabel(int posX, int posY){
|
||||||
this._posXLabel.setText(Integer.toString(posX));
|
this._posXLabel.setText("X : " + Integer.toString(posX) + " |");
|
||||||
this._posYLabel.setText(Integer.toString(posY));
|
this._posYLabel.setText("Y : " + Integer.toString(posY) + " |");
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Met à jour le label de taille X.
|
|
||||||
* @param sizeX La taille X.
|
|
||||||
*/
|
|
||||||
public void setSizeXLabel(int sizeX){
|
|
||||||
this._sizeXLabel.setText(Integer.toString(sizeX));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Met à jour le label de taille Y.
|
|
||||||
* @param sizeY La taille Y.
|
|
||||||
*/
|
|
||||||
public void setSizeYLabel(int sizeY){
|
|
||||||
this._sizeYLabel.setText(Integer.toString(sizeY));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,9 +76,7 @@ public class AppThinkerStatusbar extends JPanel {
|
|||||||
* @param sizeY La taille Y.
|
* @param sizeY La taille Y.
|
||||||
*/
|
*/
|
||||||
public void setSizeLabel(int sizeX, int sizeY){
|
public void setSizeLabel(int sizeX, int sizeY){
|
||||||
this._sizeXLabel.setText(Integer.toString(sizeX));
|
this._sizeXLabel.setText("SX : " + Integer.toString(sizeX));
|
||||||
this._sizeYLabel.setText(Integer.toString(sizeY));
|
this._sizeYLabel.setText("SY : " + Integer.toString(sizeY));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,10 +44,8 @@ public class AppThinkerToolbar extends JPanel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur de la classe AppThinkerToolbar
|
* Constructeur de la classe AppThinkerToolbar
|
||||||
* @param window Une instance de AppThinkerWindow.
|
|
||||||
*/
|
*/
|
||||||
public AppThinkerToolbar(AppThinkerWindow window){
|
public AppThinkerToolbar(){
|
||||||
this._window = window;
|
|
||||||
//Création de la Toolbar
|
//Création de la Toolbar
|
||||||
this.setLayout(new GridLayout(2,3, 10, 0));
|
this.setLayout(new GridLayout(2,3, 10, 0));
|
||||||
this.setBackground(new Color(69, 69, 72));
|
this.setBackground(new Color(69, 69, 72));
|
||||||
@@ -63,7 +61,7 @@ public class AppThinkerToolbar extends JPanel {
|
|||||||
_newProject.addActionListener(new ActionListener() {
|
_newProject.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
_window.newProject();
|
AppThinker.newProject();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_projectPanel.add(_newProject);
|
_projectPanel.add(_newProject);
|
||||||
@@ -96,7 +94,7 @@ public class AppThinkerToolbar extends JPanel {
|
|||||||
_select.addActionListener(new ActionListener() {
|
_select.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
changeTool(AppThinkerToolbar.SELECT_TOOL);
|
setCurrentTool(AppThinkerToolbar.SELECT_TOOL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_editionPanel.add(_select);
|
_editionPanel.add(_select);
|
||||||
@@ -108,7 +106,7 @@ public class AppThinkerToolbar extends JPanel {
|
|||||||
_edit.addActionListener(new ActionListener() {
|
_edit.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
changeTool(AppThinkerToolbar.EDIT_TOOL);
|
setCurrentTool(AppThinkerToolbar.EDIT_TOOL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_editionPanel.add(_edit);
|
_editionPanel.add(_edit);
|
||||||
@@ -120,7 +118,7 @@ public class AppThinkerToolbar extends JPanel {
|
|||||||
_delete.addActionListener(new ActionListener() {
|
_delete.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
changeTool(AppThinkerToolbar.DELETE_TOOL);
|
setCurrentTool(AppThinkerToolbar.DELETE_TOOL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_editionPanel.add(_delete);
|
_editionPanel.add(_delete);
|
||||||
@@ -132,7 +130,7 @@ public class AppThinkerToolbar extends JPanel {
|
|||||||
_copy.addActionListener(new ActionListener() {
|
_copy.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
changeTool(AppThinkerToolbar.COPY_TOOL);
|
setCurrentTool(AppThinkerToolbar.COPY_TOOL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_editionPanel.add(_copy);
|
_editionPanel.add(_copy);
|
||||||
@@ -144,7 +142,7 @@ public class AppThinkerToolbar extends JPanel {
|
|||||||
_paste.addActionListener(new ActionListener() {
|
_paste.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
changeTool(AppThinkerToolbar.PASTE_TOOL);
|
setCurrentTool(AppThinkerToolbar.PASTE_TOOL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_editionPanel.add(_paste);
|
_editionPanel.add(_paste);
|
||||||
@@ -171,7 +169,7 @@ public class AppThinkerToolbar extends JPanel {
|
|||||||
_newClass.addActionListener(new ActionListener() {
|
_newClass.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
changeTool(AppThinkerToolbar.CLASS_TOOL);
|
setCurrentTool(AppThinkerToolbar.CLASS_TOOL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_modelisationPanel.add(_newClass);
|
_modelisationPanel.add(_newClass);
|
||||||
@@ -183,7 +181,7 @@ public class AppThinkerToolbar extends JPanel {
|
|||||||
_newAssociation.addActionListener(new ActionListener() {
|
_newAssociation.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
changeTool(AppThinkerToolbar.ASSOCIATION_TOOL);
|
setCurrentTool(AppThinkerToolbar.ASSOCIATION_TOOL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_modelisationPanel.add(_newAssociation);
|
_modelisationPanel.add(_newAssociation);
|
||||||
@@ -195,7 +193,7 @@ public class AppThinkerToolbar extends JPanel {
|
|||||||
_newLink.addActionListener(new ActionListener() {
|
_newLink.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
changeTool(AppThinkerToolbar.LINK_TOOL);
|
setCurrentTool(AppThinkerToolbar.LINK_TOOL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_modelisationPanel.add(_newLink);
|
_modelisationPanel.add(_newLink);
|
||||||
@@ -222,7 +220,6 @@ public class AppThinkerToolbar extends JPanel {
|
|||||||
/**
|
/**
|
||||||
* Active les boutons d'édition lorsqu'un projet est ouvert
|
* Active les boutons d'édition lorsqu'un projet est ouvert
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void enableEditing(){
|
public void enableEditing(){
|
||||||
_newProject.setEnabled(true);
|
_newProject.setEnabled(true);
|
||||||
_openProject.setEnabled(true);
|
_openProject.setEnabled(true);
|
||||||
@@ -265,67 +262,50 @@ public class AppThinkerToolbar extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rafraîchit les composants de la barre d'outils.
|
* Récupère l'outil actuellement en fonction.
|
||||||
|
* @return L'outil actuellement en fonction.
|
||||||
*/
|
*/
|
||||||
public void refreshToolbar(){
|
public int getCurrentTool(){
|
||||||
this._projectPanel.updateUI();
|
return this._currentTool;
|
||||||
this._editionPanel.updateUI();
|
|
||||||
this._modelisationPanel.updateUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rafraîchit les composants du panel de projet.
|
|
||||||
*/
|
|
||||||
public void refreshProjectPanel(){
|
|
||||||
this._projectPanel.updateUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rafraîchit les composants du panel d'édition.
|
|
||||||
*/
|
|
||||||
public void refreshEditionPanel(){
|
|
||||||
this._editionPanel.updateUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rafraîchit les composants du panel de modélisation.
|
|
||||||
*/
|
|
||||||
public void refreshModelisationPanel(){
|
|
||||||
this._modelisationPanel.updateUI();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change d'outil pour l'édition du diagramme.
|
* Change d'outil pour l'édition du diagramme.
|
||||||
* @param tool L'outil cible.
|
* @param currentTool L'outil cible.
|
||||||
*/
|
*/
|
||||||
public void changeTool(int tool){
|
public void setCurrentTool(int currentTool){
|
||||||
this._currentTool = tool;
|
this._currentTool = currentTool;
|
||||||
if(this._currentTool == AppThinkerToolbar.SELECT_TOOL) this._window.getGrid().setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
if(this._currentTool == AppThinkerToolbar.SELECT_TOOL) AppThinker.getProject().getGrid().getDiagram().setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||||
else this._window.getGrid().setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
|
else AppThinker.getProject().getGrid().getDiagram().setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
|
||||||
switch(tool){
|
switch(currentTool){
|
||||||
case 1:
|
case 1:
|
||||||
_window.getStatusbar().setStatusMessage("Outil édition - Cliquez sur un élément pour l'éditer.");
|
AppThinker.getWindow().getStatusbar().setStatusMessage("Outil édition - Cliquez sur un élément pour l'éditer.");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
_window.getStatusbar().setStatusMessage("Outil suppression - Cliquez sur un élément pour le supprimer.");
|
Object a = AppThinker.getProject().getGrid().getDiagram().getSelected();
|
||||||
|
if(a instanceof Class){
|
||||||
|
AppThinker.getProject().getClasses().remove(a);
|
||||||
|
AppThinker.getProject().getGrid().getDiagram().displayDiagram();
|
||||||
|
}
|
||||||
|
AppThinker.getWindow().getStatusbar().setStatusMessage("Outil suppression - Cliquez sur un élément pour le supprimer.");
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
_window.getStatusbar().setStatusMessage("Outil copie - Cliquez sur un élément pour le copier.");
|
AppThinker.getWindow().getStatusbar().setStatusMessage("Outil copie - Cliquez sur un élément pour le copier.");
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
_window.getStatusbar().setStatusMessage("Outil coller - Cliquez à un endroit pour coller l'élément.");
|
AppThinker.getWindow().getStatusbar().setStatusMessage("Outil coller - Cliquez à un endroit pour coller l'élément.");
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
_window.getStatusbar().setStatusMessage("Outil classe - Cliquez à un endroit pour ajouter une classe.");
|
AppThinker.getWindow().getStatusbar().setStatusMessage("Outil classe - Cliquez à un endroit pour ajouter une classe.");
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
_window.getStatusbar().setStatusMessage("Outil association - Cliquez à un endroit pour ajouter une association.");
|
AppThinker.getWindow().getStatusbar().setStatusMessage("Outil association - Cliquez à un endroit pour ajouter une association.");
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
_window.getStatusbar().setStatusMessage("Outil lien - Cliquez sur une classe, maintenez, puis relachez sur une autre.");
|
AppThinker.getWindow().getStatusbar().setStatusMessage("Outil lien - Cliquez sur une classe, maintenez, puis relachez sur une autre.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_window.getStatusbar().setStatusMessage("Outil sélection - Cliquez sur un élément pour le sélectionner.");
|
AppThinker.getWindow().getStatusbar().setStatusMessage("Outil sélection - Cliquez sur un élément pour le sélectionner.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,9 @@ import java.awt.*;
|
|||||||
* @author V.BOULANGER
|
* @author V.BOULANGER
|
||||||
*/
|
*/
|
||||||
public class AppThinkerWindow extends JFrame {
|
public class AppThinkerWindow extends JFrame {
|
||||||
private Project _project;
|
|
||||||
|
|
||||||
private AppThinkerMenuBar _menu;
|
private AppThinkerMenuBar _menubar;
|
||||||
private AppThinkerToolbar _toolbar;
|
private AppThinkerToolbar _toolbar;
|
||||||
private AppThinkerGrid _grid;
|
|
||||||
private AppThinkerStatusbar _statusbar;
|
private AppThinkerStatusbar _statusbar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,81 +19,41 @@ public class AppThinkerWindow extends JFrame {
|
|||||||
//Paramétrage de la fenêtre
|
//Paramétrage de la fenêtre
|
||||||
this.setTitle("AppThinker");
|
this.setTitle("AppThinker");
|
||||||
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
|
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
|
||||||
|
this.setMinimumSize(new Dimension(750, 500));
|
||||||
Image img = null;
|
Image img = null;
|
||||||
try { img = ImageIO.read(AppThinker.class.getResource("img/logoAppThinker.png")); } catch (Exception ex) { }
|
try { img = ImageIO.read(AppThinker.class.getResource("img/logoAppThinker.png")); } catch (Exception ex) { }
|
||||||
this.setIconImage(img);
|
this.setIconImage(img);
|
||||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
this.setLocationRelativeTo(null);
|
this.setLocationRelativeTo(null);
|
||||||
|
|
||||||
|
this.setLayout(new BorderLayout());
|
||||||
|
|
||||||
//Ajout du menu à la fenêtre
|
//Ajout du menu à la fenêtre
|
||||||
_menu = new AppThinkerMenuBar(this);
|
_menubar = new AppThinkerMenuBar();
|
||||||
this.setJMenuBar(_menu);
|
this.setJMenuBar(_menubar);
|
||||||
|
|
||||||
//Ajout de la toolbar à la fenêtre
|
//Ajout de la toolbar à la fenêtre
|
||||||
_toolbar = new AppThinkerToolbar(this);
|
_toolbar = new AppThinkerToolbar();
|
||||||
this.add(_toolbar, BorderLayout.NORTH);
|
this.add(_toolbar, BorderLayout.NORTH);
|
||||||
|
|
||||||
//Ajout de la grille à la fenêtre
|
|
||||||
_grid = new AppThinkerGrid();
|
|
||||||
this.add(_grid, BorderLayout.CENTER);
|
|
||||||
|
|
||||||
//Ajout de la statusbar à la fenêtre
|
//Ajout de la statusbar à la fenêtre
|
||||||
_statusbar = new AppThinkerStatusbar();
|
_statusbar = new AppThinkerStatusbar();
|
||||||
this.add(_statusbar, BorderLayout.SOUTH);
|
this.add(_statusbar, BorderLayout.SOUTH);
|
||||||
this.pack();
|
this.pack();
|
||||||
|
|
||||||
|
this.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Crée un nouveau Projet.
|
* Récupère la menubar contenue dans la fenêtre.
|
||||||
|
* @return La menubar contenue dans la fenêtre.
|
||||||
*/
|
*/
|
||||||
public void newProject(){
|
public AppThinkerMenuBar getMenubar(){
|
||||||
this._project = new Project();
|
return this._menubar;
|
||||||
this.setTitle("AppThinker | " + _project.getName());
|
|
||||||
this._menu.enableEditing();
|
|
||||||
this._toolbar.enableEditing();
|
|
||||||
this._statusbar.setStatusMessage("Le projet a été créé.");
|
|
||||||
this._statusbar.setFileMessage(this._project.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void setGrid(AppThinkerGrid grid){
|
||||||
* Ouvre un projet existant dans la fenêtre.
|
this.add(grid, BorderLayout.CENTER);
|
||||||
*/
|
|
||||||
public void openProject(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ferme le projet en cours.
|
|
||||||
*/
|
|
||||||
public void closeProject(){
|
|
||||||
this._project = null;
|
|
||||||
this.setTitle("AppThinker");
|
|
||||||
this._menu.disableEditing();
|
|
||||||
this._toolbar.disableEditing();
|
|
||||||
this._statusbar.setStatusMessage("Le projet a été fermé.");
|
|
||||||
this._statusbar.setFileMessage("Aucun projet ouvert");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convertit le projet actuel en chaîne XML.
|
|
||||||
*/
|
|
||||||
public void convertToXml(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sauvegarde le projet en cours.
|
|
||||||
*/
|
|
||||||
public void saveProject(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sauvegarde le projet en cours à un autre emplacement.
|
|
||||||
*/
|
|
||||||
public void saveAsProject(){
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -106,14 +64,6 @@ public class AppThinkerWindow extends JFrame {
|
|||||||
return this._toolbar;
|
return this._toolbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Récupère la grille contenue dans la fenêtre.
|
|
||||||
* @return La grille contenue dans la fenêtre.
|
|
||||||
*/
|
|
||||||
public AppThinkerGrid getGrid(){
|
|
||||||
return this._grid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Récupère la statusbar contenue dans la fenêtre.
|
* Récupère la statusbar contenue dans la fenêtre.
|
||||||
* @return La statusbar contenue dans la fenêtre.
|
* @return La statusbar contenue dans la fenêtre.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class Argument {
|
public class Argument {
|
||||||
|
|
||||||
public static int _argumentsId;
|
public static int _argumentId;
|
||||||
|
|
||||||
private int _id;
|
private int _id;
|
||||||
private String _type;
|
private String _type;
|
||||||
@@ -15,8 +15,8 @@ public class Argument {
|
|||||||
* Constructeur - Crée une instance de Argument.
|
* Constructeur - Crée une instance de Argument.
|
||||||
*/
|
*/
|
||||||
public Argument(){
|
public Argument(){
|
||||||
_argumentsId++;
|
_argumentId++;
|
||||||
this._id = _argumentsId;
|
this._id = _argumentId;
|
||||||
this._type = null;
|
this._type = null;
|
||||||
this._name = "argument" + this._id;
|
this._name = "argument" + this._id;
|
||||||
}
|
}
|
||||||
@@ -27,8 +27,8 @@ public class 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){
|
||||||
_argumentsId++;
|
_argumentId++;
|
||||||
this._id = _argumentsId;
|
this._id = _argumentId;
|
||||||
this._type = type;
|
this._type = type;
|
||||||
this._name = name;
|
this._name = name;
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ public class Argument {
|
|||||||
* 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 get_type() {
|
public String getType() {
|
||||||
return _type;
|
return _type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
|
import org.w3c.dom.Attr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gère un attribut.
|
* Gère un attribut.
|
||||||
* @author V.BOULANGER
|
* @author V.BOULANGER
|
||||||
*/
|
*/
|
||||||
public class Attribute {
|
public class Attribute {
|
||||||
|
|
||||||
public static int _attributesId = 0;
|
public static int _attributeId = 0;
|
||||||
|
public static final String PRIVATE = "-";
|
||||||
|
public static final String PROTECTED = "#";
|
||||||
|
public static final String PUBLIC = "+";
|
||||||
|
|
||||||
private int _id;
|
private int _id;
|
||||||
private String _access;
|
private String _access;
|
||||||
@@ -15,10 +20,10 @@ public class Attribute {
|
|||||||
* Constructeur - Crée une instance de Attribute.
|
* Constructeur - Crée une instance de Attribute.
|
||||||
*/
|
*/
|
||||||
public Attribute(){
|
public Attribute(){
|
||||||
_attributesId++;
|
_attributeId++;
|
||||||
this._id = _attributesId;
|
this._id = _attributeId;
|
||||||
this._access = "private";
|
this._access = Attribute.PRIVATE;
|
||||||
this._type = null;
|
this._type = "int";
|
||||||
this._name = "attribut" + this._id;
|
this._name = "attribut" + this._id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,8 +34,8 @@ public class Attribute {
|
|||||||
* @param type Le type de l'attribut.
|
* @param type Le type de l'attribut.
|
||||||
*/
|
*/
|
||||||
public Attribute(String name, String access, String type){
|
public Attribute(String name, String access, String type){
|
||||||
_attributesId++;
|
_attributeId++;
|
||||||
this._id = _attributesId;
|
this._id = _attributeId;
|
||||||
this._access = access;
|
this._access = access;
|
||||||
this._type = type;
|
this._type = type;
|
||||||
this._name = name;
|
this._name = name;
|
||||||
|
|||||||
@@ -17,7 +17,10 @@ public class Class {
|
|||||||
private int _posY;
|
private int _posY;
|
||||||
private int _sizeX;
|
private int _sizeX;
|
||||||
private int _sizeY;
|
private int _sizeY;
|
||||||
|
private int _minSizeX;
|
||||||
|
private int _minSizeY;
|
||||||
private int _shape;
|
private int _shape;
|
||||||
|
|
||||||
private List<Attribute> _attributes;
|
private List<Attribute> _attributes;
|
||||||
private List<Method> _methods;
|
private List<Method> _methods;
|
||||||
|
|
||||||
@@ -33,8 +36,8 @@ public class Class {
|
|||||||
this._name = "Classe" + _id;
|
this._name = "Classe" + _id;
|
||||||
this._posX = posX;
|
this._posX = posX;
|
||||||
this._posY = posY;
|
this._posY = posY;
|
||||||
this._sizeX = 30;
|
this._sizeX = 90;
|
||||||
this._sizeY = 60;
|
this._sizeY = 50;
|
||||||
this._shape = shape;
|
this._shape = shape;
|
||||||
this._attributes = new ArrayList<Attribute>();
|
this._attributes = new ArrayList<Attribute>();
|
||||||
this._methods = new ArrayList<Method>();
|
this._methods = new ArrayList<Method>();
|
||||||
@@ -153,13 +156,35 @@ public class Class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paramètre la taille sur l'axe X et Y de la classe.
|
* Récupère la taille minimale sur l'axe X de la classe.
|
||||||
* @param sizeX La taille sur l'axe X de la classe.
|
* @return La taille minimale sur l'axe X de la classe.
|
||||||
* @param sizeY La taille sur l'axe Y de la classe.
|
|
||||||
*/
|
*/
|
||||||
public void resize(int sizeX, int sizeY){
|
public int getMinSizeX(){
|
||||||
this._sizeX = sizeX;
|
return this._minSizeX;
|
||||||
this._sizeY = sizeY;
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paramètre la taille minimale sur l'axe X de la classe.
|
||||||
|
* @param minSizeX La taille minimale sur l'axe X de la classe.
|
||||||
|
*/
|
||||||
|
public void setMinSizeX(int minSizeX){
|
||||||
|
this._minSizeX = minSizeX;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récupère la taille minimale sur l'axe Y de la classe.
|
||||||
|
* @return La taille minimale sur l'axe Y de la classe.
|
||||||
|
*/
|
||||||
|
public int getMinSizeY(){
|
||||||
|
return this._minSizeY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paramètre la taille minimale sur l'axe Y de la classe.
|
||||||
|
* @param minSizeY La taille minimale sur l'axe Y de la classe.
|
||||||
|
*/
|
||||||
|
public void setMinSizeY(int minSizeY){
|
||||||
|
this._minSizeY = minSizeY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -178,20 +203,6 @@ public class Class {
|
|||||||
this._shape = shape;
|
this._shape = shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sélectionne la classe dans l'espace graphique.
|
|
||||||
*/
|
|
||||||
public void select(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Désélectionne la classe dans l'espace graphique.
|
|
||||||
*/
|
|
||||||
public void deselect(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Récupère tous les attributs de la classe.
|
* Récupère tous les attributs de la classe.
|
||||||
* @return Les attributs de la classe.
|
* @return Les attributs de la classe.
|
||||||
@@ -203,16 +214,22 @@ public class Class {
|
|||||||
/**
|
/**
|
||||||
* Ajoute un attribut à la classe.
|
* Ajoute un attribut à la classe.
|
||||||
* @param a L'attribut à ajouter.
|
* @param a L'attribut à ajouter.
|
||||||
* @author V.BOULANGER
|
|
||||||
*/
|
*/
|
||||||
public void addAttribute(Attribute a){
|
public void addAttribute(Attribute a){
|
||||||
this._attributes.add(a);
|
this._attributes.add(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supprime un attribut de la classe.
|
||||||
|
* @param a L'attribut à supprimer.
|
||||||
|
*/
|
||||||
|
public void removeAttribute(Attribute a){
|
||||||
|
this._attributes.remove(a);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supprime un attribut de la classe.
|
* Supprime un attribut de la classe.
|
||||||
* @param index L'index de l'attribut à supprimer.
|
* @param index L'index de l'attribut à supprimer.
|
||||||
* @author V.BOULANGER
|
|
||||||
*/
|
*/
|
||||||
public void removeAttribute(int index){
|
public void removeAttribute(int index){
|
||||||
this._attributes.remove(index);
|
this._attributes.remove(index);
|
||||||
@@ -220,7 +237,6 @@ public class Class {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Supprime tous les attributs de la classe.
|
* Supprime tous les attributs de la classe.
|
||||||
* @author V.BOULANGER
|
|
||||||
*/
|
*/
|
||||||
public void clearAttributes(){
|
public void clearAttributes(){
|
||||||
this._attributes.clear();
|
this._attributes.clear();
|
||||||
@@ -237,16 +253,22 @@ public class Class {
|
|||||||
/**
|
/**
|
||||||
* Ajoute une méthode à la classe.
|
* Ajoute une méthode à la classe.
|
||||||
* @param m La méthode à ajouter.
|
* @param m La méthode à ajouter.
|
||||||
* @author V.BOULANGER
|
|
||||||
*/
|
*/
|
||||||
public void addMethod(Method m){
|
public void addMethod(Method m){
|
||||||
this._methods.add(m);
|
this._methods.add(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supprime une méthode de la classe.
|
||||||
|
* @param m La méthode à supprimer.
|
||||||
|
*/
|
||||||
|
public void removeMethod(Method m){
|
||||||
|
this._methods.remove(m);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supprime une méthode de la classe.
|
* Supprime une méthode de la classe.
|
||||||
* @param index L'index de la méthode à supprimer.
|
* @param index L'index de la méthode à supprimer.
|
||||||
* @author V.BOULANGER
|
|
||||||
*/
|
*/
|
||||||
public void removeMethod(int index){
|
public void removeMethod(int index){
|
||||||
this._methods.remove(index);
|
this._methods.remove(index);
|
||||||
@@ -254,7 +276,6 @@ public class Class {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Supprime toutes les méthodes de la classe.
|
* Supprime toutes les méthodes de la classe.
|
||||||
* @author V.BOULANGER
|
|
||||||
*/
|
*/
|
||||||
public void clearMethods(){
|
public void clearMethods(){
|
||||||
this._methods.clear();
|
this._methods.clear();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
public class Link {
|
public class Link {
|
||||||
|
|
||||||
public static int _linksId = 0;
|
public static int _linkId = 0;
|
||||||
public static final int STRONG = 0;
|
public static final int STRONG = 0;
|
||||||
public static final int WEAK = 1;
|
public static final int WEAK = 1;
|
||||||
public static final int COMPOSITION = 2;
|
public static final int COMPOSITION = 2;
|
||||||
@@ -29,8 +29,8 @@ public class Link {
|
|||||||
* @param end La classe d'arrivée.
|
* @param end La classe d'arrivée.
|
||||||
*/
|
*/
|
||||||
public Link(Class start, Class end){
|
public Link(Class start, Class end){
|
||||||
_linksId++;
|
_linkId++;
|
||||||
this._id = _linksId;
|
this._id = _linkId;
|
||||||
this._start = start;
|
this._start = start;
|
||||||
this._end = end;
|
this._end = end;
|
||||||
this._minCardinalityStart = Link.CARD_NULL;
|
this._minCardinalityStart = Link.CARD_NULL;
|
||||||
@@ -51,8 +51,8 @@ public class Link {
|
|||||||
* @param type Le type de lien.
|
* @param type Le type de lien.
|
||||||
*/
|
*/
|
||||||
public Link(Class start, Class end, int minCardinalityStart, int maxCardinalityStart, int minCardinalityEnd, int maxCardinalityEnd, int type){
|
public Link(Class start, Class end, int minCardinalityStart, int maxCardinalityStart, int minCardinalityEnd, int maxCardinalityEnd, int type){
|
||||||
_linksId++;
|
_linkId++;
|
||||||
this._id = _linksId;
|
this._id = _linkId;
|
||||||
this._start = start;
|
this._start = start;
|
||||||
this._end = end;
|
this._end = end;
|
||||||
this._minCardinalityStart = minCardinalityStart;
|
this._minCardinalityStart = minCardinalityStart;
|
||||||
@@ -86,6 +86,22 @@ public class Link {
|
|||||||
this._start = start;
|
this._start = start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récupère la classe d'arrivée du lien.
|
||||||
|
* @return La classe d'arrivée du lien.
|
||||||
|
*/
|
||||||
|
public Class getEnd() {
|
||||||
|
return _end;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paramètre la classe d'arrivée.
|
||||||
|
* @param end La classe d'arrivée.
|
||||||
|
*/
|
||||||
|
public void setEnd(Class end) {
|
||||||
|
this._end = end;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Récupère la cardinalité minimum de la classe de départ.
|
* Récupère la cardinalité minimum de la classe de départ.
|
||||||
* @return La cardinalité minimum de la classe de départ.
|
* @return La cardinalité minimum de la classe de départ.
|
||||||
@@ -118,37 +134,6 @@ public class Link {
|
|||||||
this._maxCardinalityStart = maxCardinalityStart;
|
this._maxCardinalityStart = maxCardinalityStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Récupère la classe d'arrivée du lien.
|
|
||||||
* @return La classe d'arrivée du lien.
|
|
||||||
*/
|
|
||||||
public Class getEnd() {
|
|
||||||
return _end;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Paramètre la classe d'arrivée.
|
|
||||||
* @param end La classe d'arrivée.
|
|
||||||
*/
|
|
||||||
public void setEnd(Class end) {
|
|
||||||
this._end = end;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Modifie la direction du lien (permute les classes de départ et d'arrivée).
|
|
||||||
*/
|
|
||||||
public void switchDirection(){
|
|
||||||
Class start = this._start;
|
|
||||||
int minStart = this._minCardinalityStart;
|
|
||||||
int maxStart = this._maxCardinalityStart;
|
|
||||||
this._start = _end;
|
|
||||||
this._end = start;
|
|
||||||
this._minCardinalityStart = _minCardinalityEnd;
|
|
||||||
this._maxCardinalityStart = _maxCardinalityEnd;
|
|
||||||
this._minCardinalityEnd = minStart;
|
|
||||||
this._maxCardinalityEnd = maxStart;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Récupère la cardinalité minimum de la classe d'arrivée.
|
* Récupère la cardinalité minimum de la classe d'arrivée.
|
||||||
* @return La cardinalité minimum de la classe d'arrivée.
|
* @return La cardinalité minimum de la classe d'arrivée.
|
||||||
@@ -198,16 +183,17 @@ public class Link {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sélectionne le lien dans l'espace graphique.
|
* Modifie la direction du lien (permute les classes de départ et d'arrivée).
|
||||||
*/
|
*/
|
||||||
public void select(){
|
public void switchDirection(){
|
||||||
|
Class start = this._start;
|
||||||
}
|
int minStart = this._minCardinalityStart;
|
||||||
|
int maxStart = this._maxCardinalityStart;
|
||||||
/**
|
this._start = _end;
|
||||||
* Désélectionne le lien dans l'espace graphique.
|
this._end = start;
|
||||||
*/
|
this._minCardinalityStart = _minCardinalityEnd;
|
||||||
public void deselect(){
|
this._maxCardinalityStart = _maxCardinalityEnd;
|
||||||
|
this._minCardinalityEnd = minStart;
|
||||||
|
this._maxCardinalityEnd = maxStart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class Method {
|
public class Method {
|
||||||
|
|
||||||
public static int _methodsId = 0;
|
public static int _methodId = 0;
|
||||||
|
|
||||||
private int _id;
|
private int _id;
|
||||||
private String _access;
|
private String _access;
|
||||||
@@ -18,8 +18,8 @@ public class Method {
|
|||||||
* Constructeur - Crée une instance de Method.
|
* Constructeur - Crée une instance de Method.
|
||||||
*/
|
*/
|
||||||
public Method(){
|
public Method(){
|
||||||
_methodsId++;
|
_methodId++;
|
||||||
this._id = _methodsId;
|
this._id = _methodId;
|
||||||
this._access = "public";
|
this._access = "public";
|
||||||
this._type = null;
|
this._type = null;
|
||||||
this._name = "methode" + this._id;
|
this._name = "methode" + this._id;
|
||||||
@@ -34,8 +34,8 @@ public class Method {
|
|||||||
* @param arguments Les arguments de la méthode.
|
* @param arguments Les arguments de la méthode.
|
||||||
*/
|
*/
|
||||||
public Method(String access, String type, String name, ArrayList<Argument> arguments){
|
public Method(String access, String type, String name, ArrayList<Argument> arguments){
|
||||||
_methodsId++;
|
_methodId++;
|
||||||
this._id = _methodsId;
|
this._id = _methodId;
|
||||||
this._access = access;
|
this._access = access;
|
||||||
this._type = type;
|
this._type = type;
|
||||||
this._name = name;
|
this._name = name;
|
||||||
@@ -114,6 +114,14 @@ public class Method {
|
|||||||
this._arguments.add(a);
|
this._arguments.add(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retire un argument de la méthode.
|
||||||
|
* @param a L'argument à retirer.
|
||||||
|
*/
|
||||||
|
public void removeArgument(Argument a){
|
||||||
|
this._arguments.remove(a);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retire un argument de la méthode.
|
* Retire un argument de la méthode.
|
||||||
* @param index L'index de l'argument à retirer.
|
* @param index L'index de l'argument à retirer.
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ public class Project {
|
|||||||
private String _designation;
|
private String _designation;
|
||||||
private String _path;
|
private String _path;
|
||||||
|
|
||||||
|
private AppThinkerGrid _grid;
|
||||||
|
|
||||||
private List<Class> _classes;
|
private List<Class> _classes;
|
||||||
private List<Link> _links;
|
private List<Link> _links;
|
||||||
|
|
||||||
@@ -32,6 +34,7 @@ public class Project {
|
|||||||
_path = null;
|
_path = null;
|
||||||
_classes = new ArrayList<Class>();
|
_classes = new ArrayList<Class>();
|
||||||
_links = new ArrayList<Link>();
|
_links = new ArrayList<Link>();
|
||||||
|
_grid = new AppThinkerGrid(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,6 +59,14 @@ public class Project {
|
|||||||
_links = links;
|
_links = links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récupère l'objet grille du projet.
|
||||||
|
* @return L'objet grille du projet.
|
||||||
|
*/
|
||||||
|
public AppThinkerGrid getGrid(){
|
||||||
|
return this._grid;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Récupère le numéro du Projet.
|
* Récupère le numéro du Projet.
|
||||||
* @return Le numéro du projet.
|
* @return Le numéro du projet.
|
||||||
@@ -160,6 +171,14 @@ public class Project {
|
|||||||
this._classes.add(c);
|
this._classes.add(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retire une classe du projet.
|
||||||
|
* @param c La classe à retirer.
|
||||||
|
*/
|
||||||
|
public void removeClass(Class c){
|
||||||
|
this._classes.remove(c);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retire une classe du projet.
|
* Retire une classe du projet.
|
||||||
* @param index L'index de la classe à retirer.
|
* @param index L'index de la classe à retirer.
|
||||||
@@ -191,6 +210,14 @@ public class Project {
|
|||||||
this._links.add(l);
|
this._links.add(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retire un lien du projet.
|
||||||
|
* @param l Le lien à retirer.
|
||||||
|
*/
|
||||||
|
public void removeLink(Link l){
|
||||||
|
this._links.remove(l);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retire un lien du projet.
|
* Retire un lien du projet.
|
||||||
* @param index L'index du lien à retirer.
|
* @param index L'index du lien à retirer.
|
||||||
|
|||||||
227
AppThinker/src/UmlDiagram.java
Normal file
227
AppThinker/src/UmlDiagram.java
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.event.MouseListener;
|
||||||
|
import java.awt.event.MouseMotionListener;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cette classe permet d'afficher l'ensemble des éléments du projet sous la forme d'un diagramme UML.
|
||||||
|
*/
|
||||||
|
public class UmlDiagram extends JPanel implements MouseListener, MouseMotionListener {
|
||||||
|
|
||||||
|
private Project _project;
|
||||||
|
private List<Class> _classes;
|
||||||
|
private List<Link> _links;
|
||||||
|
private Object _selected;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur - Crée un nouveau diagramme UML à partir d'un projet.
|
||||||
|
* @param p Le projet associé.
|
||||||
|
*/
|
||||||
|
public UmlDiagram(Project p){
|
||||||
|
_project = p;
|
||||||
|
this.addMouseListener(this);
|
||||||
|
this.addMouseMotionListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dessine les éléments du projet sous la forme d'un diagramme UML.
|
||||||
|
* @param g L'objet graphique
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void paintComponent(Graphics g){
|
||||||
|
int fontSize = 14;
|
||||||
|
Font font = new Font("Arial", Font.PLAIN, fontSize);
|
||||||
|
for(Class a : _classes){
|
||||||
|
int posX = a.getPosX()-(a.getSizeX()/2);
|
||||||
|
int posY = a.getPosY()-(a.getSizeY()/2);
|
||||||
|
//Dessin du rectangle
|
||||||
|
g.setColor(Color.GRAY);
|
||||||
|
g.fillRoundRect(posX, posY, a.getSizeX(), a.getSizeY(), 10, 10);
|
||||||
|
g.setColor(Color.BLACK);
|
||||||
|
//Dessin du nom de la classe
|
||||||
|
int posCounter = posY + fontSize;
|
||||||
|
FontMetrics metrics = g.getFontMetrics(font);
|
||||||
|
g.setFont(font);
|
||||||
|
g.drawString(a.getName(), posX + metrics.stringWidth(a.getName())/4, posCounter);
|
||||||
|
posCounter += 5;
|
||||||
|
//Ligne de séparation
|
||||||
|
g.drawLine(posX, posY + fontSize + 5, posX + a.getSizeX()-1, posY + fontSize + 5);
|
||||||
|
//Affichage des attributs
|
||||||
|
for(Attribute b : a.getAttributes()){
|
||||||
|
posCounter += fontSize;
|
||||||
|
g.drawString(b.getAccess() + " " + b.getName() + " : " + b.getType(), posX, posCounter);
|
||||||
|
}
|
||||||
|
posCounter += 5;
|
||||||
|
//Ligne de séparation
|
||||||
|
g.drawLine(posX, posCounter, posX + a.getSizeX()-1, posCounter);
|
||||||
|
g.setColor(new Color(69, 69, 72));
|
||||||
|
//Si la classe est sélectionnée
|
||||||
|
if((Class)_selected == a){
|
||||||
|
AppThinker.getWindow().getStatusbar().setSizeLabel(a.getSizeX(), a.getSizeY());
|
||||||
|
//Top Left
|
||||||
|
g.fillOval(posX-4, posY-4, 8, 8);
|
||||||
|
//Top
|
||||||
|
g.fillRect(posX + (a.getSizeX()/2)-4, posY-4, 8, 8);
|
||||||
|
//Top Right
|
||||||
|
g.fillOval(posX + a.getSizeX()-4, posY-4, 8, 8);
|
||||||
|
//Right
|
||||||
|
g.fillRect(posX + a.getSizeX()-4, posY + (a.getSizeY()/2)-4, 8, 8);
|
||||||
|
//Bottom Right
|
||||||
|
g.fillOval(posX + a.getSizeX()-4, posY + a.getSizeY()-4, 8, 8);
|
||||||
|
//Bottom
|
||||||
|
g.fillRect(posX + (a.getSizeX()/2)-4, posY + a.getSizeY()-4,8, 8);
|
||||||
|
//Bottom Left
|
||||||
|
g.fillOval(posX - 4, posY + a.getSizeY()-4, 8, 8);
|
||||||
|
//Left
|
||||||
|
g.fillRect(posX -4, posY + (a.getSizeY()/2)-4, 8, 8);
|
||||||
|
//Total rectangle
|
||||||
|
g.drawRect(posX, posY, a.getSizeX(), a.getSizeY());
|
||||||
|
}
|
||||||
|
else AppThinker.getWindow().getStatusbar().setSizeLabel(0, 0);
|
||||||
|
}
|
||||||
|
AppThinker.getProject().getGrid().updateUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mets à jour graphiquement le diagramme UML.
|
||||||
|
*/
|
||||||
|
public void displayDiagram(){
|
||||||
|
_classes = _project.getClasses();
|
||||||
|
_links = _project.getLinks();
|
||||||
|
this.repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récupère l'élément sélectionné dans la grille.
|
||||||
|
* @return L'élément sélectionné dan sla grille.
|
||||||
|
*/
|
||||||
|
public Object getSelected(){
|
||||||
|
return this._selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récupération de l'objet cliqué
|
||||||
|
* @param getX Les coordonnées de la souris sur l'axe X.
|
||||||
|
* @param getY Les coordonnées de la souris sur l'axe Y.
|
||||||
|
*/
|
||||||
|
public void select(int getX, int getY){
|
||||||
|
//On cherche l'objet sélectionné
|
||||||
|
boolean classSelected = false;
|
||||||
|
boolean linkSelected = false;
|
||||||
|
for(Class a : _classes){
|
||||||
|
int posX = a.getPosX()-(a.getSizeX()/2);
|
||||||
|
int posY = a.getPosY()-(a.getSizeY()/2);
|
||||||
|
if(getX >= posX && getX <= (posX + a.getSizeX())){
|
||||||
|
if(getY >= posY && getY <= (posY + a.getSizeY())){
|
||||||
|
classSelected = true;
|
||||||
|
_selected = a;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(classSelected == false && linkSelected == false) _selected = null;
|
||||||
|
this.repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Actions de la souris sur le diagramme UML
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action du clic de la souris sur le diagramme.
|
||||||
|
* @param e L'événement souris.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
if(e.getClickCount() == 2){
|
||||||
|
System.out.println("Modification des propriétés");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bouton de la souris pressé sur la grille. On récupère l'outil sélectionné pour parvenir à l'action.
|
||||||
|
* @param e L'événement souris.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void mousePressed(MouseEvent e) {
|
||||||
|
System.out.println("ok");
|
||||||
|
int tool = AppThinker.getWindow().getToolbar().getCurrentTool();
|
||||||
|
switch(tool){
|
||||||
|
//On essaie de sélectionner un élément
|
||||||
|
case AppThinkerToolbar.EDIT_TOOL:
|
||||||
|
System.out.println("On édite un élément.");
|
||||||
|
break;
|
||||||
|
case AppThinkerToolbar.DELETE_TOOL:
|
||||||
|
System.out.println("On supprime un élément.");
|
||||||
|
this.select(e.getX(), e.getY());
|
||||||
|
if(_selected instanceof Class){
|
||||||
|
Class a = (Class)_selected;
|
||||||
|
AppThinker.getProject().getClasses().remove(a);
|
||||||
|
}
|
||||||
|
this.displayDiagram();
|
||||||
|
break;
|
||||||
|
case AppThinkerToolbar.COPY_TOOL:
|
||||||
|
System.out.println("On copie un élément.");
|
||||||
|
break;
|
||||||
|
case AppThinkerToolbar.PASTE_TOOL:
|
||||||
|
System.out.println("On colle un élément.");
|
||||||
|
break;
|
||||||
|
//On essaie d'ajouter une classe
|
||||||
|
case AppThinkerToolbar.CLASS_TOOL:
|
||||||
|
Class newClass = new Class(e.getX(), e.getY(), Class.RECTANGLE);
|
||||||
|
newClass.addAttribute(new Attribute("testAttribut", Attribute.PROTECTED, "String"));
|
||||||
|
newClass.addAttribute(new Attribute("bonjour", Attribute.PUBLIC, "Date"));
|
||||||
|
AppThinker.getProject().addClass(newClass);
|
||||||
|
break;
|
||||||
|
case AppThinkerToolbar.ASSOCIATION_TOOL:
|
||||||
|
System.out.println("On ajoute une association");
|
||||||
|
break;
|
||||||
|
case AppThinkerToolbar.LINK_TOOL:
|
||||||
|
System.out.println("On ajoute un lien");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this.select(e.getX(), e.getY());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.displayDiagram();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseReleased(MouseEvent e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseEntered(MouseEvent e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseExited(MouseEvent e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Déplacer un élément en cliquant et déplaçant la souris.
|
||||||
|
* @param e Evénement souris
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void mouseDragged(MouseEvent e) {
|
||||||
|
if(_selected instanceof Class){
|
||||||
|
Class a = (Class)_selected;
|
||||||
|
a.setPosX(e.getX());
|
||||||
|
a.setPosY(e.getY());
|
||||||
|
}
|
||||||
|
this.repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* La souris bouge dans la grille. On affiche les coordonnées de la souris dans la statusbar.
|
||||||
|
* @param e L'événement souris.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void mouseMoved(MouseEvent e) {
|
||||||
|
AppThinker.getWindow().getStatusbar().setPosLabel(e.getX(), e.getY());
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user