-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gestion des exemples par fichier json
- Loading branch information
1 parent
f925c19
commit f9590b0
Showing
11 changed files
with
173 additions
and
54 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[ | ||
{ | ||
"id": "1", | ||
"name": "Les Boutons", | ||
"comment": "Exemple de code sur les boutons JavaFX" | ||
}, | ||
{ | ||
"id": "2", | ||
"name": "Les champs texte", | ||
"comment": "Les textField et la vérification de ceux ci" | ||
}, | ||
{ | ||
"id" : "3", | ||
"name": "Les Sliders", | ||
"comment": "Les Slider et quelques exemples d'application" | ||
}, | ||
{ | ||
"id" : "4", | ||
"name": "Le Date picker", | ||
"comment": "test hgkjhgkhjg" | ||
} | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.gerblog.tools; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.gerblog.libexemple.Exemple; | ||
|
||
import java.io.*; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
public class Exempliser { | ||
//List<Exemple> exempleList; | ||
public Exemple[] exTab; | ||
public Exempliser() { | ||
|
||
// this.exempleList = exempleList; | ||
|
||
//FileReader reader = new FileReader(file); | ||
try { | ||
File file = new File(getClass().getResource("/org/gerblog/libexemple/liste_exemples.json").getPath()); | ||
FileReader fileReader = new FileReader(file); | ||
|
||
ObjectMapper mapper = new ObjectMapper(); | ||
this.exTab = mapper.readValue(file,Exemple[].class); | ||
//BufferedReader br = new BufferedReader(fileReader); | ||
|
||
// String st; | ||
// while ((st = br.readLine()) != null) | ||
// System.out.println(st); | ||
} catch (IOException fileNotFoundException) { | ||
fileNotFoundException.printStackTrace(); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.gerblog.tools; | ||
|
||
import javafx.fxml.FXMLLoader; | ||
import javafx.scene.Parent; | ||
import javafx.scene.layout.VBox; | ||
import org.gerblog.gui.exemple.ExempleTileController; | ||
|
||
import java.io.IOException; | ||
|
||
public class GuiTool { | ||
/** | ||
* Génère une tuile avec bouton et commentaire | ||
* @param name nom du bouton | ||
* @param comment commentaire lié au bouton | ||
* @param listBox VBOX dans laquelle est intégré la tuile | ||
* @throws IOException | ||
*/ | ||
public static void genExemple(String name, String comment, VBox listBox) throws IOException { | ||
|
||
FXMLLoader fxmlLoader = new FXMLLoader(GuiTool.class.getResource("/org/gerblog/gui/exemple/exemple_tile.fxml")); | ||
Parent ex = fxmlLoader.load(); | ||
ExempleTileController controller = fxmlLoader.<ExempleTileController>getController(); | ||
controller.setValues(name,comment); | ||
listBox.getChildren().add(ex); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,5 @@ public static boolean verifNum(String champ){ | |
return num.matcher(champ).matches(); | ||
} | ||
} | ||
|
||
|