Skip to content

Commit

Permalink
[#538] Change tip dialog styling.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkcoding7 authored and prmr committed Jul 2, 2024
1 parent b2ef3bc commit cea62a7
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 90 deletions.
7 changes: 7 additions & 0 deletions src/org/jetuml/JetUML.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@
-fx-alignment: center;
-fx-padding: 0 0 10px 0;
}

.tip-menu
{
-fx-background-color: gainsboro;
-fx-border-color: darkgrey;
-fx-border-style: solid;
}
2 changes: 1 addition & 1 deletion src/org/jetuml/JetUML.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ public void start(Stage pStage) throws Exception
}

DialogStage dialogStage = new DialogStage(pStage);
dialogStage.getScene().getStylesheets().add(getClass().getResource("JetUML.css").toExternalForm());
EditorFrame editor = new EditorFrame(pStage, dialogStage);
diagramToOpen.ifPresent(diagram -> editor.setOpenFileAsDiagram(fileToOpen.get(), diagram));
pStage.setScene(new Scene(editor));

NotificationService.instance().setMainStage(pStage);

pStage.getScene().getStylesheets().add(getClass().getResource("JetUML.css").toExternalForm());

pStage.setOnCloseRequest(pWindowEvent ->
{
pWindowEvent.consume();
Expand Down
76 changes: 21 additions & 55 deletions src/org/jetuml/gui/DarkMode.css
Original file line number Diff line number Diff line change
@@ -1,75 +1,35 @@
.root {
.root
{
-fx-accent: #1e74c6;
-fx-focus-color: -fx-accent;
-fx-base: #1b1f21;
-fx-control-inner-background: derive(-fx-base, 35%);
-fx-control-inner-background-alt: -fx-control-inner-background ;
}

.label{
.label
{
-fx-text-fill: lightgray;
}

.text-field {
-fx-prompt-text-fill: gray;
}

.titulo{
-fx-font-weight: bold;
-fx-font-size: 18px;
}

.button{
-fx-focus-traversable: false;
}

.button:hover{
-fx-text-fill: white;
}

.separator *.line {
.separator .line
{
-fx-background-color: #3C3C3C;
-fx-border-style: solid;
-fx-border-width: 1px;
}

.scroll-bar{
-fx-background-color: derive(-fx-base,45%)
}

.button:default {
-fx-base: -fx-accent ;
}

.table-view{
/*-fx-background-color: derive(-fx-base, 10%);*/
-fx-selection-bar-non-focused: derive(-fx-base, 50%);
}

.table-view .column-header .label{
-fx-alignment: CENTER_LEFT;
-fx-font-weight: none;
}

.list-cell:even,
.list-cell:odd,
.table-row-cell:even,
.table-row-cell:odd{
-fx-control-inner-background: derive(-fx-base, 15%);
}

.list-cell:empty,
.table-row-cell:empty {
-fx-background-color: transparent;
.scroll-bar
{
-fx-background-color: derive(-fx-base, 45%)
}

.list-cell,
.table-row-cell{
-fx-border-color: transparent;
-fx-table-cell-border-color:transparent;
.button:default
{
-fx-base: darkgray;
-fx-text-fill: lightgray;
}


.welcome-tab-panel
{
-fx-padding: 20px;
Expand All @@ -93,12 +53,18 @@

.welcome-tab-panel .button:hover
{
-fx-text-fill: black;
-fx-font-size: 17pt;
-fx-text-fill: gray;
}

.welcome-tab-footer
{
-fx-alignment: center;
-fx-padding: 0 0 10px 0;
}

.tip-menu
{
-fx-background-color: -fx-base;
-fx-border-color: black;
-fx-border-style: solid;
}
47 changes: 13 additions & 34 deletions src/org/jetuml/gui/tips/TipDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public class TipDialog
private static final double TITLE_FONT_SIZE = 23;
private static final double TEXT_FONT_SIZE = 13.5;
private static final double TEXT_LINE_SPACING = 2;
private static final double TEXT_WIDTH = 570;
private static final Insets IMAGE_PADDING = new Insets(25, 0, 25, 0);
private static final double DEFAULT_NODE_SPACING = 10;
private static final String NEXT_TIP_BUTTON_STYLE = "next-tip-button";
private static final String BUTTON_STYLE = "tip-menu-button";

private Stage aStage;
private Tip aCurrentTip;
Expand All @@ -89,13 +89,13 @@ public class TipDialog
*/
public TipDialog(Stage pDialogStage)
{
aStage = pDialogStage;
aTipDisplay = new ScrollPane();
aViewedTips = new ViewedTips(getUserPrefNextTipId());
aShowTipsOnStartupCheckBox = new CheckBox(RESOURCES.getString("dialog.tips.checkbox.text"));
aShowTipsOnStartupCheckBox.setSelected(UserPreferences.instance().getBoolean(UserPreferences.BooleanPreference.showTips));
aShowTipsOnStartupCheckBox.setOnAction(e -> UserPreferences.instance().setBoolean(UserPreferences.BooleanPreference.showTips,
aShowTipsOnStartupCheckBox.isSelected()));
aStage = pDialogStage;
}

/**
Expand All @@ -110,25 +110,19 @@ public void show()

private void prepareStage()
{
//aStage.setResizable(true);
// aStage.setMinWidth(WINDOW_MIN_WIDTH);
// aStage.setWidth(WINDOW_PREF_WIDTH);
// aStage.setMinHeight(WINDOW_MIN_HEIGHT);
// aStage.setHeight(WINDOW_PREF_HEIGHT);
aStage.setTitle(RESOURCES.getString("dialog.tips.title"));
aStage.getIcons().add(new Image(RESOURCES.getString("application.icon")));
aStage.getScene().setRoot(createScene());
//aStage.getScene().getStylesheets().add(getClass().getResource("TipDialog.css").toExternalForm());
aStage.getScene().setRoot(createRoot());
aTipDisplay.requestFocus();
}

private Pane createScene()
private Pane createRoot()
{
BorderPane layout = new BorderPane();

//Removing the focus highlight on the ScrollPane
aTipDisplay.setStyle("-fx-background-color: -fx-outer-border, -fx-inner-border, -fx-body-color;" +
"-fx-background-insets: 0, 1, 2;");
"-fx-background-insets: 0, 1;");

aTipDisplay.setFitToWidth(true);
layout.setCenter(aTipDisplay);
Expand All @@ -140,13 +134,10 @@ private Pane createScene()
setUserPrefNextTip(aViewedTips.getNewNextTipOfTheDayId());
setupNewTip(tip);

aStage.requestFocus();

layout.setMinWidth(WINDOW_MIN_WIDTH);
//layout.setWidth(WINDOW_PREF_WIDTH);
layout.setMaxWidth(WINDOW_PREF_WIDTH);
layout.setMinHeight(WINDOW_MIN_HEIGHT);
//layout.setHeight(WINDOW_PREF_HEIGHT);
//Scene tipDialogScene = new Scene(layout, WINDOW_PREF_WIDTH, WINDOW_PREF_HEIGHT);
layout.setMaxHeight(WINDOW_PREF_HEIGHT);

return layout;
}
Expand All @@ -167,24 +158,17 @@ private static HBox createEmptyTipMenu()
{
HBox tipMenu = new HBox();
tipMenu.setPadding(new Insets(PADDING));
//tipMenu.setStyle("-fx-background-color: slategrey;");

BorderStroke bs = new BorderStroke(Color.DARKGRAY, BorderStrokeStyle.SOLID,
CornerRadii.EMPTY, BorderWidths.DEFAULT);
tipMenu.setBorder(new Border(bs));
tipMenu.getStyleClass().add("tip-menu");
return tipMenu;
}

private HBox createTipMenuButtons()
{
Button nextTipButton = new Button(RESOURCES.getString("dialog.tips.button.next.text"));
nextTipButton.getStyleClass().add(NEXT_TIP_BUTTON_STYLE);


Button previousTipButton = new Button(RESOURCES.getString("dialog.tips.button.previous.text"));
previousTipButton.getStyleClass().add(BUTTON_STYLE);

Button closeButton = new Button(RESOURCES.getString("dialog.tips.button.close.text"));
closeButton.getStyleClass().add(BUTTON_STYLE);

nextTipButton.setOnAction(e ->
{
Expand Down Expand Up @@ -250,8 +234,6 @@ private VBox getTipAsVBox(Tip pTip)
tipVBox.getChildren().add(node);
}

//tipVBox.setAlignment(Pos.CENTER);

return tipVBox;
}

Expand Down Expand Up @@ -312,14 +294,11 @@ private Label getTextTipElementAsTextNode(TipElement pTipElement)
String text = pTipElement.getContent();
Label textNode = new Label(text);
textNode.setWrapText(true);
textNode.setPrefWidth(570);
//textNode.wrappingWidthProperty().bind(aTipDisplay.widthProperty().subtract(2 * PADDING + 4 * DEFAULT_NODE_SPACING));
// two times the padding because of the VBox padding, and a bit extra to make up for
// other default spacing added between nodes
textNode.setPrefWidth(TEXT_WIDTH);

Font textFont = new Font(TEXT_FONT_SIZE);
textNode.setFont(textFont);
//textNode.setLineSpacing(TEXT_LINE_SPACING);
textNode.setLineSpacing(TEXT_LINE_SPACING);

return textNode;
}
Expand Down Expand Up @@ -349,7 +328,7 @@ private static HBox getImageTipElementAsImageView(TipElement pTipElement)
}
HBox imageContainer = new HBox(imageNode);
imageContainer.setAlignment(Pos.CENTER);
VBox.setMargin(imageContainer, new Insets(30, 0, 0, 0));
VBox.setMargin(imageContainer, IMAGE_PADDING);
return imageContainer;
//return imageNode;
}
Expand Down

0 comments on commit cea62a7

Please sign in to comment.