diff --git a/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties b/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties index 79621f247fa770a2d6dcdae88b077d9fdf51bb1b..841951b5c15168623334cfc51993f7acaa11f9a7 100644 --- a/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties +++ b/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties @@ -117,7 +117,7 @@ Info.Settings.ResetWarning=Die Einstellungen wurden zur Info.Settings.CacheDelete={} Datei(en) wurden gel�scht. # Info - Print -Info.Print.Header={} - Seite {} +Info.Print.Header={} - {} # Error - Standard Error.Standard.Gen=Es ist ein Fehler aufgetreten. Bitte versuchen Sie es sp�ter erneut. ({}) diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/cell/PageNameListCell.java b/PlayWall/src/de/tobias/playpad/viewcontroller/cell/PageNameListCell.java new file mode 100644 index 0000000000000000000000000000000000000000..a2b661dc4ed199bd4e4e008b2ba7c4abd2a2d8cf --- /dev/null +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/cell/PageNameListCell.java @@ -0,0 +1,25 @@ +package de.tobias.playpad.viewcontroller.cell; + +import de.tobias.playpad.PlayPadMain; +import de.tobias.playpad.Strings; +import de.tobias.playpad.project.page.Page; +import de.tobias.utils.util.Localization; +import javafx.scene.control.ListCell; + +public final class PageNameListCell extends ListCell<Integer> { + + @Override + protected void updateItem(Integer item, boolean empty) { + super.updateItem(item, empty); + if (!empty) { + Page page = PlayPadMain.getProgramInstance().getCurrentProject().getPage(item); + String name = page.getName(); + if (name.isEmpty()) { + name = Localization.getString(Strings.UI_Window_Main_PageButton, (item)); + } + setText(name); + } else { + setText(""); + } + } +} \ No newline at end of file diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/PrintDialog.java b/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/PrintDialog.java index c4ad55310bf2f14a76fa7fc71b7d18487228daab..d4fe619c978fdd49f7db89f930b981b0fb9c81f9 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/PrintDialog.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/PrintDialog.java @@ -14,7 +14,9 @@ import de.tobias.playpad.pad.Pad; import de.tobias.playpad.project.Project; import de.tobias.playpad.project.ProjectSettings; import de.tobias.playpad.project.page.PadIndex; +import de.tobias.playpad.project.page.Page; import de.tobias.playpad.settings.Profile; +import de.tobias.playpad.viewcontroller.cell.PageNameListCell; import de.tobias.utils.application.ApplicationUtils; import de.tobias.utils.ui.ViewController; import de.tobias.utils.util.Localization; @@ -48,9 +50,11 @@ public class PrintDialog extends ViewController { int pages = project.getPages().size(); for (int i = 0; i < pages; i++) { - pageComboBox.getItems().add(i + 1); + pageComboBox.getItems().add(i); } pageComboBox.getSelectionModel().selectFirst(); + pageComboBox.setCellFactory(param -> new PageNameListCell()); + pageComboBox.setButtonCell(new PageNameListCell()); getStage().initOwner(owner); } @@ -59,7 +63,7 @@ public class PrintDialog extends ViewController { public void init() { pageComboBox.getSelectionModel().selectedItemProperty().addListener((a, b, c) -> { - createPreview(c - 1); + createPreview(c); }); addCloseKeyShortcut(() -> getStage().close()); @@ -76,7 +80,7 @@ public class PrintDialog extends ViewController { Profile.currentProfile().currentLayout().applyCss(getStage()); } - private void createPreview(int page) { + private void createPreview(int pageIndex) { Html html = new Html(); Body body = new Body(); body.setStyle("max-width: 1000px; font-family: sans-serif;"); @@ -84,7 +88,13 @@ public class PrintDialog extends ViewController { H1 header = new H1(); - String headerString = Localization.getString(Strings.Info_Print_Header, project.getProjectReference().getName(), page + 1); + Page page = project.getPage(pageIndex); + String pageName = page.getName(); + if (pageName.isEmpty()) { + pageName = Localization.getString(Strings.UI_Window_Main_PageButton, (pageIndex + 1)); + } + + String headerString = Localization.getString(Strings.Info_Print_Header, project.getProjectReference().getName(), pageName); header.appendText(headerString); header.setStyle("text-align: center;"); body.appendChild(header); @@ -93,7 +103,7 @@ public class PrintDialog extends ViewController { table.setStyle("border:1px solid black;border-collapse:collapse;"); ProjectSettings settings = project.getSettings(); - int i = 0; + int padIndex = 0; for (int y = 0; y < settings.getRows(); y++) { Tr tr = new Tr(); @@ -104,14 +114,14 @@ public class PrintDialog extends ViewController { + "px; padding: 5px; vertical-align: center; text-align: center; min-height: 30px; min-width: 100px;"); Div div = new Div(); div.setStyle("word-break: break-all; white-space: normal;"); - Pad pad = this.project.getPad(new PadIndex(i, page)); + Pad pad = this.project.getPad(new PadIndex(padIndex, pageIndex)); if (pad.getContent() != null && pad.getContent().isPadLoaded()) div.appendText(pad.getName()); else div.appendText("-"); td.appendChild(div); - i++; + padIndex++; tr.appendChild(td); } }