[cp-patches] FYI: JTable fixes

2005-11-21 Thread Roman Kennke
Hi,

I fixed a bug in the JTable and its UI implementation. The UI should
actually call JTable.prepareRenderer() to prepare the cell renderer,
instead of preparing the renderer in the UI. Also I removed some unused
code that was pointed out by Eclipse.

2005-11-21  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/JTable.java
(columnAtPoint): Removed unused code.
(rowAtPoint): Removed unused code.
(prepareRenderer): Moved renderer prepare code from the UI to this
method.
(getSelections): Removed unused code.
* javax/swing/plaf/basic/BasicTableUI.java
(paintCell): Call JTable.prepareRenderer instead of preparing
the renderer in the UI.
(paint): Removed some unused code.


/Roman
Index: javax/swing/JTable.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/JTable.java,v
retrieving revision 1.61
diff -u -r1.61 JTable.java
--- javax/swing/JTable.java	18 Nov 2005 21:46:19 -	1.61
+++ javax/swing/JTable.java	21 Nov 2005 13:13:21 -
@@ -1763,7 +1763,7 @@
 if ((event.getFirstRow() ==TableModelEvent.HEADER_ROW)
  autoCreateColumnsFromModel)
 
-createDefaultColumnsFromModel();
+  createDefaultColumnsFromModel();
 
 // If the structure changes, we need to revalidate, since that might
 // affect the size parameters of the JTable. Otherwise we only need
@@ -1796,7 +1796,6 @@
   {
 if (point != null)
   {
-int x0 = getLocation().x;
 int ncols = getColumnCount();
 Dimension gap = getIntercellSpacing();
 TableColumnModel cols = getColumnModel();
@@ -1826,7 +1825,6 @@
   {
 if (point != null)
   {
-int y0 = getLocation().y;
 int nrows = getRowCount();
 int height = getRowHeight();
 int y = point.y;
@@ -1984,8 +1982,6 @@
   }
   }
 
-
-
   public TableCellRenderer getCellRenderer(int row, int column)
   {
 TableCellRenderer renderer =
@@ -2038,19 +2034,29 @@
int row,
int column)
   {
-boolean rsa = getRowSelectionAllowed();
-boolean csa = getColumnSelectionAllowed();
-boolean rs = rsa ? getSelectionModel().isSelectedIndex(row) : false;
-boolean cs = csa ? columnModel.getSelectionModel().isSelectedIndex(column) : false;
-boolean isSelected = ((rsa  csa  rs  cs) 
-  || (rsa  !csa  rs) 
-  || (!rsa  csa  cs));
-
+
+boolean rowSelAllowed = getRowSelectionAllowed();
+boolean colSelAllowed = getColumnSelectionAllowed();
+boolean isSel = false;
+if (rowSelAllowed  colSelAllowed || !rowSelAllowed  !colSelAllowed)
+  isSel = isCellSelected(row, column);
+else
+  isSel = isRowSelected(row)  getRowSelectionAllowed()
+   || isColumnSelected(column)  getColumnSelectionAllowed();
+
+// Determine the focused cell. The focused cell is the cell at the
+// leadSelectionIndices of the row and column selection model.
+ListSelectionModel rowSel = getSelectionModel();
+ListSelectionModel colSel = getColumnModel().getSelectionModel();
+boolean hasFocus = hasFocus()  isEnabled()
+rowSel.getLeadSelectionIndex() == row
+colSel.getLeadSelectionIndex() == column;
+
 return renderer.getTableCellRendererComponent(this,
   dataModel.getValueAt(row, 
 		   convertColumnIndexToModel(column)),
-  isSelected,
-  false, // hasFocus
+  isSel,
+  hasFocus,
   row, column);
   }
 
@@ -2216,7 +,6 @@
 int lo = lsm.getMinSelectionIndex();
 int hi = lsm.getMaxSelectionIndex();
 int j = 0;
-java.util.ArrayList ls = new java.util.ArrayList();
 if (lo != -1  hi != -1)
   {
 switch (lsm.getSelectionMode())
Index: javax/swing/plaf/basic/BasicTableUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTableUI.java,v
retrieving revision 1.37
diff -u -r1.37 BasicTableUI.java
--- javax/swing/plaf/basic/BasicTableUI.java	15 Nov 2005 20:32:46 -	1.37
+++ javax/swing/plaf/basic/BasicTableUI.java	21 Nov 2005 13:13:21 -
@@ -1193,29 +1193,9 @@
  TableCellRenderer rend, TableModel data,
  int rowLead, int colLead)
   {
-boolean rowSelAllowed = table.getRowSelectionAllowed();
-boolean colSelAllowed = table.getColumnSelectionAllowed();
-boolean isSel = false;
-if (rowSelAllowed  colSelAllowed || !rowSelAllowed  !colSelAllowed)
-  isSel = table.isCellSelected(row, col);
-else
- 

Re: [cp-patches] FYI: JViewport system property

2005-11-21 Thread Roman Kennke
Hi Mark,


Am Samstag, den 19.11.2005, 20:04 +0100 schrieb Mark Wielaard:
 On Tue, 2005-11-15 at 21:23 +0100, Mark Wielaard wrote:
  On Tue, 2005-11-15 at 14:16 +, Roman Kennke wrote:
   2005-11-15  Roman Kennke  [EMAIL PROTECTED]
   
   * javax/swing/JViewport.java
   (JViewport): Recognize setting of a system property
   gnu.javax.swing.JViewport for the scrollMode.
   
   --- javax/swing/JViewport.java  27 Oct 2005 17:20:22 -  1.34
   +++ javax/swing/JViewport.java  15 Nov 2005 14:12:41 -
   @@ -246,7 +246,18 @@
  public JViewport()
  {
setOpaque(true);
   -setScrollMode(BLIT_SCROLL_MODE);
   +String scrollModeProp =
   +  System.getProperty(gnu.javax.swing.JViewport.scrollMode,
   + BLIT);
  
  You want to use gnu.classpath.SystemProperties.getProperty() here for
  the (admittedly unlikely) case a JViewport is instantiated through code
  that doesn't have enough permissions for reading that system property.
  
  It might also be an idea to make scrollModeProp static and only
  instantiate it once for efficiency. Although that might be an
  optimization that isn't really worth it since I guess instantiating
  JViewPorts isn't don't that often. And it would prevent changing this
  programmaticaly per instance of course. If that is desirable.
 
 Ping. Any comments?

I fixed this with the attached patch.

2005-11-21  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/JViewport.java
(static_initializer): Initialize the defaultScrollMode here.
(JViewport): Set the defaultScrollMode that was initialized in
the static initializer.

/Roman



signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] FYI: RepaintManager fix

2005-11-21 Thread Roman Kennke
Am Samstag, den 19.11.2005, 19:09 +0100 schrieb Mark Wielaard:
 Hi Roman,
 
 On Mon, 2005-11-14 at 12:52 +, Roman Kennke wrote:
  +  /**
  +   * The current repaint managers, indexed by their ThreadGroups.
  +   */
  +  static HashMap currentRepaintManagers;
 
 Isn't this a potential memory leak? Maybe there are not many
 ThreadGroups in an application ever. But it might be wise to use a
 WeakHashMap here so that the entry disappears when the ThreadGroup is
 garbage collected.

This is fixed using the attached patch.

2005-11-21  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/RepaintManager.java
(currentRepaintManagers): Use a WeakHashMap to avoid potential
memory leak.
(currentManager): Instantiate WeakHashMap instead of HashMap.
(setCurrentManager): Instantiate WeakHashMap instead of HashMap.

/Roman



signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: patch for DefaultEditorKit fixes PR 24925

2005-11-21 Thread Anthony Balkissoon
This patch fixes bug 24925 by not inserting text into a text component
that is either disabled or uneditable.  

Also, when a key is typed, instead of calling insertString, we should be
calling replaceSelection.  Fixed.

2005-11-21  Anthony Balkissoon  [EMAIL PROTECTED]

Fixes bug #24925
* javax/swing/text/DefaultEditorKit.java:
(DefaultKeyTypedAction.actionPeformed): Call replaceSelection here
instead of insertString and only do so if the text component is both 
enabled and editable.

--Tony
Index: javax/swing/text/DefaultEditorKit.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultEditorKit.java,v
retrieving revision 1.23
diff -u -r1.23 DefaultEditorKit.java
--- javax/swing/text/DefaultEditorKit.java	19 Oct 2005 14:57:30 -	1.23
+++ javax/swing/text/DefaultEditorKit.java	21 Nov 2005 16:05:34 -
@@ -216,19 +216,9 @@
 return;
 
   JTextComponent t = getTextComponent(event);
-  if (t != null)
-{
-  try
-{
-  t.getDocument().insertString(t.getCaret().getDot(),
-   event.getActionCommand(), null);
-}
-  catch (BadLocationException be)
-{
-  // FIXME: we're not authorized to throw this.. swallow it?
-}
-}
-}
+  if (t != null  t.isEnabled()  t.isEditable())
+t.replaceSelection(event.getActionCommand());
+}
   }
 
   /**
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] FYI: JViewport system property

2005-11-21 Thread Roman Kennke
I forgot the actual patch. Here it comes now.

/Roman


Am Montag, den 21.11.2005, 14:34 +0100 schrieb Roman Kennke:
 Hi Mark,
 
 
 Am Samstag, den 19.11.2005, 20:04 +0100 schrieb Mark Wielaard:
  On Tue, 2005-11-15 at 21:23 +0100, Mark Wielaard wrote:
   On Tue, 2005-11-15 at 14:16 +, Roman Kennke wrote:
2005-11-15  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/JViewport.java
(JViewport): Recognize setting of a system property
gnu.javax.swing.JViewport for the scrollMode.

--- javax/swing/JViewport.java  27 Oct 2005 17:20:22 -  1.34
+++ javax/swing/JViewport.java  15 Nov 2005 14:12:41 -
@@ -246,7 +246,18 @@
   public JViewport()
   {
 setOpaque(true);
-setScrollMode(BLIT_SCROLL_MODE);
+String scrollModeProp =
+  System.getProperty(gnu.javax.swing.JViewport.scrollMode,
+ BLIT);
   
   You want to use gnu.classpath.SystemProperties.getProperty() here for
   the (admittedly unlikely) case a JViewport is instantiated through code
   that doesn't have enough permissions for reading that system property.
   
   It might also be an idea to make scrollModeProp static and only
   instantiate it once for efficiency. Although that might be an
   optimization that isn't really worth it since I guess instantiating
   JViewPorts isn't don't that often. And it would prevent changing this
   programmaticaly per instance of course. If that is desirable.
  
  Ping. Any comments?
 
 I fixed this with the attached patch.
 
 2005-11-21  Roman Kennke  [EMAIL PROTECTED]
 
 * javax/swing/JViewport.java
 (static_initializer): Initialize the defaultScrollMode here.
 (JViewport): Set the defaultScrollMode that was initialized in
 the static initializer.
 
 /Roman
 
 ___
 Classpath-patches mailing list
 Classpath-patches@gnu.org
 http://lists.gnu.org/mailman/listinfo/classpath-patches
Index: javax/swing/JViewport.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/JViewport.java,v
retrieving revision 1.34
retrieving revision 1.36
diff -u -r1.34 -r1.36
--- javax/swing/JViewport.java	27 Oct 2005 17:20:22 -	1.34
+++ javax/swing/JViewport.java	21 Nov 2005 13:33:06 -	1.36
@@ -38,6 +38,8 @@
 
 package javax.swing;
 
+import gnu.classpath.SystemProperties;
+
 import java.awt.Component;
 import java.awt.Dimension;
 import java.awt.Graphics;
@@ -163,7 +165,13 @@
   public static final int BACKINGSTORE_SCROLL_MODE = 2;
 
   private static final long serialVersionUID = -6925142919680527970L;
-  
+
+  /**
+   * The default scrollmode to be used by all JViewports as determined by
+   * the system property gnu.javax.swing.JViewport.scrollMode.
+   */
+  private static final int defaultScrollMode;
+
   protected boolean scrollUnderway;
   protected boolean isViewSizeSet;
 
@@ -243,10 +251,27 @@
*/
   boolean sizeChanged = true;
 
+  /**
+   * Initializes the default setting for the scrollMode property.
+   */
+  static
+  {
+String scrollModeProp =
+  SystemProperties.getProperty(gnu.javax.swing.JViewport.scrollMode,
+ BLIT);
+int myScrollMode;
+if (scrollModeProp.equalsIgnoreCase(simple))
+  defaultScrollMode = SIMPLE_SCROLL_MODE;
+else if (scrollModeProp.equalsIgnoreCase(backingstore))
+  defaultScrollMode = BACKINGSTORE_SCROLL_MODE;
+else
+  defaultScrollMode = BLIT_SCROLL_MODE;
+  }
+
   public JViewport()
   {
 setOpaque(true);
-setScrollMode(BLIT_SCROLL_MODE);
+setScrollMode(defaultScrollMode);
 updateUI();
 setLayout(createLayoutManager());
 lastPaintPosition = new Point();


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] FYI: RepaintManager fix

2005-11-21 Thread Roman Kennke

I forgot the patch. Here it comes now.

/Roman


Am Montag, den 21.11.2005, 15:02 +0100 schrieb Roman Kennke:
 Am Samstag, den 19.11.2005, 19:09 +0100 schrieb Mark Wielaard:
  Hi Roman,
  
  On Mon, 2005-11-14 at 12:52 +, Roman Kennke wrote:
   +  /**
   +   * The current repaint managers, indexed by their ThreadGroups.
   +   */
   +  static HashMap currentRepaintManagers;
  
  Isn't this a potential memory leak? Maybe there are not many
  ThreadGroups in an application ever. But it might be wise to use a
  WeakHashMap here so that the entry disappears when the ThreadGroup is
  garbage collected.
 
 This is fixed using the attached patch.
 
 2005-11-21  Roman Kennke  [EMAIL PROTECTED]
 
 * javax/swing/RepaintManager.java
 (currentRepaintManagers): Use a WeakHashMap to avoid potential
 memory leak.
 (currentManager): Instantiate WeakHashMap instead of HashMap.
 (setCurrentManager): Instantiate WeakHashMap instead of HashMap.
 
 /Roman
 
 ___
 Classpath-patches mailing list
 Classpath-patches@gnu.org
 http://lists.gnu.org/mailman/listinfo/classpath-patches
Index: javax/swing/RepaintManager.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/RepaintManager.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- javax/swing/RepaintManager.java	14 Nov 2005 12:50:01 -	1.18
+++ javax/swing/RepaintManager.java	21 Nov 2005 14:01:43 -	1.19
@@ -48,6 +48,7 @@
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.WeakHashMap;
 
 /**
  * pThe repaint manager holds a set of dirty regions, invalid components,
@@ -68,7 +69,7 @@
   /**
* The current repaint managers, indexed by their ThreadGroups.
*/
-  static HashMap currentRepaintManagers;
+  static WeakHashMap currentRepaintManagers;
   
   /**
* pA helper class which is placed into the system event queue at
@@ -286,7 +287,7 @@
   public static RepaintManager currentManager(Component component)
   {
 if (currentRepaintManagers == null)
-  currentRepaintManagers = new HashMap();
+  currentRepaintManagers = new WeakHashMap();
 ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
 RepaintManager currentManager =
   (RepaintManager) currentRepaintManagers.get(threadGroup);
@@ -330,7 +331,7 @@
   public static void setCurrentManager(RepaintManager manager)
   {
 if (currentRepaintManagers == null)
-  currentRepaintManagers = new HashMap();
+  currentRepaintManagers = new WeakHashMap();
 
 ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
 currentRepaintManagers.put(threadGroup, manager);


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] An imageio/ImageDecoder hack

2005-11-21 Thread Mark Wielaard
Hi list, Hi Tom,

While playing a bit with Caliph  Emir I found that our imageio and
ImageDecoder/GdkPixBufDecoder don't play well. The attached patch is a
quick hack to make the Emir splash-screen show up. Should I make a
real/full DataInputStreamWrapper to make a bridge between the two or
will this part be so completely rewritten that even such a hack isn't
worth it?

Cheers,

Mark
Index: gnu/java/awt/image/ImageDecoder.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/image/ImageDecoder.java,v
retrieving revision 1.15
diff -u -r1.15 ImageDecoder.java
--- gnu/java/awt/image/ImageDecoder.java	2 Jul 2005 20:32:11 -	1.15
+++ gnu/java/awt/image/ImageDecoder.java	21 Nov 2005 20:27:51 -
@@ -40,6 +40,8 @@
 import java.awt.image.ImageConsumer;
 import java.awt.image.ImageProducer;
 import java.io.ByteArrayInputStream;
+import java.io.DataInput;
+import java.io.EOFException;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -55,6 +57,7 @@
   int offset;
   int length;
   InputStream input;
+  DataInput datainput;
 
   static
   {
@@ -79,6 +82,11 @@
 this.input = is;
   }
 
+  public ImageDecoder (DataInput datainput)
+  {
+this.datainput = datainput;
+  }
+
   public ImageDecoder (byte[] imagedata, int imageoffset, int imagelength)
   {
 data = imagedata;
@@ -119,6 +127,8 @@
   {
 if (url != null)
   input = url.openStream();
+		else if (datainput != null)
+		  input = new DataInputStreamWrapper(datainput);
 else
   {
 if (filename != null)
@@ -153,4 +163,26 @@
   }
 
   public abstract void produce (Vector v, InputStream is) throws IOException;
+
+  private static class DataInputStreamWrapper extends InputStream
+  {
+private final DataInput datainput;
+
+DataInputStreamWrapper(DataInput datainput)
+{
+  this.datainput = datainput;
+}
+
+public int read() throws IOException
+{
+  try
+	{
+	  return datainput.readByte()  0xFF;
+	}
+  catch (EOFException eofe)
+	{
+	  return -1;
+	}
+}
+  }
 }
Index: gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java,v
retrieving revision 1.17
diff -u -r1.17 GdkPixbufDecoder.java
--- gnu/java/awt/peer/gtk/GdkPixbufDecoder.java	21 Aug 2005 02:39:41 -	1.17
+++ gnu/java/awt/peer/gtk/GdkPixbufDecoder.java	21 Nov 2005 20:27:51 -
@@ -47,6 +47,7 @@
 import java.awt.image.ImageProducer;
 import java.awt.image.Raster;
 import java.awt.image.RenderedImage;
+import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InputStream;
@@ -102,6 +103,11 @@
  0x00ff, 
  0xff00, 
  0x00ff);
+  public GdkPixbufDecoder (DataInput datainput)
+  {
+super (datainput);
+  }
+
   public GdkPixbufDecoder (InputStream in)
   {
 super (in);
@@ -630,7 +636,14 @@
  boolean ignoreMetadata)
 {
   super.setInput(input, seekForwardOnly, ignoreMetadata);
-  dec = new GdkPixbufDecoder((InputStream) getInput());
+  Object get = getInput();
+  if (get instanceof InputStream)
+dec = new GdkPixbufDecoder((InputStream) get);
+  else if (get instanceof DataInput)
+dec = new GdkPixbufDecoder((DataInput) get);
+  else
+	throw new IllegalArgumentException(input object not supported: 
+	   + get);
 }
 
 public BufferedImage read(int imageIndex, ImageReadParam param)


signature.asc
Description: This is a digitally signed message part
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Re: An imageio/ImageDecoder hack

2005-11-21 Thread Thomas Fitzsimmons
On Mon, 2005-11-21 at 21:30 +0100, Mark Wielaard wrote:
 Hi list, Hi Tom,
 
 While playing a bit with Caliph  Emir I found that our imageio and
 ImageDecoder/GdkPixBufDecoder don't play well. The attached patch is a
 quick hack to make the Emir splash-screen show up. Should I make a
 real/full DataInputStreamWrapper to make a bridge between the two or
 will this part be so completely rewritten that even such a hack isn't
 worth it?

I expect that GdkPixbufDecoder will go away with the
GTK2.8/Cairo/Graphics2D migration, so I wouldn't bother.  Can you add a
pointer to the app you're testing to:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20630

so that we remember to test this after the migration?

Thanks,
Tom




___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] RFC: BasicComboBoxUI minimum size caching

2005-11-21 Thread Mark Wielaard
Hi,

Some more hacking on Free Swing (this stuff really seems to work for a
lot of things now!). Emir uses something called the plastic theme. It
seems to use the BasicComboBoxUI protected fields that cache the minimum
size. So I implemented them and wrote some documentation on how I think
they should behave. It just sets the cache when the minimumSize is
requested and invalidates it in all the listeners that I thought were
relevant. It seems to work for me (and the Free Swing Demo), but it
would be nice if a Free Swing hacker could take a look.

2005-11-21  Mark Wielaard  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicComboBoxUI.java (cachedMinimumSize):
Document.
(isMinimumSizeDirty): Likewise. And initialize to true.
(getMinimumSize): Use and set cachedMinimumSize.
(FocusHandler.focusGained): Set isMinimumSizeDirty to true.
(FocusHandler.focusLost): Likewise.
(ItemHandler.itemStateChanged): Likewise.
(ListDataHandler.contentsChanged): Likewise.
(ListDataHandler.intervalAdded): Likewise.
(ListDataHandler.intervalRemoved): Likewise.
(PropertyChangeHandler.propertyChange): Likewise.

Comments welcome.

Cheers,

Mark
Index: javax/swing/plaf/basic/BasicComboBoxUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java,v
retrieving revision 1.29
diff -u -r1.29 BasicComboBoxUI.java
--- javax/swing/plaf/basic/BasicComboBoxUI.java	15 Nov 2005 20:32:46 -	1.29
+++ javax/swing/plaf/basic/BasicComboBoxUI.java	21 Nov 2005 20:47:35 -
@@ -190,10 +190,19 @@
*/
   Dimension displaySize;
 
-  // FIXME: This fields aren't used anywhere at this moment.
-  protected Dimension cachedMinimumSize;
+  // FIXME: This field isn't used anywhere at this moment.
   protected CellRendererPane currentValuePane;
-  protected boolean isMinimumSizeDirty;
+
+  /**
+   * The current minimum size if isMinimumSizeDirty is false.
+   * Setup by getMinimumSize() and invalidated by the various listeners.
+   */
+  protected Dimension cachedMinimumSize;
+
+  /**
+   * Indicates whether or not the cachedMinimumSize field is valid or not.
+   */
+  protected boolean isMinimumSizeDirty = true;
 
   /**
* Creates a new codeBasicComboBoxUI/code object.
@@ -668,7 +677,7 @@
 
   /**
* Returns the minimum size for this [EMAIL PROTECTED] JComboBox} for this
-   * look and feel.
+   * look and feel. Also makes sure cachedMinimimSize is setup correctly.
*
* @param c The [EMAIL PROTECTED] JComponent} to find the minimum size for.
*
@@ -676,10 +685,15 @@
*/
   public Dimension getMinimumSize(JComponent c)
   {
-Dimension d = getDisplaySize();
-int arrowButtonWidth = d.height;
-Dimension result = new Dimension(d.width + arrowButtonWidth, d.height);
-return result;
+if (isMinimumSizeDirty)
+  {
+	Dimension d = getDisplaySize();
+	int arrowButtonWidth = d.height;
+	cachedMinimumSize = new Dimension(d.width + arrowButtonWidth,
+	  d.height);
+	isMinimumSizeDirty = false;
+  }
+return new Dimension(cachedMinimumSize);
   }
 
   /** The value returned by the getMaximumSize() method. */
@@ -1062,6 +1076,9 @@
  */
 public void focusGained(FocusEvent e)
 {
+  // Lets assume every change invalidates the minimumsize.
+  isMinimumSizeDirty = true;
+
   hasFocus = true;
   comboBox.repaint();
 }
@@ -1074,6 +1091,9 @@
  */
 public void focusLost(FocusEvent e)
 {
+  // Lets assume every change invalidates the minimumsize.
+  isMinimumSizeDirty = true;
+
   hasFocus = false;
   setPopupVisible(comboBox, false);
   comboBox.repaint();
@@ -1102,6 +1122,9 @@
  */
 public void itemStateChanged(ItemEvent e)
 {
+  // Lets assume every change invalidates the minimumsize.
+  isMinimumSizeDirty = true;
+
   if (e.getStateChange() == ItemEvent.SELECTED  comboBox.isEditable())
 comboBox.getEditor().setItem(e.getItem());
   comboBox.repaint();
@@ -1149,6 +1172,9 @@
 public void contentsChanged(ListDataEvent e)
 {
   // if the item is selected or deselected
+
+  // Lets assume every change invalidates the minimumsize.
+  isMinimumSizeDirty = true;
 }
 
 /**
@@ -1158,6 +1184,9 @@
  */
 public void intervalAdded(ListDataEvent e)
 {
+  // Lets assume every change invalidates the minimumsize.
+  isMinimumSizeDirty = true;
+
   ComboBoxModel model = comboBox.getModel();
   ListCellRenderer renderer = comboBox.getRenderer();
 
@@ -1179,6 +1208,9 @@
  */
 public void intervalRemoved(ListDataEvent e)
 {
+  // Lets assume every change invalidates the minimumsize.
+  isMinimumSizeDirty = true;
+
   // recalculate display size of the JComboBox.
   displaySize = getDisplaySize();
   comboBox.repaint();
@@ -1206,6 +1238,9 @@
  */
 public void propertyChange(PropertyChangeEvent e)
 {
+  

Re: [cp-patches] RFC: GdkGraphics fix

2005-11-21 Thread Lillian Angel
On Mon, 2005-11-21 at 15:46 -0500, Thomas Fitzsimmons wrote:
 On Mon, 2005-11-21 at 14:33 -0500, Lillian Angel wrote:
  This fixes bug # 24937
  I spoke in detail to Roman about this. 
  drawString(String...) was changed to call
  drawString(AttributedCharacterIterator...) because they both need to
  ignore the newline characters. 
  
  drawString(AttributedCharacterIterator...) iterates through the
  characters and stores the non-newline chars in an array. Here Roman
  suggested that I make some changes and pass the char[] to the native
  drawString function because allocating a new String is not ideal.
  
  I tried doing this, but that native function calls getStringUTFChars
  (which requires a jstring). Removing the call to getStringUTFChars
  obviously does not work... 
  
  The best way to do this right now (since
  drawString(AttributedCharacterIterator...) is not fully implemented), is
  creating a new String, like I have done in this patch, or call
  replaceAll(\n, ) on the String. replaceAll does a lot of unnecessary
  things, so I avoided using it.
 
 Why bring the AttributedCharacterIterator drawString into this? 

In this function, we need to filter out those characters as well. Roman
thought it was best I do it like this. If its not good, I can always
change it around.


  Why not
 just create a new string in drawString (String str, int x, int y)
 using something like String.replaceAll?

replaceAll does alot of stuff, it would be more inefficent to use it.

 
 Also, is it enough to check for '\n'?  Are there other Unicode
 formatting characters we should filter out?

Good point. I will look into this.

Lillian



___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Patch: Text Component key bindings

2005-11-21 Thread Lillian Angel
Cut, Copy, Paste, selection forward, selection backward actions now work
for text components.

2005-11-21  Lillian Angel  [EMAIL PROTECTED]

PR classpath/PR24872
* javax/swing/text/DefaultEditorKit.java
(actionPerformed): Implemented.
(actionPerformed): Implemented.
(actionPerformed): Implemented.
(actionPerformed): Implemented.
* javax/swing/text/JTextComponent.java
(JTextComponent): Added key bindings for cut, copy,
paste, selectionBackwardAction, selectionForwardAction.

Index: javax/swing/text/DefaultEditorKit.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/DefaultEditorKit.java,v
retrieving revision 1.24
diff -u -r1.24 DefaultEditorKit.java
--- javax/swing/text/DefaultEditorKit.java	21 Nov 2005 16:09:30 -	1.24
+++ javax/swing/text/DefaultEditorKit.java	21 Nov 2005 20:54:54 -
@@ -112,8 +112,7 @@
  */
 public void actionPerformed(ActionEvent event)
 {
-  // FIXME: Implement me. Tookit.getSystemClipboard should be used
-  // for that.
+  getTextComponent(event).copy();
 }
   }
 
@@ -144,8 +143,7 @@
  */
 public void actionPerformed(ActionEvent event)
 {
-  // FIXME: Implement me. Tookit.getSystemClipboard should be used
-  // for that.
+  getTextComponent(event).cut();
 }
   }
 
@@ -174,8 +172,7 @@
  */
 public void actionPerformed(ActionEvent event)
 {
-  // FIXME: Implement me. Tookit.getSystemClipboard should be used
-  // for that.
+  getTextComponent(event).paste();
 }
   }
 
@@ -299,7 +296,8 @@
  */
 public void actionPerformed(ActionEvent event)
 {
-  // FIXME: Implement this.
+  JTextComponent t = getTextComponent(event);
+  t.replaceSelection(\t);
 }
   }
 
Index: javax/swing/text/JTextComponent.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/text/JTextComponent.java,v
retrieving revision 1.45
diff -u -r1.45 JTextComponent.java
--- javax/swing/text/JTextComponent.java	3 Nov 2005 19:40:36 -	1.45
+++ javax/swing/text/JTextComponent.java	21 Nov 2005 20:54:55 -
@@ -921,17 +921,33 @@
 
 // need to do this after updateUI()
 if (creatingKeymap)
-  loadKeymap(defkeymap, 
- new KeyBinding[] { 
-   new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0),
-  DefaultEditorKit.backwardAction),
-   new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0),
-  DefaultEditorKit.forwardAction),
-   new KeyBinding(KeyStroke.getKeyStroke(typed \b),
-  DefaultEditorKit.deletePrevCharAction),
-   new KeyBinding(KeyStroke.getKeyStroke(typed \u007f),
-  DefaultEditorKit.deleteNextCharAction)   
- },
+  loadKeymap(
+ defkeymap,
+ new KeyBinding[] {
+ new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0),
+DefaultEditorKit.backwardAction),
+ new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0),
+DefaultEditorKit.forwardAction),
+ new KeyBinding(KeyStroke.getKeyStroke(typed \b),
+DefaultEditorKit.deletePrevCharAction),
+ new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_X, 
+   KeyEvent.CTRL_DOWN_MASK),
+DefaultEditorKit.cutAction),
+ new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_C, 
+   KeyEvent.CTRL_DOWN_MASK),
+DefaultEditorKit.copyAction),
+ new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_V, 
+   KeyEvent.CTRL_DOWN_MASK),
+DefaultEditorKit.pasteAction),
+ new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 
+KeyEvent.SHIFT_DOWN_MASK),
+ DefaultEditorKit.selectionBackwardAction),
+ new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 
+   KeyEvent.SHIFT_DOWN_MASK),
+DefaultEditorKit.selectionForwardAction),
+ new KeyBinding(KeyStroke.getKeyStroke(typed \u007f),
+DefaultEditorKit.deleteNextCharAction)
+},
  getActions());
   }
 

Re: [cp-patches] RFC: BasicComboBoxUI minimum size caching

2005-11-21 Thread Roman Kennke

Hi Mark, hi list,

 Some more hacking on Free Swing (this stuff really seems to work for a
 lot of things now!). Emir uses something called the plastic theme. It
 seems to use the BasicComboBoxUI protected fields that cache the minimum
 size. So I implemented them and wrote some documentation on how I think
 they should behave. It just sets the cache when the minimumSize is
 requested and invalidates it in all the listeners that I thought were
 relevant. It seems to work for me (and the Free Swing Demo), but it
 would be nice if a Free Swing hacker could take a look.

Looks ok. Except that the cache is possibly invalidated a little too
often. I would think that the focus state doesn't change the
minimumSize. Also, the general propertyChange() invalidation is maybe
not good. But still ok to check in.

/Roman



signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] RFC: BasicComboBoxUI minimum size caching

2005-11-21 Thread Mark Wielaard
Hi Roman,

On Mon, 2005-11-21 at 22:23 +0100, Roman Kennke wrote:
 Looks ok. Except that the cache is possibly invalidated a little too
 often. I would think that the focus state doesn't change the
 minimumSize. Also, the general propertyChange() invalidation is maybe
 not good. But still ok to check in.

Yeah, you are right it isn't that likely to trigger a size change. But
we didn't do any caching before. And custom look and feels seem to do
lots of interesting tweaks. So I like to be a bit paranoid here.
Checking this in as is now. If someone feels they can optimize it and
that is worth it then please do.

Cheers,

Mark


signature.asc
Description: This is a digitally signed message part
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] FYI: JTable propertyChange for non-null header

2005-11-21 Thread Mark Wielaard
Hi,

We were trying the resize the JTable header even when there was none.
This fixes that.

2005-11-21  Mark Wielaard  [EMAIL PROTECTED]

* javax/swing/JTable.java (propertyChange): Only resize header when
not null.

This get Caliph  Emir again a bit further.
I will commit this.

Cheers,

Mark
Index: javax/swing/JTable.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/JTable.java,v
retrieving revision 1.62
diff -u -r1.62 JTable.java
--- javax/swing/JTable.java	21 Nov 2005 13:18:29 -	1.62
+++ javax/swing/JTable.java	21 Nov 2005 21:53:57 -
@@ -949,10 +949,13 @@
   if (ev.getPropertyName().equals(preferredWidth))
 {
   JTableHeader header = getTableHeader();
-  TableColumn col = (TableColumn) ev.getSource();
-  header.setResizingColumn(col);
-  doLayout();
-  header.setResizingColumn(null);
+	  if (header != null)
+	{
+	  TableColumn col = (TableColumn) ev.getSource();
+	  header.setResizingColumn(col);
+	  doLayout();
+	  header.setResizingColumn(null);
+	}
 }
 }
   }


signature.asc
Description: This is a digitally signed message part
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] FYI: GdkGraphics fix

2005-11-21 Thread Lillian Angel
This has been approved by Tom and Roman.
I re-implemented this to just use replaceAll. I know it is sometimes
inefficent, so I added a FIXME. 

2005-11-21  Lillian Angel  [EMAIL PROTECTED]

PR classpath/PR24937
* gnu/java/awt/peer/gtk/GdkGraphics.java
(drawString): Removed most non-printable characters
from the string that will be drawn. Added a FIXME comment
because may not have filtered out all characters and
replace all is inefficent.

On Mon, 2005-11-21 at 15:54 -0500, Lillian Angel wrote:
 On Mon, 2005-11-21 at 15:46 -0500, Thomas Fitzsimmons wrote:
  On Mon, 2005-11-21 at 14:33 -0500, Lillian Angel wrote:
   This fixes bug # 24937
   I spoke in detail to Roman about this. 
   drawString(String...) was changed to call
   drawString(AttributedCharacterIterator...) because they both need to
   ignore the newline characters. 
   
   drawString(AttributedCharacterIterator...) iterates through the
   characters and stores the non-newline chars in an array. Here Roman
   suggested that I make some changes and pass the char[] to the native
   drawString function because allocating a new String is not ideal.
   
   I tried doing this, but that native function calls getStringUTFChars
   (which requires a jstring). Removing the call to getStringUTFChars
   obviously does not work... 
   
   The best way to do this right now (since
   drawString(AttributedCharacterIterator...) is not fully implemented), is
   creating a new String, like I have done in this patch, or call
   replaceAll(\n, ) on the String. replaceAll does a lot of unnecessary
   things, so I avoided using it.
  
  Why bring the AttributedCharacterIterator drawString into this? 
 
 In this function, we need to filter out those characters as well. Roman
 thought it was best I do it like this. If its not good, I can always
 change it around.
 
 
   Why not
  just create a new string in drawString (String str, int x, int y)
  using something like String.replaceAll?
 
 replaceAll does alot of stuff, it would be more inefficent to use it.
 
  
  Also, is it enough to check for '\n'?  Are there other Unicode
  formatting characters we should filter out?
 
 Good point. I will look into this.
 
 Lillian
 
 
 
 ___
 Classpath-patches mailing list
 Classpath-patches@gnu.org
 http://lists.gnu.org/mailman/listinfo/classpath-patches
Index: gnu/java/awt/peer/gtk/GdkGraphics.java
===
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java,v
retrieving revision 1.49
diff -u -r1.49 GdkGraphics.java
--- gnu/java/awt/peer/gtk/GdkGraphics.java	3 Nov 2005 00:21:21 -	1.49
+++ gnu/java/awt/peer/gtk/GdkGraphics.java	21 Nov 2005 22:07:53 -
@@ -48,9 +48,9 @@
 import java.awt.Image;
 import java.awt.Rectangle;
 import java.awt.Shape;
-import java.awt.SystemColor;
 import java.awt.image.ImageObserver;
 import java.text.AttributedCharacterIterator;
+import java.util.regex.*;
 
 public class GdkGraphics extends Graphics
 {
@@ -247,10 +247,13 @@
   native void drawString (GdkFontPeer f, String str, int x, int y);
   public void drawString (String str, int x, int y)
   {
+// FIXME: Possibly more characters we need to ignore/
+// Also, implementation may be inefficent because allocating
+// new Strings.
+str = Pattern.compile([\b | \t | \n | \f | \r | \ | \']).matcher(str).replaceAll();
 drawString(getFontPeer(), str, x, y);
-  }
+  }  
   
-
   public void drawString (AttributedCharacterIterator ci, int x, int y)
   {
 throw new Error (not implemented);
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Re: An imageio/ImageDecoder hack

2005-11-21 Thread Mark Wielaard
Hi,

On Mon, 2005-11-21 at 15:37 -0500, Thomas Fitzsimmons wrote:
 I expect that GdkPixbufDecoder will go away with the
 GTK2.8/Cairo/Graphics2D migration, so I wouldn't bother.

I just checked in this little workaround then as is. It is a bit lame
and slow, but at least it works and it shouldn't impact any other
existing code paths.

2005-11-21  Mark Wielaard  [EMAIL PROTECTED]

* gnu/java/awt/image/ImageDecoder.java (datainput): New field.
(ImageDecoder(DataInput)): New constructor.
(startProduction): Create DataInputStreamWrapper when datainput set.
(DataInputStreamWrapper): New private static helper class.
* gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
(GdkPixbufDecoder(DataInput)): New constructor.
(setInput): Check whether getInput() results in an InputStream or
DataInput.

 Can you add a pointer to the app you're testing to:
 
 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20630
 
 so that we remember to test this after the migration?

Done. It seems an interesting pair of applications:
http://caliph-emir.sourceforge.net/

I am trying to get all my patches in so you can start it up and play a
little with it. But some are terrible hacks that I don't really dare to
propose yet :)

Cheers,

Mark


signature.asc
Description: This is a digitally signed message part
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


Re: [cp-patches] FYI: GdkGraphics fix

2005-11-21 Thread Mark Wielaard
Hi Lilian,

On Mon, 2005-11-21 at 17:11 -0500, Lillian Angel wrote:
 I re-implemented this to just use replaceAll. I know it is sometimes
 inefficent, so I added a FIXME. 

This is really, really inefficient. 

 +// FIXME: Possibly more characters we need to ignore/
 +// Also, implementation may be inefficent because allocating
 +// new Strings.
 +str = Pattern.compile([\b | \t | \n | \f | \r | \ | 
 \']).matcher(str).replaceAll();
  drawString(getFontPeer(), str, x, y);

Firstly if you reuse the same regex Pattern then you should allocate it
once and reuse it. But using a regular expression for this simple
replace is really overkill anyway. You will use the character array of
the string in the native gtk+ code anyway. Then you can easily iterate
over the string and possibly remove any unwanted characters. So I would
propose to just pass the string to the native side and filter it there
after you get the chars from the string. You will have to check whether
you have a copy or not before actually replacing the chars or you'll
have to make a copy, but I expect that most strings don't need filtering
at all so you probably only make one pass of the chars and be done.

Cheers,

Mark



___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] RFC: some missing DeleteLocalRef patches

2005-11-21 Thread Christian Thalinger
Hi!

These are some patches for missing DeleteLocalRef calls i've found with
CACAO.  Are they ok?  It seems so to me.  Should i search for more stuff
like that?

TWISTI


Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c
===
RCS file: 
/cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c,v
retrieving revision 1.4
diff -u -3 -p -r1.4 gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c  11 Jul 
2005 23:27:43 -  1.4
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c  21 Nov 
2005 23:13:17 -
@@ -71,6 +71,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphicsEn
   const char *name_tmp =  pango_font_family_get_name (families[idx]);
   jstring name = (*env)-NewStringUTF (env, name_tmp);
   (*env)-SetObjectArrayElement (env, family_name, idx, name);
+  (*env)-DeleteLocalRef(env, name);
 }
   g_free (families);
 
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
===
RCS file: 
/cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c,v
retrieving revision 1.19
diff -u -3 -p -r1.19 gnu_java_awt_peer_gtk_GtkChoicePeer.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c   25 Aug 2005 
02:26:50 -  1.19
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c   21 Nov 2005 
23:13:17 -
@@ -121,6 +121,7 @@ Java_gnu_java_awt_peer_gtk_GtkChoicePeer
   gtk_combo_box_append_text (GTK_COMBO_BOX (ptr), label);
 
   (*env)-ReleaseStringUTFChars (env, item, label);
+  (*env)-DeleteLocalRef(env, item);
 }
 
   gdk_threads_leave ();
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
===
RCS file: 
/cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c,v
retrieving revision 1.22
diff -u -3 -p -r1.22 gnu_java_awt_peer_gtk_GtkListPeer.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c 18 Aug 2005 
03:15:15 -  1.22
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c 21 Nov 2005 
23:13:17 -
@@ -239,6 +239,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_a
   COLUMN_STRING, text,
   -1);
   (*env)-ReleaseStringUTFChars (env, item, text);
+  (*env)-DeleteLocalRef(env, item);
 }
 
   gdk_threads_leave ();
Index: native/jni/qt-peer/qtmenupeer.cpp
===
RCS file: /cvsroot/classpath/classpath/native/jni/qt-peer/qtmenupeer.cpp,v
retrieving revision 1.4
diff -u -3 -p -r1.4 qtmenupeer.cpp
--- native/jni/qt-peer/qtmenupeer.cpp   23 Aug 2005 02:13:48 -  1.4
+++ native/jni/qt-peer/qtmenupeer.cpp   21 Nov 2005 23:13:41 -
@@ -125,6 +125,7 @@ public:
 
 jclass menuCls = env-GetObjectClass( menuPeer );
 jmethodID mid = env-GetMethodID(menuCls, add, (J)V);
+env-DeleteLocalRef(menuCls);
 env-CallVoidMethod( menuPeer, mid, (jlong)newAction );
 
 env-DeleteGlobalRef( menuPeer );




___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] RFC: BasicTabbedPaneUI paint null Icon?

2005-11-21 Thread Mark Wielaard
Hi,

This one is a little strange. Apparently the plastic laf overrides
getIconForTab(int) and returns null in certain cases. But then it still
calls paintIcon on it. I cannot find too much documentation on this, but
this seems the correct thing to do:

2005-11-21  Mark Wielaard  [EMAIL PROTECTED]

* javax/swing/plaf/basic/BasicTabbedPaneUI.java (paintIcon): Only
paint icon when not null.

Comments?

This is the last patch needed to get Emir to start up.
http://gnu.wildebeest.org/~mark/emir.png

Cheers,

Mark
Index: javax/swing/plaf/basic/BasicTabbedPaneUI.java
===
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,v
retrieving revision 1.30
diff -u -r1.30 BasicTabbedPaneUI.java
--- javax/swing/plaf/basic/BasicTabbedPaneUI.java	18 Nov 2005 21:57:37 -	1.30
+++ javax/swing/plaf/basic/BasicTabbedPaneUI.java	21 Nov 2005 23:55:01 -
@@ -1881,7 +1881,8 @@
   protected void paintIcon(Graphics g, int tabPlacement, int tabIndex,
Icon icon, Rectangle iconRect, boolean isSelected)
   {
-icon.paintIcon(tabPane, g, iconRect.x, iconRect.y);
+if (icon != null)
+  icon.paintIcon(tabPane, g, iconRect.x, iconRect.y);
   }
 
   /**
___
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches


[cp-patches] Comparable in java.util.Calendar

2005-11-21 Thread Kendall Bell

2005-11-21  Kendall Bell  [EMAIL PROTECTED]

   * java/util/Calendar.java: Implemented Comparable.
 
/* Calendar.java --
   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005  Free Software Foundation, Inc.

This file is part of GNU Classpath.

GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING.  If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.

Linking this library statically or dynamically with other modules is
making a combined work based on this library.  Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.

As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module.  An independent module is a module which is not derived from
or based on this library.  If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so.  If you do not wish to do so, delete this
exception statement from your version. */


package java.util;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * This class is an abstract base class for Calendars, which can be
 * used to convert between codeDate/code objects and a set of
 * integer fields which represent codeYEAR/code,
 * codeMONTH/code, codeDAY/code, etc.  The codeDate/code
 * object represents a time in milliseconds since the Epoch. br
 *
 * This class is locale sensitive.  To get the Object matching the
 * current locale you can use codegetInstance/code.  You can even provide
 * a locale or a timezone.  codegetInstance/code returns currently
 * a codeGregorianCalendar/code for the current date. br
 *
 * If you want to convert a date from the Year, Month, Day, DayOfWeek,
 * etc.  Representation to a codeDate/code-Object, you can create
 * a new Calendar with codegetInstance()/code,
 * codeclear()/code all fields, codeset(int,int)/code the
 * fields you need and convert it with codegetTime()/code. br
 *
 * If you want to convert a codeDate/code-object to the Calendar
 * representation, create a new Calendar, assign the
 * codeDate/code-Object with codesetTime()/code, and read the
 * fields with codeget(int)/code. br
 *
 * When computing the date from time fields, it may happen, that there
 * are either two few fields set, or some fields are inconsistent.  This
 * cases will handled in a calendar specific way.  Missing fields are
 * replaced by the fields of the epoch: 1970 January 1 00:00. br
 *
 * To understand, how the day of year is computed out of the fields
 * look at the following table.  It is traversed from top to bottom,
 * and for the first line all fields are set, that line is used to
 * compute the day. br
 *
 *
premonth + day_of_month
month + week_of_month + day_of_week
month + day_of_week_of_month + day_of_week
day_of_year
day_of_week + week_of_year/pre
 *
 * The hour_of_day-field takes precedence over the ampm and
 * hour_of_ampm fields. br
 *
 * STRONGNote:/STRONG This can differ for non-Gregorian calendar. br
 *
 * To convert a calendar to a human readable form and vice versa,  use
 * the codejava.text.DateFormat/code class. br
 *
 * Other useful things you can do with an calendar, is
 * coderoll/codeing fields (that means increase/decrease a
 * specific field by one, propagating overflows), or
 * codeadd/codeing/substracting a fixed amount to a field.
 *
 * @see Date
 * @see GregorianCalendar
 * @see TimeZone
 * @see java.text.DateFormat
 */
public abstract class Calendar implements Serializable, Cloneable
{
  /**
   * Constant representing the era time field.
   */
  public static final int ERA = 0;

  /**
   * Constant representing the year time field.
   */
  public static final int YEAR = 1;

  /**
   * Constant representing the month time field.  This field
   * should contain one of the JANUARY,...,DECEMBER constants below.
   */
  public static final int MONTH = 2;

  /**
   * Constant representing the week of the year field.
   * @see 

Comparable in java.util.Calendar

2005-11-21 Thread Kendall Bell
I would like to implement Comparable in java.util.Calendar.java. I fell 
that this is necessary for compatibility with other JRE's.

Kendall Bell
begin:vcard
fn:Kendall Bell
n:Bell;Kendall
email;internet:[EMAIL PROTECTED]
x-mozilla-html:FALSE
version:2.1
end:vcard

___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


Re: Comparable in java.util.Calendar

2005-11-21 Thread Stephen Crawley

Kendall Bell wrote:

I would like to implement Comparable in java.util.Calendar.java. I 
fell that this is necessary for compatibility with other JRE's.

Kendall Bell


Which other JRE's are you talking about?

For the record, java.util.Calendar does NOT implement Comparable in the 
JDK 1.4.2.


-- Steve



___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


Re: Comparable in java.util.Calendar

2005-11-21 Thread Mark Wielaard
Hi Kendall,

On Mon, 2005-11-21 at 17:15 -0600, Kendall Bell wrote:
 I would like to implement Comparable in java.util.Calendar.

That seems like a nice start for a 1.5 addition. Please follow the
Hacking Guide for some general instructions and post a patch to
classpath-patches plus ChangeLog entry when you have something for
review. http://www.gnu.org/software/classpath/docs/hacking.html

I see you already sent the paperwork request forms. Thanks for that.

Happy hacking,

Mark

-- 
Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html

Join the community at http://planet.classpath.org/


signature.asc
Description: This is a digitally signed message part
___
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath


[commit-cp] classpath ./ChangeLog javax/swing/JViewport.java

2005-11-21 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Branch: 
Changes by: Roman Kennke [EMAIL PROTECTED]05/11/21 13:33:06

Modified files:
.  : ChangeLog 
javax/swing: JViewport.java 

Log message:
2005-11-21  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/JViewport.java
(static_initializer): Initialize the defaultScrollMode here.
(JViewport): Set the defaultScrollMode that was initialized in
the static initializer.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5680tr2=1.5681r1=textr2=text
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/JViewport.java.diff?tr1=1.35tr2=1.36r1=textr2=text





[commit-cp] classpath javax/swing/JTable.java javax/swing/p...

2005-11-21 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Branch: 
Changes by: Roman Kennke [EMAIL PROTECTED]05/11/21 13:18:30

Modified files:
javax/swing: JTable.java 
javax/swing/plaf/basic: BasicTableUI.java 
.  : ChangeLog 

Log message:
2005-11-21  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/JTable.java
(columnAtPoint): Removed unused code.
(rowAtPoint): Removed unused code.
(prepareRenderer): Moved renderer prepare code from the UI to this
method.
(getSelections): Removed unused code.
* javax/swing/plaf/basic/BasicTableUI.java
(paintCell): Call JTable.prepareRenderer instead of preparing
the renderer in the UI.
(paint): Removed some unused code.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/JTable.java.diff?tr1=1.61tr2=1.62r1=textr2=text
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/plaf/basic/BasicTableUI.java.diff?tr1=1.37tr2=1.38r1=textr2=text
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5679tr2=1.5680r1=textr2=text





[commit-cp] classpath ./ChangeLog javax/swing/RepaintManage...

2005-11-21 Thread Roman Kennke
CVSROOT:/cvsroot/classpath
Module name:classpath
Branch: 
Changes by: Roman Kennke [EMAIL PROTECTED]05/11/21 14:01:43

Modified files:
.  : ChangeLog 
javax/swing: RepaintManager.java 

Log message:
2005-11-21  Roman Kennke  [EMAIL PROTECTED]

* javax/swing/RepaintManager.java
(currentRepaintManagers): Use a WeakHashMap to avoid potential
memory leak.
(currentManager): Instantiate WeakHashMap instead of HashMap.
(setCurrentManager): Instantiate WeakHashMap instead of HashMap.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5681tr2=1.5682r1=textr2=text
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/RepaintManager.java.diff?tr1=1.18tr2=1.19r1=textr2=text





[commit-cp] classpath ./ChangeLog javax/swing/JTable.java

2005-11-21 Thread Mark Wielaard
CVSROOT:/cvsroot/classpath
Module name:classpath
Branch: 
Changes by: Mark Wielaard [EMAIL PROTECTED]   05/11/21 22:03:17

Modified files:
.  : ChangeLog 
javax/swing: JTable.java 

Log message:
* javax/swing/JTable.java (propertyChange): Only resize header when
not null.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5684tr2=1.5685r1=textr2=text
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/JTable.java.diff?tr1=1.62tr2=1.63r1=textr2=text





[commit-cp] classpath ./ChangeLog java/awt/datatransfer/Dat...

2005-11-21 Thread Jan Roehrich
CVSROOT:/cvsroot/classpath
Module name:classpath
Branch: 
Changes by: Jan Roehrich [EMAIL PROTECTED]05/11/21 22:17:42

Modified files:
.  : ChangeLog 
java/awt/datatransfer: DataFlavor.java 

Log message:
2005-11-21  Jan Roehrich  [EMAIL PROTECTED]

* java/awt/datatransfer/DataFlavor.java: more code style
fixes. Changed order to static attributes, attributes, static
methods, constructors, methods. Moved static part into static
attribute declaration.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.5686tr2=1.5687r1=textr2=text
http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/java/awt/datatransfer/DataFlavor.java.diff?tr1=1.26tr2=1.27r1=textr2=text