protected void expansionStateChanged()

in CasViewerEclipsePlugin/uimaj-ep-casviewer/src/main/java/org/apache/uima/uct/viewer/internal/page/CASViewControl.java [149:222]


        protected void expansionStateChanged (boolean expand, SectionPart child) {
            if (expand) {
                --collapseCOunt;
            } else {
                ++collapseCOunt;
            }
            int[] weights; //  = sashForm.getWeights();
            if (child == first) {
                if (expand) {
                    // "first" is expanded
                    if (collapseCOunt > 0) {
                        // Another child is collapsed
                        weights = new int[] { total - min, min };
                    } else {
                        // Restore weights
                        weights = sashForm.getWeights();
                        if (firstMinSize == getSizeForSash(isVertical, 
                                first.getSection().getSize()) ) { 
                            // Sash is NOT moved while I am collapsed
                            weights = sashWeights;
                        }
                    }
                } else {
                    // "first" is collapsed
                    if (collapseCOunt > 1) {
                        // Another child is ALSO collapsed
                        // Restore weights
                        weights = sashWeights;
                    } else{
                        sashWeights = sashForm.getWeights();
                        weights = new int[] { min, total - min };                         
                    }
                }
            } else if (child == second) {
                if (expand) {
                    // "second" is expanded
                    if (collapseCOunt > 0) {
                        // Another child is collapsed
                        weights = new int[] { min, total - min };
                    } else {
                        // Restore weights
                        weights = sashForm.getWeights();
                        if (secondMinSize == getSizeForSash(isVertical, 
                                second.getSection().getSize())) { 
                            // Sash is NOT moved while I am collapsed
                            weights = sashWeights;
                        }
                    }
                } else {
                    // "second" is collapsed
                    if (collapseCOunt > 1) {
                        // Another child is ALSO collapsed
                        // Restore weights
                        weights = sashWeights;
                    } else{
                        sashWeights = sashForm.getWeights();
                        weights = new int[] { total - min, min };                        
                    }
                }
            } else {
                return;
            }
            // Trace.err("weights: " + weights[0] + " : " + weights[1]);
            sashForm.setWeights(weights);
            
            // Remember the size if child is collapsed
            if (!expand) {                
                if (child == first) {                    
                    firstMinSize = getSizeForSash(isVertical, first.getSection().getSize());   
                } else {
                    secondMinSize = getSizeForSash(isVertical, second.getSection().getSize());                    
                }                
            }
        }