src/main/java/org/fit/layout/impl/AreaGrid.java
private void calculateColumns()
    {
        //create the sorted list of points
        GridPoint points[] = new GridPoint[areas.size() * 2];
        int pi = 0;
        for (Area area : areas)
        {
            points[pi] = new GridPoint(area.getX1(), area, true);
            points[pi+1] = new GridPoint(area.getX2() + 1, area, false);
            pi += 2;
            //X2+1 ensures that the end of one box will be on the same point
            //as the start of the following box
        }
        Arrays.sort(points);
        
        //calculate the number of columns
        int cnt = 0;
        int last = abspos.getX1();
        for (int i = 0; i < points.length; i++)
            if (!theSame(points[i].value, last))
            { 
                last = points[i].value;
                cnt++;
            }
        if (!theSame(last, abspos.getX2()))
        	cnt++; //last column finishes the whole area
        width = cnt;
        
        //calculate the column widths and the layout
        maxindent = 0;
        minindent = -1;
        cols = new int[width];
        cnt = 0;
        last = abspos.getX1();
        for (int i = 0; i < points.length; i++)
        {
            if (!theSame(points[i].value, last)) 
            {
                cols[cnt] = points[i].value - last;
                last = points[i].value;
                cnt++;
            }
            if (points[i].begin)
            {
                target.getPosition(points[i].area).setX1(cnt);
                maxindent = cnt;
                if (minindent == -1) minindent = maxindent;
                //points[i].node.getArea().setX1(parent.getArea().getX1() + getColOfs(cnt));
            }
            else
            {
                Rectangular pos = target.getPosition(points[i].area); 
                pos.setX2(cnt-1);
                if (pos.getX2() < pos.getX1())
                    pos.setX2(pos.getX1());
                //points[i].node.getArea().setX2(parent.getArea().getX1() + getColOfs(pos.getX2()+1));
            }
        }
        if (!theSame(last, abspos.getX2()))
        	cols[cnt] = abspos.getX2() - last;
        if (minindent == -1)
            minindent = 0;
    }
private void calculateColumns()
    {
        //create the sorted list of points
        GridPoint points[] = new GridPoint[areas.size() * 2];
        int pi = 0;
        for (Area area : areas)
        {
            points[pi] = new GridPoint(area.getX1(), area, true);
            points[pi+1] = new GridPoint(area.getX2() + 1, area, false);
            pi += 2;
            //X2+1 ensures that the end of one box will be on the same point
            //as the start of the following box
        }
        Arrays.sort(points);
        
        //calculate the number of columns
        int cnt = 0;
        int last = abspos.getX1();
        for (int i = 0; i < points.length; i++)
            if (!theSame(points[i].value, last))
            { 
                last = points[i].value;
                cnt++;
            }
        if (!theSame(last, abspos.getX2()))
        	cnt++; //last column finishes the whole area
        width = cnt;
        
        //calculate the column widths and the layout
        maxindent = 0;
        minindent = -1;
        cols = new int[width];
        cnt = 0;
        last = abspos.getX1();
        for (int i = 0; i < points.length; i++)
        {
            if (!theSame(points[i].value, last)) 
            {
                cols[cnt] = points[i].value - last;
                last = points[i].value;
                cnt++;
            }
            if (points[i].begin)
            {
                target.getPosition(points[i].area).setX1(cnt);
                maxindent = cnt;
                if (minindent == -1) minindent = maxindent;
                //points[i].node.getArea().setX1(parent.getArea().getX1() + getColOfs(cnt));
            }
            else
            {
                Rectangular pos = target.getPosition(points[i].area); 
                pos.setX2(cnt-1);
                if (pos.getX2() < pos.getX1())
                    pos.setX2(pos.getX1());
                //points[i].node.getArea().setX2(parent.getArea().getX1() + getColOfs(pos.getX2()+1));
            }
        }
        if (!theSame(last, abspos.getX2()))
        	cols[cnt] = abspos.getX2() - last;
        if (minindent == -1)
            minindent = 0;
    }
private void calculateColumns ( ) { //create the sorted list of points GridPoint points [ ] = new GridPoint [ areas . size ( ) * 2 ] ; int pi = 0 ; for ( Area area : areas ) { points [ pi ] = new GridPoint ( area . getX1 ( ) , area , true ) ; points [ pi + 1 ] = new GridPoint ( area . getX2 ( ) + 1 , area , false ) ; pi += 2 ; //X2+1 ensures that the end of one box will be on the same point //as the start of the following box } Arrays . sort ( points ) ; //calculate the number of columns int cnt = 0 ; int last = abspos . getX1 ( ) ; for ( int i = 0 ; i < points . length ; i ++ ) if ( ! theSame ( points [ i ] . value , last ) ) { last = points [ i ] . value ; cnt ++ ; } if ( ! theSame ( last , abspos . getX2 ( ) ) ) cnt ++ ; //last column finishes the whole area width = cnt ; //calculate the column widths and the layout maxindent = 0 ; minindent = - 1 ; cols = new int [ width ] ; cnt = 0 ; last = abspos . getX1 ( ) ; for ( int i = 0 ; i < points . length ; i ++ ) { if ( ! theSame ( points [ i ] . value , last ) ) { cols [ cnt ] = points [ i ] . value - last ; last = points [ i ] . value ; cnt ++ ; } if ( points [ i ] . begin ) { target . getPosition ( points [ i ] . area ) . setX1 ( cnt ) ; maxindent = cnt ; if ( minindent == - 1 ) minindent = maxindent ; //points[i].node.getArea().setX1(parent.getArea().getX1() + getColOfs(cnt)); } else { Rectangular pos = target . getPosition ( points [ i ] . area ) ; pos . setX2 ( cnt - 1 ) ; if ( pos . getX2 ( ) < pos . getX1 ( ) ) pos . setX2 ( pos . getX1 ( ) ) ; //points[i].node.getArea().setX2(parent.getArea().getX1() + getColOfs(pos.getX2()+1)); } } if ( ! theSame ( last , abspos . getX2 ( ) ) ) cols [ cnt ] = abspos . getX2 ( ) - last ; if ( minindent == - 1 ) minindent = 0 ; }
Goes through the child areas and creates a list of collumns
Goes through the child areas and creates a list of collumns