MAJ terminée. Nous sommes passés en version 14.6.2 . Pour consulter les "releases notes" associées c'est ici :

https://about.gitlab.com/releases/2022/01/11/security-release-gitlab-14-6-2-released/
https://about.gitlab.com/releases/2022/01/04/gitlab-14-6-1-released/

Commit e898a7d2 authored by THEBAULT Antoine's avatar THEBAULT Antoine
Browse files

nouveaux panneaux des places et transitions #1

parent 40b1196c
......@@ -27,16 +27,18 @@
</menus>
</MenuBar>
<Button layoutX="27.0" layoutY="40.0" mnemonicParsing="false" onAction="#oneStep" text="Step" />
<TitledPane fx:id="transitionsPane" animated="false" layoutX="27.0" layoutY="125.0" prefHeight="374.0" prefWidth="283.0" text="transitions">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
</content>
</TitledPane>
<TitledPane fx:id="placesPane" animated="false" layoutX="329.0" layoutY="125.0" prefHeight="374.0" prefWidth="283.0" text="places">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
</content>
</TitledPane>
<TableView fx:id="transitionTable" layoutX="27.0" layoutY="135.0" prefHeight="335.0" prefWidth="253.0">
<columns>
<TableColumn fx:id="transitionName" prefWidth="75.0" text="transition" />
<TableColumn fx:id="Distribution" prefWidth="75.0" text="fired" />
</columns>
</TableView>
<TableView fx:id="placesTable" layoutX="313.0" layoutY="135.0" prefHeight="335.0" prefWidth="262.0">
<columns>
<TableColumn fx:id="name" prefWidth="75.0" text="place" />
<TableColumn fx:id="contents" prefWidth="75.0" text="marked" />
</columns>
</TableView>
</children>
<opaqueInsets>
<Insets />
......
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="529.0" prefWidth="626.0" scaleShape="false" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TextField fx:id="textField" layoutX="218.0" layoutY="77.0" prefHeight="31.0" prefWidth="55.0" />
<Label layoutX="27.0" layoutY="82.0" text="Enter the number of steps :" />
<Button layoutX="280.0" layoutY="77.0" mnemonicParsing="false" onAction="#startSim" text="Ok" />
<MenuBar prefHeight="32.0" prefWidth="626.0">
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
<MenuItem mnemonicParsing="false" onAction="#loadFile" text="Load file" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Edit" />
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" text="About" />
</items>
</Menu>
</menus>
</MenuBar>
<Button layoutX="27.0" layoutY="40.0" mnemonicParsing="false" onAction="#oneStep" text="Step" />
<TitledPane animated="false" layoutX="27.0" layoutY="125.0" prefHeight="374.0" prefWidth="283.0" text="transitions">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<TextField layoutX="14.0" layoutY="14.0" prefHeight="31.0" prefWidth="245.0" />
<Label fx:id="transitionsText" layoutX="14.0" layoutY="58.0" prefHeight="32.0" prefWidth="243.0" text="Label" />
</children>
</AnchorPane>
</content>
</TitledPane>
<TitledPane animated="false" layoutX="329.0" layoutY="125.0" prefHeight="374.0" prefWidth="283.0" text="places">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<TextField layoutX="14.0" layoutY="14.0" prefHeight="31.0" prefWidth="259.0" />
<Label fx:id="placesText" layoutX="14.0" layoutY="63.0" prefHeight="31.0" prefWidth="256.0" text="Label" />
</children>
</AnchorPane>
</content>
</TitledPane>
</children>
<opaqueInsets>
<Insets />
</opaqueInsets>
</Pane>
package DOM;
public class PlaceDom {
String name;
String content;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public PlaceDom(String name, String content) {
super();
this.name = name;
this.content = content;
}
}
package DOM;
public class TransitionDom {
String name;
String distribution;
String pre;
String post;
public TransitionDom(String name, String pre, String post, String distribution) {
super();
this.name = name;
this.distribution = distribution;
this.pre = pre;
this.post = post;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDistribution() {
return distribution;
}
public void setDistribution(String distribution) {
this.distribution = distribution;
}
public String getPre() {
return pre;
}
public void setPre(String pre) {
this.pre = pre;
}
public String getPost() {
return post;
}
public void setPost(String post) {
this.post = post;
}
}
package application;
import java.io.IOException;
import java.util.ArrayList;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Rectangle2D;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.stage.Screen;
import javafx.stage.Stage;
import storSim.place;
import storSim.transition;
public class Controller2 extends Application {
@FXML
static Label placesText;
@FXML
static Label transitionsText;
public void displayPlacesTransitions(ArrayList<place> places, ArrayList<transition> transitions) {
Stage stage = new Stage();
try {
FXMLLoader loader = new FXMLLoader(Controller2.class.getResource("../scheme2.fxml"));
// Set this class as the controller
loader.setController(this);
// Load the scene
stage.setScene(new Scene(loader.load()));
// Setup the window/stage
stage.setTitle("Passing Controllers Example - Layout2");
} catch (IOException e) {
e.printStackTrace();
}
//Scene scene = new Scene((Parent) JfxUtils.loadFxml("../scheme2.fxml"), 1024, 800);
//stage.setScene(scene);
//set up the width and height of the window
Rectangle2D bounds = Screen.getPrimary().getVisualBounds();
//primaryStage.setWidth(bounds.getWidth());
stage.setHeight(bounds.getHeight());
stage.setTitle("StorSim");
String text="";
for (place p:places) {
text+=p.getName();
}
placesText.setText(text);
text="";
for (transition t:transitions) {
text+=t.getName();
}
transitionsText.setText(text);
stage.show();
}
@FXML
public void startSim(ActionEvent event) {
}
@FXML
public void loadFile(ActionEvent event) {
}
@FXML
private void oneStep(ActionEvent event) {
}
@Override
public void start(Stage arg0) throws Exception {
}
}
package application;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.ResourceBundle;
import DOM.PlaceDom;
import DOM.TransitionDom;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.geometry.Rectangle2D;
import javafx.stage.FileChooser;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.stage.Window;
import storSim.place;
import storSim.sim;
import storSim.transition;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
/*import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;*/
import javafx.scene.control.TextField;
import javafx.scene.control.TitledPane;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Region;
import storSim.place;
/**
......@@ -28,7 +51,11 @@ import javafx.scene.control.TextField;
*/
public class Main extends Application {
Stage primaryStage;
static Stage primaryStage;
static Scene scene;
static Pane root;
/**the file of the network to be loaded for the simulation*/
File netFile;
......@@ -37,6 +64,44 @@ public class Main extends Application {
@FXML
TextField textField;
@FXML
static Label placesText;
@FXML
static Label transitionsText;
@FXML
private static TableView<TransitionDom> transitionTable = new TableView<>();
@FXML
private static TableView<PlaceDom> placesTable = new TableView<>();
@FXML
private static TableColumn<PlaceDom, String> name= new TableColumn<PlaceDom, String>("name");
@FXML
private static TableColumn<PlaceDom, String> content= new TableColumn<PlaceDom, String>("content");
@FXML
private static TableColumn<TransitionDom, String> transitionName= new TableColumn<TransitionDom, String>("name");
@FXML
private static TableColumn<TransitionDom, String> Distribution= new TableColumn<TransitionDom, String>("Distribution");
@FXML
private static TableColumn<TransitionDom, String> pre= new TableColumn<TransitionDom, String>("pre");
@FXML
private static TableColumn<TransitionDom, String> post= new TableColumn<TransitionDom, String>("post");
static ObservableList<PlaceDom> placesList = FXCollections.observableArrayList();
static ObservableList<TransitionDom> transitionsList = FXCollections.observableArrayList();
static GridPane grid = new GridPane();
static String netFileUrl="";
static Button oneStep = new Button("One step");
Label transitions = new Label("Transitions");
Label places = new Label("Places");
/**load the file of the petrinet to simulate*/
@FXML
private void loadFile(ActionEvent event) {
......@@ -53,13 +118,15 @@ public class Main extends Application {
System.out.println("start");
int steps = Integer.parseInt(textField.getText());
String netFileUrl = netFile.getAbsolutePath();
//display(netFileUrl);
sim.main(steps, netFileUrl);
}
@FXML
private void oneStep(ActionEvent event) {
event.consume();
String netFileUrl = netFile.getAbsolutePath();
netFileUrl = netFile.getAbsolutePath();
//display(netFileUrl);
sim.oneStep(netFileUrl);
}
......@@ -69,8 +136,13 @@ public class Main extends Application {
try {
primaryStage = stage;
//root = FXMLLoader.load(getClass().getResource("../scheme.fxml"));
//scene = new Scene(root, 600, 400);
//load the xml file of the user interface
primaryStage.setScene(new Scene((Parent) JfxUtils.loadFxml("../scheme.fxml"), 1024, 800));
scene = new Scene((Parent) JfxUtils.loadFxml("../scheme.fxml"), 1024, 800);
primaryStage.setScene(scene);
//set up the width and height of the window
Rectangle2D bounds = Screen.getPrimary().getVisualBounds();
......@@ -79,7 +151,25 @@ public class Main extends Application {
primaryStage.setTitle("StorSim");
placesText=new Label();
placesText.setText("test");
primaryStage.show();
placesTable.getColumns().addAll(name, content);
transitionTable.getColumns().addAll(transitionName, pre, post, Distribution);
grid.add(transitions, 0, 1);
grid.add(places, 100, 1);
oneStep.setOnAction((EventHandler<ActionEvent>) new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
sim.oneStep(netFileUrl);
}
});
} catch(Exception e) {
e.printStackTrace();
}
......@@ -88,5 +178,108 @@ public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
public static void displayPlacesTransitions(ArrayList<place> places, ArrayList<transition> transitions) {
String text="";
for (place p:places) {
text+=p.getName();
}
placesText = new Label();
placesText.setText(text);
text="";
for (transition t:transitions) {
text+=t.getName();
}
transitionsText = new Label();
transitionsText.setText(text);
//placesPane = new TitledPane("places", grid);
//root.getChildren().add(placesPane);
//primaryStage.getScene().setRoot(new Region());
//scene = new Scene(new Region(), 600, 400);
//primaryStage.getScene().setRoot(root);
//primaryStage.setScene(scene2);
//primaryStage.show();
//scene = new Scene(grid, 500, 300);
// set the scene
// primaryStage.setScene(scene);
//primaryStage.show();
}
/*public void display(String fname) {
BufferedReader br;
try {
br = new BufferedReader(new FileReader(fname));
while (br.ready()) { // Tant quon peut encore lire des choses
handleLine(br.readLine());
}
br.close();
} catch(Exception e) {
System.out.println(e.getMessage());
}
transitionsText = new Label();
placesText = new Label();
placesText.setText(places);
transitionsText.setText(transitions);
GridPane grid = new GridPane();
grid.add(placesText, 0, 0);
grid.add(transitionsText, 0, 1);
scene = new Scene(grid, 1024, 800);
primaryStage.setScene(scene);
primaryStage.show();
}
private void handleLine(String line){
System.out.println(line);
String[] segments = line.split(":");
if (segments[0].equals("place")){
//System.out.println("A place");
places+=" "+segments[2];
}
if (segments[0].equals("transition")){
//System.out.println("A transition");
transitions+=" "+segments[2];
}
}*/
public static void addTransition(TransitionDom tDom) {
transitionsList.add(tDom);
transitionName.setCellValueFactory(new PropertyValueFactory("name"));
pre.setCellValueFactory(new PropertyValueFactory("pre"));
post.setCellValueFactory(new PropertyValueFactory("post"));
Distribution.setCellValueFactory(new PropertyValueFactory("Distribution"));
transitionTable.setItems(transitionsList);
grid.getChildren().remove(transitionTable);
grid.getChildren().remove(oneStep);
grid.add(oneStep, 0, 0);
grid.add(transitionTable, 0, 2);
scene.setRoot(grid);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void addPlace(PlaceDom p) {
placesList.add(p);
name.setCellValueFactory(new PropertyValueFactory("name"));
content.setCellValueFactory(new PropertyValueFactory("content"));
placesTable.setItems(placesList);
grid.getChildren().remove(placesTable);
grid.getChildren().remove(oneStep);
grid.add(oneStep, 0, 0);
grid.add(placesTable, 100, 2);
scene.setRoot(grid);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void clear() {
placesList.clear();
transitionsList.clear();
}
}
......@@ -27,16 +27,18 @@
</menus>
</MenuBar>
<Button layoutX="27.0" layoutY="40.0" mnemonicParsing="false" onAction="#oneStep" text="Step" />
<TitledPane fx:id="transitionsPane" animated="false" layoutX="27.0" layoutY="125.0" prefHeight="374.0" prefWidth="283.0" text="transitions">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
</content>
</TitledPane>
<TitledPane fx:id="placesPane" animated="false" layoutX="329.0" layoutY="125.0" prefHeight="374.0" prefWidth="283.0" text="places">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
</content>
</TitledPane>
<TableView fx:id="transitionTable" layoutX="27.0" layoutY="135.0" prefHeight="335.0" prefWidth="253.0">
<columns>
<TableColumn fx:id="transitionName" prefWidth="75.0" text="transition" />
<TableColumn fx:id="Distribution" prefWidth="75.0" text="fired" />
</columns>
</TableView>
<TableView fx:id="placesTable" layoutX="313.0" layoutY="135.0" prefHeight="335.0" prefWidth="262.0">
<columns>
<TableColumn fx:id="name" prefWidth="75.0" text="place" />
<TableColumn fx:id="contents" prefWidth="75.0" text="marked" />
</columns>
</TableView>
</children>
<opaqueInsets>
<Insets />
......
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="529.0" prefWidth="626.0" scaleShape="false" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TextField fx:id="textField" layoutX="218.0" layoutY="77.0" prefHeight="31.0" prefWidth="55.0" />
<Label layoutX="27.0" layoutY="82.0" text="Enter the number of steps :" />
<Button layoutX="280.0" layoutY="77.0" mnemonicParsing="false" onAction="#startSim" text="Ok" />
<MenuBar prefHeight="32.0" prefWidth="626.0">
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
<MenuItem mnemonicParsing="false" onAction="#loadFile" text="Load file" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Edit" />
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" text="About" />
</items>
</Menu>
</menus>
</MenuBar>
<Button layoutX="27.0" layoutY="40.0" mnemonicParsing="false" onAction="#oneStep" text="Step" />
<TitledPane animated="false" layoutX="27.0" layoutY="125.0" prefHeight="374.0" prefWidth="283.0" text="transitions">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<TextField layoutX="14.0" layoutY="14.0" prefHeight="31.0" prefWidth="245.0" />
<Label fx:id="transitionsText" layoutX="14.0" layoutY="58.0" prefHeight="32.0" prefWidth="243.0" text="Label" />
</children>
</AnchorPane>
</content>
</TitledPane>
<TitledPane animated="false" layoutX="329.0" layoutY="125.0" prefHeight="374.0" prefWidth="283.0" text="places">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<TextField layoutX="14.0" layoutY="14.0" prefHeight="31.0" prefWidth="259.0" />
<Label fx:id="placesText" layoutX="14.0" layoutY="63.0" prefHeight="31.0" prefWidth="256.0" text="Label" />
</children>
</AnchorPane>
</content>
</TitledPane>
</children>
<opaqueInsets>
<Insets />
</opaqueInsets>
</Pane>
......@@ -34,7 +34,7 @@ public class marking {
// removes a place from a marking
public boolean remove(place p){
boolean b= ListMarked.remove(p);
for (place ep:ListMarked){System.out</