Browse Source

Merge pull request #5712 in DESIGN/design from release/11.0 to feature/x

* commit 'b5ba2a1324681fd34b2ef52bf81d5d7845a2fabe':
  CHART-20565 图表渐变色更新
  REPORT-58713  加些注释
  REPORT-58503 【主题切换】预览区ui改版
  REPORT-58800 【主题切换】优化主题选择界面 应用主题的交互
  REPORT-58389 【FR11二轮回归】设计器-frm模板撤销/切换主题,设计画布都会变小
  REPORT-58586 FR11-二轮回归-单元格属性-样式-切换成跟随主题后,鼠标无法上滑至顶部
  REPORT-58713 决策报表中公式模拟计算的参数编辑窗口会出现“闪屏”现象
  代码修改
  REPORT-58543【主题切换】字符颜色的主题色控件中的色块没有选中状态
  REPORT-57881 10.0.19一轮冒烟-断网时打开设计器内置帮助文档,日志中没有离线提示
  REPORT-58520 FR11-二轮回归-模板-纸张背景-背景设置显示不全
  REPORT-58539 【主题切换】悬浮元素-样式窗口ui优化
  CHART-20536 图表预定义配色,升级兼容后,主题配色面板内容固定不变
  REPORT-58667 【主题切换】修改模板主题管理的tab名称、窗口名称
  REPORT-58655 复用组件的在线搜索需要在筛选条件下搜索
  REPORT-58395【主题切换】frm主题配置组件标题图案以后,左侧预览图不生效
  CHART-20476 报表块内图表-超链悬浮窗设置项没了
research/11.0
superman 3 years ago
parent
commit
fab530b426
  1. 5
      designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java
  2. 82
      designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java
  3. 1
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java
  4. 11
      designer-base/src/main/java/com/fr/design/login/AbstractDesignerSSO.java
  5. 2
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  6. 20
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java
  7. 9
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeProfilePane.java
  8. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeManageDialog.java
  9. 65
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java
  10. 53
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/cell/CellStyleEditPane.java
  11. 7
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListExtendedPane.java
  12. 11
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListPane.java
  13. 40
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ComponentPreviewPane.java
  14. 7
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/cell/AbstractPreviewCell.java
  15. 1
      designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java
  16. 7
      designer-base/src/main/java/com/fr/design/style/AlignmentPane.java
  17. 5
      designer-base/src/main/java/com/fr/design/style/BorderPane.java
  18. 19
      designer-base/src/main/java/com/fr/design/style/background/BackgroundJComponent.java
  19. 4
      designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java
  20. 5
      designer-base/src/main/java/com/fr/design/style/color/ColorControlWindowWithAuto.java
  21. 132
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java
  22. BIN
      designer-base/src/main/resources/com/fr/design/images/transparent_background.png
  23. 9
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  24. 15
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  25. 5
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/AbstractOnlineWidgetShowPane.java
  26. 4
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  27. 4
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java
  28. 46
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java
  29. 4
      designer-realize/src/main/java/com/fr/design/report/NewReportBackgroundPane.java
  30. 42
      designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java

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

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

@ -0,0 +1,82 @@
package com.fr.design.cell;
import com.fr.base.NameStyle;
import com.fr.base.ScreenResolution;
import com.fr.base.Style;
import com.fr.design.mainframe.theme.TemplateThemeBlock;
import com.fr.general.IOUtils;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/9/3
*/
public class CellStylePreviewPane extends JPanel {
private static final Image transparentBackgroundImage = Toolkit.getDefaultToolkit().createImage(CellStylePreviewPane.class.getResource("/com/fr/design/images/transparent_background.png"));
private final float transparentBackgroundWidth;
private final float transparentBackgroundHeight;
private final float transparentBackgroundAspect;
private String paintText = "Report";
private Style style = Style.DEFAULT_STYLE;
public CellStylePreviewPane() {
transparentBackgroundWidth = transparentBackgroundImage.getWidth(null);
transparentBackgroundHeight = transparentBackgroundImage.getHeight(null);
transparentBackgroundAspect = 1.0F * transparentBackgroundImage.getWidth(null) / transparentBackgroundImage.getHeight(null);
}
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();
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, getWidth() - 3, getHeight() - 3);
}
@Override
public Dimension getMinimumSize() {
return getPreferredSize();
}
}

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);
} }

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;
}
} }

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

@ -625,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();
} }

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

@ -126,15 +126,17 @@ public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane {
} }
private void setSelectedBlock(TemplateThemeBlock<T> block) { private void setSelectedBlock(TemplateThemeBlock<T> block) {
if (selectedBlock != null) { if (selectedBlock != block) {
selectedBlock.setSelected(false); if (selectedBlock != null) {
} selectedBlock.setSelected(false);
selectedBlock = block; }
if (selectedBlock != null) { selectedBlock = block;
selectedBlock.setSelected(true); if (selectedBlock != null) {
} selectedBlock.setSelected(true);
if (changeListener != null) { }
changeListener.fireChanged(new ChangeEvent(this)); if (changeListener != null) {
changeListener.fireChanged(new ChangeEvent(this));
}
} }
} }

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

@ -5,7 +5,6 @@ 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.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.ThemedColorScheme; import com.fr.base.theme.settings.ThemedColorScheme;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
@ -27,12 +26,9 @@ 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;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -44,6 +40,7 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -55,7 +52,6 @@ import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.util.List;
import static com.fr.design.i18n.Toolkit.i18nText; import static com.fr.design.i18n.Toolkit.i18nText;
@ -321,6 +317,9 @@ public abstract class TemplateThemeProfilePane<T extends TemplateTheme> extends
FineColorManager.traverse(theme, replaceByColorScheme); FineColorManager.traverse(theme, replaceByColorScheme);
populateBean(theme); populateBean(theme);
//图表渐变色
chartStyleSettingPane.populateGradientBar(colors);
} }
public void populateBean(T theme) { public void populateBean(T theme) {

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

@ -70,8 +70,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();

65
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;
@ -43,56 +41,27 @@ 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() {
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane();
container.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); container.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
@ -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);
}
}
} }

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);

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

@ -88,10 +88,13 @@ 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);
colorButtons.get(i).setSelectObject(color); colorList.add(color);
if (i < colorCount) {
colorButtons.get(i).setSelectObject(color);
}
} }
} }

40
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;
@ -20,15 +19,20 @@ 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;
@ -67,7 +71,11 @@ public abstract class ComponentPreviewPane extends UINoOpaquePanel implements Th
ThemedComponentStyle componentStyle = theme.getComponentStyle(); ThemedComponentStyle componentStyle = theme.getComponentStyle();
style = componentStyle.getStyle(); style = componentStyle.getStyle();
setBorder(new UIRoundedBorder(style.getBorder(), style.getColor(), style.getBorderRadius())); if (style.getBorder() == 0) {
setBorder(null);
} else {
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();
@ -116,8 +124,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);
@ -145,6 +155,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) {

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());
} }

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();

19
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,16 +31,23 @@ 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;
} }
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);

132
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();
centerPane.add(menuColorPane);
if(isSupportThemeColor){ if (isSupportThemeColor) {
initThemeColorPane(); JPanel themePane = initThemeColorPane();
}else { centerPane.add(themePane);
} else {
centerPane.add(menuColorPane);
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 {
} }
} }
} }

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

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

@ -812,7 +812,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) {
} }

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

@ -664,9 +664,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 +687,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,10 +1189,20 @@ 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);
fireTargetModified(shouldCreateUndoState); fireTargetModified(shouldCreateUndoState);
formDesign.refreshRoot(); formDesign.refreshRoot();
// 刷新界面后恢复原来的尺寸
formDesign.getArea().setAreaSize(areaSize, horizontalValue, verticalValue, widthValue, heightValue, slideValue);
FormHierarchyTreePane.getInstance().refreshRoot(); FormHierarchyTreePane.getInstance().refreshRoot();
if (this.index != FORM_TAB) { if (this.index != FORM_TAB) {
refreshToolArea(); refreshToolArea();

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);
} }

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

@ -774,7 +774,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);

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;
} }

46
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,7 +17,6 @@ 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;
@ -26,8 +25,6 @@ import javax.swing.event.ChangeListener;
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.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.io.Serializable; import java.io.Serializable;
@ -142,7 +139,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 +147,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,41 +159,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();
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;

Loading…
Cancel
Save