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