Commit 178cc4eb30d9e24fddfd26a367c1f3cacb5aca1e
1 parent
02c44758
fix(conflict)
Showing
9 changed files
with
41 additions
and
46 deletions
Show diff stats
.Rhistory deleted
grid.data
No preview for this file type
grille.ser deleted
No preview for this file type
src/ihm/TablooProto$MyTableModel.class deleted
No preview for this file type
src/ihm/TablooProto$PremiereColonneSpecificRenderer.class deleted
No preview for this file type
src/ihm/TablooProto.class deleted
No preview for this file type
src/ihm/TablooProto.java
@@ -2,27 +2,11 @@ package ihm; | @@ -2,27 +2,11 @@ package ihm; | ||
2 | 2 | ||
3 | /* | 3 | /* |
4 | * TablooProto.java requires no other files. | 4 | * TablooProto.java requires no other files. |
5 | - * | 5 | + * |
6 | */ | 6 | */ |
7 | -import java.awt.Color; | ||
8 | -import java.awt.Component; | ||
9 | -import javax.swing.JFrame; | ||
10 | -import javax.swing.JScrollPane; | ||
11 | -import javax.swing.JTable; | ||
12 | -import javax.swing.table.AbstractTableModel; | ||
13 | -import java.awt.Dimension; | ||
14 | -import java.awt.GridLayout; | ||
15 | -import java.io.File; | ||
16 | -import java.io.FileInputStream; | ||
17 | -import java.io.FileNotFoundException; | ||
18 | -import java.io.IOException; | ||
19 | -import java.io.ObjectInputStream; | ||
20 | - | ||
21 | -import javax.swing.JLabel; | ||
22 | -import javax.swing.JPanel; | ||
23 | -import javax.swing.table.DefaultTableCellRenderer; | ||
24 | -import javax.swing.table.TableColumn; | ||
25 | 7 | ||
8 | +import kernel.Cell; | ||
9 | +import kernel.Formula; | ||
26 | import kernel.Grid; | 10 | import kernel.Grid; |
27 | import kernel.exception.*; | 11 | import kernel.exception.*; |
28 | import kernel.function.Average; | 12 | import kernel.function.Average; |
@@ -49,7 +33,7 @@ import java.util.stream.Collectors; | @@ -49,7 +33,7 @@ import java.util.stream.Collectors; | ||
49 | 33 | ||
50 | public class TablooProto extends JPanel { | 34 | public class TablooProto extends JPanel { |
51 | 35 | ||
52 | - static Grid grid; | 36 | + private static Grid grid; |
53 | 37 | ||
54 | // Fourni: ne rien changer. | 38 | // Fourni: ne rien changer. |
55 | public TablooProto(Grid grid) throws ClassNotFoundException, IOException { | 39 | public TablooProto(Grid grid) throws ClassNotFoundException, IOException { |
@@ -88,32 +72,31 @@ public class TablooProto extends JPanel { | @@ -88,32 +72,31 @@ public class TablooProto extends JPanel { | ||
88 | * | 72 | * |
89 | */ | 73 | */ |
90 | Color couleur; | 74 | Color couleur; |
91 | - | ||
92 | - public PremiereColonneSpecificRenderer(Color couleur) { | ||
93 | - super(); | ||
94 | - this.couleur = couleur; | ||
95 | - this.setHorizontalAlignment(JLabel.CENTER); | ||
96 | - } | ||
97 | - | ||
98 | - @Override | ||
99 | - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { | ||
100 | - Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); | ||
101 | - cell.setBackground(couleur); | ||
102 | - return cell; | ||
103 | - } | ||
104 | - } | ||
105 | - | ||
106 | - // Inner class pour etablir la connexion entre la JTable graphique et un modele de donnees. | ||
107 | - // Pour nous le modele de donnees sera une grille du noyau de representation et de calcul | ||
108 | - // construite et sauvegardee par serialisation comme precedemmment. | ||
109 | - // Dans ce prototype exemple, le modele de donnees est une simple matrice de String "en dur". | ||
110 | - // Il faudra le remplacer par une connexion a une telle grille. | ||
111 | - class MyTableModel extends AbstractTableModel { | ||
112 | - | ||
113 | - /** | ||
114 | - * | 75 | + |
76 | + public PremiereColonneSpecificRenderer(Color couleur) { | ||
77 | + super(); | ||
78 | + this.couleur = couleur; | ||
79 | + this.setHorizontalAlignment(JLabel.CENTER); | ||
80 | + } | ||
81 | + | ||
82 | + @Override | ||
83 | + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { | ||
84 | + Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); | ||
85 | + cell.setBackground(couleur); | ||
86 | + return cell; | ||
87 | + } | ||
88 | + } | ||
89 | + | ||
90 | + // Inner class pour etablir la connexion entre la JTable graphique et un modele de donnees. | ||
91 | + // Pour nous le modele de donnees sera une grille du noyau de representation et de calcul | ||
92 | + // construite et sauvegardee par serialisation comme precedemmment. | ||
93 | + // Dans ce prototype exemple, le modele de donnees est une simple matrice de String "en dur". | ||
94 | + // Il faudra le remplacer par une connexion a une telle grille. | ||
95 | + class MyTableModel extends AbstractTableModel { | ||
96 | + | ||
97 | + /** | ||
98 | + * | ||
115 | */ | 99 | */ |
116 | - private static final long serialVersionUID = 1L; | ||
117 | private Grid grid; | 100 | private Grid grid; |
118 | 101 | ||
119 | MyTableModel(Grid grid) { | 102 | MyTableModel(Grid grid) { |
@@ -163,7 +146,7 @@ public class TablooProto extends JPanel { | @@ -163,7 +146,7 @@ public class TablooProto extends JPanel { | ||
163 | // TODO Auto-generated catch block | 146 | // TODO Auto-generated catch block |
164 | 147 | ||
165 | } | 148 | } |
166 | - } | 149 | + } |
167 | return ""; | 150 | return ""; |
168 | } | 151 | } |
169 | 152 |
src/kernel/Grid.java
@@ -60,6 +60,10 @@ public class Grid implements Serializable { | @@ -60,6 +60,10 @@ public class Grid implements Serializable { | ||
60 | throw new CellNotFoundException(); | 60 | throw new CellNotFoundException(); |
61 | } | 61 | } |
62 | 62 | ||
63 | + public Cell getCell(String id) { | ||
64 | + return this.cells.get(id); | ||
65 | + } | ||
66 | + | ||
63 | public List<Cell> getCells() { | 67 | public List<Cell> getCells() { |
64 | return new ArrayList<>(this.cells.values()); | 68 | return new ArrayList<>(this.cells.values()); |
65 | } | 69 | } |