harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r440748 [24/25] - in /incubator/harmony/enhanced/classlib/trunk/modules: accessibility/src/main/java/javax/accessibility/ awt/ awt/make/ awt/src/main/java/common/java/awt/ awt/src/main/java/common/java/awt/datatransfer/ awt/src/main/java/co...
Date Wed, 06 Sep 2006 16:06:30 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTextFieldUI.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTextFieldUI.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTextFieldUI.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTextFieldUI.java Wed Sep  6 09:06:15 2006
@@ -19,12 +19,14 @@
  */
 package javax.swing.plaf.basic;
 
+import java.awt.Color;
 import java.beans.PropertyChangeEvent;
 import java.lang.reflect.Constructor;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
 import javax.swing.JComponent;
+import javax.swing.UIManager;
 import javax.swing.plaf.ComponentUI;
 import javax.swing.text.Document;
 import javax.swing.text.Element;
@@ -79,10 +81,20 @@
         super.installUI(c);
     }
 
+    private void updateBackgroundColor() {
+        String property = getComponent().isEditable()
+            ? ".background" : ".inactiveBackground";
+        Color color = UIManager.getColor(addPrefix(property));
+        getComponent().setBackground(color);
+    }
+
     protected  void propertyChange(final PropertyChangeEvent evt) {
         String propertyName = evt.getPropertyName();
         if ("horizontalAlignment".equals(propertyName)) {
             getComponent().repaint();
+        } else  if (org.apache.harmony.x.swing.StringConstants
+                    .EDITABLE_PROPERTY_CHANGED.equals(evt.getPropertyName())) {
+            updateBackgroundColor();
         }
         super.propertyChange(evt);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTextUI.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTextUI.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTextUI.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTextUI.java Wed Sep  6 09:06:15 2006
@@ -111,7 +111,7 @@
     // The Parent of all view Hierarchy. In never changes. When document
     // changes,
     // a child of rootView will be replaced only.
-    private RootViewContext        rootViewContext ;
+    private RootViewContext        rootViewContext;
 
     // PropertyChangeListener, DocumentListener
     private Listener               listener             = new Listener();
@@ -545,35 +545,33 @@
     }
 
     protected void installDefaults() {
-        UIDefaults uiDefaults = UIManager.getLookAndFeelDefaults();
-
         LookAndFeel.installColorsAndFont(component, addPrefix(".background"),
                                                     addPrefix(".foreground"),
                                                     addPrefix(".font"));
         if (Utilities.isUIResource(component.getBorder())) {
-            component.setBorder(uiDefaults.getBorder(addPrefix(".border")));
+            component.setBorder(UIManager.getBorder(addPrefix(".border")));
         }
         if (Utilities.isUIResource(component.getMargin())) {
-            component.setMargin(uiDefaults.getInsets(addPrefix(".margin")));
+            component.setMargin(UIManager.getInsets(addPrefix(".margin")));
         }
         //RI 6251901. Documentation error
         if (Utilities.isUIResource(component.getCaretColor())) {
-            component.setCaretColor(uiDefaults.getColor(addPrefix(
+            component.setCaretColor(UIManager.getColor(addPrefix(
                                                       ".caretForeground")));
         }
 
         if (Utilities.isUIResource(component.getSelectionColor())) {
-            component.setSelectionColor(uiDefaults.getColor(addPrefix(
+            component.setSelectionColor(UIManager.getColor(addPrefix(
                                                       ".selectionBackground")));
         }
 
         if (Utilities.isUIResource(component.getSelectedTextColor())) {
-            component.setSelectedTextColor(uiDefaults
+            component.setSelectedTextColor(UIManager
                     .getColor(addPrefix(".selectionForeground")));
         }
 
         if (Utilities.isUIResource(component.getDisabledTextColor())) {
-            component.setDisabledTextColor(uiDefaults.getColor(addPrefix(
+            component.setDisabledTextColor(UIManager.getColor(addPrefix(
                                          ".inactiveForeground")));
         }
     }
@@ -629,10 +627,9 @@
   }
 
     final void installUIInputMap() {
-        UIDefaults uiDefaults = UIManager.getLookAndFeelDefaults();
         String propertyName = addPrefix(".focusInputMap");
         InputMapUIResource inputMap1 = new InputMapUIResource();
-        InputMapUIResource inputMap2 = (InputMapUIResource)uiDefaults
+        InputMapUIResource inputMap2 = (InputMapUIResource)UIManager
                 .get(propertyName);
         inputMap1.setParent(inputMap2);
         SwingUtilities.replaceUIInputMap(component, JComponent.WHEN_FOCUSED,
@@ -1007,9 +1004,10 @@
     }
 
     final boolean getI18nProperty() {
-        return document == null ? false
-           :((Boolean)document.getProperty(StringConstants.BIDI_PROPERTY))
-               .booleanValue();
+        return document == null
+               ? false
+               : ((Boolean)document.getProperty(StringConstants.BIDI_PROPERTY))
+                 .booleanValue();
     }
 
     private View getRootView() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicToolBarUI.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicToolBarUI.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicToolBarUI.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicToolBarUI.java Wed Sep  6 09:06:15 2006
@@ -63,7 +63,6 @@
 import javax.swing.plaf.BorderUIResource;
 import javax.swing.plaf.ComponentUI;
 import javax.swing.plaf.ToolBarUI;
-import javax.swing.plaf.basic.BasicBorders;
 
 import org.apache.harmony.x.swing.StringConstants;
 import org.apache.harmony.x.swing.Utilities;
@@ -160,14 +159,17 @@
             repaint();
         }
 
-        private void changeOrientation(final int o) {
+        private void updateBounds(final int o, final Point newLocation) {
             if (orientation != o) {
                 Rectangle bounds = SwingUtilities.getLocalBounds(this);
                 setOffset(new Point(offset.y, offset.x));
                 bounds.setLocation((int)bounds.getCenterX() - getOffset().x,
                                    (int)bounds.getCenterY() - getOffset().y);
                 bounds.setSize(getHeight(), getWidth());
+                bounds.setLocation(newLocation);
                 setBounds(bounds);
+            } else {
+                setLocation(newLocation);
             }
             setOrientation(o);
         }
@@ -244,6 +246,16 @@
         }
     }
 
+    private class FloatingWindow extends JDialog {
+        public FloatingWindow(final Frame owner, final String title) {
+            super(owner, title, false);
+        }
+
+        public FloatingWindow(final Dialog owner, final String title) {
+            super(owner, title, false);
+        }
+    }
+
     public static ComponentUI createUI(final JComponent c) {
         return new BasicToolBarUI();
     }
@@ -295,6 +307,12 @@
     private Color light;
     private Color shadow;
 
+    private Color buttonDarkShadow;
+    private Color buttonHighlight;
+    private Color buttonLight;
+    private Color buttonShadow;
+
+
     public void installUI(final JComponent c) {
         toolBar = (JToolBar)c;
 
@@ -326,7 +344,18 @@
     }
 
     public boolean canDock(final Component c, final Point p) {
-        return getDockingConstraints(c, p) != BorderLayout.CENTER;
+        String constraints = getDockingConstraints(c, p);
+        if (constraints == BorderLayout.CENTER || !(c instanceof Container)) {
+            return false;
+        }
+
+        if (((Container)c).getLayout() instanceof BorderLayout) {
+            BorderLayout borderLayout = (BorderLayout)((Container)c).getLayout();
+            if (borderLayout.getLayoutComponent(constraints) != null) {
+                return false;
+            }
+        }
+        return true;
     }
 
     public void setDockingColor(final Color c) {
@@ -468,13 +497,16 @@
 
     protected RootPaneContainer createFloatingWindow(final JToolBar toolbar) {
         Window owner = SwingUtilities.getWindowAncestor(toolBar);
+        while (owner instanceof FloatingWindow) {
+            owner = owner.getOwner();
+        }
         JDialog floatingFrame;
         if (owner instanceof Dialog) {
-            floatingFrame = new JDialog((Dialog)owner, toolbar.getName(), false);
+            floatingFrame = new FloatingWindow((Dialog)owner, toolbar.getName());
         } else if (owner instanceof Frame) {
-            floatingFrame = new JDialog((Frame)owner, toolbar.getName(), false);
+            floatingFrame = new FloatingWindow((Frame)owner, toolbar.getName());
         } else {
-            floatingFrame = new JDialog((Frame)null, toolbar.getName(), false);
+            floatingFrame = new FloatingWindow((Frame)null, toolbar.getName());
         }
 
         floatingFrame.setResizable(false);
@@ -500,7 +532,7 @@
 
     protected Border createNonRolloverBorder() {
         Border buttonBorder = new BasicBorders.ButtonBorder(
-                shadow, darkShadow, highlight, light);
+                buttonShadow, buttonDarkShadow, buttonHighlight, buttonLight);
         Border marginBorder = new BasicBorders.ToolBarButtonMarginBorder();
         return new BorderUIResource.CompoundBorderUIResource(buttonBorder,
                                                              marginBorder);
@@ -541,11 +573,10 @@
         dragWindow.setBorderColor(canDock
                                   ? dockingBorderColor
                                   : floatingBorderColor);
-        dragWindow.changeOrientation(calculateOrientation(
-                getDockingConstraints(parent, p)));
+        int newOrientation = calculateOrientation(getDockingConstraints(parent, p));
         SwingUtilities.convertPointToScreen(p, parent);
         p.translate(-dragWindow.getOffset().x, -dragWindow.getOffset().y);
-        dragWindow.setLocation(p);
+        dragWindow.updateBounds(newOrientation, p);
     }
 
     protected void floatAt(final Point position, final Point origin) {
@@ -590,6 +621,10 @@
         highlight = UIManager.getColor("ToolBar.highlight");
         light = UIManager.getColor("ToolBar.light");
         shadow = UIManager.getColor("ToolBar.shadow");
+        buttonDarkShadow = UIManager.getColor("Button.darkShadow");
+        buttonHighlight = UIManager.getColor("Button.highlight");
+        buttonLight = UIManager.getColor("Button.light");
+        buttonShadow = UIManager.getColor("Button.shadow");
 
         setRolloverBorders(toolBar.isRollover());
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTreeKeyboardActions.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTreeKeyboardActions.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTreeKeyboardActions.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTreeKeyboardActions.java Wed Sep  6 09:06:15 2006
@@ -259,20 +259,30 @@
     private static AbstractAction toggleSelectionPreserveAnchorAction = new PreserveLeadAnchorAction() {
         public void preserveActionPerformed(final JTree tree) {
             TreePath leadPath = tree.getLeadSelectionPath();
-            TreePath togglePath = leadPath != null ? leadPath : tree.getPathForRow(0);
+            if (leadPath == null) {
+                return;
+            }
 
-            if (tree.isPathSelected(togglePath)) {
-                tree.removeSelectionPath(togglePath);
+            if (tree.isPathSelected(leadPath)) {
+                tree.removeSelectionPath(leadPath);
             } else {
-                tree.addSelectionPath(togglePath);
+                tree.addSelectionPath(leadPath);
             }
         }
     };
+    private static AbstractAction moveSelectionToAction = new TreeAction() {
+        public void actionPerformed(final JTree tree) {
+            TreePath leadPath = tree.getLeadSelectionPath();
+            if (leadPath == null) {
+                return;
+            }
+            tree.setSelectionPath(leadPath);
+        }
+    };
     private static AbstractAction extendSelectionAction = new TreeAction() {
         public void actionPerformed(final JTree tree) {
             TreePath leadPath = tree.getLeadSelectionPath();
             if (leadPath == null) {
-                tree.setSelectionPath(tree.getPathForRow(0));
                 return;
             }
             extendSelection(tree, leadPath);
@@ -353,6 +363,18 @@
             tree.scrollRectToVisible(visibleRect);
         }
     };
+    private static AbstractAction expandAction = new TreeAction() {
+        public void actionPerformed(final JTree tree) {
+            int leadRow = tree.getLeadSelectionRow();
+            tree.expandRow(leadRow);
+        }
+    };
+    private static AbstractAction collapseAction = new TreeAction() {
+        public void actionPerformed(final JTree tree) {
+            int leadRow = tree.getLeadSelectionRow();
+            tree.collapseRow(leadRow);
+        }
+    };
 
 
     public static void installKeyboardActions(final JTree tree) {
@@ -380,6 +402,7 @@
 
         tree.getActionMap().put("toggleSelectionPreserveAnchor", toggleSelectionPreserveAnchorAction);
         tree.getActionMap().put("extendSelection", extendSelectionAction);
+        tree.getActionMap().put("moveSelectionTo", moveSelectionToAction);
 
         tree.getActionMap().put("selectFirstChangeLead", selectFirstChangeLeadAction);
         tree.getActionMap().put("selectLastChangeLead", selectLastChangeLeadAction);
@@ -398,6 +421,9 @@
 
         tree.getActionMap().put("startEditing", startEditingAction);
         tree.getActionMap().put("cancel", cancelAction);
+
+        tree.getActionMap().put("expand", expandAction);
+        tree.getActionMap().put("collapse", collapseAction);
     }
 
     public static void uninstallKeyboardActions(final JTree tree) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTreeUI.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTreeUI.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTreeUI.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicTreeUI.java Wed Sep  6 09:06:15 2006
@@ -184,7 +184,10 @@
 
         public void keyTyped(final KeyEvent e) {
             int rowCount = tree.getRowCount();
-            if (rowCount == 0) {
+            if (rowCount == 0 
+                || (e.getModifiersEx() & KeyEvent.ALT_DOWN_MASK) != 0
+                || (e.getModifiersEx() & KeyEvent.CTRL_DOWN_MASK) != 0) {
+                
                 return;
             }
 
@@ -1512,6 +1515,10 @@
             treeModel.valueForPathChanged(editingPath, getCellEditor().getCellEditorValue());
         }
 
+        if (!isEditing(tree)) {
+            return;
+        }
+        
         tree.remove(editingComponent);
         editingComponent = null;
         editingPath = null;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/RootPaneFocusHandler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/RootPaneFocusHandler.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/RootPaneFocusHandler.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/RootPaneFocusHandler.java Wed Sep  6 09:06:15 2006
@@ -21,6 +21,8 @@
 
 import java.awt.Component;
 import java.awt.KeyboardFocusManager;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
 
 import javax.swing.JPopupMenu;
 import javax.swing.JRootPane;
@@ -37,8 +39,9 @@
     private static RootPaneFocusHandler sharedInstance;
     private static int numInstallations;
     private static Component previousFocusOwner;
+    private static Component focusedRootPane;
 
-    private boolean focusGrabbed;
+    private KeyListener rootPaneKeyListener;
 
     private RootPaneFocusHandler() {
     }
@@ -65,11 +68,11 @@
     public void stateChanged(final ChangeEvent e) {
         final MenuElement[] path = MenuSelectionManager.defaultManager().getSelectedPath();
         if (Utilities.isEmptyArray(path)) {
-            if (focusGrabbed) {
+            if (focusedRootPane != null) {
                 returnFocus();
             }
         } else {
-            if (!focusGrabbed && Utilities.isValidFirstPathElement(path[0])) {
+            if (focusedRootPane == null && Utilities.isValidFirstPathElement(path[0])) {
                 grabFocus(path);
             }
         }
@@ -86,13 +89,33 @@
                 Component focusOwner = getFocusManager().getFocusOwner();
                 if (pane.requestFocus(true)) {
                     previousFocusOwner = focusOwner;
-                    focusGrabbed = true;
+                    focusedRootPane = pane;
+                    MenuKeyBindingProcessor.attach();
+                    if (pane.getJMenuBar() == null) {
+                        pane.addKeyListener(createRootPaneKeyListener());
+                    }
                 }
                 break;
             }
         }
     }
 
+    private KeyListener createRootPaneKeyListener() {
+        return (rootPaneKeyListener != null) ? rootPaneKeyListener : (rootPaneKeyListener = new KeyListener() {
+            public void keyPressed(KeyEvent event) {
+                MenuSelectionManager.defaultManager().processKeyEvent(event);
+            }
+
+            public void keyReleased(KeyEvent event) {
+                MenuSelectionManager.defaultManager().processKeyEvent(event);
+            }
+
+            public void keyTyped(KeyEvent event) {
+                MenuSelectionManager.defaultManager().processKeyEvent(event);
+            }
+        });
+    }
+
     private Component getRootPaneChild(final MenuElement item) {
         return (item instanceof JPopupMenu) ? ((JPopupMenu)item).getInvoker() : (Component)item;
     }
@@ -103,7 +126,9 @@
         } else {
             getFocusManager().focusNextComponent();
         }
-        focusGrabbed = false;
+        focusedRootPane.removeKeyListener(rootPaneKeyListener);
+        focusedRootPane = null;
+        MenuKeyBindingProcessor.detach();
     }
 
     private KeyboardFocusManager getFocusManager() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalBorders.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalBorders.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalBorders.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalBorders.java Wed Sep  6 09:06:15 2006
@@ -339,6 +339,14 @@
     }
 
     public static class TextFieldBorder extends Flush3DBorder {
+
+        public void paintBorder(Component c, Graphics g, int x, int y, int w,
+                                int h) {
+            if (!c.isEnabled()) {
+                return;
+            }
+            super.paintBorder(c, g, x, y, w, h);
+        }
     }
 
     public static class ToggleButtonBorder extends ButtonBorder {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalButtonUI.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalButtonUI.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalButtonUI.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalButtonUI.java Wed Sep  6 09:06:15 2006
@@ -38,8 +38,6 @@
     protected Color focusColor;
     protected Color selectColor;
 
-    private Color pressedButtonBG;
-
     private static MetalButtonUI commonMetalButtonUI;
 
     public static ComponentUI createUI(final JComponent component) {
@@ -51,7 +49,6 @@
 
     public void installDefaults(final AbstractButton button) {
         super.installDefaults(button);
-        pressedButtonBG = UIManager.getColor(getPropertyPrefix() + "shadow");
     }
 
     public void uninstallDefaults(final AbstractButton button) {
@@ -75,7 +72,7 @@
 
     protected void paintButtonPressed(final Graphics g, final AbstractButton button) {
         if (button.getModel().isArmed() && button.isContentAreaFilled()) {
-            ButtonCommons.paintPressed(g, button, pressedButtonBG);
+            ButtonCommons.paintPressed(g, button, getSelectColor());
         }
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalFileChooserUI.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalFileChooserUI.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalFileChooserUI.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalFileChooserUI.java Wed Sep  6 09:06:15 2006
@@ -47,6 +47,7 @@
 import java.io.File;
 import java.text.DateFormat;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.EventObject;
 import java.util.LinkedList;
@@ -85,6 +86,8 @@
 import javax.swing.SwingUtilities;
 import javax.swing.TransferHandler;
 import javax.swing.UIManager;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
 import javax.swing.event.ListDataEvent;
 import javax.swing.event.ListDataListener;
 import javax.swing.event.ListSelectionEvent;
@@ -98,6 +101,7 @@
 import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.TableModel;
 import javax.swing.text.JTextComponent;
+import javax.swing.text.Position.Bias;
 
 import org.apache.harmony.x.swing.StringConstants;
 import org.apache.harmony.x.swing.Utilities;
@@ -275,11 +279,15 @@
                 fireContentsChanged(this, 0, filters.length - 1);
             } else if (JFileChooser.FILE_FILTER_CHANGED_PROPERTY.equals(changedProperty)) {
                 setSelectedItem(e.getNewValue());
+                if (!Arrays.asList(filters).contains(e.getNewValue())) {
+                    getFileChooser().addChoosableFileFilter((FileFilter)e.getNewValue());
+                }
             }
         }
 
         public void setSelectedItem(final Object filter) {
             selectedFilter = filter;
+            getViewRepresentation().getSelectionModel().clearSelection();
             fireContentsChanged(this, -1, -1);
         }
 
@@ -408,7 +416,7 @@
     }
 
     private class DetailedFileViewModel extends AbstractTableModel {
-        private final String[] columnNames = new String[] { "Name", "Size", "Type", "Modified", "Attributes" };
+        private String[] columnNames;
 
         public int getRowCount() {
             return getModel().getSize();
@@ -471,8 +479,20 @@
         }
 
         public String getColumnName(final int column) {
+            if (columnNames == null) {
+                initColumnNames();
+            }
             return columnNames[column];
         }
+
+        private void initColumnNames() {
+            columnNames = new String[5];
+            columnNames[0] = UIManager.getString("FileChooser.fileNameHeaderText");
+            columnNames[1] = UIManager.getString("FileChooser.fileSizeHeaderText");
+            columnNames[2] = UIManager.getString("FileChooser.fileTypeHeaderText");
+            columnNames[3] = UIManager.getString("FileChooser.fileDateHeaderText");
+            columnNames[4] = UIManager.getString("FileChooser.fileAttrHeaderText");
+        }
     }
 
     private class DirectoryComboBoxRenderer extends DefaultListCellRenderer {
@@ -559,11 +579,13 @@
         public OpenDirectoryAction() {
             putValue(AbstractAction.NAME, openButtonText);
             putValue(AbstractAction.SHORT_DESCRIPTION, openButtonToolTipText);
-            putValue(AbstractAction.MNEMONIC_KEY, new Integer(openButtonMnemonic));
         }
 
         public void actionPerformed(final ActionEvent e) {
             File selectedDir = getViewRepresentation().getSelectedValue();
+            if (selectedDir == null) {
+                selectedDir = translateFile(getFileName());
+            }
             getFileChooser().setCurrentDirectory(selectedDir);
         }
     }
@@ -734,7 +756,7 @@
         fc.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
 
         listView = createList(fc);
-        detailedView = createTable(fc);
+        detailedView = createDetailsView(fc);
 
         fc.add(listView, BorderLayout.CENTER);
         fc.add(createTopPanel(fc), BorderLayout.NORTH);
@@ -924,22 +946,9 @@
             setDirectorySelected(false);
             setDirectory(null);
         }
-        Action approveAction;
-        if (selectedValues.length == 1
-            && selectedFile.isDirectory()
-            && getFileChooser().isTraversable(selectedFile)
-            && (!getFileChooser().isDirectorySelectionEnabled()
-                || !getFileChooser().getFileSystemView().isFileSystem(selectedFile)
-                || (getFileChooser().getFileSystemView().isFileSystemRoot(selectedFile)
-                    && getFileChooser().getFileSelectionMode() != JFileChooser.DIRECTORIES_ONLY))) {
 
-            approveAction = openDirectoryAction;
-        } else {
-            approveAction = approveSelectionAction;
-        }
-        if (approveButton.getAction() != approveAction) {
-            approveButton.setAction(approveAction);
-        }
+        
+        configureApproveButton(selectedFile, selectedValues.length == 1);
 
         if (getFileChooser().isMultiSelectionEnabled()) {
             List selectedFiles = new LinkedList();
@@ -1061,7 +1070,20 @@
         result.setPreferredSize(new Dimension(300, 200));
         result.setBorder(MetalBorders.getTextFieldBorder());
 
-        list = new JList(getModel());
+        list = new JList(getModel()) {
+            public int getNextMatch(final String prefix, final int startIndex, final Bias bias) {
+                return Utilities.getNextMatch(new Utilities.ListModelAccessor() {
+                    public Object getElementAt(final int index) {
+                        return ((File)getModel().getElementAt(index)).getName();
+                    }
+
+                    public int getSize() {
+                        return getModel().getSize();
+                    }
+                    
+                }, prefix, startIndex, bias);
+            }
+        };
         list.setSelectionMode(fc.isMultiSelectionEnabled() ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
                 : ListSelectionModel.SINGLE_SELECTION);
         list.setLayoutOrientation(JList.VERTICAL_WRAP);
@@ -1079,7 +1101,136 @@
     }
 
     protected JPanel createDetailsView(final JFileChooser fc) {
-        throw new UnsupportedOperationException("Is not supported since JTable is not implemented yet");
+        JPanel result = new JPanel(new BorderLayout());
+        result.setPreferredSize(new Dimension(300, 200));
+        result.setBorder(MetalBorders.getTextFieldBorder());
+
+        TableModel model = new DetailedFileViewModel();
+        table = new JTable(model) {
+            protected void processKeyEvent(final KeyEvent event) {
+                if (event.getKeyCode() == KeyEvent.VK_ENTER
+                    || event.getKeyCode() == KeyEvent.VK_ESCAPE) {
+
+                    KeyEvent fcEvent = new KeyEvent(getFileChooser(), event.getID(), event.getWhen(), event.getModifiers(), event.getKeyCode(), event.getKeyChar(), event.getKeyLocation());
+                    SwingUtilities.processKeyBindings(fcEvent);
+                    return;
+                }
+
+                super.processKeyEvent(event);
+            }
+            
+            public boolean getScrollableTracksViewportHeight() {
+                return true;
+            }
+        };
+        table.setShowGrid(false);
+        table.setSelectionModel(list.getSelectionModel());
+        result.add(new JScrollPane(table), BorderLayout.CENTER);
+        result.add(getAccessoryPanel(), BorderLayout.LINE_END);
+
+        table.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
+        table.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);
+
+        table.getColumnModel().getColumn(0).setPreferredWidth(150);
+        table.getColumnModel().getColumn(1).setPreferredWidth(30);
+        table.getColumnModel().getColumn(2).setPreferredWidth(50);
+        table.getColumnModel().getColumn(3).setPreferredWidth(50);
+        table.getColumnModel().getColumn(4).setPreferredWidth(20);
+
+        table.getColumn(model.getColumnName(0)).setCellRenderer(new DefaultTableCellRenderer() {
+            public Component getTableCellRendererComponent(final JTable table,
+                                                           final Object value,
+                                                           final boolean isSelected,
+                                                           final boolean hasFocus,
+                                                           final int row,
+                                                           final int column) {
+
+                File renderingFile = (File)getModel().getElementAt(row);
+                String displayValue = getFileChooser().getName(renderingFile);
+
+                JLabel result = (JLabel)super.getTableCellRendererComponent(table, displayValue, isSelected, hasFocus, row, column);
+                result.setIcon(getFileChooser().getIcon(renderingFile));
+
+                return result;
+            }
+        });
+        table.getColumn(model.getColumnName(1)).setCellRenderer(new DefaultTableCellRenderer() {
+            public Component getTableCellRendererComponent(final JTable table,
+                                                           final Object value,
+                                                           final boolean isSelected,
+                                                           final boolean hasFocus,
+                                                           final int row,
+                                                           final int column) {
+
+                JLabel result = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+                result.setHorizontalAlignment(SwingConstants.RIGHT);
+                return result;
+            }
+        });
+        table.getColumn(model.getColumnName(3)).setCellRenderer(new DefaultTableCellRenderer() {
+            public Component getTableCellRendererComponent(final JTable table,
+                                                           final Object value,
+                                                           final boolean isSelected,
+                                                           final boolean hasFocus,
+                                                           final int row,
+                                                           final int column) {
+
+                Date date = (Date)value;
+                if (date != null) {
+                    JLabel result = (JLabel)super.getTableCellRendererComponent(table, DateFormat.getDateTimeInstance().format(date), isSelected, hasFocus, row, column);
+                    result.setHorizontalAlignment(SwingConstants.RIGHT);
+                    return result;
+                }
+                return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+            }
+        });
+        table.setDefaultEditor(String.class, new DefaultCellEditor(new JTextField()) {
+            public boolean isCellEditable(final EventObject event) {
+                return event == null;
+            }
+        });
+
+
+        getModel().addListDataListener(new ListDataListener() {
+            public void intervalAdded(final ListDataEvent e) {
+                fireTableChanged();
+            }
+
+            public void intervalRemoved(final ListDataEvent e) {
+                fireTableChanged();
+            }
+
+            public void contentsChanged(final ListDataEvent e) {
+                fireTableChanged();
+            }
+
+            private void fireTableChanged() {
+                if (isDetailedViewActivated) {
+                    ((AbstractTableModel)table.getModel()).fireTableDataChanged();
+                }
+            }
+        });
+
+        table.addMouseListener(new MouseAdapter() {
+            public void mouseClicked(final MouseEvent e) {
+                if (e.getButton() != MouseEvent.BUTTON1) {
+                    return;
+                }
+
+                if (e.getClickCount() != 2) {
+                    return;
+                }
+                File file = getViewRepresentation().getSelectedValue();
+                if (file != null && file.isDirectory()) {
+                    getFileChooser().setCurrentDirectory(file);
+                    return;
+                }
+
+                approveSelectionAction.actionPerformed(null);
+            }
+        });
+
+        return result;
     }
 
     protected void addControlButtons() {
@@ -1132,7 +1283,9 @@
         c.insets = new Insets(0, 0, 6, 0);
         c.gridwidth = 1;
         c.weightx = 0.0;
-        bottomPanel.add(new JLabel(UIManager.getString("FileChooser.fileNameLabelText")), c);
+        JLabel fileNameLabel = new JLabel(UIManager.getString("FileChooser.fileNameLabelText"));
+        fileNameLabel.setDisplayedMnemonic(UIManager.getInt("FileChooser.fileNameLabelMnemonic"));
+        bottomPanel.add(fileNameLabel, c);
         bottomPanel.add(Box.createHorizontalStrut(6), c);
 
 
@@ -1140,11 +1293,31 @@
         c.gridwidth = 1;
         c.gridwidth = GridBagConstraints.REMAINDER;
         fileNameField = new JTextField();
-        fileNameField.setAction(getApproveSelectionAction());
-        fileNameField.setToolTipText(null);
-        fileNameField.addActionListener(new ActionListener() {
-            public void actionPerformed(final ActionEvent e) {
-                setFileName(fileNameField.getText());
+        
+        fileNameLabel.setLabelFor(fileNameField);
+        
+        fileNameField.getDocument().addDocumentListener(new DocumentListener() {
+            public void insertUpdate(final DocumentEvent e) {
+                onChange();
+            }
+
+            public void removeUpdate(final DocumentEvent e) {
+                onChange();
+            }
+
+            public void changedUpdate(final DocumentEvent e) {
+                onChange();
+            }
+            
+            
+            private void onChange() {
+                configureApproveButton(translateFile(fileNameField.getText()), true);
+            }
+        });
+        fileNameField.addFocusListener(new FocusAdapter() {
+            public void focusGained(final FocusEvent e) {
+                getViewRepresentation().getSelectionModel().clearSelection();
+                configureApproveButton(translateFile(fileNameField.getText()), true);
             }
         });
         bottomPanel.add(fileNameField, c);
@@ -1152,14 +1325,20 @@
         c.insets = new Insets(0, 0, 0, 0);
         c.gridwidth = 1;
         c.weightx = 0.0;
-        bottomPanel.add(new JLabel(UIManager.getString("FileChooser.filesOfTypeLabelText")), c);
+        JLabel filesOfTypeLabel = new JLabel(UIManager.getString("FileChooser.filesOfTypeLabelText"));
+        filesOfTypeLabel.setDisplayedMnemonic(UIManager.getInt("FileChooser.filesOfTypeLabelMnemonic"));
+        bottomPanel.add(filesOfTypeLabel, c);
         bottomPanel.add(Box.createHorizontalStrut(6), c);
 
         c.gridwidth = GridBagConstraints.REMAINDER;
         c.weightx = 1.0;
         final JComboBox fileFilterCombo = new JComboBox(createFilterComboBoxModel());
+        
+        filesOfTypeLabel.setLabelFor(fileFilterCombo);
+        
         fileFilterCombo.addActionListener(new ActionListener() {
             public void actionPerformed(final ActionEvent e) {
+                fileNameField.setText("");
                 getFileChooser().setFileFilter((FileFilter)fileFilterCombo.getSelectedItem());
             }
         });
@@ -1214,6 +1393,10 @@
 
         result.add(actionLabel, BorderLayout.LINE_START);
         result.add(directoryComboBox, BorderLayout.CENTER);
+        
+        actionLabel.setDisplayedMnemonic(UIManager.getInt("FileChooser.lookInLabelMnemonic"));
+        actionLabel.setLabelFor(directoryComboBox);
+        
         result.add(viewButtonsPanel, BorderLayout.LINE_END);
 
         return result;
@@ -1277,135 +1460,6 @@
         return result;
     }
 
-    private JPanel createTable(final JFileChooser fc) {
-        JPanel result = new JPanel(new BorderLayout());
-        result.setPreferredSize(new Dimension(300, 200));
-        result.setBorder(MetalBorders.getTextFieldBorder());
-
-        TableModel model = new DetailedFileViewModel();
-        table = new JTable(model) {
-            protected void processKeyEvent(final KeyEvent event) {
-                if (event.getKeyCode() == KeyEvent.VK_ENTER
-                    || event.getKeyCode() == KeyEvent.VK_ESCAPE) {
-
-                    KeyEvent fcEvent = new KeyEvent(getFileChooser(), event.getID(), event.getWhen(), event.getModifiers(), event.getKeyCode(), event.getKeyChar(), event.getKeyLocation());
-                    SwingUtilities.processKeyBindings(fcEvent);
-                    return;
-                }
-
-                super.processKeyEvent(event);
-            }
-        };
-        table.setShowGrid(false);
-        table.setSelectionModel(list.getSelectionModel());
-        result.add(new JScrollPane(table), BorderLayout.CENTER);
-        result.add(getAccessoryPanel(), BorderLayout.LINE_END);
-
-        table.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null);
-        table.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null);
-
-        table.getColumnModel().getColumn(0).setPreferredWidth(150);
-        table.getColumnModel().getColumn(1).setPreferredWidth(30);
-        table.getColumnModel().getColumn(2).setPreferredWidth(50);
-        table.getColumnModel().getColumn(3).setPreferredWidth(50);
-        table.getColumnModel().getColumn(4).setPreferredWidth(20);
-
-        table.getColumn(model.getColumnName(0)).setCellRenderer(new DefaultTableCellRenderer() {
-            public Component getTableCellRendererComponent(final JTable table,
-                                                           final Object value,
-                                                           final boolean isSelected,
-                                                           final boolean hasFocus,
-                                                           final int row,
-                                                           final int column) {
-
-                File renderingFile = (File)getModel().getElementAt(row);
-                String displayValue = getFileChooser().getName(renderingFile);
-
-                JLabel result = (JLabel)super.getTableCellRendererComponent(table, displayValue, isSelected, hasFocus, row, column);
-                result.setIcon(getFileChooser().getIcon(renderingFile));
-
-                return result;
-            }
-        });
-        table.getColumn(model.getColumnName(1)).setCellRenderer(new DefaultTableCellRenderer() {
-            public Component getTableCellRendererComponent(final JTable table,
-                                                           final Object value,
-                                                           final boolean isSelected,
-                                                           final boolean hasFocus,
-                                                           final int row,
-                                                           final int column) {
-
-                JLabel result = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
-                result.setHorizontalAlignment(SwingConstants.RIGHT);
-                return result;
-            }
-        });
-        table.getColumn(model.getColumnName(3)).setCellRenderer(new DefaultTableCellRenderer() {
-            public Component getTableCellRendererComponent(final JTable table,
-                                                           final Object value,
-                                                           final boolean isSelected,
-                                                           final boolean hasFocus,
-                                                           final int row,
-                                                           final int column) {
-
-                Date date = (Date)value;
-                if (date != null) {
-                    JLabel result = (JLabel)super.getTableCellRendererComponent(table, DateFormat.getDateTimeInstance().format(date), isSelected, hasFocus, row, column);
-                    result.setHorizontalAlignment(SwingConstants.RIGHT);
-                    return result;
-                }
-                return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
-            }
-        });
-        table.setDefaultEditor(String.class, new DefaultCellEditor(new JTextField()) {
-            public boolean isCellEditable(final EventObject event) {
-                return event == null;
-            }
-        });
-
-
-        getModel().addListDataListener(new ListDataListener() {
-            public void intervalAdded(final ListDataEvent e) {
-                fireTableChanged();
-            }
-
-            public void intervalRemoved(final ListDataEvent e) {
-                fireTableChanged();
-            }
-
-            public void contentsChanged(final ListDataEvent e) {
-                fireTableChanged();
-            }
-
-            private void fireTableChanged() {
-                if (isDetailedViewActivated) {
-                    ((AbstractTableModel)table.getModel()).fireTableDataChanged();
-                }
-            }
-        });
-
-        table.addMouseListener(new MouseAdapter() {
-            public void mouseClicked(final MouseEvent e) {
-                if (e.getButton() != MouseEvent.BUTTON1) {
-                    return;
-                }
-
-                if (e.getClickCount() != 2) {
-                    return;
-                }
-                File file = getViewRepresentation().getSelectedValue();
-                if (file != null && file.isDirectory()) {
-                    getFileChooser().setCurrentDirectory(file);
-                    return;
-                }
-
-                approveSelectionAction.actionPerformed(null);
-            }
-        });
-
-        return result;
-    }
-
     private ViewRepresentation getViewRepresentation() {
         return isDetailedViewActivated ? detailedViewRepresentation : listViewRepresentation;
     }
@@ -1426,4 +1480,56 @@
         }
         return num + " KB";
     }
+    
+    private void configureApproveButton(final File selectedFile, final boolean singleFileSelected) {
+        Action approveAction;
+        if (singleFileSelected
+            && selectedFile != null 
+            && selectedFile.isDirectory()
+            && getFileChooser().isTraversable(selectedFile)
+            && (!getFileChooser().isDirectorySelectionEnabled()
+                || !getFileChooser().getFileSystemView().isFileSystem(selectedFile)
+                || (getFileChooser().getFileSystemView().isFileSystemRoot(selectedFile)
+                    && getFileChooser().getFileSelectionMode() != JFileChooser.DIRECTORIES_ONLY))) {
+
+            approveAction = openDirectoryAction;
+        } else {
+            approveAction = approveSelectionAction;
+        }
+        if (approveButton.getAction() != approveAction) {
+            approveButton.setAction(approveAction);
+        }
+            
+    }
+    
+    
+    private File translateFile(final String fileName) {
+        if (Utilities.isEmptyString(fileName)) {
+            return null;
+        }
+
+        File candidateFile = new File(fileName);
+        if (candidateFile.isAbsolute()) {
+            return candidateFile;
+        }
+
+        if (fileName.startsWith("\"")) {
+            String nakedFileName = fileName.endsWith("\"")
+                                   ? fileName.substring(1, fileName.length() - 1)
+                                   : fileName.substring(1);
+
+            File fileInCurrentDir = getFileChooser().getFileSystemView().getChild(getFileChooser().getCurrentDirectory(), nakedFileName);
+            if (fileInCurrentDir != null
+                && fileInCurrentDir.exists()
+                && getFileChooser().getFileSystemView().isFileSystem(fileInCurrentDir)) {
+
+                return fileInCurrentDir;
+            } else {
+                return getFileChooser().getFileSystemView().createFileObject(nakedFileName);
+            }
+        } else {
+            return getFileChooser().getFileSystemView().createFileObject(getFileChooser().getCurrentDirectory(), fileName);
+        }
+    }
+    
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalInternalFrameUI.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalInternalFrameUI.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalInternalFrameUI.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalInternalFrameUI.java Wed Sep  6 09:06:15 2006
@@ -27,17 +27,16 @@
 import javax.swing.JComponent;
 import javax.swing.JInternalFrame;
 import javax.swing.LookAndFeel;
-
-import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
 import javax.swing.plaf.ComponentUI;
-
 import javax.swing.plaf.basic.BasicInternalFrameUI;
 
 public class MetalInternalFrameUI extends BasicInternalFrameUI {
     protected static String IS_PALETTE = "JInternalFrame.isPalette";
 
+    private static String IS_OPTION_DIALOG = "JInternalFrame.optionDialog";
+
     private MetalInternalFramePropertyChangeListener metalPropertyChangeListener;
-    private BasicInternalFrameTitlePane titlePane;
+    private MetalInternalFrameTitlePane titlePane;
 
 
     private class MetalInternalFramePropertyChangeListener implements PropertyChangeListener {
@@ -47,6 +46,8 @@
         public void propertyChange(final PropertyChangeEvent e) {
             if (IS_PALETTE.equals(e.getPropertyName())) {
                 setPalette(((Boolean)e.getNewValue()).booleanValue());
+            } else if (IS_OPTION_DIALOG.equals(e.getPropertyName())) {
+                setBorder();
             }
         }
     }
@@ -95,8 +96,7 @@
     public void installUI(final JComponent c) {
         super.installUI(c);
 
-        Boolean b = (Boolean)c.getClientProperty(MetalInternalFrameUI.IS_PALETTE);
-        setPalette(b != null && b.booleanValue());
+        setPalette(isPropertySet(IS_PALETTE));
     }
 
     public void uninstallUI(final JComponent c) {
@@ -109,13 +109,24 @@
     }
 
     public void setPalette(final boolean b) {
-        ((MetalInternalFrameTitlePane)titlePane).setPalette(b);
+        titlePane.setPalette(b);
 
-        if (b) {
+        setBorder();
+        // the layer isn't changed
+    }
+    
+    private void setBorder() {
+        if (titlePane.isPalette) {
             LookAndFeel.installBorder(frame, "InternalFrame.paletteBorder");
+        } else if (isPropertySet(IS_OPTION_DIALOG)) {
+            LookAndFeel.installBorder(frame, "InternalFrame.optionDialogBorder");
         } else {
             LookAndFeel.installBorder(frame, "InternalFrame.border");
         }
-        // the layer isn't changed
+    }
+    
+    private boolean isPropertySet(final String propertyName) {
+        Boolean b = (Boolean)frame.getClientProperty(propertyName);
+        return b != null && b.booleanValue();
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalLookAndFeel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalLookAndFeel.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalLookAndFeel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalLookAndFeel.java Wed Sep  6 09:06:15 2006
@@ -184,21 +184,37 @@
         Object[] tableAncestorInputMap = new Object[] {"ctrl C", "copy", "ctrl V", "paste",
                                                        "ctrl X", "cut", "COPY", "copy", "PASTE", "paste",
                                                        "CUT", "cut", "RIGHT", "selectNextColumn",
+                                                       "ctrl RIGHT", "selectNextColumnChangeLead",
                                                        "KP_RIGHT", "selectNextColumn",
+                                                       "ctrl KP_RIGHT", "selectNextColumnChangeLead",
                                                        "LEFT", "selectPreviousColumn",
+                                                       "ctrl LEFT", "selectPreviousColumnChangeLead",
                                                        "KP_LEFT", "selectPreviousColumn",
+                                                       "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
                                                        "DOWN", "selectNextRow",
+                                                       "ctrl DOWN", "selectNextRowChangeLead",
                                                        "KP_DOWN", "selectNextRow",
+                                                       "ctrl KP_DOWN", "selectNextRowChangeLead",
                                                        "UP", "selectPreviousRow",
+                                                       "ctrl UP", "selectPreviousRowChangeLead",
                                                        "KP_UP", "selectPreviousRow",
+                                                       "ctrl KP_UP", "selectPreviousRowChangeLead",
                                                        "shift RIGHT", "selectNextColumnExtendSelection",
+                                                       "shift ctrl RIGHT", "selectNextColumnExtendSelection",
                                                        "shift KP_RIGHT", "selectNextColumnExtendSelection",
+                                                       "shift ctrl KP_RIGHT", "selectNextColumnExtendSelection",
                                                        "shift LEFT", "selectPreviousColumnExtendSelection",
+                                                       "shift ctrl LEFT", "selectPreviousColumnExtendSelection",
                                                        "shift KP_LEFT", "selectPreviousColumnExtendSelection",
+                                                       "shift ctrl KP_LEFT", "selectPreviousColumnExtendSelection",
                                                        "shift DOWN", "selectNextRowExtendSelection",
+                                                       "shift ctrl DOWN", "selectNextRowExtendSelection",
                                                        "shift KP_DOWN", "selectNextRowExtendSelection",
+                                                       "shift ctrl KP_DOWN", "selectNextRowExtendSelection",
                                                        "shift UP", "selectPreviousRowExtendSelection",
+                                                       "shift ctrl UP", "selectPreviousRowExtendSelection",
                                                        "shift KP_UP", "selectPreviousRowExtendSelection",
+                                                       "shift ctrl KP_UP", "selectPreviousRowExtendSelection",
                                                        "PAGE_UP", "scrollUpChangeSelection",
                                                        "PAGE_DOWN", "scrollDownChangeSelection",
                                                        "HOME", "selectFirstColumn",
@@ -219,8 +235,10 @@
                                                        "shift TAB", "selectPreviousColumnCell",
                                                        "ENTER", "selectNextRowCell",
                                                        "shift ENTER", "selectPreviousRowCell",
-                                                       "ctrl A", "selectAll", "ESCAPE", "cancel",
-                                                       "F2", "startEditing" };
+                                                       "ctrl A", "selectAll", "ctrl SLASH", "selectAll", "ctrl BACK_SLASH", "clearSelection",
+                                                       "F2", "startEditing", "ESCAPE", "cancel",
+                                                       "SPACE", "addToSelection", "ctrl SPACE", "toggleAndAnchor",
+                                                       "shift ctrl SPACE", "moveSelectionTo", "shift SPACE", "extendTo"};
         Object[] editorPaneFocusInputMap = new Object[] {"ctrl C", DefaultEditorKit.copyAction,
                                                          "ctrl V", DefaultEditorKit.pasteAction,
                                                          "ctrl X", DefaultEditorKit.cutAction,
@@ -260,6 +278,7 @@
                                                          "shift KP_DOWN", DefaultEditorKit.selectionDownAction,
                                                          "ENTER", DefaultEditorKit.insertBreakAction,
                                                          "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
+                                                         "ctrl H", DefaultEditorKit.deletePrevCharAction,
                                                          "DELETE", DefaultEditorKit.deleteNextCharAction,
                                                          "RIGHT", DefaultEditorKit.forwardAction,
                                                          "LEFT", DefaultEditorKit.backwardAction,
@@ -338,6 +357,7 @@
                                                                  "shift HOME", DefaultEditorKit.selectionBeginLineAction,
                                                                  "shift END", DefaultEditorKit.selectionEndLineAction,
                                                                  "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
+                                                                 "ctrl H", DefaultEditorKit.deletePrevCharAction,
                                                                  "DELETE", DefaultEditorKit.deleteNextCharAction,
                                                                  "RIGHT", DefaultEditorKit.forwardAction,
                                                                  "LEFT", DefaultEditorKit.backwardAction,
@@ -357,11 +377,15 @@
                                                    "CUT", "cut", "UP", "selectPrevious",
                                                    "KP_UP", "selectPrevious",
                                                    "shift UP", "selectPreviousExtendSelection",
+                                                   "shift ctrl UP", "selectPreviousExtendSelection",
                                                    "shift KP_UP", "selectPreviousExtendSelection",
+                                                   "shift ctrl KP_UP", "selectPreviousExtendSelection",
                                                    "DOWN", "selectNext",
                                                    "KP_DOWN", "selectNext",
                                                    "shift DOWN", "selectNextExtendSelection",
+                                                   "shift ctrl DOWN", "selectNextExtendSelection",
                                                    "shift KP_DOWN", "selectNextExtendSelection",
+                                                   "shift ctrl KP_DOWN", "selectNextExtendSelection",
                                                    "RIGHT", "selectChild", "KP_RIGHT", "selectChild",
                                                    "LEFT", "selectParent", "KP_LEFT", "selectParent",
                                                    "PAGE_UP", "scrollUpChangeSelection",
@@ -369,7 +393,9 @@
                                                    "PAGE_DOWN", "scrollDownChangeSelection",
                                                    "shift PAGE_DOWN", "scrollDownExtendSelection",
                                                    "HOME", "selectFirst", "shift HOME", "selectFirstExtendSelection",
+                                                   "shift ctrl HOME", "selectFirstExtendSelection",
                                                    "END", "selectLast", "shift END", "selectLastExtendSelection",
+                                                   "shift ctrl END", "selectLastExtendSelection",
                                                    "F2", "startEditing", "ctrl A", "selectAll",
                                                    "ctrl SLASH", "selectAll",
                                                    "ctrl BACK_SLASH", "clearSelection",
@@ -389,32 +415,51 @@
                                                    "ctrl KP_LEFT", "scrollLeft",
                                                    "ctrl RIGHT", "scrollRight",
                                                    "ctrl KP_RIGHT", "scrollRight",
-                                                   "SPACE", "toggleSelectionPreserveAnchor" };
+                                                   "ADD", "expand", "SUBTRACT", "collapse",
+                                                   "SPACE", "toggleSelectionPreserveAnchor",
+                                                   "shift ctrl SPACE", "moveSelectionTo"};
         Object[] listFocusInputMap = new Object[] {"ctrl C", "copy", "ctrl V", "paste",
                                                    "ctrl X", "cut", "COPY", "copy",
                                                    "PASTE", "paste", "CUT", "cut",
                                                    "UP", "selectPreviousRow", "KP_UP", "selectPreviousRow",
                                                    "shift UP", "selectPreviousRowExtendSelection",
+                                                   "shift ctrl UP", "selectPreviousRowExtendSelection",
                                                    "shift KP_UP", "selectPreviousRowExtendSelection",
+                                                   "shift ctrl KP_UP", "selectPreviousRowExtendSelection",
                                                    "DOWN", "selectNextRow", "KP_DOWN", "selectNextRow",
+                                                   "ctrl DOWN", "selectNextRowChangeLead", "ctrl KP_DOWN", "selectNextRowChangeLead",
                                                    "shift DOWN", "selectNextRowExtendSelection",
+                                                   "shift ctrl DOWN", "selectNextRowExtendSelection",
                                                    "shift KP_DOWN", "selectNextRowExtendSelection",
+                                                   "shift ctrl KP_DOWN", "selectNextRowExtendSelection",
                                                    "LEFT", "selectPreviousColumn", "KP_LEFT", "selectPreviousColumn",
+                                                   "ctrl LEFT", "selectPreviousColumnChangeLead", "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
                                                    "shift LEFT", "selectPreviousColumnExtendSelection",
+                                                   "shift ctrl LEFT", "selectPreviousColumnExtendSelection",
                                                    "shift KP_LEFT", "selectPreviousColumnExtendSelection",
+                                                   "shift ctrl KP_LEFT", "selectPreviousColumnExtendSelection",
                                                    "RIGHT", "selectNextColumn", "KP_RIGHT", "selectNextColumn",
+                                                   "ctrl RIGHT", "selectNextColumnChangeLead", "ctrl KP_RIGHT", "selectNextColumnChangeLead",
                                                    "shift RIGHT", "selectNextColumnExtendSelection",
+                                                   "shift ctrl RIGHT", "selectNextColumnExtendSelection",
                                                    "shift KP_RIGHT", "selectNextColumnExtendSelection",
-                                                   "HOME", "selectFirstRow",
-                                                   "shift HOME", "selectFirstRowExtendSelection",
-                                                   "END", "selectLastRow",
-                                                   "shift END", "selectLastRowExtendSelection",
-                                                   "PAGE_UP", "scrollUp", "shift PAGE_UP", "scrollUpExtendSelection",
-                                                   "PAGE_DOWN", "scrollDown",
+                                                   "shift ctrl KP_RIGHT", "selectNextColumnExtendSelection",
+                                                   "HOME", "selectFirstRow", "ctrl HOME", "selectFirstRowChangeLead",
+                                                   "shift HOME", "selectFirstRowExtendSelection", "shift ctrl HOME", "selectFirstRowExtendSelection",
+                                                   "END", "selectLastRow", "ctrl END", "selectLastRowChangeLead",
+                                                   "shift END", "selectLastRowExtendSelection", "shift ctrl END", "selectLastRowExtendSelection",
+                                                   "PAGE_UP", "scrollUp", "ctrl PAGE_UP", "scrollUpChangeLead",
+                                                   "shift PAGE_UP", "scrollUpExtendSelection", "shift ctrl PAGE_UP", "scrollUpExtendSelection",
+                                                   "PAGE_DOWN", "scrollDown", "ctrl PAGE_DOWN", "scrollDownChangeLead",
                                                    "shift PAGE_DOWN", "scrollDownExtendSelection",
+                                                   "shift ctrl PAGE_DOWN", "scrollDownExtendSelection",
                                                    "ctrl A", "selectAll",
-                                                   "ctrl SLASH", "selectAll", "ctrl BACK_SLASH", "clearSelection" };
-        Object[] scrollBarFocusInputMap = new Object[] {"RIGHT", "positiveUnitIncrement",
+                                                   "ctrl SLASH", "selectAll", "ctrl BACK_SLASH", "clearSelection",
+                                                   "ctrl UP", "selectPreviousRowChangeLead",
+                                                   "ctrl KP_UP", "selectPreviousRowChangeLead",
+                                                   "SPACE", "addToSelection", "ctrl SPACE", "toggleAndAnchor",
+                                                   "shift ctrl SPACE", "moveSelectionTo", "shift SPACE", "extendTo"};
+        Object[] scrollBarAncestorInputMap = new Object[] {"RIGHT", "positiveUnitIncrement",
                                                         "KP_RIGHT", "positiveUnitIncrement",
                                                         "DOWN", "positiveUnitIncrement",
                                                         "KP_DOWN", "positiveUnitIncrement",
@@ -497,6 +542,7 @@
                                                         "shift HOME", DefaultEditorKit.selectionBeginLineAction,
                                                         "shift END", DefaultEditorKit.selectionEndLineAction,
                                                         "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
+                                                        "ctrl H", DefaultEditorKit.deletePrevCharAction,
                                                         "DELETE", DefaultEditorKit.deleteNextCharAction,
                                                         "RIGHT", DefaultEditorKit.forwardAction,
                                                         "LEFT", DefaultEditorKit.backwardAction,
@@ -626,7 +672,7 @@
                  "RootPane.questionDialogBorder", new MetalLazyValue("javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder"),
                  "RootPane.warningDialogBorder", new MetalLazyValue("javax.swing.plaf.metal.MetalBorders$WarningDialogBorder"),
                  "ScrollBar.allowsAbsolutePositioning", Boolean.TRUE,
-                 "ScrollBar.focusInputMap", new UIDefaults.LazyInputMap(scrollBarFocusInputMap),
+                 "ScrollBar.ancestorInputMap", new UIDefaults.LazyInputMap(scrollBarAncestorInputMap),
                  "ScrollBar.width", new Integer(17),
                  "ScrollPane.ancestorInputMap", new UIDefaults.LazyInputMap(scrollPaneAncestorInputMap),
                  "ScrollPane.border", new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalBorders$ScrollPaneBorder"),
@@ -1238,7 +1284,7 @@
                 Class classObj = Class.forName(className);
                 result = (methodName == null)
                         ? classObj.newInstance()
-                        : classObj.getMethod(methodName, (Class[])null).invoke(null, null);
+                        : classObj.getMethod(methodName, null).invoke(null, null);
             } catch (final Exception e) {
                 e.printStackTrace();
             }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalRootPaneTitlePane.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalRootPaneTitlePane.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalRootPaneTitlePane.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/metal/MetalRootPaneTitlePane.java Wed Sep  6 09:06:15 2006
@@ -21,7 +21,9 @@
 
 package javax.swing.plaf.metal;
 
+import java.awt.Frame;
 import java.awt.Insets;
+import java.awt.Toolkit;
 import java.awt.Window;
 
 import java.awt.event.ActionEvent;
@@ -324,9 +326,10 @@
 
     private void loadWindowProperties() {
         if (rootPane.getWindowDecorationStyle() == JRootPane.FRAME) {
-            isIconifiable = true;
+            Toolkit toolkit = Toolkit.getDefaultToolkit();
+            isIconifiable = toolkit.isFrameStateSupported(Frame.ICONIFIED);
             isClosable = true;
-            isMaximizable = true;
+            isMaximizable = toolkit.isFrameStateSupported(Frame.MAXIMIZED_BOTH);
             internals.hasMenuBar = true;
         } else {
             isIconifiable = false;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/table/DefaultTableColumnModel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/table/DefaultTableColumnModel.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/table/DefaultTableColumnModel.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/table/DefaultTableColumnModel.java Wed Sep  6 09:06:15 2006
@@ -49,6 +49,7 @@
     public DefaultTableColumnModel() {
         selectionModel = createSelectionModel();
         selectionModel.addListSelectionListener(this);
+        alignSelectionModelToColumns();
     }
 
     public void addColumn(final TableColumn column) {
@@ -58,6 +59,7 @@
         tableColumns.add(column);
         totalColumnWidth = -1;
         column.addPropertyChangeListener(this);
+        alignSelectionModelToColumns();
         fireColumnAdded(new TableColumnModelEvent(this, tableColumns.size() - 2 >= 0 ? tableColumns.size() - 2 : tableColumns.size() - 1, tableColumns.size() - 1));
     }
 
@@ -67,6 +69,7 @@
             totalColumnWidth = -1;
             column.removePropertyChangeListener(this);
         }
+        alignSelectionModelToColumns();
         fireColumnRemoved(new TableColumnModelEvent(this, index, index));
     }
 
@@ -162,6 +165,7 @@
 
         selectionModel = model;
         selectionModel.addListSelectionListener(this);
+        alignSelectionModelToColumns();
     }
 
     public ListSelectionModel getSelectionModel() {
@@ -289,5 +293,18 @@
         }
 
         return changeEvent;
+    }
+
+    private void alignSelectionModelToColumns() {
+        if (getColumnCount() == 0) {
+            if (selectionModel.getAnchorSelectionIndex() >= 0) {
+                selectionModel.setValueIsAdjusting(true);
+                selectionModel.setAnchorSelectionIndex(-1);
+                selectionModel.setLeadSelectionIndex(-1);
+                selectionModel.setValueIsAdjusting(false);
+            }
+        } else if (selectionModel.getLeadSelectionIndex() < 0) {
+            selectionModel.removeSelectionInterval(0, 0);
+        }
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/ChangedCharSetException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/ChangedCharSetException.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/ChangedCharSetException.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/ChangedCharSetException.java Wed Sep  6 09:06:15 2006
@@ -22,21 +22,20 @@
 import java.io.IOException;
 
 public class ChangedCharSetException extends IOException {
+    private final String charSet;
+    private final boolean charSetKey;
 
-
-    public ChangedCharSetException(final String a0, final boolean a1) {
-        throw new UnsupportedOperationException("Not implemented");
+    public ChangedCharSetException(final String charSet, final boolean charSetKey) {
+        this.charSet = charSet;
+        this.charSetKey = charSetKey;
     }
 
-
     public boolean keyEqualsCharSet() {
-        throw new UnsupportedOperationException("Not implemented");
+        return charSetKey;
     }
 
-
     public String getCharSetSpec() {
-        throw new UnsupportedOperationException("Not implemented");
+        return charSet;
     }
-
 }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/ComponentView.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/ComponentView.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/ComponentView.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/ComponentView.java Wed Sep  6 09:06:15 2006
@@ -20,9 +20,13 @@
 package javax.swing.text;
 
 import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
 import java.awt.Graphics;
+import java.awt.LayoutManager;
 import java.awt.Rectangle;
 import java.awt.Shape;
+import java.util.HashMap;
 
 import javax.swing.text.Position.Bias;
 
@@ -30,9 +34,49 @@
 
 public class ComponentView extends View {
 
+    private static final class ComponentViewLayout implements LayoutManager {
+        private static final HashMap componentViews = new HashMap();
+        
+        public void layoutContainer(final Container c) {
+            for (int i = 0; i < c.getComponentCount(); i++) {
+                Component child = c.getComponent(i);
+                View componentView = (View)componentViews.get(child);
+                if (componentView == null) {
+                    break;
+                }
+                Shape bounds1 = null;
+                Shape bounds2 = null;
+                try {
+                    final JTextComponent textComponent = (JTextComponent)c;
+                    bounds1 = textComponent.modelToView(componentView.getStartOffset());
+                    bounds2 = textComponent.modelToView(componentView.getEndOffset());
+                } catch (BadLocationException e) {
+                }
+                if (bounds1 == null || bounds2 == null) {
+                    return;
+                }
+                Rectangle bounds = ((Rectangle)bounds1).union((Rectangle)bounds2);
+                child.setBounds(bounds.x, bounds.y, bounds.width,
+                                bounds.height);
+            }
+        }
+        
+        public Dimension minimumLayoutSize(Container c) {
+            return null;
+        }
+
+        public Dimension preferredLayoutSize(Container c) {
+            return null;
+        }
+
+        public void addLayoutComponent(String name, Component c) {
+        }
+
+        public void removeLayoutComponent(Component c) {
+        }
+    }
+
     private static final int EMPTY_SPAN = 0;
-    private boolean notInitialized = true;
-    private boolean compInHierarchy = false;
     private Component component;
 
     public ComponentView(final Element element) {
@@ -108,43 +152,30 @@
     }
 
     public void setParent(final View parent) {
-        if (getParent() != null) {
-            if (parent == null) {
-                if (component.getParent() != null) {
-                    component.getParent().remove(component);
-                    compInHierarchy = false;
-                }
-                super.setParent(parent);
-            } else {
-                if (component.getParent() == null) {
-                    getContainer().add(component);
-                    compInHierarchy = true;
-                }
+        if (parent == null) {
+            if (component != null && component.getParent() != null) {
+                component.getParent().remove(component);
             }
-        } else {
             super.setParent(parent);
-
-            if (parent != null) {
-                if (notInitialized) {
+        } else {
+            if (getParent() == null) {
+                super.setParent(parent);
+                if (component == null) {
                     component = createComponent();
-                    notInitialized = false;
+                    ComponentViewLayout.componentViews.put(component, this);
+                }
+            } 
+            final Container container = getContainer();
+            if (container != null) {
+                container.add(component);
+                if (container.getLayout() == null) {
+                    container.setLayout(new ComponentViewLayout());
                 }
-                getContainer().add(component);
-                compInHierarchy = true;
             }
         }
     }
 
-    public void paint(final Graphics g, final Shape shape)  {
-       if (component != null && compInHierarchy) {
-           final Rectangle bounds = shape.getBounds();
-           final int height = Math.min(bounds.height,
-                                       component.getPreferredSize().height);
-           component.setBounds(bounds.x + 1,
-                               (bounds.height - height) + bounds.y,
-                               bounds.width - 1,
-                               height);
-       }
+    public void paint(final Graphics g, final Shape shape) {
     }
 
     protected Component createComponent() {
@@ -156,4 +187,6 @@
             throw new IllegalArgumentException("Invalid axis: " + axis);
         }
     }
+    
+    
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/DefaultCaret.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/DefaultCaret.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/DefaultCaret.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/DefaultCaret.java Wed Sep  6 09:06:15 2006
@@ -380,8 +380,7 @@
      */
     public DefaultCaret() {
         blinkTimer = createTimer(false, 0);
-        magicTimer = createTimer(true, 0);
-        startTimer(magicTimer);
+        magicTimer = createTimer(true, 0);       
     }
 
     public void addChangeListener(final ChangeListener changeListener) {
@@ -511,6 +510,7 @@
         component.removeMouseMotionListener(this);
         component.removeFocusListener(this);
         stopTimer(blinkTimer);
+        stopTimer(magicTimer);
         highlighter = null;
         component = null;
         textKit = null;
@@ -792,7 +792,7 @@
     public void mousePressed(final MouseEvent me) {
         int offset;
         int mask = MouseEvent.SHIFT_DOWN_MASK;
-        if (me.getButton() != MouseEvent.BUTTON1) {
+        if (me.getButton() != MouseEvent.BUTTON1 || !component.isEnabled()) {
             return;
         }
         component.requestFocusInWindow();
@@ -934,7 +934,6 @@
 
         blinkTimer = (Timer)createTimer(false, 0);
         magicTimer = (Timer)createTimer(true, 0);
-        startTimer(magicTimer);
 
         triangleX = new int[APEX_NUMBER];
         triangleY = new int[APEX_NUMBER];

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/GapContent.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/GapContent.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/GapContent.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/GapContent.java Wed Sep  6 09:06:15 2006
@@ -355,7 +355,7 @@
                              final int addSize)
         throws BadLocationException {
 
-        if (where < 0 || where >= length()) {
+        if (where < 0 || where > length()) {
             throw new BadLocationException("Invalid insert position", where);
         }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/StyleConstants.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/StyleConstants.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/StyleConstants.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/StyleConstants.java Wed Sep  6 09:06:15 2006
@@ -251,6 +251,7 @@
     }
 
     public static void setFontSize(final MutableAttributeSet a, final int s) {
+        // TODO in version 1.5.0 use Integer.valueOf instead of constructor
         a.addAttribute(FontSize, new Integer(s));
     }
 
@@ -265,6 +266,7 @@
 
     public static void setSpaceBelow(final MutableAttributeSet a,
                                      final float i) {
+        // TODO in version 1.5.0 use Float.valueOf instead of constructor
         a.addAttribute(SpaceBelow, new Float(i));
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/StyleContext.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/StyleContext.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/StyleContext.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/StyleContext.java Wed Sep  6 09:06:15 2006
@@ -466,7 +466,6 @@
 
     public StyleContext() {
         initTransientFields();
-        styles = new NamedStyle();
         addStyle(DEFAULT_STYLE, null);
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/TabSet.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/TabSet.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/TabSet.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/TabSet.java Wed Sep  6 09:06:15 2006
@@ -97,13 +97,6 @@
         return hash.hashCode();
     }
 
-    /*
-     * The format of the string is based on 1.5 release behavior
-     * which can be revealed using the following code:
-     *
-     *  Object obj = new TabSet(new TabStop[] { new TabStop(1.0f), new TabStop(2.0f)});
-     *  System.out.println(obj.toString());
-     */
     public String toString() {
         StringBuffer result = new StringBuffer("[ ");
         for (int i = 0; i < tabs.length; i++) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/TabStop.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/TabStop.java?view=diff&rev=440748&r1=440747&r2=440748
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/TabStop.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/text/TabStop.java Wed Sep  6 09:06:15 2006
@@ -85,13 +85,6 @@
         return hash.hashCode();
     }
 
-    /*
-     * The format of the string is based on 1.5 release behavior
-     * which can be revealed using the following code:
-     *
-     *  Object obj = new TabStop(1.0f, TabStop.ALIGN_RIGHT, TabStop.LEAD_DOTS);
-     *  System.out.println(obj.toString());
-     */
     public String toString() {
         final StringBuffer result = new StringBuffer();
         switch (alignment) {



Mime
View raw message