Hi Albert, Please see:
http://lists.canoo.com/mailman/private/ulc-developer/2006/003685.html http://lists.canoo.com/mailman/private/ulc-developer/2004/001513.html Thanks and regards, Janak >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] Behalf Of Albert Smulders >Sent: Tuesday, August 29, 2006 6:56 PM >To: [email protected] >Subject: [ULC-developer] Another point: DefaultRenderer on Tree / >TableTree > > >Another point: > >When you disable a tree (at least using Plastic L&F), the items >are grayed in the same... after installing a custom renderer, this >doesn't work anymore... And if you try to set foreground color >"gray" in the custom renderer, nothing happens until some >roundtrip (= reload of tree data)... Also the example ("cyan >leafs") in the api guide I could not get to work satisfactorily... > >Kind regards, > >Alberto A.Smulders >HostDat Lda. - Portugal > > > >-------- Original-Nachricht -------- >Datum: Tue, 29 Aug 2006 14:45:20 +0200 >Von: [EMAIL PROTECTED] >An: [email protected] >Betreff: [ULC-developer] DefaultRenderer on Tree / TableTree > >> >> We discovered some Issues / Swing differences on the ULCTree and >> ULCTableTree: >> >> - Using a custom renderer extended from >> DefaultTreeCellRenderer/DefaultTableTreeCellRenderer on ULCTree >/ ULCTableTree results in the lost of the >> default icons provided by the current look&feel. Using Swing's JTree the >> default icons are drawn. (See classes SimpleULCTree and >SimpleJTree at the >> bottom of the mail) >> >> - On a ULCTree with a custom cell renderer (or on the tree column of >> ULCTableTree) the focus is drawn differently than the Swing >counterpart. In ULC >> the icon is inside the focus border. >> >> - On a ULCTableTree with a custom cell renderer: The lines of >the tree are >> not drawn on the selected row(s). (See class ULCTableTreeTest) >> >> - Setting a default tree icon of the look and feel to null (e.q. >> UIManager.put("Tree.leafIcon", null) ) results in a >NullPointerException in the >> TableTree-Widget. >> >> Is there a workaround especially for the focus and line drawing issue ? >> >> Best Regards, >> Markus Wyss >> UBS AG >> >> Tel. +41-44-236 31 02 >> Fax.+41-44-236 30 22 >> >> public class SimpleULCTree extends AbstractApplication { >> >> public void start() { >> ULCFrame frame = new ULCFrame("ULCTree with >> DefaultTreeCellRenderer"); >> >> ULCBorderLayoutPane colorBox = new ULCBorderLayoutPane(); >> colorBox.add(new ULCScrollPane(createTree())); >> >> frame.getContentPane().add(colorBox); >> frame.pack(); >> frame.setSize(400, 400); >> frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE); >> frame.setVisible(true); >> } >> >> private ULCTree createTree() { >> final ULCTree tree = new ULCTree(new MyTreeModel()); >> tree.setCellRenderer(new MyTreeRenderer()); >> return tree; >> } >> >> class MyTreeRenderer extends DefaultTreeCellRenderer { >> >> public MyTreeRenderer() { >> super(); >> ULCIcon icon = new >> ULCIcon(this.getClass().getResource("ampel_rot.gif")); >> setClosedIcon(icon); >> setOpenIcon(icon); >> setLeafIcon(icon); >> } >> >> } >> >> public static void main(String[] args) { >> DevelopmentRunner.setApplicationClass(SimpleULCTree.class); >> DevelopmentRunner.run(); >> } >> >> public class MyTreeModel extends DefaultTreeModel { >> >> public MyTreeModel() { >> super( new DefaultMutableTreeNode("Customers")); >> >> DefaultMutableTreeNode customers = (DefaultMutableTreeNode) >> getRoot(); >> >> DefaultMutableTreeNode bundle1234 = new >> DefaultMutableTreeNode("Bundle 1234"); >> customers.add(bundle1234); >> >> DefaultMutableTreeNode brig = new >> DefaultMutableTreeNode("Brig"); >> bundle1234.add(brig); >> brig.add(new DefaultMutableTreeNode("Account 11111111", >> true)); >> brig.add(new DefaultMutableTreeNode("Account 22222222", >> true)); >> >> DefaultMutableTreeNode ascona = new >> DefaultMutableTreeNode("Ascona"); >> bundle1234.add(ascona); >> ascona.add(new DefaultMutableTreeNode("Account 3333333", >> true)); >> >> >> DefaultMutableTreeNode bundle5678 = new >> DefaultMutableTreeNode("Bundle 5678"); >> customers.add(bundle5678); >> >> DefaultMutableTreeNode zuerich = new >> DefaultMutableTreeNode("Zürich"); >> bundle5678.add(zuerich); >> zuerich.add(new DefaultMutableTreeNode("Account 4444444", >> true)); >> } >> } >> } >> >> public class SimpleJTree extends JFrame { >> >> public SimpleJTree() { >> super("JTree with DefaultTreeCellRenderer"); >> >> JPanel colorBox = new JPanel(new BorderLayout()); >> colorBox.add(new JScrollPane(createTree())); >> >> getContentPane().add(colorBox); >> pack(); >> setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); >> setSize(400, 400); >> } >> >> private JTree createTree() { >> final JTree tree = new JTree(new MyTreeModel()); >> tree.setCellRenderer(new MyTreeRenderer()); >> return tree; >> } >> >> >> class MyTreeRenderer extends DefaultTreeCellRenderer { >> >> public MyTreeRenderer() { >> super(); >> Icon icon = new >> ImageIcon(this.getClass().getResource("ampel_rot.gif")); >> setOpenIcon(icon); >> setClosedIcon(icon); >> setLeafIcon(icon); >> } >> >> } >> >> public static void main(String[] args) { >> SimpleJTree simpleTree = new SimpleJTree(); >> simpleTree.setVisible(true); >> } >> >> public class MyTreeModel extends DefaultTreeModel { >> >> public MyTreeModel() { >> super( new DefaultMutableTreeNode("Customers")); >> >> DefaultMutableTreeNode customers = (DefaultMutableTreeNode) >> getRoot(); >> >> DefaultMutableTreeNode bundle1234 = new >> DefaultMutableTreeNode("Bundle 1234"); >> customers.add(bundle1234); >> >> DefaultMutableTreeNode brig = new >> DefaultMutableTreeNode("Brig"); >> bundle1234.add(brig); >> brig.add(new DefaultMutableTreeNode("Account 11111111", >> true)); >> brig.add(new DefaultMutableTreeNode("Account 22222222", >> true)); >> >> DefaultMutableTreeNode ascona = new >> DefaultMutableTreeNode("Ascona"); >> bundle1234.add(ascona); >> ascona.add(new DefaultMutableTreeNode("Account 3333333", >> true)); >> >> >> DefaultMutableTreeNode bundle5678 = new >> DefaultMutableTreeNode("Bundle 5678"); >> customers.add(bundle5678); >> >> DefaultMutableTreeNode zuerich = new >> DefaultMutableTreeNode("Zürich"); >> bundle5678.add(zuerich); >> zuerich.add(new DefaultMutableTreeNode("Account 4444444", >> true)); >> } >> } >> } >> >> public class ULCTableTreeTest extends AbstractApplication { >> public void start() { >> ULCFrame frame = new ULCFrame(); >> frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE); >> >> DefaultMutableTableTreeNode root = new >> DefaultMutableTableTreeNode( >> new Object[] { "root", "root", "root" }, false); >> DefaultMutableTableTreeNode primaryOffering = new >> DefaultMutableTableTreeNode( >> new Object[] { "Offer", "Total", >> "Total % " }, true); >> DefaultMutableTableTreeNode ubsStrategy = new >> DefaultMutableTableTreeNode( >> new Object[] { "AAAA", "13605", "16.84" }, false); >> DefaultMutableTableTreeNode inUbsStrategy = new >> DefaultMutableTableTreeNode( >> new Object[] { "BBBBB", "xx", "yy" }, true); >> DefaultMutableTableTreeNode ubsXtra = new >> DefaultMutableTableTreeNode( >> new Object[] { "CCCC", "11", "0.01" }, false); >> DefaultMutableTableTreeNode inUbsXtra = new >> DefaultMutableTableTreeNode( >> new Object[] { "DDDD", "zz", "vv" }, true); >> >> ubsStrategy.add(inUbsStrategy); >> ubsXtra.add(inUbsXtra); >> >> root.add(primaryOffering); >> root.add(ubsStrategy); >> root.add(ubsXtra); >> >> DefaultTableTreeModel model = new DefaultTableTreeModel(root, >> new String[] { "col1", "col2", "col3" }); >> >> model.setRoot(root); >> ULCTableTree tree = new ULCTableTree(model); >> tree.setRootVisible(false); >> tree.setShowsRootHandles(true); >> >> tree.setTableTreeHeader(null); >> ULCTableTreeColumnModel cm = tree.getColumnModel(); >> >> cm.getColumn(0).setCellRenderer(new >> MyCellRenderer(IDefaults.LEFT)); >> cm.getColumn(1).setCellRenderer(new >> MyCellRenderer(IDefaults.RIGHT)); >> cm.getColumn(2).setCellRenderer(new >> MyCellRenderer(IDefaults.RIGHT)); >> >> frame.add(new ULCScrollPane(tree)); >> frame.pack(); >> frame.setLocation(300, 400); >> frame.setSize(700, 300); >> frame.setVisible(true); >> } >> >> class MyCellRenderer extends DefaultTableTreeCellRenderer { >> public MyCellRenderer(int alignment) { >> super(); >> setHorizontalAlignment(alignment); >> } >> } >> >> public static void main(String[] args) { >> DevelopmentRunner.setApplicationClass(ULCTableTreeTest.class); >> DevelopmentRunner.run(); >> } >> } >> _______________________________________________ >> ULC-developer mailing list >> [email protected] >> http://lists.canoo.com/mailman/listinfo/ulc-developer > >-- > > >Echte DSL-Flatrate dauerhaft für 0,- Euro*. Nur noch kurze Zeit! >"Feel free" mit GMX DSL: http://www.gmx.net/de/go/dsl >_______________________________________________ >ULC-developer mailing list >[email protected] >http://lists.canoo.com/mailman/listinfo/ulc-developer _______________________________________________ ULC-developer mailing list [email protected] http://lists.canoo.com/mailman/listinfo/ulc-developer
