mirror of
https://github.com/Akomry/sae302_applicom.git
synced 2025-12-06 08:43:54 +00:00
feat(config): ajout de la persistance des positions des séparateurs
This commit is contained in:
parent
3bc5db868c
commit
e18e4c3223
3 changed files with 12 additions and 8 deletions
|
|
@ -9,10 +9,7 @@ import javafx.stage.Stage;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Locale;
|
import java.util.*;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.ResourceBundle;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.LogManager;
|
import java.util.logging.LogManager;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
@ -53,8 +50,6 @@ public class ChatApplication extends Application {
|
||||||
if (!properties.getProperty("width").isEmpty() && !properties.getProperty("height").isEmpty()) {
|
if (!properties.getProperty("width").isEmpty() && !properties.getProperty("height").isEmpty()) {
|
||||||
stage.setWidth(Double.parseDouble(properties.getProperty("width")));
|
stage.setWidth(Double.parseDouble(properties.getProperty("width")));
|
||||||
stage.setHeight(Double.parseDouble(properties.getProperty("height")));
|
stage.setHeight(Double.parseDouble(properties.getProperty("height")));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (properties.getProperty("posx").isEmpty() || properties.getProperty("height").isEmpty()) {
|
if (properties.getProperty("posx").isEmpty() || properties.getProperty("height").isEmpty()) {
|
||||||
stage.centerOnScreen();
|
stage.centerOnScreen();
|
||||||
|
|
@ -77,7 +72,8 @@ public class ChatApplication extends Application {
|
||||||
properties.setProperty("posx", String.valueOf(stage.getX()));
|
properties.setProperty("posx", String.valueOf(stage.getX()));
|
||||||
properties.setProperty("posy", String.valueOf(stage.getY()));
|
properties.setProperty("posy", String.valueOf(stage.getY()));
|
||||||
|
|
||||||
|
properties.setProperty("split1", String.valueOf(controller.senderSplitPane.getDividerPositions()[0]));
|
||||||
|
properties.setProperty("split2", String.valueOf(controller.exchangeSplitPane.getDividerPositions()[0]));
|
||||||
LOGGER.finest(properties.toString());
|
LOGGER.finest(properties.toString());
|
||||||
properties.store(new FileOutputStream(getClass().getResource("config.properties").getPath()), null);
|
properties.store(new FileOutputStream(getClass().getResource("config.properties").getPath()), null);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ public class ChatController implements Initializable {
|
||||||
public Label statusLabel;
|
public Label statusLabel;
|
||||||
public Label dateTimeLabel;
|
public Label dateTimeLabel;
|
||||||
public Contact contact;
|
public Contact contact;
|
||||||
|
public SplitPane senderSplitPane;
|
||||||
private ContactMap contactMap = new ContactMap();
|
private ContactMap contactMap = new ContactMap();
|
||||||
private ObservableList<Contact> contactObservableList = FXCollections.observableArrayList();
|
private ObservableList<Contact> contactObservableList = FXCollections.observableArrayList();
|
||||||
private ObservableList<Post> postsObservableList = FXCollections.observableArrayList();
|
private ObservableList<Post> postsObservableList = FXCollections.observableArrayList();
|
||||||
|
|
@ -101,6 +102,13 @@ public class ChatController implements Initializable {
|
||||||
}
|
}
|
||||||
hostComboBox.setValue(!properties.getProperty("lasthost").isEmpty() ? properties.getProperty("lasthost") : hostComboBox.getItems().get(0));
|
hostComboBox.setValue(!properties.getProperty("lasthost").isEmpty() ? properties.getProperty("lasthost") : hostComboBox.getItems().get(0));
|
||||||
loginTextField.setText(!properties.getProperty("login").isEmpty() ? properties.getProperty("login") : "");
|
loginTextField.setText(!properties.getProperty("login").isEmpty() ? properties.getProperty("login") : "");
|
||||||
|
if (!properties.getProperty("split2").isEmpty()) {
|
||||||
|
exchangeSplitPane.setDividerPositions(Double.parseDouble(properties.getProperty("split2")));
|
||||||
|
}
|
||||||
|
if (!properties.getProperty("split1").isEmpty()) {
|
||||||
|
exchangeSplitPane.setDividerPositions(Double.parseDouble(properties.getProperty("split2")));
|
||||||
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.warning("Impossible de charger le fichier de configuration! Configuration par défaut chargée");
|
LOGGER.warning("Impossible de charger le fichier de configuration! Configuration par défaut chargée");
|
||||||
System.out.println(e.getMessage());
|
System.out.println(e.getMessage());
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@
|
||||||
<SplitPane fx:id="exchangeSplitPane" dividerPositions="0.9" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
|
<SplitPane fx:id="exchangeSplitPane" dividerPositions="0.9" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
|
||||||
<items>
|
<items>
|
||||||
<ListView fx:id="postListView" prefHeight="200.0" prefWidth="348.0" />
|
<ListView fx:id="postListView" prefHeight="200.0" prefWidth="348.0" />
|
||||||
<SplitPane dividerPositions="0.1" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0">
|
<SplitPane fx:id="senderSplitPane" dividerPositions="0.1" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0">
|
||||||
<items>
|
<items>
|
||||||
<ListView fx:id="roomsListView" prefHeight="200.0" prefWidth="200.0" />
|
<ListView fx:id="roomsListView" prefHeight="200.0" prefWidth="200.0" />
|
||||||
<ListView fx:id="contactsListView" prefHeight="200.0" prefWidth="200.0" />
|
<ListView fx:id="contactsListView" prefHeight="200.0" prefWidth="200.0" />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue