diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-05-08 20:10:10 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-05-08 20:10:10 +0000 |
commit | 836c0d15e7ae358504391e38db644134faa82f79 (patch) | |
tree | 4871d84f0380f8d62a8d54a9f97f4b85fdf0af45 | |
parent | 0ad1d3949c31663c1d2bae9b93ed1b6455a2354c (diff) | |
download | classpath-836c0d15e7ae358504391e38db644134faa82f79.tar.gz |
2006-05-08 Lillian Angel <langel@redhat.com>
* java/net/URLClassLoader.java
(JarURLLoader): Added check to make sure the INDEX.LIST file
exists.
2006-05-08 Roman Kennke <kennke@aicas.com>
PR classpath/27481
* javax/swing/JRootPane.java
(createContentPane): Set background of the content pane to null,
so that the content pane inherits its background from the
root pane.
2006-05-08 Roman Kennke <kennke@aicas.com>
PR classpath/27480
* javax/swing/ButtonGroup.java
(add): Check if new button is selected and if so, deselect other
buttons in the group.
2006-05-08 Lillian Angel <langel@redhat.com>
PR classpath/27444
* java/net/URLClassLoader.java
(JarURLLoader): Added code to go through
META-INF/INDEX.LIST file to load all jars listed.
2006-05-08 Roman Kennke <kennke@aicas.com>
PR classpath/27461
* javax/swing/ImageIcon.java
(ImageIcon(URL)): Set description to URL.toString().
2006-05-08 Roman Kennke <kennke@aicas.com>
PR classpath/27482
* javax/swing/JTable.java
(IconCellRenderer.getTableCellRendererComponent): Set icon to
null when cell value is null.
2006-05-08 Roman Kennke <kennke@aicas.com>
PR classpath/27484
* javax/swing/DefaultDesktopManager.java
(closeFrame): Don't perform default close action on the frame
to prevent endless loop.
2006-05-08 Roman Kennke <kennke@aicas.com>
PR classpath/27485
* javax/swing/table/DefaultTableModel.java
(addExtraRows): New helper method.
(checkSize): New helper method.
(setRowCount): Use addExtraRows helper method.
(addColumn): Use addExtraRows helper method.
(getColumnName): Check and adjust size if necessary using
checkSize().
2006-05-08 Roman Kennke <kennke@aicas.com>
PR classpath/27486
* javax/swing/JTable.java
(setValueAt): Allow setting values even when table is editable.
-rw-r--r-- | ChangeLog | 65 | ||||
-rw-r--r-- | java/net/URLClassLoader.java | 40 | ||||
-rw-r--r-- | javax/swing/ButtonGroup.java | 8 | ||||
-rw-r--r-- | javax/swing/DefaultDesktopManager.java | 2 | ||||
-rw-r--r-- | javax/swing/ImageIcon.java | 6 | ||||
-rw-r--r-- | javax/swing/JRootPane.java | 1 | ||||
-rw-r--r-- | javax/swing/JTable.java | 20 | ||||
-rw-r--r-- | javax/swing/table/DefaultTableModel.java | 54 |
8 files changed, 162 insertions, 34 deletions
@@ -1,3 +1,68 @@ +2006-05-08 Lillian Angel <langel@redhat.com> + + * java/net/URLClassLoader.java + (JarURLLoader): Added check to make sure the INDEX.LIST file + exists. + +2006-05-08 Roman Kennke <kennke@aicas.com> + + PR classpath/27481 + * javax/swing/JRootPane.java + (createContentPane): Set background of the content pane to null, + so that the content pane inherits its background from the + root pane. + +2006-05-08 Roman Kennke <kennke@aicas.com> + + PR classpath/27480 + * javax/swing/ButtonGroup.java + (add): Check if new button is selected and if so, deselect other + buttons in the group. + +2006-05-08 Lillian Angel <langel@redhat.com> + + PR 27444 + * java/net/URLClassLoader.java + (JarURLLoader): Added code to go through + META-INF/INDEX.LIST file to load all jars listed. + +2006-05-08 Roman Kennke <kennke@aicas.com> + + PR classpath/27461 + * javax/swing/ImageIcon.java + (ImageIcon(URL)): Set description to URL.toString(). + +2006-05-08 Roman Kennke <kennke@aicas.com> + + PR classpath/27482 + * javax/swing/JTable.java + (IconCellRenderer.getTableCellRendererComponent): Set icon to + null when cell value is null. + +2006-05-08 Roman Kennke <kennke@aicas.com> + + PR classpath/27484 + * javax/swing/DefaultDesktopManager.java + (closeFrame): Don't perform default close action on the frame + to prevent endless loop. + +2006-05-08 Roman Kennke <kennke@aicas.com> + + PR classpath/27485 + * javax/swing/table/DefaultTableModel.java + (addExtraRows): New helper method. + (checkSize): New helper method. + (setRowCount): Use addExtraRows helper method. + (addColumn): Use addExtraRows helper method. + (getColumnName): Check and adjust size if necessary using + checkSize(). + +2006-05-08 Roman Kennke <kennke@aicas.com> + + PR classpath/27486 + * javax/swing/JTable.java + (setValueAt): Allow setting values even when table is editable. + 2006-05-07 Andrew John Hughes <gnu_andrew@member.fsf.org> PR classpath/27435: diff --git a/java/net/URLClassLoader.java b/java/net/URLClassLoader.java index 677a2275a..183e645c8 100644 --- a/java/net/URLClassLoader.java +++ b/java/net/URLClassLoader.java @@ -39,6 +39,7 @@ exception statement from your version. */ package java.net; +import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.EOFException; import java.io.File; @@ -46,6 +47,7 @@ import java.io.FileInputStream; import java.io.FilePermission; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; import java.security.AccessControlContext; import java.security.AccessController; import java.security.CodeSource; @@ -315,27 +317,51 @@ public class URLClassLoader extends SecureClassLoader jarfile = ((JarURLConnection) baseJarURL.openConnection()).getJarFile(); - + Manifest manifest; Attributes attributes; String classPathString; - if ((manifest = jarfile.getManifest()) != null + this.classPath = new Vector(); + + // This goes through the cached jar files listed + // in the INDEX.LIST file. All the jars found are added + // to the classPath vector so they can be loaded. + String dir = "META-INF/INDEX.LIST"; + if (jarfile.getEntry(dir) != null) + { + BufferedReader br = new BufferedReader(new InputStreamReader(new URL(baseJarURL, + dir).openStream())); + String line = br.readLine(); + while (line != null) + { + if (line.endsWith(".jar")) + { + try + { + this.classPath.add(new URL(baseURL, line)); + } + catch (java.net.MalformedURLException xx) + { + // Give up + } + } + line = br.readLine(); + } + } + else if ((manifest = jarfile.getManifest()) != null && (attributes = manifest.getMainAttributes()) != null && ((classPathString = attributes.getValue(Attributes.Name.CLASS_PATH)) != null)) - { - this.classPath = new Vector(); - + { StringTokenizer st = new StringTokenizer(classPathString, " "); while (st.hasMoreElements ()) { String e = st.nextToken (); try { - URL url = new URL(baseURL, e); - this.classPath.add(url); + this.classPath.add(new URL(baseURL, e)); } catch (java.net.MalformedURLException xx) { diff --git a/javax/swing/ButtonGroup.java b/javax/swing/ButtonGroup.java index 94f0109e6..2f8d19831 100644 --- a/javax/swing/ButtonGroup.java +++ b/javax/swing/ButtonGroup.java @@ -91,8 +91,12 @@ public class ButtonGroup implements Serializable { b.getModel().setGroup(this); if (b.isSelected()) - sel = b.getModel(); - buttons.addElement(b); + { + if (sel == null) + sel = b.getModel(); + else + b.setSelected(false); + } buttons.addElement(b); } /** diff --git a/javax/swing/DefaultDesktopManager.java b/javax/swing/DefaultDesktopManager.java index df2ab6cdb..0304461ad 100644 --- a/javax/swing/DefaultDesktopManager.java +++ b/javax/swing/DefaultDesktopManager.java @@ -124,8 +124,6 @@ public class DefaultDesktopManager implements DesktopManager, Serializable public void closeFrame(JInternalFrame frame) { Container c = frame.getParent(); - frame.doDefaultCloseAction(); - if (c != null) { if (frame.isIcon()) diff --git a/javax/swing/ImageIcon.java b/javax/swing/ImageIcon.java index 7347985eb..cedf4be35 100644 --- a/javax/swing/ImageIcon.java +++ b/javax/swing/ImageIcon.java @@ -288,12 +288,12 @@ public class ImageIcon } /** - * Creates an ImageIcon from the given URL without any description - * set. + * Creates an ImageIcon from the given URL and sets the description + * to the URL String representation. */ public ImageIcon(URL url) { - this(url, null); + this(url, url.toString()); } /** diff --git a/javax/swing/JRootPane.java b/javax/swing/JRootPane.java index a2cd9c7a0..5c4723596 100644 --- a/javax/swing/JRootPane.java +++ b/javax/swing/JRootPane.java @@ -551,6 +551,7 @@ public class JRootPane extends JComponent implements Accessible JPanel p = new JPanel(); p.setName(this.getName() + ".contentPane"); p.setLayout(new BorderLayout()); + p.setBackground(null); return p; } diff --git a/javax/swing/JTable.java b/javax/swing/JTable.java index 8a5dbb022..348534469 100644 --- a/javax/swing/JTable.java +++ b/javax/swing/JTable.java @@ -1246,8 +1246,12 @@ public class JTable { Icon iconValue = (Icon) value; setIcon(iconValue); - setText(""); } + else + { + setIcon(null); + } + setText(""); return this; } } @@ -1893,8 +1897,13 @@ public class JTable int x0 = 0; - int idx0 = event.getFirstIndex(); - int idxn = event.getLastIndex(); + // We must limit the indices to the bounds of the JTable's model, because + // we might get values of -1 or greater then columnCount in the case + // when columns get removed. + int idx0 = Math.max(0, Math.min(getColumnCount() - 1, + event.getFirstIndex())); + int idxn = Math.max(0, Math.min(getColumnCount() - 1, + event.getLastIndex())); int i; for (i = 0; i < idx0; i++) @@ -3586,8 +3595,7 @@ public class JTable } /** - * Set value for the cell at the given position. If the cell is not - * editable, this method returns without action. The modified cell is + * Set value for the cell at the given position. The modified cell is * repainted. * * @param value the value to set @@ -3596,8 +3604,6 @@ public class JTable */ public void setValueAt(Object value, int row, int column) { - if (!isCellEditable(row, column)) - return; dataModel.setValueAt(value, row, convertColumnIndexToModel(column)); repaint(getCellRect(row, column, true)); diff --git a/javax/swing/table/DefaultTableModel.java b/javax/swing/table/DefaultTableModel.java index c281caa07..09be2f752 100644 --- a/javax/swing/table/DefaultTableModel.java +++ b/javax/swing/table/DefaultTableModel.java @@ -294,12 +294,7 @@ public class DefaultTableModel extends AbstractTableModel else { int rowsToAdd = rowCount - existingRowCount; - for (int i = 0; i < rowsToAdd; i++) - { - Vector tmp = new Vector(); - tmp.setSize(columnIdentifiers.size()); - dataVector.add(tmp); - } + addExtraRows(rowsToAdd, columnIdentifiers.size()); fireTableRowsInserted(existingRowCount,rowCount-1); } } @@ -366,12 +361,7 @@ public class DefaultTableModel extends AbstractTableModel if (columnData.length > dataVector.size()) { int rowsToAdd = columnData.length - dataVector.size(); - for (int i = 0; i < rowsToAdd; i++) - { - Vector tmp = new Vector(); - tmp.setSize(columnIdentifiers.size()); - dataVector.add(tmp); - } + addExtraRows(rowsToAdd, columnIdentifiers.size()); } else if (columnData.length < dataVector.size()) { @@ -502,7 +492,8 @@ public class DefaultTableModel extends AbstractTableModel else { if (column < getColumnCount()) - { + { + checkSize(); Object id = columnIdentifiers.get(column); if (id != null) result = id.toString(); @@ -588,4 +579,41 @@ public class DefaultTableModel extends AbstractTableModel vector.add(convertToVector(data[i])); return vector; } + + /** + * This method adds some rows to <code>dataVector</code>. + * + * @param rowsToAdd number of rows to add + * @param nbColumns size of the added rows + */ + private void addExtraRows(int rowsToAdd, int nbColumns) + { + for (int i = 0; i < rowsToAdd; i++) + { + Vector tmp = new Vector(); + tmp.setSize(columnIdentifiers.size()); + dataVector.add(tmp); + } + } + + /** + * Checks the real columns/rows sizes against the ones returned by + * <code>getColumnCount()</code> and <code>getRowCount()</code>. + * If the supposed one are bigger, then we grow <code>columIdentifiers</code> + * and <code>dataVector</code> to their expected size. + */ + private void checkSize() + { + int columnCount = getColumnCount(); + int rowCount = getRowCount(); + + if (columnCount > columnIdentifiers.size()) + columnIdentifiers.setSize(columnCount); + + if (rowCount > dataVector.size()) + { + int rowsToAdd = rowCount - dataVector.size(); + addExtraRows(rowsToAdd, columnCount); + } + } } |