@ -4,6 +4,7 @@ import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter ;
import com.fr.design.designer.beans.events.DesignerEvent ;
import com.fr.design.designer.creator.XCreator ;
import com.fr.design.designer.creator.XWTitleLayout ;
import com.fr.design.gui.ilable.UILabel ;
import com.fr.design.i18n.Toolkit ;
import com.fr.design.layout.VerticalFlowLayout ;
@ -58,7 +59,7 @@ public class PopupControlPanel extends JPanel {
addButton ( toggleButton , 1 ) ;
addButton ( settingButton , 2 ) ;
setButtonVisible ( editButton , tru e) ;
setButtonVisible ( editButton , fals e) ;
setButtonVisible ( toggleButton , false ) ;
setButtonVisible ( settingButton , false ) ;
}
@ -139,7 +140,7 @@ public class PopupControlPanel extends JPanel {
if ( index > 0 ) {
getComponent ( 2 * index - 1 ) . setVisible ( false ) ;
}
buttons . get ( index ) . setVisible ( tru e) ;
buttons . get ( index ) . setVisible ( visibl e) ;
if ( ! visible ) {
// 如果当前按钮设置为不可见,且在当前按钮之前的其他按钮也不可见,则下一个可见按钮前无分割线
@ -192,6 +193,7 @@ public class PopupControlPanel extends JPanel {
}
public void updatePane ( FormDesigner designer ) {
setButtonVisible ( editButton , creator . acceptType ( XWTitleLayout . class ) ) ;
setButtonVisible ( settingButton , creator . isShared ( ) ) ;
setButtonVisible ( toggleButton , AdapterBus . searchLayoutAdapter ( designer , creator ) instanceof FRAbsoluteLayoutAdapter ) ;
toggleButton . setSelected ( creator . toData ( ) . isAspectRatioLocked ( ) ) ;
@ -199,6 +201,15 @@ public class PopupControlPanel extends JPanel {
updateDimension ( ) ;
}
public boolean hasVisibleButtons ( ) {
for ( int i = 0 ; i < buttons . size ( ) ; i + + ) {
if ( buttons . get ( i ) . isVisible ( ) ) {
return true ;
}
}
return false ;
}
private void updateDimension ( ) {
int height = 0 ;
for ( int i = 0 ; i < buttons . size ( ) ; i + + ) {