@ -4,6 +4,9 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.designer.creator.XCreator ;
import com.fr.design.designer.creator.XCreatorUtils ;
import com.fr.design.designer.creator.XLayoutContainer ;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout ;
import com.fr.design.designer.creator.XWFitLayout ;
import com.fr.design.designer.creator.cardlayout.XCardSwitchButton ;
import com.fr.design.designer.treeview.ComponentTreeCellRenderer ;
import com.fr.design.designer.treeview.ComponentTreeModel ;
import com.fr.design.gui.itree.UITreeUI ;
@ -244,12 +247,25 @@ public class ComponentTree extends JTree {
}
public void getExpandNodes ( XLayoutContainer container , List < TreePath > searchList ) {
for ( int i = 0 , size = container . getXCreatorCount ( ) ; i < size ; i + + ) {
XCreator creator = container . getXCreator ( i ) ;
TreePath treePath = buildTreePath ( creator ) ;
if ( isExpanded ( treePath ) ) searchList . add ( treePath ) ;
if ( creator instanceof XLayoutContainer ) {
getExpandNodes ( ( XLayoutContainer ) creator , searchList ) ;
TreePath treePath = buildTreePath ( container ) ;
if ( isExpanded ( treePath ) ) {
searchList . add ( treePath ) ;
for ( int i = 0 , size = container . getXCreatorCount ( ) ; i < size ; i + + ) {
XCreator creator = container . getXCreator ( i ) ;
if ( creator . acceptType ( XLayoutContainer . class ) | | creator . acceptType ( XCardSwitchButton . class ) ) {
getExpandNodes ( ( XLayoutContainer ) creator . getXCreator ( ) , searchList ) ;
}
}
}
//对绝对布局做特殊处理
if ( container . acceptType ( XWFitLayout . class ) ) {
XWFitLayout bodyFitLayout = ( XWFitLayout ) container ;
for ( int j = 0 ; j < bodyFitLayout . getXCreatorCount ( ) ; j + + ) {
//类型是绝对布局并且还是body
if ( bodyFitLayout . getXCreator ( j ) . acceptType ( XWAbsoluteBodyLayout . class ) ) {
container = ( XLayoutContainer ) bodyFitLayout . getXCreator ( j ) ;
getExpandNodes ( container , searchList ) ;
}
}
}
}