Skip to content

Commit 2a5b0f3

Browse files
committed
removed padding from listcells
1 parent 63209ad commit 2a5b0f3

File tree

4 files changed

+9
-18
lines changed

4 files changed

+9
-18
lines changed

src/main/java/de/doubleslash/keeptime/view/ProjectsListViewController.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import java.util.Map;
88
import java.util.Map.Entry;
99
import java.util.Optional;
10-
import java.util.function.Consumer;
1110

1211
import org.slf4j.Logger;
1312
import org.slf4j.LoggerFactory;
@@ -80,14 +79,6 @@ public ProjectsListViewController(final Model model, final Controller controller
8079
addProjectToProjectSelectionNodeMap(project);
8180
}
8281

83-
// TODO why is there no nice way for listview height?
84-
// https://stackoverflow.com/questions/17429508/how-do-you-get-javafx-listview-to-be-the-height-of-its-items
85-
final Consumer<Double> updateSize = height -> {
86-
LOG.debug(String.format("%s%f", "update size ", height));
87-
availableProjectsListView.setPrefHeight(height);
88-
mainStage.sizeToScene(); // also update scene size
89-
};
90-
9182
searchTextField.textProperty().addListener((a, b, newValue) -> {
9283
LOG.info("New filter value: " + newValue);
9384
// TODO do i always have to create a new predicate?
@@ -100,10 +91,10 @@ public ProjectsListViewController(final Model model, final Controller controller
10091
final String lowerCaseFilter = newValue.toLowerCase();
10192

10293
if (project.getName().toLowerCase().contains(lowerCaseFilter)) {
103-
return true; // Filter matches first name.
94+
return true;
10495
}
10596

106-
return false; // Does not match.
97+
return false;
10798
});
10899
LOG.debug("Amount of projects to show '{}'.", filteredData.size());
109100
});
@@ -124,8 +115,9 @@ public ProjectsListViewController(final Model model, final Controller controller
124115
break;
125116
case ESCAPE:
126117
if (hideable) {
127-
searchTextField.getScene().getWindow().hide();
118+
mainStage.hide();
128119
}
120+
eh.consume();
129121
break;
130122
default:
131123
break;
@@ -144,8 +136,6 @@ public ProjectsListViewController(final Model model, final Controller controller
144136
});
145137

146138
availableProjectsListView.getSelectionModel().selectFirst();
147-
148-
searchTextField.setPromptText("Search");
149139
}
150140

151141
private void addProjectToProjectSelectionNodeMap(final Project project) {

src/main/resources/css/application.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767

6868
.list-cell {
6969
-fx-background-color: transparent;
70+
-fx-padding: 0px;
7071
}
7172

7273
.list-cell:selected {

src/main/resources/layouts/ViewLayout.fxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@
108108
<left>
109109
<VBox fx:id="projectsVBox" BorderPane.alignment="CENTER">
110110
<children>
111-
<TextField fx:id="searchTextField" maxHeight="15.0" minHeight="0.0" prefHeight="15.0" prefWidth="148.0" stylesheets="@../css/application.css">
111+
<TextField fx:id="searchTextField" maxHeight="15.0" minHeight="0.0" prefHeight="15.0" prefWidth="140.0" promptText="Search" stylesheets="@../css/application.css">
112112
<font>
113113
<Font name="Open Sans Regular" size="12.0" />
114114
</font>
115115
</TextField>
116-
<ListView fx:id="availableProjectsListView" prefHeight="130.0" prefWidth="148.0" stylesheets="@../css/application.css" />
116+
<ListView fx:id="availableProjectsListView" prefHeight="130.0" prefWidth="140.0" stylesheets="@../css/application.css" />
117117
<Button fx:id="addNewProjectButton" minHeight="-Infinity" mnemonicParsing="false" onAction="#addNewProject" prefHeight="23.0" prefWidth="120.0" stylesheets="@../css/application.css" text="+ Add new project">
118118
<font>
119119
<Font name="Open Sans Regular" size="12.0" />

src/main/resources/layouts/ViewLayoutPopup.fxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
<?import javafx.scene.layout.VBox?>
2222
<?import javafx.scene.text.Font?>
2323

24-
<VBox fx:id="root" prefHeight="425.0" prefWidth="145.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.doubleslash.keeptime.viewpopup.ViewControllerPopup">
24+
<VBox fx:id="root" prefHeight="350.0" prefWidth="145.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.doubleslash.keeptime.viewpopup.ViewControllerPopup">
2525
<children>
2626
<TextField fx:id="searchTextField" maxHeight="15.0" minHeight="0.0" prefHeight="15.0" promptText="Search" stylesheets="@../css/application.css">
2727
<font>
2828
<Font name="Open Sans Regular" size="12.0" />
2929
</font>
3030
</TextField>
31-
<ListView fx:id="projectListView" prefHeight="400.0" prefWidth="312.0" stylesheets="@../css/application.css" />
31+
<ListView fx:id="projectListView" prefHeight="335.0" prefWidth="145.0" stylesheets="@../css/application.css" />
3232
</children>
3333
</VBox>

0 commit comments

Comments
 (0)