Résolution #34 LRafraichissement labels de taille

This commit is contained in:
2020-12-20 18:04:40 +01:00
parent 736e644861
commit f1de38b2fb
32 changed files with 2035 additions and 1705 deletions

View File

@@ -15,8 +15,11 @@ public class UmlToolbar extends JPanel {
public static final int COPY_TOOL = 3;
public static final int PASTE_TOOL = 4;
public static final int CLASS_TOOL = 5;
public static final int ASSOCIATION_TOOL = 6;
public static final int LINK_TOOL = 7;
public static final int STRONG_TOOL = 6;
public static final int WEAK_TOOL = 7;
public static final int COMPOSITION_TOOL = 8;
public static final int AGGREGATION_TOOL = 9;
public static final int INHERITANCE_TOOL = 10;
private int _currentTool = 0;
@@ -31,8 +34,11 @@ public class UmlToolbar extends JPanel {
private JPanel _modelisationPanel;
private JButton _newClass;
private JButton _newAssociation;
private JButton _newLink;
private JButton _newStrong;
private JButton _newWeak;
private JButton _newComposition;
private JButton _newAggregation;
private JButton _newInheritance;
private UmlDiagram _umlDiagram;
@@ -135,30 +141,71 @@ public class UmlToolbar extends JPanel {
}
});
_modelisationPanel.add(_newClass);
_newAssociation = new JButton();
_newAssociation.setSize(32, 32);
_newAssociation.setBorderPainted(false);
_newAssociation.setIcon(new ImageIcon(getClass().getResource("img/x32/newAssociation.png")));
_newAssociation.setToolTipText("Add a new association.");
_newAssociation.addActionListener(new ActionListener() {
_newStrong = new JButton();
_newStrong.setSize(32, 32);
_newStrong.setBorderPainted(false);
_newStrong.setIcon(new ImageIcon(getClass().getResource("img/x32/strongRelation.png")));
_newStrong.setToolTipText("<html>Add a <b>strong relation</b>.<br>A <b>strong relation</b> is a relation that will always be verified.<br><i>Eg: Teachers teach courses.</i></html>");
_newStrong.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setCurrentTool(UmlToolbar.ASSOCIATION_TOOL);
setCurrentTool(UmlToolbar.STRONG_TOOL);
}
});
_modelisationPanel.add(_newAssociation);
_newLink = new JButton();
_newLink.setSize(32, 32);
_newLink.setBorderPainted(false);
_newLink.setIcon(new ImageIcon(getClass().getResource("img/x32/newLink.png")));
_newLink.setToolTipText("Add a new link.");
_newLink.addActionListener(new ActionListener() {
_modelisationPanel.add(_newStrong);
_newWeak = new JButton();
_newWeak.setSize(32, 32);
_newWeak.setBorderPainted(false);
_newWeak.setIcon(new ImageIcon(getClass().getResource("img/x32/weakRelation.png")));
_newWeak.setToolTipText("<html>Add a <b>weak relation</b>.<br>A <b>weak relation</b> is a relation that only exists at a particular time.<br><i>Eg: A person has a job when he works for a company.</i></html>");
_newWeak.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setCurrentTool(UmlToolbar.LINK_TOOL);
setCurrentTool(UmlToolbar.WEAK_TOOL);
}
});
_modelisationPanel.add(_newLink);
_modelisationPanel.add(_newWeak);
_newComposition = new JButton();
_newComposition.setSize(32, 32);
_newComposition.setBorderPainted(false);
_newComposition.setIcon(new ImageIcon(getClass().getResource("img/x32/compositionRelation.png")));
_newComposition.setToolTipText("<html>Add a <b>composition relation</b>.<br>It corresponds to the verb <b>'to have'</b>, <b>with the uniqueness</b> of the component side.<br><i>Eg: A caddie have 4 wheels.</i></html>");
_newComposition.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setCurrentTool(UmlToolbar.COMPOSITION_TOOL);
}
});
_modelisationPanel.add(_newComposition);
_newAggregation = new JButton();
_newAggregation.setSize(32, 32);
_newAggregation.setBorderPainted(false);
_newAggregation.setIcon(new ImageIcon(getClass().getResource("img/x32/aggregationRelation.png")));
_newAggregation.setToolTipText("<html>Add an <b>aggregation relation</b>.<br>It corresponds to the verb <b>'to have'</b>, <b>without the uniqueness</b> of the component side.<br><i>Eg: A room has 4 walls. (One wall may be the wall of another room).</i></html>");
_newAggregation.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setCurrentTool(UmlToolbar.AGGREGATION_TOOL);
}
});
_modelisationPanel.add(_newAggregation);
_newInheritance = new JButton();
_newInheritance.setSize(32, 32);
_newInheritance.setBorderPainted(false);
_newInheritance.setIcon(new ImageIcon(getClass().getResource("img/x32/inheritanceRelation.png")));
_newInheritance.setToolTipText("<html>Add an <b>inheritance relation</b>.<br>A class is <b>a specification</b> of another class.<br><i>Eg: An employer is a person.</i></html>");
_newInheritance.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setCurrentTool(UmlToolbar.INHERITANCE_TOOL);
}
});
_modelisationPanel.add(_newInheritance);
this.add(_editionPanel, BorderLayout.CENTER);
this.add(_modelisationPanel, BorderLayout.CENTER);
@@ -189,8 +236,11 @@ public class UmlToolbar extends JPanel {
_redo.setEnabled(enabled);
_newClass.setEnabled(enabled);
_newAssociation.setEnabled(enabled);
_newLink.setEnabled(enabled);
_newStrong.setEnabled(enabled);
_newWeak.setEnabled(enabled);
_newComposition.setEnabled(enabled);
_newAggregation.setEnabled(enabled);
_newInheritance.setEnabled(enabled);
}
/**
@@ -210,32 +260,41 @@ public class UmlToolbar extends JPanel {
if(this._currentTool == UmlToolbar.SELECT_TOOL) _umlDiagram.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
else _umlDiagram.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
switch(currentTool){
case 1:
case EDIT_TOOL:
if(_umlDiagram.getSelected() instanceof Class){
_umlDiagram.editClass((Class) _umlDiagram.getSelected());
}
AppThinker.getWindow().getStatusbar().setStatusMessage("Edit tool - Click an item to edit its properties.");
break;
case 2:
case DELETE_TOOL:
if(_umlDiagram.getSelected() instanceof Class){
_umlDiagram.removeClass((Class) _umlDiagram.getSelected());
}
AppThinker.getWindow().getStatusbar().setStatusMessage("Delete tool - Click an item to delete it.");
break;
case 3:
case COPY_TOOL:
AppThinker.getWindow().getStatusbar().setStatusMessage("Copy tool - Click an item to copy it.");
break;
case 4:
case PASTE_TOOL:
AppThinker.getWindow().getStatusbar().setStatusMessage("Paste tool - Click everywhere to paste the last copied item.");
break;
case 5:
case CLASS_TOOL:
AppThinker.getWindow().getStatusbar().setStatusMessage("Class tool - Click everywhere to add a new class.");
break;
case 6:
AppThinker.getWindow().getStatusbar().setStatusMessage("Association tool - Click everywhere to add a new association.");
case STRONG_TOOL:
AppThinker.getWindow().getStatusbar().setStatusMessage("Strong relation tool - Click on a class, hold, and release on another class.");
break;
case 7:
AppThinker.getWindow().getStatusbar().setStatusMessage("Link tool - Click on a class, hold, and release on another class.");
case WEAK_TOOL:
AppThinker.getWindow().getStatusbar().setStatusMessage("Weak relation tool - Click on a class, hold, and release on another class.");
break;
case COMPOSITION_TOOL:
AppThinker.getWindow().getStatusbar().setStatusMessage("Composition relation tool - Click on a class, hold, and release on another class.");
break;
case AGGREGATION_TOOL:
AppThinker.getWindow().getStatusbar().setStatusMessage("Aggregation relation tool - Click on a class, hold, and release on another class.");
break;
case INHERITANCE_TOOL:
AppThinker.getWindow().getStatusbar().setStatusMessage("Inheritance relation tool - Click on a class, hold, and release on another class.");
break;
default:
AppThinker.getWindow().getStatusbar().setStatusMessage("Select tool - Click an item to select it or move it.");