@@ -1,5 +1,7 @@
|
||||
import javax.swing.*;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* La classe principale du logiciel AppThinker.
|
||||
@@ -32,34 +34,143 @@ public class AppThinker {
|
||||
*/
|
||||
public static void newProject(){
|
||||
_project = new Project();
|
||||
_window.setTitle("AppThinker | " + _project.getName());
|
||||
_window.getMenubar().setProjectEnable(true);
|
||||
_project.getUmlDiagram().getToolbar().setEnabled(true);
|
||||
_window.getStatusbar().setStatusMessage("The project was created.");
|
||||
displayProject();
|
||||
_window.getStatusbar().setFileMessage(_project.getName());
|
||||
_window.setProject(_project);
|
||||
AppThinker.getProject().getUmlDiagram().displayDiagram();
|
||||
_project.getUmlDiagram().displayDiagram();
|
||||
_window.getStatusbar().setStatusMessage("The project was created.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Opère les modifications nécessaires sur la fenêtre pour accueillir le projet.
|
||||
*/
|
||||
public static void displayProject(){
|
||||
|
||||
_window.setTitle((_project.getPath() == null) ? "AppThinker - " + _project.getName() + "*" : "AppThinker - " + _project.getName() + " (" + _project.getPath() + ")");
|
||||
_window.getMenubar().setProjectEnable(true);
|
||||
_project.getUmlDiagram().getToolbar().setEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ouvre un projet existant dans la fenêtre.
|
||||
*/
|
||||
public static void openProject(){
|
||||
//_window.getGrid().repaint();
|
||||
FileNameExtensionFilter fileFilter = new FileNameExtensionFilter("AppThinker project", "appt");
|
||||
JFileChooser dialog = new JFileChooser();
|
||||
dialog.setDialogType(JFileChooser.OPEN_DIALOG);
|
||||
dialog.setDialogTitle("Open an AppThinker project");
|
||||
dialog.setFileFilter(fileFilter);
|
||||
dialog.setAcceptAllFileFilterUsed(false);
|
||||
if(dialog.showOpenDialog(null) == JFileChooser.APPROVE_OPTION){
|
||||
ObjectInputStream ois = null;
|
||||
Project project = null;
|
||||
try {
|
||||
final FileInputStream fichier = new FileInputStream(dialog.getSelectedFile().getPath());
|
||||
ois = new ObjectInputStream(fichier);
|
||||
project = (Project) ois.readObject();
|
||||
} catch (final java.io.IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (final ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (ois != null) {
|
||||
ois.close();
|
||||
_project = project;
|
||||
_window.getStatusbar().setFileMessage(_project.getName());
|
||||
_window.setProject(_project);
|
||||
_project.getUmlDiagram().displayDiagram();
|
||||
displayProject();
|
||||
}
|
||||
} catch (final IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sauvegarde le projet en cours.
|
||||
*/
|
||||
public static void saveProject(){
|
||||
|
||||
//Si le projet ne contient pas de path, on demande à l'enregistrer dans un emplacement
|
||||
FileNameExtensionFilter fileFilter = new FileNameExtensionFilter("AppThinker project", "appt");
|
||||
String path = _project.getPath();
|
||||
if(path == null){
|
||||
JFileChooser dialog = new JFileChooser();
|
||||
dialog.setDialogTitle("Save an AppThinker project");
|
||||
dialog.setDialogType(JFileChooser.SAVE_DIALOG);
|
||||
dialog.setFileFilter(fileFilter);
|
||||
dialog.setAcceptAllFileFilterUsed(false);
|
||||
if(dialog.showOpenDialog(null) == JFileChooser.APPROVE_OPTION){
|
||||
String filePath = dialog.getSelectedFile().getPath();
|
||||
path = (filePath.contains(".appt")) ? filePath : filePath + ".appt";
|
||||
}
|
||||
}
|
||||
//On serialize le projet dans un fichier
|
||||
_project.setPath(path);
|
||||
ObjectOutputStream oos = null;
|
||||
try {
|
||||
final FileOutputStream fichier = new FileOutputStream(path);
|
||||
oos = new ObjectOutputStream(fichier);
|
||||
oos.writeObject(_project);
|
||||
oos.flush();
|
||||
} catch (final java.io.IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (oos != null) {
|
||||
oos.flush();
|
||||
oos.close();
|
||||
displayProject();
|
||||
_window.getStatusbar().setStatusMessage("The project was saved successfully.");
|
||||
}
|
||||
} catch (final IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sauvegarde le projet en cours à un autre emplacement.
|
||||
*/
|
||||
public static void saveAsProject(){
|
||||
//Enregistrer le projet sous un autre emplacement
|
||||
FileNameExtensionFilter fileFilter = new FileNameExtensionFilter("AppThinker project", "appt");
|
||||
String path = _project.getPath();
|
||||
|
||||
JFileChooser dialog = new JFileChooser();
|
||||
dialog.setDialogTitle("Save an AppThinker project");
|
||||
dialog.setDialogType(JFileChooser.SAVE_DIALOG);
|
||||
dialog.setFileFilter(fileFilter);
|
||||
dialog.setAcceptAllFileFilterUsed(false);
|
||||
if(dialog.showOpenDialog(null) == JFileChooser.APPROVE_OPTION){
|
||||
String filePath = dialog.getSelectedFile().getPath();
|
||||
path = (filePath.contains(".appt")) ? filePath : filePath + ".appt";
|
||||
}
|
||||
|
||||
//On serialize le projet dans un fichier
|
||||
_project.setPath(path);
|
||||
ObjectOutputStream oos = null;
|
||||
try {
|
||||
final FileOutputStream fichier = new FileOutputStream(path);
|
||||
oos = new ObjectOutputStream(fichier);
|
||||
oos.writeObject(_project);
|
||||
oos.flush();
|
||||
} catch (final java.io.IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (oos != null) {
|
||||
oos.flush();
|
||||
oos.close();
|
||||
displayProject();
|
||||
_window.getStatusbar().setStatusMessage("The project was saved on a new location.");
|
||||
}
|
||||
} catch (final IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +181,7 @@ public class AppThinker {
|
||||
_window.getMenubar().setProjectEnable(false);
|
||||
_project.getUmlDiagram().getToolbar().setEnabled(false);
|
||||
_window.getStatusbar().setStatusMessage("The project has been closed.");
|
||||
_window.getStatusbar().setFileMessage("No open project.");
|
||||
_window.getStatusbar().setFileMessage("No project opened.");
|
||||
_window.clearProject();
|
||||
_project = null;
|
||||
}
|
||||
|
||||
@@ -180,6 +180,7 @@ public class AppThinkerMenuBar extends JMenuBar {
|
||||
|
||||
/**
|
||||
* Active/Désactive les boutons relatifs au projet.
|
||||
* @param enabled Le paramètre d'activation.
|
||||
*/
|
||||
public void setProjectEnable(boolean enabled){
|
||||
_saveProject.setEnabled(enabled);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class AppThinkerStatusbar extends JPanel {
|
||||
|
||||
this.add(actionBar);
|
||||
|
||||
_fileLabel = new JLabel("No open project.");
|
||||
_fileLabel = new JLabel("No project opened.");
|
||||
_fileLabel.setHorizontalAlignment(JLabel.RIGHT);
|
||||
this.add(_fileLabel);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ public class AppThinkerToolbar extends JPanel {
|
||||
|
||||
/**
|
||||
* Constructeur de la classe AppThinkerToolbar
|
||||
* @param diagram Le diagramme UML auquel appartient la toolbar.
|
||||
*/
|
||||
public AppThinkerToolbar(UmlDiagram diagram){
|
||||
_umlDiagram = diagram;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Gère un argument d'une méthode.
|
||||
* @author V.BOULANGER
|
||||
*/
|
||||
public class Argument {
|
||||
public class Argument implements Serializable {
|
||||
|
||||
public static int _argumentId;
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import org.w3c.dom.Attr;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Gère un attribut.
|
||||
* @author V.BOULANGER
|
||||
*/
|
||||
public class Attribute {
|
||||
public class Attribute implements Serializable {
|
||||
|
||||
public static int _attributeId = 0;
|
||||
public static final String PRIVATE = "-";
|
||||
@@ -15,6 +17,12 @@ public class Attribute {
|
||||
private String _access;
|
||||
private String _type;
|
||||
private String _name;
|
||||
private boolean _isStatic;
|
||||
private boolean _isFinal;
|
||||
private boolean _isAbstract;
|
||||
private boolean _isSynchronized;
|
||||
private boolean _isVolatile;
|
||||
private boolean _isTransient;
|
||||
|
||||
/**
|
||||
* Constructeur - Crée une instance de Attribute.
|
||||
@@ -96,4 +104,100 @@ public class Attribute {
|
||||
public void setName(String name) {
|
||||
this._name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne si l'attribut est statique ou non.
|
||||
* @return true : l'attribut est statique, false: l'attribut n'est pas statique.
|
||||
*/
|
||||
public boolean isStatic() {
|
||||
return _isStatic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paramètre la caractéristique statique de l'attribut.
|
||||
* @param s true : l'attribut est statique, false : l'attribut n'est pas statique
|
||||
*/
|
||||
public void setStatic(boolean s) {
|
||||
this._isStatic = s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne si l'attribut est final ou non.
|
||||
* @return true : l'attribut est final, false: l'attribut n'est pas final.
|
||||
*/
|
||||
public boolean isFinal() {
|
||||
return _isFinal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paramètre la caractéristique final de l'attribut.
|
||||
* @param f true : l'attribut est final, false : l'attribut n'est pas final
|
||||
*/
|
||||
public void setFinal(boolean f) {
|
||||
this._isFinal = f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne si l'attribut est abstrait ou non.
|
||||
* @return true : l'attribut est abstrait, false: l'attribut n'est pas abstrait.
|
||||
*/
|
||||
public boolean isAbstract() {
|
||||
return _isAbstract;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paramètre la caractéristique abstraite de l'attribut.
|
||||
* @param a true : l'attribut est abstrait, false : l'attribut n'est pas abstrait.
|
||||
*/
|
||||
public void setAbstract(boolean a) {
|
||||
this._isAbstract = a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne si l'attribut est synchronisé ou non.
|
||||
* @return true : l'attribut est synchronisé, false: l'attribut n'est pas synchronisé.
|
||||
*/
|
||||
public boolean isSynchronized() {
|
||||
return _isSynchronized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paramètre la caractéristique synchronisée de l'attribut.
|
||||
* @param s true : l'attribut est synchronisé, false : l'attribut n'est pas synchronisé.
|
||||
*/
|
||||
public void setSynchronized(boolean s) {
|
||||
this._isSynchronized = s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne si l'attribut est volatile ou non.
|
||||
* @return true : l'attribut est volatile, false: l'attribut n'est pas volatile.
|
||||
*/
|
||||
public boolean isVolatile() {
|
||||
return _isVolatile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paramètre la caractéristique volatile de l'attribut.
|
||||
* @param v true : l'attribut est volatile, false : l'attribut n'est pas volatile
|
||||
*/
|
||||
public void setVolatile(boolean v) {
|
||||
this._isVolatile = v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne si l'attribut est transitoire ou non.
|
||||
* @return true : l'attribut est transitoire, false: l'attribut n'est pas transitoire.
|
||||
*/
|
||||
public boolean isTransient() {
|
||||
return _isTransient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paramètre la caractéristique transitoire de l'attribut.
|
||||
* @param t true : l'attribut est transitoire, false : l'attribut n'est pas transitoire
|
||||
*/
|
||||
public void setTransient(boolean t) {
|
||||
this._isTransient = t;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -7,7 +8,7 @@ import java.util.List;
|
||||
* Gère une classe du projet.
|
||||
* @author V.BOULANGER
|
||||
*/
|
||||
public class Class {
|
||||
public class Class implements Serializable {
|
||||
|
||||
public static int _classId = 0;
|
||||
public static final int RECTANGLE = 0;
|
||||
|
||||
@@ -19,11 +19,11 @@ public class ClassPropertiesWindow extends JFrame {
|
||||
private JTextField _nameField;
|
||||
private JTable _attributesTable;
|
||||
private JScrollPane _scrollAttributes;
|
||||
private String[] _attributesColumns = {"Name", "Access modifier", "Type"};
|
||||
private String[] _attributesColumns = {"Name", "Access modifier", "Type", "Static", "Final", "Abstract", "Synchronised", "Volatile", "Transient"};
|
||||
private DefaultTableModel _attributeModel;
|
||||
private JTable _methodsTable;
|
||||
private JScrollPane _scrollMethods;
|
||||
private String[] _methodsColumns = {"Name", "Access modifier", "Type", "Arguments"};
|
||||
private String[] _methodsColumns = {"Name", "Access modifier", "Type", "Arguments", "Static", "Final", "Abstract", "Synchronised", "Volatile", "Transient"};
|
||||
private DefaultTableModel _methodModel;
|
||||
|
||||
|
||||
@@ -170,6 +170,7 @@ public class ClassPropertiesWindow extends JFrame {
|
||||
|
||||
/**
|
||||
* Ouvre une fenêtre d'édition des arguments pour la méthode sélectionnée
|
||||
* @param m La méthode dans laquelle seront modifiés les arguments.
|
||||
*/
|
||||
public void openArgumentsWindow(Method m){
|
||||
ArgumentsPropertiesWindow argsWin = new ArgumentsPropertiesWindow(this, _umlDiagram, m);
|
||||
@@ -221,7 +222,7 @@ public class ClassPropertiesWindow extends JFrame {
|
||||
access = "PROTECTED";
|
||||
break;
|
||||
}
|
||||
_attributeModel.addRow(new Object[]{attr.getName(), access, attr.getType()});
|
||||
_attributeModel.addRow(new Object[]{attr.getName(), access, attr.getType(), attr.isStatic(), attr.isFinal(), attr.isAbstract(), attr.isSynchronized(), attr.isVolatile(), attr.isTransient()});
|
||||
}
|
||||
//On ajoute les contrôles pour chaque colonne
|
||||
JComboBox accessComboBox = new JComboBox();
|
||||
@@ -245,6 +246,25 @@ public class ClassPropertiesWindow extends JFrame {
|
||||
typeComboBox.addItem("String");
|
||||
TableColumn typeColumn = _attributesTable.getColumn(_attributesColumns[2]);
|
||||
typeColumn.setCellEditor(new DefaultCellEditor(typeComboBox));
|
||||
|
||||
JCheckBox staticComboBox = new JCheckBox();
|
||||
TableColumn staticColumn = _attributesTable.getColumn(_attributesColumns[3]);
|
||||
staticColumn.setCellEditor(new DefaultCellEditor(staticComboBox));
|
||||
JCheckBox finalComboBox = new JCheckBox();
|
||||
TableColumn finalColumn = _attributesTable.getColumn(_attributesColumns[4]);
|
||||
finalColumn.setCellEditor(new DefaultCellEditor(finalComboBox));
|
||||
JCheckBox abstractComboBox = new JCheckBox();
|
||||
TableColumn abstractColumn = _attributesTable.getColumn(_attributesColumns[5]);
|
||||
abstractColumn.setCellEditor(new DefaultCellEditor(abstractComboBox));
|
||||
JCheckBox synchronizedComboBox = new JCheckBox();
|
||||
TableColumn synchronizedColumn = _attributesTable.getColumn(_attributesColumns[6]);
|
||||
synchronizedColumn.setCellEditor(new DefaultCellEditor(synchronizedComboBox));
|
||||
JCheckBox volatileComboBox = new JCheckBox();
|
||||
TableColumn volatileColumn = _attributesTable.getColumn(_attributesColumns[7]);
|
||||
volatileColumn.setCellEditor(new DefaultCellEditor(volatileComboBox));
|
||||
JCheckBox transientComboBox = new JCheckBox();
|
||||
TableColumn transientColumn = _attributesTable.getColumn(_attributesColumns[8]);
|
||||
transientColumn.setCellEditor(new DefaultCellEditor(transientComboBox));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -285,7 +305,7 @@ public class ClassPropertiesWindow extends JFrame {
|
||||
access = "PROTECTED";
|
||||
break;
|
||||
}
|
||||
_methodModel.addRow(new Object[]{meth.getName(), access, meth.getType(), "..."});
|
||||
_methodModel.addRow(new Object[]{meth.getName(), access, meth.getType(), "...", meth.isStatic(), meth.isFinal(), meth.isAbstract(), meth.isSynchronized(), meth.isVolatile(), meth.isTransient()});
|
||||
}
|
||||
//On ajoute les contrôles pour chaque colonne
|
||||
JComboBox accessComboBox = new JComboBox();
|
||||
@@ -314,6 +334,25 @@ public class ClassPropertiesWindow extends JFrame {
|
||||
argsField.setEnabled(false);
|
||||
TableColumn argColumn = _methodsTable.getColumn(_methodsColumns[3]);
|
||||
argColumn.setCellEditor(new DefaultCellEditor(argsField));
|
||||
|
||||
JCheckBox staticComboBox = new JCheckBox();
|
||||
TableColumn staticColumn = _methodsTable.getColumn(_methodsColumns[4]);
|
||||
staticColumn.setCellEditor(new DefaultCellEditor(staticComboBox));
|
||||
JCheckBox finalComboBox = new JCheckBox();
|
||||
TableColumn finalColumn = _methodsTable.getColumn(_methodsColumns[5]);
|
||||
finalColumn.setCellEditor(new DefaultCellEditor(finalComboBox));
|
||||
JCheckBox abstractComboBox = new JCheckBox();
|
||||
TableColumn abstractColumn = _methodsTable.getColumn(_methodsColumns[6]);
|
||||
abstractColumn.setCellEditor(new DefaultCellEditor(abstractComboBox));
|
||||
JCheckBox synchronizedComboBox = new JCheckBox();
|
||||
TableColumn synchronizedColumn = _methodsTable.getColumn(_methodsColumns[7]);
|
||||
synchronizedColumn.setCellEditor(new DefaultCellEditor(synchronizedComboBox));
|
||||
JCheckBox volatileComboBox = new JCheckBox();
|
||||
TableColumn volatileColumn = _methodsTable.getColumn(_methodsColumns[8]);
|
||||
volatileColumn.setCellEditor(new DefaultCellEditor(volatileComboBox));
|
||||
JCheckBox transientComboBox = new JCheckBox();
|
||||
TableColumn transientColumn = _methodsTable.getColumn(_methodsColumns[9]);
|
||||
transientColumn.setCellEditor(new DefaultCellEditor(transientComboBox));
|
||||
}
|
||||
|
||||
|
||||
@@ -340,8 +379,14 @@ public class ClassPropertiesWindow extends JFrame {
|
||||
_class.getAttributes().get(i).setAccess(Attribute.PROTECTED);
|
||||
break;
|
||||
}
|
||||
_class.getAttributes().get(i).setType(vect.get(2).toString());
|
||||
_class.getAttributes().get(i).setName(vect.get(0).toString());
|
||||
_class.getAttributes().get(i).setType(vect.get(2).toString());
|
||||
_class.getAttributes().get(i).setStatic((boolean) vect.get(3));
|
||||
_class.getAttributes().get(i).setFinal((boolean) vect.get(4));
|
||||
_class.getAttributes().get(i).setAbstract((boolean) vect.get(5));
|
||||
_class.getAttributes().get(i).setSynchronized((boolean) vect.get(6));
|
||||
_class.getAttributes().get(i).setVolatile((boolean) vect.get(7));
|
||||
_class.getAttributes().get(i).setTransient((boolean) vect.get(8));
|
||||
}
|
||||
//Enregistrement des méthodes
|
||||
_methodsTable.editCellAt(0,0);
|
||||
@@ -359,8 +404,14 @@ public class ClassPropertiesWindow extends JFrame {
|
||||
_class.getMethods().get(i).setAccess(Method.PROTECTED);
|
||||
break;
|
||||
}
|
||||
_class.getMethods().get(i).setType(vect.get(2).toString());
|
||||
_class.getMethods().get(i).setName(vect.get(0).toString());
|
||||
_class.getMethods().get(i).setType(vect.get(2).toString());
|
||||
_class.getMethods().get(i).setStatic((boolean) vect.get(4));
|
||||
_class.getMethods().get(i).setFinal((boolean) vect.get(5));
|
||||
_class.getMethods().get(i).setAbstract((boolean) vect.get(6));
|
||||
_class.getMethods().get(i).setSynchronized((boolean) vect.get(7));
|
||||
_class.getMethods().get(i).setVolatile((boolean) vect.get(8));
|
||||
_class.getMethods().get(i).setTransient((boolean) vect.get(9));
|
||||
}
|
||||
|
||||
//Rafraichissement de l'affichage
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Gère un lien entre deux classes.
|
||||
* @author V.BOULANGER
|
||||
*/
|
||||
public class Link {
|
||||
public class Link implements Serializable{
|
||||
|
||||
public static int _linkId = 0;
|
||||
public static final int STRONG = 0;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -5,7 +6,7 @@ import java.util.List;
|
||||
* Gère une méthode.
|
||||
* @author V.BOULANGER
|
||||
*/
|
||||
public class Method {
|
||||
public class Method implements Serializable {
|
||||
|
||||
public static int _methodId = 0;
|
||||
public static final String PRIVATE = "-";
|
||||
@@ -17,6 +18,12 @@ public class Method {
|
||||
private String _type;
|
||||
private String _name;
|
||||
private List<Argument> _arguments;
|
||||
private boolean _isStatic;
|
||||
private boolean _isFinal;
|
||||
private boolean _isAbstract;
|
||||
private boolean _isSynchronized;
|
||||
private boolean _isVolatile;
|
||||
private boolean _isTransient;
|
||||
|
||||
/**
|
||||
* Constructeur - Crée une instance de Method.
|
||||
@@ -140,4 +147,100 @@ public class Method {
|
||||
public void clearArguments(){
|
||||
this._arguments.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne si l'attribut est statique ou non.
|
||||
* @return true : l'attribut est statique, false: l'attribut n'est pas statique.
|
||||
*/
|
||||
public boolean isStatic() {
|
||||
return _isStatic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paramètre la caractéristique statique de l'attribut.
|
||||
* @param s true : l'attribut est statique, false : l'attribut n'est pas statique
|
||||
*/
|
||||
public void setStatic(boolean s) {
|
||||
this._isStatic = s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne si l'attribut est final ou non.
|
||||
* @return true : l'attribut est final, false: l'attribut n'est pas final.
|
||||
*/
|
||||
public boolean isFinal() {
|
||||
return _isFinal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paramètre la caractéristique final de l'attribut.
|
||||
* @param f true : l'attribut est final, false : l'attribut n'est pas final
|
||||
*/
|
||||
public void setFinal(boolean f) {
|
||||
this._isFinal = f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne si l'attribut est abstrait ou non.
|
||||
* @return true : l'attribut est abstrait, false: l'attribut n'est pas abstrait.
|
||||
*/
|
||||
public boolean isAbstract() {
|
||||
return _isAbstract;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paramètre la caractéristique abstraite de l'attribut.
|
||||
* @param a true : l'attribut est abstrait, false : l'attribut n'est pas abstrait.
|
||||
*/
|
||||
public void setAbstract(boolean a) {
|
||||
this._isAbstract = a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne si l'attribut est synchronisé ou non.
|
||||
* @return true : l'attribut est synchronisé, false: l'attribut n'est pas synchronisé.
|
||||
*/
|
||||
public boolean isSynchronized() {
|
||||
return _isSynchronized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paramètre la caractéristique synchronisée de l'attribut.
|
||||
* @param s true : l'attribut est synchronisé, false : l'attribut n'est pas synchronisé.
|
||||
*/
|
||||
public void setSynchronized(boolean s) {
|
||||
this._isSynchronized = s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne si l'attribut est volatile ou non.
|
||||
* @return true : l'attribut est volatile, false: l'attribut n'est pas volatile.
|
||||
*/
|
||||
public boolean isVolatile() {
|
||||
return _isVolatile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paramètre la caractéristique volatile de l'attribut.
|
||||
* @param v true : l'attribut est volatile, false : l'attribut n'est pas volatile
|
||||
*/
|
||||
public void setVolatile(boolean v) {
|
||||
this._isVolatile = v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne si l'attribut est transitoire ou non.
|
||||
* @return true : l'attribut est transitoire, false: l'attribut n'est pas transitoire.
|
||||
*/
|
||||
public boolean isTransient() {
|
||||
return _isTransient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paramètre la caractéristique transitoire de l'attribut.
|
||||
* @param t true : l'attribut est transitoire, false : l'attribut n'est pas transitoire
|
||||
*/
|
||||
public void setTransient(boolean t) {
|
||||
this._isTransient = t;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -5,7 +6,7 @@ import java.util.List;
|
||||
* Gère un projet.
|
||||
* @author V.BOULANGER
|
||||
*/
|
||||
public class Project {
|
||||
public class Project implements Serializable {
|
||||
|
||||
public static int _projectId = 0;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -10,7 +11,7 @@ import java.util.List;
|
||||
* Cette classe permet d'afficher l'ensemble des éléments du projet sous la forme d'un diagramme UML.
|
||||
* @author V.BOULANGER
|
||||
*/
|
||||
public class UmlDiagram extends JPanel implements MouseListener, MouseMotionListener {
|
||||
public class UmlDiagram extends JPanel implements MouseListener, MouseMotionListener, Serializable {
|
||||
|
||||
private Project _project;
|
||||
private AppThinkerToolbar _toolbar;
|
||||
@@ -71,6 +72,8 @@ public class UmlDiagram extends JPanel implements MouseListener, MouseMotionList
|
||||
for(Attribute b : a.getAttributes()){
|
||||
posCounter += font2.getSize();
|
||||
g.drawString(b.getAccess() + " " + b.getName() + " : " + b.getType(), posX, posCounter);
|
||||
//Si l'attribut est statique, on le souligne
|
||||
if(b.isStatic()) g.drawLine(a.getPosX()-a.getSizeX()/2+10, posCounter+1, a.getPosX()+a.getSizeX()/2-10, posCounter+1);
|
||||
}
|
||||
posCounter += 5;
|
||||
g.setColor(new Color(218, 233, 244));
|
||||
@@ -90,6 +93,9 @@ public class UmlDiagram extends JPanel implements MouseListener, MouseMotionList
|
||||
//chain = chain.substring(0, chain.length()-2);
|
||||
chain += String.join(", ", listArguments) + ") : " + m.getType();
|
||||
g.drawString(chain, posX, posCounter);
|
||||
//Si l'attribut est statique, on le souligne
|
||||
if(m.isStatic()) g.drawLine(a.getPosX()-a.getSizeX()/2+10, posCounter+1, a.getPosX()+a.getSizeX()/2-10, posCounter+1);
|
||||
|
||||
}
|
||||
//Si la classe est sélectionnée
|
||||
if((Class)_selected == a){
|
||||
|
||||
Reference in New Issue
Block a user