Browse Source

Pull request #9812: REPORT-73183 优化tab命名规则,现在的规则是,tabxy,x为tablayout中tab的index,y为模板中tablayout 的index

Merge in DESIGN/design from ~KERRY/design_10.0:feature/x to feature/x

* commit '06fe7a465de108de2dd2c748537325ab28c79ac9':
  添加注释
  REPORT-73183  优化tab命名规则,现在的规则是,tabxy,x为tablayout中tab的index,y为模板中tablayout 的index
feature/x
kerry 2 years ago
parent
commit
dee544a876
  1. 16
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java

16
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java

@ -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() {

Loading…
Cancel
Save