Added actual document icons.
This commit is contained in:
parent
c08276abbf
commit
aa90f98424
|
@ -0,0 +1,69 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="64"
|
||||
height="64"
|
||||
viewBox="0 0 16.933333 16.933333"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
inkscape:version="1.3.2 (1:1.3.2+202311252150+091e20ef0f)"
|
||||
sodipodi:docname="doc-icon.svg"
|
||||
inkscape:export-filename="../src/main/resources/images/doc-icon.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#ffffff"
|
||||
borderopacity="1"
|
||||
inkscape:showpageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="1"
|
||||
inkscape:deskcolor="#505050"
|
||||
inkscape:document-units="px"
|
||||
inkscape:zoom="8.3452885"
|
||||
inkscape:cx="18.273784"
|
||||
inkscape:cy="26.601836"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1025"
|
||||
inkscape:window-x="1080"
|
||||
inkscape:window-y="470"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" />
|
||||
<defs
|
||||
id="defs1" />
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<path
|
||||
id="rect1"
|
||||
style="fill:#d2d2d2;fill-opacity:1;stroke:#000031;stroke-width:0.880783;stroke-opacity:1"
|
||||
d="m 3.0114942,0.69473565 h 8.8346808 c 0.650605,0 3.250041,2.33700955 3.250041,2.98761475 V 15.06422 c 0,0.650604 -0.523773,1.174377 -1.174377,1.174377 H 3.0114942 c -0.6506051,0 -1.1743773,-0.523773 -1.1743773,-1.174377 V 1.869113 c 0,-0.6506052 0.5237722,-1.17437735 1.1743773,-1.17437735 z"
|
||||
sodipodi:nodetypes="sssssssss" />
|
||||
<path
|
||||
style="fill:none;stroke:#000031;stroke-width:0.880783;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 11.846175,0.69473565 c 0,0 -0.308342,1.92253135 0.378055,2.60892725 0.763774,0.7637736 2.871986,0.3786875 2.871986,0.3786875"
|
||||
id="path1"
|
||||
sodipodi:nodetypes="csc" />
|
||||
<path
|
||||
style="fill:none;stroke:#000031;stroke-width:0.880783;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 3.8656138,3.0179173 H 10.014863"
|
||||
id="path2" />
|
||||
<path
|
||||
style="fill:none;stroke:#000031;stroke-width:0.880783;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 3.8656138,5.3359736 H 11.205695"
|
||||
id="path3"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:none;stroke:#000031;stroke-width:0.880783;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 3.8656138,7.6540298 H 13.100137"
|
||||
id="path4"
|
||||
sodipodi:nodetypes="cc" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.8 KiB |
|
@ -4,6 +4,9 @@ import javafx.scene.control.Alert;
|
|||
import javafx.scene.control.ButtonType;
|
||||
import javafx.stage.Modality;
|
||||
|
||||
/**
|
||||
* Helper class for standardized popups and confirmation dialogs for the app.
|
||||
*/
|
||||
public class Popups {
|
||||
public static boolean confirm(String text) {
|
||||
Alert alert = new Alert(Alert.AlertType.CONFIRMATION, text);
|
||||
|
|
|
@ -70,6 +70,12 @@ public class TransactionsViewController implements RouteSelectionListener {
|
|||
selectedTransaction.addListener((observable, oldValue, newValue) -> {
|
||||
transactionViewController.setTransaction(newValue);
|
||||
});
|
||||
|
||||
// Clear the transactions when a new profile is loaded.
|
||||
Profile.whenLoaded(profile -> {
|
||||
transactionsVBox.getChildren().clear();
|
||||
onRouteSelected(null);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,7 +6,6 @@ import javafx.scene.image.Image;
|
|||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.shape.Rectangle;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
@ -31,19 +30,25 @@ public class AttachmentPreview extends BorderPane {
|
|||
nameContainer.setMinHeight(LABEL_SIZE);
|
||||
contentContainer.setBottom(nameContainer);
|
||||
|
||||
Rectangle placeholder = new Rectangle(IMAGE_SIZE, IMAGE_SIZE);
|
||||
placeholder.setFill(Color.WHITE);
|
||||
contentContainer.setCenter(placeholder);
|
||||
|
||||
boolean showDocIcon = true;
|
||||
Set<String> imageTypes = Set.of("image/png", "image/jpeg", "image/gif", "image/bmp");
|
||||
if (imageTypes.contains(attachment.getContentType())) {
|
||||
try (var in = Files.newInputStream(attachment.getPath())) {
|
||||
Image img = new Image(in, IMAGE_SIZE, IMAGE_SIZE, true, true);
|
||||
contentContainer.setCenter(new ImageView(img));
|
||||
showDocIcon = false;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
if (showDocIcon) {
|
||||
try (var in = AttachmentPreview.class.getResourceAsStream("/images/doc-icon.png")) {
|
||||
Image img = new Image(in, IMAGE_SIZE, IMAGE_SIZE, true, true);
|
||||
contentContainer.setCenter(new ImageView(img));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
BorderPane hoverIndicatorPane = new BorderPane();
|
||||
hoverIndicatorPane.prefWidthProperty().bind(contentContainer.widthProperty());
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.andrewlalis.perfin.view.component;
|
|||
import com.andrewlalis.perfin.data.pagination.Page;
|
||||
import com.andrewlalis.perfin.data.pagination.PageRequest;
|
||||
import com.andrewlalis.perfin.data.pagination.Sort;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.beans.property.IntegerProperty;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
|
@ -10,11 +11,13 @@ import javafx.beans.property.SimpleIntegerProperty;
|
|||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.scene.text.TextAlignment;
|
||||
import javafx.scene.text.TextFlow;
|
||||
|
||||
/**
|
||||
|
@ -48,8 +51,12 @@ public class DataSourcePaginationControls extends BorderPane {
|
|||
maxPagesLabel.textProperty().bind(maxPages.asString());
|
||||
TextFlow maxPagesText = new TextFlow(new Text(" / "), maxPagesLabel);
|
||||
maxPagesText.managedProperty().bind(maxPagesText.visibleProperty());
|
||||
maxPagesText.visibleProperty().bind(maxPages.isNotEqualTo(-1));
|
||||
maxPagesText.visibleProperty().bind(maxPages.greaterThan(0));
|
||||
TextFlow pageText = new TextFlow(new Text("Page "), currentPageLabel, maxPagesText);
|
||||
pageText.setTextAlignment(TextAlignment.CENTER);
|
||||
BorderPane pageTextContainer = new BorderPane(pageText);
|
||||
BorderPane.setAlignment(pageText, Pos.CENTER);
|
||||
pageTextContainer.setStyle("-fx-border-color: blue;");
|
||||
|
||||
|
||||
Button previousPageButton = new Button("Previous Page");
|
||||
|
@ -59,38 +66,45 @@ public class DataSourcePaginationControls extends BorderPane {
|
|||
nextPageButton.disableProperty().bind(fetching.or(currentPage.greaterThanOrEqualTo(maxPages)));
|
||||
nextPageButton.setOnAction(event -> setPage(currentPage.get() + 1));
|
||||
|
||||
sorts.addListener((ListChangeListener<Sort>) c -> {
|
||||
setPage(1);
|
||||
});
|
||||
// sorts.addListener((ListChangeListener<Sort>) c -> {
|
||||
// setPage(1);
|
||||
// });
|
||||
|
||||
HBox hbox = new HBox(
|
||||
previousPageButton,
|
||||
pageText,
|
||||
pageTextContainer,
|
||||
nextPageButton
|
||||
);
|
||||
hbox.getStyleClass().addAll("std-padding", "std-spacing");
|
||||
setCenter(hbox);
|
||||
}
|
||||
|
||||
public void setPage(int page) {
|
||||
try {
|
||||
fetching.set(true);
|
||||
PageRequest pagination = new PageRequest(page - 1, itemsPerPage.get(), sorts);
|
||||
var p = fetcher.fetchPage(pagination);
|
||||
int totalResults = fetcher.getTotalCount();
|
||||
target.setAll(p.items());
|
||||
if (totalResults != -1) {
|
||||
int max = totalResults / itemsPerPage.get();
|
||||
if (totalResults % itemsPerPage.get() != 0) {
|
||||
max += 1;
|
||||
}
|
||||
maxPages.set(max);
|
||||
fetching.set(true);
|
||||
PageRequest pagination = new PageRequest(page - 1, itemsPerPage.get(), sorts);
|
||||
Thread.ofVirtual().start(() -> {
|
||||
try {
|
||||
var p = fetcher.fetchPage(pagination);
|
||||
int totalResults = fetcher.getTotalCount();
|
||||
Platform.runLater(() -> {
|
||||
target.setAll(p.items());
|
||||
if (totalResults != -1) {
|
||||
int max = totalResults / itemsPerPage.get();
|
||||
if (totalResults % itemsPerPage.get() != 0) {
|
||||
max += 1;
|
||||
}
|
||||
maxPages.set(max);
|
||||
}
|
||||
currentPage.set(page);
|
||||
fetching.set(false);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(System.err);
|
||||
Platform.runLater(() -> {
|
||||
target.clear();
|
||||
fetching.set(false);
|
||||
});
|
||||
}
|
||||
currentPage.set(page);
|
||||
} catch (Exception e) {
|
||||
target.clear();
|
||||
e.printStackTrace(System.err);
|
||||
} finally {
|
||||
fetching.set(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Loading…
Reference in New Issue