svn commit: r13091 - trunk/src_new/org/argouml: cognitive/critics/ui i18n

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2007-07-16 11:08:00-0700
New Revision: 13091

Added:
   trunk/src_new/org/argouml/cognitive/critics/ui/TableCritics.java   (contents, props changed)
   trunk/src_new/org/argouml/cognitive/critics/ui/TableModelCritics.java   (contents, props changed)
Modified:
   trunk/src_new/org/argouml/cognitive/critics/ui/CriticBrowserDialog.java
   trunk/src_new/org/argouml/i18n/dialog.properties

Log:
Show some more Critic attributes in the CriticBrowser.

Using progressive disclosure (i.e. the principle behind the "Advanced" button).

Modified: trunk/src_new/org/argouml/cognitive/critics/ui/CriticBrowserDialog.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/cognitive/critics/ui/CriticBrowserDialog.java?view=diff&rev=13091&p1=trunk/src_new/org/argouml/cognitive/critics/ui/CriticBrowserDialog.java&p2=trunk/src_new/org/argouml/cognitive/critics/ui/CriticBrowserDialog.java&r1=13090&r2=13091
==============================================================================
--- trunk/src_new/org/argouml/cognitive/critics/ui/CriticBrowserDialog.java	(original)
+++ trunk/src_new/org/argouml/cognitive/critics/ui/CriticBrowserDialog.java	2007-07-16 11:08:00-0700
@@ -34,12 +34,6 @@
 import java.awt.event.ActionListener;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
-import java.beans.PropertyChangeEvent;
-import java.beans.VetoableChangeListener;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
 import java.util.Observable;
 import java.util.Observer;
 
@@ -49,23 +43,17 @@
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
-import javax.swing.JTable;
 import javax.swing.JTextArea;
 import javax.swing.JTextField;
-import javax.swing.ListSelectionModel;
-import javax.swing.SwingUtilities;
 import javax.swing.event.DocumentEvent;
 import javax.swing.event.DocumentListener;
 import javax.swing.event.ListSelectionEvent;
 import javax.swing.event.ListSelectionListener;
 import javax.swing.event.TableModelEvent;
 import javax.swing.event.TableModelListener;
-import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumn;
 import javax.swing.text.Document;
 
 import org.apache.log4j.Logger;
-import org.argouml.cognitive.Agency;
 import org.argouml.cognitive.Critic;
 import org.argouml.cognitive.ToDoItem;
 import org.argouml.cognitive.Translator;
@@ -77,8 +65,7 @@
  * Dialog box to list all critics and allow editing of some of their
  * properties. <p>
  *
- * TODO: knowledge type, supported goals,
- * supported decisions, critic network.
+ * TODO: supported goals, critic network.
  */
 public class CriticBrowserDialog extends ArgoDialog
     implements ActionListener,
@@ -92,11 +79,6 @@
 
     private static int numCriticBrowser = 0;
 
-    ////////////////////////////////////////////////////////////////
-    // constants
-    private static final String DESC_WIDTH_TEXT =
-	"This is Sample Text for determining Column Width";
-
     private static final int NUM_COLUMNS = 25;
 
     private static final String HIGH =
@@ -139,8 +121,8 @@
     private JLabel clarifierLabel = new JLabel(
             Translator.localize("dialog.browse.label.use-clarifier"));
 
-    private TableModelCritics tableModel  = new TableModelCritics();
-    private JTable table        = new JTable();
+    private TableCritics table;
+
     private JTextField className = new JTextField("", NUM_COLUMNS);
     private JTextField headline = new JTextField("", NUM_COLUMNS);
     private JComboBox priority  = new JComboBox(PRIORITIES);
@@ -156,10 +138,11 @@
             Translator.localize("dialog.browse.button.edit-network"));
     private JButton goButton      = new JButton(
             Translator.localize("dialog.browse.button.go"));
+    private JButton advancedButton  = new JButton(
+            Translator.localize("dialog.browse.button.advanced"));
 
     private Critic target;
 
-    private List<Critic>   critics;
 
     /**
      * The constructor.
@@ -173,43 +156,16 @@
        
 	// Critics Table
 	JPanel tablePanel = new JPanel(new BorderLayout(5, 5));
-
-	critics = new ArrayList<Critic>(Agency.getCriticList());
-	Collections.sort(critics, new Comparator<Critic>() {
-	    public int compare(Critic o1, Critic o2) {
-		return o1.getHeadline().compareTo(o2.getHeadline());
-	    }
-	});
-	tableModel.setTarget(critics);
-	table.setModel(tableModel);
-	table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-	table.setShowVerticalLines(false);
-	table.getSelectionModel().addListSelectionListener(this);
-        table.getModel().addTableModelListener(this);
-	table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
-	TableColumn checkCol = table.getColumnModel().getColumn(0);
-	TableColumn descCol = table.getColumnModel().getColumn(1);
-	TableColumn actCol = table.getColumnModel().getColumn(2);
-	checkCol.setMinWidth(35);
-	checkCol.setMaxWidth(35);
-	checkCol.setWidth(30);
-	int descWidth = table.getFontMetrics(table.getFont())
-	        .stringWidth(DESC_WIDTH_TEXT);
-	descCol.setMinWidth(descWidth);
-	descCol.setWidth(descWidth); // no maximum set, so it will stretch...
-	actCol.setMinWidth(50);
-	actCol.setMaxWidth(50);
-	actCol.setWidth(50);
-
-	tablePanel.add(criticsLabel, BorderLayout.NORTH);
+        table = new TableCritics(new TableModelCritics(false), this, this);
+        criticsLabel.setText(criticsLabel.getText() + " (" 
+                + table.getModel().getRowCount() + ")");
+        tablePanel.add(criticsLabel, BorderLayout.NORTH);
 	JScrollPane tableSP = new JScrollPane(table);
 	tablePanel.add(tableSP, BorderLayout.CENTER);
 
 	// Set tableSP's preferred height to 0 so that details height
 	// is used in pack()
-	tableSP.setPreferredSize(new Dimension(checkCol.getWidth()
-	        + descCol.getWidth() + actCol.getWidth() + 20,
-	        0));
+	tableSP.setPreferredSize(table.getInitialSize());
         bsp.add(tablePanel, BorderSplitPane.CENTER);
         
 	// Critic Details panel
@@ -298,6 +254,7 @@
 	fieldConstraints.gridy = 6;
 	JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
 	buttonPanel.add(wakeButton);
+        buttonPanel.add(advancedButton);
         /* TODO: These buttons for future enhancement:
 	buttonPanel.add(configButton);
 	buttonPanel.add(networkButton); */
@@ -318,6 +275,7 @@
         goButton.addActionListener(this);
         networkButton.addActionListener(this);
         wakeButton.addActionListener(this);
+        advancedButton.addActionListener(this);
         configButton.addActionListener(this);
         headline.getDocument().addDocumentListener(this);
         moreInfo.getDocument().addDocumentListener(this);
@@ -335,20 +293,33 @@
         
         goButton.setEnabled(false);
         wakeButton.setEnabled(false);
+        advancedButton.setEnabled(true);
         networkButton.setEnabled(false);
         configButton.setEnabled(false);
+
+        useClar.setSelectedItem(null);
+        useClar.repaint();
     }
     
     /**
      * @param t the new target
      */
-    private void setTarget(Object t) {
-	target = (Critic) t;
+    private void setTarget(Critic cr) {
+        if (cr == null) {
+            enableFieldsAndButtons();
+            className.setText("");
+            headline.setText("");
+            priority.setSelectedItem(null);
+            priority.repaint();
+            moreInfo.setText("");
+            desc.setText("");
+            return;
+        }
         updateButtonsEnabled();
-	className.setText(target.getClass().getName());
-	headline.setText(target.getHeadline());
+	className.setText(cr.getClass().getName());
+	headline.setText(cr.getHeadline());
 
-	int p = target.getPriority();
+	int p = cr.getPriority();
 	if (p == ToDoItem.HIGH_PRIORITY) {
 	    priority.setSelectedItem(HIGH);
 	} else if (p == ToDoItem.MED_PRIORITY) {
@@ -358,8 +329,8 @@
 	}
 	priority.repaint();
 
-	moreInfo.setText(target.getMoreInfoURL());
-	desc.setText(target.getDescriptionTemplate());
+	moreInfo.setText(cr.getMoreInfoURL());
+	desc.setText(cr.getDescriptionTemplate());
 	desc.setCaretPosition(0);
 	useClar.setSelectedItem(ALWAYS);
 	useClar.repaint();
@@ -367,7 +338,6 @@
 
     /**
      * Updates the states of the buttons
-     *
      */
     protected void updateButtonsEnabled() {
         this.configButton.setEnabled(false);
@@ -441,6 +411,10 @@
             table.repaint();
 	    return;
 	}
+        if (e.getSource() == advancedButton) {
+            table.setAdvanced(true);
+            advancedButton.setEnabled(false);
+        }
 	LOG.debug("unknown src in CriticBrowserDialog: " + e.getSource());
     }
 
@@ -459,7 +433,7 @@
         if (this.target != null) {
             this.target.deleteObserver(this);
         }
-	setTarget(critics.get(row));
+	setTarget((row == -1) ? null : table.getCriticAtRow(row));
         if (this.target != null) {
             this.target.addObserver(this);
         }
@@ -525,121 +499,4 @@
         table.repaint();
     }
 
-} /* end class CriticBrowserDialog */
-
-
-
-
-class TableModelCritics extends AbstractTableModel
-    implements VetoableChangeListener {
-    private static final Logger LOG =
-	Logger.getLogger(TableModelCritics.class);
-
-    ////////////////
-    // instance varables
-    private List target;
-
-    /**
-     * Constructor.
-     */
-    public TableModelCritics() { }
-
-    ////////////////
-    // accessors
-    /**
-     * @param critics the list of critics
-     */
-    public void setTarget(List critics) {
-	target = critics;
-	//fireTableStructureChanged();
-    }
-
-    ////////////////
-    // TableModel implemetation
-    /*
-     * @see javax.swing.table.TableModel#getColumnCount()
-     */
-    public int getColumnCount() { return 3; }
-
-    /*
-     * @see javax.swing.table.TableModel#getColumnName(int)
-     */
-    public String getColumnName(int c) {
-	if (c == 0)
-	    return Translator.localize("dialog.browse.column-name.active");
-	if (c == 1)
-	    return Translator.localize("dialog.browse.column-name.headline");
-	if (c == 2)
-	    return Translator.localize("dialog.browse.column-name.snoozed");
-	return "XXX";
-    }
-
-    /*
-     * @see javax.swing.table.TableModel#getColumnClass(int)
-     */
-    public Class getColumnClass(int c) {
-	if (c == 0) {
-            return Boolean.class;
-        }
-	if (c == 1) {
-            return String.class;
-        }
-	if (c == 2) {
-            return String.class;
-        }
-	return String.class;
-    }
-
-    /*
-     * @see javax.swing.table.TableModel#isCellEditable(int, int)
-     */
-    public boolean isCellEditable(int row, int col) {
-	return col == 0;
-    }
-
-    /*
-     * @see javax.swing.table.TableModel#getRowCount()
-     */
-    public int getRowCount() {
-	if (target == null) return 0;
-	return target.size();
-    }
-
-    /*
-     * @see javax.swing.table.TableModel#getValueAt(int, int)
-     */
-    public Object getValueAt(int row, int col) {
-	Critic cr = (Critic) target.get(row);
-	if (col == 0) return cr.isEnabled() ? Boolean.TRUE : Boolean.FALSE;
-	if (col == 1) return cr.getHeadline();
-	if (col == 2) return cr.isActive() ? "no" : "yes";
-	return "CR-" + row * 2 + col; // for debugging
-    }
-
-    /*
-     * @see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int)
-     */
-    public void setValueAt(Object aValue, int rowIndex, int columnIndex)  {
-	LOG.debug("setting table value " + rowIndex + ", " + columnIndex);
-	if (columnIndex != 0) return;
-	if (!(aValue instanceof Boolean)) return;
-	Boolean enable = (Boolean) aValue;
-	Critic cr = (Critic) target.get(rowIndex);
-	cr.setEnabled(enable.booleanValue());
-	fireTableRowsUpdated(rowIndex, rowIndex); //TODO:
-    }
-
-    ////////////////
-    // event handlers
-
-    /*
-     * @see java.beans.VetoableChangeListener#vetoableChange(java.beans.PropertyChangeEvent)
-     */
-    public void vetoableChange(PropertyChangeEvent pce) {
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                fireTableStructureChanged();
-            }
-        });
-    }
-} /* end class TableModelCritics */
+}

Added: trunk/src_new/org/argouml/cognitive/critics/ui/TableCritics.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/cognitive/critics/ui/TableCritics.java?view=auto&rev=13091
==============================================================================
--- (empty file)
+++ trunk/src_new/org/argouml/cognitive/critics/ui/TableCritics.java	2007-07-16 11:08:00-0700
@@ -0,0 +1,118 @@
+// $Id$
+// Copyright (c) 2007 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.cognitive.critics.ui;
+
+import java.awt.Dimension;
+
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableModel;
+
+import org.argouml.cognitive.Critic;
+
+/**
+ * This class represents the table shown in the Critics Browser dialog. <p>
+ * 
+ * This is a seperate class so that 
+ * the CriticsBrowser does not need to know 
+ * what the table contains, i.e. how many columns it has, etc. 
+ *
+ * @author Michiel
+ */
+class TableCritics extends JTable {
+
+    private boolean initialised;
+    private static final String DESC_WIDTH_TEXT =
+        "This is Sample Text for determining Column Width";
+
+    public TableCritics(TableModel model, 
+            ListSelectionListener lsl, TableModelListener tml) {
+        super(model);
+        setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        setShowVerticalLines(false);
+        getSelectionModel().addListSelectionListener(lsl);
+        getModel().addTableModelListener(tml);
+        setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
+
+        initialised = true;
+        setColumnWidths();
+    }
+
+    private void setColumnWidths() {
+        if (!initialised) return;
+        TableColumn checkCol = getColumnModel().getColumn(0);
+        TableColumn descCol = getColumnModel().getColumn(1);
+        TableColumn actCol = getColumnModel().getColumn(2);
+        checkCol.setMinWidth(35);
+        checkCol.setMaxWidth(35);
+        checkCol.setWidth(30);
+        int descWidth = getFontMetrics(getFont())
+                .stringWidth(DESC_WIDTH_TEXT);
+        descCol.setMinWidth(descWidth);
+        descCol.setWidth(descWidth); // no maximum set, so it will stretch...
+        actCol.setMinWidth(50);
+        actCol.setMaxWidth(55);
+        actCol.setWidth(55);
+        /* and for advanced mode: */
+        if (getColumnModel().getColumnCount() > 3) {
+            descCol.setMinWidth(descWidth / 2);
+            TableColumn prioCol = getColumnModel().getColumn(3);
+            prioCol.setMinWidth(45);
+            prioCol.setMaxWidth(50);
+            prioCol.setWidth(50);
+        }
+    }
+    
+    public Critic getCriticAtRow(int row) {
+        TableModelCritics model = (TableModelCritics) getModel();
+        return model.getCriticAtRow(row);
+    }
+
+    public Dimension getInitialSize() {
+        return new Dimension(getColumnModel().getTotalColumnWidth() + 20, 0);
+    }
+    
+    public void setAdvanced(boolean mode) {
+        TableModelCritics model = (TableModelCritics) getModel();
+        model.setAdvanced(mode);
+    }
+
+    /**
+     * @see javax.swing.JTable#tableChanged(javax.swing.event.TableModelEvent)
+     */
+    @Override
+    public void tableChanged(TableModelEvent e) {
+        super.tableChanged(e);
+        /* This changes the complete structure of the table, 
+         * so we need to set the column widths again. */
+        setColumnWidths();
+    }
+
+    
+}

Added: trunk/src_new/org/argouml/cognitive/critics/ui/TableModelCritics.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/cognitive/critics/ui/TableModelCritics.java?view=auto&rev=13091
==============================================================================
--- (empty file)
+++ trunk/src_new/org/argouml/cognitive/critics/ui/TableModelCritics.java	2007-07-16 11:08:00-0700
@@ -0,0 +1,214 @@
+// $Id$
+// Copyright (c) 2007 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.cognitive.critics.ui;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.VetoableChangeListener;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.swing.SwingUtilities;
+import javax.swing.table.AbstractTableModel;
+
+import org.apache.log4j.Logger;
+import org.argouml.cognitive.Agency;
+import org.argouml.cognitive.Critic;
+import org.argouml.cognitive.Translator;
+
+/**
+ * The Table Model from the Critics Browser dialog. <p>
+ * 
+ * This class used to be part of the CriticBrowserDialog.java file. <p>
+ * 
+ * In advanced mode, this model also handles 
+ * priority, supportedDecisions, knowledgeTypes.
+ */
+class TableModelCritics extends AbstractTableModel
+    implements VetoableChangeListener {
+
+    private static final Logger LOG =
+        Logger.getLogger(TableModelCritics.class);
+
+    private List<Critic> critics;
+    private boolean advanced;
+
+    /**
+     * Constructor.
+     *
+     * @param advancedMode true if we show advanced columns
+     */
+    public TableModelCritics(boolean advancedMode) { 
+        critics = new ArrayList<Critic>(Agency.getCriticList());
+        // Set initial sorting on Critic Headline
+        Collections.sort(critics, new Comparator<Critic>() {
+            public int compare(Critic o1, Critic o2) {
+                return o1.getHeadline().compareTo(o2.getHeadline());
+            }
+        });
+        advanced = advancedMode;
+    }
+
+    /**
+     * @param row the selected row
+     * @return the Critic shown on that row
+     */
+    public Critic getCriticAtRow(int row) {
+        return critics.get(row);
+    }
+
+    //  TableModel implemetation
+    /*
+     * @see javax.swing.table.TableModel#getColumnCount()
+     */
+    public int getColumnCount() { 
+        return advanced ? 6 : 3; 
+    }
+
+    /*
+     * @see javax.swing.table.TableModel#getColumnName(int)
+     */
+    public String getColumnName(int c) {
+        if (c == 0)
+            return Translator.localize("dialog.browse.column-name.active");
+        if (c == 1)
+            return Translator.localize("dialog.browse.column-name.headline");
+        if (c == 2)
+            return Translator.localize("dialog.browse.column-name.snoozed");
+        if (c == 3)
+            return Translator.localize("dialog.browse.column-name.priority");
+        if (c == 4)
+            return Translator.localize(
+                    "dialog.browse.column-name.supported-decision");
+        if (c == 5)
+            return Translator.localize(
+                    "dialog.browse.column-name.knowledge-type");
+        throw new IllegalArgumentException();
+    }
+
+    /*
+     * @see javax.swing.table.TableModel#getColumnClass(int)
+     */
+    public Class< ? > getColumnClass(int c) {
+        if (c == 0) {
+            return Boolean.class;
+        }
+        if (c == 1) {
+            return String.class;
+        }
+        if (c == 2) {
+            return String.class;
+        }
+        if (c == 3) {
+            return Integer.class;
+        }
+        if (c == 4) {
+            return String.class;
+        }
+        if (c == 5) {
+            return String.class;
+        }
+        throw new IllegalArgumentException();
+    }
+
+    /*
+     * @see javax.swing.table.TableModel#isCellEditable(int, int)
+     */
+    public boolean isCellEditable(int row, int col) {
+        return col == 0;
+    }
+
+    /*
+     * @see javax.swing.table.TableModel#getRowCount()
+     */
+    public int getRowCount() {
+        if (critics == null) return 0;
+        return critics.size();
+    }
+
+    /*
+     * @see javax.swing.table.TableModel#getValueAt(int, int)
+     */
+    public Object getValueAt(int row, int col) {
+        Critic cr = critics.get(row);
+        if (col == 0) return cr.isEnabled() ? Boolean.TRUE : Boolean.FALSE;
+        if (col == 1) return cr.getHeadline();
+        if (col == 2) return cr.isActive() ? "no" : "yes";
+        if (col == 3) return cr.getPriority();
+        if (col == 4) return listToString(cr.getSupportedDecisions());
+        if (col == 5) return listToString(cr.getKnowledgeTypes());
+        throw new IllegalArgumentException();
+    }
+    
+    private String listToString(List l) {
+        StringBuffer buf = new StringBuffer();
+        Iterator i = l.iterator();
+        boolean hasNext = i.hasNext();
+        while (hasNext) {
+            Object o = i.next();
+            buf.append(String.valueOf(o));
+            hasNext = i.hasNext();
+            if (hasNext)
+                buf.append(", ");
+        }
+        return buf.toString();
+    }
+
+    /*
+     * @see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int)
+     */
+    public void setValueAt(Object aValue, int rowIndex, int columnIndex)  {
+        LOG.debug("setting table value " + rowIndex + ", " + columnIndex);
+        if (columnIndex != 0) return;
+        if (!(aValue instanceof Boolean)) return;
+        Boolean enable = (Boolean) aValue;
+        Critic cr = critics.get(rowIndex);
+        cr.setEnabled(enable.booleanValue());
+        fireTableRowsUpdated(rowIndex, rowIndex); //TODO:
+    }
+
+    /*
+     * TODO: Why is this here? Who is calling this?
+     * 
+     * @see java.beans.VetoableChangeListener#vetoableChange(java.beans.PropertyChangeEvent)
+     */
+    public void vetoableChange(PropertyChangeEvent pce) {
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                fireTableStructureChanged();
+            }
+        });
+    }
+
+    /**
+     * @param advancedMode true causes advanced mode
+     */
+    void setAdvanced(boolean advancedMode) {
+        advanced = advancedMode;
+        fireTableStructureChanged();
+    }
+}

Modified: trunk/src_new/org/argouml/i18n/dialog.properties
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/i18n/dialog.properties?view=diff&rev=13091&p1=trunk/src_new/org/argouml/i18n/dialog.properties&p2=trunk/src_new/org/argouml/i18n/dialog.properties&r1=13090&r2=13091
==============================================================================
--- trunk/src_new/org/argouml/i18n/dialog.properties	(original)
+++ trunk/src_new/org/argouml/i18n/dialog.properties	2007-07-16 11:08:00-0700
@@ -25,13 +25,17 @@
 dialog.add-associated-classifierroles = Add Associated Classifier Roles
 dialog.add-associations = Add Associations
 dialog.add-predecessors = Add Predecessors
+dialog.browse.button.advanced = Advanced
 dialog.browse.button.configure = Configure
 dialog.browse.button.edit-network = Edit Network
 dialog.browse.button.go = Go
 dialog.browse.button.wake = Wake
 dialog.browse.column-name.active = Active
 dialog.browse.column-name.headline = Headline
+dialog.browse.column-name.knowledge-type = Knowledge Type
+dialog.browse.column-name.priority = Priority
 dialog.browse.column-name.snoozed = Snoozed
+dialog.browse.column-name.supported-decision = Supported Decision
 dialog.browse.label.critic-class = Critic Class:
 dialog.browse.label.critics = Critics
 dialog.browse.label.description = Description:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.