Author: jflesch
Date: 2007-04-23 01:07:57 +0000 (Mon, 23 Apr 2007)
New Revision: 12890
Modified:
trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
trunk/apps/Thaw/src/thaw/i18n/thaw.properties
trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
trunk/apps/Thaw/src/thaw/plugins/index/Comment.java
trunk/apps/Thaw/src/thaw/plugins/index/CommentTab.java
Log:
Add a field to change quickly the trust level when reading comments
Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2007-04-23
00:43:25 UTC (rev 12889)
+++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2007-04-23
01:07:57 UTC (rev 12890)
@@ -80,6 +80,7 @@
thaw.common.closeTab=Fermer cette tabulation
+thaw.common.apply=Appliquer
## Errors
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-04-23 00:43:25 UTC
(rev 12889)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-04-23 01:07:57 UTC
(rev 12890)
@@ -80,9 +80,10 @@
thaw.common.closeTab=Close this tab
thaw.common.closeWin=Close the window
-
thaw.common.autodetect=Auto-detect
+thaw.common.apply=Apply
+
## Errors
thaw.error.idAlreadyUsed=Unable to connect. Our Id is already used by another
client connected to the node.
Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2007-04-23 00:43:25 UTC
(rev 12889)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2007-04-23 01:07:57 UTC
(rev 12890)
@@ -80,6 +80,7 @@
thaw.common.closeTab=Fermer cette tabulation
+thaw.common.apply=Appliquer
## Errors
Modified: trunk/apps/Thaw/src/thaw/plugins/index/Comment.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Comment.java 2007-04-23 00:43:25 UTC
(rev 12889)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Comment.java 2007-04-23 01:07:57 UTC
(rev 12890)
@@ -9,10 +9,13 @@
import java.util.Observer;
import java.util.Observable;
+import java.util.Vector;
+
/* Swing */
import javax.swing.JPanel;
import javax.swing.JLabel;
+import javax.swing.JComboBox;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JButton;
@@ -22,6 +25,9 @@
import java.awt.GridLayout;
import java.awt.BorderLayout;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
/* DOM */
import javax.xml.parsers.DocumentBuilder;
@@ -91,7 +97,7 @@
* Will use, from the configuration:
* 'userNickname' as the author name
*/
-public class Comment extends Observable implements Observer {
+public class Comment extends Observable implements Observer, ActionListener {
public final static int MAX_SIZE = 16384;
private Identity author;
@@ -130,7 +136,13 @@
}
- public JPanel getPanel() {
+ private CommentTab tab;
+ private JComboBox trust;
+ private JButton changeTrust;
+
+ public JPanel getPanel(CommentTab tab) {
+ this.tab= tab;
+
JPanel panel = new JPanel(new BorderLayout(10, 10));
JTextArea text = new JTextArea(comment.trim());
@@ -142,10 +154,10 @@
JLabel sigLabel = new
JLabel(I18n.getMessage("thaw.plugin.signature.trustLevel.trustLevel")+ " : ");
JTextField sigLevel = new
JTextField(I18n.getMessage(author.getTrustLevelStr())
- + (author.isDup() ?
I18n.getMessage("thaw.plugin.signature.duplicata") : ""));
+ + (author.isDup() ? " - "
+ I18n.getMessage("thaw.plugin.signature.duplicata") : ""));
- sigLevel.setDisabledTextColor(author.getTrustLevelColor());
+ sigLevel.setForeground(author.getTrustLevelColor());
sigLevel.setEditable(false);
sigLevel.setBackground(panel.getBackground());
@@ -154,9 +166,29 @@
sigPanel.add(sigLabel, BorderLayout.WEST);
sigPanel.add(sigLevel, BorderLayout.CENTER);
+
+ Vector trustLevels = new Vector();
+
+ for (int i = 0 ; i < Identity.trustLevelInt.length ; i++) {
+ if (Identity.trustLevelInt[i] < 100)
+
trustLevels.add(I18n.getMessage(Identity.trustLevelStr[i]));
+ }
+
+
+ trust = new JComboBox(trustLevels);
+
trust.setSelectedItem(I18n.getMessage(author.getTrustLevelStr()));
+ changeTrust = new JButton(I18n.getMessage("thaw.common.apply"));
+ changeTrust.addActionListener(this);
+
+ JPanel trustPanel = new JPanel(new BorderLayout());
+ trustPanel.add(trust, BorderLayout.CENTER);
+ trustPanel.add(changeTrust, BorderLayout.EAST);
+
+
JPanel bottomPanel = new JPanel(new BorderLayout());
bottomPanel.add(sigPanel, BorderLayout.WEST);
bottomPanel.add(new JLabel(""), BorderLayout.CENTER);
+ bottomPanel.add(trustPanel, BorderLayout.EAST);
text.setEditable(false);
@@ -170,6 +202,17 @@
}
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource() == changeTrust) {
+ if (author == null)
+ return;
+ author.setTrustLevel((String)trust.getSelectedItem());
+ tab.updateCommentList();
+ return;
+ }
+ }
+
+
/**
* Will write it in a temporary file
*/
Modified: trunk/apps/Thaw/src/thaw/plugins/index/CommentTab.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/CommentTab.java 2007-04-23
00:43:25 UTC (rev 12889)
+++ trunk/apps/Thaw/src/thaw/plugins/index/CommentTab.java 2007-04-23
01:07:57 UTC (rev 12890)
@@ -100,7 +100,7 @@
for (Iterator it = comments.iterator();
it.hasNext();) {
- JPanel panel = ((Comment)it.next()).getPanel();
+ JPanel panel =
((Comment)it.next()).getPanel(this);
insidePanel.add(panel);
}
@@ -108,6 +108,8 @@
centerPanel.add(new JScrollPane(insidePanel),
BorderLayout.NORTH);
centerPanel.add(new JLabel(""), BorderLayout.CENTER);
+
+ centerPanel.revalidate();
}