Skip to content

Commit

Permalink
Merge remote-tracking branch 'lfcnassif/#2205_IncreaseDefaultRowHeight'
Browse files Browse the repository at this point in the history
  • Loading branch information
lfcnassif committed May 19, 2024
2 parents e9141ed + a9dfe5e commit 46a9f15
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
8 changes: 6 additions & 2 deletions iped-app/src/main/java/iped/app/ui/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,6 @@ public void createGUI() {
resultsTable.setDefaultRenderer(String.class, new TableCellRenderer());
resultsTable.setShowGrid(false);
resultsTable.setAutoscrolls(false);
((JComponent) resultsTable.getDefaultRenderer(Boolean.class)).setOpaque(true);
FilterTableHeaderController.init(resultsTable.getTableHeader());

InputMap inputMap = resultsTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
Expand Down Expand Up @@ -1486,8 +1485,9 @@ public void updateIconContainersUI(int size, boolean updateUI) {
}

private void updateIconContainerUI(JComponent comp, int size, boolean updateUI) {
JTable table = null;
if (comp instanceof JTable && comp != gallery) {
JTable table = (JTable) comp;
table = (JTable) comp;
table.setRowHeight(size);

// Set bookmark icons column width based on current icon size
Expand All @@ -1500,6 +1500,10 @@ private void updateIconContainerUI(JComponent comp, int size, boolean updateUI)
if (updateUI) {
comp.updateUI();
}
if (table != null) {
// Fix the background of boolean columns (with a CheckBox)
((JComponent) table.getDefaultRenderer(Boolean.class)).setOpaque(true);
}
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion iped-app/src/main/java/iped/app/ui/IconManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/
public class IconManager {

public static final int defaultSize = 16;
public static final int defaultSize = 18;
public static final int defaultGallerySize = 24;
public static final int defaultCategorySize = 20;

Expand Down
10 changes: 9 additions & 1 deletion iped-app/src/main/java/iped/app/ui/utils/UiIconSize.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import iped.app.ui.IconManager;
Expand All @@ -14,6 +15,7 @@ public class UiIconSize {
private static final String[] keys = new String[] { "CatIconSize", "GalleryIconSize", "TableIconSize" };
private static final String[] comments = new String[] { "for categories", "in the gallery",
"in tables and other UI elements" };
private static final String lastSavedKey = "LastSaved";
private static final int[] defaultSizes = new int[] { IconManager.defaultCategorySize,
IconManager.defaultGallerySize, IconManager.defaultSize };

Expand All @@ -26,7 +28,7 @@ public static int[] loadUserSetting() {
UTF8Properties prop = new UTF8Properties();
prop.load(file);

boolean missing = false;
boolean missing = prop.getProperty(lastSavedKey) == null;
for (int i = 0; i < keys.length; i++) {
String value = prop.getProperty(keys[i]);
if (value != null) {
Expand All @@ -37,6 +39,11 @@ public static int[] loadUserSetting() {
}

if (missing) {
for (int i = 0; i < keys.length; i++) {
if (sizes[i] < defaultSizes[i]) {
sizes[i] = defaultSizes[i];
}
}
saveUserSetting(sizes);
}
}
Expand All @@ -57,6 +64,7 @@ public static void saveUserSetting(int[] sizes) {
l.add(keys[i] + " = " + sizes[i]);
l.add("");
}
l.add(lastSavedKey + " = " + new Date());
Files.write(file.toPath(), l, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE);
} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import java.awt.Dimension;

import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.table.AbstractTableModel;
Expand All @@ -36,7 +35,6 @@ public HitsTable(AbstractTableModel tableModel) {
setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
getTableHeader().setPreferredSize(new Dimension(0, 0));
setShowGrid(false);
((JComponent) getDefaultRenderer(Boolean.class)).setOpaque(true);
}

@Override
Expand Down

0 comments on commit 46a9f15

Please sign in to comment.