CheckBoxTree support

Request new features and improvements you want to see in WebLaF.
I will answer any request so don't hesitate and post it!

CheckBoxTree support

Postby Abu Abdullah » Sat Aug 11, 2012 5:49 pm

Hi,

JIDE Common Layer are really used everywhere, It will be really a plus if Web L&F support it. one component I'm really using it CheckBoxTree.

with Web L&F:
1.png
1.png (10.96 KiB) Viewed 19385 times


without Web L&F:
2.png
2.png (10.88 KiB) Viewed 19385 times



Test Code
Code: Select all
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
import java.io.*;
import javax.swing.plaf.*;
import com.alee.laf.*;
import javax.swing.tree.*;
import com.jidesoft.swing.*;

class Test1 extends JFrame
{
   public Test1()
   {
      DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root");
      DefaultMutableTreeNode child1 = new DefaultMutableTreeNode("Child 1");
      root.add(child1);
      DefaultMutableTreeNode child2 = new DefaultMutableTreeNode("Child 2");
      root.add(child2);
      
      final CheckBoxTree tree = new CheckBoxTree(root);

      setDefaultCloseOperation(EXIT_ON_CLOSE);
      setSize(200, 200);
      getContentPane().add(tree);
      
      setVisible(true);
   }
   
   public static void main(String args[])
   {
      WebLookAndFeel.install();
      SwingUtilities.invokeLater(new Runnable(){public void run(){new Test1();}});
   }
}


The problem seems that the tree nodes are not transparent (to show the checkbox)
I tried many things e.g. setOpaque(false), overriding CellRenderer ... without success

appreciate if you can have a look at it

jide jar file can be downloaded from:
http://repo1.maven.org/maven2/com/jides ... -3.4.4.jar
Abu Abdullah
 
Posts: 41
Joined: Tue Apr 17, 2012 12:11 pm

Re: CheckBoxTree support

Postby Abu Abdullah » Sat Aug 11, 2012 5:52 pm

sorry, i should put this in the suggestion forum
Abu Abdullah
 
Posts: 41
Joined: Tue Apr 17, 2012 12:11 pm

Re: CheckBoxTree support

Postby mgarin » Sun Aug 12, 2012 4:11 pm

No problem :)
I will look into that issue and say what you can do about it
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg

Re: CheckBoxTree support

Postby Abu Abdullah » Mon Aug 13, 2012 10:17 am

By the way, the src is on:
https://github.com/jidesoft/jide-oss
Abu Abdullah
 
Posts: 41
Joined: Tue Apr 17, 2012 12:11 pm

Re: CheckBoxTree support

Postby mgarin » Mon Aug 13, 2012 1:25 pm

Thanks, that will help a lot :)

After v.1.4 i will look closer into working with all Jide components properly. Some of them still might be not stylable at all, thats why i am adding my own implementations fully written or taken from various open-source projects.

P.S. I have moved the topic into suggestions forum.
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg

Re: CheckBoxTree support

Postby mgarin » Tue Apr 09, 2013 2:12 pm

I have added a few fixes for checkboxes and tree.
They will be available in the nearest update (in a day or two).

Jide checkbox tree is working properly now:
Image

Still, to make it look like on the screenshot above you will have to add two small lines of code...

1. Force the tree to use Web-styled renderer inside the jide checkbox tree cell renderer:
(this is required to force renderer to use proper borders and Web-styling)
Code: Select all
checkBoxTree.setCellRenderer ( new WebTreeCellRenderer () );


2. Make the real checkbox tree cell renderer (that has the check inside itself) non-opaque:
(this is required to let selection to be visible behind the actual cell renderer)
Code: Select all
( ( JComponent ) checkBoxTree.getCellRenderer () ).setOpaque ( false );
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg

Re: CheckBoxTree support

Postby mgarin » Tue Apr 09, 2013 2:13 pm

I might also be adding a new WebCheckBoxTree component in next library updates.
Probably it will be a bit improved jide checkbox tree.
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg

Re: CheckBoxTree support

Postby mgarin » Tue Apr 09, 2013 2:25 pm

I have also added similar fixes for Jide checkbox list.
But it is still recommended to use WebCheckBoxList :)
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg

Re: [ADDED] CheckBoxTree support

Postby Abu Abdullah » Sun Jun 23, 2013 1:48 pm

i missed to check this thread, i have tried the above but i'm still not able to get the correct behavior. checkbox are still not visible, the width is not calculated correctly.

Untitled.png
Untitled.png (10.23 KiB) Viewed 18749 times


this is the code, i might not implement the changes correctly:

Code: Select all
import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
import java.io.*;
import javax.swing.plaf.*;
import com.alee.laf.*;
import javax.swing.tree.*;
import com.jidesoft.swing.*;

class Test1 extends JFrame
{
   public Test1()
   {
      DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root");
      DefaultMutableTreeNode child1 = new DefaultMutableTreeNode("Child 1");
      root.add(child1);
      DefaultMutableTreeNode child2 = new DefaultMutableTreeNode("Child 2");
      root.add(child2);
     
      final CheckBoxTree tree = new CheckBoxTree(root);
     tree.setCellRenderer ( new com.alee.laf.tree.WebTreeCellRenderer () );
     ( ( JComponent ) tree.getCellRenderer () ).setOpaque ( false );

      setDefaultCloseOperation(EXIT_ON_CLOSE);
      setSize(200, 200);
      getContentPane().add(tree);
     
      setVisible(true);
   }
   
   public static void main(String args[])
   {
      WebLookAndFeel.install();
      SwingUtilities.invokeLater(new Runnable(){public void run(){new Test1();}});
   }
}


in addition, I'm not able to find some useful functions for WebTreeCellRenderer e.g. setLeafIcon setOpenIcon setClosedIcon. why not extending the DefaultTreeCellRenderer
Abu Abdullah
 
Posts: 41
Joined: Tue Apr 17, 2012 12:11 pm

Re: [ADDED] CheckBoxTree support

Postby mgarin » Mon Jun 24, 2013 4:13 pm

Strange but your example works fine for me...
Maybe you are using some old Jide version?
And what is your JDK version?

(I used jide-commons library v.1.9.3 and JDK 1.6.0_30 for tests)

About the setLeafIcon/setOpenIcon/setClosedIcon methods - i have added them into the next update.
I didn't use default renderer as base because it does a lot of pointless actions when rendering an element.
Plus i had to create renderer atop of my own component to have some additional features included.
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg

Re: [ADDED] CheckBoxTree support

Postby Abu Abdullah » Mon Jun 24, 2013 5:14 pm

v 1.9.3 is way too old. please find the latest one in:
http://mvnrepository.com/artifact/com.jidesoft/jide-oss


and thanks for adding those functions.
Abu Abdullah
 
Posts: 41
Joined: Tue Apr 17, 2012 12:11 pm

Re: [ADDED] CheckBoxTree support

Postby mgarin » Mon Jun 24, 2013 6:30 pm

Will try it out right now.
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg

Re: [ADDED] CheckBoxTree support

Postby mgarin » Mon Jun 24, 2013 6:44 pm

Indeed, i can reproduce the bug on the latest library version.
Will try to fix it in the next update.
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg

Re: [ADDED] CheckBoxTree support

Postby Abu Abdullah » Mon Jun 24, 2013 6:49 pm

great Thanks
Abu Abdullah
 
Posts: 41
Joined: Tue Apr 17, 2012 12:11 pm

Re: [ADDED] CheckBoxTree support

Postby mgarin » Mon Jun 24, 2013 7:51 pm

Still, i am not sure about the fix - there is a few problems about it.
Jide renderer modifies checkbox icon and doesn't restore it properly.
It also uses a static image and weblaf provides animated ones which doesn't work well with it.
And they also use tristate checkbox with an additional 3rd custom state.

If i won't be able to make a fix for this inside WebLaF - I might include jide-oss into weblaf later and add a few fixes for their classes instead.
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg

Re: [ADDED] CheckBoxTree support

Postby Abu Abdullah » Tue Jun 25, 2013 1:01 pm

certainly including jide-oss will solve everything and you can even customize it in the best way to match WebLaF guidelines. On the other hand, it will need a huge efforts and mostly you will not be able to catch up with the updates by the jide team. they are launching an update almost every two weeks. so at the end we will end up with a fixed version. Difficult decision?

mgarin wrote:It also uses a static image and weblaf provides animated ones which doesn't work well with it.
And they also use tristate checkbox with an additional 3rd custom state.


i noticed this when i tried old version v2 of jide. there is no animation and the rendering is a bit slow. it might be a good choice to have two modes (with/without animation), it might help in integrating WebLaF with other libraries as well. the same goes for tristate checkbox.
Abu Abdullah
 
Posts: 41
Joined: Tue Apr 17, 2012 12:11 pm

Re: [ADDED] CheckBoxTree support

Postby mgarin » Tue Jun 25, 2013 3:19 pm

Abu Abdullah wrote:certainly including jide-oss will solve everything and you can even customize it in the best way to match WebLaF guidelines. On the other hand, it will need a huge efforts and mostly you will not be able to catch up with the updates by the jide team. they are launching an update almost every two weeks. so at the end we will end up with a fixed version. Difficult decision?


That is true. This is one of reasons why i didn't include any large Swing libraries into WebLaF and created almost every component, layout, manager and other features by myself. I will think of some solution to fix Jide behavior w/o touching Jide code.

Abu Abdullah wrote:i noticed this when i tried old version v2 of jide. there is no animation and the rendering is a bit slow. it might be a good choice to have two modes (with/without animation), it might help in integrating WebLaF with other libraries as well. the same goes for tristate checkbox.


There is a static version of checkbox (you can simply switch animation off to use it).
I just need to workaround Jide icon switch behavior somehow. I got a few ideas and i will try them.
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg

Re: CheckBoxTree support

Postby Abu Abdullah » Thu Jul 04, 2013 7:19 am

I have tested the latest update from git.

com.alee.laf.tree.WebTreeCellRenderer.setLeafIcon(null) is throwing NullPointerException

using the DefaultTreeCellRenderer works somehow.

Untitled.png
Untitled.png (32.81 KiB) Viewed 17269 times


Only setOpaque is not working and the height of the text is not working as well. In addition the parent checkbox is somehow flickering i.e. when the mouse on top of it, the mark is gone like what you see from the image above, i believe it is related to the third state of the tristate checkbox
Abu Abdullah
 
Posts: 41
Joined: Tue Apr 17, 2012 12:11 pm

Re: CheckBoxTree support

Postby Abu Abdullah » Wed Aug 07, 2013 8:40 am

I have tested it again with the latest binary (5 Aug). now the setOpaque is working with DefaultTreeCellRenderer. the rest still the same with WebTreeCellRenderer/DefaultTreeCellRenderer
Abu Abdullah
 
Posts: 41
Joined: Tue Apr 17, 2012 12:11 pm

Re: CheckBoxTree support

Postby mgarin » Thu Aug 08, 2013 5:09 pm

I did not make any fixes for CheckBoxTree yet.

I have added an issue for that update on GitHub: https://github.com/mgarin/weblaf/issues/12
As soon as i will complete the CheckBoxTree i will post and update here and close the issue on GitHub.
User avatar
mgarin
Site Admin
 
Posts: 223
Joined: Mon Apr 16, 2012 1:01 pm
Location: Russia, Saint-Petersburg

Next

Return to Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest

cron