Browse Source

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

feature/x
kerry 2 years ago
parent
commit
72df91768a
  1. 14
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java

14
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.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.cardtag.DefaultTemplateStyle; import com.fr.general.cardtag.DefaultTemplateStyle;
import com.fr.stable.StringUtils;
import javax.swing.border.Border; import javax.swing.border.Border;
import java.awt.*; import java.awt.*;
@ -133,13 +134,15 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
int index = this.cardLayout.toData().getWidgetCount(); int index = this.cardLayout.toData().getWidgetCount();
//新加一个card //新加一个card
String widgetName = tagName + getTabNameIndex(); String widgetName = tagName + getTabNameIndex() + getCardLayoutSuffix(cardLayout.toData().getWidgetName(), cardLayout.createDefaultName());
WTabFitLayout fitLayout = new WTabFitLayout(widgetName, tabFitIndex, currentCard); WTabFitLayout fitLayout = new WTabFitLayout(widgetName, tabFitIndex, currentCard);
fitLayout.setTabNameIndex(getTabNameIndex()); fitLayout.setTabNameIndex(getTabNameIndex());
XWTabFitLayout tabFitLayout = new XWTabFitLayout(fitLayout, new Dimension()); XWTabFitLayout tabFitLayout = new XWTabFitLayout(fitLayout, new Dimension());
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); 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(); WCardTagLayout layout = (WCardTagLayout) this.toData();
if(!ComparatorUtils.equals(layout.getTemplateStyle().getStyle(), DefaultTemplateStyle.DEFAULT_TEMPLATE_STYLE)){ if(!ComparatorUtils.equals(layout.getTemplateStyle().getStyle(), DefaultTemplateStyle.DEFAULT_TEMPLATE_STYLE)){
@ -154,6 +157,13 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
cardLayout.showCard(); 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 @Override
protected String getIconName() { protected String getIconName() {

Loading…
Cancel
Save