@@ -44,10 +44,8 @@ public class AppThinkerToolbar extends JPanel {
|
||||
|
||||
/**
|
||||
* Constructeur de la classe AppThinkerToolbar
|
||||
* @param window Une instance de AppThinkerWindow.
|
||||
*/
|
||||
public AppThinkerToolbar(AppThinkerWindow window){
|
||||
this._window = window;
|
||||
public AppThinkerToolbar(){
|
||||
//Création de la Toolbar
|
||||
this.setLayout(new GridLayout(2,3, 10, 0));
|
||||
this.setBackground(new Color(69, 69, 72));
|
||||
@@ -63,7 +61,7 @@ public class AppThinkerToolbar extends JPanel {
|
||||
_newProject.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
_window.newProject();
|
||||
AppThinker.newProject();
|
||||
}
|
||||
});
|
||||
_projectPanel.add(_newProject);
|
||||
@@ -96,7 +94,7 @@ public class AppThinkerToolbar extends JPanel {
|
||||
_select.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
changeTool(AppThinkerToolbar.SELECT_TOOL);
|
||||
setCurrentTool(AppThinkerToolbar.SELECT_TOOL);
|
||||
}
|
||||
});
|
||||
_editionPanel.add(_select);
|
||||
@@ -108,7 +106,7 @@ public class AppThinkerToolbar extends JPanel {
|
||||
_edit.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
changeTool(AppThinkerToolbar.EDIT_TOOL);
|
||||
setCurrentTool(AppThinkerToolbar.EDIT_TOOL);
|
||||
}
|
||||
});
|
||||
_editionPanel.add(_edit);
|
||||
@@ -120,7 +118,7 @@ public class AppThinkerToolbar extends JPanel {
|
||||
_delete.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
changeTool(AppThinkerToolbar.DELETE_TOOL);
|
||||
setCurrentTool(AppThinkerToolbar.DELETE_TOOL);
|
||||
}
|
||||
});
|
||||
_editionPanel.add(_delete);
|
||||
@@ -132,7 +130,7 @@ public class AppThinkerToolbar extends JPanel {
|
||||
_copy.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
changeTool(AppThinkerToolbar.COPY_TOOL);
|
||||
setCurrentTool(AppThinkerToolbar.COPY_TOOL);
|
||||
}
|
||||
});
|
||||
_editionPanel.add(_copy);
|
||||
@@ -144,7 +142,7 @@ public class AppThinkerToolbar extends JPanel {
|
||||
_paste.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
changeTool(AppThinkerToolbar.PASTE_TOOL);
|
||||
setCurrentTool(AppThinkerToolbar.PASTE_TOOL);
|
||||
}
|
||||
});
|
||||
_editionPanel.add(_paste);
|
||||
@@ -171,7 +169,7 @@ public class AppThinkerToolbar extends JPanel {
|
||||
_newClass.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
changeTool(AppThinkerToolbar.CLASS_TOOL);
|
||||
setCurrentTool(AppThinkerToolbar.CLASS_TOOL);
|
||||
}
|
||||
});
|
||||
_modelisationPanel.add(_newClass);
|
||||
@@ -183,7 +181,7 @@ public class AppThinkerToolbar extends JPanel {
|
||||
_newAssociation.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
changeTool(AppThinkerToolbar.ASSOCIATION_TOOL);
|
||||
setCurrentTool(AppThinkerToolbar.ASSOCIATION_TOOL);
|
||||
}
|
||||
});
|
||||
_modelisationPanel.add(_newAssociation);
|
||||
@@ -195,7 +193,7 @@ public class AppThinkerToolbar extends JPanel {
|
||||
_newLink.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
changeTool(AppThinkerToolbar.LINK_TOOL);
|
||||
setCurrentTool(AppThinkerToolbar.LINK_TOOL);
|
||||
}
|
||||
});
|
||||
_modelisationPanel.add(_newLink);
|
||||
@@ -222,7 +220,6 @@ public class AppThinkerToolbar extends JPanel {
|
||||
/**
|
||||
* Active les boutons d'édition lorsqu'un projet est ouvert
|
||||
*/
|
||||
|
||||
public void enableEditing(){
|
||||
_newProject.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(){
|
||||
this._projectPanel.updateUI();
|
||||
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();
|
||||
public int getCurrentTool(){
|
||||
return this._currentTool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change d'outil pour l'édition du diagramme.
|
||||
* @param tool L'outil cible.
|
||||
* @param currentTool L'outil cible.
|
||||
*/
|
||||
public void changeTool(int tool){
|
||||
this._currentTool = tool;
|
||||
if(this._currentTool == AppThinkerToolbar.SELECT_TOOL) this._window.getGrid().setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
else this._window.getGrid().setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
|
||||
switch(tool){
|
||||
public void setCurrentTool(int currentTool){
|
||||
this._currentTool = currentTool;
|
||||
if(this._currentTool == AppThinkerToolbar.SELECT_TOOL) AppThinker.getProject().getGrid().getDiagram().setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
else AppThinker.getProject().getGrid().getDiagram().setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
|
||||
switch(currentTool){
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user