From: Nomi H. <no...@us...> - 2004-01-31 02:18:37
|
Update of /cvsroot/gmod/apollo/src/java/apollo/gui/annotinfo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16722/annotinfo Modified Files: Commentator.java Log Message: 1. only set canned comment list index to 0 for creating a *new* comment 2. listener doesn't need to react to selection of item 0 Index: Commentator.java =================================================================== RCS file: /cvsroot/gmod/apollo/src/java/apollo/gui/annotinfo/Commentator.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Commentator.java 30 Jan 2004 00:12:15 -0000 1.7 --- Commentator.java 30 Jan 2004 01:18:00 -0000 1.8 *************** *** 170,179 **** cannedList.setMaximumSize(new Dimension(panelWidth, 20)); // Don't enable canned comment pulldown unless there's ! // at least one comment to edit cannedList.setEnabled(false); cannedList.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { int row = cannedList.getSelectedIndex(); ! if (row >= 0) { commentText.setText((String) cannedList.getSelectedItem()); updateComment(); --- 170,180 ---- cannedList.setMaximumSize(new Dimension(panelWidth, 20)); // Don't enable canned comment pulldown unless there's ! // at least one comment to edit (it will get enabled later if there is) cannedList.setEnabled(false); cannedList.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { int row = cannedList.getSelectedIndex(); ! // if (row >= 0) { ! if (row > 0) { commentText.setText((String) cannedList.getSelectedItem()); updateComment(); *************** *** 295,299 **** } if (newComment == null) { - // System.out.println ("Creating yet another comment"); String name = System.getProperty("user.name"); newComment = new Comment(clonedAnnot.getId(), --- 296,299 ---- *************** *** 302,305 **** --- 302,309 ---- System.currentTimeMillis()); clonedAnnot.addComment(newComment); + // Need to set selected index to 0 because otherwise if user wanted + // to use the same comment as last time (which would come up selected) + // they couldn't, because it would not register as a valueChanged event. + cannedList.setSelectedIndex(0); } return newComment; *************** *** 312,319 **** commentText.setEditable(true); cannedList.setEnabled(true); - // Need to set selected index to 0 because otherwise if user wanted - // to use the same comment as last time (which would come up selected) - // they couldn't, because it would not register as a valueChanged event. - cannedList.setSelectedIndex(0); delButton.setEnabled(true); isInternalCheckBox.setSelected(c.isInternal()); --- 316,319 ---- |