Open Source & Free ❤️

Updated Parse Lib, Tiling Performance, Decimals & Trees

Updated Parse Lib, Tiling Performance, Decimals & Trees

Header Image

The excellent
Parse4cn1 library just announced version 1.1.
The biggest new feature is batch operations but there are
a few others that could be helpful. Overall the library was pretty solid before the 1.1 version and this is a nice
improvement on top.

Fabricio Cabeca contributed an interesting
pull request
that has the potential to improve performance nicely on most platforms. Hopefully we’ll fix the issues in this
approach and get it up again.

Steve reimplemented our BigDecimal & BigInteger based on the TeaVM
implementation to make it more compliant to the Java SE version of these classes.

Expanding A Tree

A common request for the tree class is to open it when its already expanded. I recently had to do that myself for
the GUI builder and noticed that one of the pain points is the fact that the Tree always animates
expansion. So we added a new method that allows path expansion without animation specifically: expandPath(animated, path).
This tree class shows itself expanded by default and can be useful for your app:

public class MyTree extends Tree {
    public MyTree(TreeModel model) {
        super(model);
    }

    @Override
    protected void initComponent() {
        expand();
        super.initComponent(); 
    }

    public void expand() {
        Object current = null;
        Vector c = getModel().getChildren(current);
        if(c != null) {
            for(Object o : c) {
                recurseExpand(o);
            }
        }
    }
    
    private void recurseExpand(Object... path) {
        expandPath(false, path);
        if(getModel().isLeaf(path[path.length - 1])) {
            return;
        }
        Vector ch = getModel().getChildren(path[path.length - 1]);
        if(ch != null) {
            Object[] arr = new Object[path.length + 1];
            for(int iter = 0 ; iter < path.length ; iter++) {
                arr[iter] = path[iter];
            }
            for(Object o : ch) {
                arr[path.length] = o;
                recurseExpand(arr);
            }
        }
    }
}