This commit is contained in:
pro.boooooo
2023-01-16 00:28:42 +01:00
parent 3e172218a6
commit 5d7acefae2
15 changed files with 8712 additions and 178 deletions

View File

@@ -1,9 +1,9 @@
package JsonInspector.Graphics;
package fr.sae.JSonInspector.Graphics;
import JsonInspector.Exception.JsonSyntaxException;
import JsonInspector.Main;
import JsonInspector.Settings.Parameters;
import JsonInspector.Storage.Tree;
import fr.sae.JSonInspector.Exception.JsonSyntaxException;
import fr.sae.JSonInspector.Main;
import fr.sae.JSonInspector.Settings.Parameters;
import fr.sae.JSonInspector.Storage.Tree;
import javax.swing.*;
import java.awt.*;
@@ -20,27 +20,25 @@ public class Frame extends JFrame {
private GraphicFile file;
private Tree tree;
public Frame() {
super("Inspecteur JSON");
init();
this.setVisible(true);
}
private void init() {
this.setSize(DEFAULT_FRAME_SIZE);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setMinimumSize(MINIMUM_FRAME_SIZE);
this.setLayout(cards);
this.add(firstCard());
//this.add(secondCard());
// this.add(secondCard());
cards.first(this.getContentPane());
}
/**
* Créer le premier panel où l'on entre l'URL du fichier
*
* @return le panel créé
*/
private JPanel firstCard() {
@@ -53,8 +51,8 @@ public class Frame extends JFrame {
panel.setLayout(layout);
gbc.insets = new Insets(10, 10, 10, 10);
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridx = 0;
gbc.gridy = 0;
JLabel label = new JLabel("URL :");
label.setForeground(Parameters.DEFAULT_TEXT_COLOR);
panel.add(label, gbc);
@@ -62,8 +60,8 @@ public class Frame extends JFrame {
gbc.gridx = 1;
panel.add(textField, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 2;
panel.add(button, gbc);
@@ -71,9 +69,9 @@ public class Frame extends JFrame {
return panel;
}
/**
* Créer le deuxième panel où l'on voit le fichier
*
* @return le panel créé
*/
private JPanel secondCard() {
@@ -81,9 +79,9 @@ public class Frame extends JFrame {
return initSecondCard(file);
}
/**
* Créer le deuxième panel où l'on voit le fichier
*
* @return le panel créé
*/
private JPanel secondCard(GraphicFile file) {
@@ -91,7 +89,6 @@ public class Frame extends JFrame {
return initSecondCard(file);
}
private JPanel initSecondCard(GraphicFile file) {
JButton unfoldButton = new JButton("Tout déplier");
JButton retreatButton = new JButton("Tout replier");
@@ -125,7 +122,6 @@ public class Frame extends JFrame {
return mainPanel;
}
/**
* Passe de la version PHP du fichier à la version JSON et vice-versa
*/
@@ -139,7 +135,6 @@ public class Frame extends JFrame {
repaintFile();
}
/**
* Déplit l'élément cliqué
*/
@@ -148,7 +143,6 @@ public class Frame extends JFrame {
repaintFile();
}
/**
* Replit l'élément cliqué
*/
@@ -157,7 +151,6 @@ public class Frame extends JFrame {
repaintFile();
}
/**
* Met à jour le fichier
*/
@@ -169,9 +162,9 @@ public class Frame extends JFrame {
cards.last(this.getContentPane());
}
/**
* Passe du premier panel au second
*
* @param field le champ contenant l'URL
*/
private void validationAction(JTextField field) {
@@ -199,10 +192,10 @@ public class Frame extends JFrame {
}
}
/**
* Passe du second panel au premier
* @param panel
*
* @param panel
*/
private void backAction(JPanel panel) {
this.remove(panel);