You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rm...@apache.org on 2021/05/08 23:28:31 UTC
[logging-chainsaw] branch master updated: Resize rows when editing
so you can see what you're typing (#7)
This is an automated email from the ASF dual-hosted git repository.
rmiddleton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-chainsaw.git
The following commit(s) were added to refs/heads/master by this push:
new cfa2f39 Resize rows when editing so you can see what you're typing (#7)
cfa2f39 is described below
commit cfa2f3914ffc0f9beee62d810a738d930b83cd3d
Author: Robert Middleton <rm...@users.noreply.github.com>
AuthorDate: Sat May 8 19:28:22 2021 -0400
Resize rows when editing so you can see what you're typing (#7)
---
.../log4j/chainsaw/receivers/PluginPropertyEditorPanel.java | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/log4j/chainsaw/receivers/PluginPropertyEditorPanel.java b/src/main/java/org/apache/log4j/chainsaw/receivers/PluginPropertyEditorPanel.java
index 12153ce..eac5750 100644
--- a/src/main/java/org/apache/log4j/chainsaw/receivers/PluginPropertyEditorPanel.java
+++ b/src/main/java/org/apache/log4j/chainsaw/receivers/PluginPropertyEditorPanel.java
@@ -38,6 +38,8 @@ import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.util.*;
import java.util.List;
+import javax.swing.event.CellEditorListener;
+import javax.swing.table.TableCellRenderer;
/**
@@ -175,8 +177,10 @@ public class PluginPropertyEditorPanel extends JPanel {
logger.debug("Cell value class " + valueClass +
" not know, using default editor");
- return defaultEditor.getTableCellEditorComponent(table, value,
+ Component c = defaultEditor.getTableCellEditorComponent(table, value,
isSelected, row, column);
+ table.setRowHeight( row, c.getPreferredSize().height );
+ return c;
}
/* (non-Javadoc)
@@ -189,7 +193,7 @@ public class PluginPropertyEditorPanel extends JPanel {
}
- private static class PluginPropertyTableModel extends AbstractTableModel {
+ private class PluginPropertyTableModel extends AbstractTableModel {
private final PropertyDescriptor[] descriptors;
private final Plugin plugin;
@@ -314,6 +318,9 @@ public class PluginPropertyEditorPanel extends JPanel {
} else {
super.setValueAt(aValue, rowIndex, columnIndex);
}
+
+ // Since the value has been set, resize all of the rows(if required)
+ propertyTable.setRowHeight(ChainsawConstants.DEFAULT_ROW_HEIGHT);
}
/**