Skip to content

Commit

Permalink
Merge pull request #242 from solver-it-sro/AG-140/long-path
Browse files Browse the repository at this point in the history
split path on success dialog into multiple hyperlinks
  • Loading branch information
jsuchal authored Aug 3, 2023
2 parents 2423955 + 97e7496 commit 373a57b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import javafx.scene.Node;
import javafx.scene.control.Hyperlink;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;

import java.io.File;

Expand All @@ -16,7 +17,7 @@ public class SigningSuccessDialogController implements SuppressedFocusController
@FXML
Text filenameText;
@FXML
Hyperlink folderPathText;
TextFlow successTextFlow;
@FXML
Node mainBox;

Expand All @@ -32,7 +33,20 @@ public SigningSuccessDialogController(File targetFile, File targetDirectory, Hos

public void initialize() {
filenameText.setText(targetFile.getName());
folderPathText.setText(targetFile.getParent());
initHyperlink();
}


public void initHyperlink() {
var path = targetFile.getParent().split("((?<=/|\\\\))");
for (int i = 0; i < path.length; i++) {
var hyperlink = new Hyperlink(path[i]);
hyperlink.getStyleClass().add("autogram-body");
hyperlink.getStyleClass().add("autogram-link");
hyperlink.getStyleClass().add("autogram-font-weight-bold");
hyperlink.setOnAction(this::onOpenFolderAction);
successTextFlow.getChildren().add(successTextFlow.getChildren().size() - 1, hyperlink);
}
}

public void onOpenFolderAction(ActionEvent ignored) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
<TextFlow styleClass="autogram-heading-m">
<Text styleClass="autogram-heading-m" text="Dokument bol úspešne podpísaný" />
</TextFlow>
<TextFlow styleClass="autogram-body">
<TextFlow styleClass="autogram-body" fx:id="successTextFlow">
<Text styleClass="autogram-body" text="Podpísaný súbor je uložený ako "/>
<Text styleClass="autogram-body,autogram-font-weight-bold" fx:id="filenameText" />
<Text styleClass="autogram-body" text=" v&#160;priečinku " />
<Hyperlink styleClass="autogram-body,autogram-link,autogram-font-weight-bold"
fx:id="folderPathText" onAction="#onOpenFolderAction" wrapText="true" />
<!-- Hyperlinks with path are inserted here-->
<Text styleClass="autogram-body" text="." />
</TextFlow>
</VBox>
Expand Down

0 comments on commit 373a57b

Please sign in to comment.