Browse Source

Merge branch 'release/11.0' of https://code.fineres.com/scm/~henry.wang/design into release/11.0

fix-lag
Henry.Wang 3 years ago
parent
commit
2cb1d5d7c7
  1. 5
      designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java
  2. 76
      designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java
  3. 4
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  4. 1
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java
  5. 7
      designer-base/src/main/java/com/fr/design/gui/style/ComponentTitleStylePane.java
  6. 33
      designer-base/src/main/java/com/fr/design/locale/impl/DoubleSplashMark.java
  7. 4
      designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java
  8. 11
      designer-base/src/main/java/com/fr/design/login/AbstractDesignerSSO.java
  9. 15
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  10. 17
      designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java
  11. 16
      designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java
  12. 14
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java
  13. 12
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java
  14. 7
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java
  15. 12
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemePreviewPane.java
  16. 96
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
  17. 8
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeDialog.java
  18. 15
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java
  19. 82
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java
  20. 69
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java
  21. 25
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java
  22. 15
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ComponentStyleEditPane.java
  23. 53
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java
  24. 7
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListExtendedPane.java
  25. 9
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java
  26. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ChartComponentPreviewPane.java
  27. 56
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java
  28. 16
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java
  29. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java
  30. 19
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/AbstractECPreviewPane.java
  31. 6
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECComponentPreviewPane.java
  32. 7
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECPreviewPane.java
  33. 7
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java
  34. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java
  35. 1
      designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java
  36. 7
      designer-base/src/main/java/com/fr/design/style/AlignmentPane.java
  37. 5
      designer-base/src/main/java/com/fr/design/style/BorderPane.java
  38. 17
      designer-base/src/main/java/com/fr/design/style/background/BackgroundJComponent.java
  39. 4
      designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java
  40. 5
      designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java
  41. 130
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java
  42. 13
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  43. BIN
      designer-base/src/main/resources/com/fr/design/images/transparent_background.png
  44. 7
      designer-base/src/test/java/com/fr/design/utils/DesignUtilsTest.java
  45. 9
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  46. 3
      designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java
  47. 58
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java
  48. 42
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  49. 30
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  50. 4
      designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java
  51. 4
      designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java
  52. 5
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java
  53. 9
      designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java
  54. BIN
      designer-form/src/main/resources/com/fr/design/form/images/theme4newTemplate.png
  55. 8
      designer-realize/src/main/java/com/fr/design/actions/insert/cell/GeneralCellAction.java
  56. 9
      designer-realize/src/main/java/com/fr/design/cell/editor/TextCellEditor.java
  57. 7
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  58. 4
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java
  59. 68
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java
  60. 4
      designer-realize/src/main/java/com/fr/design/report/NewReportBackgroundPane.java
  61. 42
      designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java
  62. 9
      designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java
  63. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash.png
  64. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash@2x.png
  65. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_10.png
  66. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_10@2x.png
  67. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_10_en.png
  68. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_en.png
  69. BIN
      designer-realize/src/main/resources/com/fr/design/images/splash_en@2x.png

5
designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java

@ -1,5 +1,6 @@
package com.fr.design.actions.help; package com.fr.design.actions.help;
import com.fr.design.i18n.Toolkit;
import com.fr.design.login.AbstractDesignerSSO; import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
@ -52,6 +53,10 @@ public class TutorialAction extends AbstractDesignerSSO {
} }
} }
public String getOffLineWarnMessage() {
return Toolkit.i18nText("Fine-Design_Offline_Helptutorial_Msg");
}
public static final MenuKeySet HELP_TUTORIAL = new MenuKeySet() { public static final MenuKeySet HELP_TUTORIAL = new MenuKeySet() {
@Override @Override
public char getMnemonic() { public char getMnemonic() {

76
designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java

@ -0,0 +1,76 @@
package com.fr.design.cell;
import com.fr.base.NameStyle;
import com.fr.base.ScreenResolution;
import com.fr.base.Style;
import com.fr.general.IOUtils;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/3
*/
public class CellStylePreviewPane extends JPanel {
private static final BufferedImage transparentBackgroundImage = IOUtils.readImage("/com/fr/design/images/transparent_background.png");
private final float transparentBackgroundWidth;
private final float transparentBackgroundHeight;
private String paintText = "Report";
private Style style = Style.DEFAULT_STYLE;
public CellStylePreviewPane() {
transparentBackgroundWidth = transparentBackgroundImage.getWidth(null);
transparentBackgroundHeight = transparentBackgroundImage.getHeight(null);
}
public void setStyle(Style style) {
this.style = style;
if (style instanceof NameStyle) {
paintText = ((NameStyle) style).getName();
}
repaint();
}
@Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
int resolution = ScreenResolution.getScreenResolution();
int width = getWidth();
int height = getHeight();
float scaleWidth = 1.0F * getWidth() / transparentBackgroundWidth;
float scaleHeight = 1.0F * getHeight() / transparentBackgroundHeight;
float maxScale = Math.max(scaleWidth, scaleHeight);
if (maxScale <= 1) {
scaleWidth = scaleHeight = 1;
} else {
scaleHeight = scaleWidth = maxScale;
}
g2d.drawImage(transparentBackgroundImage, 0, 0, (int) (transparentBackgroundWidth * scaleWidth), (int) (transparentBackgroundHeight * scaleHeight), null);
if (style == Style.DEFAULT_STYLE) {
// 如果是默认的style,就只写"Report"上去
Style.paintContent(g2d, paintText, style, width, height, resolution);
return;
}
Style.paintBackground(g2d, style, width, height);
Style.paintContent(g2d, paintText, style, width, height, resolution);
Style.paintBorder(g2d, style, width, height);
}
@Override
public Dimension getMinimumSize() {
return getPreferredSize();
}
}

4
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -55,6 +55,7 @@ import com.fr.stable.EssentialUtils;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.UtilEvalError; import com.fr.stable.UtilEvalError;
import com.fr.stable.script.CRAddress;
import com.fr.stable.script.ColumnRowRange; import com.fr.stable.script.ColumnRowRange;
import com.fr.stable.script.Expression; import com.fr.stable.script.Expression;
import com.fr.stable.script.Node; import com.fr.stable.script.Node;
@ -891,7 +892,8 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
} }
public void hunter4Tiny(Tiny tiny) { public void hunter4Tiny(Tiny tiny) {
if (tiny.getClass() == ColumnRowRangeInPage.class || Arrays.asList(curReportVariables).contains(tiny.toString())) { if (tiny.getClass() == ColumnRowRangeInPage.class || tiny.getClass() == CRAddress.class
|| Arrays.asList(curReportVariables).contains(tiny.toString())) {
supported = false; supported = false;
unSupportedNode = tiny.toString(); unSupportedNode = tiny.toString();
} }

1
designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java

@ -136,6 +136,7 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G
} }
popupWin = this.getColorControlWindow(); popupWin = this.getColorControlWindow();
popupWin.setColor(color);
GUICoreUtils.showPopupMenu(popupWin, this, POPUP_MENU_SHIFT, this.getSize().height); GUICoreUtils.showPopupMenu(popupWin, this, POPUP_MENU_SHIFT, this.getSize().height);
} }

7
designer-base/src/main/java/com/fr/design/gui/style/ComponentTitleStylePane.java

@ -303,16 +303,19 @@ public class ComponentTitleStylePane extends AbstractBorderPackerPane {
return; return;
} }
JPanel container = this; JPanel container = this;
for (JComponent component: components) { for (int i = 0; i < components.length; i++) {
JComponent component = components[i];
if (component != null) { if (component != null) {
container.add(component, BorderLayout.NORTH); container.add(component, BorderLayout.NORTH);
component.setBorder(BorderFactory.createEmptyBorder(i == 0 ? 0 : IntervalConstants.INTERVAL_L1, 0, 0, 0));
if (i < components.length - 1) {
JPanel nextContainer = new JPanel(FRGUIPaneFactory.createBorderLayout()); JPanel nextContainer = new JPanel(FRGUIPaneFactory.createBorderLayout());
nextContainer.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0));
container.add(nextContainer, BorderLayout.CENTER); container.add(nextContainer, BorderLayout.CENTER);
container = nextContainer; container = nextContainer;
} }
} }
} }
}
public void setSupportTitleVisible(boolean supporting) { public void setSupportTitleVisible(boolean supporting) {

33
designer-base/src/main/java/com/fr/design/locale/impl/DoubleSplashMark.java

@ -0,0 +1,33 @@
package com.fr.design.locale.impl;
import com.fr.design.DesignerEnvManager;
import com.fr.general.locale.LocaleMark;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/9/2
*/
public class DoubleSplashMark implements LocaleMark<String> {
private final Map<Locale, String> map = new HashMap<Locale, String>();
private static final String SPLASH_PATH_X2 = "/com/fr/design/images/splash@2x.png";
private static final String SPLASH_PATH_EN_X2 = "/com/fr/design/images/splash_en@2x.png";
public DoubleSplashMark() {
map.put(Locale.CHINA, SPLASH_PATH_X2);
map.put(Locale.KOREA, SPLASH_PATH_EN_X2);
map.put(Locale.JAPAN, SPLASH_PATH_EN_X2);
map.put(Locale.US, SPLASH_PATH_EN_X2);
map.put(Locale.TAIWAN, SPLASH_PATH_EN_X2);
}
@Override
public String getValue() {
String result = map.get(DesignerEnvManager.getEnvManager().getLanguage());
return result == null ? SPLASH_PATH_EN_X2 : result;
}
}

4
designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java

@ -15,8 +15,8 @@ import java.util.Map;
public class SplashMark implements LocaleMark<String> { public class SplashMark implements LocaleMark<String> {
private Map<Locale, String> map = new HashMap<Locale, String>(); private Map<Locale, String> map = new HashMap<Locale, String>();
private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.png"; private static final String SPLASH_PATH = "/com/fr/design/images/splash.png";
private static final String SPLASH_EN_PATH = "/com/fr/design/images/splash_10_en.png"; private static final String SPLASH_EN_PATH = "/com/fr/design/images/splash_en.png";
public SplashMark() { public SplashMark() {
map.put(Locale.CHINA, SPLASH_PATH); map.put(Locale.CHINA, SPLASH_PATH);

11
designer-base/src/main/java/com/fr/design/login/AbstractDesignerSSO.java

@ -6,6 +6,9 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.login.utils.DesignerLoginUtils; import com.fr.design.login.utils.DesignerLoginUtils;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -21,6 +24,10 @@ public abstract class AbstractDesignerSSO extends UpdateAction {
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
String url = getJumpUrl(); String url = getJumpUrl();
if (!DesignerLoginUtils.isOnline()) { if (!DesignerLoginUtils.isOnline()) {
String message = getOffLineWarnMessage();
if (StringUtils.isNotEmpty(message)) {
FineLoggerFactory.getLogger().warn(message);
}
BrowseUtils.browser(url); BrowseUtils.browser(url);
return; return;
} }
@ -47,4 +54,8 @@ public abstract class AbstractDesignerSSO extends UpdateAction {
} }
public abstract String getJumpUrl(); public abstract String getJumpUrl();
public String getOffLineWarnMessage() {
return StringUtils.EMPTY;
}
} }

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

@ -54,6 +54,7 @@ import com.fr.design.menu.NameSeparator;
import com.fr.design.menu.ShortCut; import com.fr.design.menu.ShortCut;
import com.fr.design.preview.PagePreview; import com.fr.design.preview.PagePreview;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils;
import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.design.worker.save.EmptyCallBackSaveWorker; import com.fr.design.worker.save.EmptyCallBackSaveWorker;
import com.fr.design.write.submit.DBManipulationInWidgetEventPane; import com.fr.design.write.submit.DBManipulationInWidgetEventPane;
@ -189,13 +190,13 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
designModel = createDesignModel(parameters); designModel = createDesignModel(parameters);
} }
addCenterPane(); addCenterPane();
this.undoState = createUndoState();
initAndStartPlugin();
if (isNewFile) { if (isNewFile) {
// REPORT-58486: 必须在初始的UndoState创建前设置主题,使得初始的UndoState就包含了主题效果
setUpTheme4NewTemplate(); setUpTheme4NewTemplate();
} }
this.undoState = createUndoState();
initAndStartPlugin();
startListenThemeConfig(); startListenThemeConfig();
} }
@ -250,7 +251,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
if (themeConfigChangeListener != null) { if (themeConfigChangeListener != null) {
TemplateThemeConfig<? extends TemplateTheme> config = getUsingTemplateThemeConfig(); TemplateThemeConfig<? extends TemplateTheme> config = getUsingTemplateThemeConfig();
if (config != null) { if (config != null) {
config.addThemeConfigChangeListener(themeConfigChangeListener); config.removeThemeConfigChangeListener(themeConfigChangeListener);
} }
} }
} }
@ -624,8 +625,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
*/ */
public void redo() { public void redo() {
this.getUndoManager().redo(); this.getUndoManager().redo();
// 重做前模版使用主题可能已经被删除或修改,需要重置模版样式
checkAndResetTheme();
fireSuperTargetModified(); fireSuperTargetModified();
} }
@ -1145,7 +1144,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public boolean isOldDesigner() { public boolean isOldDesigner() {
String xmlDesignerVersion = getTarget().getXMLDesignerVersion(); String xmlDesignerVersion = getTarget().getXMLDesignerVersion();
if (isHigherThanCurrent(xmlDesignerVersion)) { if (isHigherThanCurrent(xmlDesignerVersion)) {
String infor = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", StringUtils.parseVersion(xmlDesignerVersion)); String infor = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Template_Version_Not_Match", DesignUtils.parseVersion(xmlDesignerVersion));
String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info"); String moreInfo = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Version_Tip_More_Info");
new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show(); new InformationWarnPane(infor, moreInfo, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips")).show();
return true; return true;

17
designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java

@ -1,6 +1,5 @@
package com.fr.design.mainframe.theme; package com.fr.design.mainframe.theme;
import com.fr.base.theme.FineColorManager;
import com.fr.base.theme.FormTheme; import com.fr.base.theme.FormTheme;
import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemedComponentStyle; import com.fr.base.theme.settings.ThemedComponentStyle;
@ -13,8 +12,6 @@ import com.fr.design.mainframe.theme.edit.FormBodyStyleEditPane;
import com.fr.design.mainframe.theme.preview.FormThemePreviewPane; import com.fr.design.mainframe.theme.preview.FormThemePreviewPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.List;
import java.awt.Color;
import static com.fr.design.i18n.Toolkit.i18nText; import static com.fr.design.i18n.Toolkit.i18nText;
@ -61,20 +58,6 @@ public class FormThemeProfilePane extends TemplateThemeProfilePane<FormTheme> {
return container; return container;
} }
@Override
public void onColorSchemeChanged(List<Color> colors) {
super.onColorSchemeChanged(colors);
FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors);
ThemedFormBodyStyle formBodyStyle = formBodyStyleSettingPane.updateBean();
FineColorManager.traverse(formBodyStyle, replaceByColorScheme);
formBodyStyleSettingPane.populateBean(formBodyStyle);
ThemedComponentStyle componentStyle = componentStyleSettingPane.updateBean();
FineColorManager.traverse(componentStyle, replaceByColorScheme);
componentStyleSettingPane.populateBean(componentStyle);
}
@Override @Override
public void populateBean(FormTheme theme) { public void populateBean(FormTheme theme) {
super.populateBean(theme); super.populateBean(theme);

16
designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java

@ -1,16 +1,11 @@
package com.fr.design.mainframe.theme; package com.fr.design.mainframe.theme;
import com.fr.base.theme.FineColorManager;
import com.fr.base.theme.ReportTheme; import com.fr.base.theme.ReportTheme;
import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemedReportBodyStyle;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.theme.edit.ReportBodyStyleEditPane; import com.fr.design.mainframe.theme.edit.ReportBodyStyleEditPane;
import com.fr.design.mainframe.theme.preview.ReportThemePreviewPane; import com.fr.design.mainframe.theme.preview.ReportThemePreviewPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.Color;
import java.util.List;
/** /**
* @author Starryi * @author Starryi
@ -39,17 +34,6 @@ public class ReportThemeProfilePane extends TemplateThemeProfilePane<ReportTheme
return container; return container;
} }
@Override
public void onColorSchemeChanged(List<Color> colors) {
super.onColorSchemeChanged(colors);
FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors);
ThemedReportBodyStyle bodyStyle = reportBodyStyleSettingPane.updateBean();
FineColorManager.traverse(bodyStyle, replaceByColorScheme);
reportBodyStyleSettingPane.populateBean(bodyStyle);
}
@Override @Override
public void populateBean(ReportTheme theme) { public void populateBean(ReportTheme theme) {
super.populateBean(theme); super.populateBean(theme);

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

@ -37,8 +37,9 @@ import java.awt.event.MouseEvent;
* Created by Starryi on 2021/8/13 * Created by Starryi on 2021/8/13
*/ */
public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel { public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel {
public static final int HEIGHT = 150; public static final int INFO_HEIGHT = 30;
public static final int THUMBNAIL_HEIGHT = 125; public static final int CONTENT_WIDTH = ThemeThumbnail.WIDTH;
public static final int CONTENT_HEIGHT = ThemeThumbnail.HEIGHT + INFO_HEIGHT;
private static final Color HOVERING_BORDER_COLOR = new Color(65, 155, 249); private static final Color HOVERING_BORDER_COLOR = new Color(65, 155, 249);
private final String name; private final String name;
@ -97,13 +98,14 @@ public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel {
private void initializePane() { private void initializePane() {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
setPreferredSize(new Dimension(getPreferredSize().width, HEIGHT)); setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
setBackground(Color.WHITE); setBackground(Color.WHITE);
thumbnailPane.setBackground(Color.WHITE); thumbnailPane.setBackground(Color.WHITE);
thumbnailPane.setPreferredSize(new Dimension(getPreferredSize().width, THUMBNAIL_HEIGHT)); thumbnailPane.setPreferredSize(new Dimension(ThemeThumbnail.WIDTH, ThemeThumbnail.HEIGHT));
JPanel infoPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel infoPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
infoPane.setPreferredSize(new Dimension(CONTENT_WIDTH, INFO_HEIGHT));
infoPane.setBackground(Color.WHITE); infoPane.setBackground(Color.WHITE);
infoPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L7,0,IntervalConstants.INTERVAL_L7)); infoPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L7,0,IntervalConstants.INTERVAL_L7));
@ -129,6 +131,8 @@ public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel {
} }
} }
thumbnailPane.setThumbnail(image); thumbnailPane.setThumbnail(image);
invalidate();
repaint();
} }
public T getTheme() { public T getTheme() {
@ -193,7 +197,7 @@ public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel {
} }
if (displayTheme4NewTemplateMarker && StringUtils.equals(config.getThemeName4NewTemplate(), name)) { if (displayTheme4NewTemplateMarker && StringUtils.equals(config.getThemeName4NewTemplate(), name)) {
theme4NewTemplateMarkIcon.paintIcon(this, g, 0, 0); theme4NewTemplateMarkIcon.paintIcon(this, g, 0, thumbnailPane.getHeight() - 16);
} }
if (selected || this.hovering) { if (selected || this.hovering) {

12
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.theme;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemeThumbnail;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.event.ChangeEvent; import com.fr.design.event.ChangeEvent;
@ -29,7 +30,9 @@ import java.util.Map;
public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane { public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane {
public static final int BLOCK_COUNT_ROW_LINE = 3; public static final int BLOCK_COUNT_ROW_LINE = 3;
public static final int BLOCK_GAP = IntervalConstants.INTERVAL_L1; public static final int BLOCK_GAP = IntervalConstants.INTERVAL_L1;
public static final int CONTENT_WIDTH = 630; public static final int CONTENT_WIDTH = TemplateThemeBlock.CONTENT_WIDTH * BLOCK_COUNT_ROW_LINE + BLOCK_GAP * (BLOCK_COUNT_ROW_LINE - 1) + 10;
public static final int BLOCK_ROWS_PER_PAGE = 3;
public static final int CONTENT_HEIGHT = TemplateThemeBlock.CONTENT_HEIGHT * BLOCK_ROWS_PER_PAGE + BLOCK_GAP * (BLOCK_ROWS_PER_PAGE + 1);
public static final int ASYNC_FETCH_THEME_THREAD_COUNT = 10; public static final int ASYNC_FETCH_THEME_THREAD_COUNT = 10;
private final AsyncThemeFetcher<T> asyncThemeFetcher; private final AsyncThemeFetcher<T> asyncThemeFetcher;
@ -59,7 +62,7 @@ public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane {
private void initializePane() { private void initializePane() {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
setPreferredSize(new Dimension(CONTENT_WIDTH, getPreferredSize().height)); setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
contentListPane.setBorder(BorderFactory.createEmptyBorder(BLOCK_GAP, 0, BLOCK_GAP, 0)); contentListPane.setBorder(BorderFactory.createEmptyBorder(BLOCK_GAP, 0, BLOCK_GAP, 0));
contentListPane.setLayout(new GridLayout(0, BLOCK_COUNT_ROW_LINE, BLOCK_GAP, BLOCK_GAP)); contentListPane.setLayout(new GridLayout(0, BLOCK_COUNT_ROW_LINE, BLOCK_GAP, BLOCK_GAP));
@ -126,6 +129,7 @@ public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane {
} }
private void setSelectedBlock(TemplateThemeBlock<T> block) { private void setSelectedBlock(TemplateThemeBlock<T> block) {
if (selectedBlock != block) {
if (selectedBlock != null) { if (selectedBlock != null) {
selectedBlock.setSelected(false); selectedBlock.setSelected(false);
} }
@ -137,6 +141,7 @@ public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane {
changeListener.fireChanged(new ChangeEvent(this)); changeListener.fireChanged(new ChangeEvent(this));
} }
} }
}
private void asyncFetchTheme(String themeName) { private void asyncFetchTheme(String themeName) {
asyncThemeFetcher.submit(themeName, new AsyncThemeListItemFetchCallback(themeName)); asyncThemeFetcher.submit(themeName, new AsyncThemeListItemFetchCallback(themeName));
@ -171,7 +176,10 @@ public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane {
} }
case UPDATE: { case UPDATE: {
if (existingBlock != null) { if (existingBlock != null) {
fillContentListPane();
asyncFetchTheme(themeName); asyncFetchTheme(themeName);
validate();
repaint();
} }
break; break;
} }

7
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java

@ -17,15 +17,12 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.theme.dialog.TemplateThemeProfileDialog; import com.fr.design.mainframe.theme.dialog.TemplateThemeProfileDialog;
import com.fr.design.mainframe.theme.edit.CellStyleListEditPane;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
@ -55,6 +52,8 @@ import static com.fr.design.i18n.Toolkit.i18nText;
* Created by Starryi on 2021/8/13 * Created by Starryi on 2021/8/13
*/ */
public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane { public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane {
public static final int CONTENT_WIDTH = TemplateThemeListPane.CONTENT_WIDTH + 10;
public static final int CONTENT_HEIGHT = TemplateThemeListPane.CONTENT_HEIGHT + 37;
private final RemoveThemeAction removeAction; private final RemoveThemeAction removeAction;
private final UIButton setTheme4NewTemplateButton; private final UIButton setTheme4NewTemplateButton;
@ -94,6 +93,7 @@ public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane
private void initializePane() { private void initializePane() {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
add(createActionsContainer(), BorderLayout.NORTH); add(createActionsContainer(), BorderLayout.NORTH);
@ -102,7 +102,6 @@ public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane
nextContainer.add(new JSeparator(), BorderLayout.NORTH); nextContainer.add(new JSeparator(), BorderLayout.NORTH);
themeListPane.setPreferredSize(new Dimension(themeListPane.getPreferredSize().width, 490));
themeListPane.setSelectedChangeListener(new ChangeListener() { themeListPane.setSelectedChangeListener(new ChangeListener() {
@Override @Override
public void fireChanged(ChangeEvent event) { public void fireChanged(ChangeEvent event) {

12
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemePreviewPane.java

@ -22,6 +22,8 @@ import java.awt.image.BufferedImage;
*/ */
public abstract class TemplateThemePreviewPane<T extends TemplateTheme> extends JPanel implements CallbackEvent, ThemePreviewed<T> { public abstract class TemplateThemePreviewPane<T extends TemplateTheme> extends JPanel implements CallbackEvent, ThemePreviewed<T> {
private JPanel parent; private JPanel parent;
public static final int PREVIEW_WIDTH = 627;
public static final int PREVIEW_HEIGHT = 532;
public void setParent(JPanel parent) { public void setParent(JPanel parent) {
this.parent = parent; this.parent = parent;
@ -41,17 +43,9 @@ public abstract class TemplateThemePreviewPane<T extends TemplateTheme> extends
int thumbnailWidth = ThemeThumbnail.WIDTH; int thumbnailWidth = ThemeThumbnail.WIDTH;
int thumbnailHeight = ThemeThumbnail.HEIGHT; int thumbnailHeight = ThemeThumbnail.HEIGHT;
float thumbnailAspect = 1.0F * thumbnailWidth / thumbnailHeight;
int width = getWidth(); int width = getWidth();
int height = getHeight(); int height = getHeight();
float aspect = 1.0F * width / height;
if (thumbnailAspect > aspect) {
height = (int) (width / thumbnailAspect);
} else {
width = (int) (height * thumbnailAspect);
}
try { try {
// 使用TYPE_INT_RGB和new Color(255, 255, 255, 1)设置有透明背景buffer image, // 使用TYPE_INT_RGB和new Color(255, 255, 255, 1)设置有透明背景buffer image,
@ -85,7 +79,7 @@ public abstract class TemplateThemePreviewPane<T extends TemplateTheme> extends
@Override @Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
g.clearRect(0, 0, 517, 532); g.clearRect(0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT);
paintBackground((Graphics2D) g); paintBackground((Graphics2D) g);
} }

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

@ -7,6 +7,7 @@ import com.fr.base.theme.settings.ThemeThumbnail;
import com.fr.base.theme.settings.ThemedCellStyleList; import com.fr.base.theme.settings.ThemedCellStyleList;
import com.fr.base.theme.settings.ThemedChartStyle; import com.fr.base.theme.settings.ThemedChartStyle;
import com.fr.base.theme.settings.ThemedColorScheme; import com.fr.base.theme.settings.ThemedColorScheme;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
@ -26,6 +27,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.edit.ui.LabelUtils;
import com.fr.design.mainframe.theme.ui.BorderUtils; import com.fr.design.mainframe.theme.ui.BorderUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.CallBackAdaptor;
@ -44,6 +46,7 @@ import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Image; import java.awt.Image;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -63,12 +66,12 @@ import static com.fr.design.i18n.Toolkit.i18nText;
*/ */
public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends AbstractAttrNoScrollPane { public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends AbstractAttrNoScrollPane {
public static final int TITLE_BORDER_FONT = 12; public static final int TITLE_BORDER_FONT = 12;
public static final int LEFT_TITLE_PANE_WIDTH = 397; public static final int LEFT_TITLE_PANE_WIDTH = 627;
public static final int LEFT_TITLE_PANE_HEIGHT = 532 + TITLE_BORDER_FONT / 2 + 10; public static final int LEFT_TITLE_PANE_HEIGHT = 539;
public static final int PREVIEW_PANE_WIDTH = LEFT_TITLE_PANE_WIDTH - 10; public static final int PREVIEW_PANE_WIDTH = LEFT_TITLE_PANE_WIDTH - 10;
public static final int PREVIEW_PANE_HEIGHT = LEFT_TITLE_PANE_HEIGHT - TITLE_BORDER_FONT - 16; public static final int PREVIEW_PANE_HEIGHT = LEFT_TITLE_PANE_HEIGHT - TITLE_BORDER_FONT - 16;
public static final int RIGHT_PANE_WIDTH = 362; public static final int RIGHT_PANE_WIDTH = 352;
public static final int RIGHT_PANE_HEIGHT = LEFT_TITLE_PANE_HEIGHT; public static final int RIGHT_PANE_HEIGHT = LEFT_TITLE_PANE_HEIGHT;
public static final int COLOR_SCHEME_TITLE_PANE_WIDTH = 298; public static final int COLOR_SCHEME_TITLE_PANE_WIDTH = 298;
public static final int COLOR_SCHEME_TITLE_PANE_HEIGHT = 174 + TITLE_BORDER_FONT / 2; public static final int COLOR_SCHEME_TITLE_PANE_HEIGHT = 174 + TITLE_BORDER_FONT / 2;
@ -90,6 +93,8 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
private UIButton saveButton = new UIButton(); private UIButton saveButton = new UIButton();
private UIButton saveAsButton = new UIButton(); private UIButton saveAsButton = new UIButton();
private boolean refreshingThemedColor = false;
private boolean currentIsNewTheme; private boolean currentIsNewTheme;
private T theme; private T theme;
@ -142,19 +147,17 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
themePreviewPane = createThemePreviewPane(); themePreviewPane = createThemePreviewPane();
themePreviewPane.setPreferredSize(new Dimension(PREVIEW_PANE_WIDTH, PREVIEW_PANE_HEIGHT)); themePreviewPane.setPreferredSize(new Dimension(PREVIEW_PANE_WIDTH, PREVIEW_PANE_HEIGHT));
themePreviewPane.setPreferredSize(new Dimension(PREVIEW_PANE_WIDTH, PREVIEW_PANE_HEIGHT));
previewContainer.add(themePreviewPane, BorderLayout.CENTER); previewContainer.add(themePreviewPane, BorderLayout.CENTER);
return titleContainer; return titleContainer;
} }
private JPanel createRightPane() { private JPanel createRightPane() {
JPanel container = new JPanel(new BorderLayout(0, 12)); JPanel container = new JPanel(new BorderLayout(0, 0));
container.setPreferredSize(new Dimension(RIGHT_PANE_WIDTH, RIGHT_PANE_HEIGHT)); container.setPreferredSize(new Dimension(RIGHT_PANE_WIDTH, RIGHT_PANE_HEIGHT));
JPanel nameEditPane = createNameEditPane(); JPanel nameEditPane = createNameEditPane();
container.add(nameEditPane, BorderLayout.NORTH); container.add(nameEditPane, BorderLayout.NORTH);
JPanel settingPane = new JPanel(new BorderLayout(0, 10)); JPanel settingPane = new JPanel(new BorderLayout(0, IntervalConstants.INTERVAL_L1));
container.add(settingPane, BorderLayout.CENTER); container.add(settingPane, BorderLayout.CENTER);
settingPane.add(createColorSchemeEditPane(), BorderLayout.NORTH); settingPane.add(createColorSchemeEditPane(), BorderLayout.NORTH);
settingPane.add(createCustomEditorsPane(), BorderLayout.CENTER); settingPane.add(createCustomEditorsPane(), BorderLayout.CENTER);
@ -170,13 +173,6 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
} }
private JPanel createNameEditPane() { private JPanel createNameEditPane() {
JPanel container = new JPanel(new BorderLayout(30, 0));
container.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
container.add(LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Name")), BorderLayout.WEST);
JPanel settingContainer = new JPanel(new BorderLayout(10, 0));
container.add(settingContainer, BorderLayout.CENTER);
nameErrorLabel = LabelUtils.createLabel(StringUtils.EMPTY, Color.RED); nameErrorLabel = LabelUtils.createLabel(StringUtils.EMPTY, Color.RED);
nameErrorLabel.setVisible(false); nameErrorLabel.setVisible(false);
@ -187,14 +183,14 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
if (isEnabled()) { if (isEnabled()) {
checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, false, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton);
} }
} }
@Override @Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
if (isEnabled()) { if (isEnabled()) {
checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, false, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton);
} }
} }
@ -207,22 +203,26 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
@Override @Override
public void focusGained(FocusEvent e) { public void focusGained(FocusEvent e) {
if (isEnabled()) { if (isEnabled()) {
checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, false, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton);
} }
} }
@Override @Override
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
if (isEnabled()) { if (isEnabled()) {
checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, true, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton);
} }
} }
}); });
settingContainer.add(nameTextField, BorderLayout.WEST); double p = TableLayout.PREFERRED;
settingContainer.add(nameErrorLabel, BorderLayout.CENTER); JPanel container = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[] { LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Name")), nameTextField },
new Component[] { null, nameErrorLabel },
}, new double[] { 20, 20}, new double[] { p, 165}, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_W0);
container.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
return container; return container;
} }
private JPanel createColorSchemeEditPane() { private JPanel createColorSchemeEditPane() {
@ -265,8 +265,13 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
colorListPane.addColorChangeListener(new ChangeListener() { colorListPane.addColorChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
if (refreshingThemedColor) {
return;
}
List<Color> colors = colorListPane.update(); List<Color> colors = colorListPane.update();
refreshingThemedColor = true;
onColorSchemeChanged(colors); onColorSchemeChanged(colors);
refreshingThemedColor = false;
} }
}); });
@ -283,7 +288,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
return container; return container;
} }
public void addCustomEditorPane(String title, JComponent component) { public void addCustomEditorPane(String title, JComponent component) {
component.setPreferredSize(new Dimension(360, 260)); component.setPreferredSize(new Dimension(317, 239));
uiTabbedPane.addTab(title, component); uiTabbedPane.addTab(title, component);
} }
protected JPanel createCellStyleSettingPane() { protected JPanel createCellStyleSettingPane() {
@ -310,12 +315,12 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
public void onColorSchemeChanged(List<Color> colors) { public void onColorSchemeChanged(List<Color> colors) {
colorListExtendedPane.populate(colors); colorListExtendedPane.populate(colors);
FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors); FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors);
ThemedCellStyleList cellStyle = cellStyleSettingPane.updateBean(); T theme = updateBean();
FineColorManager.traverse(cellStyle, replaceByColorScheme);
FineColorManager.traverse(theme, replaceByColorScheme);
populateBean(theme);
ThemedChartStyle themedChartStyle = chartStyleSettingPane.updateBean(); //图表渐变色
FineColorManager.traverse(themedChartStyle, replaceByColorScheme);
chartStyleSettingPane.populateBean(themedChartStyle);
chartStyleSettingPane.populateGradientBar(colors); chartStyleSettingPane.populateGradientBar(colors);
} }
@ -389,7 +394,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
T theme = updateBean(); T theme = updateBean();
boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, nameTextField, nameErrorLabel, saveButton); boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(currentIsNewTheme, true, currentIsNewTheme, true, nameTextField, nameErrorLabel, saveButton);
if (canBeSaved && theme != null) { if (canBeSaved && theme != null) {
theme.setName(nameTextField.getText()); theme.setName(nameTextField.getText());
config.addTheme(theme, true, new CallBackAdaptor() { config.addTheme(theme, true, new CallBackAdaptor() {
@ -474,14 +479,14 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
if (isEnabled()) { if (isEnabled()) {
checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); checkThemeCanBeSavedAndUpdateUI(true, false, true, true, nameTextField, nameErrorLabel, confirmButton);
} }
} }
@Override @Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
if (isEnabled()) { if (isEnabled()) {
checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); checkThemeCanBeSavedAndUpdateUI(true, false, true, true, nameTextField, nameErrorLabel, confirmButton);
} }
} }
@ -494,14 +499,14 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
@Override @Override
public void focusGained(FocusEvent e) { public void focusGained(FocusEvent e) {
if (isEnabled()) { if (isEnabled()) {
checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); checkThemeCanBeSavedAndUpdateUI(true, false, true, true, nameTextField, nameErrorLabel, confirmButton);
} }
} }
@Override @Override
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
if (isEnabled()) { if (isEnabled()) {
checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); checkThemeCanBeSavedAndUpdateUI(true, true, true, true, nameTextField, nameErrorLabel, confirmButton);
} }
} }
}); });
@ -547,7 +552,7 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
FineLoggerFactory.getLogger().error(ex.getMessage(), ex); FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
return; return;
} }
boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(true, nameTextField, nameErrorLabel, confirmButton); boolean canBeSaved = checkThemeCanBeSavedAndUpdateUI(true, true, true, true, nameTextField, nameErrorLabel, confirmButton);
if (canBeSaved && newThemeObject != null) { if (canBeSaved && newThemeObject != null) {
newThemeObject.setName(name); newThemeObject.setName(name);
newThemeObject.setRemovable(true); newThemeObject.setRemovable(true);
@ -583,17 +588,28 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
private boolean isThemeNameDuplicated(String name) { private boolean isThemeNameDuplicated(String name) {
return config.cachedFetch(name) != null; return config.cachedFetch(name) != null;
} }
private boolean checkThemeCanBeSavedAndUpdateUI(boolean checkDuplicated, UITextField textField, UILabel errorLabel, UIButton... actionButtons) { private boolean checkThemeCanBeSavedAndUpdateUI(
String error = StringUtils.EMPTY; boolean checkEmpty,
boolean displayEmptyTip,
boolean checkDuplicated,
boolean displayDuplicatedTip,
UITextField textField,
UILabel errorLabel, UIButton... actionButtons) {
String name = textField.getText(); String name = textField.getText();
if (isThemeNameEmpty(name)) {
error = Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Empty_Name_Error_Tip"); boolean valid = true;
errorLabel.setText(StringUtils.EMPTY);
if (checkEmpty && isThemeNameEmpty(name)) {
valid = false;
if (displayEmptyTip) {
errorLabel.setText(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Empty_Name_Error_Tip"));
}
} else if (checkDuplicated && isThemeNameDuplicated(name)) { } else if (checkDuplicated && isThemeNameDuplicated(name)) {
error = Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Duplicated_Name_Error_Tip"); valid = false;
if (displayDuplicatedTip) {
errorLabel.setText(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Edit_Pane_Duplicated_Name_Error_Tip"));
}
} }
errorLabel.setText(error);
boolean valid = StringUtils.isEmpty(error);
errorLabel.setVisible(!valid); errorLabel.setVisible(!valid);
if (actionButtons != null && actionButtons.length > 0) { if (actionButtons != null && actionButtons.length > 0) {

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

@ -67,7 +67,7 @@ public abstract class TemplateThemeDialog extends JDialog {
private JPanel createActionsContainer(int align, UIButton... buttons) { private JPanel createActionsContainer(int align, UIButton... buttons) {
JPanel container = new JPanel(new FlowLayout(align, DIALOG_BOTTOM_ACTION_BUTTON_GAP, 0)); JPanel container = new JPanel(new FlowLayout(align, DIALOG_BOTTOM_ACTION_BUTTON_GAP, 0));
int paddingVertical = (DIALOG_BOTTOM_ACTION_BAR_HEIGHT - DIALOG_BOTTOM_ACTION_BUTTON_HEIGHT) / 2; int paddingVertical = getPaddingVertical();
container.setBorder(BorderFactory.createEmptyBorder(paddingVertical, 0, paddingVertical, 0)); container.setBorder(BorderFactory.createEmptyBorder(paddingVertical, 0, paddingVertical, 0));
if (buttons == null || buttons.length == 0) { if (buttons == null || buttons.length == 0) {
@ -84,6 +84,12 @@ public abstract class TemplateThemeDialog extends JDialog {
return container; return container;
} }
protected int getPaddingVertical(){
return (DIALOG_BOTTOM_ACTION_BAR_HEIGHT - DIALOG_BOTTOM_ACTION_BUTTON_HEIGHT) / 2;
}
private JPanel createActionsContainer(UIButton[] leftButtons, UIButton[] rightButtons) { private JPanel createActionsContainer(UIButton[] leftButtons, UIButton[] rightButtons) {
JPanel leftPane = createActionsContainer(FlowLayout.LEFT, leftButtons); JPanel leftPane = createActionsContainer(FlowLayout.LEFT, leftButtons);
JPanel rightPane = createActionsContainer(FlowLayout.RIGHT, rightButtons); JPanel rightPane = createActionsContainer(FlowLayout.RIGHT, rightButtons);

15
designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java

@ -10,11 +10,13 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.theme.TemplateThemeListPane;
import com.fr.design.mainframe.theme.TemplateThemeManagePane; import com.fr.design.mainframe.theme.TemplateThemeManagePane;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Window; import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -25,13 +27,12 @@ import java.awt.event.ActionListener;
* Created by Starryi on 2021/8/13 * Created by Starryi on 2021/8/13
*/ */
public class TemplateThemeManageDialog extends TemplateThemeDialog { public class TemplateThemeManageDialog extends TemplateThemeDialog {
public static final int CONTENT_WIDTH = 660;
public static final int CONTENT_HEIGHT = 570;
private final TemplateThemeManageDialogContentPane contentPane; private final TemplateThemeManageDialogContentPane contentPane;
public TemplateThemeManageDialog(Window parent) { public TemplateThemeManageDialog(Window parent) {
super(parent, Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Title"), CONTENT_WIDTH, CONTENT_HEIGHT); super(parent, Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Title"),
TemplateThemeManageDialogContentPane.CONTENT_WIDTH, TemplateThemeManageDialogContentPane.CONTENT_HEIGHT);
contentPane = new TemplateThemeManageDialogContentPane(); contentPane = new TemplateThemeManageDialogContentPane();
setContentPane(createDialogContentPane(contentPane, new UIButton[]{ createCompleteButton() })); setContentPane(createDialogContentPane(contentPane, new UIButton[]{ createCompleteButton() }));
@ -55,12 +56,16 @@ public class TemplateThemeManageDialog extends TemplateThemeDialog {
} }
public static class TemplateThemeManageDialogContentPane extends JPanel { public static class TemplateThemeManageDialogContentPane extends JPanel {
public static final int CONTENT_WIDTH = TemplateThemeManagePane.CONTENT_WIDTH + 24;
public static final int CONTENT_HEIGHT = TemplateThemeManagePane.CONTENT_HEIGHT + 40;
private final TemplateThemeManagePane<FormTheme> formThemesManagerPane; private final TemplateThemeManagePane<FormTheme> formThemesManagerPane;
private final TemplateThemeManagePane<ReportTheme> reportThemesManagerPane; private final TemplateThemeManagePane<ReportTheme> reportThemesManagerPane;
public TemplateThemeManageDialogContentPane() { public TemplateThemeManageDialogContentPane() {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
setPreferredSize(new Dimension(CONTENT_WIDTH, CONTENT_HEIGHT));
UITabbedPane tabbedPane = new UITabbedPane(); UITabbedPane tabbedPane = new UITabbedPane();
add(tabbedPane, BorderLayout.NORTH); add(tabbedPane, BorderLayout.NORTH);
@ -70,8 +75,8 @@ public class TemplateThemeManageDialog extends TemplateThemeDialog {
reportThemesManagerPane = TemplateThemeManagePane.createReportThemesManagerPane(); reportThemesManagerPane = TemplateThemeManagePane.createReportThemesManagerPane();
reportThemesManagerPane.startListenThemeConfig(); reportThemesManagerPane.startListenThemeConfig();
tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_FORM_TAB"), formThemesManagerPane); tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Form_Tab"), formThemesManagerPane);
tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_REPORT_TAB"), reportThemesManagerPane); tabbedPane.addTab(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Manager_Dialog_Report_Tab"), reportThemesManagerPane);
tabbedPane.setSelectedIndex(0); tabbedPane.setSelectedIndex(0);
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();

82
designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeProfileDialog.java

@ -4,15 +4,7 @@ import com.fr.base.theme.TemplateTheme;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.theme.TemplateThemeProfilePane; import com.fr.design.mainframe.theme.TemplateThemeProfilePane;
import com.fr.file.FILE;
import com.fr.file.FILEChooserPane;
import com.fr.file.FileFILE;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ListSet;
import com.fr.stable.xml.XMLPrintWriter;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -21,10 +13,6 @@ import java.awt.Dimension;
import java.awt.Window; import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List; import java.util.List;
/** /**
@ -33,11 +21,11 @@ import java.util.List;
* Created by Starryi on 2021/8/13 * Created by Starryi on 2021/8/13
*/ */
public class TemplateThemeProfileDialog<T extends TemplateTheme> extends TemplateThemeDialog { public class TemplateThemeProfileDialog<T extends TemplateTheme> extends TemplateThemeDialog {
private static final int PADDING_VERTICAL = 4;
public static TemplateThemeProfilePane<? extends TemplateTheme> currentVisibleProfilePane; public static TemplateThemeProfilePane<? extends TemplateTheme> currentVisibleProfilePane;
public static final int CONTENT_WIDTH = 910; public static final int CONTENT_WIDTH = 1000;
public static final int CONTENT_HEIGHT = 570; public static final int CONTENT_HEIGHT = 542;
public TemplateThemeProfileDialog(Window parent, TemplateThemeProfilePane<T> profilePane) { public TemplateThemeProfileDialog(Window parent, TemplateThemeProfilePane<T> profilePane) {
super(parent, profilePane.getTitle(), CONTENT_WIDTH, CONTENT_HEIGHT); super(parent, profilePane.getTitle(), CONTENT_WIDTH, CONTENT_HEIGHT);
@ -47,9 +35,6 @@ public class TemplateThemeProfileDialog<T extends TemplateTheme> extends Templat
content.add(profilePane, BorderLayout.CENTER); content.add(profilePane, BorderLayout.CENTER);
setContentPane(createDialogContentPane(content, new UIButton[]{ setContentPane(createDialogContentPane(content, new UIButton[]{
// 用于视觉设计师导出内置主题文件,发布前关闭
// 后续由产品经理决定是否开启此功能
createExportButton(profilePane),
profilePane.createSaveButton(), profilePane.createSaveButton(),
profilePane.createSaveAsButton(this), profilePane.createSaveAsButton(this),
createCancelButton() createCancelButton()
@ -58,63 +43,6 @@ public class TemplateThemeProfileDialog<T extends TemplateTheme> extends Templat
currentVisibleProfilePane = profilePane; currentVisibleProfilePane = profilePane;
} }
private void exportTheme(T theme) {
FILEChooserPane fileChooser = FILEChooserPane.getInstance(true, true, new ChooseFileFilter() {
@Override
public boolean accept(FILE f) {
return f.isDirectory();
}
@Override
public String getDescription() {
return "export theme to xml";
}
@Override
public boolean containsExtension(String extension) {
return true;
}
@Override
public String toString() {
return getDescription();
}
});
fileChooser.setCurrentDirectory(new FileFILE(new File("~/")));
fileChooser.setFileNameTextField(theme.getName(), ".xml");
FILE exportedFile = null;
int result = fileChooser.showSaveDialog(DesignerContext.getDesignerFrame(), ".xml");
if (result == FILEChooserPane.JOPTIONPANE_OK_OPTION || result == FILEChooserPane.OK_OPTION) {
exportedFile = fileChooser.getSelectedFILE();
}
if (exportedFile == null) {
return;
}
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(exportedFile.getPath()))) {
XMLPrintWriter writer = XMLPrintWriter.create(bos);
theme.writeXML(writer);
writer.flush();
writer.close();
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
public UIButton createExportButton(TemplateThemeProfilePane<T> profilePane) {
UIButton exportButton = new UIButton();
exportButton.setText(Toolkit.i18nText("Fine-Design_Basic_Export"));
exportButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
T theme = profilePane.updateBean();
theme.getImageIdList().setIdList(new ListSet<>());
exportTheme(theme);
}
});
return exportButton;
}
private UIButton createCancelButton() { private UIButton createCancelButton() {
UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel"));
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
@ -142,4 +70,8 @@ public class TemplateThemeProfileDialog<T extends TemplateTheme> extends Templat
public static boolean isEditingTheme() { public static boolean isEditingTheme() {
return currentVisibleProfilePane != null; return currentVisibleProfilePane != null;
} }
protected int getPaddingVertical(){
return PADDING_VERTICAL;
}
} }

69
designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java

@ -1,9 +1,8 @@
package com.fr.design.mainframe.theme.dialog; package com.fr.design.mainframe.theme.dialog;
import com.fr.base.theme.ThemedTemplate;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.TemplateThemeConfig;
import com.fr.design.base.mode.DesignModeContext; import com.fr.base.theme.ThemedTemplate;
import com.fr.design.event.ChangeEvent; import com.fr.design.event.ChangeEvent;
import com.fr.design.event.ChangeListener; import com.fr.design.event.ChangeListener;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -11,7 +10,6 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.theme.TemplateThemeListPane; import com.fr.design.mainframe.theme.TemplateThemeListPane;
import com.fr.design.mainframe.theme.ui.BorderUtils; import com.fr.design.mainframe.theme.ui.BorderUtils;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -29,8 +27,8 @@ import java.awt.event.ActionListener;
*/ */
public class public class
TemplateThemeUsingDialog<T extends TemplateTheme> extends TemplateThemeDialog { TemplateThemeUsingDialog<T extends TemplateTheme> extends TemplateThemeDialog {
public static final int CONTENT_WIDTH = 660; public static final int CONTENT_WIDTH = TemplateThemeListPane.CONTENT_WIDTH + 42;
public static final int CONTENT_HEIGHT = 515; public static final int CONTENT_HEIGHT = TemplateThemeListPane.CONTENT_HEIGHT + 23;
private final TemplateThemeListPane<T> themeListPane; private final TemplateThemeListPane<T> themeListPane;
private final ThemedTemplate currentTemplate; private final ThemedTemplate currentTemplate;
@ -43,54 +41,25 @@ TemplateThemeUsingDialog<T extends TemplateTheme> extends TemplateThemeDialog {
JPanel content = createContent(); JPanel content = createContent();
UIButton openThemeManagerButton = createOpenThemeManagerButton(); UIButton openThemeManagerButton = createOpenThemeManagerButton();
UIButton usingCurrentThemeButton = createUsingCurrentThemeButton();
UIButton completeButton = createCompleteButton(); UIButton completeButton = createCompleteButton();
setContentPane(createDialogContentPane(content, setContentPane(createDialogContentPane(content,
new UIButton[]{ openThemeManagerButton }, new UIButton[]{ openThemeManagerButton },
new UIButton[]{ usingCurrentThemeButton, completeButton } new UIButton[]{ completeButton }
)); ));
themeListPane.startListenThemeConfig(); themeListPane.startListenThemeConfig();
resetEnableCurrentThemeButton(themeListPane.getSelectedTheme(), usingCurrentThemeButton);
themeListPane.setSelectedChangeListener(new ChangeListener() { themeListPane.setSelectedChangeListener(new ChangeListener() {
@Override @Override
public void fireChanged(ChangeEvent event) { public void fireChanged(ChangeEvent event) {
resetEnableCurrentThemeButton(themeListPane.getSelectedTheme(), usingCurrentThemeButton); TemplateTheme theme = themeListPane.getSelectedTheme();
} if (theme != null) {
}); currentTemplate.setTemplateTheme(theme);
} themeListPane.repaint();
private void resetEnableCurrentThemeButton(T selectedTheme, UIButton usingCurrentThemeButton) {
if (selectedTheme == null) {
usingCurrentThemeButton.setEnabled(false);
return;
}
String selectedThemeName = selectedTheme.getName();
if (StringUtils.isEmpty(selectedThemeName)) {
usingCurrentThemeButton.setEnabled(false);
return;
}
if (currentTemplate == null) {
usingCurrentThemeButton.setEnabled(false);
return;
}
TemplateTheme templateUsingTheme = currentTemplate.getTemplateTheme();
if (templateUsingTheme == null) {
usingCurrentThemeButton.setEnabled(true);
return;
} }
String templateUsingThemeName = templateUsingTheme.getName();
if (StringUtils.isEmpty(templateUsingThemeName)) {
usingCurrentThemeButton.setEnabled(true);
return;
} }
});
usingCurrentThemeButton.setEnabled(!StringUtils.equals(templateUsingThemeName, selectedTheme.getName()));
} }
private JPanel createContent() { private JPanel createContent() {
@ -123,17 +92,6 @@ TemplateThemeUsingDialog<T extends TemplateTheme> extends TemplateThemeDialog {
return null; return null;
} }
private UIButton createUsingCurrentThemeButton() {
UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Using_Dialog_Use"));
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
apply2CurrentTemplate(button);
}
});
return button;
}
private UIButton createCompleteButton() { private UIButton createCompleteButton() {
UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Using_Dialog_Complete")); UIButton button = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Template_Theme_Using_Dialog_Complete"));
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
@ -150,13 +108,4 @@ TemplateThemeUsingDialog<T extends TemplateTheme> extends TemplateThemeDialog {
themeListPane.stopAsyncFetchTheme(); themeListPane.stopAsyncFetchTheme();
super.exit(); super.exit();
} }
private void apply2CurrentTemplate(UIButton usingCurrentThemeButton) {
TemplateTheme theme = themeListPane.getSelectedTheme();
if (theme != null) {
currentTemplate.setTemplateTheme(theme);
themeListPane.repaint();
usingCurrentThemeButton.setEnabled(false);
}
}
} }

25
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java

@ -173,6 +173,8 @@ public class CellStyleListEditPane extends JListControlPane {
return; return;
} }
int oldSelectedIndex = getSelectedIndex();
List<NameObject> nameObjectList = new ArrayList<>(); List<NameObject> nameObjectList = new ArrayList<>();
List<ThemedCellStyle> cellStyleList = ob.getCellStyleList(); List<ThemedCellStyle> cellStyleList = ob.getCellStyleList();
@ -185,9 +187,16 @@ public class CellStyleListEditPane extends JListControlPane {
populate(nameObjectArray); populate(nameObjectArray);
int newSelectedIndex = oldSelectedIndex;
if (newSelectedIndex >= nameObjectArray.length) {
newSelectedIndex = 0;
}
setSelectedIndex(newSelectedIndex);
} }
public ThemedCellStyleList updateBean() { public ThemedCellStyleList updateBean() {
nameableList.stopEditing();
Nameable[] nameables = this.update(); Nameable[] nameables = this.update();
ThemedCellStyleList styleConfig = new ThemedCellStyleList(); ThemedCellStyleList styleConfig = new ThemedCellStyleList();
for (Nameable nameable : nameables) { for (Nameable nameable : nameables) {
@ -220,7 +229,7 @@ public class CellStyleListEditPane extends JListControlPane {
if (selectModel != null) { if (selectModel != null) {
NameObject selectNameObject = (NameObject) selectModel.wrapper; NameObject selectNameObject = (NameObject) selectModel.wrapper;
ThemedCellStyle cellStyle = (ThemedCellStyle) (selectNameObject.getObject()); ThemedCellStyle cellStyle = (ThemedCellStyle) (selectNameObject.getObject());
this.shortCut.setEnabled(cellStyle.isRemovable() && !cellStyle.isDefault4New()); this.shortCut.setEnabled(cellStyle.isRemovable() && !cellStyle.isUse4Default());
} else { } else {
this.shortCut.setEnabled(false); this.shortCut.setEnabled(false);
} }
@ -257,9 +266,13 @@ public class CellStyleListEditPane extends JListControlPane {
cellStyle.setName(menuName); cellStyle.setName(menuName);
cellStyle.setStyle(Style.getInstance()); cellStyle.setStyle(Style.getInstance());
cellStyle.setRemovable(true); cellStyle.setRemovable(true);
cellStyle.setImmutable(true); cellStyle.setUse4Default(false);
cellStyle.setDefault4Absent(false); cellStyle.setUse4BigTitle(false);
cellStyle.setDefault4New(false); cellStyle.setUse4SmallTitle(false);
cellStyle.setUse4Header(false);
cellStyle.setUse4MainText(false);
cellStyle.setUse4SupportInfo(false);
cellStyle.setUse4HighlightText(false);
return new NameObject(helper.createUnrepeatedName(this.menuName()), cellStyle); return new NameObject(helper.createUnrepeatedName(this.menuName()), cellStyle);
} }
@ -276,7 +289,7 @@ public class CellStyleListEditPane extends JListControlPane {
} }
public boolean acceptNameObject(Object ob) { public boolean acceptNameObject(Object ob) {
return !((ThemedCellStyle) ob).isDefault4New(); return !((ThemedCellStyle) ob).isUse4Default();
} }
} }
@ -288,7 +301,7 @@ public class CellStyleListEditPane extends JListControlPane {
@Override @Override
public boolean acceptNameObject(Object ob) { public boolean acceptNameObject(Object ob) {
return ((ThemedCellStyle) ob).isDefault4New(); return ((ThemedCellStyle) ob).isUse4Default();
} }
} }
} }

15
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ComponentStyleEditPane.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.theme.edit;
import com.fr.base.theme.settings.ThemedComponentStyle; import com.fr.base.theme.settings.ThemedComponentStyle;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.AttrScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.style.ComponentBodyStylePane; import com.fr.design.gui.style.ComponentBodyStylePane;
import com.fr.design.gui.style.ComponentIntegralStylePane; import com.fr.design.gui.style.ComponentIntegralStylePane;
@ -113,7 +114,7 @@ public class ComponentStyleEditPane extends JPanel {
} }
} }
private JComponent createTabContainer(final JComponent component) { private JComponent createTabContainer(final JPanel component) {
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane();
container.setPreferredSize(new Dimension(container.getPreferredSize().width, 220)); container.setPreferredSize(new Dimension(container.getPreferredSize().width, 220));
@ -123,12 +124,12 @@ public class ComponentStyleEditPane extends JPanel {
tipLabelPane.add(tipLabel); tipLabelPane.add(tipLabel);
container.add(tipLabelPane, BorderLayout.NORTH); container.add(tipLabelPane, BorderLayout.NORTH);
JScrollPane scrollPane = new JScrollPane(component); container.add(new AttrScrollPane() {
scrollPane.setPreferredSize(new Dimension(container.getPreferredSize().width, 220)); @Override
scrollPane.setBorder(BorderFactory.createEmptyBorder()); protected JPanel createContentPane() {
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); return component;
}
container.add(scrollPane, BorderLayout.CENTER); }, BorderLayout.CENTER);
return container; return container;

53
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java

@ -1,8 +1,7 @@
package com.fr.design.mainframe.theme.edit.cell; package com.fr.design.mainframe.theme.edit.cell;
import com.fr.base.ScreenResolution;
import com.fr.base.Style;
import com.fr.base.theme.settings.ThemedCellStyle; import com.fr.base.theme.settings.ThemedCellStyle;
import com.fr.design.cell.CellStylePreviewPane;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.AttrScrollPane; import com.fr.design.dialog.AttrScrollPane;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -18,12 +17,9 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.theme.ui.BorderUtils; import com.fr.design.mainframe.theme.ui.BorderUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -39,7 +35,7 @@ import static com.fr.design.i18n.Toolkit.i18nText;
*/ */
public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> { public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
private ThemedCellStyle cellStyle; private ThemedCellStyle cellStyle;
private PreviewArea previewArea; private CellStylePreviewPane previewArea;
private boolean populating; private boolean populating;
private AttributeChangeListener attributeChangeListener; private AttributeChangeListener attributeChangeListener;
@ -78,7 +74,7 @@ public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
for (BasicPane basicPane : paneList) { for (BasicPane basicPane : paneList) {
((AbstractBasicStylePane) basicPane).populateBean(ob.getStyle()); ((AbstractBasicStylePane) basicPane).populateBean(ob.getStyle());
previewArea.preview(ob.getStyle()); previewArea.setStyle(ob.getStyle());
} }
this.populating = false; this.populating = false;
} }
@ -112,7 +108,8 @@ public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
jPanel.setLayout(new BorderLayout(0, 4)); jPanel.setLayout(new BorderLayout(0, 4));
JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
previewArea = new PreviewArea(); previewArea = new CellStylePreviewPane();
previewArea.setPreferredSize(new Dimension(223, 30));
previewPane.setBorder(BorderUtils.createTitleBorder(i18nText("Fine-Design_Basic_Preview"))); previewPane.setBorder(BorderUtils.createTitleBorder(i18nText("Fine-Design_Basic_Preview")));
previewPane.add(previewArea, BorderLayout.CENTER); previewPane.add(previewArea, BorderLayout.CENTER);
@ -138,7 +135,7 @@ public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
} }
ThemedCellStyle cellStyle = updateBean(); ThemedCellStyle cellStyle = updateBean();
if (cellStyle != null) { if (cellStyle != null) {
previewArea.preview(cellStyle.getStyle()); previewArea.setStyle(cellStyle.getStyle());
} }
fireAttrChangeListener(); fireAttrChangeListener();
} }
@ -157,42 +154,4 @@ public class CellStyleEditPane extends MultiTabPane<ThemedCellStyle> {
@Override @Override
public void updateBean(ThemedCellStyle ob) {} public void updateBean(ThemedCellStyle ob) {}
private static class PreviewArea extends JComponent {
private static final String paintText = "Report";
private Style style = Style.DEFAULT_STYLE;
public PreviewArea() {
setPreferredSize(new Dimension(223, 30));
}
public void preview(Style style) {
this.style = style;
repaint();
}
@Override
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
int resolution = ScreenResolution.getScreenResolution();
if (style == Style.DEFAULT_STYLE) {
// 如果是默认的style,就只写"Report"上去
Style.paintContent(g2d, paintText, style, getWidth() - 3, getHeight() - 3, resolution);
return;
}
Style.paintBackground(g2d, style, getWidth() - 3, getHeight() - 3);
Style.paintContent(g2d, paintText, style, getWidth() - 3, getHeight() - 3, resolution);
Style.paintBorder(g2d, style, getWidth() - 3, getHeight() - 3);
}
@Override
public Dimension getMinimumSize() {
return getPreferredSize();
}
}
} }

7
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListExtendedPane.java

@ -66,10 +66,7 @@ public class ColorListExtendedPane extends JPanel implements MouseListener {
public void populate(List<Color> colors) { public void populate(List<Color> colors) {
if (colors.size() > 0) { if (colors.size() > 0) {
colorList.clear(); colorList.clear();
for (int i = 0; i < colorCount; i++) { colorList.addAll(colors);
Color color = colors.get(i % colorCount);
colorList.add(color);
}
repaint(); repaint();
} }
} }
@ -132,7 +129,7 @@ public class ColorListExtendedPane extends JPanel implements MouseListener {
super.paint(g); super.paint(g);
Color oldColor = g.getColor(); Color oldColor = g.getColor();
for (int i = 0; i < colorList.size(); i++) { for (int i = 0; i < colorCount; i++) {
int x = i * (boxSize + boxGap); int x = i * (boxSize + boxGap);
for (int j = 0; j < extendedCount; j++) { for (int j = 0; j < extendedCount; j++) {
Color color = extendedColorComputer.computeExtendedColor(colorList.get(i), j, extendedCount); Color color = extendedColorComputer.computeExtendedColor(colorList.get(i), j, extendedCount);

9
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java

@ -88,12 +88,15 @@ public class ColorListPane extends JPanel implements UIObserver {
} }
public void populate(List<Color> colors) { public void populate(List<Color> colors) {
for (int i = 0; i < colors.size() && i < colorList.size(); i++) { colorList.clear();
Color color = colors.get(i % colorCount); for (int i = 0; i < colors.size(); i++) {
colorList.set(i, color); Color color = colors.get(i);
colorList.add(color);
if (i < colorCount) {
colorButtons.get(i).setSelectObject(color); colorButtons.get(i).setSelectObject(color);
} }
} }
}
public List<Color> update() { public List<Color> update() {
return new ArrayList<>(colorList); return new ArrayList<>(colorList);

4
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ChartComponentPreviewPane.java

@ -12,8 +12,8 @@ import java.awt.Component;
public class ChartComponentPreviewPane extends ComponentPreviewPane implements ThemePreviewed<FormTheme> { public class ChartComponentPreviewPane extends ComponentPreviewPane implements ThemePreviewed<FormTheme> {
private ChartPreviewPane contentPane; private ChartPreviewPane contentPane;
public ChartComponentPreviewPane(boolean showTitle) { public ChartComponentPreviewPane(String title) {
super(showTitle); super(title);
} }
@Override @Override

56
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java

@ -6,7 +6,6 @@ import com.fr.base.background.ImageBackground;
import com.fr.base.theme.FormTheme; import com.fr.base.theme.FormTheme;
import com.fr.base.theme.settings.ThemedComponentStyle; import com.fr.base.theme.settings.ThemedComponentStyle;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.Label; import com.fr.form.ui.Label;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
@ -15,20 +14,26 @@ import com.fr.general.Background;
import com.fr.general.act.BorderPacker; import com.fr.general.act.BorderPacker;
import com.fr.general.act.TitlePacker; import com.fr.general.act.TitlePacker;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.border.Border; import javax.swing.border.Border;
import javax.swing.border.LineBorder;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Composite; import java.awt.Composite;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Image; import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.Shape; import java.awt.Shape;
import java.awt.Stroke;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
@ -38,21 +43,21 @@ import java.awt.geom.RoundRectangle2D;
* Created by Starryi on 2021/8/13 * Created by Starryi on 2021/8/13
*/ */
public abstract class ComponentPreviewPane extends UINoOpaquePanel implements ThemePreviewed<FormTheme> { public abstract class ComponentPreviewPane extends UINoOpaquePanel implements ThemePreviewed<FormTheme> {
public static final int TITLE_HEIGHT = 35; public static final int TITLE_HEIGHT = 46;
private final JPanel container; private final JPanel container;
private TitleDemoPane titlePane; private TitleDemoPane titlePane;
private BorderPacker style = new LayoutBorderStyle(); private BorderPacker style = new LayoutBorderStyle();
public ComponentPreviewPane(){ public ComponentPreviewPane(){
this(false); this(StringUtils.EMPTY);
} }
public ComponentPreviewPane(boolean showTitle) { public ComponentPreviewPane(String title) {
container = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane(); container = FRGUIPaneFactory.createBorderLayout_NO_Opaque_Pane();
setLayout(new BorderLayout()); setLayout(new BorderLayout());
if (showTitle) { if (StringUtils.isNotEmpty(title)) {
titlePane = new TitleDemoPane(); titlePane = new TitleDemoPane(title);
titlePane.setPreferredSize(new Dimension(517, TITLE_HEIGHT)); titlePane.setPreferredSize(new Dimension(517, TITLE_HEIGHT));
container.add(titlePane, BorderLayout.NORTH); container.add(titlePane, BorderLayout.NORTH);
} }
@ -67,7 +72,11 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
ThemedComponentStyle componentStyle = theme.getComponentStyle(); ThemedComponentStyle componentStyle = theme.getComponentStyle();
style = componentStyle.getStyle(); style = componentStyle.getStyle();
if (style.getBorder() == 0) {
setBorder(null);
} else {
setBorder(new UIRoundedBorder(style.getBorder(), style.getColor(), style.getBorderRadius())); setBorder(new UIRoundedBorder(style.getBorder(), style.getColor(), style.getBorderRadius()));
}
int paddingTop = componentStyle.getPaddingTop(); int paddingTop = componentStyle.getPaddingTop();
int paddingBottom = componentStyle.getPaddingBottom(); int paddingBottom = componentStyle.getPaddingBottom();
@ -100,6 +109,11 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
private static class TitleDemoPane extends UINoOpaquePanel { private static class TitleDemoPane extends UINoOpaquePanel {
private final Label data = new Label(); private final Label data = new Label();
private String title = StringUtils.EMPTY;
public TitleDemoPane(String title){
this.title = title;
}
public void refresh(ThemedComponentStyle componentStyle) { public void refresh(ThemedComponentStyle componentStyle) {
BorderPacker borderPacker = componentStyle.getStyle(); BorderPacker borderPacker = componentStyle.getStyle();
@ -116,8 +130,10 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
data.setInsetImagePadding(titlePacker.getInsetImagePadding()); data.setInsetImagePadding(titlePacker.getInsetImagePadding());
data.setInsetRelativeTextLeft(titlePacker.isInsetRelativeTextLeft()); data.setInsetRelativeTextLeft(titlePacker.isInsetRelativeTextLeft());
data.setInsetRelativeTextRight(titlePacker.isInsetRelativeTextRight()); data.setInsetRelativeTextRight(titlePacker.isInsetRelativeTextRight());
this.setBorder(new BottomLineBorder(componentStyle.getStyle().getColor(), componentStyle.getStyle().getBorder()));
} }
@Override @Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
@ -134,7 +150,7 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
BaseUtils.drawStringStyleInRotation(g2d, BaseUtils.drawStringStyleInRotation(g2d,
getWidth(), getHeight(), getWidth(), getHeight(),
data.getWidgetValue().toString(), title,
Style.getInstance(data.getFont()) Style.getInstance(data.getFont())
.deriveHorizontalAlignment(data.getTextalign()) .deriveHorizontalAlignment(data.getTextalign())
.deriveVerticalAlignment(data.isVerticalCenter() ? SwingConstants.CENTER : SwingConstants.TOP) .deriveVerticalAlignment(data.isVerticalCenter() ? SwingConstants.CENTER : SwingConstants.TOP)
@ -145,6 +161,32 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
} }
public static class BottomLineBorder extends LineBorder {
private BottomLineBorder(Color color, int thickness) {
super(color, thickness);
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Graphics2D g2d = (Graphics2D) g;
Color oldColor = g2d.getColor();
Stroke oldStroke = g2d.getStroke();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(getLineColor());
g2d.setStroke(new BasicStroke(getThickness() * 2));
g2d.drawLine(0, height, width, height);
g2d.setStroke(oldStroke);
g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
private static class Utils { private static class Utils {
private static void paintBackground(Graphics2D g2d, Background background, Shape shape, float opacity) { private static void paintBackground(Graphics2D g2d, Background background, Shape shape, float opacity) {
if (background != null) { if (background != null) {

16
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java

@ -33,6 +33,8 @@ import java.awt.Dimension;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import static com.fr.design.i18n.Toolkit.i18nText;
/** /**
* @author Starryi * @author Starryi
* @version 1.0 * @version 1.0
@ -59,28 +61,28 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane<FormTheme> {
chartContent.setLayout(new BorderLayout()); chartContent.setLayout(new BorderLayout());
JPanel columnChartPanel = new UINoOpaquePanel() { JPanel columnChartPanel = new UINoOpaquePanel() {
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(300, 368); return new Dimension(379, 314);
} }
}; };
columnChartPanel.setLayout(new BorderLayout()); columnChartPanel.setLayout(new BorderLayout());
columnChartPreviewPane = createChartPreviewPane(initColumnChart(), 300, 368); columnChartPreviewPane = createChartPreviewPane(initColumnChart(), i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Column_Title"));
columnChartPanel.add(columnChartPreviewPane, BorderLayout.CENTER); columnChartPanel.add(columnChartPreviewPane, BorderLayout.CENTER);
JPanel pieChartPanel = new UINoOpaquePanel() { JPanel pieChartPanel = new UINoOpaquePanel() {
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(217, 368); return new Dimension(236, 314);
} }
}; };
pieChartPanel.setLayout(new BorderLayout()); pieChartPanel.setLayout(new BorderLayout());
pieChartPreviewPane = createChartPreviewPane(initPieChart(), 217, 368); pieChartPreviewPane = createChartPreviewPane(initPieChart(), i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_Pie_Title"));
pieChartPanel.add(pieChartPreviewPane, BorderLayout.CENTER); pieChartPanel.add(pieChartPreviewPane, BorderLayout.CENTER);
chartContent.add(columnChartPanel, BorderLayout.CENTER); chartContent.add(columnChartPanel, BorderLayout.CENTER);
chartContent.add(pieChartPanel, BorderLayout.EAST); chartContent.add(pieChartPanel, BorderLayout.EAST);
return chartContent; return chartContent;
} }
private ChartComponentPreviewPane createChartPreviewPane(ChartCollection chartCollection, int width, int height) { private ChartComponentPreviewPane createChartPreviewPane(ChartCollection chartCollection, String title) {
ChartComponentPreviewPane chartComponentPreviewPane = new ChartComponentPreviewPane(true); ChartComponentPreviewPane chartComponentPreviewPane = new ChartComponentPreviewPane(title);
chartComponentPreviewPane.getContentPane().populate(chartCollection); chartComponentPreviewPane.getContentPane().populate(chartCollection);
chartComponentPreviewPane.getContentPane().setCallbackEvent(this); chartComponentPreviewPane.getContentPane().setCallbackEvent(this);
return chartComponentPreviewPane; return chartComponentPreviewPane;
@ -103,7 +105,7 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane<FormTheme> {
} }
Composite oldComposite = g2d.getComposite(); Composite oldComposite = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha));
background.paint(g2d, new Rectangle2D.Double(0, 0, 517, 532)); background.paint(g2d, new Rectangle2D.Double(0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT));
g2d.setComposite(oldComposite); g2d.setComposite(oldComposite);
} }

2
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java

@ -60,7 +60,7 @@ public class ReportThemePreviewPane extends TemplateThemePreviewPane<ReportTheme
if (background == null) { if (background == null) {
background = ColorBackground.getInstance(Color.WHITE); background = ColorBackground.getInstance(Color.WHITE);
} }
background.paint(g2d, new Rectangle2D.Double(0, 0, 517, 532)); background.paint(g2d, new Rectangle2D.Double(0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT));
} }

19
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/AbstractECPreviewPane.java

@ -4,38 +4,35 @@ import com.fr.base.Style;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.settings.ThemedCellStyle; import com.fr.base.theme.settings.ThemedCellStyle;
import com.fr.base.theme.settings.ThemedCellStyleList; import com.fr.base.theme.settings.ThemedCellStyleList;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.theme.preview.ThemePreviewed; import com.fr.design.mainframe.theme.preview.ThemePreviewed;
import com.fr.design.mainframe.theme.preview.UINoOpaquePanel; import com.fr.design.mainframe.theme.preview.UINoOpaquePanel;
import com.fr.design.mainframe.theme.preview.ecpreview.cell.AbstractPreviewCell; import com.fr.design.mainframe.theme.preview.ecpreview.cell.AbstractPreviewCell;
import com.fr.design.mainframe.theme.preview.ecpreview.cell.PreviewCell;
import javax.swing.JPanel;
import java.util.List; import java.util.List;
public abstract class AbstractECPreviewPane extends UINoOpaquePanel implements ThemePreviewed<TemplateTheme> { public abstract class AbstractECPreviewPane extends UINoOpaquePanel implements ThemePreviewed<TemplateTheme> {
protected Style getReportHeaderStyle(ThemedCellStyleList cellStyleList) { protected Style getReportHeaderStyle(ThemedCellStyleList cellStyleList) {
return getCellStyle(cellStyleList, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Header")); return getCellStyle(cellStyleList.getUse4Header());
} }
protected Style getMainContentStyle(ThemedCellStyleList cellStyleList) { protected Style getMainContentStyle(ThemedCellStyleList cellStyleList) {
return getCellStyle(cellStyleList, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Main_Text")); return getCellStyle(cellStyleList.getUse4MainText());
} }
protected Style getHighLightStyle(ThemedCellStyleList cellStyleList) { protected Style getHighLightStyle(ThemedCellStyleList cellStyleList) {
return getCellStyle(cellStyleList, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Highlight_Text")); return getCellStyle(cellStyleList.getUse4HighlightText());
} }
protected Style getSmallTitleStyle(ThemedCellStyleList cellStyleList) { protected Style getSmallTitleStyle(ThemedCellStyleList cellStyleList) {
return getCellStyle(cellStyleList, Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Small_Title")); return getCellStyle(cellStyleList.getUse4SmallTitle());
} }
private Style getCellStyle(ThemedCellStyleList cellStyleList, String styleName) { private Style getCellStyle(ThemedCellStyle themedCellStyle) {
ThemedCellStyle cellStyle = cellStyleList.find(styleName); if (themedCellStyle == null) {
if (cellStyle == null) {
return Style.DEFAULT_STYLE; return Style.DEFAULT_STYLE;
} }
return cellStyle.getStyle(); Style style = themedCellStyle.getStyle();
return style != null ? style : Style.DEFAULT_STYLE;
} }
protected void refresh(List<AbstractPreviewCell> list, Style style) { protected void refresh(List<AbstractPreviewCell> list, Style style) {

6
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECComponentPreviewPane.java

@ -5,6 +5,8 @@ import com.fr.design.mainframe.theme.preview.ComponentPreviewPane;
import java.awt.Component; import java.awt.Component;
import static com.fr.design.i18n.Toolkit.i18nText;
/** /**
* @author Starryi * @author Starryi
* @version 1.0 * @version 1.0
@ -13,6 +15,10 @@ import java.awt.Component;
public class ECComponentPreviewPane extends ComponentPreviewPane { public class ECComponentPreviewPane extends ComponentPreviewPane {
private ECPreviewPane contentPane; private ECPreviewPane contentPane;
public ECComponentPreviewPane(){
super(i18nText("Fine-Design_Basic_Template_Theme_Profile_Pane_EC_Title"));
}
@Override @Override
protected Component createContentPane() { protected Component createContentPane() {
contentPane = new ECPreviewPane(); contentPane = new ECPreviewPane();

7
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECPreviewPane.java

@ -26,8 +26,7 @@ import java.util.List;
*/ */
public class ECPreviewPane extends AbstractECPreviewPane { public class ECPreviewPane extends AbstractECPreviewPane {
private static String csv = private static String csv =
"城市 当月目标 当月实际完成 月度完成率 全年完成率\n" + "城市 当月目标 当月完成 月完成率 年完成率\n" +
"南通市 324,646 324,646 100% 100%\n" +
"合肥市 248,938 348,938 140% 140%\n" + "合肥市 248,938 348,938 140% 140%\n" +
"邵阳市 248,938 348,938 140% 140%\n" + "邵阳市 248,938 348,938 140% 140%\n" +
"合计 1,071,460 1,371,460 128% 128%"; "合计 1,071,460 1,371,460 128% 128%";
@ -53,7 +52,7 @@ public class ECPreviewPane extends AbstractECPreviewPane {
public ECPreviewPane() { public ECPreviewPane() {
this.setPreferredSize(new Dimension(517, 170)); this.setPreferredSize(new Dimension(517, 147));
this.setBorder(BorderFactory.createEmptyBorder(0, 1, 2, 1)); this.setBorder(BorderFactory.createEmptyBorder(0, 1, 2, 1));
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
String[] titleArr = DATA_LIST.get(0); String[] titleArr = DATA_LIST.get(0);
@ -67,7 +66,7 @@ public class ECPreviewPane extends AbstractECPreviewPane {
headerCellList.add(cell); headerCellList.add(cell);
} }
JPanel contentPane = new UINoOpaquePanel(new GridLayout(3, 5, 0, 0)); JPanel contentPane = new UINoOpaquePanel(new GridLayout(2, 5, 0, 0));
this.add(contentPane, BorderLayout.CENTER); this.add(contentPane, BorderLayout.CENTER);
for (int i = 1; i < DATA_LIST.size() - 1; i++) { for (int i = 1; i < DATA_LIST.size() - 1; i++) {
String[] textLine = DATA_LIST.get(i); String[] textLine = DATA_LIST.get(i);

7
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java

@ -1,8 +1,6 @@
package com.fr.design.mainframe.theme.preview.ecpreview.cell; package com.fr.design.mainframe.theme.preview.ecpreview.cell;
import com.fr.base.ScreenResolution;
import com.fr.base.Style; import com.fr.base.Style;
import javax.swing.JComponent; import javax.swing.JComponent;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
@ -10,6 +8,8 @@ import java.awt.Graphics2D;
public abstract class AbstractPreviewCell extends JComponent { public abstract class AbstractPreviewCell extends JComponent {
protected Style style = Style.DEFAULT_STYLE; protected Style style = Style.DEFAULT_STYLE;
private static final int NO_SCALE_RESOLUTION = 100;
public void refresh(Style style) { public void refresh(Style style) {
this.style = style; this.style = style;
@ -17,9 +17,8 @@ public abstract class AbstractPreviewCell extends JComponent {
public void paint(Graphics g) { public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
int resolution = ScreenResolution.getScreenResolution();
Style.paintBackground(g2d, style, getWidth(), getHeight()); Style.paintBackground(g2d, style, getWidth(), getHeight());
paintContent(g2d, resolution); paintContent(g2d, NO_SCALE_RESOLUTION);
Style.paintBorder(g2d, style, getWidth(), getHeight()); Style.paintBorder(g2d, style, getWidth(), getHeight());
} }

2
designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java

@ -34,7 +34,7 @@ public class DefaultThemedTemplateCellElementCase {
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) { if (template != null) {
TemplateTheme theme = template.getTemplateTheme(); TemplateTheme theme = template.getTemplateTheme();
ThemedCellStyle themedCellStyle = theme.getCellStyleList().getDefaultCellStyle4New(); ThemedCellStyle themedCellStyle = theme.getCellStyleList().getUse4Default();
if (themedCellStyle != null) { if (themedCellStyle != null) {
NameStyle nameStyle = NameStyle.getPassiveInstance(themedCellStyle.getName(), themedCellStyle.getStyle()); NameStyle nameStyle = NameStyle.getPassiveInstance(themedCellStyle.getName(), themedCellStyle.getStyle());
cellElement.setStyle(nameStyle); cellElement.setStyle(nameStyle);

1
designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java

@ -40,7 +40,6 @@ public abstract class AbstractSelectBox<T> extends AbstractPopBox implements Mou
displayComponent = new BackgroundJComponent(); displayComponent = new BackgroundJComponent();
displayComponent.setEmptyBackground(); displayComponent.setEmptyBackground();
displayComponent.setBorder(new TriggleLineBorder());
triggleButton = new UIButton(UIConstants.ARROW_DOWN_ICON) { triggleButton = new UIButton(UIConstants.ARROW_DOWN_ICON) {
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return false; return false;

7
designer-base/src/main/java/com/fr/design/style/AlignmentPane.java

@ -5,6 +5,7 @@ package com.fr.design.style;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.border.UITitledBorder;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
@ -86,7 +87,7 @@ public class AlignmentPane extends BasicPane {
//richer:文本控制和图片布局 //richer:文本控制和图片布局
JPanel textDirectionPanel = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); JPanel textDirectionPanel = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
contentPane.add(textDirectionPanel); contentPane.add(textDirectionPanel);
textDirectionPanel.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"), null)); textDirectionPanel.setBorder(UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation")));
JPanel isVerticalTextPanel = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); JPanel isVerticalTextPanel = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane();
textDirectionPanel.add(isVerticalTextPanel); textDirectionPanel.add(isVerticalTextPanel);
initVerticalPane(isVerticalTextPanel); initVerticalPane(isVerticalTextPanel);
@ -131,7 +132,7 @@ public class AlignmentPane extends BasicPane {
private void initSpacingPane (JPanel spacingPane) { private void initSpacingPane (JPanel spacingPane) {
spacingPane.setLayout(new GridLayout(1, 3)); spacingPane.setLayout(new GridLayout(1, 3));
spacingPane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Spacing") + ":")); spacingPane.setBorder(UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Spacing") + ":"));
spacingBeforeSpinner = new UIBasicSpinner(new SpinnerNumberModel(new Integer(0), new Integer(0), null, new Integer(1))); spacingBeforeSpinner = new UIBasicSpinner(new SpinnerNumberModel(new Integer(0), new Integer(0), null, new Integer(1)));
spacingBeforeSpinner.addChangeListener(changeListener); spacingBeforeSpinner.addChangeListener(changeListener);
@ -153,7 +154,7 @@ public class AlignmentPane extends BasicPane {
private JPanel getIndentPane() { private JPanel getIndentPane() {
JPanel indentPane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); JPanel indentPane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane();
indentPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sytle_Indentation"), null)); indentPane.setBorder(UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sytle_Indentation")));
Comparable maximum = null; Comparable maximum = null;
leftIndentSpinner = new UIBasicSpinner(new SpinnerNumberModel(new Integer(0), new Integer(0), maximum, new Integer(1))); leftIndentSpinner = new UIBasicSpinner(new SpinnerNumberModel(new Integer(0), new Integer(0), maximum, new Integer(1)));
leftIndentSpinner.addChangeListener(changeListener); leftIndentSpinner.addChangeListener(changeListener);

5
designer-base/src/main/java/com/fr/design/style/BorderPane.java

@ -7,6 +7,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.CellBorderStyle; import com.fr.base.CellBorderStyle;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.border.UITitledBorder;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.LineComboBox;
@ -96,7 +97,7 @@ public class BorderPane extends BasicPane {
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
centerPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"), null)); centerPane.setBorder(UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")));
JPanel borderAllControlPane = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); JPanel borderAllControlPane = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane();
centerPane.add(borderAllControlPane, BorderLayout.NORTH); centerPane.add(borderAllControlPane, BorderLayout.NORTH);
borderAllControlPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0)); borderAllControlPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0));
@ -147,7 +148,7 @@ public class BorderPane extends BasicPane {
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
northPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Line"), null)); northPane.setBorder(UITitledBorder.createBorderWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Line")));
JPanel rightTopPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel rightTopPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
northPane.add(rightTopPane, BorderLayout.NORTH); northPane.add(rightTopPane, BorderLayout.NORTH);
JPanel first = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel first = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();

17
designer-base/src/main/java/com/fr/design/style/background/BackgroundJComponent.java

@ -1,10 +1,12 @@
package com.fr.design.style.background; package com.fr.design.style.background;
import java.awt.Color;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Insets;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import javax.swing.JComponent; import javax.swing.JComponent;
import com.fr.design.border.UIRoundedBorder;
import com.fr.general.Background; import com.fr.general.Background;
/** /**
@ -18,7 +20,7 @@ public class BackgroundJComponent extends JComponent {
protected Background background ; protected Background background ;
public BackgroundJComponent() { public BackgroundJComponent() {
this.setBorder(new UIRoundedBorder(Color.decode("#999999"), 2, 2));
} }
public BackgroundJComponent(Background background) { public BackgroundJComponent(Background background) {
@ -29,11 +31,13 @@ public class BackgroundJComponent extends JComponent {
super.paint(g); super.paint(g);
if(background != null && this.getSize().getWidth() > 0 && this.getSize().getHeight() > 0) { if(background != null && this.getSize().getWidth() > 0 && this.getSize().getHeight() > 0) {
background.paint(g, new Rectangle2D.Double(1, 1, this.getSize().getWidth() - 2, background.paint(g, new Rectangle2D.Double(2, 2, this.getSize().getWidth() - 4,
this.getSize().getHeight() - 2)); this.getSize().getHeight() - 4));
} }
} }
public void setEmptyBackground() { public void setEmptyBackground() {
this.background = null; this.background = null;
} }
@ -41,4 +45,9 @@ public class BackgroundJComponent extends JComponent {
public void setSelfBackground(Background background) { public void setSelfBackground(Background background) {
this.background = background; this.background = background;
} }
@Override
public Insets getInsets() {
return new Insets(0,0,0,0);
}
} }

4
designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java

@ -38,6 +38,10 @@ public abstract class ColorControlWindow extends JPopupMenu {
return selectionPopupPane.getColor(); return selectionPopupPane.getColor();
} }
public void setColor(Color color) {
selectionPopupPane.setColor(color);
}
public PopupHider getPopupHider() { public PopupHider getPopupHider() {
return popupHider; return popupHider;
} }

5
designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java

@ -39,6 +39,11 @@ public abstract class ColorControlWindowWithAuto extends ColorControlWindow {
return selectionPopupPaneWithAuto.getColor(); return selectionPopupPaneWithAuto.getColor();
} }
public void setColor(Color color) {
selectionPopupPaneWithAuto.setColor(color);
}
protected void initSelectionPopupPane(boolean isSupportTransparent) { protected void initSelectionPopupPane(boolean isSupportTransparent) {
selectionPopupPaneWithAuto = new ColorSelectionPopupPaneWithAuto(isSupportTransparent); selectionPopupPaneWithAuto = new ColorSelectionPopupPaneWithAuto(isSupportTransparent);
this.add(selectionPopupPaneWithAuto, BorderLayout.CENTER); this.add(selectionPopupPaneWithAuto, BorderLayout.CENTER);

130
designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java

@ -1,6 +1,7 @@
package com.fr.design.style.color; package com.fr.design.style.color;
import com.fr.base.FineColor; import com.fr.base.FineColor;
import com.fr.base.theme.FineColorDeriveState;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
@ -37,8 +38,11 @@ import java.util.List;
*/ */
public class NewColorSelectPane extends BasicPane implements ColorSelectable { public class NewColorSelectPane extends BasicPane implements ColorSelectable {
private static final long serialVersionUID = -8634152305687249392L; private static final long serialVersionUID = -8634152305687249392L;
private static final float BRIGHTNESS_VALUE = 0.15F;
private static final float PURITY_VALUE = 0.1F; private static final int WIDTH = 197;
private static final int HEIGHT = 250;
//颜色衍生的数量
private static final int DEFAULT_DERIVE_COUNT = 5;
private FineColor color = null; // color private FineColor color = null; // color
// color setting action. // color setting action.
@ -49,15 +53,12 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
private boolean isSupportThemeColor; private boolean isSupportThemeColor;
public final static int TRANSPARENT_WINDOW_HEIGHT = 165;
public final static int WINDOW_HEIGHT = 150;
// 最近使用颜色 // 最近使用颜色
private final NewUsedColorPane usedColorPane; private final NewUsedColorPane usedColorPane;
private final JPanel menuColorPane; private final JPanel menuColorPane;
private ColorCell[][] themeColorCellGrid; private ColorCell[][] themeColorCellGrid;
public static NewColorSelectPane createColorSelectPaneWithTheme(boolean supportTheme){ public static NewColorSelectPane createColorSelectPaneWithTheme(boolean supportTheme) {
return new NewColorSelectPane(true, supportTheme); return new NewColorSelectPane(true, supportTheme);
} }
@ -80,14 +81,16 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
initSelectButton(isSupportTransparent); initSelectButton(isSupportTransparent);
// center // center
JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); JPanel centerPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
centerPane.setBorder(BorderFactory.createEmptyBorder(10, 4, 0 ,4)); centerPane.setBorder(BorderFactory.createEmptyBorder(10, 4, 0, 4));
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
menuColorPane = getMenuColorPane(); menuColorPane = getMenuColorPane();
if (isSupportThemeColor) {
JPanel themePane = initThemeColorPane();
centerPane.add(themePane);
} else {
centerPane.add(menuColorPane); centerPane.add(menuColorPane);
if(isSupportThemeColor){
initThemeColorPane();
}else {
initMenuColorPane(); initMenuColorPane();
} }
@ -129,7 +132,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
centerPane.add(centerPane1); centerPane.add(centerPane1);
} }
private JPanel createStandardColorPane(){ private JPanel createStandardColorPane() {
JPanel jPanel = new JPanel(new GridLayout(1, 10, 3, 0)); JPanel jPanel = new JPanel(new GridLayout(1, 10, 3, 0));
Color[] colorArray = ColorFactory.STANDARD_COLORS; Color[] colorArray = ColorFactory.STANDARD_COLORS;
for (int i = 0; i < colorArray.length; i++) { for (int i = 0; i < colorArray.length; i++) {
@ -138,19 +141,21 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
return jPanel; return jPanel;
} }
private void initThemeColorPane(){ private JPanel initThemeColorPane() {
menuColorPane.removeAll(); menuColorPane.removeAll();
JPanel themeColorPane = new JPanel(new BorderLayout(0, 5));
themeColorPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
themeColorPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Theme_Color")), BorderLayout.CENTER);
themeColorPane.add(menuColorPane, BorderLayout.SOUTH);
menuColorPane.setLayout(new BorderLayout(0, 10)); menuColorPane.setLayout(new BorderLayout(0, 10));
JPanel northPane = new JPanel(new GridLayout(1, 8, 3, 0)); JPanel northPane = new JPanel(new GridLayout(1, 8, 3, 0));
JPanel centerPane = new JPanel(new GridLayout(1, 8, 3, 0)); JPanel centerPane = new JPanel(new GridLayout(1, 8, 3, 0));
menuColorPane.add(northPane, BorderLayout.NORTH); menuColorPane.add(northPane, BorderLayout.NORTH);
menuColorPane.add(centerPane, BorderLayout.CENTER); menuColorPane.add(centerPane, BorderLayout.CENTER);
Color[] colorArray = new Color[] { Color[] colorArray = new Color[]{
// 2列灰度色
Color.decode("#B3B3B3"),
Color.decode("#808080"),
// 8列主题色 // 8列主题色
Color.decode("#FFFFFF"), Color.decode("#FFFFFF"),
Color.decode("#CCCCCC"), Color.decode("#CCCCCC"),
@ -160,20 +165,22 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
Color.decode("#CCCCCC"), Color.decode("#CCCCCC"),
Color.decode("#FFFFFF"), Color.decode("#FFFFFF"),
Color.decode("#CCCCCC"), Color.decode("#CCCCCC"),
// 2列灰度色
Color.decode("#333333"),
Color.decode("#FFFFFF"),
}; };
if (themeColorCellGrid == null) { if (themeColorCellGrid == null) {
themeColorCellGrid = new ColorCell[colorArray.length][5]; themeColorCellGrid = new ColorCell[colorArray.length][DEFAULT_DERIVE_COUNT];
for (int i = 0; i < colorArray.length; i++) { for (int i = 0; i < colorArray.length; i++) {
ColorCell[] colorCellColumn = new ColorCell[5]; ColorCell[] colorCellColumn = new ColorCell[DEFAULT_DERIVE_COUNT];
boolean isDefaultColor = (i == 0 || i == 1); boolean isDefaultColor = (i == colorArray.length - 1 || i == colorArray.length - 2);
Color color = colorArray[i]; Color color = colorArray[i];
colorCellColumn[0] = createFineColorCell(color, isDefaultColor, i, 2); Color[] deriveColorArr = FineColorDeriveState.getDeriveColorArr(color, isDefaultColor, DEFAULT_DERIVE_COUNT);
colorCellColumn[2] = createFineColorCell(color = saturationDown(color, isDefaultColor, true), isDefaultColor, i, 1); for (int j = 0; j < deriveColorArr.length; j++) {
colorCellColumn[1] = createFineColorCell(saturationDown(color, isDefaultColor, true), isDefaultColor, i, 0); colorCellColumn[j] = createFineColorCell(deriveColorArr[j], isDefaultColor, i, j);
color = colorArray[i]; }
colorCellColumn[3] = createFineColorCell(color = saturationDown(color, isDefaultColor, false), isDefaultColor, i, 3);
colorCellColumn[4] = createFineColorCell(saturationDown(color, isDefaultColor, false), isDefaultColor, i, 4);
themeColorCellGrid[i] = colorCellColumn; themeColorCellGrid[i] = colorCellColumn;
} }
} }
@ -182,15 +189,15 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
northPane.add(themeColorCellGrid[i][0]); northPane.add(themeColorCellGrid[i][0]);
} }
for (int i = 0; i < colorArray.length; i++) { for (int i = 0; i < colorArray.length; i++) {
JPanel columnPane = new JPanel(new GridLayout(4, 1, 0, 3)); JPanel columnPane = new JPanel(new GridLayout(DEFAULT_DERIVE_COUNT - 1, 1, 0, 3));
columnPane.add(themeColorCellGrid[i][1]); for (int j = 1; j < DEFAULT_DERIVE_COUNT; j++) {
columnPane.add(themeColorCellGrid[i][2]); columnPane.add(themeColorCellGrid[i][j]);
columnPane.add(themeColorCellGrid[i][3]); }
columnPane.add(themeColorCellGrid[i][4]);
centerPane.add(columnPane); centerPane.add(columnPane);
} }
refreshThemeMenuColorPane(); refreshThemeMenuColorPane();
return themeColorPane;
} }
private void refreshThemeMenuColorPane() { private void refreshThemeMenuColorPane() {
@ -198,7 +205,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
if (TemplateThemeProfileDialog.isEditingTheme()) { if (TemplateThemeProfileDialog.isEditingTheme()) {
standardColors = TemplateThemeProfileDialog.getEditingColorScheme(); standardColors = TemplateThemeProfileDialog.getEditingColorScheme();
} else { } else {
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) { if (template != null) {
TemplateTheme theme = template.getTemplateTheme(); TemplateTheme theme = template.getTemplateTheme();
if (theme != null) { if (theme != null) {
@ -206,43 +213,24 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
} }
} }
} }
if (standardColors == null || standardColors.size() != 8) { if (standardColors == null || standardColors.size() < 8) {
return; return;
} }
for (int i = 2; i < themeColorCellGrid.length; i++) { for (int i = 0; i < themeColorCellGrid.length - 2; i++) {
Color color = standardColors.get(i - 2); Color color = standardColors.get(i);
Color[] deriveColorArr = FineColorDeriveState.getDeriveColorArr(color, false, DEFAULT_DERIVE_COUNT);
themeColorCellGrid[i][0].setColor(color); for (int j = 0; j < deriveColorArr.length; j++) {
themeColorCellGrid[i][2].setColor(color = saturationDown(color, false, true)); themeColorCellGrid[i][j].setColor(deriveColorArr[j]);
themeColorCellGrid[i][1].setColor(saturationDown(color, false, true)); }
color = standardColors.get(i - 2);
themeColorCellGrid[i][3].setColor(color = saturationDown(color, false, false));
themeColorCellGrid[i][4].setColor(saturationDown(color, false, false));
} }
} }
private FineColorCell createFineColorCell(Color color, boolean isDefaultColor, int x, int y) { private FineColorCell createFineColorCell(Color color, boolean isDefaultColor, int x, int y) {
return isDefaultColor ? new FineColorCell(color, this) : new FineColorCell(color, this, x - 2, y); return isDefaultColor ? new FineColorCell(color, this) : new FineColorCell(color, this, x, y);
} }
/**
* 调整明度和纯度默认色只调整明度
* @param color
* @param isDefaultColor
* @return
*/
public static Color saturationDown(Color color, boolean isDefaultColor, boolean isLight) {
float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), new float[3]);
if (!isDefaultColor) {
hsb[1] = isLight ? Math.max(0, hsb[1] - PURITY_VALUE) : Math.min(1, hsb[1] + PURITY_VALUE);
}
hsb[2] = isLight ? Math.min(1, hsb[2] + BRIGHTNESS_VALUE) : Math.max(0, hsb[2] - BRIGHTNESS_VALUE);
Color color1 = Color.getHSBColor(hsb[0], hsb[1], hsb[2]);
return color1;
}
private void initMenuColorPane() { private void initMenuColorPane() {
menuColorPane.setLayout(new GridLayout(5, 8, 3, 3)); menuColorPane.setLayout(new GridLayout(5, 8, 3, 3));
@ -266,7 +254,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
return true; return true;
} }
protected void initSelectButton(boolean isSupportTransparent){ protected void initSelectButton(boolean isSupportTransparent) {
this.isSupportTransparent = isSupportTransparent; this.isSupportTransparent = isSupportTransparent;
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5)); this.setBorder(new UIRoundedBorder(UIConstants.TOOLBAR_BORDER_COLOR, 1, 5));
@ -280,6 +268,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
/** /**
* 添加监听 * 添加监听
*
* @param changeListener 监听 * @param changeListener 监听
*/ */
public void addChangeListener(ChangeListener changeListener) { public void addChangeListener(ChangeListener changeListener) {
@ -332,7 +321,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
setFineColor(fineColor); setFineColor(fineColor);
} }
private void setFineColor(FineColor fineColor){ private void setFineColor(FineColor fineColor) {
this.color = fineColor; this.color = fineColor;
// fire color change. // fire color change.
@ -343,7 +332,9 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
changeListener.stateChanged(evt); changeListener.stateChanged(evt);
} }
} }
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color); if (color != null) {
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color.getColor());
}
this.repaint(); this.repaint();
} }
@ -375,10 +366,14 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
int height = HEIGHT;
if (isSupportTransparent) { if (isSupportTransparent) {
return new Dimension(197, 265); height += 15;
}
if (isSupportThemeColor) {
height += 25;
} }
return new Dimension(197, 250); return new Dimension(WIDTH, height);
} }
/** /**
@ -400,12 +395,12 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
private boolean setColorRealTime; private boolean setColorRealTime;
public JPanel getPane(){ public JPanel getPane() {
return this.pane; return this.pane;
} }
public NewUsedColorPane(int columns, ColorSelectable selectable, boolean setColorRealTime){ public NewUsedColorPane(int columns, ColorSelectable selectable, boolean setColorRealTime) {
this.columns = columns; this.columns = columns;
this.selectable = selectable; this.selectable = selectable;
this.setColorRealTime = setColorRealTime; this.setColorRealTime = setColorRealTime;
@ -436,7 +431,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
* 更新最近使用颜色 * 更新最近使用颜色
*/ */
public void updateUsedColor() { public void updateUsedColor() {
int total = columns ; int total = columns;
Color[] colors = DesignerEnvManager.getEnvManager().getColorConfigManager().getColors(); Color[] colors = DesignerEnvManager.getEnvManager().getColorConfigManager().getColors();
int size = colors.length; int size = colors.length;
for (int i = 0; i < total; i++) { for (int i = 0; i < total; i++) {
@ -452,4 +447,5 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
} }
} }
} }

13
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -425,4 +425,17 @@ public class DesignUtils {
return true; return true;
} }
/**
* FR25.0版本出来需要进行适配下
*
* @param xmlDesignerVersion
* @return
*/
public static String parseVersion(String xmlDesignerVersion) {
if (StringUtils.isNotEmpty(xmlDesignerVersion)) {
return String.valueOf(xmlDesignerVersion.charAt(0) - 'A');
}
return xmlDesignerVersion;
}
} }

BIN
designer-base/src/main/resources/com/fr/design/images/transparent_background.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

7
designer-base/src/test/java/com/fr/design/utils/DesignUtilsTest.java

@ -3,6 +3,7 @@ package com.fr.design.utils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import java.net.ServerSocket; import java.net.ServerSocket;
@ -29,4 +30,10 @@ public class DesignUtilsTest extends TestCase {
assertTrue(DesignUtils.isPortOccupied()); assertTrue(DesignUtils.isPortOccupied());
} }
@Test
public void testParseVersion() {
Assert.assertEquals("10", DesignUtils.parseVersion("KAA"));
Assert.assertEquals("11", DesignUtils.parseVersion("LAA"));
}
} }

9
designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

@ -802,7 +802,14 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
try { try {
popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY); popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY);
popup.updatePane(designer); popup.updatePane(designer);
popup.setVisible(selected && accept && popup.hasVisibleButtons() && popup.isCanVisible() && !isShowPluginDialog()); boolean needShowing = selected && accept && popup.hasVisibleButtons() && popup.isCanVisible() && !isShowPluginDialog();
// 当不可见时,且可以设置为可见状态,才去设置为可见
// 避免已经是可见状态时,重复设置可见,造成闪屏
if (!popup.isVisible() && needShowing) {
popup.setVisible(true);
} else if (!needShowing) {
popup.setVisible(false);
}
popup.setRelativeBounds(bounds); popup.setRelativeBounds(bounds);
} catch (Exception ignored) { } catch (Exception ignored) {
} }

3
designer-form/src/main/java/com/fr/design/designer/creator/XElementCase.java

@ -321,9 +321,8 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
FormDesigner designer = editingMouseListener.getDesigner(); FormDesigner designer = editingMouseListener.getDesigner();
if (e.getButton() == MouseEvent.BUTTON1 && if (e.getButton() == MouseEvent.BUTTON1 &&
(e.getClickCount() == 2 || designer.getCursor().getType() == Cursor.HAND_CURSOR)) { (e.getClickCount() == 2 || designer.getCursor().getType() == Cursor.HAND_CURSOR)) {
FormElementCaseContainerProvider component = (FormElementCaseContainerProvider) designer.getComponentAt(e);
//切换设计器 //切换设计器
designer.switchTab(component); designer.switchTab(this);
} }
} }

58
designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -2,12 +2,8 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartCollection;
import com.fr.base.theme.TemplateThemeAware;
import com.fr.base.theme.TemplateThemeCompatible;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider; import com.fr.chartx.attr.ChartProvider;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.TemplateTheme;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
@ -22,7 +18,6 @@ import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
@ -32,24 +27,16 @@ import com.fr.design.mod.bean.ContentChangeItem;
import com.fr.design.mod.event.TableDataModifyEvent; import com.fr.design.mod.event.TableDataModifyEvent;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.form.main.Form;
import com.fr.form.main.WidgetGather;
import com.fr.form.share.editor.SharableEditorProvider;
import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.SharableWidgetProvider;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.ui.AbstractBorderStyleWidget; import com.fr.form.share.editor.SharableEditorProvider;
import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.util.Collections;
import java.util.HashMap;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JWindow; import javax.swing.JWindow;
import java.util.List; import javax.swing.SwingUtilities;
import java.util.Map;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Point; import java.awt.Point;
@ -59,7 +46,10 @@ import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent; import java.awt.dnd.DropTargetEvent;
import javax.swing.SwingUtilities; import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 添加模式下鼠标事件处理器 * 添加模式下鼠标事件处理器
@ -150,9 +140,6 @@ public class FormCreatorDropTarget extends DropTarget {
EventDispatcher.fire(TableDataModifyEvent.INSTANCE, new ContentChangeItem(tdNameMap, widget, ChangeItem.TABLE_DATA_NAME)); EventDispatcher.fire(TableDataModifyEvent.INSTANCE, new ContentChangeItem(tdNameMap, widget, ChangeItem.TABLE_DATA_NAME));
} }
// 新疆的图表块和报表块默认主题化
addThemeToNewWidget(addingXCreator);
designer.getSelectionModel().setSelectedCreators( designer.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget}));
designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED);
@ -363,37 +350,4 @@ public class FormCreatorDropTarget extends DropTarget {
public TabDragInner getTabDragInner() { public TabDragInner getTabDragInner() {
return this.tabDragInner; return this.tabDragInner;
} }
private void addThemeToNewWidget(XCreator addingXCreator) {
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template == null) {
return;
}
TemplateTheme theme = template.getTemplateTheme();
if (!(theme instanceof FormTheme)) {
return;
}
FormTheme formTheme = (FormTheme) theme;
Form.traversalWidget(addingXCreator.toData(), new WidgetGather() {
@Override
public void dealWith(Widget widget) {
if (widget instanceof AbstractBorderStyleWidget) {
AbstractBorderStyleWidget styleWidget = (AbstractBorderStyleWidget) widget;
if (!styleWidget.supportThemed()) {
return;
}
boolean followingTheme = (!addingXCreator.isShared()) || styleWidget.isBorderStyleFollowingTheme();
styleWidget.setBorderStyleFollowingTheme(followingTheme);
if (followingTheme) {
styleWidget.onTemplateUsingThemeChange(formTheme, TemplateThemeCompatible.NONE);
}
}
}
@Override
public boolean dealWithAllCards() { return true; }
}, AbstractBorderStyleWidget.class);
addingXCreator.rebuid();
}
} }

42
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -2,6 +2,9 @@ package com.fr.design.mainframe;
import com.fr.base.Parameter; import com.fr.base.Parameter;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeCompatible;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState; import com.fr.design.DesignState;
@ -41,6 +44,7 @@ import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fit.DesignerUIModeConfig; import com.fr.design.fit.DesignerUIModeConfig;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
@ -57,7 +61,9 @@ import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseContainerProvider;
import com.fr.form.FormElementCaseProvider; import com.fr.form.FormElementCaseProvider;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.main.WidgetGather;
import com.fr.form.parameter.FormSubmitButton; import com.fr.form.parameter.FormSubmitButton;
import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.form.ui.EditorHolder; import com.fr.form.ui.EditorHolder;
import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.PaddingMargin;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
@ -1189,6 +1195,9 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
* @param xCreator 组件 * @param xCreator 组件
*/ */
public void startDraggingBean(XCreator xCreator) { public void startDraggingBean(XCreator xCreator) {
// 新疆的图表块和报表块默认主题化
addThemeToDroppedNewWidget(xCreator);
// 根据所选择的组件的BeanInfo生成相应的AddingModel // 根据所选择的组件的BeanInfo生成相应的AddingModel
// AddingModel和StateModel不一样,适合当前选择的组件相关的 // AddingModel和StateModel不一样,适合当前选择的组件相关的
addingModel = new AddingModel(this, xCreator); addingModel = new AddingModel(this, xCreator);
@ -1853,4 +1862,37 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
public FormSpacingLineDrawer getSpacingLineDrawer() { public FormSpacingLineDrawer getSpacingLineDrawer() {
return spacingLineDrawer; return spacingLineDrawer;
} }
private void addThemeToDroppedNewWidget(XCreator addingXCreator) {
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template == null) {
return;
}
TemplateTheme theme = template.getTemplateTheme();
if (!(theme instanceof FormTheme)) {
return;
}
FormTheme formTheme = (FormTheme) theme;
Form.traversalWidget(addingXCreator.toData(), new WidgetGather() {
@Override
public void dealWith(Widget widget) {
if (widget instanceof AbstractBorderStyleWidget) {
AbstractBorderStyleWidget styleWidget = (AbstractBorderStyleWidget) widget;
if (!styleWidget.supportThemed()) {
return;
}
boolean followingTheme = (!addingXCreator.isShared()) || styleWidget.isBorderStyleFollowingTheme();
styleWidget.setBorderStyleFollowingTheme(followingTheme);
if (followingTheme) {
styleWidget.onTemplateUsingThemeChange(formTheme, TemplateThemeCompatible.NONE);
}
}
}
@Override
public boolean dealWithAllCards() { return true; }
}, AbstractBorderStyleWidget.class);
addingXCreator.rebuid();
}
} }

30
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -39,6 +39,7 @@ import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.FormAdaptiveConfigUIProcessor; import com.fr.design.fun.FormAdaptiveConfigUIProcessor;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.fun.PropertyItemPaneProvider;
@ -664,9 +665,11 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
@Override @Override
protected void applyUndoState(FormUndoState u) { protected void applyUndoState(FormUndoState u) {
try { try {
Form undoForm = (Form) u.getForm().clone();
undoForm.checkAndResetTheme();
if (this.index == FORM_TAB) { if (this.index == FORM_TAB) {
//JForm的target重置 //JForm的target重置
this.setTarget((Form) u.getForm().clone()); this.setTarget(undoForm);
JForm.this.refreshRoot(); JForm.this.refreshRoot();
this.formDesign.getArea().setAreaSize(u.getAreaSize(), u.getHorizontalValue(), u.getVerticalValue(), u.getWidthValue(), u.getHeightValue(), u.getSlideValue()); this.formDesign.getArea().setAreaSize(u.getAreaSize(), u.getHorizontalValue(), u.getVerticalValue(), u.getWidthValue(), u.getHeightValue(), u.getSlideValue());
//撤销的时候要重新选择的body布局 //撤销的时候要重新选择的body布局
@ -685,7 +688,6 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
} else { } else {
// 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块. // 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块.
// 修改了JForm的Target需要同步修改formDesign的Target. // 修改了JForm的Target需要同步修改formDesign的Target.
Form undoForm = (Form) u.getForm().clone();
String widgetName = this.formDesign.getElementCaseContainerName(); String widgetName = this.formDesign.getElementCaseContainerName();
//这儿太坑了,u.getForm() 与 getTarget内容不一样 //这儿太坑了,u.getForm() 与 getTarget内容不一样
FormElementCaseProvider dataTable = undoForm.getElementCaseByName(widgetName); FormElementCaseProvider dataTable = undoForm.getElementCaseByName(widgetName);
@ -1188,13 +1190,35 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
FormTheme oldTheme = getTarget().getTemplateTheme(); FormTheme oldTheme = getTarget().getTemplateTheme();
boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName()); boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName());
FormArea formArea = formDesign.getArea();
int horizontalValue = formArea.getHorizontalValue();
int verticalValue= formArea.getVerticalValue();
Dimension areaSize = formArea.getAreaSize();
double widthValue = formArea.getWidthPaneValue();
double heightValue = formArea.getHeightPaneValue();
double slideValue = formArea.getSlideValue();
getTarget().setTemplateTheme(newTheme, compatible); getTarget().setTemplateTheme(newTheme, compatible);
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) {
fireTargetModified(shouldCreateUndoState); fireTargetModified(shouldCreateUndoState);
formDesign.refreshRoot(); formDesign.refreshRoot();
FormHierarchyTreePane.getInstance().refreshRoot(); // 刷新界面后恢复原来的尺寸
formDesign.getArea().setAreaSize(areaSize, horizontalValue, verticalValue, widthValue, heightValue, slideValue);
if (this.index != FORM_TAB) { if (this.index != FORM_TAB) {
refreshToolArea(); refreshToolArea();
} else {
// CHART-20568: 当图表块处于编辑状态时,任何界面内容的修改都会导致其进行截图操作,进而引起设计器界面再次重绘,导致死循环,因而需要停止编辑 恢复浮层展示
TreePath[] treePaths = FormHierarchyTreePane.getInstance(formDesign).getComponentTree().getSelectedTreePath();
if (treePaths != null) {
for (TreePath path : treePaths) {
if (path != null) {
formDesign.stopEditing(path);
}
}
}
}
FormHierarchyTreePane.getInstance().refreshRoot();
} }
super.setTemplateTheme(newTheme, compatible); super.setTemplateTheme(newTheme, compatible);

4
designer-form/src/main/java/com/fr/design/mainframe/share/action/CreateComponentAction.java

@ -251,7 +251,7 @@ public class CreateComponentAction extends UpdateAction {
private Image componentToImage(Component comp, Rectangle rect) { private Image componentToImage(Component comp, Rectangle rect) {
BufferedImage im = new BufferedImage((int) rect.getWidth(), (int) rect.getHeight(), BufferedImage.TYPE_INT_ARGB); BufferedImage im = new BufferedImage((int) rect.getWidth(), (int) rect.getHeight(), BufferedImage.TYPE_INT_RGB);
comp.paint(im.getGraphics()); comp.paint(im.getGraphics());
return im; return im;
} }
@ -260,7 +260,7 @@ public class CreateComponentAction extends UpdateAction {
private Image moduleToImage(Form form, ElementCaseEditor editor, Map<String, Object> parameterMap, Rectangle rect) { private Image moduleToImage(Form form, ElementCaseEditor editor, Map<String, Object> parameterMap, Rectangle rect) {
if (editor == null) { if (editor == null) {
return new BufferedImage((int) rect.getWidth(), (int) rect.getHeight(), BufferedImage.TYPE_INT_ARGB); return new BufferedImage((int) rect.getWidth(), (int) rect.getHeight(), BufferedImage.TYPE_INT_RGB);
} }
FormElementCaseProvider provider = editor.getElementCase(); FormElementCaseProvider provider = editor.getElementCase();
provider.setName(editor.getWidgetName()); provider.setName(editor.getWidgetName());

4
designer-form/src/main/java/com/fr/design/mainframe/share/action/InstallComponentAction.java

@ -95,7 +95,9 @@ public class InstallComponentAction extends UpdateAction {
} }
ShareWidgetInfoManager.getInstance().saveXmlInfo(); ShareWidgetInfoManager.getInstance().saveXmlInfo();
boolean needShowMessage = (chosenFiles.length > 1 && chosenFiles.length != failureList.size()) || containRues(chosenFiles); boolean reuNeedShowMessage = chosenFiles.length > 1 && chosenFiles.length != failureList.size();
boolean reusNeedShowMessage = containRues(chosenFiles) && !failureList.isEmpty();
boolean needShowMessage = reuNeedShowMessage || reusNeedShowMessage;
return new InstallBackInfo(installStatus, needShowMessage, failureList); return new InstallBackInfo(installStatus, needShowMessage, failureList);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);

5
designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java

@ -47,14 +47,11 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel {
private OnlineShareWidget[] sharableWidgetProviders; private OnlineShareWidget[] sharableWidgetProviders;
//缓存一份用于搜索
private final OnlineShareWidget[] sharableWidgetCache;
//主面板和搜索面板的cardLayout //主面板和搜索面板的cardLayout
private CardLayout mainCardLayout; private CardLayout mainCardLayout;
public AbstractOnlineWidgetShowPane(OnlineShareWidget[] sharableWidgetProviders) { public AbstractOnlineWidgetShowPane(OnlineShareWidget[] sharableWidgetProviders) {
this.sharableWidgetCache = sharableWidgetProviders;
this.sharableWidgetProviders = sharableWidgetProviders; this.sharableWidgetProviders = sharableWidgetProviders;
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel contentPane = initContentPane(); JPanel contentPane = initContentPane();
@ -119,7 +116,7 @@ public abstract class AbstractOnlineWidgetShowPane extends JPanel {
} }
List<OnlineShareWidget> widgets = new ArrayList<>(); List<OnlineShareWidget> widgets = new ArrayList<>();
if (StringUtils.isNotEmpty(text)) { if (StringUtils.isNotEmpty(text)) {
for (OnlineShareWidget provider : sharableWidgetCache) { for (OnlineShareWidget provider : sharableWidgetProviders) {
if (provider.getName().toLowerCase().contains(text)) { if (provider.getName().toLowerCase().contains(text)) {
widgets.add(provider); widgets.add(provider);
} }

9
designer-form/src/main/java/com/fr/design/mainframe/share/util/InstallUtils.java

@ -30,9 +30,14 @@ public class InstallUtils {
* 安装组件包 * 安装组件包
*/ */
public static boolean installReusFile(File chosenFile, long installTime, List<String> list) { public static boolean installReusFile(File chosenFile, long installTime, List<String> list) {
return installReusFile(chosenFile, installTime, list, o -> { InstallResult installResult = installReusFile(chosenFile, installTime, list, o -> {
//do nothing //do nothing
}).installStatus; });
Group group = installResult.group;
if (group.getAllBindInfoList().length == 0) {
DefaultShareGroupManager.getInstance().removeGroup(group);
}
return installResult.installStatus;
} }
/** /**

BIN
designer-form/src/main/resources/com/fr/design/form/images/theme4newTemplate.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 411 B

After

Width:  |  Height:  |  Size: 611 B

8
designer-realize/src/main/java/com/fr/design/actions/insert/cell/GeneralCellAction.java

@ -10,6 +10,7 @@ import com.fr.design.menu.MenuKeySet;
import javax.swing.*; import javax.swing.*;
import java.awt.event.ActionEvent;
/** /**
* *
@ -52,4 +53,11 @@ public class GeneralCellAction extends AbstractCellAction implements WorkBookSup
public Class getCellValueClass() { public Class getCellValueClass() {
return String.class; return String.class;
} }
@Override
public void actionPerformed(ActionEvent evt) {
super.actionPerformed(evt);
this.getEditingComponent().getGrid().getCellEditor().stopCellEditing();
}
} }

9
designer-realize/src/main/java/com/fr/design/cell/editor/TextCellEditor.java

@ -129,7 +129,7 @@ public class TextCellEditor extends AbstractCellEditor {
} }
this.oldValue = Utils.objectToString(value); this.oldValue = Utils.objectToString(value);
this.textField.setText(oldValue); resetTextWithoutDocumentListener(oldValue);
//peter:只读方式获得Style. //peter:只读方式获得Style.
Style style = null; Style style = null;
if(cellElement != null) { if(cellElement != null) {
@ -176,4 +176,11 @@ public class TextCellEditor extends AbstractCellEditor {
public void keyReleased(KeyEvent evt) { public void keyReleased(KeyEvent evt) {
} }
}; };
private void resetTextWithoutDocumentListener(String text) {
this.textField.getDocument().removeDocumentListener(documentlistener);
this.textField.setText(text);
this.textField.getDocument().addDocumentListener(documentlistener);
}
} }

7
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -37,6 +37,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
@ -774,7 +775,9 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
@Override @Override
protected void applyUndoState(WorkBookUndoState u) { protected void applyUndoState(WorkBookUndoState u) {
try { try {
this.setTarget((WorkBook) u.getWorkBook().clone()); WorkBook undoWorkBook = (WorkBook) u.getWorkBook().clone();
undoWorkBook.checkAndResetTheme();
this.setTarget(undoWorkBook);
if (!DesignerMode.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
if (u.getAuthorityType() != BaseUndoState.NORMAL_STATE) { if (u.getAuthorityType() != BaseUndoState.NORMAL_STATE) {
applyAll(u); applyAll(u);
@ -1293,10 +1296,12 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
getTarget().setTemplateTheme(newTheme, compatible); getTarget().setTemplateTheme(newTheme, compatible);
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) {
fireTargetModified(shouldCreateUndoState); fireTargetModified(shouldCreateUndoState);
reportComposite.setSelectedIndex(reportComposite.getSelectedIndex()); reportComposite.setSelectedIndex(reportComposite.getSelectedIndex());
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView(); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView();
DesignerContext.getDesignerFrame().resetToolkitByPlus(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); DesignerContext.getDesignerFrame().resetToolkitByPlus(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
}
super.setTemplateTheme(newTheme, compatible); super.setTemplateTheme(newTheme, compatible);
} }

4
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java

@ -7,7 +7,6 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
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.TableLayout; import com.fr.design.layout.TableLayout;
@ -132,8 +131,7 @@ public class StylePane extends BasicPane implements UIObserver {
uiLabel.setPreferredSize(new Dimension(uiLabel.getPreferredSize().width, 20)); uiLabel.setPreferredSize(new Dimension(uiLabel.getPreferredSize().width, 20));
container.add(uiLabel, BorderLayout.NORTH); container.add(uiLabel, BorderLayout.NORTH);
themedCellStyleListPane.setBorder(BorderFactory.createEmptyBorder()); themedCellStyleListPane.setBorder(BorderFactory.createEmptyBorder());
UIScrollPane scrollPane = new UIScrollPane(themedCellStyleListPane); container.add(themedCellStyleListPane, BorderLayout.CENTER);
container.add(scrollPane, BorderLayout.CENTER);
return container; return container;
} }

68
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java

@ -1,11 +1,11 @@
package com.fr.design.mainframe.cell.settingpane.style; package com.fr.design.mainframe.cell.settingpane.style;
import com.fr.base.NameStyle; import com.fr.base.NameStyle;
import com.fr.base.ScreenResolution;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.settings.ThemedCellStyle; import com.fr.base.theme.settings.ThemedCellStyle;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.cell.CellStylePreviewPane;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -17,19 +17,16 @@ import com.fr.general.ComparatorUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
import javax.swing.JComponent;
import javax.swing.JList; import javax.swing.JList;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.ListCellRenderer; import javax.swing.ListCellRenderer;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
@ -45,21 +42,19 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
defaultListModel = new DefaultListModel<>(); defaultListModel = new DefaultListModel<>();
styleList = new JList<>(defaultListModel); styleList = new JList<>(defaultListModel);
styleList.setCellRenderer(new RadioButtonListCellRenderer()); styleList.setCellRenderer(new RadioButtonListCellRenderer());
setLayout(FRGUIPaneFactory.createBorderLayout()); styleList.setOpaque(false);
add(styleList, BorderLayout.CENTER); styleList.setBackground(null);
setBorder(BorderFactory.createEmptyBorder(0 ,LEFT_BORDER, 0, RIGHT_BORDER)); styleList.addListSelectionListener(new ListSelectionListener() {
styleList.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void valueChanged(ListSelectionEvent e) {
int clickedNumber = e.getClickCount();
if (clickedNumber == 1) {
if (changeListener != null) { if (changeListener != null) {
changeListener.stateChanged(new ChangeEvent(styleList)); changeListener.stateChanged(new ChangeEvent(styleList));
} }
} }
}
}); });
setLayout(FRGUIPaneFactory.createBorderLayout());
add(styleList, BorderLayout.CENTER);
setBorder(BorderFactory.createEmptyBorder(0 ,LEFT_BORDER, 0, RIGHT_BORDER));
DesignerContext.setDesignerBean("predefinedStyle", this); DesignerContext.setDesignerBean("predefinedStyle", this);
} }
@ -142,7 +137,7 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
private static class RadioButtonListCellRenderer extends JPanel implements ListCellRenderer<Object>, Serializable { private static class RadioButtonListCellRenderer extends JPanel implements ListCellRenderer<Object>, Serializable {
private final UIRadioButton button; private final UIRadioButton button;
private final PreviewArea previewArea; private final CellStylePreviewPane previewArea;
public RadioButtonListCellRenderer() { public RadioButtonListCellRenderer() {
super(); super();
@ -150,7 +145,7 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
setPreferredSize(new Dimension(getPreferredSize().width, 40)); setPreferredSize(new Dimension(getPreferredSize().width, 40));
button = new UIRadioButton(); button = new UIRadioButton();
previewArea = new PreviewArea(); previewArea = new CellStylePreviewPane();
add(button, BorderLayout.WEST); add(button, BorderLayout.WEST);
add(previewArea, BorderLayout.CENTER); add(previewArea, BorderLayout.CENTER);
} }
@ -162,43 +157,4 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
return this; return this;
} }
} }
private static class PreviewArea extends JComponent {
private String paintText = "Report";
private Style style = Style.DEFAULT_STYLE;
public void setStyle(Style style) {
this.style = style;
if (style instanceof NameStyle) {
paintText = ((NameStyle) style).getName();
}
repaint();
}
@Override
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
int resolution = ScreenResolution.getScreenResolution();
g.clipRect(0, 0, getWidth() - 3, getHeight() - 3);
if (style == Style.DEFAULT_STYLE) {
// 如果是默认的style,就只写"Report"上去
Style.paintContent(g2d, paintText, style, getWidth() - 3, getHeight() - 3, resolution);
return;
}
Style.paintBackground(g2d, style, getWidth() - 3, getHeight() - 3);
Style.paintContent(g2d, paintText, style, getWidth() - 3, getHeight() - 3, resolution);
Style.paintBorder(g2d, style, getWidth() - 3, getHeight() - 3);
}
@Override
public Dimension getMinimumSize() {
return getPreferredSize();
}
}
} }

4
designer-realize/src/main/java/com/fr/design/report/NewReportBackgroundPane.java

@ -140,11 +140,11 @@ public class NewReportBackgroundPane extends BasicPane {
} }
}); });
JPanel contentContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel contentContainer = new JPanel(new BorderLayout(IntervalConstants.INTERVAL_L6, 0));
contentContainer.setBorder(BorderFactory.createEmptyBorder()); contentContainer.setBorder(BorderFactory.createEmptyBorder());
contentContainer.setBorder(BorderFactory.createEmptyBorder()); contentContainer.setBorder(BorderFactory.createEmptyBorder());
contentContainer.setPreferredSize(new Dimension(600, 540)); contentContainer.setPreferredSize(new Dimension(600, 540));
contentContainer.add(createLeftPane(), BorderLayout.WEST); contentContainer.add(createLeftPane(), BorderLayout.CENTER);
contentContainer.add(createRightPane(), BorderLayout.EAST); contentContainer.add(createRightPane(), BorderLayout.EAST);
addAttributeChangeListener(new AttributeChangeListener() { addAttributeChangeListener(new AttributeChangeListener() {

42
designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java

@ -1,9 +1,9 @@
package com.fr.design.report; package com.fr.design.report;
import com.fr.base.NameStyle; import com.fr.base.NameStyle;
import com.fr.base.ScreenResolution;
import com.fr.base.Style; import com.fr.base.Style;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.cell.CellStylePreviewPane;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -52,8 +52,6 @@ import java.awt.CardLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
@ -66,7 +64,7 @@ public class ReportStylePane extends BasicPane {
}; };
public static final int DEFAULT_SELECTED_INDEX = 0; public static final int DEFAULT_SELECTED_INDEX = 0;
private final PreviewArea previewArea; private final CellStylePreviewPane previewArea;
private final UIButtonGroup<String> followingThemeButtonGroup; private final UIButtonGroup<String> followingThemeButtonGroup;
private final CustomFloatStyleSettingPane customStylePane; private final CustomFloatStyleSettingPane customStylePane;
private final ThemedCellStyleListPane themedCellStyleListPane; private final ThemedCellStyleListPane themedCellStyleListPane;
@ -78,7 +76,7 @@ public class ReportStylePane extends BasicPane {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
previewArea = new PreviewArea(); previewArea = new CellStylePreviewPane();
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS); followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS);
customStylePane = new CustomFloatStyleSettingPane(); customStylePane = new CustomFloatStyleSettingPane();
themedCellStyleListPane = new ThemedCellStyleListPane(); themedCellStyleListPane = new ThemedCellStyleListPane();
@ -333,40 +331,6 @@ public class ReportStylePane extends BasicPane {
previewArea.setStyle(updateBean()); previewArea.setStyle(updateBean());
} }
private static class PreviewArea extends JComponent {
private static final String paintText = "Report";
private Style style = Style.DEFAULT_STYLE;
public void setStyle(Style style) {
this.style = style;
repaint();
}
@Override
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
int resolution = ScreenResolution.getScreenResolution();
if (style == Style.DEFAULT_STYLE) {
// 如果是默认的style,就只写"Report"上去
Style.paintContent(g2d, paintText, style, getWidth() - 3, getHeight() - 3, resolution);
return;
}
Style.paintBackground(g2d, style, getWidth() - 3, getHeight() - 3);
Style.paintContent(g2d, paintText, style, getWidth() - 3, getHeight() - 3, resolution);
Style.paintBorder(g2d, style, getWidth() - 3, getHeight() - 3);
}
@Override
public Dimension getMinimumSize() {
return getPreferredSize();
}
}
private static class CustomFloatStyleSettingPane extends BasicPane implements ChangeListener { private static class CustomFloatStyleSettingPane extends BasicPane implements ChangeListener {
private static final int ALIGNMENT_INDEX = 1; private static final int ALIGNMENT_INDEX = 1;
private static final int FONT_INDEX = 2; private static final int FONT_INDEX = 2;

9
designer-realize/src/main/java/com/fr/start/common/SplashPane4WinAndJDK11.java

@ -2,6 +2,7 @@ package com.fr.start.common;
import com.bulenkov.iconloader.IconLoader; import com.bulenkov.iconloader.IconLoader;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.locale.impl.DoubleSplashMark;
import com.fr.design.locale.impl.SplashMark; import com.fr.design.locale.impl.SplashMark;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleCenter;
@ -28,25 +29,19 @@ public class SplashPane4WinAndJDK11 extends SplashPane{
*/ */
private boolean isDouble = false; private boolean isDouble = false;
private static final String IMAGE_SPLASH = "splash_10.png";
private static final String IMAGE_SPLASH_DOUBLE = "splash_10@2x.png";
public SplashPane4WinAndJDK11() { public SplashPane4WinAndJDK11() {
this.imagePath = getSplashPath4WinAndJdk11(); this.imagePath = getSplashPath4WinAndJdk11();
} }
private String getSplashPath4WinAndJdk11() { private String getSplashPath4WinAndJdk11() {
String path = (String) LocaleCenter.getMark(SplashMark.class).getValue(); String path = (String) LocaleCenter.getMark(SplashMark.class).getValue();
if (path.contains(IMAGE_SPLASH)) { String pathOfDouble = (String) LocaleCenter.getMark(DoubleSplashMark.class).getValue();
// 为图片加上"@2x" // 为图片加上"@2x"
String pathOfDouble = path.replace(IMAGE_SPLASH, IMAGE_SPLASH_DOUBLE);
// 某些定制jar里面没有两倍图,判断一下,如果文件不存在,就返回一倍图的path // 某些定制jar里面没有两倍图,判断一下,如果文件不存在,就返回一倍图的path
if (IOUtils.readResource(pathOfDouble) != null) { if (IOUtils.readResource(pathOfDouble) != null) {
this.isDouble = true; this.isDouble = true;
return pathOfDouble; return pathOfDouble;
} }
}
return path; return path;
} }

BIN
designer-realize/src/main/resources/com/fr/design/images/splash.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_10.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_10@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 814 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_10_en.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_en.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

BIN
designer-realize/src/main/resources/com/fr/design/images/splash_en@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 KiB

Loading…
Cancel
Save