Skip to content

Commit

Permalink
Merge pull request #150 from firm1/improvedOptions
Browse files Browse the repository at this point in the history
fix textes tronqués dans les options et about
  • Loading branch information
firm1 committed Jun 28, 2016
2 parents 3add9fe + ef40478 commit 0878e72
Show file tree
Hide file tree
Showing 9 changed files with 307 additions and 571 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCodeCombination;
import javafx.scene.input.KeyCombination;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.*;
import javafx.scene.text.Text;
import javafx.stage.DirectoryChooser;
import javafx.stage.Modality;
Expand Down Expand Up @@ -653,7 +650,8 @@ private void uploadContents(){
Scene scene = new Scene(aboutDialog);
dialogStage.setScene(scene);
dialogStage.getIcons().add(new Image(MainApp.class.getResourceAsStream("assets/static/icons/logo.png")));
dialogStage.initModality(Modality.APPLICATION_MODAL);
dialogStage.setResizable(false);
dialogStage.initModality(Modality.WINDOW_MODAL);

dialogStage.show();
}catch(IOException e){
Expand All @@ -665,7 +663,7 @@ private void uploadContents(){
FXMLLoader loader = new CustomFXMLLoader(MainApp.class.getResource("fxml/OptionsDialog.fxml"));

try{
AnchorPane optionsDialog = loader.load();
BorderPane optionsDialog = loader.load();

Stage dialogStage = new Stage();
dialogStage.setTitle(Configuration.bundle.getString("ui.menu.options"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@
import javafx.beans.NamedArg;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.stage.Modality;

public class CustomAlert extends Alert{

public CustomAlert(@NamedArg("alertType") AlertType alertType) {
super(alertType);
IconFactory.addAlertLogo(this);
FunctionTreeFactory.addTheming(this.getDialogPane());
initModality(Modality.APPLICATION_MODAL);
}

public CustomAlert(@NamedArg("alertType") AlertType alertType, @NamedArg("contentText") String contentText, ButtonType... buttons) {
super(alertType, contentText, buttons);
IconFactory.addAlertLogo(this);
FunctionTreeFactory.addTheming(this.getDialogPane());
initModality(Modality.APPLICATION_MODAL);
}

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package com.zestedesavoir.zestwriter.view.com;

import javafx.scene.control.Dialog;
import javafx.scene.control.Label;
import javafx.scene.layout.Region;
import javafx.stage.Modality;

public class CustomDialog<T> extends Dialog<T> {

public CustomDialog() {
super();
FunctionTreeFactory.addTheming(this.getDialogPane());
initModality(Modality.APPLICATION_MODAL);
getDialogPane().getChildren().stream().filter(node -> node instanceof Label).forEach(node -> ((Label)node).setMinHeight(Region.USE_PREF_SIZE));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,6 @@ public class OptionsDialog{
private String optEditorToolbarView;
private boolean optSmartEditor;

@FXML private Hyperlink optionGeneral;
@FXML private Hyperlink optionEditor;
@FXML private Hyperlink optionDisplay;
@FXML private Hyperlink optionShortcut;
@FXML private Hyperlink optionAuthentification;
@FXML private Hyperlink optionAdvanced;

@FXML private AnchorPane optionGeneralPane;
@FXML private AnchorPane optionEditorPane;
@FXML private AnchorPane optionDisplayPane;
@FXML private AnchorPane optionShortcutPane;
@FXML private AnchorPane optionAuthentificationPane;
@FXML private AnchorPane optionAdvancedPane;

@FXML private RadioButton optEditorToolbarViewYes;
@FXML private RadioButton optEditorToolbarViewNo;
@FXML private RadioButton optSmartEditorYes;
Expand All @@ -62,6 +48,7 @@ public class OptionsDialog{
@FXML private ComboBox<String> optAdvancedProtocol;
@FXML private TextField optAdvancedHost;
@FXML private TextField optAdvancedPort;
@FXML private Label workspacepath;


public void setMainApp(MainApp mainApp){
Expand All @@ -74,17 +61,14 @@ public void setMainApp(MainApp mainApp){
setShortcutOptions();
setAuthentificationOptions();
setAdvancedOptions();

workspacepath.setText(config.getWorkspacePath());
}

public void setWindow(Stage window){
this.optionsWindow = window;
}

@FXML private void initialize(){
hideAllPane();
optionGeneralPane.setVisible(true);
}

@FXML private void HandleSaveButtonAction(){
config.setEditorFont(optEditorFont);
config.setEditorFontSize(String.valueOf(optEditorFontSize));
Expand Down Expand Up @@ -152,54 +136,6 @@ public void setWindow(Stage window){
}
}

@FXML private void HandleHyperlinkGeneralLabel(){
hideAllPane();
optionGeneralPane.setVisible(true);

resetHyperlinkColor();
optionGeneral.setTextFill(Color.BLACK);
}

@FXML private void HandleHyperlinkEditorLabel(){
hideAllPane();
optionEditorPane.setVisible(true);

resetHyperlinkColor();
optionEditor.setTextFill(Color.BLACK);
}

@FXML private void HandleHyperlinkDisplayLabel(){
hideAllPane();
optionDisplayPane.setVisible(true);

resetHyperlinkColor();
optionDisplay.setTextFill(Color.BLACK);
}

@FXML private void HandleHyperlinkShortcutLabel(){
hideAllPane();
optionShortcutPane.setVisible(true);

resetHyperlinkColor();
optionShortcut.setTextFill(Color.BLACK);
}

@FXML private void HandleHyperlinkAuthentificationLabel(){
hideAllPane();
optionAuthentificationPane.setVisible(true);

resetHyperlinkColor();
optionAuthentification.setTextFill(Color.BLACK);
}

@FXML private void HandleHyperlinkAdvancedLabel(){
hideAllPane();
optionAdvancedPane.setVisible(true);

resetHyperlinkColor();
optionAdvanced.setTextFill(Color.BLACK);
}

@FXML private void HandleGeneralBrowseAction(){
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle(Configuration.bundle.getString("ui.options.workspace"));
Expand All @@ -212,14 +148,6 @@ public void setWindow(Stage window){
}
}

@FXML private void HandleGeneralShowAction(){
Alert alert = new CustomAlert(Alert.AlertType.INFORMATION);
alert.setTitle(Configuration.bundle.getString("ui.options.workspace.title"));
alert.setHeaderText(Configuration.bundle.getString("ui.options.workspace.header"));
alert.setContentText(config.getWorkspacePath());
alert.showAndWait();
}

@FXML private void HandleEditorFontChoice(){
Dialog<Font> fontSelector = new FontSelectorDialog(new Font(config.getEditorFont(), config.getEditorFontsize()));
Optional<Font> result = fontSelector.showAndWait();
Expand Down Expand Up @@ -355,24 +283,6 @@ private void setAdvancedOptions(){
optAdvancedPort.setText(config.getAdvancedServerPort());
}

private void resetHyperlinkColor(){
optionGeneral.setTextFill(Color.web("#656565"));
optionEditor.setTextFill(Color.web("#656565"));
optionDisplay.setTextFill(Color.web("#656565"));
optionShortcut.setTextFill(Color.web("#656565"));
optionAuthentification.setTextFill(Color.web("#656565"));
optionAdvanced.setTextFill(Color.web("#656565"));
}

private void hideAllPane(){
optionGeneralPane.setVisible(false);
optionEditorPane.setVisible(false);
optionDisplayPane.setVisible(false);
optionShortcutPane.setVisible(false);
optionAuthentificationPane.setVisible(false);
optionAdvancedPane.setVisible(false);
}

private void resetOptions(){
config.resetAllOptions();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +0,0 @@
/* OptionsDialog style */

.hyperlink{
-fx-underline:false;
}

.hyperlink:hover{
-fx-underline:true;
}

.title {
-fx-font-weight: bold;
-fx-font-size: 15pt;
-fx-text-fill: #ea9408;
}

.subtitle {
-fx-font-style: italic;
-fx-font-size: 11pt;
-fx-text-fill: #ea9408;
}
6 changes: 6 additions & 0 deletions src/main/resources/com/zestedesavoir/zestwriter/css/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@
-fx-text-fill: derive(-fx-background, 90%);
}

.subtitle {
-fx-font-weight: bold;
-fx-font-size: 13pt;
-fx-text-fill: #ea9408;
-fx-label-padding: 20;
}
.label-bottom {
-fx-fill: #FFF;
}
7 changes: 7 additions & 0 deletions src/main/resources/com/zestedesavoir/zestwriter/css/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,11 @@
.lineno {
-fx-background-color: derive(-fx-base,20%);
-fx-text-fill: #999;
}

.subtitle {
-fx-font-weight: bold;
-fx-font-size: 13pt;
-fx-text-fill: #ea9408;
-fx-label-padding: 20;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zestedesavoir.zestwriter.view.dialogs.AboutDialog">
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="500.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zestedesavoir.zestwriter.view.dialogs.AboutDialog">
<children>
<VBox prefHeight="200.0" prefWidth="100.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<HBox prefHeight="100.0" prefWidth="200.0">
<HBox>
<children>
<ImageView fitHeight="120.0" fitWidth="128.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../../../logo/logo-128.png" />
</image>
</ImageView>
<Label text="%ui.app_name.text">
<Label text="%ui.app_name.text" wrapText="true">
<font>
<Font name="Calibri" size="33.0" />
<Font size="33.0" />
</font>
<HBox.margin>
<Insets left="50.0" top="60.0" />
Expand All @@ -35,16 +35,16 @@
</HBox>
<GridPane>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="90.0" minWidth="90.0" prefWidth="90.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="261.0" minWidth="10.0" prefWidth="246.0" />
<ColumnConstraints hgrow="SOMETIMES" />
<ColumnConstraints hgrow="SOMETIMES" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label prefWidth="70.0" text="%ui.version.label">
<Label text="%ui.version.label">
<font>
<Font name="Calibri Bold" size="16.0" />
</font>
Expand All @@ -60,20 +60,20 @@
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</padding>
</Label>
<Label prefWidth="70.0" text="%ui.licence.label.abbr" GridPane.rowIndex="1">
<Label text="%ui.licence.label.abbr" GridPane.rowIndex="1">
<font>
<Font name="Calibri Bold" size="16.0" />
<Font name="Bold" size="16.0" />
</font>
<padding>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
</padding>
</Label>
<Hyperlink onAction="#HandleGplHyperlinkAction" style="-fx-border-width: 0;" text="%ui.licence.label.short" textFill="#656565" GridPane.columnIndex="1" GridPane.rowIndex="1">
<font>
<Font name="Calibri" size="16.0" />
<Font size="16.0" />
</font>
</Hyperlink>
<Label prefWidth="70.0" text="%ui.source.label" GridPane.rowIndex="2">
<Label text="%ui.source.label" GridPane.rowIndex="2">
<font>
<Font name="Calibri Bold" size="16.0" />
</font>
Expand All @@ -91,9 +91,9 @@
<Insets top="25.0" />
</VBox.margin>
</GridPane>
<Label prefHeight="91.0" prefWidth="340.0" text="%ui.app_name.description" wrapText="true">
<Label prefHeight="91.0" text="%ui.app_name.description" wrapText="true">
<font>
<Font name="Calibri" size="16.0" />
<Font size="16.0" />
</font>
<padding>
<Insets bottom="3.0" left="3.0" right="3.0" top="3.0" />
Expand Down

0 comments on commit 0878e72

Please sign in to comment.