This commit is contained in:
Bilou 2023-01-08 07:30:49 +01:00
parent a357b0ec5d
commit 62ef69f0b4
14 changed files with 56 additions and 10 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,12 +3,12 @@ package Graphics;
import java.io.InputStream; import java.io.InputStream;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import Graphics.Type.*; import Graphics.Type.*;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.util.List;
import java.awt.GridBagConstraints; import java.awt.GridBagConstraints;
import java.awt.GridBagLayout; import java.awt.GridBagLayout;
import java.awt.Color; import java.awt.Color;
@ -48,18 +48,28 @@ public class GraphicFile extends JPanel {
settings.gridx = 2; settings.gridx = 2;
for (String key : allVariables.keySet()) { for (String key : allVariables.keySet()) {
JPanel fusion = new JPanel(new GridLayout(1, 1));
settings.gridy = rows; settings.gridy = rows;
JLabel name = new JLabel("\"" + key + "\": "); JLabel name = new JLabel("\"" + key + "\": ");
name.setForeground(new Color(163, 90, 0)); name.setForeground(new Color(163, 90, 0));
JLabel value = new JLabel(allVariables.get(key).display());
value.setForeground(allVariables.get(key).getColor());
JPanel fusion = new JPanel(new GridLayout(1, 1));
fusion.add(name); fusion.add(name);
if (allVariables.get(key).getClass().getName() != "Graphics.Type.Array") {
fusion.add(value); JLabel value = new JLabel(allVariables.get(key).display());
value.setForeground(allVariables.get(key).getColor());
fusion.add(value);
} else {
JPanel speForArray = new JPanel();
speForArray.add(new JLabel("[ "));
for (int i = 0; i <= allVariables.get(key).listGet().size() - 1; i++) {
JLabel tmp = new JLabel(String.valueOf(allVariables.get(key).listGet().get(i).display()));
tmp.setForeground(allVariables.get(key).listGet().get(i).getColor());
speForArray.add(tmp);
}
speForArray.add(new JLabel(" ]"));
fusion.add(speForArray);
}
core.add(fusion, settings); core.add(fusion, settings);
rows++; rows++;

View File

@ -74,6 +74,11 @@ public class Array implements Type<List<Type<?>>> {
return this.valueRaw; return this.valueRaw;
} }
@Override
public List<Type<?>> listGet() {
return this.value;
}
@Override @Override
public Color getColor() { public Color getColor() {
return this.color; return this.color;

View File

@ -1,6 +1,7 @@
package Graphics.Type; package Graphics.Type;
import java.awt.Color; import java.awt.Color;
import java.util.List;
/** /**
* Representation du type boolean * Representation du type boolean
@ -19,6 +20,11 @@ public class Bool implements Type<Boolean> {
} }
} }
@Override
public List<Type<?>> listGet() {
return null;
}
@Override @Override
public Color getColor() { public Color getColor() {
return this.color; return this.color;

View File

@ -1,6 +1,7 @@
package Graphics.Type; package Graphics.Type;
import java.awt.Color; import java.awt.Color;
import java.util.List;
/** /**
* Representation du type string * Representation du type string
@ -15,6 +16,11 @@ public class Chaine implements Type<String> {
this.color = Color.PINK; this.color = Color.PINK;
} }
@Override
public List<Type<?>> listGet() {
return null;
}
@Override @Override
public Color getColor() { public Color getColor() {
return this.color; return this.color;

View File

@ -1,6 +1,7 @@
package Graphics.Type; package Graphics.Type;
import java.awt.Color; import java.awt.Color;
import java.util.List;
/** /**
* Representation du type int * Representation du type int
@ -15,6 +16,11 @@ public class Entier implements Type<Integer> {
this.color = Color.BLUE; this.color = Color.BLUE;
} }
@Override
public List<Type<?>> listGet() {
return null;
}
@Override @Override
public Color getColor() { public Color getColor() {
return this.color; return this.color;

View File

@ -1,6 +1,7 @@
package Graphics.Type; package Graphics.Type;
import java.awt.Color; import java.awt.Color;
import java.util.List;
/** /**
* Representation du type double * Representation du type double
@ -15,6 +16,11 @@ public class Flottant implements Type<Double> {
this.color = Color.BLUE; this.color = Color.BLUE;
} }
@Override
public List<Type<?>> listGet() {
return null;
}
@Override @Override
public Color getColor() { public Color getColor() {
return this.color; return this.color;

View File

@ -1,6 +1,7 @@
package Graphics.Type; package Graphics.Type;
import java.awt.Color; import java.awt.Color;
import java.util.List;
public interface Type<T> { public interface Type<T> {
/** /**
@ -11,9 +12,8 @@ public interface Type<T> {
public String getType(); public String getType();
/** /**
* Recuperer la valeur de la variable
* *
* @return La valeur du resultat * @return
*/ */
public T getValue(); public T getValue();
@ -26,4 +26,11 @@ public interface Type<T> {
* Afficher la valeur / toutes les valeurs * Afficher la valeur / toutes les valeurs
*/ */
public String display(); public String display();
/**
* UNIQUEMENT POUR Graphics.Type.Chaine
*
* @return La liste contenant les valeurs du tableau
*/
public List<Type<?>> listGet();
} }