Issue Details (XML | Word | Printable)

Key: UBA-7413
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Janak Mulani
Reporter: David Frank
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
ULCBase

UIScrollPane.BasicScrollPane.setCorner() breaks with recent JRE6

Created: 10/Mar/08 03:31 PM   Updated: 08/Dec/08 12:13 PM
Component/s: components
Affects Version/s: None
Fix Version/s: ULC 6.2.3, UltraLightClient '08


 Description  « Hide
Starting with build 12 of Java SE 6 Update N (https://jdk6.dev.java.net/6uNea.html) an IllegalArgumentException occurs when showing e.g. an ULCTable with Scrollbars.
UIScrollPane should support the keys UPPER_LEADING_CORNER, UPPER_TRAILING_CORNER, LOWER_LEADING_CORNER, LOWER_TRAILING_CORNER as defined in javax.swing.ScrollPaneConstants.
The new keys can simply be mapped to the old ones as shown in http://www.jdocs.com/page/AjaxSourceCode?oid=29115#329

com.ulcjava.base.shared.internal.IllegalArgumentException: invalid corner key
at com.ulcjava.base.client.UIScrollPane$BasicScrollPane.setCorner(UIScrollPane.java:14)
at javax.swing.JTable.configureEnclosingScrollPane(Unknown Source)
at javax.swing.JTable.addNotify(Unknown Source)
at java.awt.Container.addNotify(Unknown Source)
at javax.swing.JComponent.addNotify(Unknown Source)
at java.awt.Container.addNotify(Unknown Source)
at javax.swing.JComponent.addNotify(Unknown Source)
at java.awt.Container.addNotify(Unknown Source)
at javax.swing.JComponent.addNotify(Unknown Source)
at java.awt.Container.addNotify(Unknown Source)
at javax.swing.JComponent.addNotify(Unknown Source)
at java.awt.Container.addNotify(Unknown Source)
at javax.swing.JComponent.addNotify(Unknown Source)
at java.awt.Container.addNotify(Unknown Source)
at javax.swing.JComponent.addNotify(Unknown Source)
at java.awt.Container.addNotify(Unknown Source)
at javax.swing.JComponent.addNotify(Unknown Source)
at javax.swing.JRootPane.addNotify(Unknown Source)
at java.awt.Container.addNotify(Unknown Source)
at java.awt.Window.addNotify(Unknown Source)
at java.awt.Frame.addNotify(Unknown Source)
at java.awt.Window.show(Unknown Source)
at java.awt.Component.show(Unknown Source)
at java.awt.Component.setVisible(Unknown Source)
at java.awt.Window.setVisible(Unknown Source)
at com.ulcjava.base.client.UIWindow.show(UIWindow.java:16)
at com.ulcjava.base.client.UIWindow.setVisible(UIWindow.java:72)
at com.ulcjava.base.client.UIWindow.postInitializeState(UIWindow.java:54)
at com.ulcjava.base.client.UIFrame.postInitializeState(UIFrame.java:2)
at com.ulcjava.base.client.UIProxy.init(UIProxy.java:76)
at com.ulcjava.base.client.UISession.newInstance(UISession.java:34)
at com.ulcjava.base.client.UISession.handleRequest(UISession.java:84)
at com.ulcjava.base.client.UISession.b(UISession.java:278)
at com.ulcjava.base.client.UISession.access$2000(UISession.java:317)
at com.ulcjava.base.client.UISession$6.run(UISession$6.java:2)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at com.ulcjava.base.client.FilteringEventQueue.dispatchEvent(FilteringEventQueue.java:19)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Andreas Henle added a comment - 23/Oct/08 03:39 PM
As a workaround it is possible to overwrite the setCorner(String key, Component corner) method in UIScrollPane.BasicScrollPane and set the correct keys like it is done since Java 1.5.

The following code demonstrates this workaround:

import com.ulcjava.base.application.AbstractApplication;
import com.ulcjava.base.application.ULCComponent;
import com.ulcjava.base.application.ULCFrame;
import com.ulcjava.base.application.ULCScrollPane;
import com.ulcjava.base.application.ULCTable;
import com.ulcjava.base.application.table.AbstractTableModel;
import com.ulcjava.base.client.UIScrollPane;
import com.ulcjava.base.development.DevelopmentRunner;

import java.awt.Component;

/**
 * Demo code for a patched version of ULCScrollPane that works witch Java 6 Update 10O
 */
public class ULCScrollPaneWithJava6u10Fix extends AbstractApplication {
    
    public void start() {
        ULCTable table = new ULCTable(new TestTableModel());
        
        ULCFrame frame = new ULCFrame();
        frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);
        // use the patched scroll pane
        frame.add(new ULCFixedScrollPane(table));
        frame.setVisible(true);
    }
    
    // server side implementation
    private class ULCFixedScrollPane extends ULCScrollPane {
        public ULCFixedScrollPane() {
            super();
        }
        
        public ULCFixedScrollPane(int vsbPolicy, int hsbPolicy) {
            super(vsbPolicy, hsbPolicy);
        }
        
        public ULCFixedScrollPane(ULCComponent viewPortView, int verticalScrollBarPolicy, int horizontalScrollBarPolicy) {
            super(viewPortView, verticalScrollBarPolicy, horizontalScrollBarPolicy);
        }
        
        public ULCFixedScrollPane(ULCComponent viewPortView) {
            super(viewPortView);
        }
        
        protected String typeString() {
            // use the full qualified name in a deployed scenario
            return UIFixedScrollPane.class.getName();
        }
    }
    
    // client side implementation
    public static class UIFixedScrollPane extends UIScrollPane {
        protected Object createBasicObject(Object[] arguments) {
            return new BasicFixedScrollPane();
        }
        
        public class BasicFixedScrollPane extends UIScrollPane.BasicScrollPane {
            
            public void setCorner(String key, Component corner) {
                boolean isLeftToRight = getComponentOrientation().isLeftToRight();
                if (key.equals(LOWER_LEADING_CORNER)) {
                    key = isLeftToRight ? LOWER_LEFT_CORNER : LOWER_RIGHT_CORNER;
                } else if (key.equals(LOWER_TRAILING_CORNER)) {
                    key = isLeftToRight ? LOWER_RIGHT_CORNER : LOWER_LEFT_CORNER;
                } else if (key.equals(UPPER_LEADING_CORNER)) {
                    key = isLeftToRight ? UPPER_LEFT_CORNER : UPPER_RIGHT_CORNER;
                } else if (key.equals(UPPER_TRAILING_CORNER)) {
                    key = isLeftToRight ? UPPER_RIGHT_CORNER : UPPER_LEFT_CORNER;
                }
                
                super.setCorner(key, corner);
            }
        }
    }
    
    private class TestTableModel extends AbstractTableModel {
        
        public int getColumnCount() {
            return 10;
        }
        
        public int getRowCount() {
            return 100;
        }
        
        public Object getValueAt(int row, int column) {
            return row + " - " + column;
        }
    }
    
    public static void main(String[] args) {
        DevelopmentRunner.setApplicationClass(ULCScrollPaneWithJava6u10Fix.class);
        DevelopmentRunner.run();
    }
}