Browse Source

Pull request #5528: REPORT-57984 & REPORT-58010 & REPORT-58003 & REPORT-57966

Merge in DESIGN/design from ~STARRYI/design:feature/x to feature/x

* commit '0f953c1357f5b72b49c6cbf1d25edbc11fd2cef7':
  无JIRA任务 修复因数据结构变更,导致无法查找到 主题数据产生的NPE
  REPORT-57966 【主题切换】模板主题页面的√显示不全
  REPORT-58003 【主题切换】模板主题过长时无法点击编辑按钮
  REPORT-58010 【主题切换】另存的窗口显示与交互不同
  REPORT-57984 【主题切换】设置了2个同样不同名称的浅色主题,应用时勾选了2个
research/11.0
starryi 3 years ago
parent
commit
8a0c1fc22f
  1. 3
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  2. 8
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java
  3. 61
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java

3
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -1715,6 +1715,9 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
protected void setUpTheme4NewTemplate() {
TemplateTheme theme = getUsingTemplateThemeConfig().cachedFetchTheme4NewTemplate();
if (theme != null) {
theme = getUsingTemplateThemeConfig().createNewTheme();
}
TemplateThemeAttrMark themeAttrMark = template.getAttrMark(TemplateThemeAttrMark.XML_TAG);
if (themeAttrMark == null) {
themeAttrMark = new TemplateThemeAttrMark();

8
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java

@ -23,8 +23,10 @@ import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Window;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -104,7 +106,7 @@ public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel {
UILabel titleLabel = new UILabel(name);
titleLabel.setToolTipText(name);
infoPane.add(titleLabel, BorderLayout.WEST);
infoPane.add(titleLabel, BorderLayout.CENTER);
if (profilePane != null) {
addProfileButton(infoPane);
@ -179,12 +181,14 @@ public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel {
@Override
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) {
TemplateThemeConfig<? extends TemplateTheme> templateUsingConfig = template.getUsingTemplateThemeConfig();
TemplateTheme templateTheme = template.getTemplateTheme();
if (templateUsingConfig == this.config && StringUtils.equals(templateTheme.getName(), name)) {
theme4currentTemplateMarkIcon.paintIcon(this, g, 176, 0);
theme4currentTemplateMarkIcon.paintIcon(this, g, getWidth() - 25, 0);
}
}

61
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java

@ -25,6 +25,7 @@ import com.fr.design.mainframe.theme.edit.ui.ColorListPane;
import com.fr.design.mainframe.theme.edit.ui.LabelUtils;
import com.fr.design.mainframe.theme.ui.BorderUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
@ -311,7 +312,11 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
}
public void populateBean(T theme) {
this.theme = theme;
try {
this.theme = (T) theme.clone();
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
isPopulating = true;
String name = theme.getName();
@ -448,26 +453,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
confirmButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
T theme = updateBean();
boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton);
if (canBeSaved && theme != null) {
theme.setName(nameTextField.getText());
theme.setRemovable(true);
theme.setMutable(true);
Configurations.modify(new WorkerFacade(config.getClass()) {
@Override
public void run() {
config.addTheme(theme, true);
}
}.addCallBack(new CallBackAdaptor() {
@Override
public void afterCommit() {
super.afterCommit();
exit();
parent.exit();
}
}));
}
saveAsNew(nameTextField.getText());
}
});
@ -531,8 +517,9 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel nameTextPane = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(20, 5);
nameTextPane.add(nameTextField);
nameTextPane.setBorder(BorderFactory.createEmptyBorder(20, 0, 0, 0));
nameTextPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Template_Theme_Save_As_Pane_Name_Label")));
nameTextPane.add(nameTextField);
container.add(nameTextPane, BorderLayout.CENTER);
container.add(nameErrorLabel, BorderLayout.SOUTH);
@ -540,6 +527,36 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
return container;
}
private void saveAsNew(String name) {
T newThemeObject = null;
try {
newThemeObject = (T) updateBean().clone();
} catch (CloneNotSupportedException ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
return;
}
boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton);
if (canBeSaved && newThemeObject != null) {
newThemeObject.setName(name);
newThemeObject.setRemovable(true);
newThemeObject.setMutable(true);
T finalNewThemeObject = newThemeObject;
Configurations.modify(new WorkerFacade(config.getClass()) {
@Override
public void run() {
config.addTheme(finalNewThemeObject, true);
}
}.addCallBack(new CallBackAdaptor() {
@Override
public void afterCommit() {
super.afterCommit();
exit();
parent.exit();
}
}));
}
}
public void exit() {
this.dispose();
}

Loading…
Cancel
Save