@ -35,6 +35,7 @@ import com.fr.general.act.BorderPacker;
import com.fr.general.ComparatorUtils ;
import com.fr.general.FRFont ;
import com.fr.general.cardtag.DefaultTemplateStyle ;
import com.fr.stable.StringUtils ;
import javax.swing.border.Border ;
import java.awt.* ;
@ -132,14 +133,16 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
}
int index = this . cardLayout . toData ( ) . getWidgetCount ( ) ;
//新加一个card
String widgetName = tagName + getTabNameIndex ( ) ;
//新加一个card,命名规则是tabxy,x为tablayout中tab的index,y为模板中tablayout 的index
String widgetName = tagName + getTabNameIndex ( ) + getCardLayoutSuffix ( cardLayout . toData ( ) . getWidgetName ( ) , cardLayout . createDefaultName ( ) ) ;
WTabFitLayout fitLayout = new WTabFitLayout ( widgetName , tabFitIndex , currentCard ) ;
fitLayout . setTabNameIndex ( getTabNameIndex ( ) ) ;
XWTabFitLayout tabFitLayout = new XWTabFitLayout ( fitLayout , new Dimension ( ) ) ;
FormDesigner formDesigner = WidgetPropertyPane . getInstance ( ) . getEditingFormDesigner ( ) ;
ModelUtil . renameWidgetName ( formDesigner . getTarget ( ) , tabFitLayout ) ;
if ( formDesigner . getTarget ( ) . isNameExist ( widgetName ) ) {
ModelUtil . renameWidgetName ( formDesigner . getTarget ( ) , tabFitLayout ) ;
}
WCardTagLayout layout = ( WCardTagLayout ) this . toData ( ) ;
if ( ! ComparatorUtils . equals ( layout . getTemplateStyle ( ) . getStyle ( ) , DefaultTemplateStyle . DEFAULT_TEMPLATE_STYLE ) ) {
@ -154,6 +157,13 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
cardLayout . showCard ( ) ;
}
private String getCardLayoutSuffix ( String cardLayoutName , String defaultName ) {
if ( StringUtils . isEmpty ( cardLayoutName ) | | StringUtils . isEmpty ( defaultName ) | | ! cardLayoutName . contains ( defaultName ) ) {
return StringUtils . EMPTY ;
}
return cardLayoutName . substring ( defaultName . length ( ) ) ;
}
@Override
protected String getIconName ( ) {